diff --git a/hw/application_fpga/core/timer/rtl/timer_core.v b/hw/application_fpga/core/timer/rtl/timer_core.v index 9830dba..f52a4cb 100644 --- a/hw/application_fpga/core/timer/rtl/timer_core.v +++ b/hw/application_fpga/core/timer/rtl/timer_core.v @@ -31,9 +31,8 @@ module timer_core( //---------------------------------------------------------------- // Internal constant and parameter definitions. //---------------------------------------------------------------- - localparam CTRL_IDLE = 2'h0; - localparam CTRL_PRESCALER = 2'h1; - localparam CTRL_TIMER = 2'h2; + localparam CTRL_IDLE = 1'h0; + localparam CTRL_RUNNING = 1'h1; //---------------------------------------------------------------- @@ -55,8 +54,8 @@ module timer_core( reg timer_rst; reg timer_inc; - reg [1 : 0] core_ctrl_reg; - reg [1 : 0] core_ctrl_new; + reg core_ctrl_reg; + reg core_ctrl_new; reg core_ctrl_we; @@ -160,13 +159,13 @@ module timer_core( prescaler_rst = 1'h1; timer_rst = 1'h1; - core_ctrl_new = CTRL_PRESCALER; + core_ctrl_new = CTRL_RUNNING; core_ctrl_we = 1'h1; end end - CTRL_PRESCALER: begin + CTRL_RUNNING: begin if (stop) begin running_new = 1'h0; running_we = 1'h1; diff --git a/hw/application_fpga/core/timer/tb/tb_timer_core.v b/hw/application_fpga/core/timer/tb/tb_timer_core.v index fe2df9d..34eeeb6 100644 --- a/hw/application_fpga/core/timer/tb/tb_timer_core.v +++ b/hw/application_fpga/core/timer/tb/tb_timer_core.v @@ -215,6 +215,8 @@ module tb_timer_core(); //---------------------------------------------------------------- // test1() + // + // Test that the timer can count to a specified number of cycles. //---------------------------------------------------------------- task test1; begin : test1 @@ -225,7 +227,7 @@ module tb_timer_core(); tc_ctr = tc_ctr + 1; $display("--- test1: Run timer to set value started."); - $display("--- test1: prescaler: 6, timer: 9. Should take 6*9 + 1 = 55 cycles.."); + $display("--- test1: prescaler: 6, timer: 9. Should take 6*9 + 1 = 55 cycles."); tb_prescaler_init = 32'h6; tb_timer_init = 32'h9; test1_expected_num_cycles = tb_prescaler_init * tb_timer_init + 1;