-
Notifications
You must be signed in to change notification settings - Fork 2
/
ebr_buffer.v
136 lines (124 loc) · 2.88 KB
/
ebr_buffer.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/* Verilog netlist generated by SCUBA Diamond (64-bit) 3.3.0.109 Patch Version(s) 122746 */
/* Module Version: 7.4 */
/* C:\lscc\diamond\3.3_x64\ispfpga\bin\nt64\scuba.exe -w -n ebr_buffer -lang verilog -synth synplify -bus_exp 7 -bb -arch mj5g00 -type bram -wp 11 -rp 1010 -data_width 8 -rdata_width 8 -num_rows 2048 -outdataA REGISTERED -outdataB REGISTERED -writemodeA NORMAL -writemodeB NORMAL -resetmode ASYNC -cascade -1 */
/* Mon Nov 10 22:18:45 2014 */
//
/////
//`timescale 1 ns / 1 ps
//module ebr_buffer (DataInA, DataInB, AddressA, AddressB, ClockA, ClockB,
// ClockEnA, ClockEnB, WrA, WrB, ResetA, ResetB, QA, QB);
// input [7:0] DataInA;
// input [7:0] DataInB;
// input [10:0] AddressA;
// input [10:0] AddressB;
// input ClockA;
// input ClockB;
// input ClockEnA;
// input ClockEnB;
// input WrA;
// input WrB;
// input ResetA;
// input ResetB;
// output reg [7:0] QA;
// output reg [7:0] QB;
//
//reg [7:0] block_ramA[0:2047];
//reg [7:0] block_ramB[0:2047];
////port A
//always @ ( posedge ClockA )
//begin
//if(ResetA)
//QA <= 8'd0;
//else if(ClockEnA)begin
// if(WrA)
// block_ramA[AddressA] <= DataInA;
// else
// QA <= block_ramA[AddressA];
//end
//end
////port B
//always @ ( posedge ClockB )
//begin
//if(ResetB)
//QB <= 8'd0;
//else if(ClockEnB)begin
// if(WrB)
// block_ramB[AddressB] <= DataInB;
// else
// QB <= block_ramB[AddressB];
//end
//end
//
//endmodule
//`timescale 1ns / 1fs
module ebr_buffer
(
input wire [7:0] DataInA,
input wire [7:0] DataInB,
input wire [10:0] AddressA,
input wire [10:0] AddressB,
input wire ClockA,
input wire ClockB,
input wire ClockEnA,
input wire ClockEnB,
input wire WrA,
input wire WrB,
input wire ResetA,
input wire ResetB,
// input disp,
output wire [7:0] QA,
output wire [7:0] QB
);
// Declare the RAM variable
reg [7:0] ram[0:2047];
reg [7:0] q_a, q_b;
assign QA = q_a;
assign QB = q_b;
// Port A
always @ (posedge ClockA)
begin
if(ClockEnA)
begin
if (WrA)
begin
ram[AddressA] <= DataInA;
q_a <= DataInA;
end
else
begin
q_a <= ram[AddressA];
end
end
end
// Port B
always @ (posedge ClockB)
begin
if (ClockEnB)
begin
if (WrB)
begin
ram[AddressB] <= DataInB;
q_b <= DataInB;
end
else
begin
q_b <= ram[AddressB];
end
end
end
/*`ifdef DEBUG_RAM
always @ (posedge disp)
begin: named
// integer i;
if (disp)
begin
for(int i=0; i<10; i=i+1)
$display ("mem[%0d] = %0d", i, ram[i]);
for(int i=51; i<68; i=i+1)
$display ("mem[%0d] = %0d", i, ram[i]);
for (int i=2040; i<2048; i=i+1)
$display ("mem[%0d] = %0d", i, ram[i]);
end
end
`endif*/
endmodule