Line 62... |
Line 62... |
// Internal i/f
|
// Internal i/f
|
pre_branch_op, branch_op, except_type, except_prefix,
|
pre_branch_op, branch_op, except_type, except_prefix,
|
id_branch_addrtarget, ex_branch_addrtarget, muxed_b, operand_b,
|
id_branch_addrtarget, ex_branch_addrtarget, muxed_b, operand_b,
|
flag, flagforw, ex_branch_taken, except_start,
|
flag, flagforw, ex_branch_taken, except_start,
|
epcr, spr_dat_i, spr_pc_we, genpc_refetch,
|
epcr, spr_dat_i, spr_pc_we, genpc_refetch,
|
genpc_freeze, no_more_dslot, lsu_stall
|
genpc_freeze, no_more_dslot, lsu_stall, du_flush_pipe, spr_dat_npc
|
);
|
);
|
|
|
//
|
//
|
// I/O
|
// I/O
|
//
|
//
|
Line 103... |
Line 103... |
output ex_branch_taken;
|
output ex_branch_taken;
|
input except_start;
|
input except_start;
|
input [31:0] epcr;
|
input [31:0] epcr;
|
input [31:0] spr_dat_i;
|
input [31:0] spr_dat_i;
|
input spr_pc_we;
|
input spr_pc_we;
|
|
input [31:0] spr_dat_npc;
|
input genpc_refetch;
|
input genpc_refetch;
|
input genpc_freeze;
|
input genpc_freeze;
|
input no_more_dslot;
|
input no_more_dslot;
|
input lsu_stall;
|
input lsu_stall;
|
|
input du_flush_pipe;
|
|
|
parameter boot_adr = `OR1200_BOOT_ADR;
|
parameter boot_adr = `OR1200_BOOT_ADR;
|
//
|
//
|
// Internal wires and regs
|
// Internal wires and regs
|
//
|
//
|
Line 124... |
Line 126... |
reg wait_lsu;
|
reg wait_lsu;
|
|
|
//
|
//
|
// Address of insn to be fecthed
|
// Address of insn to be fecthed
|
//
|
//
|
assign icpu_adr_o = !no_more_dslot & !except_start & !spr_pc_we
|
assign icpu_adr_o = !no_more_dslot & !except_start & !spr_pc_we & !du_flush_pipe
|
& (icpu_rty_i | genpc_refetch) ?
|
& (icpu_rty_i | genpc_refetch) ?
|
icpu_adr_i : {pc[31:2], 1'b0, ex_branch_taken|spr_pc_we};
|
icpu_adr_i : {pc[31:2], 1'b0, ex_branch_taken|spr_pc_we};
|
|
|
//
|
//
|
// Control access to IC subsystem
|
// Control access to IC subsystem
|
Line 163... |
Line 165... |
// Async calculation of new PC value. This value is used for addressing the
|
// Async calculation of new PC value. This value is used for addressing the
|
// IC.
|
// IC.
|
//
|
//
|
always @(pcreg or ex_branch_addrtarget or flag or branch_op or except_type
|
always @(pcreg or ex_branch_addrtarget or flag or branch_op or except_type
|
or except_start or operand_b or epcr or spr_pc_we or spr_dat_i or
|
or except_start or operand_b or epcr or spr_pc_we or spr_dat_i or
|
except_prefix)
|
except_prefix or du_flush_pipe)
|
begin
|
begin
|
casez ({spr_pc_we, except_start, branch_op}) // synopsys parallel_case
|
casez ({du_flush_pipe, spr_pc_we, except_start, branch_op}) // synopsys parallel_case
|
{2'b00, `OR1200_BRANCHOP_NOP}: begin
|
{3'b000, `OR1200_BRANCHOP_NOP}: begin
|
pc = {pcreg + 30'd1, 2'b0};
|
pc = {pcreg + 30'd1, 2'b0};
|
ex_branch_taken = 1'b0;
|
ex_branch_taken = 1'b0;
|
end
|
end
|
{2'b00, `OR1200_BRANCHOP_J}: begin
|
{3'b000, `OR1200_BRANCHOP_J}: begin
|
`ifdef OR1200_VERBOSE
|
`ifdef OR1200_VERBOSE
|
// synopsys translate_off
|
// synopsys translate_off
|
$display("%t: BRANCHOP_J: pc <= ex_branch_addrtarget %h"
|
$display("%t: BRANCHOP_J: pc <= ex_branch_addrtarget %h"
|
, $time, ex_branch_addrtarget);
|
, $time, ex_branch_addrtarget);
|
// synopsys translate_on
|
// synopsys translate_on
|
`endif
|
`endif
|
pc = {ex_branch_addrtarget, 2'b00};
|
pc = {ex_branch_addrtarget, 2'b00};
|
ex_branch_taken = 1'b1;
|
ex_branch_taken = 1'b1;
|
end
|
end
|
{2'b00, `OR1200_BRANCHOP_JR}: begin
|
{3'b000, `OR1200_BRANCHOP_JR}: begin
|
`ifdef OR1200_VERBOSE
|
`ifdef OR1200_VERBOSE
|
// synopsys translate_off
|
// synopsys translate_off
|
$display("%t: BRANCHOP_JR: pc <= operand_b %h",
|
$display("%t: BRANCHOP_JR: pc <= operand_b %h",
|
$time, operand_b);
|
$time, operand_b);
|
// synopsys translate_on
|
// synopsys translate_on
|
`endif
|
`endif
|
pc = operand_b;
|
pc = operand_b;
|
ex_branch_taken = 1'b1;
|
ex_branch_taken = 1'b1;
|
end
|
end
|
{2'b00, `OR1200_BRANCHOP_BF}:
|
{3'b000, `OR1200_BRANCHOP_BF}:
|
if (flag) begin
|
if (flag) begin
|
`ifdef OR1200_VERBOSE
|
`ifdef OR1200_VERBOSE
|
// synopsys translate_off
|
// synopsys translate_off
|
$display("%t: BRANCHOP_BF: pc <= ex_branch_addrtarget %h",
|
$display("%t: BRANCHOP_BF: pc <= ex_branch_addrtarget %h",
|
$time, ex_branch_addrtarget);
|
$time, ex_branch_addrtarget);
|
Line 210... |
Line 212... |
// synopsys translate_on
|
// synopsys translate_on
|
`endif
|
`endif
|
pc = {pcreg + 30'd1, 2'b0};
|
pc = {pcreg + 30'd1, 2'b0};
|
ex_branch_taken = 1'b0;
|
ex_branch_taken = 1'b0;
|
end
|
end
|
{2'b00, `OR1200_BRANCHOP_BNF}:
|
{3'b000, `OR1200_BRANCHOP_BNF}:
|
if (flag) begin
|
if (flag) begin
|
`ifdef OR1200_VERBOSE
|
`ifdef OR1200_VERBOSE
|
// synopsys translate_off
|
// synopsys translate_off
|
$display("%t: BRANCHOP_BNF: not taken", $time);
|
$display("%t: BRANCHOP_BNF: not taken", $time);
|
// synopsys translate_on
|
// synopsys translate_on
|
Line 230... |
Line 232... |
// synopsys translate_on
|
// synopsys translate_on
|
`endif
|
`endif
|
pc = {ex_branch_addrtarget, 2'b00};
|
pc = {ex_branch_addrtarget, 2'b00};
|
ex_branch_taken = 1'b1;
|
ex_branch_taken = 1'b1;
|
end
|
end
|
{2'b00, `OR1200_BRANCHOP_RFE}: begin
|
{3'b000, `OR1200_BRANCHOP_RFE}: begin
|
`ifdef OR1200_VERBOSE
|
`ifdef OR1200_VERBOSE
|
// synopsys translate_off
|
// synopsys translate_off
|
$display("%t: BRANCHOP_RFE: pc <= epcr %h",
|
$display("%t: BRANCHOP_RFE: pc <= epcr %h",
|
$time, epcr);
|
$time, epcr);
|
// synopsys translate_on
|
// synopsys translate_on
|
`endif
|
`endif
|
pc = epcr;
|
pc = epcr;
|
ex_branch_taken = 1'b1;
|
ex_branch_taken = 1'b1;
|
end
|
end
|
{2'b01, 3'b???}: begin
|
{3'b100, 3'b???}: begin
|
|
`ifdef OR1200_VERBOSE
|
|
// synopsys translate_off
|
|
$display("Reload breaked ins at : %h.", spr_dat_npc);
|
|
// synopsys translate_on
|
|
`endif
|
|
pc = spr_dat_npc;
|
|
ex_branch_taken = 1'b1;
|
|
end
|
|
{3'b001, 3'b???}: begin
|
`ifdef OR1200_VERBOSE
|
`ifdef OR1200_VERBOSE
|
// synopsys translate_off
|
// synopsys translate_off
|
$display("Starting exception: %h.", except_type);
|
$display("Starting exception: %h.", except_type);
|
// synopsys translate_on
|
// synopsys translate_on
|
`endif
|
`endif
|
Line 286... |
Line 297... |
pcreg_select <= 1'b0; // select FF value
|
pcreg_select <= 1'b0; // select FF value
|
end
|
end
|
else if (spr_pc_we) begin
|
else if (spr_pc_we) begin
|
pcreg_default <= spr_dat_i[31:2];
|
pcreg_default <= spr_dat_i[31:2];
|
end
|
end
|
else if (no_more_dslot | except_start | !genpc_freeze & !icpu_rty_i
|
else if (du_flush_pipe | no_more_dslot | except_start | !genpc_freeze & !icpu_rty_i
|
& !genpc_refetch) begin
|
& !genpc_refetch) begin
|
pcreg_default <= pc[31:2];
|
pcreg_default <= pc[31:2];
|
end
|
end
|
|
|
always @(pcreg_boot or pcreg_default or pcreg_select)
|
always @(pcreg_boot or pcreg_default or pcreg_select)
|