Line 1... |
Line 1... |
// ============================================================================
|
// ============================================================================
|
// __
|
// __
|
// \\__/ 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_EvalBranch.v
|
// FT64_EvalBranch.v
|
Line 22... |
Line 22... |
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
//
|
//
|
// ============================================================================
|
// ============================================================================
|
//
|
//
|
`define TRUE 1'b1
|
`define TRUE 1'b1
|
|
`define BNEI 6'h12
|
`define BBc 6'h26
|
`define BBc 6'h26
|
`define Bcc 6'h30
|
`define Bcc 6'h30
|
`define BEQI 6'h32
|
`define BEQI 6'h32
|
`define BCHK 6'h33
|
`define BCHK 6'h33
|
`define CHK 6'h34
|
`define CHK 6'h34
|
Line 34... |
Line 35... |
`define BNE 3'h1
|
`define BNE 3'h1
|
`define BLT 3'h2
|
`define BLT 3'h2
|
`define BGE 3'h3
|
`define BGE 3'h3
|
`define BLTU 3'h6
|
`define BLTU 3'h6
|
`define BGEU 3'h7
|
`define BGEU 3'h7
|
|
`define BAND 3'h0
|
|
`define BOR 3'h1
|
|
`define BXOR 3'd2
|
|
`define BNAND 3'h4
|
|
`define BNOR 3'h5
|
|
`define BXNOR 3'd6
|
|
|
`define IBNE 2'd2
|
`define IBNE 2'd2
|
`define DBNZ 2'd3
|
`define DBNZ 2'd3
|
|
|
module FT64_EvalBranch(instr, a, b, c, takb);
|
module FT64_EvalBranch(instr, a, b, c, takb);
|
Line 61... |
Line 68... |
`BGE: takb <= $signed(a) >= $signed(b);
|
`BGE: takb <= $signed(a) >= $signed(b);
|
`BLTU: takb <= a < b;
|
`BLTU: takb <= a < b;
|
`BGEU: takb <= a >= b;
|
`BGEU: takb <= a >= b;
|
default: takb <= `TRUE;
|
default: takb <= `TRUE;
|
endcase
|
endcase
|
|
`BLcc:
|
|
case(instr[15:13])
|
|
`BAND: takb <= a != 0 && b != 0;
|
|
`BOR: takb <= a != 0 || b != 0;
|
|
`BXOR: takb <= (a != 0) ^ (b != 0);
|
|
`BNAND: takb <= !(a != 0 && b != 0);
|
|
`BNOR: takb <= !(a != 0 || b != 0);
|
|
`BXNOR: takb <= !((a != 0) ^ (b != 0));
|
|
default: takb <= `TRUE;
|
|
endcase
|
`BEQI: takb <= a=={{56{instr[22]}},instr[22:18],instr[15:13]};
|
`BEQI: takb <= a=={{56{instr[22]}},instr[22:18],instr[15:13]};
|
|
`BNEI: takb <= a!={{56{instr[22]}},instr[22:18],instr[15:13]};
|
`BBc:
|
`BBc:
|
case(instr[14:13])
|
case(instr[14:13])
|
2'd0: takb <= a[{instr[22:18],instr[15]}]; // BBS
|
2'd0: takb <= a[{instr[22:18],instr[15]}]; // BBS
|
2'd1: takb <= ~a[{instr[22:18],instr[15]}]; // BBC
|
2'd1: takb <= ~a[{instr[22:18],instr[15]}]; // BBC
|
`IBNE: takb <= (a + 64'd1) !=b;
|
`IBNE: takb <= (a + 64'd1) !=b;
|