mirror of
https://github.com/tillitis/tillitis-key1.git
synced 2025-02-07 02:25:30 -05:00
(fpga) Simplify code, improve commenst in tb.
Change names of states and remove redundant state. Fix comments and printout to clarify. Signed-off-by: Joachim Strömbergson <joachim@assured.se>
This commit is contained in:
parent
de4db95bb0
commit
2d0c1b5ab6
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user