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

Subversion Repositories or1k

[/] [or1k/] [tags/] [rel_23/] [or1200/] [rtl/] [verilog/] [or1200_ctrl.v] - Diff between revs 1032 and 1159

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 1032 Rev 1159
Line 42... Line 42...
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//
//
// CVS Revision History
// CVS Revision History
//
//
// $Log: not supported by cvs2svn $
// $Log: not supported by cvs2svn $
 
// Revision 1.7  2002/09/07 05:42:02  lampret
 
// Added optional SR[CY]. Added define to enable additional (compare) flag modifiers. Defines are OR1200_IMPL_ADDC and OR1200_ADDITIONAL_FLAG_MODIFIERS.
 
//
// Revision 1.6  2002/03/29 15:16:54  lampret
// Revision 1.6  2002/03/29 15:16:54  lampret
// Some of the warnings fixed.
// Some of the warnings fixed.
//
//
// Revision 1.5  2002/02/01 19:56:54  lampret
// Revision 1.5  2002/02/01 19:56:54  lampret
// Fixed combinational loops.
// Fixed combinational loops.
Line 161... Line 164...
// Internal wires and regs
// Internal wires and regs
//
//
reg     [`OR1200_BRANCHOP_WIDTH-1:0]             pre_branch_op;
reg     [`OR1200_BRANCHOP_WIDTH-1:0]             pre_branch_op;
reg     [`OR1200_BRANCHOP_WIDTH-1:0]             branch_op;
reg     [`OR1200_BRANCHOP_WIDTH-1:0]             branch_op;
reg     [`OR1200_ALUOP_WIDTH-1:0]                alu_op;
reg     [`OR1200_ALUOP_WIDTH-1:0]                alu_op;
 
`ifdef OR1200_MAC_IMPLEMENTED
reg     [`OR1200_MACOP_WIDTH-1:0]                mac_op;
reg     [`OR1200_MACOP_WIDTH-1:0]                mac_op;
 
reg                                     ex_macrc_op;
 
`else
 
wire    [`OR1200_MACOP_WIDTH-1:0]                mac_op;
 
wire                                    ex_macrc_op;
 
`endif
reg     [`OR1200_SHROTOP_WIDTH-1:0]              shrot_op;
reg     [`OR1200_SHROTOP_WIDTH-1:0]              shrot_op;
reg     [31:0]                           id_insn;
reg     [31:0]                           id_insn;
reg     [31:0]                           ex_insn;
reg     [31:0]                           ex_insn;
reg     [31:0]                           wb_insn;
reg     [31:0]                           wb_insn;
reg     [`OR1200_REGFILE_ADDR_WIDTH-1:0] rf_addrw;
reg     [`OR1200_REGFILE_ADDR_WIDTH-1:0] rf_addrw;
Line 181... Line 190...
reg                                     imm_signextend;
reg                                     imm_signextend;
reg     [15:0]                           spr_addrimm;
reg     [15:0]                           spr_addrimm;
reg                                     sig_syscall;
reg                                     sig_syscall;
reg                                     sig_trap;
reg                                     sig_trap;
reg                                     except_illegal;
reg                                     except_illegal;
reg                                     ex_macrc_op;
 
wire                                    id_void;
wire                                    id_void;
 
 
//
//
// Register file read addresses
// Register file read addresses
//
//
Line 216... Line 224...
assign branch_addrofs = {{4{ex_insn[25]}}, ex_insn[25:0]};
assign branch_addrofs = {{4{ex_insn[25]}}, ex_insn[25:0]};
 
 
//
//
// l.macrc in ID stage
// l.macrc in ID stage
//
//
 
`ifdef OR1200_MAC_IMPLEMENTED
assign id_macrc_op = (id_insn[31:26] == `OR1200_OR32_MOVHI) & id_insn[16];
assign id_macrc_op = (id_insn[31:26] == `OR1200_OR32_MOVHI) & id_insn[16];
 
`else
 
assign id_macrc_op = 1'b0;
 
`endif
 
 
//
//
//
//
//
//
assign rfe = (pre_branch_op == `OR1200_BRANCHOP_RFE) | (branch_op == `OR1200_BRANCHOP_RFE);
assign rfe = (pre_branch_op == `OR1200_BRANCHOP_RFE) | (branch_op == `OR1200_BRANCHOP_RFE);
Line 250... Line 262...
                sel_b = `OR1200_SEL_RF;
                sel_b = `OR1200_SEL_RF;
 
 
//
//
// l.macrc in EX stage
// l.macrc in EX stage
//
//
 
`ifdef OR1200_MAC_IMPLEMENTED
always @(posedge clk or posedge rst) begin
always @(posedge clk or posedge rst) begin
        if (rst)
        if (rst)
                ex_macrc_op <= #1 1'b0;
                ex_macrc_op <= #1 1'b0;
        else if (!ex_freeze & id_freeze | flushpipe)
        else if (!ex_freeze & id_freeze | flushpipe)
                ex_macrc_op <= #1 1'b0;
                ex_macrc_op <= #1 1'b0;
        else if (!ex_freeze)
        else if (!ex_freeze)
                ex_macrc_op <= #1 id_macrc_op;
                ex_macrc_op <= #1 id_macrc_op;
end
end
 
`else
 
assign ex_macrc_op = 1'b0;
 
`endif
 
 
//
//
// Decode of spr_addrimm
// Decode of spr_addrimm
//
//
always @(posedge clk or posedge rst) begin
always @(posedge clk or posedge rst) begin
Line 349... Line 365...
        // l.xori
        // l.xori
        `OR1200_OR32_XORI:
        `OR1200_OR32_XORI:
                imm_signextend = 1'b1;
                imm_signextend = 1'b1;
 
 
        // l.muli
        // l.muli
 
`ifdef OR1200_MULT_IMPLEMENTED
        `OR1200_OR32_MULI:
        `OR1200_OR32_MULI:
                imm_signextend = 1'b1;
                imm_signextend = 1'b1;
 
`endif
 
 
        // l.maci
        // l.maci
 
`ifdef OR1200_MAC_IMPLEMENTED
        `OR1200_OR32_MACI:
        `OR1200_OR32_MACI:
                imm_signextend = 1'b1;
                imm_signextend = 1'b1;
 
`endif
 
 
        // SFXX insns with immediate
        // SFXX insns with immediate
        `OR1200_OR32_SFXXI:
        `OR1200_OR32_SFXXI:
                imm_signextend = 1'b1;
                imm_signextend = 1'b1;
 
 
Line 492... Line 512...
            // l.sys, l.brk and all three sync insns
            // l.sys, l.brk and all three sync insns
            `OR1200_OR32_XSYNC:
            `OR1200_OR32_XSYNC:
              sel_imm <= #1 1'b0;
              sel_imm <= #1 1'b0;
 
 
            // l.mac/l.msb
            // l.mac/l.msb
 
`ifdef OR1200_MAC_IMPLEMENTED
            `OR1200_OR32_MACMSB:
            `OR1200_OR32_MACMSB:
              sel_imm <= #1 1'b0;
              sel_imm <= #1 1'b0;
 
`endif
 
 
            // l.sw
            // l.sw
            `OR1200_OR32_SW:
            `OR1200_OR32_SW:
              sel_imm <= #1 1'b0;
              sel_imm <= #1 1'b0;
 
 
Line 550... Line 572...
            `OR1200_OR32_BF,
            `OR1200_OR32_BF,
            `OR1200_OR32_RFE,
            `OR1200_OR32_RFE,
            `OR1200_OR32_MOVHI,
            `OR1200_OR32_MOVHI,
            `OR1200_OR32_MFSPR,
            `OR1200_OR32_MFSPR,
            `OR1200_OR32_XSYNC,
            `OR1200_OR32_XSYNC,
 
`ifdef OR1200_MAC_IMPLEMENTED
            `OR1200_OR32_MACI,
            `OR1200_OR32_MACI,
 
`endif
            `OR1200_OR32_LWZ,
            `OR1200_OR32_LWZ,
            `OR1200_OR32_LBZ,
            `OR1200_OR32_LBZ,
            `OR1200_OR32_LBS,
            `OR1200_OR32_LBS,
            `OR1200_OR32_LHZ,
            `OR1200_OR32_LHZ,
            `OR1200_OR32_LHS,
            `OR1200_OR32_LHS,
            `OR1200_OR32_ADDI,
            `OR1200_OR32_ADDI,
            `OR1200_OR32_ADDIC,
            `OR1200_OR32_ADDIC,
            `OR1200_OR32_ANDI,
            `OR1200_OR32_ANDI,
            `OR1200_OR32_ORI,
            `OR1200_OR32_ORI,
            `OR1200_OR32_XORI,
            `OR1200_OR32_XORI,
 
`ifdef OR1200_MULT_IMPLEMENTED
            `OR1200_OR32_MULI,
            `OR1200_OR32_MULI,
 
`endif
            `OR1200_OR32_SH_ROTI,
            `OR1200_OR32_SH_ROTI,
            `OR1200_OR32_SFXXI,
            `OR1200_OR32_SFXXI,
            `OR1200_OR32_MTSPR,
            `OR1200_OR32_MTSPR,
 
`ifdef OR1200_MAC_IMPLEMENTED
            `OR1200_OR32_MACMSB,
            `OR1200_OR32_MACMSB,
 
`endif
            `OR1200_OR32_SW,
            `OR1200_OR32_SW,
            `OR1200_OR32_SB,
            `OR1200_OR32_SB,
            `OR1200_OR32_SH,
            `OR1200_OR32_SH,
            `OR1200_OR32_ALU,
            `OR1200_OR32_ALU,
            `OR1200_OR32_SFXX,
            `OR1200_OR32_SFXX,
Line 643... Line 671...
            // l.xori
            // l.xori
            `OR1200_OR32_XORI:
            `OR1200_OR32_XORI:
              alu_op <= #1 `OR1200_ALUOP_XOR;
              alu_op <= #1 `OR1200_ALUOP_XOR;
 
 
            // l.muli
            // l.muli
 
`ifdef OR1200_MULT_IMPLEMENTED
            `OR1200_OR32_MULI:
            `OR1200_OR32_MULI:
              alu_op <= #1 `OR1200_ALUOP_MUL;
              alu_op <= #1 `OR1200_ALUOP_MUL;
 
`endif
 
 
            // Shift and rotate insns with immediate
            // Shift and rotate insns with immediate
            `OR1200_OR32_SH_ROTI:
            `OR1200_OR32_SH_ROTI:
              alu_op <= #1 `OR1200_ALUOP_SHROT;
              alu_op <= #1 `OR1200_ALUOP_SHROT;
 
 
Line 675... Line 705...
end
end
 
 
//
//
// Decode of mac_op
// Decode of mac_op
//
//
 
`ifdef OR1200_MAC_IMPLEMENTED
always @(posedge clk or posedge rst) begin
always @(posedge clk or posedge rst) begin
        if (rst)
        if (rst)
                mac_op <= #1 `OR1200_MACOP_NOP;
                mac_op <= #1 `OR1200_MACOP_NOP;
        else if (!ex_freeze & id_freeze | flushpipe)
        else if (!ex_freeze & id_freeze | flushpipe)
                mac_op <= #1 `OR1200_MACOP_NOP;
                mac_op <= #1 `OR1200_MACOP_NOP;
Line 700... Line 731...
 
 
          endcase
          endcase
        else
        else
                mac_op <= #1 `OR1200_MACOP_NOP;
                mac_op <= #1 `OR1200_MACOP_NOP;
end
end
 
`else
 
assign mac_op = `OR1200_MACOP_NOP;
 
`endif
 
 
//
//
// Decode of shrot_op
// Decode of shrot_op
//
//
always @(posedge clk or posedge rst) begin
always @(posedge clk or posedge rst) begin
Line 782... Line 816...
                  // l.xori
                  // l.xori
                  `OR1200_OR32_XORI:
                  `OR1200_OR32_XORI:
                    rfwb_op <= #1 `OR1200_RFWBOP_ALU;
                    rfwb_op <= #1 `OR1200_RFWBOP_ALU;
 
 
                  // l.muli
                  // l.muli
 
`ifdef OR1200_MULT_IMPLEMENTED
                  `OR1200_OR32_MULI:
                  `OR1200_OR32_MULI:
                    rfwb_op <= #1 `OR1200_RFWBOP_ALU;
                    rfwb_op <= #1 `OR1200_RFWBOP_ALU;
 
`endif
 
 
                  // Shift and rotate insns with immediate
                  // Shift and rotate insns with immediate
                  `OR1200_OR32_SH_ROTI:
                  `OR1200_OR32_SH_ROTI:
                    rfwb_op <= #1 `OR1200_RFWBOP_ALU;
                    rfwb_op <= #1 `OR1200_RFWBOP_ALU;
 
 

powered by: WebSVN 2.1.0

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