|
21 | 21 | input CLK, |
22 | 22 | input RST_X, |
23 | 23 | input EN, |
24 | | - input [((W_A-1)+1)-1:0] pc, |
| 24 | + input [W_A-1:0] pc, |
25 | 25 | output pred, |
26 | | - input [((W_A-1)+1)-1:0] update_pc, |
| 26 | + input [W_A-1:0] update_pc, |
27 | 27 | input update, |
28 | 28 | input rslt |
29 | 29 | ); |
30 | 30 |
|
31 | 31 | //Branch History Register |
32 | | - reg [((W_BHR-1)+1)-1:0] bhr; |
| 32 | + reg [W_BHR-1:0] bhr; |
33 | 33 | //Pattern History Table |
34 | | - wire [(1+1)-1:0] read_pht; |
35 | | - wire [(1+1)-1:0] update_read_pht; |
36 | | - wire [(1+1)-1:0] write_pht; |
| 34 | + wire [1:0] read_pht; |
| 35 | + wire [1:0] update_read_pht; |
| 36 | + wire [1:0] write_pht; |
37 | 37 |
|
38 | | - reg [((W_BHR-1)+1)-1:0] d_bhr; |
| 38 | + reg [W_BHR-1:0] d_bhr; |
39 | 39 | reg d_update; |
40 | 40 | reg d_rslt; |
41 | | - reg [((W_A-1)+1)-1:0] d_update_pc; |
| 41 | + reg [W_A-1:0] d_update_pc; |
42 | 42 |
|
43 | 43 | pht_mem #(.W_PHT(W_PHT), .N_PHT(N_PHT)) |
44 | 44 | pht_mem(CLK, EN, pht_index(bhr, pc), read_pht, |
|
68 | 68 | end |
69 | 69 | end |
70 | 70 | |
71 | | - function [((W_PHT-1)+1)-1:0] pht_index; |
72 | | - input [((W_BHR-1)+1)-1:0] bhr; |
73 | | - input [((W_A-1)+1)-1:0] pc; |
| 71 | + function [W_PHT-1:0] pht_index; |
| 72 | + input [W_BHR-1:0] bhr; |
| 73 | + input [W_A-1:0] pc; |
74 | 74 | begin |
75 | 75 | pht_index = (bhr << BHR_OFFSET) ^ (pc >> 2); |
76 | 76 | end |
77 | 77 | endfunction |
78 | 78 |
|
79 | | - function [(1+1)-1:0] pht_update; |
80 | | - input [(1+1)-1:0] current; |
| 79 | + function [1:0] pht_update; |
| 80 | + input [1:0] current; |
81 | 81 | input rslt; |
82 | 82 | begin |
83 | 83 | if(rslt) begin |
|
88 | 88 | end |
89 | 89 | endfunction |
90 | 90 | |
91 | | - function [(0+1)-1:0] get_pred; |
92 | | - input [(1+1)-1:0] cnt; |
| 91 | + function [0:0] get_pred; |
| 92 | + input [1:0] cnt; |
93 | 93 | begin |
94 | 94 | get_pred = (cnt >= 2)? 1:0; |
95 | 95 | end |
|
104 | 104 | ( |
105 | 105 | input CLK, |
106 | 106 | input EN, |
107 | | - input [((W_PHT-1)+1)-1:0] I_A0, |
108 | | - output [(1+1)-1:0] O_Q0, |
109 | | - input [((W_PHT-1)+1)-1:0] I_A1, |
110 | | - output [(1+1)-1:0] O_Q1, |
111 | | - input [((W_PHT-1)+1)-1:0] I_A2, |
112 | | - input [(1+1)-1:0] I_D2, |
| 107 | + input [W_PHT-1:0] I_A0, |
| 108 | + output [1:0] O_Q0, |
| 109 | + input [W_PHT-1:0] I_A1, |
| 110 | + output [1:0] O_Q1, |
| 111 | + input [W_PHT-1:0] I_A2, |
| 112 | + input [1:0] I_D2, |
113 | 113 | input I_WE2 |
114 | 114 | ); |
115 | 115 |
|
116 | | - reg [(1+1)-1:0] mem [0:((N_PHT-1)+1)-1]; |
117 | | - reg [((W_PHT-1)+1)-1:0] d_I_A0; |
118 | | - reg [((W_PHT-1)+1)-1:0] d_I_A1; |
| 116 | + reg [1:0] mem [0:N_PHT-1]; |
| 117 | + reg [W_PHT-1:0] d_I_A0; |
| 118 | + reg [W_PHT-1:0] d_I_A1; |
119 | 119 |
|
120 | 120 | integer i; |
121 | 121 | initial begin |
|
148 | 148 | ( |
149 | 149 | input CLK, RST_X, |
150 | 150 | input EN, |
151 | | - input [((W_A-1)+1)-1:0] pc, |
152 | | - output [((W_A-1)+1)-1:0] pred_target, |
| 151 | + input [W_A-1:0] pc, |
| 152 | + output [W_A-1:0] pred_target, |
153 | 153 | output exist, |
154 | 154 | output read_ras, |
155 | | - input [((W_A-1)+1)-1:0] update_pc, |
156 | | - input [((W_A-1)+1)-1:0] update_target, |
| 155 | + input [W_A-1:0] update_pc, |
| 156 | + input [W_A-1:0] update_target, |
157 | 157 | input update_read_ras, |
158 | 158 | input update, |
159 | 159 | input rslt |
160 | 160 | ); |
161 | 161 |
|
162 | 162 | localparam W_TAG = W_A - (W_TAB + 2); |
163 | 163 |
|
164 | | - reg [((W_A-1)+1)-1:0] d_pc; |
165 | | - reg [((W_A-1)+1)-1:0] d_update_pc; |
166 | | - reg [((W_A-1)+1)-1:0] d_update_target; |
| 164 | + reg [W_A-1:0] d_pc; |
| 165 | + reg [W_A-1:0] d_update_pc; |
| 166 | + reg [W_A-1:0] d_update_target; |
167 | 167 | reg d_update; |
168 | 168 | reg d_rslt; |
169 | 169 | reg d_update_read_ras; |
170 | 170 | |
171 | | -// reg [(0+1)-1:0] last [0:((N_TAB-1)+1)-1]; //LRU |
172 | | -// reg [(0+1)-1:0] d_last; |
| 171 | +// reg [0:0] last [0:N_TAB-1]; //LRU |
| 172 | +// reg [0:0] d_last; |
173 | 173 | |
174 | | - function [((W_TAB-1)+1)-1:0] btb_index; |
175 | | - input [((W_A-1)+1)-1:0] pc; |
| 174 | + function [W_TAB-1:0] btb_index; |
| 175 | + input [W_A-1:0] pc; |
176 | 176 | begin |
177 | 177 | btb_index = pc >> 2; |
178 | 178 | end |
179 | 179 | endfunction |
180 | 180 | |
181 | | - function [((W_TAG-1)+1)-1:0] get_tag; |
182 | | - input [((W_A-1)+1)-1:0] pc; |
| 181 | + function [W_TAG-1:0] get_tag; |
| 182 | + input [W_A-1:0] pc; |
183 | 183 | begin |
184 | 184 | get_tag = pc[W_A-1:(W_A-W_TAG)]; |
185 | 185 | end |
|
200 | 200 | wire read_hit; |
201 | 201 | wire update_hit; |
202 | 202 | wire victim; |
203 | | - reg [((W_A-1)+1)-1:0] btb [0:((N_TAB-1)+1)-1]; |
204 | | - reg [((W_TAG-1)+1)-1:0] tag [0:((N_TAB-1)+1)-1]; |
205 | | - wire [((W_TAG-1)+1)-1:0] read_tag; |
206 | | - wire [((W_A-1)+1)-1:0] read_target; |
207 | | - wire [((W_TAG-1)+1)-1:0] update_tag; |
| 203 | + reg [W_A-1:0] btb [0:N_TAB-1]; |
| 204 | + reg [W_TAG-1:0] tag [0:N_TAB-1]; |
| 205 | + wire [W_TAG-1:0] read_tag; |
| 206 | + wire [W_A-1:0] read_target; |
| 207 | + wire [W_TAG-1:0] update_tag; |
208 | 208 | wire t_read_ras; |
209 | | - reg [(0+1)-1:0] ras [0:((N_TAB-1)+1)-1]; |
| 209 | + reg [0:0] ras [0:N_TAB-1]; |
210 | 210 | wire btb_we; |
211 | 211 | assign btb_we = d_rslt && d_update && (update_hit || victim); |
212 | 212 | btb_mem #(.W_A(W_A), .W_TAB(W_TAB), .N_TAB(N_TAB)) |
|
301 | 301 | ( |
302 | 302 | input CLK, |
303 | 303 | input EN, |
304 | | - input [((W_TAB-1)+1)-1:0] I_A0, |
305 | | - output [((W_A-1)+1)-1:0] O_Q0, |
306 | | - input [((W_TAB-1)+1)-1:0] I_A1, |
307 | | - input [((W_A-1)+1)-1:0] I_D1, |
| 304 | + input [W_TAB-1:0] I_A0, |
| 305 | + output [W_A-1:0] O_Q0, |
| 306 | + input [W_TAB-1:0] I_A1, |
| 307 | + input [W_A-1:0] I_D1, |
308 | 308 | input I_WE1 |
309 | 309 | ); |
310 | 310 |
|
311 | | - reg [((W_A-1)+1)-1:0] btb [0:((N_TAB-1)+1)-1]; |
312 | | - reg [((W_TAB-1)+1)-1:0] d_I_A0; |
| 311 | + reg [W_A-1:0] btb [0:N_TAB-1]; |
| 312 | + reg [W_TAB-1:0] d_I_A0; |
313 | 313 |
|
314 | 314 | integer i; |
315 | 315 | initial begin |
|
336 | 336 | ( |
337 | 337 | input CLK, |
338 | 338 | input EN, |
339 | | - input [((W_TAB-1)+1)-1:0] I_A0, |
340 | | - output [((W_TAG-1)+1)-1:0] O_Q0, |
341 | | - input [((W_TAB-1)+1)-1:0] I_A1, |
342 | | - output [((W_TAG-1)+1)-1:0] O_Q1, |
343 | | - input [((W_TAB-1)+1)-1:0] I_A2, |
344 | | - input [((W_TAG-1)+1)-1:0] I_D2, |
| 339 | + input [W_TAB-1:0] I_A0, |
| 340 | + output [W_TAG-1:0] O_Q0, |
| 341 | + input [W_TAB-1:0] I_A1, |
| 342 | + output [W_TAG-1:0] O_Q1, |
| 343 | + input [W_TAB-1:0] I_A2, |
| 344 | + input [W_TAG-1:0] I_D2, |
345 | 345 | input I_WE2 |
346 | 346 | ); |
347 | 347 | |
348 | 348 | localparam W_TAG = W_A - (W_TAB + 2); |
349 | | - reg [((W_TAG-1)+1)-1:0] tag [0:((N_TAB-1)+1)-1]; |
350 | | - reg [((W_TAB-1)+1)-1:0] d_I_A0; |
351 | | - reg [((W_TAB-1)+1)-1:0] d_I_A1; |
| 349 | + reg [W_TAG-1:0] tag [0:N_TAB-1]; |
| 350 | + reg [W_TAB-1:0] d_I_A0; |
| 351 | + reg [W_TAB-1:0] d_I_A1; |
352 | 352 |
|
353 | 353 | integer i; |
354 | 354 | initial begin |
|
378 | 378 | ( |
379 | 379 | input CLK, |
380 | 380 | input EN, |
381 | | - input [((W_TAB-1)+1)-1:0] I_A0, |
382 | | - output [(0+1)-1:0] O_Q0, |
383 | | - input [((W_TAB-1)+1)-1:0] I_A1, |
384 | | - input [(0+1)-1:0] I_D1, |
| 381 | + input [W_TAB-1:0] I_A0, |
| 382 | + output [0:0] O_Q0, |
| 383 | + input [W_TAB-1:0] I_A1, |
| 384 | + input [0:0] I_D1, |
385 | 385 | input I_WE1 |
386 | 386 | ); |
387 | 387 |
|
388 | | - reg [(0+1)-1:0] ras [0:((N_TAB-1)+1)-1]; |
389 | | - reg [((W_TAB-1)+1)-1:0] d_I_A0; |
| 388 | + reg [0:0] ras [0:N_TAB-1]; |
| 389 | + reg [W_TAB-1:0] d_I_A0; |
390 | 390 | |
391 | 391 | integer i; |
392 | 392 | initial begin |
|
419 | 419 | input EN, |
420 | 420 | input I_PUSH, |
421 | 421 | input I_POP, |
422 | | - input [((W_A-1)+1)-1:0] I_ADDR, |
423 | | - output reg [((W_A-1)+1)-1:0] O_ADDR, |
| 422 | + input [W_A-1:0] I_ADDR, |
| 423 | + output reg [W_A-1:0] O_ADDR, |
424 | 424 | output O_OVERFLOW |
425 | 425 | ); |
426 | 426 |
|
427 | | - reg [((W_A-1)+1)-1:0] stack [0:(N_STACK+1)-1]; |
428 | | - reg [((W_STACK-1)+1)-1:0] head; |
429 | | - reg [((W_CNT-1)+1)-1:0] over_cnt; |
| 427 | + reg [W_A-1:0] stack [0:N_STACK]; |
| 428 | + reg [W_STACK-1:0] head; |
| 429 | + reg [W_CNT-1:0] over_cnt; |
430 | 430 | |
431 | 431 | assign O_OVERFLOW = (over_cnt > 0); |
432 | | - wire [((W_STACK-1)+1)-1:0] read_ptr; |
| 432 | + wire [W_STACK-1:0] read_ptr; |
433 | 433 | assign read_ptr = (head == 0)? 0 : head -1; |
434 | 434 | //assign O_ADDR = (head == 0)? 0: stack[read_ptr]; |
435 | 435 | |
|
470 | 470 | ) |
471 | 471 | input CLK, RST_X; |
472 | 472 | input EN; |
473 | | - input [((W_A-1)+1)-1:0] pc; |
| 473 | + input [W_A-1:0] pc; |
474 | 474 | output pred; |
475 | | - input [((W_A-1)+1)-1:0] update_pc; |
| 475 | + input [W_A-1:0] update_pc; |
476 | 476 | input update; |
477 | 477 | input rslt; |
478 | 478 | assign pred = 0; |
|
492 | 492 | ( |
493 | 493 | input CLK, RST_X, |
494 | 494 | input EN, |
495 | | - input [((W_A-1)+1)-1:0] pc, |
496 | | - output [((W_A-1)+1)-1:0] pred_target, |
| 495 | + input [W_A-1:0] pc, |
| 496 | + output [W_A-1:0] pred_target, |
497 | 497 | output exist, |
498 | 498 | output read_ras, |
499 | | - input [((W_A-1)+1)-1:0] update_pc, |
500 | | - input [((W_A-1)+1)-1:0] update_target, |
| 499 | + input [W_A-1:0] update_pc, |
| 500 | + input [W_A-1:0] update_target, |
501 | 501 | input update_read_ras, |
502 | 502 | input update, |
503 | 503 | input rslt |
|
521 | 521 | input EN, |
522 | 522 | input I_PUSH, |
523 | 523 | input I_POP, |
524 | | - input [((W_A-1)+1)-1:0] I_ADDR, |
525 | | - output [((W_A-1)+1)-1:0] O_ADDR, |
| 524 | + input [W_A-1:0] I_ADDR, |
| 525 | + output [W_A-1:0] O_ADDR, |
526 | 526 | output O_OVERFLOW |
527 | 527 | ); |
528 | 528 | assign O_ADDR = 0; |
|
0 commit comments