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

Subversion Repositories fluid_core_2

[/] [fluid_core_2/] [trunk/] [rtl/] [ID_Stage.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 azmathmoos
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
//// Copyright (C) 2014-2015 Azmath Moosa                         ////
4
////                                                              ////
5
//// This source file may be used and distributed without         ////
6
//// restriction provided that this copyright statement is not    ////
7
//// removed from the file and that any derivative work contains  ////
8
//// the original copyright notice and the associated disclaimer. ////
9
////                                                              ////
10
//// This source file is free software; you can redistribute it   ////
11
//// and/or modify it under the terms of the GNU Lesser General   ////
12
//// Public License as published by the Free Software Foundation; ////
13
//// either version 3 of the License, or (at your option) any     ////
14
//// later version.                                               ////
15
////                                                              ////
16
//// This source is distributed in the hope that it will be       ////
17
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
18
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
19
//// PURPOSE.  See the GNU Lesser General Public License for more ////
20
//// details.                                                     ////
21
////                                                              ////
22
//// You should have received a copy of the GNU Lesser General    ////
23
//// Public License along with this source; if not, download it   ////
24
//// from http://www.opencores.org/lgpl.shtml                     ////
25
////                                                              ////
26
//////////////////////////////////////////////////////////////////////
27
`timescale 1ns / 1ps
28
`include "Configuration.v"
29
 
30
 
31
module ID_Stage(
32
        input [0:`IF_ID_reg_w] IF_ID_reg,
33
        input Clk,
34
        input RST,
35
        output [0:`reg_sel_w] RF_a,
36
        output [0:`reg_sel_w] RF_b,
37
        input [0:`dpw] RF_op_a,
38
        input [0:`dpw] RF_op_b,
39
        output [0:`ID_EX_reg_w] ID_EX_reg,
40
        //---op forwarding pins---//
41
        //output [0:`type_msb] curr_type,
42
        input [0:1] reg_src_A, reg_src_B, st_src,
43
        input [0:2] load_hazard_abs,
44
        output rrr_adm, rri_adm, not_branch,
45
        output [0:`uop_vector_msb] uop_vector,
46
        input [0:`uop_msb] uop
47
    );
48
//-----------------------MicroOperation--------------------------//
49
//      wire [0:`uop_vector_msb] uop_vector;
50
//      wire [0:`uop_msb] uop;
51
        assign uop_vector = IF_ID_reg[0:`uop_vector_msb];
52
 
53
 
54
 
55
        wire [0:3] adm;
56
        wire [0:`type_msb] Type;
57
        wire [0:`wb_dst_msb] WB_Dest;
58
        wire [0:`mod_sel_msb] Mod_Sel;
59
        wire [0:`operation_msb] Operation;
60
        wire bS0, bS1, bS2, bImm;
61
 
62
 
63
        assign Type = uop[0:`type_msb];
64
        assign WB_Dest = uop[`type_msb+1:`type_msb+1+`wb_dst_msb];
65
        assign adm = uop[`type_msb+1+`wb_dst_msb+1:`type_msb+1+`wb_dst_msb+4];
66
        assign bS0 = uop[`type_msb+1+`wb_dst_msb+1];
67
        assign bS1 = uop[`type_msb+1+`wb_dst_msb+2];
68
        assign bS2 = uop[`type_msb+1+`wb_dst_msb+3];
69
        assign bImm = uop[`type_msb+1+`wb_dst_msb+4];
70
        assign Mod_Sel = uop[`type_msb+1+`wb_dst_msb+5:`type_msb+1+`wb_dst_msb+5+`mod_sel_msb];
71
        assign Operation = uop[`type_msb+1+`wb_dst_msb+5+`mod_sel_msb+1:`type_msb+1+`wb_dst_msb+5+`mod_sel_msb+1+`operation_msb];
72
 
73
//------------fetch operands------------------//
74
        wire [0:`inst_w-`uop_vector_msb-1] raw_operands;
75
        assign raw_operands = IF_ID_reg[`uop_vector_msb+1:`inst_w];
76
 
77
        wire [0:`dpw] S0, S1, S2, Imm;
78
        reg [0:`dpw] buff_op_a, buff_op_b;
79
        wire [0:`bc_msb] Rd_BC;
80
 
81
        assign Rd_BC = raw_operands[0:`bc_msb];
82
 
83
 
84
        //update RF_a in negative half of cycle -- no need for that wrong comment!
85
        assign RF_a = bS0 ? Rd_BC[1:`bc_msb] : bS2 ? raw_operands[`bc_msb+1+`reg_sel_w+1:`bc_msb+1+`reg_sel_w+1+`reg_sel_w]:0 ;
86
        assign S0 = bS0 ? buff_op_a : 0;
87
 
88
        assign RF_b = bS1 ? raw_operands[`bc_msb+1:`bc_msb+1+`reg_sel_w]:0;
89
        assign S1 = bS1 ? buff_op_b : 0;
90
 
91
 
92
        assign Imm = bImm ? raw_operands[`bc_msb+1:`inst_w-`uop_vector_msb-1]:raw_operands[`bc_msb+1+`reg_sel_w+1:`inst_w-`uop_vector_msb-1];
93
        assign S2 = bS2 ? buff_op_a : Imm;
94
 
95
        //latch on to reg file in the negative half
96
        always@(*) begin
97
                if (~Clk) begin
98
                        buff_op_a <= RF_op_a;
99
                        buff_op_b <= RF_op_b;
100
                end
101
        end
102
 
103
//----Operand Forwarding----//
104
        assign not_branch = (|(Type ^ `type_branch));
105
        assign rrr_adm = (adm == `RRR);//(~(|(adm ^ `RRR)));
106
        assign rri_adm = (adm == `RRI);
107
 
108
//-----next stage----//
109
        assign ID_EX_reg = {Type,WB_Dest,Mod_Sel,Operation,Rd_BC,S0,S1,S2,reg_src_A,reg_src_B,st_src,load_hazard_abs};//
110
endmodule

powered by: WebSVN 2.1.0

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