-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmem_system_ref.v
62 lines (53 loc) · 1.47 KB
/
mem_system_ref.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
53
54
55
56
57
58
59
60
61
62
/* $Author: karu $ */
/* $LastChangedDate: 2009-04-24 09:28:13 -0500 (Fri, 24 Apr 2009) $ */
/* $Rev: 77 $ */
`default_nettype none
module mem_system_ref(/*AUTOARG*/
// Outputs
DataOut, Done, Stall, CacheHit,
// Inputs
Addr, DataIn, Rd, Wr, clk, rst
);
input wire [15:0] Addr;
input wire [15:0] DataIn;
input wire Rd;
input wire Wr;
input wire clk;
input wire rst;
output reg [15:0] DataOut;
output wire Done;
output wire Stall;
output wire CacheHit;
/*AUTOWIRE*/
// Beginning of automatic wires (for undeclared instantiated-module outputs)
// End of automatics
reg [7:0] mem[0:65535];
reg loaded;
integer i;
initial begin
loaded = 0;
for (i = 0; i < 65536; i=i+1) begin
mem[i] = 0;
end
end
always @(rst or loaded or Wr or Rd or DataIn) begin
if (rst) begin
if (!loaded) begin
$readmemh("loadfile_all.img", mem);
loaded = 1;
end
end else begin
if (Wr) begin
{mem[Addr], mem[Addr+8'd1]} = DataIn;
end
if (Rd) begin
DataOut = {mem[Addr], mem[Addr+8'd1]};
end
end
end // always @ (rst or loaded or Wr or Rd or DataIn)
assign Done = (Rd|Wr);
assign Stall = 1'b0;
assign CacheHit = 1'b0;
endmodule // mem_system_ref
`default_nettype wire
// DUMMY LINE FOR REV CONTROL :9: