]> Joshua Wise's Git repositories - firearm.git/blobdiff - Fetch.v
Fetch, ICache: Autoize ICache/Fetch interface, and rename with more stylish names.
[firearm.git] / Fetch.v
diff --git a/Fetch.v b/Fetch.v
index aa9bd7ca91c92c8bc8b94bdec0602db2e06819e6..4dbe365613b73f7588ef1ac79f1f34aca0eba83e 100644 (file)
--- a/Fetch.v
+++ b/Fetch.v
@@ -1,54 +1,54 @@
 module Fetch(
-       input clk,
-       input Nrst,
+       input              clk,
+       input              Nrst,
        
-       output wire [31:0] rd_addr,
-       output wire rd_req,
-       input rd_wait,
-       input [31:0] rd_data,
+       output wire [31:0] ic__rd_addr_0a,
+       output wire        ic__rd_req_0a,
+       input              ic__rd_wait_0a,
+       input       [31:0] ic__rd_data_0a,
        
-       input stall,
-       input jmp,
-       input [31:0] jmppc,
-       output reg bubble = 1,
-       output reg [31:0] insn = 0,
-       output reg [31:0] pc = 32'hFFFFFFFC);
+       input              stall_0a,
+       input              jmp_0a,
+       input       [31:0] jmppc_0a,
+       output reg         bubble_1a = 1,
+       output reg  [31:0] insn_1a = 0,
+       output reg  [31:0] pc_1a = 32'hFFFFFFFC);
        
        reg qjmp = 0;   /* A jump has been queued up while we were waiting. */
        reg [31:0] qjmppc;
        always @(posedge clk or negedge Nrst)
                if (!Nrst)
                        qjmp <= 0;
-               else if ((rd_wait || stall) && jmp)
-                       {qjmp,qjmppc} <= {jmp, jmppc};
-               else if (!rd_wait && !stall && qjmp)    /* It has already been intoed. */
+               else if ((ic__rd_wait_0a || stall_0a) && jmp_0a)
+                       {qjmp,qjmppc} <= {jmp_0a, jmppc_0a};
+               else if (!ic__rd_wait_0a && !stall_0a && qjmp)  /* It has already been intoed. */
                        {qjmp,qjmppc} <= {1'b0, 32'hxxxxxxxx};
        
-       reg [31:0] reqpc;
-       always @(*)
-               if (stall)
-                       reqpc = pc;
-               else if (qjmp)
-                       reqpc = qjmppc;
-               else if (jmp)
-                       reqpc = jmppc;
-               else
-                       reqpc = pc + 4;
-       
-       assign rd_addr = reqpc;
-       assign rd_req = 1;
+       reg [31:0] reqpc_0a;
        
+       /* Output latch logic */
+       assign ic__rd_addr_0a = reqpc_0a;
+       assign ic__rd_req_0a = 1;
        always @(posedge clk or negedge Nrst)
-       begin
                if (!Nrst) begin
-                       pc <= 32'hFFFFFFFC;
-                       bubble <= 1;
-               end else if (!stall)
-               begin
-                       bubble <= rd_wait;
-                       insn <= rd_data;
-                       if (!rd_wait)
-                               pc <= reqpc;
+                       bubble_1a <= 1;
+                       insn_1a <= 32'h00000000;
+                       pc_1a <= 32'h00000000;
+               end else if (!stall_0a) begin
+                       bubble_1a <= (jmp_0a || qjmp || ic__rd_wait_0a);
+                       insn_1a <= ic__rd_data_0a;
+                       pc_1a <= reqpc_0a;
+               end
+       
+       always @(posedge clk or negedge Nrst)
+               if (!Nrst)
+                       reqpc_0a <= 0;
+               else if (!stall_0a && !ic__rd_wait_0a) begin
+                       if (qjmp)
+                               reqpc_0a <= qjmppc;
+                       else if (jmp_0a)
+                               reqpc_0a <= jmppc_0a;
+                       else
+                               reqpc_0a <= reqpc_0a + 4;
                end
-       end
 endmodule
This page took 0.026433 seconds and 4 git commands to generate.