cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
shravk259
Visitor
Visitor
392 Views
Registered: ‎07-30-2019

Ram module instantiation doesn't infer BRAM

I want to use a bram as a rom. But for Vivado to infer it as a bram I was forced to write the modue like a RAM. So, when I synthesize this RAM module, I can see in the utilization report that 1 BRAM is used.

However, when I instantiate this module in a different module to write values into the BRAM, there is no BRAM inferred - instead there are LUTs and FFs inferred. What am i doing wrong ? My top level code is attached.

Below is my ram module:

 

`timescale 1ns / 1ps

module bram(
input clock, // System clock
input we, // When high RAM sets data in input lines to given address
input [13:0] data_in, // Data lines to write to memory
input [13:0] address, // Address lines for saving data to memory

output reg[13:0] data_out // Data out
);

(* dont_touch = "true" *) reg [13:0] mem[0:2047];

 

always @(posedge clock)
begin
if (we)
begin
mem[address]<=data_in;
data_out <= mem[address];
end
end


endmodule

Below is the code where I used the ram module:

`timescale 1ns / 1ns

module inv( (* dont_touch = "true" *) input[13:0] adr_in,
(* dont_touch = "true" *)output[13:0] out,
(* dont_touch = "true" *) input clk
);

(* dont_touch = "true" *) reg we=1;
(* dont_touch = "true" *) reg[13:0] adr_l=0;
(* dont_touch = "true" *) reg[13:0] adr_e=0;
(* dont_touch = "true" *) wire[13:0] out_l;
(* dont_touch = "true" *) wire[13:0] out_e;
(* dont_touch = "true" *) reg[13:0] din;
(* dont_touch = "true" *) reg[13:0] din_1;
(* dont_touch = "true" *) reg[13:0] temp;
(* dont_touch = "true" *) wire[13:0] temp_adr;

parameter Q=256;

bram logq(clk, we, din, adr_l, out_l);
bram expq(clk, we, din_1, adr_e, out_e);

//incrementing addresses to expq and logq rams
always @(posedge clk)
begin
if (adr_l < 256 || adr_e < 255)
adr_l<=adr_l+1;
adr_l<=adr_e+1;
end

//values for expq
always @(posedge clk)
begin
case (adr_e)
0: din_1<=1;
1: din_1<=2;
2: din_1<=4;
3: din_1<=8;
4: din_1<=16;
5: din_1<=32;
6: din_1<=64;
7: din_1<=128;
8: din_1<=29;
9: din_1<=58;
10: din_1<=116;
11: din_1<=232;
12: din_1<=205;
13: din_1<=135;
14: din_1<=19;
15: din_1<=38;
16: din_1<=76;
17: din_1<=152;
18: din_1<=45;
19: din_1<=90;
20: din_1<=180;
21: din_1<=117;
22: din_1<=234;
23: din_1<=201;
24: din_1<=143;
25: din_1<=3;
26: din_1<=6;
27: din_1<=12;
28: din_1<=24;
29: din_1<=48;
30: din_1<=96;
31: din_1<=192;
32: din_1<=157;
33: din_1<=39;
34: din_1<=78;
35: din_1<=156;
36: din_1<=37;
37: din_1<=74;
38: din_1<=148;
39: din_1<=53;
40: din_1<=106;
41: din_1<=212;
42: din_1<=181;
43: din_1<=119;
44: din_1<=238;
45: din_1<=193;
46: din_1<=159;
47: din_1<=35;
48: din_1<=70;
49: din_1<=140;
50: din_1<=5;
51: din_1<=10;
52: din_1<=20;
53: din_1<=40;
54: din_1<=80;
55: din_1<=160;
56: din_1<=93;
57: din_1<=186;
58: din_1<=105;
59: din_1<=210;
60: din_1<=185;
61: din_1<=111;
62: din_1<=222;
63: din_1<=161;
64: din_1<=95;
65: din_1<=190;
66: din_1<=97;
67: din_1<=194;
68: din_1<=153;
69: din_1<=47;
70: din_1<=94;
71: din_1<=188;
72: din_1<=101;
73: din_1<=202;
74: din_1<=137;
75: din_1<=15;
76: din_1<=30;
77: din_1<=60;
78: din_1<=120;
79: din_1<=240;
80: din_1<=253;
81: din_1<=231;
82: din_1<=211;
83: din_1<=187;
84: din_1<=107;
85: din_1<=214;
86: din_1<=177;
87: din_1<=127;
88: din_1<=254;
89: din_1<=225;
90: din_1<=223;
91: din_1<=163;
92: din_1<=91;
93: din_1<=182;
94: din_1<=113;
95: din_1<=226;
96: din_1<=217;
97: din_1<=175;
98: din_1<=67;
99: din_1<=134;
100: din_1<=17;
101: din_1<=34;
102: din_1<=68;
103: din_1<=136;
104: din_1<=13;
105: din_1<=26;
106: din_1<=52;
107: din_1<=104;
108: din_1<=208;
109: din_1<=189;
110: din_1<=103;
111: din_1<=206;
112: din_1<=129;
113: din_1<=31;
114: din_1<=62;
115: din_1<=124;
116: din_1<=248;
117: din_1<=237;
118: din_1<=199;
119: din_1<=147;
120: din_1<=59;
121: din_1<=118;
122: din_1<=236;
123: din_1<=197;
124: din_1<=151;
125: din_1<=51;
126: din_1<=102;
127: din_1<=204;
128: din_1<=133;
129: din_1<=23;
130: din_1<=46;
131: din_1<=92;
132: din_1<=184;
133: din_1<=109;
134: din_1<=218;
135: din_1<=169;
136: din_1<=79;
137: din_1<=158;
138: din_1<=33;
139: din_1<=66;
140: din_1<=132;
141: din_1<=21;
142: din_1<=42;
143: din_1<=84;
144: din_1<=168;
145: din_1<=77;
146: din_1<=154;
147: din_1<=41;
148: din_1<=82;
149: din_1<=164;
150: din_1<=85;
151: din_1<=170;
152: din_1<=73;
153: din_1<=146;
154: din_1<=57;
155: din_1<=114;
156: din_1<=228;
157: din_1<=213;
158: din_1<=183;
159: din_1<=115;
160: din_1<=230;
161: din_1<=209;
162: din_1<=191;
163: din_1<=99;
164: din_1<=198;
165: din_1<=145;
166: din_1<=63;
167: din_1<=126;
168: din_1<=252;
169: din_1<=229;
170: din_1<=215;
171: din_1<=179;
172: din_1<=123;
173: din_1<=246;
174: din_1<=241;
175: din_1<=255;
176: din_1<=227;
177: din_1<=219;
178: din_1<=171;
179: din_1<=75;
180: din_1<=150;
181: din_1<=49;
182: din_1<=98;
183: din_1<=196;
184: din_1<=149;
185: din_1<=55;
186: din_1<=110;
187: din_1<=220;
188: din_1<=165;
189: din_1<=87;
190: din_1<=174;
191: din_1<=65;
192: din_1<=130;
193: din_1<=25;
194: din_1<=50;
195: din_1<=100;
196: din_1<=200;
197: din_1<=141;
198: din_1<=7;
199: din_1<=14;
200: din_1<=28;
201: din_1<=56;
202: din_1<=112;
203: din_1<=224;
204: din_1<=221;
205: din_1<=167;
206: din_1<=83;
207: din_1<=166;
208: din_1<=81;
209: din_1<=162;
210: din_1<=89;
211: din_1<=178;
212: din_1<=121;
213: din_1<=242;
214: din_1<=249;
215: din_1<=239;
216: din_1<=195;
217: din_1<=155;
218: din_1<=43;
219: din_1<=86;
220: din_1<=172;
221: din_1<=69;
222: din_1<=138;
223: din_1<=9;
224: din_1<=18;
225: din_1<=36;
226: din_1<=72;
227: din_1<=144;
228: din_1<=61;
229: din_1<=122;
230: din_1<=244;
231: din_1<=245;
232: din_1<=247;
233: din_1<=243;
234: din_1<=251;
235: din_1<=235;
236: din_1<=203;
237: din_1<=139;
238: din_1<=11;
239: din_1<=22;
240: din_1<=44;
241: din_1<=88;
242: din_1<=176;
243: din_1<=125;
244: din_1<=250;
245: din_1<=233;
246: din_1<=207;
247: din_1<=131;
248: din_1<=27;
249: din_1<=54;
250: din_1<=108;
251: din_1<=216;
252: din_1<=173;
253: din_1<=71;
254: din_1<=142;

endcase
end

//values for logq
always @(posedge clk)
begin

case (adr_l)
0: din<=0;
1: din<=0;
2: din<=1;
3: din<=25;
4: din<=2;
5: din<=50;
6: din<=26;
7: din<=198;
8: din<=3;
9: din<=223;
10: din<=51;
11: din<=238;
12: din<=27;
13: din<=104;
14: din<=199;
15: din<=75;
16: din<=4;
17: din<=100;
18: din<=224;
19: din<=14;
20: din<=52;
21: din<=141;
22: din<=239;
23: din<=129;
24: din<=28;
25: din<=193;
26: din<=105;
27: din<=248;
28: din<=200;
29: din<=8;
30: din<=76;
31: din<=113;
32: din<=5;
33: din<=138;
34: din<=101;
35: din<=47;
36: din<=225;
37: din<=36;
38: din<=15;
39: din<=33;
40: din<=53;
41: din<=147;
42: din<=142;
43: din<=218;
44: din<=240;
45: din<=18;
46: din<=130;
47: din<=69;
48: din<=29;
49: din<=181;
50: din<=194;
51: din<=125;
52: din<=106;
53: din<=39;
54: din<=249;
55: din<=185;
56: din<=201;
57: din<=154;
58: din<=9;
59: din<=120;
60: din<=77;
61: din<=228;
62: din<=114;
63: din<=166;
64: din<=6;
65: din<=191;
66: din<=139;
67: din<=98;
68: din<=102;
69: din<=221;
70: din<=48;
71: din<=253;
72: din<=226;
73: din<=152;
74: din<=37;
75: din<=179;
76: din<=16;
77: din<=145;
78: din<=34;
79: din<=136;
80: din<=54;
81: din<=208;
82: din<=148;
83: din<=206;
84: din<=143;
85: din<=150;
86: din<=219;
87: din<=189;
88: din<=241;
89: din<=210;
90: din<=19;
91: din<=92;
92: din<=131;
93: din<=56;
94: din<=70;
95: din<=64;
96: din<=30;
97: din<=66;
98: din<=182;
99: din<=163;
100: din<=195;
101: din<=72;
102: din<=126;
103: din<=110;
104: din<=107;
105: din<=58;
106: din<=40;
107: din<=84;
108: din<=250;
109: din<=133;
110: din<=186;
111: din<=61;
112: din<=202;
113: din<=94;
114: din<=155;
115: din<=159;
116: din<=10;
117: din<=21;
118: din<=121;
119: din<=43;
120: din<=78;
121: din<=212;
122: din<=229;
123: din<=172;
124: din<=115;
125: din<=243;
126: din<=167;
127: din<=87;
128: din<=7;
129: din<=112;
130: din<=192;
131: din<=247;
132: din<=140;
133: din<=128;
134: din<=99;
135: din<=13;
136: din<=103;
137: din<=74;
138: din<=222;
139: din<=237;
140: din<=49;
141: din<=197;
142: din<=254;
143: din<=24;
144: din<=227;
145: din<=165;
146: din<=153;
147: din<=119;
148: din<=38;
149: din<=184;
150: din<=180;
151: din<=124;
152: din<=17;
153: din<=68;
154: din<=146;
155: din<=217;
156: din<=35;
157: din<=32;
158: din<=137;
159: din<=46;
160: din<=55;
161: din<=63;
162: din<=209;
163: din<=91;
164: din<=149;
165: din<=188;
166: din<=207;
167: din<=205;
168: din<=144;
169: din<=135;
170: din<=151;
171: din<=178;
172: din<=220;
173: din<=252;
174: din<=190;
175: din<=97;
176: din<=242;
177: din<=86;
178: din<=211;
179: din<=171;
180: din<=20;
181: din<=42;
182: din<=93;
183 : din<=158;
184: din<=132;
185: din<=60;
186: din<=57;
187: din<=83;
188: din<=71;
189: din<=109;
190: din<=65;
191: din<=162;
192: din<=31;
193: din<=45;
194: din<=67;
195: din<=216;
196: din<=183;
197: din<=123;
198: din<=164;
199: din<=118;
200: din<=196;
201: din<=23;
202: din<=73;
203: din<=236;
204: din<=127;
205: din<=12;
206: din<=111;
207: din<=246;
208: din<=108;
209: din<=161;
210: din<=59;
211: din<=82;
212: din<=41;
213: din<=157;
214: din<=85;
215: din<=170;
216: din<=251;
217: din<=96;
218: din<=134;
219: din<=177;
220: din<=187;
221: din<=204;
222: din<=62;
223: din<=90;
224: din<=203;
225: din<=89;
226: din<=95;
227: din<=176;
228: din<=156;
229: din<=169;
230: din<=160;
231: din<=81;
232: din<=11;
233: din<=245;
234: din<=22;
235: din<=235;
236: din<=122;
237: din<=117;
238: din<=44;
239: din<=215;
240: din<=79;
241: din<=174;
242: din<=213;
243: din<=233;
244: din<=230;
245: din<=231;
246: din<=173;
247: din<=232;
248: din<=116;
249: din<=214;
250: din<=244;
251: din<=234;
252: din<=168;
253: din<=80;
254: din<=88;
255: din<=175;
endcase
end

//inverse galios field operation task
task invgf;
input[13:0] a;

if(a==0)
temp=0;
else if(a==1)
temp=1;
else
temp=expq.mem[temp_adr];
endtask

always @(posedge clk)
begin
invgf(A);
out= temp;
end

endmodule

0 Kudos
0 Replies