parameter real I = 6E-9; //基准电流
real iout; //内部电流变量;
always @(*) begin
case (Ain) //根据输入编码决定iout的值
2'b00: begin iout = 5.0; end
2'b01: begin iout = 4.0; end
2'b11: begin iout = 3.0; end
2'b11: begin iout = 2.0; end
endcase
end
analog
I(Iout) <+ iout*I;//通过Iout和基准电流相乘得到最后输出电流
end