// ============================================================================
|
// ============================================================================
|
// __
|
// __
|
// \\__/ o\ (C) 2017-2018 Robert Finch, Waterloo
|
// \\__/ o\ (C) 2017-2019 Robert Finch, Waterloo
|
// \ __ / All rights reserved.
|
// \ __ / All rights reserved.
|
// \/_// robfinch<remove>@finitron.ca
|
// \/_// robfinch<remove>@finitron.ca
|
// ||
|
// ||
|
//
|
//
|
// FT64_idecoder.v
|
// FT64_idecoder.v
|
//
|
//
|
// This source file is free software: you can redistribute it and/or modify
|
// This source file is free software: you can redistribute it and/or modify
|
// it under the terms of the GNU Lesser General Public License as published
|
// it under the terms of the GNU Lesser General Public License as published
|
// by the Free Software Foundation, either version 3 of the License, or
|
// by the Free Software Foundation, either version 3 of the License, or
|
// (at your option) any later version.
|
// (at your option) any later version.
|
//
|
//
|
// This source file is distributed in the hope that it will be useful,
|
// This source file is distributed in the hope that it will be useful,
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
//
|
//
|
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
//
|
//
|
// ============================================================================
|
// ============================================================================
|
//
|
//
|
`include ".\FT64_config.vh"
|
`include ".\FT64_config.vh"
|
`include ".\FT64_defines.vh"
|
`include ".\FT64_defines.vh"
|
|
|
module FT64_idecoder(clk,idv_i,id_i,instr,vl,ven,thrd,predict_taken,Rt,bus,id_o,idv_o,debug_on,pred_on);
|
module FT64_idecoder(clk,idv_i,id_i,instr,vl,ven,thrd,predict_taken,Rt,bus,id_o,idv_o,debug_on,pred_on);
|
input clk;
|
input clk;
|
input idv_i;
|
input idv_i;
|
input [4:0] id_i;
|
input [4:0] id_i;
|
input [47:0] instr;
|
input [47:0] instr;
|
input [7:0] vl;
|
input [7:0] vl;
|
input [5:0] ven;
|
input [5:0] ven;
|
input thrd;
|
input thrd;
|
input predict_taken;
|
input predict_taken;
|
input [4:0] Rt;
|
input [4:0] Rt;
|
output reg [143:0] bus;
|
output reg [143:0] bus;
|
output reg [4:0] id_o;
|
output reg [4:0] id_o;
|
output reg idv_o;
|
output reg idv_o;
|
input debug_on;
|
input debug_on;
|
input pred_on;
|
input pred_on;
|
|
|
parameter TRUE = 1'b1;
|
parameter TRUE = 1'b1;
|
parameter FALSE = 1'b0;
|
parameter FALSE = 1'b0;
|
// Memory access sizes
|
// Memory access sizes
|
parameter byt = 3'd0;
|
parameter byt = 3'd0;
|
parameter wyde = 3'd1;
|
parameter wyde = 3'd1;
|
parameter tetra = 3'd2;
|
parameter tetra = 3'd2;
|
parameter octa = 3'd3;
|
parameter octa = 3'd3;
|
|
parameter hexi = 3'd4;
|
|
|
// Really IsPredictableBranch
|
// Really IsPredictableBranch
|
// Does not include BccR's
|
// Does not include BccR's
|
//function IsBranch;
|
//function IsBranch;
|
//input [47:0] isn;
|
//input [47:0] isn;
|
//casez(isn[`INSTRUCTION_OP])
|
//casez(isn[`INSTRUCTION_OP])
|
//`Bcc: IsBranch = TRUE;
|
//`Bcc: IsBranch = TRUE;
|
//`BBc: IsBranch = TRUE;
|
//`BBc: IsBranch = TRUE;
|
//`BEQI: IsBranch = TRUE;
|
//`BEQI: IsBranch = TRUE;
|
//`CHK: IsBranch = TRUE;
|
//`CHK: IsBranch = TRUE;
|
//default: IsBranch = FALSE;
|
//default: IsBranch = FALSE;
|
//endcase
|
//endcase
|
//endfunction
|
//endfunction
|
|
|
wire [10:0] brdisp = instr[31:21];
|
wire [10:0] brdisp = instr[31:21];
|
|
|
wire iAlu;
|
wire iAlu;
|
mIsALU uialu1
|
mIsALU uialu1
|
(
|
(
|
.instr(instr),
|
.instr(instr),
|
.IsALU(iAlu)
|
.IsALU(iAlu)
|
);
|
);
|
|
|
function IsTLB;
|
function IsTLB;
|
input [47:0] isn;
|
input [47:0] isn;
|
case(isn[`INSTRUCTION_OP])
|
case(isn[`INSTRUCTION_OP])
|
`R2:
|
`R2:
|
case(isn[`INSTRUCTION_S2])
|
case(isn[`INSTRUCTION_S2])
|
`TLB: IsTLB = TRUE;
|
`TLB: IsTLB = TRUE;
|
default: IsTLB = FALSE;
|
default: IsTLB = FALSE;
|
endcase
|
endcase
|
default: IsTLB = FALSE;
|
default: IsTLB = FALSE;
|
endcase
|
endcase
|
endfunction
|
endfunction
|
|
|
reg IsALU;
|
reg IsALU;
|
always @*
|
always @*
|
case(instr[`INSTRUCTION_OP])
|
case(instr[`INSTRUCTION_OP])
|
`R2:
|
`R2:
|
if (instr[`INSTRUCTION_L2]==2'b00)
|
if (instr[`INSTRUCTION_L2]==2'b00)
|
case(instr[`INSTRUCTION_S2])
|
case(instr[`INSTRUCTION_S2])
|
`VMOV: IsALU = TRUE;
|
`VMOV: IsALU = TRUE;
|
`RTI: IsALU = FALSE;
|
`RTI: IsALU = FALSE;
|
default: IsALU = TRUE;
|
default: IsALU = TRUE;
|
endcase
|
endcase
|
else
|
else
|
IsALU = TRUE;
|
IsALU = TRUE;
|
`BRK: IsALU = FALSE;
|
`BRK: IsALU = FALSE;
|
`Bcc: IsALU = FALSE;
|
`Bcc: IsALU = FALSE;
|
|
`BLcc: IsALU = FALSE;
|
`BBc: IsALU = FALSE;
|
`BBc: IsALU = FALSE;
|
`BEQI: IsALU = FALSE;
|
`BEQI: IsALU = FALSE;
|
|
`BNEI: IsALU = FALSE;
|
`CHK: IsALU = FALSE;
|
`CHK: IsALU = FALSE;
|
`JAL: IsALU = FALSE;
|
`JAL: IsALU = FALSE;
|
`JMP: IsALU = FALSE;
|
`JMP: IsALU = FALSE;
|
`CALL: IsALU = FALSE;
|
`CALL: IsALU = FALSE;
|
`RET: IsALU = FALSE;
|
`RET: IsALU = FALSE;
|
`FVECTOR:
|
`FVECTOR:
|
case(instr[`INSTRUCTION_S2])
|
case(instr[`INSTRUCTION_S2])
|
`VSHL,`VSHR,`VASR: IsALU = TRUE;
|
`VSHL,`VSHR,`VASR: IsALU = TRUE;
|
default: IsALU = FALSE; // Integer
|
default: IsALU = FALSE; // Integer
|
endcase
|
endcase
|
`IVECTOR:
|
`IVECTOR:
|
case(instr[`INSTRUCTION_S2])
|
case(instr[`INSTRUCTION_S2])
|
`VSHL,`VSHR,`VASR: IsALU = TRUE;
|
`VSHL,`VSHR,`VASR: IsALU = TRUE;
|
default: IsALU = TRUE; // Integer
|
default: IsALU = TRUE; // Integer
|
endcase
|
endcase
|
`FLOAT: IsALU = FALSE;
|
`FLOAT: IsALU = FALSE;
|
default: IsALU = TRUE;
|
default: IsALU = TRUE;
|
endcase
|
endcase
|
|
|
function IsAlu0Only;
|
function IsAlu0Only;
|
input [47:0] isn;
|
input [47:0] isn;
|
begin
|
begin
|
case(isn[`INSTRUCTION_OP])
|
case(isn[`INSTRUCTION_OP])
|
`R2:
|
`R2:
|
if (isn[`INSTRUCTION_L2]==2'b00)
|
if (isn[`INSTRUCTION_L2]==2'b00)
|
case(isn[`INSTRUCTION_S2])
|
case(isn[`INSTRUCTION_S2])
|
`TLB: IsAlu0Only = TRUE;
|
`TLB: IsAlu0Only = TRUE;
|
`R1: IsAlu0Only = TRUE;
|
`R1: IsAlu0Only = TRUE;
|
`SHIFTR,`SHIFT31,`SHIFT63:
|
`SHIFTR,`SHIFT31,`SHIFT63:
|
IsAlu0Only = !(instr[25:23]==`SHL || instr[25:23]==`ASL);
|
IsAlu0Only = !(instr[25:23]==`SHL || instr[25:23]==`ASL);
|
`MULU,`MULSU,`MUL,
|
`MULU,`MULSU,`MUL,
|
`MULUH,`MULSUH,`MULH,
|
`MULUH,`MULSUH,`MULH,
|
`MODU,`MODSU,`MOD: IsAlu0Only = TRUE;
|
`MODU,`MODSU,`MOD: IsAlu0Only = TRUE;
|
`DIVU,`DIVSU,`DIV: IsAlu0Only = TRUE;
|
`DIVU,`DIVSU,`DIV: IsAlu0Only = TRUE;
|
`MIN,`MAX: IsAlu0Only = TRUE;
|
`MIN,`MAX: IsAlu0Only = TRUE;
|
default: IsAlu0Only = FALSE;
|
default: IsAlu0Only = FALSE;
|
endcase
|
endcase
|
else
|
else
|
IsAlu0Only = FALSE;
|
IsAlu0Only = FALSE;
|
`MEMNDX: IsAlu0Only = TRUE;
|
`MEMNDX: IsAlu0Only = TRUE;
|
`IVECTOR,`FVECTOR:
|
`IVECTOR,`FVECTOR:
|
case(isn[`INSTRUCTION_S2])
|
case(isn[`INSTRUCTION_S2])
|
`VSHL,`VSHR,`VASR: IsAlu0Only = TRUE;
|
`VSHL,`VSHR,`VASR: IsAlu0Only = TRUE;
|
default: IsAlu0Only = FALSE;
|
default: IsAlu0Only = FALSE;
|
endcase
|
endcase
|
`BITFIELD: IsAlu0Only = TRUE;
|
`BITFIELD: IsAlu0Only = TRUE;
|
`MULUI,`MULI,
|
`MULUI,`MULI,
|
`DIVUI,`DIVI,
|
`DIVUI,`DIVI,
|
`MODI: IsAlu0Only = TRUE;
|
`MODI: IsAlu0Only = TRUE;
|
`CSRRW: IsAlu0Only = TRUE;
|
`CSRRW: IsAlu0Only = TRUE;
|
default: IsAlu0Only = FALSE;
|
default: IsAlu0Only = FALSE;
|
endcase
|
endcase
|
end
|
end
|
endfunction
|
endfunction
|
|
|
function IsFPU;
|
function IsFPU;
|
input [47:0] isn;
|
input [47:0] isn;
|
begin
|
begin
|
case(isn[`INSTRUCTION_OP])
|
case(isn[`INSTRUCTION_OP])
|
`FLOAT: IsFPU = TRUE;
|
`FLOAT: IsFPU = TRUE;
|
`FVECTOR:
|
`FVECTOR:
|
case(isn[`INSTRUCTION_S2])
|
case(isn[`INSTRUCTION_S2])
|
`VSHL,`VSHR,`VASR: IsFPU = FALSE;
|
`VSHL,`VSHR,`VASR: IsFPU = FALSE;
|
default: IsFPU = TRUE;
|
default: IsFPU = TRUE;
|
endcase
|
endcase
|
default: IsFPU = FALSE;
|
default: IsFPU = FALSE;
|
endcase
|
endcase
|
end
|
end
|
endfunction
|
endfunction
|
|
|
reg IsFlowCtrl;
|
reg IsFlowCtrl;
|
always @*
|
always @*
|
case(instr[`INSTRUCTION_OP])
|
case(instr[`INSTRUCTION_OP])
|
`BRK: IsFlowCtrl <= TRUE;
|
`BRK: IsFlowCtrl <= TRUE;
|
`R2: case(instr[`INSTRUCTION_S2])
|
`R2: case(instr[`INSTRUCTION_S2])
|
`RTI: IsFlowCtrl <= TRUE;
|
`RTI: IsFlowCtrl <= TRUE;
|
default: IsFlowCtrl <= FALSE;
|
default: IsFlowCtrl <= FALSE;
|
endcase
|
endcase
|
`Bcc: IsFlowCtrl <= TRUE;
|
`Bcc: IsFlowCtrl <= TRUE;
|
|
`BLcc: IsFlowCtrl <= TRUE;
|
`BBc: IsFlowCtrl <= TRUE;
|
`BBc: IsFlowCtrl <= TRUE;
|
`BEQI: IsFlowCtrl <= TRUE;
|
`BEQI: IsFlowCtrl <= TRUE;
|
|
`BNEI: IsFlowCtrl <= TRUE;
|
`CHK: IsFlowCtrl <= TRUE;
|
`CHK: IsFlowCtrl <= TRUE;
|
`JAL: IsFlowCtrl <= TRUE;
|
`JAL: IsFlowCtrl <= TRUE;
|
`JMP: IsFlowCtrl <= TRUE;
|
`JMP: IsFlowCtrl <= TRUE;
|
`CALL: IsFlowCtrl <= TRUE;
|
`CALL: IsFlowCtrl <= TRUE;
|
`RET: IsFlowCtrl <= TRUE;
|
`RET: IsFlowCtrl <= TRUE;
|
default: IsFlowCtrl <= FALSE;
|
default: IsFlowCtrl <= FALSE;
|
endcase
|
endcase
|
|
|
//function IsFlowCtrl;
|
//function IsFlowCtrl;
|
//input [47:0] isn;
|
//input [47:0] isn;
|
//begin
|
//begin
|
//case(isn[`INSTRUCTION_OP])
|
//case(isn[`INSTRUCTION_OP])
|
//`BRK: IsFlowCtrl = TRUE;
|
//`BRK: IsFlowCtrl = TRUE;
|
//`RR: case(isn[`INSTRUCTION_S2])
|
//`RR: case(isn[`INSTRUCTION_S2])
|
// `RTI: IsFlowCtrl = TRUE;
|
// `RTI: IsFlowCtrl = TRUE;
|
// default: IsFlowCtrl = FALSE;
|
// default: IsFlowCtrl = FALSE;
|
// endcase
|
// endcase
|
//`Bcc: IsFlowCtrl = TRUE;
|
//`Bcc: IsFlowCtrl = TRUE;
|
//`BBc: IsFlowCtrl = TRUE;
|
//`BBc: IsFlowCtrl = TRUE;
|
//`BEQI: IsFlowCtrl = TRUE;
|
//`BEQI: IsFlowCtrl = TRUE;
|
//`CHK: IsFlowCtrl = TRUE;
|
//`CHK: IsFlowCtrl = TRUE;
|
//`JAL: IsFlowCtrl = TRUE;
|
//`JAL: IsFlowCtrl = TRUE;
|
//`JMP: IsFlowCtrl = TRUE;
|
//`JMP: IsFlowCtrl = TRUE;
|
//`CALL: IsFlowCtrl = TRUE;
|
//`CALL: IsFlowCtrl = TRUE;
|
//`RET: IsFlowCtrl = TRUE;
|
//`RET: IsFlowCtrl = TRUE;
|
//default: IsFlowCtrl = FALSE;
|
//default: IsFlowCtrl = FALSE;
|
//endcase
|
//endcase
|
//end
|
//end
|
//endfunction
|
//endfunction
|
|
|
// fnCanException
|
// fnCanException
|
//
|
//
|
// Used by memory issue logic (stores).
|
// Used by memory issue logic (stores).
|
// Returns TRUE if the instruction can cause an exception.
|
// Returns TRUE if the instruction can cause an exception.
|
// In debug mode any instruction could potentially cause a breakpoint exception.
|
// In debug mode any instruction could potentially cause a breakpoint exception.
|
// Rather than check all the addresses for potential debug exceptions it's
|
// Rather than check all the addresses for potential debug exceptions it's
|
// simpler to just have it so that all instructions could exception. This will
|
// simpler to just have it so that all instructions could exception. This will
|
// slow processing down somewhat as stores will only be done at the head of the
|
// slow processing down somewhat as stores will only be done at the head of the
|
// instruction queue, but it's debug mode so we probably don't care.
|
// instruction queue, but it's debug mode so we probably don't care.
|
//
|
//
|
function fnCanException;
|
function fnCanException;
|
input [47:0] isn;
|
input [47:0] isn;
|
begin
|
begin
|
// ToDo add debug_on as input
|
// ToDo add debug_on as input
|
`ifdef SUPPORT_DBG
|
`ifdef SUPPORT_DBG
|
if (debug_on)
|
if (debug_on)
|
fnCanException = `TRUE;
|
fnCanException = `TRUE;
|
else
|
else
|
`endif
|
`endif
|
case(isn[`INSTRUCTION_OP])
|
case(isn[`INSTRUCTION_OP])
|
`FLOAT:
|
`FLOAT:
|
case(isn[`INSTRUCTION_S2])
|
case(isn[`INSTRUCTION_S2])
|
`FDIV,`FMUL,`FADD,`FSUB,`FTX:
|
`FDIV,`FMUL,`FADD,`FSUB,`FTX:
|
fnCanException = `TRUE;
|
fnCanException = `TRUE;
|
default: fnCanException = `FALSE;
|
default: fnCanException = `FALSE;
|
endcase
|
endcase
|
`DIVI,`MODI,`MULI:
|
`DIVI,`MODI,`MULI:
|
fnCanException = `TRUE;
|
fnCanException = `TRUE;
|
`R2:
|
`R2:
|
case(isn[`INSTRUCTION_S2])
|
case(isn[`INSTRUCTION_S2])
|
`MUL,
|
`MUL,
|
`DIV,`MULSU,`DIVSU,
|
`DIV,`MULSU,`DIVSU,
|
`MOD,`MODSU:
|
`MOD,`MODSU:
|
fnCanException = TRUE;
|
fnCanException = TRUE;
|
`RTI: fnCanException = TRUE;
|
`RTI: fnCanException = TRUE;
|
default: fnCanException = FALSE;
|
default: fnCanException = FALSE;
|
endcase
|
endcase
|
// Had branches that could exception if looping to self. But in a tight loop
|
// Had branches that could exception if looping to self. But in a tight loop
|
// it affects store performance.
|
// it affects store performance.
|
// -> A branch may only exception if it loops back to itself.
|
// -> A branch may only exception if it loops back to itself.
|
`Bcc,`BBc,`BEQI: fnCanException = isn[7] ? brdisp == 11'h7FF : brdisp == 11'h7FE;
|
`Bcc,`BLcc,`BBc,`BEQI,`BNEI: fnCanException = isn[7] ? brdisp == 11'h7FF : brdisp == 11'h7FE;
|
`CHK: fnCanException = TRUE;
|
`CHK: fnCanException = TRUE;
|
default:
|
default:
|
// Stores can stil exception if there is a write buffer, but we allow following
|
// Stores can stil exception if there is a write buffer, but we allow following
|
// stores to be issued by ignoring the fact they can exception because the stores
|
// stores to be issued by ignoring the fact they can exception because the stores
|
// can be undone by invalidating the write buffer.
|
// can be undone by invalidating the write buffer.
|
`ifdef HAS_WB
|
`ifdef HAS_WB
|
fnCanException = IsMem(isn) && !IsStore(isn);
|
fnCanException = IsMem && !IsStore(isn);
|
`else
|
`else
|
fnCanException = IsMem(isn);
|
fnCanException = IsMem;
|
`endif
|
`endif
|
endcase
|
endcase
|
end
|
end
|
endfunction
|
endfunction
|
|
|
function IsLoad;
|
function IsLoad;
|
input [47:0] isn;
|
input [47:0] isn;
|
case(isn[`INSTRUCTION_OP])
|
case(isn[`INSTRUCTION_OP])
|
`MEMNDX: IsLoad = !isn[31];
|
`MEMNDX: IsLoad = !isn[31];
|
`LB: IsLoad = TRUE;
|
`LB: IsLoad = TRUE;
|
`LBU: IsLoad = TRUE;
|
`LBU: IsLoad = TRUE;
|
`Lx: IsLoad = TRUE;
|
`Lx: IsLoad = TRUE;
|
`LxU: IsLoad = TRUE;
|
`LxU: IsLoad = TRUE;
|
`LWR: IsLoad = TRUE;
|
`LWR: IsLoad = TRUE;
|
`LV: IsLoad = TRUE;
|
`LV: IsLoad = TRUE;
|
`LVx: IsLoad = TRUE;
|
`LVx: IsLoad = TRUE;
|
`LVxU: IsLoad = TRUE;
|
`LVxU: IsLoad = TRUE;
|
default: IsLoad = FALSE;
|
default: IsLoad = FALSE;
|
endcase
|
endcase
|
endfunction
|
endfunction
|
|
|
|
function IsMov2Seg;
|
|
input [47:0] isn;
|
|
case(isn[`INSTRUCTION_OP])
|
|
`R2:
|
|
if (isn[6])
|
|
IsMov2Seg = isn[47:42]==`MOV2SEG;
|
|
else
|
|
case(isn[`INSTRUCTION_S2])
|
|
`MOV2SEG: IsMov2Seg = TRUE;
|
|
`RTI: IsMov2Seg = TRUE;
|
|
default: IsMov2Seg = FALSE;
|
|
endcase
|
|
`RET:
|
|
IsMov2Seg = TRUE;
|
|
default: IsMov2Seg = FALSE;
|
|
endcase
|
|
endfunction
|
|
|
function IsVolatileLoad;
|
function IsVolatileLoad;
|
input [47:0] isn;
|
input [47:0] isn;
|
case(isn[`INSTRUCTION_OP])
|
case(isn[`INSTRUCTION_OP])
|
|
`R2:
|
|
if (isn[6])
|
|
IsVolatileLoad = isn[47:42]==`MOV2SEG;
|
|
else
|
|
IsVolatileLoad = isn[31:26]==`MOV2SEG;
|
`MEMNDX:
|
`MEMNDX:
|
if (isn[`INSTRUCTION_L2]==2'b00)
|
if (isn[`INSTRUCTION_L2]==2'b00)
|
case({isn[31:28],isn[22:21]})
|
case({isn[31:28],isn[22:21]})
|
`LWRX: IsVolatileLoad = TRUE;
|
`LWRX: IsVolatileLoad = TRUE;
|
`LVBX: IsVolatileLoad = TRUE;
|
`LVBX: IsVolatileLoad = TRUE;
|
`LVBUX: IsVolatileLoad = TRUE;
|
`LVBUX: IsVolatileLoad = TRUE;
|
`LVCX: IsVolatileLoad = TRUE;
|
`LVCX: IsVolatileLoad = TRUE;
|
`LVCUX: IsVolatileLoad = TRUE;
|
`LVCUX: IsVolatileLoad = TRUE;
|
`LVHX: IsVolatileLoad = TRUE;
|
`LVHX: IsVolatileLoad = TRUE;
|
`LVHUX: IsVolatileLoad = TRUE;
|
`LVHUX: IsVolatileLoad = TRUE;
|
`LVWX: IsVolatileLoad = TRUE;
|
`LVWX: IsVolatileLoad = TRUE;
|
default: IsVolatileLoad = FALSE;
|
default: IsVolatileLoad = FALSE;
|
endcase
|
endcase
|
else
|
else
|
IsVolatileLoad = FALSE;
|
IsVolatileLoad = FALSE;
|
`LWR: IsVolatileLoad = TRUE;
|
`LWR: IsVolatileLoad = TRUE;
|
`LVx: IsVolatileLoad = TRUE;
|
`LVx: IsVolatileLoad = TRUE;
|
`LVxU: IsVolatileLoad = TRUE;
|
`LVxU: IsVolatileLoad = TRUE;
|
default: IsVolatileLoad = FALSE;
|
default: IsVolatileLoad = FALSE;
|
endcase
|
endcase
|
endfunction
|
endfunction
|
|
|
function IsStore;
|
function IsStore;
|
input [47:0] isn;
|
input [47:0] isn;
|
case(isn[`INSTRUCTION_OP])
|
case(isn[`INSTRUCTION_OP])
|
`MEMNDX:
|
`MEMNDX:
|
if (isn[`INSTRUCTION_L2]==2'b10) begin
|
if (isn[`INSTRUCTION_L2]==2'b10) begin
|
if (isn[31])
|
if (isn[31])
|
case({isn[31:28],isn[17:16]})
|
case({isn[31:28],isn[17:16]})
|
`PUSH: IsStore = TRUE;
|
`PUSH: IsStore = TRUE;
|
default: IsStore = FALSE;
|
default: IsStore = FALSE;
|
endcase
|
endcase
|
else
|
else
|
IsStore = FALSE;
|
IsStore = FALSE;
|
end
|
end
|
else if (isn[`INSTRUCTION_L2]==2'b00)
|
else if (isn[`INSTRUCTION_L2]==2'b00)
|
case({isn[31:28],isn[17:16]})
|
case({isn[31:28],isn[17:16]})
|
`PUSH: IsStore = TRUE;
|
`PUSH: IsStore = TRUE;
|
`SBX: IsStore = TRUE;
|
`SBX: IsStore = TRUE;
|
`SCX: IsStore = TRUE;
|
`SCX: IsStore = TRUE;
|
`SHX: IsStore = TRUE;
|
`SHX: IsStore = TRUE;
|
`SWX: IsStore = TRUE;
|
`SWX: IsStore = TRUE;
|
`SWCX: IsStore = TRUE;
|
`SWCX: IsStore = TRUE;
|
`SVX: IsStore = TRUE;
|
`SVX: IsStore = TRUE;
|
`CASX: IsStore = TRUE;
|
`CASX: IsStore = TRUE;
|
`INC: IsStore = TRUE;
|
`INC: IsStore = TRUE;
|
default: IsStore = FALSE;
|
default: IsStore = FALSE;
|
endcase
|
endcase
|
else
|
else
|
IsStore = FALSE;
|
IsStore = FALSE;
|
|
`PUSHC: IsStore = TRUE;
|
`SB: IsStore = TRUE;
|
`SB: IsStore = TRUE;
|
`Sx: IsStore = TRUE;
|
`Sx: IsStore = TRUE;
|
`SWC: IsStore = TRUE;
|
`SWC: IsStore = TRUE;
|
`INC: IsStore = TRUE;
|
`INC: IsStore = TRUE;
|
`SV: IsStore = TRUE;
|
`SV: IsStore = TRUE;
|
`CAS: IsStore = TRUE;
|
`CAS: IsStore = TRUE;
|
`AMO: IsStore = TRUE;
|
`AMO: IsStore = TRUE;
|
default: IsStore = FALSE;
|
default: IsStore = FALSE;
|
endcase
|
endcase
|
endfunction
|
endfunction
|
|
|
function IsPush;
|
function IsPush;
|
input [47:0] isn;
|
input [47:0] isn;
|
case(isn[`INSTRUCTION_OP])
|
case(isn[`INSTRUCTION_OP])
|
`MEMNDX:
|
`MEMNDX:
|
if (isn[`INSTRUCTION_L2]==2'b10) begin
|
if (isn[`INSTRUCTION_L2]==2'b10) begin
|
if (isn[31])
|
if (isn[31])
|
case({isn[31:28],isn[17:16]})
|
case({isn[31:28],isn[17:16]})
|
`PUSH: IsPush = TRUE;
|
`PUSH: IsPush = TRUE;
|
default: IsPush = FALSE;
|
default: IsPush = FALSE;
|
endcase
|
endcase
|
else
|
else
|
IsPush = FALSE;
|
IsPush = FALSE;
|
end
|
end
|
else if (isn[`INSTRUCTION_L2]==2'b00)
|
else if (isn[`INSTRUCTION_L2]==2'b00)
|
case({isn[31:28],isn[17:16]})
|
case({isn[31:28],isn[17:16]})
|
`PUSH: IsPush = TRUE;
|
`PUSH: IsPush = TRUE;
|
default: IsPush = FALSE;
|
default: IsPush = FALSE;
|
endcase
|
endcase
|
else
|
else
|
IsPush = FALSE;
|
IsPush = FALSE;
|
|
`PUSHC: IsPush = TRUE;
|
default: IsPush = FALSE;
|
default: IsPush = FALSE;
|
endcase
|
endcase
|
endfunction
|
endfunction
|
|
|
function [0:0] IsMem;
|
function IsPushc;
|
input [47:0] isn;
|
input [47:0] isn;
|
case(isn[`INSTRUCTION_OP])
|
case(isn[`INSTRUCTION_OP])
|
|
`PUSHC: IsPushc = TRUE;
|
|
default: IsPushc = FALSE;
|
|
endcase
|
|
endfunction
|
|
|
|
//function [0:0] IsMem;
|
|
reg IsMem;
|
|
always @*
|
|
//input [47:0] isn;
|
|
case(instr[`INSTRUCTION_OP])
|
|
`R2:
|
|
if (instr[6])
|
|
IsMem = instr[47:42]==`MOV2SEG;
|
|
else
|
|
case(instr[`INSTRUCTION_S2])
|
|
`MOV2SEG: IsMem = TRUE;
|
|
`RTI: IsMem = TRUE;
|
|
default: IsMem = FALSE;
|
|
endcase
|
`MEMNDX: IsMem = TRUE;
|
`MEMNDX: IsMem = TRUE;
|
`AMO: IsMem = TRUE;
|
`AMO: IsMem = TRUE;
|
`LB: IsMem = TRUE;
|
`LB: IsMem = TRUE;
|
`LBU: IsMem = TRUE;
|
`LBU: IsMem = TRUE;
|
`Lx: IsMem = TRUE;
|
`Lx: IsMem = TRUE;
|
`LxU: IsMem = TRUE;
|
`LxU: IsMem = TRUE;
|
`LWR: IsMem = TRUE;
|
`LWR: IsMem = TRUE;
|
`LV,`SV: IsMem = TRUE;
|
`LV,`SV: IsMem = TRUE;
|
`INC: IsMem = TRUE;
|
`INC: IsMem = TRUE;
|
|
`PUSHC: IsMem = TRUE;
|
`SB: IsMem = TRUE;
|
`SB: IsMem = TRUE;
|
`Sx: IsMem = TRUE;
|
`Sx: IsMem = TRUE;
|
`SWC: IsMem = TRUE;
|
`SWC: IsMem = TRUE;
|
`CAS: IsMem = TRUE;
|
`CAS: IsMem = TRUE;
|
`LVx: IsMem = TRUE;
|
`LVx: IsMem = TRUE;
|
`LVxU: IsMem = TRUE;
|
`LVxU: IsMem = TRUE;
|
|
//`RET: IsMem = TRUE;???
|
default: IsMem = FALSE;
|
default: IsMem = FALSE;
|
endcase
|
endcase
|
endfunction
|
//endfunction
|
|
|
function IsMemNdx;
|
function IsMemNdx;
|
input [47:0] isn;
|
input [47:0] isn;
|
case(isn[`INSTRUCTION_OP])
|
case(isn[`INSTRUCTION_OP])
|
`MEMNDX: IsMemNdx = TRUE;
|
`MEMNDX: IsMemNdx = TRUE;
|
default: IsMemNdx = FALSE;
|
default: IsMemNdx = FALSE;
|
endcase
|
endcase
|
endfunction
|
endfunction
|
|
|
function [2:0] MemSize;
|
function [2:0] MemSize;
|
input [47:0] isn;
|
input [47:0] isn;
|
case(isn[`INSTRUCTION_OP])
|
case(isn[`INSTRUCTION_OP])
|
`MEMNDX:
|
`MEMNDX:
|
if (isn[`INSTRUCTION_L2]==2'b00) begin
|
if (isn[`INSTRUCTION_L2]==2'b00) begin
|
if (IsLoad(isn))
|
if (IsLoad(isn))
|
case({isn[31:28],isn[22:21]})
|
case({isn[31:28],isn[22:21]})
|
`LVBX,`LVBUX: MemSize = byt;
|
`LVBX,`LVBUX: MemSize = byt;
|
`LBX,`LBUX: MemSize = byt;
|
`LBX,`LBUX: MemSize = byt;
|
`LVCX,`LVCUX: MemSize = wyde;
|
`LVCX,`LVCUX: MemSize = wyde;
|
`LCX,`LCUX: MemSize = wyde;
|
`LCX,`LCUX: MemSize = wyde;
|
`LVHX,`LVHUX: MemSize = tetra;
|
`LVHX,`LVHUX: MemSize = tetra;
|
`LHX: MemSize = tetra;
|
`LHX: MemSize = tetra;
|
`LHUX: MemSize = tetra;
|
`LHUX: MemSize = tetra;
|
`LVWX: MemSize = octa;
|
`LVWX: MemSize = octa;
|
`LWX: MemSize = octa;
|
`LWX: MemSize = octa;
|
`LWRX: MemSize = octa;
|
`LWRX: MemSize = octa;
|
`LVX: MemSize = octa;
|
`LVX: MemSize = octa;
|
`LVx:
|
`LVx:
|
case(isn[20:18])
|
case(isn[20:18])
|
3'd0,3'd1: MemSize = byt;
|
3'd0,3'd1: MemSize = byt;
|
3'd2,3'd3: MemSize = wyde;
|
3'd2,3'd3: MemSize = wyde;
|
3'd4,3'd5: MemSize = tetra;
|
3'd4,3'd5: MemSize = tetra;
|
default: MemSize = octa;
|
default: MemSize = octa;
|
endcase
|
endcase
|
default: MemSize = octa;
|
default: MemSize = octa;
|
endcase
|
endcase
|
else
|
else
|
case({isn[31:28],isn[17:16]})
|
case({isn[31:28],isn[17:16]})
|
`SBX: MemSize = byt;
|
`SBX: MemSize = byt;
|
`SCX: MemSize = wyde;
|
`SCX: MemSize = wyde;
|
`SHX: MemSize = tetra;
|
`SHX: MemSize = tetra;
|
`SWX: MemSize = octa;
|
`SWX: MemSize = octa;
|
`SWCX: MemSize = octa;
|
`SWCX: MemSize = octa;
|
`SVX: MemSize = octa;
|
`SVX: MemSize = octa;
|
default: MemSize = octa;
|
default: MemSize = octa;
|
endcase
|
endcase
|
end
|
end
|
else
|
else
|
MemSize = octa;
|
MemSize = octa;
|
`LB,`LBU: MemSize = byt;
|
`LB,`LBU: MemSize = byt;
|
`Lx,`LxU,`LVx,`LVxU:
|
`Lx,`LxU,`LVx,`LVxU:
|
casez(isn[20:18])
|
casez(isn[21:18])
|
3'b100: MemSize = octa;
|
4'b1000: MemSize = hexi;
|
3'b?10: MemSize = tetra;
|
4'b?100: MemSize = octa;
|
3'b??1: MemSize = wyde;
|
4'b??10: MemSize = tetra;
|
|
4'b???1: MemSize = wyde;
|
default: MemSize = octa;
|
default: MemSize = octa;
|
endcase
|
endcase
|
`LWR: MemSize = octa;
|
`LWR: MemSize = octa;
|
`LV: MemSize = octa;
|
`LV: MemSize = octa;
|
`AMO:
|
`AMO:
|
case(isn[23:21])
|
case(isn[23:21])
|
3'd0: MemSize = byt;
|
3'd0: MemSize = byt;
|
3'd1: MemSize = wyde;
|
3'd1: MemSize = wyde;
|
3'd2: MemSize = tetra;
|
3'd2: MemSize = tetra;
|
3'd3: MemSize = octa;
|
3'd3: MemSize = octa;
|
default: MemSize = octa;
|
default: MemSize = octa;
|
endcase
|
endcase
|
`SB: MemSize = byt;
|
`SB: MemSize = byt;
|
`Sx:
|
`Sx:
|
casez(isn[15:13])
|
casez(isn[16:13])
|
3'b100: MemSize = octa;
|
4'b1000: MemSize = hexi;
|
3'b?10: MemSize = tetra;
|
4'b?100: MemSize = octa;
|
3'b??1: MemSize = wyde;
|
4'b??10: MemSize = tetra;
|
|
4'b???1: MemSize = wyde;
|
default: MemSize = octa;
|
default: MemSize = octa;
|
endcase
|
endcase
|
`SWC: MemSize = octa;
|
`SWC: MemSize = octa;
|
`SV: MemSize = octa;
|
`SV: MemSize = octa;
|
|
`PUSHC: MemSize = octa;
|
default: MemSize = octa;
|
default: MemSize = octa;
|
endcase
|
endcase
|
endfunction
|
endfunction
|
|
|
function IsCAS;
|
function IsCAS;
|
input [47:0] isn;
|
input [47:0] isn;
|
case(isn[`INSTRUCTION_OP])
|
case(isn[`INSTRUCTION_OP])
|
`MEMNDX:
|
`MEMNDX:
|
if (isn[`INSTRUCTION_L2]==2'b00)
|
if (isn[`INSTRUCTION_L2]==2'b00)
|
case({isn[31:28],isn[17:16]})
|
case({isn[31:28],isn[17:16]})
|
`CASX: IsCAS = TRUE;
|
`CASX: IsCAS = TRUE;
|
default: IsCAS = FALSE;
|
default: IsCAS = FALSE;
|
endcase
|
endcase
|
else
|
else
|
IsCAS = FALSE;
|
IsCAS = FALSE;
|
`CAS: IsCAS = TRUE;
|
`CAS: IsCAS = TRUE;
|
default: IsCAS = FALSE;
|
default: IsCAS = FALSE;
|
endcase
|
endcase
|
endfunction
|
endfunction
|
|
|
function IsAMO;
|
function IsAMO;
|
input [47:0] isn;
|
input [47:0] isn;
|
case(isn[`INSTRUCTION_OP])
|
case(isn[`INSTRUCTION_OP])
|
`AMO: IsAMO = TRUE;
|
`AMO: IsAMO = TRUE;
|
default: IsAMO = FALSE;
|
default: IsAMO = FALSE;
|
endcase
|
endcase
|
endfunction
|
endfunction
|
|
|
function IsInc;
|
function IsInc;
|
input [47:0] isn;
|
input [47:0] isn;
|
case(isn[`INSTRUCTION_OP])
|
case(isn[`INSTRUCTION_OP])
|
`MEMNDX:
|
`MEMNDX:
|
if (isn[`INSTRUCTION_L2]==2'b00)
|
if (isn[`INSTRUCTION_L2]==2'b00)
|
case({isn[31:28],isn[17:16]})
|
case({isn[31:28],isn[17:16]})
|
`INCX: IsInc = TRUE;
|
`INCX: IsInc = TRUE;
|
default: IsInc = FALSE;
|
default: IsInc = FALSE;
|
endcase
|
endcase
|
else
|
else
|
IsInc = FALSE;
|
IsInc = FALSE;
|
`INC: IsInc = TRUE;
|
`INC: IsInc = TRUE;
|
default: IsInc = FALSE;
|
default: IsInc = FALSE;
|
endcase
|
endcase
|
endfunction
|
endfunction
|
|
|
function IsFSync;
|
function IsFSync;
|
input [47:0] isn;
|
input [47:0] isn;
|
IsFSync = (isn[`INSTRUCTION_OP]==`FLOAT && isn[`INSTRUCTION_L2]==2'b00 && isn[`INSTRUCTION_S2]==`FSYNC);
|
IsFSync = (isn[`INSTRUCTION_OP]==`FLOAT && isn[`INSTRUCTION_L2]==2'b00 && isn[`INSTRUCTION_S2]==`FSYNC);
|
endfunction
|
endfunction
|
|
|
function IsMemdb;
|
function IsMemdb;
|
input [47:0] isn;
|
input [47:0] isn;
|
IsMemdb = (isn[`INSTRUCTION_OP]==`R2 && isn[`INSTRUCTION_L2]==2'b00 && isn[`INSTRUCTION_S2]==`R1 && isn[22:18]==`MEMDB);
|
IsMemdb = (isn[`INSTRUCTION_OP]==`R2 && isn[`INSTRUCTION_L2]==2'b00 && isn[`INSTRUCTION_S2]==`R1 && isn[22:18]==`MEMDB);
|
endfunction
|
endfunction
|
|
|
function IsMemsb;
|
function IsMemsb;
|
input [47:0] isn;
|
input [47:0] isn;
|
IsMemsb = (isn[`INSTRUCTION_OP]==`RR && isn[`INSTRUCTION_L2]==2'b00 && isn[`INSTRUCTION_S2]==`R1 && isn[22:18]==`MEMSB);
|
IsMemsb = (isn[`INSTRUCTION_OP]==`RR && isn[`INSTRUCTION_L2]==2'b00 && isn[`INSTRUCTION_S2]==`R1 && isn[22:18]==`MEMSB);
|
endfunction
|
endfunction
|
|
|
function IsSEI;
|
function IsSEI;
|
input [47:0] isn;
|
input [47:0] isn;
|
IsSEI = (isn[`INSTRUCTION_OP]==`R2 && isn[`INSTRUCTION_L2]==2'b00 && isn[`INSTRUCTION_S2]==`SEI);
|
IsSEI = (isn[`INSTRUCTION_OP]==`R2 && isn[`INSTRUCTION_L2]==2'b00 && isn[`INSTRUCTION_S2]==`SEI);
|
endfunction
|
endfunction
|
|
|
function IsShift48;
|
function IsShift48;
|
input [47:0] isn;
|
input [47:0] isn;
|
case(isn[`INSTRUCTION_OP])
|
case(isn[`INSTRUCTION_OP])
|
`R2:
|
`R2:
|
if (isn[`INSTRUCTION_L2]==2'b01)
|
if (isn[`INSTRUCTION_L2]==2'b01)
|
case(isn[47:42])
|
case(isn[47:42])
|
`SHIFTR: IsShift48 = TRUE;
|
`SHIFTR: IsShift48 = TRUE;
|
default: IsShift48 = FALSE;
|
default: IsShift48 = FALSE;
|
endcase
|
endcase
|
else
|
else
|
IsShift48 = FALSE;
|
IsShift48 = FALSE;
|
default: IsShift48 = FALSE;
|
default: IsShift48 = FALSE;
|
endcase
|
endcase
|
endfunction
|
endfunction
|
|
|
function IsShift;
|
function IsShift;
|
input [47:0] isn;
|
input [47:0] isn;
|
case(isn[`INSTRUCTION_OP])
|
case(isn[`INSTRUCTION_OP])
|
`R2:
|
`R2:
|
if (isn[`INSTRUCTION_L2]==2'b00)
|
if (isn[`INSTRUCTION_L2]==2'b00)
|
case(isn[31:26])
|
case(isn[31:26])
|
`SHIFTR: IsShift = TRUE;
|
`SHIFTR: IsShift = TRUE;
|
`SHIFT31: IsShift = TRUE;
|
`SHIFT31: IsShift = TRUE;
|
`SHIFT63: IsShift = TRUE;
|
`SHIFT63: IsShift = TRUE;
|
default: IsShift = FALSE;
|
default: IsShift = FALSE;
|
endcase
|
endcase
|
else
|
else
|
IsShift = FALSE;
|
IsShift = FALSE;
|
default: IsShift = FALSE;
|
default: IsShift = FALSE;
|
endcase
|
endcase
|
endfunction
|
endfunction
|
|
|
function IsCmp;
|
|
input [47:0] isn;
|
|
case(isn[`INSTRUCTION_OP])
|
|
`R2:
|
|
if (isn[`INSTRUCTION_L2]==2'b00)
|
|
case(isn[31:26])
|
|
`CMP: IsCmp = TRUE;
|
|
default: IsCmp = FALSE;
|
|
endcase
|
|
else
|
|
IsCmp = FALSE;
|
|
`CMPI: IsCmp = TRUE;
|
|
default: IsCmp = FALSE;
|
|
endcase
|
|
endfunction
|
|
|
|
function IsLWRX;
|
function IsLWRX;
|
input [47:0] isn;
|
input [47:0] isn;
|
case(isn[`INSTRUCTION_OP])
|
case(isn[`INSTRUCTION_OP])
|
`MEMNDX:
|
`MEMNDX:
|
if (isn[`INSTRUCTION_L2]==2'b00)
|
if (isn[`INSTRUCTION_L2]==2'b00)
|
case({isn[31:28],isn[22:21]})
|
case({isn[31:28],isn[22:21]})
|
`LWRX: IsLWRX = TRUE;
|
`LWRX: IsLWRX = TRUE;
|
default: IsLWRX = FALSE;
|
default: IsLWRX = FALSE;
|
endcase
|
endcase
|
else
|
else
|
IsLWRX = FALSE;
|
IsLWRX = FALSE;
|
default: IsLWRX = FALSE;
|
default: IsLWRX = FALSE;
|
endcase
|
endcase
|
endfunction
|
endfunction
|
|
|
// Aquire / release bits are only available on indexed SWC / LWR
|
// Aquire / release bits are only available on indexed SWC / LWR
|
function IsSWCX;
|
function IsSWCX;
|
input [47:0] isn;
|
input [47:0] isn;
|
case(isn[`INSTRUCTION_OP])
|
case(isn[`INSTRUCTION_OP])
|
`MEMNDX:
|
`MEMNDX:
|
if (isn[`INSTRUCTION_L2]==2'b00)
|
if (isn[`INSTRUCTION_L2]==2'b00)
|
case({isn[31:28],isn[17:16]})
|
case({isn[31:28],isn[17:16]})
|
`SWCX: IsSWCX = TRUE;
|
`SWCX: IsSWCX = TRUE;
|
default: IsSWCX = FALSE;
|
default: IsSWCX = FALSE;
|
endcase
|
endcase
|
else
|
else
|
IsSWCX = FALSE;
|
IsSWCX = FALSE;
|
default: IsSWCX = FALSE;
|
default: IsSWCX = FALSE;
|
endcase
|
endcase
|
endfunction
|
endfunction
|
|
|
function IsJmp;
|
function IsJmp;
|
input [47:0] isn;
|
input [47:0] isn;
|
IsJmp = isn[`INSTRUCTION_OP]==`JMP;
|
IsJmp = isn[`INSTRUCTION_OP]==`JMP;
|
endfunction
|
endfunction
|
|
|
// Really IsPredictableBranch
|
// Really IsPredictableBranch
|
// Does not include BccR's
|
// Does not include BccR's
|
function IsBranch;
|
function IsBranch;
|
input [47:0] isn;
|
input [47:0] isn;
|
casez(isn[`INSTRUCTION_OP])
|
casez(isn[`INSTRUCTION_OP])
|
`Bcc: IsBranch = TRUE;
|
`Bcc: IsBranch = TRUE;
|
|
`BLcc: IsBranch = TRUE;
|
`BBc: IsBranch = TRUE;
|
`BBc: IsBranch = TRUE;
|
`BEQI: IsBranch = TRUE;
|
`BEQI: IsBranch = TRUE;
|
|
`BNEI: IsBranch = TRUE;
|
`CHK: IsBranch = TRUE;
|
`CHK: IsBranch = TRUE;
|
default: IsBranch = FALSE;
|
default: IsBranch = FALSE;
|
endcase
|
endcase
|
endfunction
|
endfunction
|
|
|
function IsJAL;
|
function IsJAL;
|
input [47:0] isn;
|
input [47:0] isn;
|
IsJAL = isn[`INSTRUCTION_OP]==`JAL;
|
IsJAL = isn[`INSTRUCTION_OP]==`JAL;
|
endfunction
|
endfunction
|
|
|
function IsRet;
|
function IsRet;
|
input [47:0] isn;
|
input [47:0] isn;
|
IsRet = isn[`INSTRUCTION_OP]==`RET;
|
IsRet = isn[`INSTRUCTION_OP]==`RET;
|
endfunction
|
endfunction
|
|
|
function IsIrq;
|
function IsIrq;
|
input [47:0] isn;
|
input [47:0] isn;
|
IsIrq = isn[`INSTRUCTION_OP]==`BRK && isn[25:21]==5'h0;
|
IsIrq = isn[`INSTRUCTION_OP]==`BRK && isn[25:21]==5'h0;
|
endfunction
|
endfunction
|
|
|
function IsBrk;
|
function IsBrk;
|
input [47:0] isn;
|
input [47:0] isn;
|
IsBrk = isn[`INSTRUCTION_OP]==`BRK;
|
IsBrk = isn[`INSTRUCTION_OP]==`BRK;
|
endfunction
|
endfunction
|
|
|
function IsRti;
|
function IsRti;
|
input [47:0] isn;
|
input [47:0] isn;
|
IsRti = isn[`INSTRUCTION_OP]==`RR && isn[`INSTRUCTION_S2]==`RTI;
|
IsRti = isn[`INSTRUCTION_OP]==`RR && isn[`INSTRUCTION_S2]==`RTI;
|
endfunction
|
endfunction
|
|
|
function IsSync;
|
function IsSync;
|
input [47:0] isn;
|
input [47:0] isn;
|
IsSync = (isn[`INSTRUCTION_OP]==`R2 && isn[`INSTRUCTION_L2]==2'b00 && isn[`INSTRUCTION_S2]==`R1 && isn[22:18]==`SYNC) || IsRti(isn);
|
IsSync = (isn[`INSTRUCTION_OP]==`R2 && isn[`INSTRUCTION_L2]==2'b00 && isn[`INSTRUCTION_S2]==`R1 && isn[22:18]==`SYNC) || IsRti(isn) || IsMov2Seg(isn);
|
endfunction
|
endfunction
|
|
|
// Has an extendable 14-bit constant
|
// Has an extendable 14-bit constant
|
function HasConst;
|
function HasConst;
|
input [47:0] isn;
|
input [47:0] isn;
|
casez(isn[`INSTRUCTION_OP])
|
casez(isn[`INSTRUCTION_OP])
|
`ADDI: HasConst = TRUE;
|
`ADDI: HasConst = TRUE;
|
|
`SEQI: HasConst = TRUE;
|
`SLTI: HasConst = TRUE;
|
`SLTI: HasConst = TRUE;
|
`SLTUI: HasConst = TRUE;
|
`SLTUI: HasConst = TRUE;
|
`SGTI: HasConst = TRUE;
|
`SGTI: HasConst = TRUE;
|
`SGTUI: HasConst = TRUE;
|
`SGTUI: HasConst = TRUE;
|
`ANDI: HasConst = TRUE;
|
`ANDI: HasConst = TRUE;
|
`ORI: HasConst = TRUE;
|
`ORI: HasConst = TRUE;
|
`XORI: HasConst = TRUE;
|
`XORI: HasConst = TRUE;
|
`XNORI: HasConst = TRUE;
|
`XNORI: HasConst = TRUE;
|
`MULUI: HasConst = TRUE;
|
`MULUI: HasConst = TRUE;
|
`MULI: HasConst = TRUE;
|
`MULI: HasConst = TRUE;
|
`MULFI: HasConst = TRUE;
|
`MULFI: HasConst = TRUE;
|
`DIVUI: HasConst = TRUE;
|
`DIVUI: HasConst = TRUE;
|
`DIVI: HasConst = TRUE;
|
`DIVI: HasConst = TRUE;
|
`MODI: HasConst = TRUE;
|
`MODI: HasConst = TRUE;
|
`LB: HasConst = TRUE;
|
`LB: HasConst = TRUE;
|
`LBU: HasConst = TRUE;
|
`LBU: HasConst = TRUE;
|
`Lx: HasConst = TRUE;
|
`Lx: HasConst = TRUE;
|
`LxU: HasConst = TRUE;
|
`LxU: HasConst = TRUE;
|
`LWR: HasConst = TRUE;
|
`LWR: HasConst = TRUE;
|
`LV: HasConst = TRUE;
|
`LV: HasConst = TRUE;
|
`SB: HasConst = TRUE;
|
`SB: HasConst = TRUE;
|
`Sx: HasConst = TRUE;
|
`Sx: HasConst = TRUE;
|
`SWC: HasConst = TRUE;
|
`SWC: HasConst = TRUE;
|
`INC: HasConst = TRUE;
|
`INC: HasConst = TRUE;
|
`SV: HasConst = TRUE;
|
`SV: HasConst = TRUE;
|
`CAS: HasConst = TRUE;
|
`CAS: HasConst = TRUE;
|
`JAL: HasConst = TRUE;
|
`JAL: HasConst = TRUE;
|
`CALL: HasConst = TRUE;
|
`CALL: HasConst = TRUE;
|
`RET: HasConst = TRUE;
|
`RET: HasConst = TRUE;
|
`LVx: HasConst = TRUE;
|
`LVx: HasConst = TRUE;
|
`LVxU: HasConst = TRUE;
|
`LVxU: HasConst = TRUE;
|
|
`PUSHC: HasConst = TRUE;
|
default: HasConst = FALSE;
|
default: HasConst = FALSE;
|
endcase
|
endcase
|
endfunction
|
endfunction
|
|
|
function IsOddball;
|
function IsOddball;
|
input [47:0] instr;
|
input [47:0] instr;
|
//if (|iqentry_exc[head])
|
//if (|iqentry_exc[head])
|
// IsOddball = TRUE;
|
// IsOddball = TRUE;
|
//else
|
//else
|
case(instr[`INSTRUCTION_OP])
|
case(instr[`INSTRUCTION_OP])
|
`BRK: IsOddball = TRUE;
|
`BRK: IsOddball = TRUE;
|
`IVECTOR:
|
`IVECTOR:
|
case(instr[`INSTRUCTION_S2])
|
case(instr[`INSTRUCTION_S2])
|
`VSxx: IsOddball = TRUE;
|
`VSxx: IsOddball = TRUE;
|
default: IsOddball = FALSE;
|
default: IsOddball = FALSE;
|
endcase
|
endcase
|
`RR:
|
`RR:
|
case(instr[`INSTRUCTION_S2])
|
case(instr[`INSTRUCTION_S2])
|
`VMOV: IsOddball = TRUE;
|
`VMOV: IsOddball = TRUE;
|
`SEI,`RTI: IsOddball = TRUE;
|
`SEI,`RTI: IsOddball = TRUE;
|
default: IsOddball = FALSE;
|
default: IsOddball = FALSE;
|
endcase
|
endcase
|
`MEMNDX:
|
`MEMNDX:
|
case({instr[31:28],instr[17:16]})
|
case({instr[31:28],instr[17:16]})
|
`CACHEX: IsOddball = TRUE;
|
`CACHEX: IsOddball = TRUE;
|
default: IsOddball = FALSE;
|
default: IsOddball = FALSE;
|
endcase
|
endcase
|
`CSRRW,`REX,`CACHE,`FLOAT: IsOddball = TRUE;
|
`CSRRW,`REX,`CACHE,`FLOAT: IsOddball = TRUE;
|
default: IsOddball = FALSE;
|
default: IsOddball = FALSE;
|
endcase
|
endcase
|
endfunction
|
endfunction
|
|
|
function IsRFW;
|
function IsRFW;
|
input [47:0] isn;
|
input [47:0] isn;
|
casez(isn[`INSTRUCTION_OP])
|
casez(isn[`INSTRUCTION_OP])
|
`IVECTOR: IsRFW = TRUE;
|
`IVECTOR: IsRFW = TRUE;
|
`FVECTOR: IsRFW = TRUE;
|
`FVECTOR: IsRFW = TRUE;
|
`R2:
|
`R2:
|
if (isn[`INSTRUCTION_L2]==2'b00)
|
if (isn[`INSTRUCTION_L2]==2'b00)
|
casez(isn[`INSTRUCTION_S2])
|
casez(isn[`INSTRUCTION_S2])
|
`TLB: IsRFW = TRUE;
|
`TLB: IsRFW = TRUE;
|
`R1:
|
`R1:
|
case(isn[22:18])
|
case(isn[22:18])
|
`MEMDB,`MEMSB,`SYNC,`SETWB,5'h14,5'h15: IsRFW = FALSE;
|
`MEMDB,`MEMSB,`SYNC,`SETWB,5'h14,5'h15: IsRFW = FALSE;
|
default: IsRFW = TRUE;
|
default: IsRFW = TRUE;
|
endcase
|
endcase
|
`ADD: IsRFW = TRUE;
|
`ADD: IsRFW = TRUE;
|
`SUB: IsRFW = TRUE;
|
`SUB: IsRFW = TRUE;
|
|
`SEQ: IsRFW = TRUE;
|
`SLT: IsRFW = TRUE;
|
`SLT: IsRFW = TRUE;
|
`SLTU: IsRFW = TRUE;
|
`SLTU: IsRFW = TRUE;
|
`SLE: IsRFW = TRUE;
|
`SLE: IsRFW = TRUE;
|
`SLEU: IsRFW = TRUE;
|
`SLEU: IsRFW = TRUE;
|
`AND: IsRFW = TRUE;
|
`AND: IsRFW = TRUE;
|
`OR: IsRFW = TRUE;
|
`OR: IsRFW = TRUE;
|
`XOR: IsRFW = TRUE;
|
`XOR: IsRFW = TRUE;
|
`NAND: IsRFW = TRUE;
|
`NAND: IsRFW = TRUE;
|
`NOR: IsRFW = TRUE;
|
`NOR: IsRFW = TRUE;
|
`XNOR: IsRFW = TRUE;
|
`XNOR: IsRFW = TRUE;
|
`MULU: IsRFW = TRUE;
|
`MULU: IsRFW = TRUE;
|
`MULSU: IsRFW = TRUE;
|
`MULSU: IsRFW = TRUE;
|
`MUL: IsRFW = TRUE;
|
`MUL: IsRFW = TRUE;
|
`MULUH: IsRFW = TRUE;
|
`MULUH: IsRFW = TRUE;
|
`MULSUH: IsRFW = TRUE;
|
`MULSUH: IsRFW = TRUE;
|
`MULH: IsRFW = TRUE;
|
`MULH: IsRFW = TRUE;
|
`MULF: IsRFW = TRUE;
|
`MULF: IsRFW = TRUE;
|
`FXMUL: IsRFW = TRUE;
|
`FXMUL: IsRFW = TRUE;
|
`DIVU: IsRFW = TRUE;
|
`DIVU: IsRFW = TRUE;
|
`DIVSU: IsRFW = TRUE;
|
`DIVSU: IsRFW = TRUE;
|
`DIV:IsRFW = TRUE;
|
`DIV:IsRFW = TRUE;
|
`MODU: IsRFW = TRUE;
|
`MODU: IsRFW = TRUE;
|
`MODSU: IsRFW = TRUE;
|
`MODSU: IsRFW = TRUE;
|
`MOD:IsRFW = TRUE;
|
`MOD:IsRFW = TRUE;
|
`MOV: IsRFW = TRUE;
|
`MOV: IsRFW = TRUE;
|
`VMOV: IsRFW = TRUE;
|
`VMOV: IsRFW = TRUE;
|
`SHIFTR,`SHIFT31,`SHIFT63:
|
`SHIFTR,`SHIFT31,`SHIFT63:
|
IsRFW = TRUE;
|
IsRFW = TRUE;
|
`MIN,`MAX: IsRFW = TRUE;
|
`MIN,`MAX: IsRFW = TRUE;
|
`SEI: IsRFW = TRUE;
|
`SEI: IsRFW = TRUE;
|
default: IsRFW = FALSE;
|
default: IsRFW = FALSE;
|
endcase
|
endcase
|
else if (isn[`INSTRUCTION_L2]==2'b01)
|
else if (isn[`INSTRUCTION_L2]==2'b01)
|
case(isn[47:42])
|
case(isn[47:42])
|
`CMOVEZ: IsRFW = TRUE;
|
`CMOVEZ: IsRFW = TRUE;
|
`CMOVNZ: IsRFW = TRUE;
|
`CMOVNZ: IsRFW = TRUE;
|
default: IsRFW = FALSE;
|
default: IsRFW = FALSE;
|
endcase
|
endcase
|
else if (isn[7]==1'b1)
|
else if (isn[7]==1'b1)
|
casez(isn[`INSTRUCTION_S2])
|
casez(isn[`INSTRUCTION_S2])
|
`ADD: IsRFW = TRUE;
|
`ADD: IsRFW = TRUE;
|
`SUB: IsRFW = TRUE;
|
`SUB: IsRFW = TRUE;
|
`AND: IsRFW = TRUE;
|
`AND: IsRFW = TRUE;
|
`OR: IsRFW = TRUE;
|
`OR: IsRFW = TRUE;
|
`XOR: IsRFW = TRUE;
|
`XOR: IsRFW = TRUE;
|
`MOV: IsRFW = TRUE;
|
`MOV: IsRFW = TRUE;
|
`SHIFTR,`SHIFT31,`SHIFT63:
|
`SHIFTR,`SHIFT31,`SHIFT63:
|
IsRFW = TRUE;
|
IsRFW = TRUE;
|
default: IsRFW = FALSE;
|
default: IsRFW = FALSE;
|
endcase
|
endcase
|
else
|
else
|
IsRFW = FALSE;
|
IsRFW = FALSE;
|
`MEMNDX:
|
`MEMNDX:
|
if (isn[`INSTRUCTION_L2]==2'b10) begin
|
if (isn[`INSTRUCTION_L2]==2'b10) begin
|
if (IsLoad(isn))
|
if (IsLoad(isn))
|
IsRFW = TRUE;
|
IsRFW = TRUE;
|
else
|
else
|
case({isn[31:28],isn[17:16]})
|
case({isn[31:28],isn[17:16]})
|
`PUSH: IsRFW = TRUE;
|
`PUSH: IsRFW = TRUE;
|
`CASX: IsRFW = TRUE;
|
`CASX: IsRFW = TRUE;
|
default: IsRFW = FALSE;
|
default: IsRFW = FALSE;
|
endcase
|
endcase
|
end
|
end
|
else if (isn[`INSTRUCTION_L2]==2'b00) begin
|
else if (isn[`INSTRUCTION_L2]==2'b00) begin
|
if (IsLoad(isn))
|
if (IsLoad(isn))
|
case({isn[31:28],isn[22:21]})
|
case({isn[31:28],isn[22:21]})
|
`LBX: IsRFW = TRUE;
|
`LBX: IsRFW = TRUE;
|
`LBUX: IsRFW = TRUE;
|
`LBUX: IsRFW = TRUE;
|
`LCX: IsRFW = TRUE;
|
`LCX: IsRFW = TRUE;
|
`LCUX: IsRFW = TRUE;
|
`LCUX: IsRFW = TRUE;
|
`LHX: IsRFW = TRUE;
|
`LHX: IsRFW = TRUE;
|
`LHUX: IsRFW = TRUE;
|
`LHUX: IsRFW = TRUE;
|
`LWX: IsRFW = TRUE;
|
`LWX: IsRFW = TRUE;
|
`LVBX: IsRFW = TRUE;
|
`LVBX: IsRFW = TRUE;
|
`LVBUX: IsRFW = TRUE;
|
`LVBUX: IsRFW = TRUE;
|
`LVCX: IsRFW = TRUE;
|
`LVCX: IsRFW = TRUE;
|
`LVCUX: IsRFW = TRUE;
|
`LVCUX: IsRFW = TRUE;
|
`LVHX: IsRFW = TRUE;
|
`LVHX: IsRFW = TRUE;
|
`LVHUX: IsRFW = TRUE;
|
`LVHUX: IsRFW = TRUE;
|
`LVWX: IsRFW = TRUE;
|
`LVWX: IsRFW = TRUE;
|
`LWX: IsRFW = TRUE;
|
`LWX: IsRFW = TRUE;
|
`LWRX: IsRFW = TRUE;
|
`LWRX: IsRFW = TRUE;
|
`LVX: IsRFW = TRUE;
|
`LVX: IsRFW = TRUE;
|
default: IsRFW = FALSE;
|
default: IsRFW = FALSE;
|
endcase
|
endcase
|
else
|
else
|
case({isn[31:28],isn[17:16]})
|
case({isn[31:28],isn[17:16]})
|
`PUSH: IsRFW = TRUE;
|
`PUSH: IsRFW = TRUE;
|
`CASX: IsRFW = TRUE;
|
`CASX: IsRFW = TRUE;
|
default: IsRFW = FALSE;
|
default: IsRFW = FALSE;
|
endcase
|
endcase
|
end
|
end
|
else
|
else
|
IsRFW = FALSE;
|
IsRFW = FALSE;
|
`BBc: IsRFW = FALSE;
|
`BBc: IsRFW = FALSE;
|
`BITFIELD: IsRFW = TRUE;
|
`BITFIELD: IsRFW = TRUE;
|
`ADDI: IsRFW = TRUE;
|
`ADDI: IsRFW = TRUE;
|
|
`SEQI: IsRFW = TRUE;
|
`SLTI: IsRFW = TRUE;
|
`SLTI: IsRFW = TRUE;
|
`SLTUI: IsRFW = TRUE;
|
`SLTUI: IsRFW = TRUE;
|
`SGTI: IsRFW = TRUE;
|
`SGTI: IsRFW = TRUE;
|
`SGTUI: IsRFW = TRUE;
|
`SGTUI: IsRFW = TRUE;
|
`ANDI: IsRFW = TRUE;
|
`ANDI: IsRFW = TRUE;
|
`ORI: IsRFW = TRUE;
|
`ORI: IsRFW = TRUE;
|
`XORI: IsRFW = TRUE;
|
`XORI: IsRFW = TRUE;
|
`XNORI: IsRFW = TRUE;
|
`XNORI: IsRFW = TRUE;
|
`MULUI: IsRFW = TRUE;
|
`MULUI: IsRFW = TRUE;
|
`MULI: IsRFW = TRUE;
|
`MULI: IsRFW = TRUE;
|
`MULFI: IsRFW = TRUE;
|
`MULFI: IsRFW = TRUE;
|
`DIVUI: IsRFW = TRUE;
|
`DIVUI: IsRFW = TRUE;
|
`DIVI: IsRFW = TRUE;
|
`DIVI: IsRFW = TRUE;
|
`MODI: IsRFW = TRUE;
|
`MODI: IsRFW = TRUE;
|
`JAL: IsRFW = TRUE;
|
`JAL: IsRFW = TRUE;
|
`CALL: IsRFW = TRUE;
|
`CALL: IsRFW = TRUE;
|
`RET: IsRFW = TRUE;
|
`RET: IsRFW = TRUE;
|
`LB: IsRFW = TRUE;
|
`LB: IsRFW = TRUE;
|
`LBU: IsRFW = TRUE;
|
`LBU: IsRFW = TRUE;
|
`Lx: IsRFW = TRUE;
|
`Lx: IsRFW = TRUE;
|
`LxU: IsRFW = TRUE;
|
`LxU: IsRFW = TRUE;
|
`LWR: IsRFW = TRUE;
|
`LWR: IsRFW = TRUE;
|
`LV: IsRFW = TRUE;
|
`LV: IsRFW = TRUE;
|
`LVx: IsRFW = TRUE;
|
`LVx: IsRFW = TRUE;
|
`LVxU: IsRFW = TRUE;
|
`LVxU: IsRFW = TRUE;
|
|
`PUSHC: IsRFW = TRUE;
|
`CAS: IsRFW = TRUE;
|
`CAS: IsRFW = TRUE;
|
`AMO: IsRFW = TRUE;
|
`AMO: IsRFW = TRUE;
|
`CSRRW: IsRFW = TRUE;
|
`CSRRW: IsRFW = TRUE;
|
`AUIPC: IsRFW = TRUE;
|
`AUIPC: IsRFW = TRUE;
|
`LUI: IsRFW = TRUE;
|
`LUI: IsRFW = TRUE;
|
default: IsRFW = FALSE;
|
default: IsRFW = FALSE;
|
endcase
|
endcase
|
endfunction
|
endfunction
|
|
|
// Determines which lanes of the target register get updated.
|
// Determines which lanes of the target register get updated.
|
function [7:0] fnWe;
|
function [7:0] fnWe;
|
input [47:0] isn;
|
input [47:0] isn;
|
casez(isn[`INSTRUCTION_OP])
|
casez(isn[`INSTRUCTION_OP])
|
`R2:
|
`R2:
|
case(isn[`INSTRUCTION_S2])
|
case(isn[`INSTRUCTION_S2])
|
`CMP: fnWe = 8'h00; // CMP sets predicate registers so doesn't update general register file.
|
`CMP: fnWe = 8'h00; // CMP sets predicate registers so doesn't update general register file.
|
default: fnWe = 8'hFF;
|
default: fnWe = 8'hFF;
|
endcase
|
endcase
|
`CMPI: fnWe = 8'h00;
|
|
default: fnWe = 8'hFF;
|
default: fnWe = 8'hFF;
|
endcase
|
endcase
|
/*
|
/*
|
casez(isn[`INSTRUCTION_OP])
|
casez(isn[`INSTRUCTION_OP])
|
`R2:
|
`R2:
|
case(isn[`INSTRUCTION_S2])
|
case(isn[`INSTRUCTION_S2])
|
`R1:
|
`R1:
|
case(isn[22:18])
|
case(isn[22:18])
|
`ABS,`CNTLZ,`CNTLO,`CNTPOP:
|
`ABS,`CNTLZ,`CNTLO,`CNTPOP:
|
case(isn[25:23])
|
case(isn[25:23])
|
3'b000: fnWe = 8'h01;
|
3'b000: fnWe = 8'h01;
|
3'b001: fnWe = 8'h03;
|
3'b001: fnWe = 8'h03;
|
3'b010: fnWe = 8'h0F;
|
3'b010: fnWe = 8'h0F;
|
3'b011: fnWe = 8'hFF;
|
3'b011: fnWe = 8'hFF;
|
default: fnWe = 8'hFF;
|
default: fnWe = 8'hFF;
|
endcase
|
endcase
|
default: fnWe = 8'hFF;
|
default: fnWe = 8'hFF;
|
endcase
|
endcase
|
`SHIFT31: fnWe = (~isn[25] & isn[21]) ? 8'hFF : 8'hFF;
|
`SHIFT31: fnWe = (~isn[25] & isn[21]) ? 8'hFF : 8'hFF;
|
`SHIFT63: fnWe = (~isn[25] & isn[21]) ? 8'hFF : 8'hFF;
|
`SHIFT63: fnWe = (~isn[25] & isn[21]) ? 8'hFF : 8'hFF;
|
`SLT,`SLTU,`SLE,`SLEU,
|
`SLT,`SLTU,`SLE,`SLEU,
|
`ADD,`SUB,
|
`ADD,`SUB,
|
`AND,`OR,`XOR,
|
`AND,`OR,`XOR,
|
`NAND,`NOR,`XNOR,
|
`NAND,`NOR,`XNOR,
|
`DIV,`DIVU,`DIVSU,
|
`DIV,`DIVU,`DIVSU,
|
`MOD,`MODU,`MODSU,
|
`MOD,`MODU,`MODSU,
|
`MUL,`MULU,`MULSU,
|
`MUL,`MULU,`MULSU,
|
`MULH,`MULUH,`MULSUH,
|
`MULH,`MULUH,`MULSUH,
|
`FXMUL:
|
`FXMUL:
|
case(isn[25:23])
|
case(isn[25:23])
|
3'b000: fnWe = 8'h01;
|
3'b000: fnWe = 8'h01;
|
3'b001: fnWe = 8'h03;
|
3'b001: fnWe = 8'h03;
|
3'b010: fnWe = 8'h0F;
|
3'b010: fnWe = 8'h0F;
|
3'b011: fnWe = 8'hFF;
|
3'b011: fnWe = 8'hFF;
|
default: fnWe = 8'hFF;
|
default: fnWe = 8'hFF;
|
endcase
|
endcase
|
default: fnWe = 8'hFF;
|
default: fnWe = 8'hFF;
|
endcase
|
endcase
|
default: fnWe = 8'hFF;
|
default: fnWe = 8'hFF;
|
endcase
|
endcase
|
*/
|
*/
|
endfunction
|
endfunction
|
|
|
// Detect if a source is automatically valid
|
// Detect if a source is automatically valid
|
function Source1Valid;
|
function Source1Valid;
|
input [47:0] isn;
|
input [47:0] isn;
|
casez(isn[`INSTRUCTION_OP])
|
casez(isn[`INSTRUCTION_OP])
|
`BRK: Source1Valid = TRUE;
|
`BRK: Source1Valid = TRUE;
|
`Bcc: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`Bcc: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
|
`BLcc: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`BBc: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`BBc: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`BEQI: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`BEQI: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
|
`BNEI: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`CHK: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`CHK: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`R2: case(isn[`INSTRUCTION_S2])
|
`R2: case(isn[`INSTRUCTION_S2])
|
`SHIFT31: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`SHIFT31: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`SHIFT63: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`SHIFT63: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`SHIFTR: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`SHIFTR: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
default: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
default: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
endcase
|
endcase
|
`MEMNDX: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`MEMNDX: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`ADDI: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`ADDI: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
|
`SEQI: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`SLTI: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`SLTI: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`SLTUI: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`SLTUI: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`SGTI: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`SGTI: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`SGTUI: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`SGTUI: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`ANDI: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`ANDI: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`ORI: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`ORI: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`XORI: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`XORI: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`XNORI: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`XNORI: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`MULUI: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`MULUI: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`AMO: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`AMO: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`LB: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`LB: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`LBU: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`LBU: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`Lx: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`Lx: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`LxU: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`LxU: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`LWR: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`LWR: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`LV: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`LV: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`LVx: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`LVx: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`SB: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`SB: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`Sx: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`Sx: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`SWC: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`SWC: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`SV: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`SV: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
|
`PUSHC: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`INC: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`INC: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`CAS: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`CAS: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`JAL: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`JAL: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`RET: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`RET: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`CSRRW: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`CSRRW: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
`BITFIELD: case(isn[31:28])
|
`BITFIELD: case(isn[31:28])
|
`BFINSI: Source1Valid = TRUE;
|
`BFINSI: Source1Valid = TRUE;
|
default: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
default: Source1Valid = isn[`INSTRUCTION_RA]==5'd0;
|
endcase
|
endcase
|
`IVECTOR:
|
`IVECTOR:
|
Source1Valid = FALSE;
|
Source1Valid = FALSE;
|
default: Source1Valid = TRUE;
|
default: Source1Valid = TRUE;
|
endcase
|
endcase
|
endfunction
|
endfunction
|
|
|
function Source2Valid;
|
function Source2Valid;
|
input [47:0] isn;
|
input [47:0] isn;
|
casez(isn[`INSTRUCTION_OP])
|
casez(isn[`INSTRUCTION_OP])
|
`BRK: Source2Valid = TRUE;
|
`BRK: Source2Valid = TRUE;
|
`Bcc: Source2Valid = isn[`INSTRUCTION_RB]==5'd0;
|
`Bcc: Source2Valid = isn[`INSTRUCTION_RB]==5'd0;
|
|
`BLcc: Source2Valid = isn[`INSTRUCTION_RB]==5'd0;
|
`BBc: Source2Valid = TRUE;
|
`BBc: Source2Valid = TRUE;
|
`BEQI: Source2Valid = TRUE;
|
`BEQI: Source2Valid = TRUE;
|
|
`BNEI: Source2Valid = TRUE;
|
`CHK: Source2Valid = isn[`INSTRUCTION_RB]==5'd0;
|
`CHK: Source2Valid = isn[`INSTRUCTION_RB]==5'd0;
|
`R2: case(isn[`INSTRUCTION_S2])
|
`R2: case(isn[`INSTRUCTION_S2])
|
`R1: Source2Valid = TRUE;
|
`R1: Source2Valid = TRUE;
|
`SHIFTR: Source2Valid = isn[25] ? 1'b1 : isn[`INSTRUCTION_RB]==5'd0;
|
`SHIFT31: Source2Valid = TRUE;
|
`SHIFT31: Source2Valid = isn[25] ? 1'b1 : isn[`INSTRUCTION_RB]==5'd0;
|
`SHIFT63: Source2Valid = TRUE;
|
`SHIFT63: Source2Valid = isn[25] ? 1'b1 : isn[`INSTRUCTION_RB]==5'd0;
|
|
default: Source2Valid = isn[`INSTRUCTION_RB]==5'd0;
|
default: Source2Valid = isn[`INSTRUCTION_RB]==5'd0;
|
endcase
|
endcase
|
`MEMNDX:
|
`MEMNDX:
|
if (IsLoad(isn))
|
if (IsLoad(isn))
|
case({isn[31:28],isn[22:21]})
|
case({isn[31:28],isn[22:21]})
|
`LVX: Source2Valid = FALSE;
|
`LVX: Source2Valid = FALSE;
|
default: Source2Valid = isn[`INSTRUCTION_RB]==5'd0;
|
default: Source2Valid = isn[`INSTRUCTION_RB]==5'd0;
|
endcase
|
endcase
|
else
|
else
|
case({isn[31:28],isn[17:16]})
|
case({isn[31:28],isn[17:16]})
|
`SVX: Source2Valid = FALSE;
|
`SVX: Source2Valid = FALSE;
|
default: Source2Valid = isn[`INSTRUCTION_RB]==5'd0;
|
default: Source2Valid = isn[`INSTRUCTION_RB]==5'd0;
|
endcase
|
endcase
|
`ADDI: Source2Valid = TRUE;
|
`ADDI: Source2Valid = TRUE;
|
|
`SEQI: Source2Valid = TRUE;
|
`SLTI: Source2Valid = TRUE;
|
`SLTI: Source2Valid = TRUE;
|
`SLTUI: Source2Valid = TRUE;
|
`SLTUI: Source2Valid = TRUE;
|
`SGTI: Source2Valid = TRUE;
|
`SGTI: Source2Valid = TRUE;
|
`SGTUI: Source2Valid = TRUE;
|
`SGTUI: Source2Valid = TRUE;
|
`ANDI: Source2Valid = TRUE;
|
`ANDI: Source2Valid = TRUE;
|
`ORI: Source2Valid = TRUE;
|
`ORI: Source2Valid = TRUE;
|
`XORI: Source2Valid = TRUE;
|
`XORI: Source2Valid = TRUE;
|
`XNORI: Source2Valid = TRUE;
|
`XNORI: Source2Valid = TRUE;
|
`MULUI: Source2Valid = TRUE;
|
`MULUI: Source2Valid = TRUE;
|
`LB: Source2Valid = TRUE;
|
`LB: Source2Valid = TRUE;
|
`LBU: Source2Valid = TRUE;
|
`LBU: Source2Valid = TRUE;
|
`Lx: Source2Valid = TRUE;
|
`Lx: Source2Valid = TRUE;
|
`LxU: Source2Valid = TRUE;
|
`LxU: Source2Valid = TRUE;
|
`LWR: Source2Valid = TRUE;
|
`LWR: Source2Valid = TRUE;
|
`LVx: Source2Valid = TRUE;
|
`LVx: Source2Valid = TRUE;
|
`INC: Source2Valid = TRUE;
|
`INC: Source2Valid = TRUE;
|
`SB: Source2Valid = isn[`INSTRUCTION_RB]==5'd0;
|
`SB: Source2Valid = isn[`INSTRUCTION_RB]==5'd0;
|
`Sx: Source2Valid = isn[`INSTRUCTION_RB]==5'd0;
|
`Sx: Source2Valid = isn[`INSTRUCTION_RB]==5'd0;
|
`SWC: Source2Valid = isn[`INSTRUCTION_RB]==5'd0;
|
`SWC: Source2Valid = isn[`INSTRUCTION_RB]==5'd0;
|
|
`PUSHC: Source2Valid = TRUE;
|
`CAS: Source2Valid = isn[`INSTRUCTION_RB]==5'd0;
|
`CAS: Source2Valid = isn[`INSTRUCTION_RB]==5'd0;
|
`JAL: Source2Valid = TRUE;
|
`JAL: Source2Valid = TRUE;
|
`RET: Source2Valid = isn[`INSTRUCTION_RB]==5'd0;
|
`RET: Source2Valid = isn[`INSTRUCTION_RB]==5'd0;
|
`IVECTOR:
|
`IVECTOR:
|
case(isn[`INSTRUCTION_S2])
|
case(isn[`INSTRUCTION_S2])
|
`VABS: Source2Valid = TRUE;
|
`VABS: Source2Valid = TRUE;
|
`VMAND,`VMOR,`VMXOR,`VMXNOR,`VMPOP:
|
`VMAND,`VMOR,`VMXOR,`VMXNOR,`VMPOP:
|
Source2Valid = FALSE;
|
Source2Valid = FALSE;
|
`VADDS,`VSUBS,`VANDS,`VORS,`VXORS:
|
`VADDS,`VSUBS,`VANDS,`VORS,`VXORS:
|
Source2Valid = isn[`INSTRUCTION_RB]==5'd0;
|
Source2Valid = isn[`INSTRUCTION_RB]==5'd0;
|
`VBITS2V: Source2Valid = TRUE;
|
`VBITS2V: Source2Valid = TRUE;
|
`V2BITS: Source2Valid = isn[`INSTRUCTION_RB]==5'd0;
|
`V2BITS: Source2Valid = isn[`INSTRUCTION_RB]==5'd0;
|
`VSHL,`VSHR,`VASR: Source2Valid = isn[22:21]==2'd2;
|
`VSHL,`VSHR,`VASR: Source2Valid = isn[22:21]==2'd2;
|
default: Source2Valid = FALSE;
|
default: Source2Valid = FALSE;
|
endcase
|
endcase
|
`LV: Source2Valid = TRUE;
|
`LV: Source2Valid = TRUE;
|
`SV: Source2Valid = FALSE;
|
`SV: Source2Valid = FALSE;
|
`AMO: Source2Valid = isn[31] || isn[`INSTRUCTION_RB]==5'd0;
|
`AMO: Source2Valid = isn[31] || isn[`INSTRUCTION_RB]==5'd0;
|
default: Source2Valid = TRUE;
|
default: Source2Valid = TRUE;
|
endcase
|
endcase
|
endfunction
|
endfunction
|
|
|
function Source3Valid;
|
function Source3Valid;
|
input [47:0] isn;
|
input [47:0] isn;
|
case(isn[`INSTRUCTION_OP])
|
case(isn[`INSTRUCTION_OP])
|
`IVECTOR:
|
`IVECTOR:
|
case(isn[`INSTRUCTION_S2])
|
case(isn[`INSTRUCTION_S2])
|
`VEX: Source3Valid = TRUE;
|
`VEX: Source3Valid = TRUE;
|
default: Source3Valid = TRUE;
|
default: Source3Valid = TRUE;
|
endcase
|
endcase
|
`CHK: Source3Valid = isn[`INSTRUCTION_RC]==5'd0;
|
`CHK: Source3Valid = isn[`INSTRUCTION_RC]==5'd0;
|
`R2:
|
`R2:
|
if (isn[`INSTRUCTION_L2]==2'b01)
|
if (isn[`INSTRUCTION_L2]==2'b01)
|
case(isn[47:42])
|
case(isn[47:42])
|
`CMOVEZ,`CMOVNZ: Source3Valid = isn[`INSTRUCTION_RC]==5'd0;
|
`CMOVEZ,`CMOVNZ: Source3Valid = isn[`INSTRUCTION_RC]==5'd0;
|
default: Source3Valid = TRUE;
|
default: Source3Valid = TRUE;
|
endcase
|
endcase
|
else
|
else
|
case(isn[`INSTRUCTION_S2])
|
case(isn[`INSTRUCTION_S2])
|
`MAJ: Source3Valid = isn[`INSTRUCTION_RC]==5'd0;
|
`MAJ: Source3Valid = isn[`INSTRUCTION_RC]==5'd0;
|
default: Source3Valid = TRUE;
|
default: Source3Valid = TRUE;
|
endcase
|
endcase
|
`MEMNDX:
|
`MEMNDX:
|
if (isn[`INSTRUCTION_L2]==2'b00)
|
if (isn[`INSTRUCTION_L2]==2'b00)
|
case({isn[31:28],isn[17:16]})
|
case({isn[31:28],isn[17:16]})
|
`SBX: Source3Valid = isn[`INSTRUCTION_RC]==5'd0;
|
`SBX: Source3Valid = isn[`INSTRUCTION_RC]==5'd0;
|
`SCX: Source3Valid = isn[`INSTRUCTION_RC]==5'd0;
|
`SCX: Source3Valid = isn[`INSTRUCTION_RC]==5'd0;
|
`SHX: Source3Valid = isn[`INSTRUCTION_RC]==5'd0;
|
`SHX: Source3Valid = isn[`INSTRUCTION_RC]==5'd0;
|
`SWX: Source3Valid = isn[`INSTRUCTION_RC]==5'd0;
|
`SWX: Source3Valid = isn[`INSTRUCTION_RC]==5'd0;
|
`SWCX: Source3Valid = isn[`INSTRUCTION_RC]==5'd0;
|
`SWCX: Source3Valid = isn[`INSTRUCTION_RC]==5'd0;
|
`CASX: Source3Valid = isn[`INSTRUCTION_RC]==5'd0;
|
`CASX: Source3Valid = isn[`INSTRUCTION_RC]==5'd0;
|
default: Source3Valid = TRUE;
|
default: Source3Valid = TRUE;
|
endcase
|
endcase
|
else
|
else
|
Source3Valid = TRUE;
|
Source3Valid = TRUE;
|
default: Source3Valid = TRUE;
|
default: Source3Valid = TRUE;
|
endcase
|
endcase
|
endfunction
|
endfunction
|
|
|
wire isRet = IsRet(instr);
|
wire isRet = IsRet(instr);
|
wire isJal = IsJAL(instr);
|
wire isJal = IsJAL(instr);
|
wire isBrk = IsBrk(instr);
|
wire isBrk = IsBrk(instr);
|
wire isRti = IsRti(instr);
|
wire isRti = IsRti(instr);
|
|
|
`ifdef REGISTER_DECODE
|
`ifdef REGISTER_DECODE
|
always @(posedge clk)
|
always @(posedge clk)
|
`else
|
`else
|
always @*
|
always @*
|
`endif
|
`endif
|
begin
|
begin
|
bus <= 144'h0;
|
bus <= 144'h0;
|
bus[`IB_CMP] <= IsCmp(instr);
|
bus[`IB_LOADSEG] <= IsMov2Seg(instr);
|
if (IsStore(instr))
|
bus[`IB_CMP] <= 1'b0;//IsCmp(instr);
|
|
if (IsStore(instr) & !IsPushc(instr))
|
bus[`IB_CONST] <= instr[6]==1'b1 ? {{34{instr[47]}},instr[47:23],instr[17:13]} :
|
bus[`IB_CONST] <= instr[6]==1'b1 ? {{34{instr[47]}},instr[47:23],instr[17:13]} :
|
{{50{instr[31]}},instr[31:23],instr[17:13]};
|
{{50{instr[31]}},instr[31:23],instr[17:13]};
|
else
|
else
|
bus[`IB_CONST] <= instr[6]==1'b1 ? {{34{instr[47]}},instr[47:18]} :
|
bus[`IB_CONST] <= instr[6]==1'b1 ? {{34{instr[47]}},instr[47:18]} :
|
{{50{instr[31]}},instr[31:18]};
|
{{50{instr[31]}},instr[31:18]};
|
`ifdef SUPPORT_DCI
|
`ifdef SUPPORT_DCI
|
if (instr[`INSTRUCTION_OP]==`CMPRSSD)
|
if (instr[`INSTRUCTION_OP]==`CMPRSSD)
|
bus[`IB_LN] <= 3'd2 | pred_on;
|
bus[`IB_LN] <= 3'd2 | pred_on;
|
else
|
else
|
`endif
|
`endif
|
case(instr[7:6])
|
case(instr[7:6])
|
2'b00: bus[`IB_LN] <= 3'd4 | pred_on;
|
2'b00: bus[`IB_LN] <= 3'd4 | pred_on;
|
2'b01: bus[`IB_LN] <= 3'd6 | pred_on;
|
2'b01: bus[`IB_LN] <= 3'd6 | pred_on;
|
default: bus[`IB_LN] <= 3'd2 | pred_on;
|
default: bus[`IB_LN] <= 3'd2 | pred_on;
|
endcase
|
endcase
|
// bus[`IB_RT] <= fnRt(instr,ven,vl,thrd) | {thrd,7'b0};
|
// bus[`IB_RT] <= fnRt(instr,ven,vl,thrd) | {thrd,7'b0};
|
// bus[`IB_RC] <= fnRc(instr,ven,thrd) | {thrd,7'b0};
|
// bus[`IB_RC] <= fnRc(instr,ven,thrd) | {thrd,7'b0};
|
// bus[`IB_RA] <= fnRa(instr,ven,vl,thrd) | {thrd,7'b0};
|
// bus[`IB_RA] <= fnRa(instr,ven,vl,thrd) | {thrd,7'b0};
|
bus[`IB_IMM] <= HasConst(instr);
|
bus[`IB_IMM] <= HasConst(instr);
|
// bus[`IB_A3V] <= Source3Valid(instr);
|
// bus[`IB_A3V] <= Source3Valid(instr);
|
// bus[`IB_A2V] <= Source2Valid(instr);
|
// bus[`IB_A2V] <= Source2Valid(instr);
|
// bus[`IB_A1V] <= Source1Valid(instr);
|
// bus[`IB_A1V] <= Source1Valid(instr);
|
bus[`IB_TLB] <= IsTLB(instr);
|
bus[`IB_TLB] <= IsTLB(instr);
|
bus[`IB_SZ] <= instr[`INSTRUCTION_OP]==`R2 ? instr[25:23] : 3'd3; // 3'd3=word size
|
bus[`IB_SZ] <= instr[`INSTRUCTION_OP]==`R2 ? instr[25:23] : 3'd3; // 3'd3=word size
|
bus[`IB_IRQ] <= IsIrq(instr);
|
bus[`IB_IRQ] <= IsIrq(instr);
|
bus[`IB_BRK] <= isBrk;
|
bus[`IB_BRK] <= isBrk;
|
bus[`IB_RTI] <= isRti;
|
bus[`IB_RTI] <= isRti;
|
bus[`IB_RET] <= isRet;
|
bus[`IB_RET] <= isRet;
|
bus[`IB_JAL] <= isJal;
|
bus[`IB_JAL] <= isJal;
|
// IB_BT is now used to indicate when to update the branch target buffer.
|
// IB_BT is now used to indicate when to update the branch target buffer.
|
// This occurs when one of the instructions with an unknown or calculated
|
// This occurs when one of the instructions with an unknown or calculated
|
// target is present.
|
// target is present.
|
bus[`IB_BT] <= isJal | isRet | isBrk | isRti;
|
bus[`IB_BT] <= isJal | isRet | isBrk | isRti;
|
bus[`IB_ALU] <= IsALU;
|
bus[`IB_ALU] <= IsALU;
|
bus[`IB_ALU0] <= IsAlu0Only(instr);
|
bus[`IB_ALU0] <= IsAlu0Only(instr);
|
bus[`IB_FPU] <= IsFPU(instr);
|
bus[`IB_FPU] <= IsFPU(instr);
|
bus[`IB_FC] <= IsFlowCtrl;
|
bus[`IB_FC] <= IsFlowCtrl;
|
bus[`IB_CANEX] <= fnCanException(instr);
|
bus[`IB_CANEX] <= fnCanException(instr);
|
bus[`IB_LOADV] <= IsVolatileLoad(instr);
|
bus[`IB_LOADV] <= IsVolatileLoad(instr);
|
bus[`IB_LOAD] <= IsLoad(instr);
|
bus[`IB_LOAD] <= IsLoad(instr);
|
bus[`IB_PRELOAD] <= IsLoad(instr) && Rt==5'd0;
|
bus[`IB_PRELOAD] <= IsLoad(instr) && Rt==5'd0;
|
bus[`IB_STORE] <= IsStore(instr);
|
bus[`IB_STORE] <= IsStore(instr);
|
bus[`IB_PUSH] <= IsPush(instr);
|
bus[`IB_PUSH] <= IsPush(instr);
|
bus[`IB_ODDBALL] <= IsOddball(instr);
|
bus[`IB_ODDBALL] <= IsOddball(instr);
|
bus[`IB_MEMSZ] <= MemSize(instr);
|
bus[`IB_MEMSZ] <= MemSize(instr);
|
bus[`IB_MEM] <= IsMem(instr);
|
bus[`IB_MEM] <= IsMem;
|
bus[`IB_MEMNDX] <= IsMemNdx(instr);
|
bus[`IB_MEMNDX] <= IsMemNdx(instr);
|
bus[`IB_RMW] <= IsCAS(instr) || IsAMO(instr) || IsInc(instr);
|
bus[`IB_RMW] <= IsCAS(instr) || IsAMO(instr) || IsInc(instr);
|
bus[`IB_MEMDB] <= IsMemdb(instr);
|
bus[`IB_MEMDB] <= IsMemdb(instr);
|
bus[`IB_MEMSB] <= IsMemsb(instr);
|
bus[`IB_MEMSB] <= IsMemsb(instr);
|
bus[`IB_SHFT] <= IsShift48(instr);//|IsShift(instr);
|
bus[`IB_SHFT] <= IsShift48(instr);//|IsShift(instr);
|
bus[`IB_SEI] <= IsSEI(instr);
|
bus[`IB_SEI] <= IsSEI(instr);
|
bus[`IB_AQ] <= (IsAMO(instr)|IsLWRX(instr)|IsSWCX(instr)) & instr[25];
|
bus[`IB_AQ] <= (IsAMO(instr)|IsLWRX(instr)|IsSWCX(instr)) & instr[25];
|
bus[`IB_RL] <= (IsAMO(instr)|IsLWRX(instr)|IsSWCX(instr)) & instr[24];
|
bus[`IB_RL] <= (IsAMO(instr)|IsLWRX(instr)|IsSWCX(instr)) & instr[24];
|
bus[`IB_JMP] <= IsJmp(instr);
|
bus[`IB_JMP] <= IsJmp(instr);
|
bus[`IB_BR] <= IsBranch(instr);
|
bus[`IB_BR] <= IsBranch(instr);
|
bus[`IB_SYNC] <= IsSync(instr)||IsBrk(instr)||IsRti(instr);
|
bus[`IB_SYNC] <= IsSync(instr)||IsBrk(instr)||IsRti(instr);
|
bus[`IB_FSYNC] <= IsFSync(instr);
|
bus[`IB_FSYNC] <= IsFSync(instr);
|
bus[`IB_RFW] <= (Rt==5'd0) ? 1'b0 : IsRFW(instr);// && !IsCmp(instr);
|
bus[`IB_RFW] <= (Rt==5'd0) ? 1'b0 : IsRFW(instr);// && !IsCmp(instr);
|
bus[`IB_PRFW] <= IsCmp(instr);
|
bus[`IB_PRFW] <= 1'b0;//IsCmp(instr);
|
bus[`IB_WE] <= fnWe(instr);
|
bus[`IB_WE] <= fnWe(instr);
|
id_o <= id_i;
|
id_o <= id_i;
|
idv_o <= idv_i;
|
idv_o <= idv_i;
|
end
|
end
|
|
|
endmodule
|
endmodule
|
|
|
module mIsALU(instr, IsALU);
|
module mIsALU(instr, IsALU);
|
input [47:0] instr;
|
input [47:0] instr;
|
output reg IsALU;
|
output reg IsALU;
|
parameter TRUE = 1'b1;
|
parameter TRUE = 1'b1;
|
parameter FALSE = 1'b0;
|
parameter FALSE = 1'b0;
|
|
|
always @*
|
always @*
|
casez(instr[`INSTRUCTION_OP])
|
casez(instr[`INSTRUCTION_OP])
|
`R2:
|
`R2:
|
if (instr[`INSTRUCTION_L2]==2'b00)
|
if (instr[`INSTRUCTION_L2]==2'b00)
|
case(instr[`INSTRUCTION_S2])
|
case(instr[`INSTRUCTION_S2])
|
`VMOV: IsALU = TRUE;
|
`VMOV: IsALU = TRUE;
|
`RTI: IsALU = FALSE;
|
`RTI: IsALU = FALSE;
|
default: IsALU = TRUE;
|
default: IsALU = TRUE;
|
endcase
|
endcase
|
else
|
else
|
IsALU = TRUE;
|
IsALU = TRUE;
|
`BRK: IsALU = FALSE;
|
`BRK: IsALU = FALSE;
|
`Bcc: IsALU = FALSE;
|
`Bcc: IsALU = FALSE;
|
|
`BLcc: IsALU = FALSE;
|
`BBc: IsALU = FALSE;
|
`BBc: IsALU = FALSE;
|
`BEQI: IsALU = FALSE;
|
`BEQI: IsALU = FALSE;
|
|
`BNEI: IsALU = FALSE;
|
`CHK: IsALU = FALSE;
|
`CHK: IsALU = FALSE;
|
`JAL: IsALU = FALSE;
|
`JAL: IsALU = FALSE;
|
`JMP: IsALU = FALSE;
|
`JMP: IsALU = FALSE;
|
`CALL: IsALU = FALSE;
|
`CALL: IsALU = FALSE;
|
`RET: IsALU = FALSE;
|
`RET: IsALU = FALSE;
|
`FVECTOR:
|
`FVECTOR:
|
case(instr[`INSTRUCTION_S2])
|
case(instr[`INSTRUCTION_S2])
|
`VSHL,`VSHR,`VASR: IsALU = TRUE;
|
`VSHL,`VSHR,`VASR: IsALU = TRUE;
|
default: IsALU = FALSE; // Integer
|
default: IsALU = FALSE; // Integer
|
endcase
|
endcase
|
`IVECTOR:
|
`IVECTOR:
|
case(instr[`INSTRUCTION_S2])
|
case(instr[`INSTRUCTION_S2])
|
`VSHL,`VSHR,`VASR: IsALU = TRUE;
|
`VSHL,`VSHR,`VASR: IsALU = TRUE;
|
default: IsALU = TRUE; // Integer
|
default: IsALU = TRUE; // Integer
|
endcase
|
endcase
|
`FLOAT: IsALU = FALSE;
|
`FLOAT: IsALU = FALSE;
|
default: IsALU = TRUE;
|
default: IsALU = TRUE;
|
endcase
|
endcase
|
|
|
endmodule
|
endmodule
|
|
|