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

Subversion Repositories m65c02

[/] [m65c02/] [trunk/] [Sim/] [tb_M65C02_RAM.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 MichaelA
///////////////////////////////////////////////////////////////////////////////
2
//
3
//  Copyright 2006-2012 by Michael A. Morris, dba M. A. Morris & Associates
4
//
5
//  All rights reserved. The source code contained herein is publicly released
6
//  under the terms an conditions of the GNU Lesser Public License. No part of
7
//  this source code may be reproduced or transmitted in any form or by any
8
//  means, electronic or mechanical, including photocopying, recording, or any
9
//  information storage and retrieval system in violation of the license under
10
//  which the source code is released.
11
//
12
//  The source code contained herein is free; it may be redistributed and/or 
13
//  modified in accordance with the terms of the GNU Lesser General Public
14
//  License as published by the Free Software Foundation; either version 2.1 of
15
//  the GNU Lesser General Public License, or any later version.
16
//
17
//  The source code contained herein is freely released WITHOUT ANY WARRANTY;
18
//  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
19
//  PARTICULAR PURPOSE. (Refer to the GNU Lesser General Public License for
20
//  more details.)
21
//
22
//  A copy of the GNU Lesser General Public License should have been received
23
//  along with the source code contained herein; if not, a copy can be obtained
24
//  by writing to:
25
//
26
//  Free Software Foundation, Inc.
27
//  51 Franklin Street, Fifth Floor
28
//  Boston, MA  02110-1301 USA
29
//
30
//  Further, no use of this source code is permitted in any form or means
31
//  without inclusion of this banner prominently in any derived works. 
32
//
33
//  Michael A. Morris
34
//  Huntsville, AL
35
//
36
///////////////////////////////////////////////////////////////////////////////
37
 
38
`timescale 1ns / 1ps
39
 
40
////////////////////////////////////////////////////////////////////////////////
41
// Company:         M. A. Morris & Assoc. 
42
// Engineer:        Michael A. Morris
43
//
44
// Create Date:     23:07:42 02/04/2012
45
// Design Name:     M65C02_RAM
46
// Module Name:     C:/XProjects/ISE10.1i/MAM6502/tb_M65C02_RAM.v
47
// Project Name:    MAM6502
48
// Target Device:   Generic functional simulation of various RAM technologies
49
// Tool versions:   ISE 10.1i SP3
50
//  
51
// Description: 
52
//
53
// Verilog Test Fixture created by ISE for module: M65C02_RAM
54
//
55
// Dependencies:
56
// 
57
// Revision:
58
//
59
//  1.00    12B04   MAM     File Created
60
//
61
//  2.00    12K18   MAM     Modified to support new version of the M65C02_RAM
62
//                          module which emulates Asynchronous LUT-based RAM,
63
//                          Synchronous, flow-through RAM (Block RAM), and
64
//                          Synchronous, pipelined RAM (SynchSRAM).
65
//
66
// Additional Comments:
67
// 
68
////////////////////////////////////////////////////////////////////////////////
69
 
70
module tb_M65C02_RAM;
71
 
72
        reg     Rst;
73
    reg     Clk;
74
 
75
        reg     WE;
76
        wire    [10:0] AI;
77
        reg     [ 7:0] DI;
78
        wire    [ 7:0] DO;
79
 
80
    //  Simulation Variables
81
 
82
    reg     [10:0] Cntr;
83
    wire    TC_Cntr;
84
    reg     Ext, ZP;
85
 
86
        // Instantiate the Unit Under Test (UUT)
87
 
88
M65C02_RAM  #(
89
                .pAddrSize(11),
90
                .pDataSize(8),
91
                .pFileName("M65C02_Tst2.txt")
92
            ) RAM (
93
                .Clk(Clk),
94
 
95
                .Ext(Ext),
96
                .ZP(ZP),
97
 
98
                .WE(WE),
99
                .AI(Cntr),
100
                .DI(DI),
101
                .DO(DO)
102
            );
103
 
104
initial begin
105
    // Initialize Inputs
106
    Rst = 1;
107
    Clk = 1;
108
    WE  = 0;
109
    DI  = 0;
110
 
111
    // Wait 100 ns for global reset to finish
112
    #101 Rst = 0;
113
 
114
    // Add stimulus here
115
 
116
end
117
 
118
///////////////////////////////////////////////////////////////////////////////
119
//
120
//  Clocks
121
 
122
always #5 Clk = ~Clk;
123
 
124
///////////////////////////////////////////////////////////////////////////////
125
 
126
always @(posedge Clk)
127
begin
128
    if(Rst | TC_Cntr)
129
        Cntr = #1 0;
130
    else
131
        Cntr = #1 Cntr + 1;
132
end
133
 
134
assign TC_Cntr = (Cntr == 11'h661);     // Last used location in test program
135
 
136
assign AI = Cntr;
137
 
138
//  Cycle through the various modes
139
 
140
always @(posedge Clk)
141
begin
142
    if(Rst)
143
        {Ext, ZP} <= #1 1;
144
    else if(TC_Cntr)
145
        {Ext, ZP} <= #1 ({Ext, ZP} + 1);
146
end
147
 
148
endmodule
149
 

powered by: WebSVN 2.1.0

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