summaryrefslogtreecommitdiffstats
path: root/fpga/usrp1/models/ssram.v
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-04-15 11:24:41 -0700
committerJosh Blum <josh@joshknows.com>2010-04-15 11:24:41 -0700
commit3a196c5d614fbec9b1010b3082245614ba5e0dc9 (patch)
tree784f075298f5d86c9e7429ce0ff977deaf4315c8 /fpga/usrp1/models/ssram.v
parentcbf7a0916f0455743d8446a8edc0f0775e3e63ed (diff)
parent05d77f772317de5d925301aa11bb9a880656dd05 (diff)
downloaduhd-3a196c5d614fbec9b1010b3082245614ba5e0dc9.tar.gz
uhd-3a196c5d614fbec9b1010b3082245614ba5e0dc9.tar.bz2
uhd-3a196c5d614fbec9b1010b3082245614ba5e0dc9.zip
Merge branch 'udp'
Diffstat (limited to 'fpga/usrp1/models/ssram.v')
-rw-r--r--fpga/usrp1/models/ssram.v38
1 files changed, 38 insertions, 0 deletions
diff --git a/fpga/usrp1/models/ssram.v b/fpga/usrp1/models/ssram.v
new file mode 100644
index 000000000..fd7339970
--- /dev/null
+++ b/fpga/usrp1/models/ssram.v
@@ -0,0 +1,38 @@
+
+// Model of Pipelined [ZBT] Synchronous SRAM
+
+module ssram(clock,addr,data,wen,ce);
+ parameter addrbits = 19;
+ parameter depth = 524288;
+
+ input clock;
+ input [addrbits-1:0] addr;
+ inout [35:0] data;
+ input wen;
+ input ce;
+
+ reg [35:0] ram [0:depth-1];
+
+ reg read_d1,read_d2;
+ reg write_d1,write_d2;
+ reg [addrbits-1:0] addr_d1,addr_d2;
+
+ always @(posedge clock)
+ begin
+ read_d1 <= #1 ce & ~wen;
+ write_d1 <= #1 ce & wen;
+ addr_d1 <= #1 addr;
+ read_d2 <= #1 read_d1;
+ write_d2 <= #1 write_d1;
+ addr_d2 <= #1 addr_d1;
+ if(write_d2)
+ ram[addr_d2] = data;
+ end // always @ (posedge clock)
+
+ data = (ce & read_d2) ? ram[addr_d2] : 36'bz;
+
+ always @(posedge clock)
+ if(~ce & (write_d2 | write_d1 | wen))
+ $display("$time ERROR: RAM CE not asserted during write cycle");
+
+endmodule // ssram