diff options
author | Josh Blum <josh@joshknows.com> | 2010-01-22 11:58:32 -0800 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2010-01-22 11:58:32 -0800 |
commit | da57b53f803af2598a06fa89e6da2797e5e65155 (patch) | |
tree | bfc0772d0cb7d880d1f91ed936baa02d8ac8d155 /usrp1/models/ssram.v | |
parent | 7bf8a6df381a667134b55701993c6770d32bc76b (diff) | |
parent | a170b9b42345794429486dd4f3316e84ea2cc871 (diff) | |
download | uhd-da57b53f803af2598a06fa89e6da2797e5e65155.tar.gz uhd-da57b53f803af2598a06fa89e6da2797e5e65155.tar.bz2 uhd-da57b53f803af2598a06fa89e6da2797e5e65155.zip |
Merge branch 'usrp1' into usrp2
Conflicts:
.gitignore
Diffstat (limited to 'usrp1/models/ssram.v')
-rw-r--r-- | usrp1/models/ssram.v | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/usrp1/models/ssram.v b/usrp1/models/ssram.v new file mode 100644 index 000000000..fd7339970 --- /dev/null +++ b/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 |