1 |
15 |
ste.fis |
////////////////////////////////////////////////////////////////////////////////
|
2 |
|
|
// This sourcecode is released under BSD license.
|
3 |
|
|
// Please see http://www.opensource.org/licenses/bsd-license.php for details!
|
4 |
|
|
////////////////////////////////////////////////////////////////////////////////
|
5 |
|
|
//
|
6 |
|
|
// Copyright (c) 2010, Stefan Fischer <Ste.Fis@OpenCores.org>
|
7 |
|
|
// All rights reserved.
|
8 |
|
|
//
|
9 |
|
|
// Redistribution and use in source and binary forms, with or without
|
10 |
|
|
// modification, are permitted provided that the following conditions are met:
|
11 |
|
|
//
|
12 |
|
|
// * Redistributions of source code must retain the above copyright notice,
|
13 |
|
|
// this list of conditions and the following disclaimer.
|
14 |
|
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
15 |
|
|
// this list of conditions and the following disclaimer in the documentation
|
16 |
31 |
ste.fis |
// and/or other materials provided with the distribution.
|
17 |
15 |
ste.fis |
//
|
18 |
|
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
19 |
|
|
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
20 |
|
|
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
21 |
|
|
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
22 |
|
|
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
23 |
|
|
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
24 |
|
|
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
25 |
|
|
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
26 |
|
|
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
27 |
|
|
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
28 |
|
|
// POSSIBILITY OF SUCH DAMAGE.
|
29 |
|
|
//
|
30 |
|
|
////////////////////////////////////////////////////////////////////////////////
|
31 |
|
|
// filename: picoblaze_wb_uart_tb.v
|
32 |
|
|
// description: testbench for picoblaze_wb_uart example
|
33 |
|
|
// todo4user: modify stimulus as needed
|
34 |
|
|
// version: 0.0.0
|
35 |
|
|
// changelog: - 0.0.0, initial release
|
36 |
|
|
// - ...
|
37 |
|
|
////////////////////////////////////////////////////////////////////////////////
|
38 |
|
|
|
39 |
|
|
|
40 |
|
|
`uselib lib = unisims_ver
|
41 |
|
|
|
42 |
|
|
`timescale 1 ns / 1 ps
|
43 |
|
|
|
44 |
|
|
|
45 |
|
|
module picoblaze_wb_uart_tb;
|
46 |
|
|
|
47 |
|
|
reg rst_n;
|
48 |
|
|
reg clk;
|
49 |
|
|
|
50 |
|
|
wire uart_rx_si;
|
51 |
|
|
wire uart_tx_so;
|
52 |
|
|
|
53 |
|
|
parameter PERIOD = 20;
|
54 |
|
|
|
55 |
18 |
ste.fis |
// system signal generation
|
56 |
15 |
ste.fis |
initial begin
|
57 |
|
|
clk = 1'b1;
|
58 |
|
|
rst_n = 1'b0;
|
59 |
|
|
#(PERIOD*2) rst_n = 1'b1;
|
60 |
|
|
end
|
61 |
|
|
always #(PERIOD/2) clk = ! clk;
|
62 |
|
|
|
63 |
|
|
// simple serial loopback
|
64 |
|
|
assign uart_rx_si = uart_tx_so;
|
65 |
|
|
|
66 |
18 |
ste.fis |
// design under test instance
|
67 |
15 |
ste.fis |
picoblaze_wb_uart dut (
|
68 |
|
|
.p_rst_n_i(rst_n),
|
69 |
|
|
.p_clk_i(clk),
|
70 |
|
|
|
71 |
|
|
.p_uart_rx_si_i(uart_rx_si),
|
72 |
|
|
.p_uart_tx_so_o(uart_tx_so)
|
73 |
|
|
);
|
74 |
|
|
|
75 |
|
|
endmodule
|