-
Notifications
You must be signed in to change notification settings - Fork 0
/
data_mem.v
52 lines (45 loc) · 978 Bytes
/
data_mem.v
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 02:09:45 02/25/2013
// Design Name:
// Module Name: data_mem
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
module data_mem(
input clock,
input [10:0] address,
output [32:0] out_data,
input [32:0] in_data,
input write,
input read //hace falta usarla?
);
integer i;
reg [32:0] memoria [0:2047];
reg [32:0] aux;
initial
begin
for (i = 0; i < 2048; i=i+1)
memoria[i] = 32'b00000_00000_00000_00000_00000_00000_00;
end
always@(posedge clock)
begin
if(write)
memoria[address] = in_data;
else
aux = memoria[address];
end
assign out_data = aux;
endmodule