|  | 
 
 发表于 2019-3-7 18:47:48
|
显示全部楼层 
| 或者可用试试这样 
 
 
 
    
        复制代码
     、include"constants.h"    、include"disciplines.h"
    module RDAC(A,B,CLK);
    input CLK;
    voltage CLK;
    inout A,B;
    electrical A,B;
    integer cnt;
    real rval;
    parameter integer K=50;
    analog begin
    @cross(V(CLK) -0.5,+1.0)
             
    if(cnt>=K)
           cnt=0;
    else
            cnt=cnt+1;
    end
    case(cnt)
    0: rval=1k;
    1: rval=2k;
    ....
    
V(A,B)<+ rval*I(A,B);
endmodule
 | 
 |