stackram.v 403 Bytes
Newer Older
bp's avatar
bp committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
// behavioural verison of stackram

module stackram(data, wren, wraddress, rdaddress, clock, q);
   input [15:0] data;
   input 	wren;
   input [2:0] 	wraddress;
   input [2:0] 	rdaddress;
   input 	clock;
   output [15:0] q;

   reg [15:0] 	 ram[0:7];
   reg [15:0] 	 q;

   always @(posedge clock)
     begin
	if(wren) ram[wraddress] <= data;
	q <= ram[rdaddress];
     end
   
endmodule // stackram