Hello, I'm trying to create a DAC based on a real circuit. This will be used to speed-up sims of a bigger system.
I am using CASE to evaluate each input word and then assign the correct voltage value (based on sims results).
I have not been successful so far implementing the DAC with using CASE, it looks like it does not evaluate correctly the options.
Code:input [2:0] i_ddrvrefctrlqnnnh;
output vref_a;
electrical vref_a;
electrical [2:0] i_ddrvrefctrlqnnnh;
analog begin
//@(initial_step) begin
// @(i_ddrvrefctrlqnnnh) begin
case(i_ddrvrefctrlqnnnh)
// 0 : vout= 0.1;
001 : vout= 0.2;
2 : vout= 0.3;
3 : vout=0.4;
4 : vout=0.5;
// 5 : vout=0.6;
// 6 : vout=0.7;
// 7 : vout=0.8;
default : vout=1;
endcase
V(vref_a)<+(vout);
// end
end
endmodule
Some lines are commented as part of the trial/error I've been doing.
I commented the first CASE-option and the result is always the "default" value. If I do not comment the first CASE-option, it always take the first option, never the following ones.
The second CASE-option was put in binary mode, looking to have a result there (that's why the difference with the others)
I'm testing this in a DC sim in spectre.
Regards,
Guile