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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rc203soc/] [bench/] [models/] [zbtram.v] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1327 jcastillo
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  ZBT RAM Model                                               ////
4
////                                                              ////
5
////                                                              ////
6
////  Description                                                 ////
7
////  Emulates the behaviour of the ZBT RAM                       ////
8
////                                                              ////
9
////  To Do:                                                      ////
10
////   - nothing really                                           ////
11
////                                                              ////
12
////  Author(s):                                                  ////
13 1575 jcastillo
////      - Javier Castillo, javier.castillo@urjc.es              ////
14 1327 jcastillo
////                                                              ////
15
//////////////////////////////////////////////////////////////////////
16
////                                                              ////
17
//// Copyright (C) 2004 OpenCores                                 ////
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
// CVS Revision History
43
//
44
// $Log: not supported by cvs2svn $
45 1575 jcastillo
// Revision 1.1.1.1  2004/12/13 17:14:31  jcastillo
46
// Firt import of OR1200 over Celoxica RC203 platform
47
//
48 1327 jcastillo
 
49
 
50
// synopsys translate_off
51
`include "timescale.v"
52
// synopsys translate_on
53
 
54
 
55
module zbtram(clk,nBW,nCS,nRW,data,address);
56
 
57
   input        clk;
58
   input [3:0]  nBW;
59
   input        nCS;
60
   input        nRW;
61
   inout [31:0] data;
62
   input [19:0] address;
63
 
64
   reg   [19:0] addr_var;
65
   reg   [31:0] mem['h0:'h10000];
66
 
67
   reg control;
68
   reg [31:0] data_t;
69
 
70
   assign #1 data = control ? data_t : 32'hZ;
71
 
72
   integer i,file;
73
 
74
   initial
75
   begin
76
 
77
      #1
78
 
79
      for(i='h0;i<'h10000;i=i+1)
80
        mem[i]=0;
81
 
82
      //Load RAM with a initial program
83
 /*   $display("Initializing RAM");
84
      $readmemh("./hex/or1k-des.hex", mem); */
85
 
86
 
87
 
88
      data_t=0;
89
      control=0;
90
 
91
      while(1)
92
      begin
93
          @(posedge clk)
94
          if(nRW==1)
95
          begin
96
            addr_var = address;
97
 
98
            control = 1;
99
            data_t = mem[addr_var];
100
            if(addr_var==0) data_t=0;
101
//          $display("Read %X from address %X",data_t,addr_var);   
102
          end
103
          else
104
          begin
105
            addr_var = address;
106
            control = 0;
107
            @(posedge clk)
108
            case(nBW)
109
             4'b0000:
110
               mem[addr_var] = data;
111
             4'b0111:
112
               mem[addr_var][31:24] = data[7:0];
113
             4'b1011:
114
               mem[addr_var][23:16] = data[7:0];
115
             4'b1101:
116
               mem[addr_var][15:8] = data[7:0];
117
             4'b1110:
118
               mem[addr_var][7:0] = data[7:0];
119
             4'b0011:
120
               mem[addr_var][31:16] = data[15:0];
121
             4'b1100:
122
               mem[addr_var][15:0] = data[15:0];
123
            endcase
124
            control = 1;
125
//            $display("%d: Write %X in address %X sel= %b",$time,mem[addr_var],addr_var,nBW);   
126
          end
127
       end
128
    end
129
 
130
 
131
 
132
endmodule
133
 

powered by: WebSVN 2.1.0

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