fpga-lab-2/Top/niosII/testbench/niosII_tb/simulation/niosII_tb.v

65 lines
2.1 KiB
Coq
Raw Normal View History

2022-12-22 15:20:49 +03:00
`timescale 1 ps / 1 ps
module niosII_tb (
2022-12-24 02:08:20 +03:00
);
2022-12-22 15:20:49 +03:00
2022-12-24 02:08:20 +03:00
wire niosii_inst_clk_bfm_clk_clk; // niosII_inst_clk_bfm:clk -> [niosII_inst:clk_clk, niosII_inst_reset_bfm:clk]
wire niosii_inst_reset_bfm_reset_reset; // niosII_inst_reset_bfm:reset -> niosII_inst:reset_reset_n
2022-12-22 17:32:08 +03:00
reg train;
wire red, yellow, green;
2022-12-22 15:20:49 +03:00
2022-12-24 02:08:20 +03:00
niosII niosii_inst
(
.clk_clk (niosii_inst_clk_bfm_clk_clk), // clk.clk
.reset_reset_n (niosii_inst_reset_bfm_reset_reset), // reset.reset_n
.sem_export_train (train), // sem_export.train
.sem_export_red (red), // .red
.sem_export_yellow (yellow), // .yellow
.sem_export_green (green) // .green
);
2022-12-22 15:20:49 +03:00
2022-12-24 02:08:20 +03:00
altera_avalon_clock_source
#(
.CLOCK_RATE (50000000),
.CLOCK_UNIT (1)
)
niosii_inst_clk_bfm
(
.clk (niosii_inst_clk_bfm_clk_clk) // clk.clk
);
2022-12-22 15:20:49 +03:00
2022-12-24 02:08:20 +03:00
altera_avalon_reset_source
#(
.ASSERT_HIGH_RESET (0),
.INITIAL_RESET_CYCLES (50)
)
niosii_inst_reset_bfm
(
.reset (niosii_inst_reset_bfm_reset_reset), // reset.reset_n
.clk (niosii_inst_clk_bfm_clk_clk) // clk.clk
);
2022-12-22 15:20:49 +03:00
initial begin
train = 0;
wait (niosii_inst_reset_bfm_reset_reset);
forever begin
2022-12-22 17:32:08 +03:00
repeat (29000) @(posedge niosii_inst_clk_bfm_clk_clk);
2022-12-22 15:20:49 +03:00
train = 1;
2022-12-22 17:32:08 +03:00
repeat (10) @(posedge niosii_inst_clk_bfm_clk_clk);
2022-12-22 15:20:49 +03:00
train = 0;
2022-12-24 02:08:20 +03:00
repeat (900) @(posedge niosii_inst_clk_bfm_clk_clk);
train = 1;
repeat (10) @(posedge niosii_inst_clk_bfm_clk_clk);
train = 0;
repeat (900) @(posedge niosii_inst_clk_bfm_clk_clk);
train = 1;
repeat (10) @(posedge niosii_inst_clk_bfm_clk_clk);
train = 0;
repeat (900) @(posedge niosii_inst_clk_bfm_clk_clk);
train = 1;
repeat (10) @(posedge niosii_inst_clk_bfm_clk_clk);
train = 0;
2022-12-22 15:20:49 +03:00
end
end
endmodule