diff --git a/ch4/motorcontrol.sv b/ch4/motorcontrol.sv index d66eb83..3539434 100644 --- a/ch4/motorcontrol.sv +++ b/ch4/motorcontrol.sv @@ -1,3 +1,5 @@ +`timescale 1ns/1ps + module motorcontrol #(parameter N=21) (input logic clk, input logic rst, @@ -37,6 +39,11 @@ module motorcontrol #(parameter N=21) pwm = 0; next_state = state; end + default: + begin + pwm = 0; + next_state = reset; + end endcase end endmodule diff --git a/ch4/motorcontrol_tb.sv b/ch4/motorcontrol_tb.sv index 1f71d1e..5894a36 100644 --- a/ch4/motorcontrol_tb.sv +++ b/ch4/motorcontrol_tb.sv @@ -18,12 +18,15 @@ module motorcontrol_tb(); clk = 0; initial begin - rst = 1; direction = 0; - #10; rst = 0; - #19999990; rst = 1; direction = 1; - #10; rst = 0; - #19999990; rst = 1; - #10; rst = 0; + $dumpfile("output.vcd"); + $dumpvars; + rst = 1; direction = 0; + #10; rst = 0; + #19999990; rst = 1; direction = 1; + #10; rst = 0; + #19999990; rst = 1; + #10; rst = 0; + $finish; end endmodule