summaryrefslogtreecommitdiffstats
path: root/translated_examples/mem.v
blob: 18e36c4026bcef892441527a896423d41317a5ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// no timescale needed

module mem(
input wire clk,
input wire rstn,
input wire en,
input wire cs,
input wire [addr_width - 1:0] addr,
input wire [bus_width - 1:0] din,
output wire [bus_width - 1:0] dout
);

parameter [31:0] addr_width=6;
parameter [31:0] bus_width=14;
// not implemented
// not implemented




reg [bus_width - 1:0] mem[255:0];
reg [addr_width - 1:0] al = 8'h00;

  assign dout = mem[al];
  always @(posedge clk) begin
    al <= addr;
    if(en == 1'b1) begin
      mem[addr] <= din;
    end
  end


endmodule
OpenPOWER on IntegriCloud