2 //************************************************************************
\r
3 //************************************************************************
\r
4 //** This model is the property of Cypress Semiconductor Corp and is **
\r
5 //** protected by the US copyright laws, any unauthorized copying and **
\r
6 //** distribution is prohibited. Cypress reserves the right to change **
\r
7 //** any of the functional specifications without any prior notice. **
\r
8 //** Cypress is not liable for any damages which may result from the **
\r
9 //** use of this functional model. **
\r
11 //** File Name : CY7C1356 **
\r
13 //** Revision : 1.0 - 08/03/2004 **
\r
15 //** The timings are to be selected by the user depending upon the **
\r
16 //** frequency of operation from the datasheet. **
\r
18 //** Model : CY7C1356C - NoBL Pipelined SRAM **
\r
19 //** Queries : MPD Applications **
\r
20 //** Website: www.cypress.com/support **
\r
21 //************************************************************************
\r
22 //************************************************************************
\r
24 `timescale 1ns / 10ps
\r
26 // NOTE : Any setup/hold errors will force input signal to x state
\r
27 // or if results indeterminant (write addr) core is reset x
\r
29 // define fixed values
\r
31 `define wordsize (18 -1) //
\r
32 `define no_words (1048576 -1) // 1M x 18 RAM
\r
34 module cy1356 ( d, clk, a, bws, we_b, adv_lb, ce1b, ce2, ce3b, oeb, cenb, mode);
\r
36 inout [`wordsize:0] d;
\r
37 input clk, // clock input (R)
\r
38 we_b, // byte write enable(L)
\r
39 adv_lb, // burst(H)/load(L) address
\r
40 ce1b, // chip enable(L)
\r
41 ce2, // chip enable(H)
\r
42 ce3b, // chip enable(L)
\r
43 oeb, // async output enable(L)(read)
\r
44 cenb, // clock enable(L)
\r
45 mode; // interleave(H)/linear(L) burst
\r
46 input [1:0] bws; // byte write select(L)
\r
47 input [18:0] a; // address bus
\r
49 // *** NOTE DEVICE OPERATES #0.01 AFTER CLOCK ***
\r
50 // *** THEREFORE DELAYS HAVE TO TAKE THIS INTO ACCOUNT ***
\r
53 //**********************************************************************
\r
54 // Timings for 225MHz
\r
55 //**********************************************************************
\r
67 //***********************************************************************
\r
68 // Timings for 200MHz
\r
69 //**********************************************************************
\r
82 //***********************************************************************
\r
84 //**********************************************************************
\r
85 // This model is configured for 166 MHz Operation (CY7C1356-166).
\r
86 //**********************************************************************
\r
100 reg notifier; // error support reg's
\r
111 wire chipen; // combined chip enable (high for an active chip)
\r
113 reg chipen_d; // _d = delayed
\r
114 reg chipen_o; // _o = operational = delayed sig or _d sig
\r
116 wire writestate; // holds 1 if any of writebus is low
\r
120 wire loadcyc; // holds 1 for load cycles (setup and hold checks)
\r
121 wire writecyc; // holds 1 for write cycles (setup and hold checks)
\r
122 wire [1:0] bws; // holds the bws values
\r
124 wire [1:0] writebusb; // holds the "internal" bws bus based on we_b
\r
125 reg [1:0] writebusb_d;
\r
126 reg [1:0] writebusb_o;
\r
128 wire [2:0] operation; // holds chipen, adv_ld and writestate
\r
129 reg [2:0] operation_d;
\r
130 reg [2:0] operation_o;
\r
132 wire [18:0] a; // address input bus
\r
136 reg [`wordsize:0] do; // data output reg
\r
137 reg [`wordsize:0] di; // data input bus
\r
138 reg [`wordsize:0] dd; // data delayed bus
\r
140 wire tristate; // tristate output (on a bytewise basis) when asserted
\r
141 reg cetri; // register set by chip disable which sets the tristate
\r
142 reg oetri; // register set by oe which sets the tristate
\r
143 reg enable; // register to make the ram enabled when equal to 1
\r
144 reg [18:0] addreg; // register to hold the input address
\r
145 reg [`wordsize:0] pipereg; // register for the output data
\r
147 reg [`wordsize:0] mem [0:`no_words]; // RAM array
\r
149 reg [`wordsize:0] writeword; // temporary holding register for the write data
\r
150 reg burstinit; // register to hold a[0] for burst type
\r
151 reg [18:0] i; // temporary register used to write to all mem locs.
\r
152 reg writetri; // tristate
\r
153 reg lw, bw; // pipelined write functions
\r
157 wire [`wordsize:0] d = !tristate ? do[`wordsize:0] : 18'bz ; // data bus
\r
159 assign chipen = (adv_lb == 1 ) ? chipen_d :
\r
160 ~ce1b & ce2 & ~ce3b ;
\r
162 assign writestate = ~& writebusb;
\r
164 assign operation = {chipen, adv_lb, writestate};
\r
166 assign writebusb[1:0] = ( we_b ==0 & adv_lb ==0) ? bws[1:0]:
\r
167 ( we_b ==1 & adv_lb ==0) ? 2'b11 :
\r
168 ( we_bl ==0 & adv_lb ==1) ? bws[1:0]:
\r
169 ( we_bl ==1 & adv_lb ==1) ? 2'b11 :
\r
172 assign loadcyc = chipen & !cenb;
\r
174 assign writecyc = writestate_d & enable & ~cenb & chipen; // check
\r
176 assign tristate = cetri | writetri | oetri;
\r
180 // formers for notices/errors etc
\r
182 //$display("NOTICE : xxx :");
\r
183 //$display("WARNING : xxx :");
\r
184 //$display("ERROR *** : xxx :");
\r
187 // initialize the output to be tri-state, ram to be disabled
\r
225 // *** SETUP / HOLD VIOLATIONS ***
\r
229 $display("NOTICE : 020 : Data bus corruption");
\r
237 $display("NOTICE : 010 : Byte write corruption");
\r
245 $display("NOTICE : 011 : Byte enable corruption");
\r
253 $display("NOTICE : 012 : CE1B corruption");
\r
261 $display("NOTICE : 013 : CE2 corruption");
\r
269 $display("NOTICE : 014 : CE3B corruption");
\r
277 $display("NOTICE : 015 : CENB corruption");
\r
285 $display("NOTICE : 016 : ADV_LB corruption");
\r
286 force adv_lb = 1'bx;
\r
291 // synchronous functions from clk edge
\r
293 always @(posedge clk)
\r
297 // latch conditions on adv_lb
\r
304 chipen_d <= chipen;
\r
307 chipen_o <= chipen;
\r
308 writestate_o <= writestate;
\r
309 writestate_d <= writestate_o;
\r
310 writebusb_o <= writebusb;
\r
311 writebusb_d <= writebusb_o;
\r
312 operation_o <= operation;
\r
317 // execute previously pipelined fns
\r
329 // decode input/piplined state
\r
331 casex (operation_o)
\r
336 3'b110 : burstread;
\r
337 default : unknown; // output unknown values and display an error message
\r
340 do <= `tco pipereg;
\r
344 // *** task section ***
\r
348 if (enable) cetri <= `tclz 0;
\r
349 writetri <= `tchz 0;
\r
351 pipereg = mem[addreg];
\r
357 if (enable) cetri <= `tclz 0;
\r
358 writeword = mem[addreg]; // set up a word to hold the data for the current location
\r
359 /* overwrite the current word for the bytes being written to */
\r
360 if (!writebusb_d[1]) writeword[17:9] = di[17:9];
\r
361 if (!writebusb_d[0]) writeword[8:0] = di[8:0];
\r
362 writeword = writeword & writeword; //convert z to x states
\r
363 mem[addreg] = writeword; // store the new word into the memory location
\r
364 //writetri <= `tchz 1; // tristate the outputs
\r
371 writetri <= `tchz 1; // tristate the outputs
\r
378 writetri <= `tchz 1; // tristate the outputs
\r
384 burstinit = a_o[0];
\r
393 burstinit = a_d[0];
\r
417 // $display ("Unknown function: Operation = %b\n", operation);
\r
431 if (burstinit == 0 || mode == 0)
\r
434 2'b00: addreg[1:0] = 2'b01;
\r
435 2'b01: addreg[1:0] = 2'b10;
\r
436 2'b10: addreg[1:0] = 2'b11;
\r
437 2'b11: addreg[1:0] = 2'b00;
\r
438 default: addreg[1:0] = 2'bxx;
\r
444 2'b00: addreg[1:0] = 2'b11;
\r
445 2'b01: addreg[1:0] = 2'b00;
\r
446 2'b10: addreg[1:0] = 2'b01;
\r
447 2'b11: addreg[1:0] = 2'b10;
\r
448 default: addreg[1:0] = 2'bxx;
\r
457 // specify the setup and hold checks
\r
459 // notifier will wipe memory as result is indeterminent
\r
461 $setuphold(posedge clk &&& loadcyc, a, `tas, `tah, notifier);
\r
463 // noti1 should make ip = 'bx;
\r
465 $setuphold(posedge clk, bws, `tas, `tah, noti1_0);
\r
467 $setuphold(posedge clk, we_b, `tas, `tah, noti1_1);
\r
468 $setuphold(posedge clk, ce1b, `tas, `tah, noti1_2);
\r
469 $setuphold(posedge clk, ce2, `tas, `tah, noti1_3);
\r
470 $setuphold(posedge clk, ce3b, `tas, `tah, noti1_4);
\r
472 // noti2 should make d = 18'hxxxxx;
\r
474 $setuphold(posedge clk &&& writecyc, d, `tas, `tah, noti2);
\r
476 // add extra tests here.
\r
478 $setuphold(posedge clk, cenb, `tas, `tah, noti1_5);
\r
479 $setuphold(posedge clk, adv_lb, `tas, `tah, noti1_6);
\r