Simulate a digital to analog converter in ModelSim

Status
Not open for further replies.

gnoble29

Member level 1
Joined
Jun 30, 2010
Messages
38
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
india
Activity points
1,528
Is there a way to simulate a digital to analog converter in ModelSim????? I have my Verilog code that produces the 16 bit input to a DAC . It would be really nice if I could somehow see the analog waveform in simulation...
 

Is there a way to simulate a digital to analog converter in ModelSim????? I have my Verilog code that produces the 16 bit input to a DAC . It would be really nice if I could somehow see the analog waveform in simulation...

Take the 16 bit input and divide it by the full scale range and then multiply by the full scale output range. For example, if the 16 bit input you mentioned is meant to represent 0-65535 and the DAC produces an output that is between 0 and 3.3 Volts then the conversion would be

Vout <= 3.3 * real(to_integer(unsigned(Dac_input)) / 65535.0); -- (VHDL, don't know Verilog)

Where Dac_input is std_logic_vector(15 downto 0); (i.e. the 16 bit DAC input)
Vout is type real

I'd be surprised that your DAC would have a 16 bit parallel input, but that is your problem statement. Assuming it doesn't then the real DAC input is probably some form of serial stream in which case you then would need to create a serial to parallel conversion that produces the signal Dac_input.

Kevin Jennings
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…