mirror of
https://github.com/retroSoC/uart.git
synced 2026-11-04 22:32:39 +00:00
feat: add all testbench files
This commit is contained in:
4 files changed
+148
No files matched your search
@@ -0,0 +1,48 @@
|
||||
// Copyright (c) 2023 Beijing Institute of Open Source Chip
|
||||
// uart is licensed under Mulan PSL v2.
|
||||
// You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
// You may obtain a copy of Mulan PSL v2 at:
|
||||
// http://license.coscl.org.cn/MulanPSL2
|
||||
// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
// EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
// MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
// See the Mulan PSL v2 for more details.
|
||||
|
||||
`include "apb4_if.sv"
|
||||
`include "uart_define.sv"
|
||||
|
||||
module apb4_uart_tb ();
|
||||
localparam CLK_PEROID = 10;
|
||||
logic rst_n_i, clk_i;
|
||||
|
||||
initial begin
|
||||
clk_i = 1'b0;
|
||||
forever begin
|
||||
#(CLK_PEROID / 2) clk_i <= ~clk_i;
|
||||
end
|
||||
end
|
||||
|
||||
task sim_reset(int delay);
|
||||
rst_n_i = 1'b0;
|
||||
repeat (delay) @(posedge clk_i);
|
||||
#1 rst_n_i = 1'b1;
|
||||
endtask
|
||||
|
||||
initial begin
|
||||
sim_reset(40);
|
||||
end
|
||||
|
||||
apb4_if u_apb4_if (
|
||||
clk_i,
|
||||
rst_n_i
|
||||
);
|
||||
|
||||
uart_if u_uart_if ();
|
||||
|
||||
test_top u_test_top (.apb4(u_apb4_if.master));
|
||||
apb4_uart u_apb4_uart (
|
||||
.apb4(u_apb4_if.slave),
|
||||
.uart(u_uart_if.dut)
|
||||
);
|
||||
|
||||
endmodule
|
||||
Reference in new issue
Block a user