OpenCores
URL https://opencores.org/ocsvn/t6507lp/t6507lp/trunk

Subversion Repositories t6507lp

[/] [t6507lp/] [trunk/] [rtl/] [verilog/] [t6532_tb.v] - Blame information for rev 203

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 203 creep
////////////////////////////////////////////////////////////////////////////
2
////                                                                    ////
3
//// T6532 IP Core                                                      ////
4
////                                                                    ////
5
//// This file is part of the T2600 project                             ////
6
//// http://www.opencores.org/cores/t2600/                              ////
7
////                                                                    ////
8
//// Description                                                        ////
9
//// 6532 testbench                                                     ////
10
////                                                                    ////
11
//// Author(s):                                                         ////
12
//// - Gabriel Oshiro Zardo, gabrieloshiro@gmail.com                    ////
13
//// - Samuel Nascimento Pagliarini (creep), snpagliarini@gmail.com     ////
14
////                                                                    ////
15
////////////////////////////////////////////////////////////////////////////
16
////                                                                    ////
17
//// Copyright (C) 2001 Authors and OPENCORES.ORG                       ////
18
////                                                                    ////
19
//// This source file may be used and distributed without               ////
20
//// restriction provided that this copyright statement is not          ////
21
//// removed from the file and that any derivative work contains        ////
22
//// the original copyright notice and the associated disclaimer.       ////
23
////                                                                    ////
24
//// This source file is free software; you can redistribute it         ////
25
//// and/or modify it under the terms of the GNU Lesser General         ////
26
//// Public License as published by the Free Software Foundation;       ////
27
//// either version 2.1 of the License, or (at your option) any         ////
28
//// later version.                                                     ////
29
////                                                                    ////
30
//// This source is distributed in the hope that it will be             ////
31
//// useful, but WITHOUT ANY WARRANTY; without even the implied         ////
32
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR            ////
33
//// PURPOSE. See the GNU Lesser General Public License for more        ////
34
//// details.                                                           ////
35
////                                                                    ////
36
//// You should have received a copy of the GNU Lesser General          ////
37
//// Public License along with this source; if not, download it         ////
38
//// from http://www.opencores.org/lgpl.shtml                           ////
39
////                                                                    ////
40
////////////////////////////////////////////////////////////////////////////
41
 
42
`include "timescale.v"
43
 
44
module t6532_tb();
45
        // mem_rw signals
46
        localparam MEM_READ = 1'b0;
47
        localparam MEM_WRITE = 1'b1;
48
 
49
        parameter [3:0] DATA_SIZE = 4'd8;
50
        parameter [3:0] ADDR_SIZE = 4'd10; // this is the *local* addr_size
51
 
52
        localparam [3:0] DATA_SIZE_ = DATA_SIZE - 4'd1;
53
        localparam [3:0] ADDR_SIZE_ = ADDR_SIZE - 4'd1;
54
 
55
        reg clk; // regs are inputs
56
        reg reset_n;
57
        reg [15:0] io_lines;
58
        reg enable;
59
        reg mem_rw;
60
        reg [ADDR_SIZE_:0] address;
61
 
62
        reg [DATA_SIZE_:0] data_drv;
63
        tri [DATA_SIZE_:0] data = data_drv;
64
 
65
        t6532 #(DATA_SIZE, ADDR_SIZE) t6532(
66
                .clk            (clk),
67
                .reset_n        (reset_n),
68
                .io_lines       (io_lines),
69
                .enable         (enable),
70
                .mem_rw         (mem_rw),
71
                .address        (address),
72
                .data           (data)
73
        );
74
 
75
        always #10 clk = ~clk;
76
 
77
        always @(*) begin
78
                if (mem_rw == MEM_READ) begin
79
                        data_drv = 8'hZ;
80
                end
81
        end
82
 
83
        initial begin
84
                clk = 1'b0;
85
                reset_n = 1'b0;
86
                io_lines = 15'd0;
87
                enable = 1'b0;
88
                mem_rw = MEM_READ;
89
                address = 0;
90
 
91
                @(negedge clk) // will wait for next negative edge of the clock (t=20)
92
                reset_n=1'b1;
93
 
94
 
95
                #4000;
96
                $finish; // to shut down the simulation
97
        end //initial
98
 
99
endmodule

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.