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

46 lines
1.6 KiB
Coq
Raw Normal View History

2022-12-22 15:20:49 +03:00
`timescale 1 ps / 1 ps
module niosII_tb (
);
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
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
2022-12-22 17:32:08 +03:00
.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
);
altera_avalon_clock_source #(
.CLOCK_RATE (50000000),
.CLOCK_UNIT (1)
) niosii_inst_clk_bfm (
.clk (niosii_inst_clk_bfm_clk_clk) // clk.clk
);
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
);
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;
end
end
endmodule