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

Subversion Repositories openarty

[/] [openarty/] [trunk/] [rtl/] [cpu/] [idecode.v] - Diff between revs 3 and 49

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

Rev 3 Rev 49
Line 94... Line 94...
        reg     r_pipe;
        reg     r_pipe;
`endif
`endif
 
 
 
 
        wire    [4:0]    w_op;
        wire    [4:0]    w_op;
        wire            w_ldi, w_mov, w_cmptst, w_ldilo, w_ALU, w_brev, w_noop;
        wire            w_ldi, w_mov, w_cmptst, w_ldilo, w_ALU, w_brev, w_noop,
 
                        w_mpy;
        wire    [4:0]    w_dcdR, w_dcdB, w_dcdA;
        wire    [4:0]    w_dcdR, w_dcdB, w_dcdA;
        wire            w_dcdR_pc, w_dcdR_cc;
        wire            w_dcdR_pc, w_dcdR_cc;
        wire            w_dcdA_pc, w_dcdA_cc;
        wire            w_dcdA_pc, w_dcdA_cc;
        wire            w_dcdB_pc, w_dcdB_cc;
        wire            w_dcdB_pc, w_dcdB_cc;
        wire    [3:0]    w_cond;
        wire    [3:0]    w_cond;
        wire            w_wF, w_dcdM, w_dcdDV, w_dcdFP;
        wire            w_wF, w_dcdM, w_dcdDV, w_dcdFP, w_sto;
        wire            w_wR, w_rA, w_rB, w_wR_n;
        wire            w_wR, w_rA, w_rB, w_wR_n;
        wire            w_ljmp, w_ljmp_dly;
        wire            w_ljmp, w_ljmp_dly;
        wire    [31:0]   iword;
        wire    [31:0]   iword;
 
 
 
 
Line 131... Line 132...
        assign  w_mov    = (w_op      == 5'h0f);
        assign  w_mov    = (w_op      == 5'h0f);
        assign  w_ldi    = (w_op[4:1] == 4'hb);
        assign  w_ldi    = (w_op[4:1] == 4'hb);
        assign  w_brev   = (w_op      == 5'hc);
        assign  w_brev   = (w_op      == 5'hc);
        assign  w_cmptst = (w_op[4:1] == 4'h8);
        assign  w_cmptst = (w_op[4:1] == 4'h8);
        assign  w_ldilo  = (w_op[4:0] == 5'h9);
        assign  w_ldilo  = (w_op[4:0] == 5'h9);
 
        assign  w_mpy    = ((w_op[4:1]==4'h5)||(w_op[4:0]==5'h08));
        assign  w_ALU    = (~w_op[4]);
        assign  w_ALU    = (~w_op[4]);
 
 
        // 4 LUTs
        // 4 LUTs
        //
        //
        // Two parts to the result register: the register set, given for
        // Two parts to the result register: the register set, given for
        // moves in i_word[18] but only for the supervisor, and the other
        // moves in iword[18] but only for the supervisor, and the other
        // four bits encoded in the instruction.
        // four bits encoded in the instruction.
        //
        //
 
`ifdef  OPT_NO_USERMODE
 
        assign  w_dcdR = { 1'b0, iword[30:27] };
 
`else
        assign  w_dcdR = { ((~iword[31])&&(w_mov)&&(~i_gie))?iword[18]:i_gie,
        assign  w_dcdR = { ((~iword[31])&&(w_mov)&&(~i_gie))?iword[18]:i_gie,
                                iword[30:27] };
                                iword[30:27] };
 
`endif
        // 2 LUTs
        // 2 LUTs
        //
        //
        // If the result register is either CC or PC, and this would otherwise
        // If the result register is either CC or PC, and this would otherwise
        // be a floating point instruction with floating point opcode of 0,
        // be a floating point instruction with floating point opcode of 0,
        // then this is a NOOP.
        // then this is a NOOP.
        assign  w_noop   = (w_op[4:0] == 5'h18)&&(
        assign  w_noop   = (w_op[4:0] == 5'h18)&&(
                        ((IMPLEMENT_FPU>0)&&(w_dcdR[3:1] == 3'h7))
                        ((IMPLEMENT_FPU>0)&&(w_dcdR[3:1] == 3'h7))
                        ||(IMPLEMENT_FPU==0));
                        ||(IMPLEMENT_FPU==0));
 
 
 
`ifdef  OPT_NO_USERMODE
 
        assign  w_dcdB = { 1'b0, iword[17:14] };
 
`else
        // 4 LUTs
        // 4 LUTs
        assign  w_dcdB = { ((~iword[31])&&(w_mov)&&(~i_gie))?iword[13]:i_gie,
        assign  w_dcdB = { ((~iword[31])&&(w_mov)&&(~i_gie))?iword[13]:i_gie,
                                iword[17:14] };
                                iword[17:14] };
 
`endif
 
 
        // 0 LUTs
        // 0 LUTs
        assign  w_dcdA = w_dcdR;
        assign  w_dcdA = w_dcdR;
        // 2 LUTs, 1 delay each
        // 2 LUTs, 1 delay each
        assign  w_dcdR_pc = (w_dcdR == {i_gie, `CPU_PC_REG});
        assign  w_dcdR_pc = (w_dcdR == {i_gie, `CPU_PC_REG});
Line 178... Line 188...
                                        1'b0,iword[20:19]}
                                        1'b0,iword[20:19]}
                        : { (iword[21:19]==3'h0), iword[21:19] };
                        : { (iword[21:19]==3'h0), iword[21:19] };
 
 
        // 1 LUT
        // 1 LUT
        assign  w_dcdM    = (w_op[4:1] == 4'h9);
        assign  w_dcdM    = (w_op[4:1] == 4'h9);
 
        assign  w_sto     = (w_dcdM)&&(w_op[0]);
        // 1 LUT
        // 1 LUT
        assign  w_dcdDV   = (w_op[4:1] == 4'ha);
        assign  w_dcdDV   = (w_op[4:1] == 4'ha);
        // 1 LUT
        // 1 LUT
        assign  w_dcdFP   = (w_op[4:3] == 2'b11)&&(w_dcdR[3:1] != 3'h7);
        assign  w_dcdFP   = (w_op[4:3] == 2'b11)&&(w_dcdR[3:1] != 3'h7);
        // 4 LUT's--since it depends upon FP/NOOP condition (vs 1 before)
        // 4 LUT's--since it depends upon FP/NOOP condition (vs 1 before)
Line 189... Line 200...
        assign  w_rA     = (w_dcdFP)
        assign  w_rA     = (w_dcdFP)
                                // Divide's read A
                                // Divide's read A
                                ||(w_dcdDV)
                                ||(w_dcdDV)
                                // ALU read's A, unless it's a MOV to A
                                // ALU read's A, unless it's a MOV to A
                                // This includes LDIHI/LDILO
                                // This includes LDIHI/LDILO
                                ||((~w_op[4])&&(w_op[3:0]!=4'hf))
                                ||((~w_op[4])&&(w_op[3:0]!=4'hf)&&(!w_brev))
                                // STO's read A
                                // STO's read A
                                ||((w_dcdM)&&(w_op[0]))
                                ||((w_dcdM)&&(w_op[0]))
                                // Test/compares
                                // Test/compares
                                ||(w_op[4:1]== 4'h8);
                                ||(w_cmptst);
        // 1 LUTs -- do we read a register for operand B?  Specifically, do
        // 1 LUTs -- do we read a register for operand B?  Specifically, do
        // we need to stall if the register is not (yet) ready?
        // we need to stall if the register is not (yet) ready?
        assign  w_rB     = (w_mov)||((iword[18])&&(~w_ldi));
        assign  w_rB     = (w_mov)||((iword[18])&&(~w_ldi));
        // 1 LUT: All but STO, NOOP/BREAK/LOCK, and CMP/TST write back to w_dcdR
        // 1 LUT: All but STO, NOOP/BREAK/LOCK, and CMP/TST write back to w_dcdR
        assign  w_wR_n   = ((w_dcdM)&&(w_op[0]))
        assign  w_wR_n   = (w_sto)||(w_cmptst)
                                ||((w_op[4:3]==2'b11)&&(w_dcdR[3:1]==3'h7))
                                ||((w_op[4:3]==2'b11)&&(w_dcdR[3:1]==3'h7));
                                ||(w_cmptst);
 
        assign  w_wR     = ~w_wR_n;
        assign  w_wR     = ~w_wR_n;
        //
        //
        // 1-output bit (5 Opcode bits, 4 out-reg bits, 3 condition bits)
        // 1-output bit (5 Opcode bits, 4 out-reg bits, 3 condition bits)
        //      
        //      
        //      This'd be 4 LUTs, save that we have the carve out for NOOPs
        //      This'd be 4 LUTs, save that we have the carve out for NOOPs
Line 277... Line 287...
`ifdef  OPT_VLIW
`ifdef  OPT_VLIW
                        o_illegal <= (i_illegal);
                        o_illegal <= (i_illegal);
`else
`else
                        o_illegal <= ((i_illegal) || (i_instruction[31]));
                        o_illegal <= ((i_illegal) || (i_instruction[31]));
`endif
`endif
                        if ((IMPLEMENT_MPY==0)&&((w_op[4:1]==4'h5)||(w_op[4:0]==5'h08)))
                        if ((IMPLEMENT_MPY==0)&&(w_mpy))
                                o_illegal <= 1'b1;
                                o_illegal <= 1'b1;
 
 
                        if ((IMPLEMENT_DIVIDE==0)&&(w_dcdDV))
                        if ((IMPLEMENT_DIVIDE==0)&&(w_dcdDV))
                                o_illegal <= 1'b1;
                                o_illegal <= 1'b1;
                        else if ((IMPLEMENT_DIVIDE!=0)&&(w_dcdDV)&&(w_dcdR[3:1]==3'h7))
                        else if ((IMPLEMENT_DIVIDE!=0)&&(w_dcdDV)&&(w_dcdR[3:1]==3'h7))
Line 423... Line 433...
                always @(posedge i_clk)
                always @(posedge i_clk)
                        if (i_ce)
                        if (i_ce)
                        begin
                        begin
                                if (r_ljmp)
                                if (r_ljmp)
                                        r_branch_pc <= iword[(AW-1):0];
                                        r_branch_pc <= iword[(AW-1):0];
                                else if (w_op[4:1] == 4'hb) // LDI
                                else if (w_ldi) // LDI
                                        r_branch_pc <= {{(AW-23){iword[22]}},iword[22:0]};
                                        r_branch_pc <= {{(AW-23){iword[22]}},iword[22:0]};
                                else // Add x,PC
                                else // Add x,PC
                                r_branch_pc <= i_pc
                                r_branch_pc <= i_pc
                                        + {{(AW-17){iword[17]}},iword[16:0]}
                                        + {{(AW-17){iword[17]}},iword[16:0]}
                                        + {{(AW-1){1'b0}},1'b1};
                                        + {{(AW-1){1'b0}},1'b1};

powered by: WebSVN 2.1.0

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