aboutsummaryrefslogtreecommitdiff
path: root/core/rtl/ifu.sv
blob: 0eb3b1d23be932b513dd8f99962081f067e1d587 (plain) (blame)
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
module ifu
  import riscv_types::*;
(
    input logic clk,
    input logic rst_l,

    // IMEM interface
    output logic [31:0] if_imem_addr_IF
);

  logic [31:0] pc_IF;
  logic [31:0] pcNxt_IF;

  assign if_imem_addr_IF = pc_IF;  // Always fetch PC from IMEM, addresses are always 32 bit aligned
                                   // TODO: Find out if 32 is the best fetching width vs 16

  // Program Counter (PC)
  assign pcNxt_IF = pc_IF + 32'd4;

  AFFR #(
      .WIDTH(32)
  ) ff_IF_pc (
      .q(pc_IF),
      .d(pcNxt_IF),
      .en(1'b1),
      .clk(clk),
      .rst_l(rst_l)
  );

endmodule