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

Subversion Repositories t6507lp

[/] [t6507lp/] [trunk/] [rtl/] [verilog/] [t2600_bus_tb.v] - Blame information for rev 197

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

Line No. Rev Author Line
1 191 creep
////////////////////////////////////////////////////////////////////////////
2
////                                                                    ////
3
//// t2600 IP Core                                                      ////
4
////                                                                    ////
5
//// This file is part of the t2600 project                             ////
6
//// http://www.opencores.org/cores/t2600/                              ////
7
////                                                                    ////
8
//// Description                                                        ////
9
//// Bus controller testbench                                           ////
10
////                                                                    ////
11
//// TODO:                                                              ////
12
//// - Nothing                                                          ////
13
////                                                                    ////
14
//// Author(s):                                                         ////
15
//// - Gabriel Oshiro Zardo, gabrieloshiro@gmail.com                    ////
16
//// - Samuel Nascimento Pagliarini (creep), snpagliarini@gmail.com     ////
17
////                                                                    ////
18
////////////////////////////////////////////////////////////////////////////
19
////                                                                    ////
20
//// Copyright (C) 2001 Authors and OPENCORES.ORG                       ////
21
////                                                                    ////
22
//// This source file may be used and distributed without               ////
23
//// restriction provided that this copyright statement is not          ////
24
//// removed from the file and that any derivative work contains        ////
25
//// the original copyright notice and the associated disclaimer.       ////
26
////                                                                    ////
27
//// This source file is free software; you can redistribute it         ////
28
//// and/or modify it under the terms of the GNU Lesser General         ////
29
//// Public License as published by the Free Software Foundation;       ////
30
//// either version 2.1 of the License, or (at your option) any         ////
31
//// later version.                                                     ////
32
////                                                                    ////
33
//// This source is distributed in the hope that it will be             ////
34
//// useful, but WITHOUT ANY WARRANTY; without even the implied         ////
35
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR            ////
36
//// PURPOSE. See the GNU Lesser General Public License for more        ////
37
//// details.                                                           ////
38
////                                                                    ////
39
//// You should have received a copy of the GNU Lesser General          ////
40
//// Public License along with this source; if not, download it         ////
41
//// from http://www.opencores.org/lgpl.shtml                           ////
42
////                                                                    ////
43
////////////////////////////////////////////////////////////////////////////
44
 
45
`include "timescale.v"
46
module t2600_bus_tb();
47
        parameter [3:0] DATA_SIZE = 4'd8;
48
        parameter [3:0] ADDR_SIZE = 4'd13;
49
 
50
        localparam [3:0] DATA_SIZE_ = DATA_SIZE - 4'd1;
51
        localparam [3:0] ADDR_SIZE_ = ADDR_SIZE - 4'd1;
52
        localparam [3:0] RIOT_ADDR_SIZE_ = 4'd6;
53
        localparam [3:0] TIA_ADDR_SIZE_ = 4'd5;
54
 
55
        // these 3 registers are kind of drivers/wrappers for the tristate ones
56
        reg [DATA_SIZE_:0] riot_data_drvr;
57
        reg [DATA_SIZE_:0] rom_data_drvr;
58
        reg [DATA_SIZE_:0] tia_data_drvr;
59
 
60
        // list of all the inputs/outputs of the bus controller
61
        reg [ADDR_SIZE_:0] address;
62
        reg [DATA_SIZE_:0] data_from_cpu;
63
        reg cpu_rw_mem;
64
        tri [DATA_SIZE_:0] riot_data = riot_data_drvr;
65
        tri [DATA_SIZE_:0] rom_data = rom_data_drvr;
66
        tri [DATA_SIZE_:0] tia_data = tia_data_drvr;
67
        wire [RIOT_ADDR_SIZE_:0] address_riot;
68
        wire [ADDR_SIZE_:0] address_rom;
69
        wire [TIA_ADDR_SIZE_:0] address_tia;
70
        wire[DATA_SIZE_:0] data_to_cpu;
71
        wire enable_riot;
72
        wire enable_rom;
73
        wire enable_tia;
74
        wire rw_mem;
75
 
76
        t2600_bus t2600_bus (
77
                .address        (address),
78
                .data_from_cpu  (data_from_cpu),
79
                .cpu_rw_mem     (cpu_rw_mem),
80
                .riot_data      (riot_data),
81
                .rom_data       (rom_data),
82
                .tia_data       (tia_data),
83
                .address_riot   (address_riot),
84
                .address_rom    (address_rom),
85
                .address_tia    (address_tia),
86
                .data_to_cpu    (data_to_cpu),
87
                .enable_riot    (enable_riot),
88
                .enable_rom     (enable_rom),
89
                .enable_tia     (enable_tia),
90
                .rw_mem         (rw_mem)
91
        );
92
 
93
        always @(*) begin
94
                if (cpu_rw_mem == 1) begin
95
                        tia_data_drvr = 8'hZ;
96
                        riot_data_drvr = 8'hZ;
97
                        rom_data_drvr = 8'hZ;
98
                end
99
        end
100
 
101
        // this block is clockless so I cannot use @(negedge clk)
102
        initial begin
103
                address = 13'b0;
104
                data_from_cpu = 8'h01;
105
                cpu_rw_mem = 1'b0; // READ
106
 
107
                #10;
108
                address = 13'd8; // this is a TIA adress
109
 
110
                #10;
111
                address = 13'd128; // this is a RIOT adress
112
 
113
                #10;
114
                address = 13'd4096; // this is a ROM adress
115
 
116
                #10;
117
                cpu_rw_mem = 1'b1; // from now on I will be writing
118
                riot_data_drvr = 8'h02;
119
                rom_data_drvr = 8'h03;
120
                tia_data_drvr = 8'h04;
121
                address = 13'd8; // this is a TIA adress
122
 
123
                #10;
124
                address = 13'd128; // this is a RIOT adress
125
 
126
                #10;
127
                address = 13'd4096; // this is a ROM adress
128
 
129
                #10;
130
                $finish();
131
        end
132
endmodule

powered by: WebSVN 2.1.0

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