OpenCores
URL https://opencores.org/ocsvn/fluid_core_2/fluid_core_2/trunk

Subversion Repositories fluid_core_2

[/] [fluid_core_2/] [trunk/] [xilinx14.5 project/] [IF_Stage.v] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 azmathmoos
`timescale 1ns / 1ps
2
`include "Configuration.v"
3
 
4
module IF_Stage(
5
        input Clk,
6
        input RST,
7
        input stall,
8
        input intr,
9
        input return_back,
10
        input [0:`pc_w] intr_vector,
11
        input [0:`inst_w] exInstruction,
12
        input [0:`pc_w] branch_target,
13
        input branch, linked,
14
        inout [0:3] stkFlag,
15
        output [0:`pc_w] exInstAddr,
16
        output exInstClk,
17
        output [0:`IF_ID_reg_w] IF_ID_reg
18
    );
19
 
20
 
21
        reg [0:`pc_w] PC;
22
        reg [0:`inst_w] IR;
23
        reg [0:`pc_w+4] PCStack [0:3];
24
        reg [0:1] PCStackPtr;
25
        reg HLT;
26
 
27
initial begin
28
PC <= 0;
29
IR <=0;
30
PCStackPtr <= 0;
31
end
32
 
33
always@ (posedge Clk) begin
34
        if (RST) begin
35
                PC <=0;
36
                IR <= 0;
37
                PCStackPtr <= 0;
38
                HLT <= 0;
39
        end else if (~HLT) begin
40
 
41
                if (intr) begin
42
                PCStack[PCStackPtr] <= {PC,stkFlag};
43
                PCStackPtr <= PCStackPtr + 1;
44
                PC <= intr_vector;
45
                end else if (branch) begin
46
                        if (linked) begin
47
                        PCStack[PCStackPtr] <= {PC+1,stkFlag};
48
                        PCStackPtr <= PCStackPtr + 1;
49
                        end
50
                PC <= branch_target;
51
                end else if (return_back) begin
52
                PCStackPtr <= PCStackPtr - 1;
53
                PC <= PCStack[PCStackPtr-1][0:`pc_w];
54
                end else if (~stall) begin
55
                PC <= PC + 1;
56
                IR <= exInstruction;
57
                HLT <= &exInstruction[0:`uop_vector_msb];
58
                end
59
 
60
        end
61
end
62
 
63
assign stkFlag = return_back ? PCStack[PCStackPtr][`pc_w+1:`pc_w+4]:'bz;
64
 
65
assign exInstAddr = PC;
66
assign exInstClk = Clk;
67
 
68
assign IF_ID_reg = IR;
69
 
70
endmodule

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.