Logic Symbol:
Logic Diagram:
Function Table:
Code:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module memory_16x4(O,D,CS,WE,clk,A); | |
output reg [3:0] O; | |
input [3:0] D; | |
input [3:0] A; | |
input CS,WE,clk; | |
reg [3:0] memory[0:15]; | |
always @(posedge clk) | |
begin | |
if (~CS) | |
begin | |
if (WE == 1) | |
O = ~(memory[A]); | |
else if (WE == 0) | |
memory[A] = D; | |
end | |
else | |
O = 4'bZZZZ; | |
endmodule |