diff options
author | Brian Woods | 2023-04-12 12:55:22 -0400 |
---|---|---|
committer | Brian Woods | 2023-04-12 12:55:22 -0400 |
commit | 68083e9e02744022631d5b77e119f8d0fcb306b8 (patch) | |
tree | 2269ea10e709218a12b2854af8dcacb6e72a0696 /mixed_hdl/simulation.v | |
parent | 2e5b437fc94aa989ca81aa820739178281d218d8 (diff) |
This isn't fully mixed but rather it supports VHDL modiles in a verilog
simulation. You can't have verilog undernearth the VHDL either. It
uses the ghdl (v3 or higher) synth option to synth the VHDL top modules
to verilog and then it uses those with Icarus.
Diffstat (limited to 'mixed_hdl/simulation.v')
-rw-r--r-- | mixed_hdl/simulation.v | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/mixed_hdl/simulation.v b/mixed_hdl/simulation.v new file mode 100644 index 0000000..6b6e298 --- /dev/null +++ b/mixed_hdl/simulation.v @@ -0,0 +1,41 @@ +module simulation; + + reg rst = 0; + reg clk = 0; + reg en = 0; + wire [7:0] count; + wire [7:0] out_data; + wire dr; + + /* Make a reset that pulses once. */ + initial begin + $dumpfile("simulation.vcd"); + $dumpvars(0, simulation); + + # 17 rst = 1; + # 11 rst = 0; + # 29 rst = 1; + # 11 rst = 0; + //# 100 $stop; + # 1000 $finish; + end + + /* Make a regular pulsing clock. */ + always #5 clk = !clk; + + initial begin + #60 + forever #10 en = !en; + end + + top top_logic (count, + out_data, + dr, + en, + rst, + clk); + + initial + $monitor("At time %t, value = %h (%0d)", + $time, out_data, out_data); +endmodule // simulation |