Altera_Forum
Honored Contributor
12 years agoModelsim ASE: different results for gate-level simulation of VHDL and Verilog netlist
Hello.
I am trying to simulate simple Quartus II project for Cyclone II with M4K memory block in modelsim (test_mem.zip in attachment). I am setting VHDL output format for netlist and compiling the project. Then I am running Modelsim ASE, changing directory to simulation/custom and running the followng sequence of commands:vlib workvmap work work
vcom -reportprogress 300 -work work test_mem.vho
vsim -L cycloneii -voptargs=+acc -t ns work.test_mem
add wave -position end sim:/test_mem/clk
add wave -position end sim:/test_mem/address
add wave -position end sim:/test_mem/leds
force -freeze sim:/test_mem/clk 0 0, 1 {20 ns} -r 40ns
force -freeze sim:/test_mem/address 00000000 0
run 200ns In the Wave window I can see the following result: (see attachment modelsim1.jpg) This is what I expected: after first clk rising edge there is a value 0x01 on data bus (which is stored at memory at address 0x0) Now I am changing netlist output format to Verilog HDL and recompiling Quartus II project. Then I am stopping previous simulation and running following sequence of commands in Modelsim: vlib workvmap work work
vlog -reportprogress 300 -work work test_mem.vo
vsim -L cycloneii_ver -voptargs=+acc -t ns work.test_mem
add wave -position end sim:/test_mem/clk
add wave -position end sim:/test_mem/address
add wave -position end sim:/test_mem/leds
force -freeze sim:/test_mem/clk 0 0, 1 {20 ns} -r 40ns
force -freeze sim:/test_mem/address 00000000 0
run 200ns In the Wave window I see different result! (see attachment modelsim2.jpg) After first clk rising edge there is a zeros on data bus! ANd value from address 0x0 appears on data bus only after second clk rising edge. (After more experiments I found that this is not additional memory latency. It is only returns zeros only after first rising clk edge). Is it correct behaviour of Modelsim? Maybe I should set some settings for Verilog simulation? (I tried to set simulator tool from custom to Modelsim in Quartus II. Result is same). Also attaching directory with two generated netlists for simulation (tm2.zip)