//Replicating CY7C168A RAM chip, 4kx4 bits
//Using code from here: https://www.intel.com/content/www/us/en/programmable/quartushelp/13.0/mergedProjects/hdl/vlog/vlog_pro_ram_inferred.htm
//Changing to 4-bits
//CSn chip select signal handled at higher level

module RAM_CY7C168A(q, a, d, we, clk);
   output reg [3:0] q;
   input [3:0] d;
   input [11:0] a;
   input we, clk;
   reg [3:0] mem [1023:0];
    always @(posedge clk) begin
        if (we)
            mem[a] <= d;
        q <= mem[a];
   end
endmodule