forked from openhwgroup/cv32e40p
-
Notifications
You must be signed in to change notification settings - Fork 8
/
prefetch_L0_buffer.sv
837 lines (684 loc) · 23.8 KB
/
prefetch_L0_buffer.sv
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
// Copyright 2015 ETH Zurich and University of Bologna.
// Copyright and related rights are licensed under the Solderpad Hardware
// License, Version 0.51 (the “License”); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://solderpad.org/licenses/SHL-0.51. Unless required by applicable law
// or agreed to in writing, software, hardware and materials distributed under
// this License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License.
////////////////////////////////////////////////////////////////////////////////
// Engineer: Igor Loi - [email protected] //
// //
// Additional contributions by: //
// Andreas Traber - [email protected] //
// //
// Design Name: Prefetcher Buffer for 128 bit memory interface //
// Project Name: RI5CY //
// Language: SystemVerilog //
// //
// Description: Prefetch Buffer that caches instructions. This cuts overly //
// long critical paths to the instruction cache //
// //
////////////////////////////////////////////////////////////////////////////////
module riscv_prefetch_L0_buffer
#(
parameter RDATA_IN_WIDTH = 128
)
(
input logic clk,
input logic rst_n,
input logic req_i,
input logic branch_i,
input logic [31:0] addr_i,
input logic hwloop_i,
input logic [31:0] hwloop_target_i,
input logic ready_i,
output logic valid_o,
output logic [31:0] rdata_o,
output logic [31:0] addr_o,
output logic is_hwlp_o, // is set when the currently served data is from a hwloop
// goes to instruction memory / instruction cache
output logic instr_req_o,
output logic [31:0] instr_addr_o,
input logic instr_gnt_i,
input logic instr_rvalid_i,
input logic [RDATA_IN_WIDTH/32-1:0][31:0] instr_rdata_i,
// Prefetch Buffer Status
output logic busy_o
);
logic busy_L0;
enum logic [3:0] { IDLE, BRANCHED,
HWLP_WAIT_GNT, HWLP_GRANTED, HWLP_GRANTED_WAIT, HWLP_FETCH_DONE,
NOT_VALID, NOT_VALID_GRANTED, NOT_VALID_CROSS, NOT_VALID_CROSS_GRANTED,
VALID, VALID_CROSS, VALID_GRANTED, VALID_FETCH_DONE } CS, NS;
logic do_fetch;
logic do_hwlp, do_hwlp_int;
logic use_last;
logic save_rdata_last;
logic use_hwlp;
logic save_rdata_hwlp;
logic valid;
logic hwlp_is_crossword;
logic is_crossword;
logic next_is_crossword;
logic next_valid;
logic next_upper_compressed;
logic fetch_possible;
logic upper_is_compressed;
logic [31:0] addr_q, addr_n, addr_int, addr_aligned_next, addr_real_next;
logic is_hwlp_q, is_hwlp_n;
logic [31:0] rdata_last_q;
logic valid_L0;
logic [RDATA_IN_WIDTH/32-1:0][31:0] rdata_L0;
logic [31:0] addr_L0;
logic fetch_valid;
logic fetch_gnt;
// prepared data for output
logic [31:0] rdata, rdata_unaligned;
logic aligned_is_compressed, unaligned_is_compressed;
logic hwlp_aligned_is_compressed, hwlp_unaligned_is_compressed;
prefetch_L0_buffer_L0
#(
.RDATA_IN_WIDTH ( RDATA_IN_WIDTH )
)
L0_buffer_i
(
.clk ( clk ),
.rst_n ( rst_n ),
.prefetch_i ( do_fetch ),
.prefetch_addr_i ( addr_real_next ), //addr_aligned_next
.branch_i ( branch_i ),
.branch_addr_i ( addr_i ),
.hwlp_i ( do_hwlp | do_hwlp_int ),
.hwlp_addr_i ( hwloop_target_i ),
.fetch_gnt_o ( fetch_gnt ),
.fetch_valid_o ( fetch_valid ),
.valid_o ( valid_L0 ),
.rdata_o ( rdata_L0 ),
.addr_o ( addr_L0 ),
.instr_req_o ( instr_req_o ),
.instr_addr_o ( instr_addr_o ),
.instr_gnt_i ( instr_gnt_i ),
.instr_rvalid_i ( instr_rvalid_i ),
.instr_rdata_i ( instr_rdata_i ),
.busy_o ( busy_L0 )
);
assign rdata = (use_last || use_hwlp) ? rdata_last_q : rdata_L0[addr_o[3:2]];
// the lower part of rdata_unaligned is always the higher part of rdata
assign rdata_unaligned[15:0] = rdata[31:16];
always_comb
begin
rdata_unaligned[31:16] = 'x;
case(addr_o[3:2])
2'b00: begin rdata_unaligned[31:16] = rdata_L0[1][15:0]; end
2'b01: begin rdata_unaligned[31:16] = rdata_L0[2][15:0]; end
2'b10: begin rdata_unaligned[31:16] = rdata_L0[3][15:0]; end
2'b11: begin rdata_unaligned[31:16] = rdata_L0[0][15:0]; end
endcase // addr_o
end
assign unaligned_is_compressed = rdata[17:16] != 2'b11;
assign aligned_is_compressed = rdata[1:0] != 2'b11;
assign upper_is_compressed = rdata_L0[3][17:16] != 2'b11;
assign is_crossword = (addr_o[3:1] == 3'b111) && (~upper_is_compressed);
assign next_is_crossword = ((addr_o[3:1] == 3'b110) && (aligned_is_compressed) && (~upper_is_compressed)) || ((addr_o[3:1] == 3'b101) && (~unaligned_is_compressed) && (~upper_is_compressed));
assign next_upper_compressed = ((addr_o[3:1] == 3'b110) && (aligned_is_compressed) && upper_is_compressed) || ((addr_o[3:1] == 3'b101) && (~unaligned_is_compressed) && upper_is_compressed);
assign next_valid = ((addr_o[3:2] != 2'b11) || next_upper_compressed) && (~next_is_crossword) && valid;
//addr_o[3:2] == 2'b11;// ((addr_o[3:1] == 3'b101) & (~upper_is_compressed)) | addr_o[3:2] == 2'b11; //
assign fetch_possible = (addr_o[3:2] == 2'b11 );
assign addr_aligned_next = { addr_o[31:2], 2'b00 } + 32'h4;
assign addr_real_next = (next_is_crossword) ? { addr_o[31:4], 4'b0000 } + 32'h16 : { addr_o[31:2], 2'b00 } + 32'h4;
assign hwlp_unaligned_is_compressed = rdata_L0[2][17:16] != 2'b11;
assign hwlp_aligned_is_compressed = rdata_L0[3][1:0] != 2'b11;
assign hwlp_is_crossword = (hwloop_target_i[3:1] == 3'b111) && (~upper_is_compressed);
always_comb
begin
addr_int = addr_o;
// advance address when pipeline is unstalled
if (ready_i) begin
if (addr_o[1]) begin
// unaligned case
// always move to next entry in the FIFO
if (unaligned_is_compressed) begin
addr_int = { addr_aligned_next[31:2], 2'b00};
end else begin
addr_int = { addr_aligned_next[31:2], 2'b10};
end
end else begin
// aligned case
if (aligned_is_compressed) begin
// just increase address, do not move to next entry in the FIFO
addr_int = { addr_o[31:2], 2'b10 };
end else begin
// move to next entry in the FIFO
addr_int = { addr_aligned_next[31:2], 2'b00 };
end
end
end
end
always_comb
begin
NS = CS;
do_fetch = 1'b0;
do_hwlp = 1'b0;
do_hwlp_int = 1'b0;
use_last = 1'b0;
use_hwlp = 1'b0;
save_rdata_last = 1'b0;
save_rdata_hwlp = 1'b0;
valid = 1'b0;
addr_n = addr_int;
is_hwlp_n = is_hwlp_q;
if (ready_i)
is_hwlp_n = 1'b0;
case (CS)
IDLE: begin
// wait here for something to happen
end
BRANCHED: begin
valid = 1'b0;
do_fetch = fetch_possible;
if (fetch_valid && (~is_crossword))
valid = 1'b1;
if (ready_i) begin
if (hwloop_i) begin
addr_n = addr_o; // keep the old address for now
NS = HWLP_WAIT_GNT;
end else begin
if (next_valid) begin
if (fetch_gnt) begin
save_rdata_last = 1'b1;
NS = VALID_GRANTED;
end else
NS = VALID;
end else if (next_is_crossword) begin
if (fetch_gnt) begin
save_rdata_last = 1'b1;
NS = NOT_VALID_CROSS_GRANTED;
end else begin
NS = NOT_VALID_CROSS;
end
end else begin
if (fetch_gnt)
NS = NOT_VALID_GRANTED;
else
NS = NOT_VALID;
end
end
end else begin
if (fetch_valid) begin
if (is_crossword) begin
save_rdata_last = 1'b1;
if (fetch_gnt)
NS = NOT_VALID_CROSS_GRANTED;
else
NS = NOT_VALID_CROSS;
end else begin
if (fetch_gnt) begin
save_rdata_last = 1'b1;
NS = VALID_GRANTED;
end else
NS = VALID;
end
end
end
end
NOT_VALID: begin
do_fetch = 1'b1;
if (fetch_gnt)
NS = NOT_VALID_GRANTED;
end
NOT_VALID_GRANTED: begin
valid = fetch_valid;
do_hwlp = hwloop_i;
if (fetch_valid)
NS = VALID;
end
NOT_VALID_CROSS:
begin
do_fetch = 1'b1;
if (fetch_gnt)
begin
save_rdata_last = 1'b1;
NS = NOT_VALID_CROSS_GRANTED;
end
end
NOT_VALID_CROSS_GRANTED:
begin
valid = fetch_valid;
use_last = 1'b1;
do_hwlp = hwloop_i;
if (fetch_valid)
begin
if (ready_i)
NS = VALID;
else
NS = VALID_CROSS;
end
end
VALID: begin
valid = 1'b1;
do_fetch = fetch_possible; // fetch_possible = addr_o[3:2] == 2'b11;//
do_hwlp = hwloop_i;
if (ready_i)
begin
if (next_is_crossword)
begin
do_fetch = 1'b1;
if (fetch_gnt)
begin
save_rdata_last = 1'b1;
NS = NOT_VALID_CROSS_GRANTED;
end
else // not fetching
begin
NS = NOT_VALID_CROSS;
end
end
else // Next is not crossword
if (~next_valid)
begin
if (fetch_gnt)
NS = NOT_VALID_GRANTED;
else
NS = NOT_VALID;
end
else // Next is valid
begin
if (fetch_gnt)
begin
if (next_upper_compressed)
begin
save_rdata_last = 1'b1;
NS = VALID_GRANTED;
end
end
end
end
else // NOT ready
begin
if (fetch_gnt)
begin
save_rdata_last = 1'b1;
NS = VALID_GRANTED;
end
end
end
VALID_CROSS: begin
valid = 1'b1;
use_last = 1'b1;
do_hwlp = hwloop_i;
if (ready_i)
NS = VALID;
end
VALID_GRANTED: begin
valid = 1'b1;
use_last = 1'b1;
do_hwlp = hwloop_i;
if (ready_i) begin
if (fetch_valid) begin
if (next_is_crossword)
NS = VALID_CROSS;
else if(next_upper_compressed)
NS = VALID_FETCH_DONE;
else
NS = VALID;
end else begin
if (next_is_crossword)
NS = NOT_VALID_CROSS_GRANTED;
else if (next_upper_compressed)
NS = VALID_GRANTED;
else
NS = NOT_VALID_GRANTED;
end
end else begin
if (fetch_valid)
NS = VALID_FETCH_DONE;
end
end
VALID_FETCH_DONE: begin
valid = 1'b1;
use_last = 1'b1;
do_hwlp = hwloop_i;
if (ready_i) begin
if (next_is_crossword)
NS = VALID_CROSS;
else if (next_upper_compressed)
NS = VALID_FETCH_DONE;
else
NS = VALID;
end
end
HWLP_WAIT_GNT: begin
do_hwlp_int = 1'b1;
if (fetch_gnt) begin
is_hwlp_n = 1'b1;
addr_n = hwloop_target_i;
NS = BRANCHED;
end
end
HWLP_GRANTED: begin
valid = 1'b1;
use_hwlp = 1'b1;
if (ready_i) begin
addr_n = hwloop_target_i;
if (fetch_valid) begin
is_hwlp_n = 1'b1;
if (hwlp_is_crossword) begin
NS = NOT_VALID_CROSS;
end else begin
NS = VALID;
end
end else begin
NS = HWLP_GRANTED_WAIT;
end
end else begin
if (fetch_valid)
NS = HWLP_FETCH_DONE;
end
end
HWLP_GRANTED_WAIT: begin
use_hwlp = 1'b1;
if (fetch_valid) begin
is_hwlp_n = 1'b1;
if (hwlp_is_crossword) begin
NS = NOT_VALID_CROSS;
end else begin
NS = VALID;
end
end
end
HWLP_FETCH_DONE: begin
valid = 1'b1;
use_hwlp = 1'b1;
if (ready_i) begin
is_hwlp_n = 1'b1;
addr_n = hwloop_target_i;
if (hwlp_is_crossword) begin
NS = NOT_VALID_CROSS;
end else begin
NS = VALID;
end
end
end
endcase
// branches always have priority
if (branch_i) begin
is_hwlp_n = 1'b0;
addr_n = addr_i;
NS = BRANCHED;
end else if (hwloop_i) begin
if (do_hwlp) begin
if (ready_i) begin
if (fetch_gnt) begin
is_hwlp_n = 1'b1;
addr_n = hwloop_target_i;
NS = BRANCHED;
end else begin
addr_n = addr_o; // keep the old address for now
NS = HWLP_WAIT_GNT;
end
end else begin
if (fetch_gnt) begin
save_rdata_hwlp = 1'b1;
NS = HWLP_GRANTED;
end
end
end
end
end
//////////////////////////////////////////////////////////////////////////////
// registers
//////////////////////////////////////////////////////////////////////////////
always_ff @(posedge clk, negedge rst_n)
begin
if (~rst_n)
begin
addr_q <= '0;
is_hwlp_q <= 1'b0;
CS <= IDLE;
rdata_last_q <= '0;
end
else
begin
addr_q <= addr_n;
is_hwlp_q <= is_hwlp_n;
CS <= NS;
if (save_rdata_hwlp)
rdata_last_q <= rdata_o;
else if(save_rdata_last)
begin
//rdata_last_q <= rdata_L0[3];
if(ready_i)
begin
rdata_last_q <= rdata_L0[3];//rdata;
end
else
begin
rdata_last_q <= rdata;//rdata;
end
end
end
end
//////////////////////////////////////////////////////////////////////////////
// output ports
//////////////////////////////////////////////////////////////////////////////
assign rdata_o = ((~addr_o[1]) || use_hwlp) ? rdata : rdata_unaligned;
assign valid_o = valid & (~branch_i);
assign addr_o = addr_q;
assign is_hwlp_o = is_hwlp_q & (~branch_i);
assign busy_o = busy_L0;
`ifndef verilator
//----------------------------------------------------------------------------
// Assertions
//----------------------------------------------------------------------------
// there should never be a ready_i without valid_o
assert property (
@(posedge clk) (ready_i) |-> (valid_o) ) else $warning("IF Stage is ready without prefetcher having valid data");
// never is_crossword while also next_is_crossword
assert property (
@(posedge clk) (next_is_crossword) |-> (~is_crossword) ) else $warning("Cannot have two crossword accesses back-to-back");
assert property (
@(posedge clk) (is_crossword) |-> (~next_is_crossword) ) else $warning("Cannot have two crossword accesses back-to-back");
`endif
endmodule // prefetch_L0_buffer
module prefetch_L0_buffer_L0
#(
parameter RDATA_IN_WIDTH = 128
)
(
input logic clk,
input logic rst_n,
input logic prefetch_i,
input logic [31:0] prefetch_addr_i,
input logic branch_i,
input logic [31:0] branch_addr_i,
input logic hwlp_i,
input logic [31:0] hwlp_addr_i,
output logic fetch_gnt_o,
output logic fetch_valid_o,
output logic valid_o,
output logic [RDATA_IN_WIDTH/32-1:0][31:0] rdata_o,
output logic [31:0] addr_o,
// goes to instruction memory / instruction cache
output logic instr_req_o,
output logic [31:0] instr_addr_o,
input logic instr_gnt_i,
input logic instr_rvalid_i,
input logic [RDATA_IN_WIDTH/32-1:0][31:0] instr_rdata_i,
output logic busy_o
);
enum logic [2:0] { EMPTY, VALID_L0, WAIT_GNT, WAIT_RVALID, ABORTED_BRANCH, WAIT_HWLOOP } CS, NS;
logic [3:0][31:0] L0_buffer;
logic [31:0] addr_q, instr_addr_int;
logic valid;
//////////////////////////////////////////////////////////////////////////////
// FSM
//////////////////////////////////////////////////////////////////////////////
always_comb
begin
NS = CS;
valid = 1'b0;
instr_req_o = 1'b0;
instr_addr_int = 'x;
fetch_valid_o = 1'b0;
case(CS)
// wait for the first branch request before fetching any instructions
EMPTY:
begin
if (branch_i)
instr_addr_int = branch_addr_i;
else if (hwlp_i)
instr_addr_int = hwlp_addr_i;
else
instr_addr_int = prefetch_addr_i;
if (branch_i | hwlp_i | prefetch_i) // make the request to icache
begin
instr_req_o = 1'b1;
if (instr_gnt_i)
NS = WAIT_RVALID;
else
NS = WAIT_GNT;
end
end //~EMPTY
WAIT_GNT:
begin
if (branch_i)
instr_addr_int = branch_addr_i;
else if (hwlp_i)
instr_addr_int = hwlp_addr_i;
else
instr_addr_int = addr_q;
if (branch_i)
begin
instr_req_o = 1'b1;
if (instr_gnt_i)
NS = WAIT_RVALID;
else
NS = WAIT_GNT;
end
else
begin
instr_req_o = 1'b1;
if (instr_gnt_i)
NS = WAIT_RVALID;
else
NS = WAIT_GNT;
end
end //~WAIT_GNT
WAIT_RVALID:
begin
valid = instr_rvalid_i;
if (branch_i)
instr_addr_int = branch_addr_i;
else if (hwlp_i)
instr_addr_int = hwlp_addr_i;
else
instr_addr_int = prefetch_addr_i;
if (branch_i)
begin
if (instr_rvalid_i)
begin
fetch_valid_o = 1'b1;
instr_req_o = 1'b1;
if (instr_gnt_i)
NS = WAIT_RVALID;
else
NS = WAIT_GNT;
end else begin
NS = ABORTED_BRANCH; // TODO: THIS STATE IS IDENTICAL WITH THIS ONE
end
end
else
begin
if (instr_rvalid_i)
begin
fetch_valid_o = 1'b1;
if (prefetch_i | hwlp_i) // we are receiving the last packet, then prefetch the next one
begin
instr_req_o = 1'b1;
if (instr_gnt_i)
NS = WAIT_RVALID;
else
NS = WAIT_GNT;
end
else // not the last chunk
begin
NS = VALID_L0;
end
end
end
end //~WAIT_RVALID
VALID_L0:
begin
valid = 1'b1;
if (branch_i)
instr_addr_int = branch_addr_i;
else if (hwlp_i)
instr_addr_int = hwlp_addr_i;
else
instr_addr_int = prefetch_addr_i;
if (branch_i | hwlp_i | prefetch_i)
begin
instr_req_o = 1'b1;
if (instr_gnt_i)
NS = WAIT_RVALID;
else
NS = WAIT_GNT;
end
end //~VALID_L0
ABORTED_BRANCH:
begin
// prepare address even if we don't need it
// this removes the dependency for instr_addr_o on instr_rvalid_i
if (branch_i)
instr_addr_int = branch_addr_i;
else
instr_addr_int = addr_q;
if (instr_rvalid_i)
begin
instr_req_o = 1'b1;
if (instr_gnt_i)
NS = WAIT_RVALID;
else
NS = WAIT_GNT;
end
end //~ABORTED_BRANCH
default:
begin
NS = EMPTY;
end
endcase //~CS
end
//////////////////////////////////////////////////////////////////////////////
// registers
//////////////////////////////////////////////////////////////////////////////
always_ff @(posedge clk, negedge rst_n)
begin
if (~rst_n)
begin
CS <= EMPTY;
L0_buffer <= '0;
addr_q <= '0;
end
else
begin
CS <= NS;
if (instr_rvalid_i)
begin
L0_buffer <= instr_rdata_i;
end
if (branch_i | hwlp_i | prefetch_i)
addr_q <= instr_addr_int;
end
end
//////////////////////////////////////////////////////////////////////////////
// output ports
//////////////////////////////////////////////////////////////////////////////
assign instr_addr_o = { instr_addr_int[31:4], 4'b0000 };
assign rdata_o = (instr_rvalid_i) ? instr_rdata_i : L0_buffer;
assign addr_o = addr_q;
assign valid_o = valid & (~branch_i);
assign busy_o = (CS != EMPTY) && (CS != VALID_L0) || instr_req_o;
assign fetch_gnt_o = instr_gnt_i;
endmodule