mirror of
https://github.com/tillitis/tillitis-key1.git
synced 2024-12-24 15:09:27 -05:00
Cleanup of tb for timer core
Signed-off-by: Joachim Strömbergson <joachim@assured.se>
This commit is contained in:
parent
60efb3c25e
commit
f020495695
@ -35,10 +35,9 @@ module tb_timer_core();
|
|||||||
|
|
||||||
reg tb_clk;
|
reg tb_clk;
|
||||||
reg tb_reset_n;
|
reg tb_reset_n;
|
||||||
reg tb_start;
|
reg [31 : 0] tb_prescaler_init;
|
||||||
reg tb_stop;
|
reg [31 : 0] tb_timer_init;
|
||||||
reg [31 : 0] tb_prescaler;
|
reg tb_start_stop;
|
||||||
reg [31 : 0] tb_timer;
|
|
||||||
wire [31 : 0] tb_curr_timer;
|
wire [31 : 0] tb_curr_timer;
|
||||||
wire tb_ready;
|
wire tb_ready;
|
||||||
|
|
||||||
@ -49,10 +48,9 @@ module tb_timer_core();
|
|||||||
timer_core dut(
|
timer_core dut(
|
||||||
.clk(tb_clk),
|
.clk(tb_clk),
|
||||||
.reset_n(tb_reset_n),
|
.reset_n(tb_reset_n),
|
||||||
.prescaler_value(tb_prescaler),
|
.prescaler_init(tb_prescaler_init),
|
||||||
.timer_value(tb_timer),
|
.timer_init(tb_timer_init),
|
||||||
.start(tb_start),
|
.start_stop(tb_start_stop),
|
||||||
.stop(tb_stop),
|
|
||||||
.curr_timer(tb_curr_timer),
|
.curr_timer(tb_curr_timer),
|
||||||
.ready(tb_ready)
|
.ready(tb_ready)
|
||||||
);
|
);
|
||||||
@ -99,10 +97,10 @@ module tb_timer_core();
|
|||||||
$display("Cycle: %08d", cycle_ctr);
|
$display("Cycle: %08d", cycle_ctr);
|
||||||
$display("");
|
$display("");
|
||||||
$display("Inputs and outputs:");
|
$display("Inputs and outputs:");
|
||||||
$display("start: 0x%1x, stop: 0x%1x, ready: 0x%1x",
|
$display("prescaler_init: 0x%08x, timer_init: 0x%08x",
|
||||||
dut.start, dut.stop, dut.ready);
|
dut.prescaler_init, dut.timer_init);
|
||||||
$display("prescaler_value: 0x%08x, timer_value: 0x%08x",
|
$display("start_stop: 0x%1x, ready: 0x%1x",
|
||||||
dut.prescaler_value, dut.timer_value);
|
dut.start_stop, dut.ready);
|
||||||
$display("");
|
$display("");
|
||||||
$display("Internal state:");
|
$display("Internal state:");
|
||||||
$display("prescaler_reg: 0x%08x, prescaler_new: 0x%08x",
|
$display("prescaler_reg: 0x%08x, prescaler_new: 0x%08x",
|
||||||
@ -174,28 +172,23 @@ module tb_timer_core();
|
|||||||
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
||||||
task init_sim;
|
task init_sim;
|
||||||
begin
|
begin
|
||||||
cycle_ctr = 0;
|
cycle_ctr = 0;
|
||||||
error_ctr = 0;
|
error_ctr = 0;
|
||||||
tc_ctr = 0;
|
tc_ctr = 0;
|
||||||
tb_monitor = 0;
|
tb_monitor = 0;
|
||||||
|
|
||||||
tb_clk = 0;
|
tb_clk = 0;
|
||||||
tb_reset_n = 1;
|
tb_reset_n = 1;
|
||||||
|
|
||||||
tb_start = 1'h0;
|
tb_start_stop = 1'h0;
|
||||||
tb_stop = 1'h0;
|
tb_prescaler_init = 32'h0;
|
||||||
tb_prescaler = 32'h0;
|
tb_timer_init = 32'h0;
|
||||||
tb_timer = 32'h0;
|
|
||||||
end
|
end
|
||||||
endtask // init_sim
|
endtask // init_sim
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
||||||
// test()
|
// test1()
|
||||||
// Runs an encipher, decipher test with given key and plaintext
|
|
||||||
// The generated ciphertext is verified with the given ciphertet.
|
|
||||||
// The generated plaintxt is also verified against the
|
|
||||||
// given plaintext.
|
|
||||||
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
||||||
task test1;
|
task test1;
|
||||||
begin
|
begin
|
||||||
@ -204,12 +197,12 @@ module tb_timer_core();
|
|||||||
|
|
||||||
$display("--- test1 started.");
|
$display("--- test1 started.");
|
||||||
dump_dut_state();
|
dump_dut_state();
|
||||||
tb_prescaler = 32'h6;
|
tb_prescaler_init = 32'h6;
|
||||||
tb_timer = 32'h9;
|
tb_timer_init = 32'h9;
|
||||||
#(CLK_PERIOD);
|
#(CLK_PERIOD);
|
||||||
tb_start = 1'h1;
|
tb_start_stop = 1'h1;
|
||||||
#(CLK_PERIOD);
|
#(CLK_PERIOD);
|
||||||
tb_start = 1'h0;
|
tb_start_stop = 1'h0;
|
||||||
wait_ready();
|
wait_ready();
|
||||||
#(CLK_PERIOD);
|
#(CLK_PERIOD);
|
||||||
tb_monitor = 0;
|
tb_monitor = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user