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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [or1200/] [rtl/] [verilog/] [or1200_except.v] - Diff between revs 151 and 185

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

Rev 151 Rev 185
Line 1... Line 1...
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
////                                                              ////
////                                                              ////
////  OR1200's Exception logic                                    ////
////  OR1200's Exception logic                                    ////
////                                                              ////
////                                                              ////
////  This file is part of the OpenRISC 1200 project              ////
////  This file is part of the OpenRISC 1200 project              ////
////  http://www.opencores.org/cores/or1k/                        ////
////  http://www.opencores.org/project,or1k                       ////
////                                                              ////
////                                                              ////
////  Description                                                 ////
////  Description                                                 ////
////  Handles all OR1K exceptions inside CPU block.               ////
////  Handles all OR1K exceptions inside CPU block.               ////
////                                                              ////
////                                                              ////
////  To Do:                                                      ////
////  To Do:                                                      ////
Line 39... Line 39...
//// Public License along with this source; if not, download it   ////
//// Public License along with this source; if not, download it   ////
//// from http://www.opencores.org/lgpl.shtml                     ////
//// from http://www.opencores.org/lgpl.shtml                     ////
////                                                              ////
////                                                              ////
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//
//
// CVS Revision History
 
// $Log: or1200_except.v,v $
// $Log: or1200_except.v,v $
//
//
// Revision 2.0  2010/06/30 11:00:00  ORSoC
// Revision 2.0  2010/06/30 11:00:00  ORSoC
// Major update: 
// Major update: 
// Structure reordered and bugs fixed. 
// Structure reordered and bugs fixed. 
//
 
// Revision 1.17  2004/06/08 18:17:36  lampret
 
// Non-functional changes. Coding style fixes.
 
//
 
// Revision 1.16  2004/04/05 08:29:57  lampret
 
// Merged branch_qmem into main tree.
 
//
 
// Revision 1.15.4.1  2004/02/11 01:40:11  lampret
 
// preliminary HW breakpoints support in debug unit (by default disabled). To enable define OR1200_DU_HWBKPTS.
 
//
 
// Revision 1.15  2003/04/20 22:23:57  lampret
 
// No functional change. Only added customization for exception vectors.
 
//
 
// Revision 1.14  2002/09/03 22:28:21  lampret
 
// As per Taylor Su suggestion all case blocks are full case by default and optionally (OR1200_CASE_DEFAULT) can be disabled to increase clock frequncy.
 
//
 
// Revision 1.13  2002/08/28 01:44:25  lampret
 
// Removed some commented RTL. Fixed SR/ESR flag bug.
 
//
 
// Revision 1.12  2002/08/22 02:16:45  lampret
 
// Fixed IMMU bug.
 
//
 
// Revision 1.11  2002/08/18 19:54:28  lampret
 
// Added store buffer.
 
//
 
// Revision 1.10  2002/07/14 22:17:17  lampret
 
// Added simple trace buffer [only for Xilinx Virtex target]. Fixed instruction fetch abort when new exception is recognized.
 
//
 
// Revision 1.9  2002/02/11 04:33:17  lampret
 
// Speed optimizations (removed duplicate _cyc_ and _stb_). Fixed D/IMMU cache-inhibit attr.
 
//
 
// Revision 1.8  2002/01/28 01:16:00  lampret
 
// Changed 'void' nop-ops instead of insn[0] to use insn[16]. Debug unit stalls the tick timer. Prepared new flag generation for add and and insns. Blocked DC/IC while they are turned off. Fixed I/D MMU SPRs layout except WAYs. TODO: smart IC invalidate, l.j 2 and TLB ways.
 
//
 
// Revision 1.7  2002/01/23 07:52:36  lampret
 
// Changed default reset values for SR and ESR to match or1ksim's. Fixed flop model in or1200_dpram_32x32 when OR1200_XILINX_RAM32X1D is defined.
 
//
 
// Revision 1.6  2002/01/18 14:21:43  lampret
 
// Fixed 'the NPC single-step fix'.
 
//
 
// Revision 1.5  2002/01/18 07:56:00  lampret
 
// No more low/high priority interrupts (PICPR removed). Added tick timer exception. Added exception prefix (SR[EPH]). Fixed single-step bug whenreading NPC.
 
//
 
// Revision 1.4  2002/01/14 21:11:50  lampret
 
// Changed alignment exception EPCR. Not tested yet.
 
//
 
// Revision 1.3  2002/01/14 19:09:57  lampret
 
// Fixed order of syscall and range exceptions.
 
//
 
// Revision 1.2  2002/01/14 06:18:22  lampret
 
// Fixed mem2reg bug in FAST implementation. Updated debug unit to work with new genpc/if.
 
//
 
// Revision 1.1  2002/01/03 08:16:15  lampret
 
// New prefixes for RTL files, prefixed module names. Updated cache controllers and MMUs.
 
//
 
// Revision 1.15  2001/11/27 23:13:11  lampret
 
// Fixed except_stop width and fixed EX PC for 1400444f no-ops.
 
//
 
// Revision 1.14  2001/11/23 08:38:51  lampret
 
// Changed DSR/DRR behavior and exception detection.
 
//
 
// Revision 1.13  2001/11/20 18:46:15  simons
 
// Break point bug fixed
 
//
 
// Revision 1.12  2001/11/18 09:58:28  lampret
 
// Fixed some l.trap typos.
 
//
 
// Revision 1.11  2001/11/18 08:36:28  lampret
 
// For GDB changed single stepping and disabled trap exception.
 
//
 
// Revision 1.10  2001/11/13 10:02:21  lampret
 
// Added 'setpc'. Renamed some signals (except_flushpipe into flushpipe etc)
 
//
 
// Revision 1.9  2001/11/10 03:43:57  lampret
 
// Fixed exceptions.
 
//
 
// Revision 1.8  2001/10/21 17:57:16  lampret
 
// Removed params from generic_XX.v. Added translate_off/on in sprs.v and id.v. Removed spr_addr from dc.v and ic.v. Fixed CR+LF.
 
//
 
// Revision 1.7  2001/10/14 13:12:09  lampret
 
// MP3 version.
 
//
 
// Revision 1.1.1.1  2001/10/06 10:18:36  igorm
 
// no message
 
//
 
// Revision 1.2  2001/08/09 13:39:33  lampret
 
// Major clean-up.
 
//
 
// Revision 1.1  2001/07/20 00:46:03  lampret
 
// Development version of RTL. Libraries are missing.
 
//
 
//
 
 
 
// synopsys translate_off
// synopsys translate_off
`include "timescale.v"
`include "timescale.v"
// synopsys translate_on
// synopsys translate_on
`include "or1200_defines.v"
`include "or1200_defines.v"
Line 155... Line 62...
 
 
//
//
// Exception recognition and sequencing
// Exception recognition and sequencing
//
//
 
 
module or1200_except(
module or1200_except
 
  (
        // Clock and reset
        // Clock and reset
        clk, rst,
        clk, rst,
 
 
        // Internal i/f
        // Internal i/f
        sig_ibuserr, sig_dbuserr, sig_illegal, sig_align, sig_range, sig_dtlbmiss, sig_dmmufault,
   sig_ibuserr, sig_dbuserr, sig_illegal, sig_align, sig_range, sig_dtlbmiss,
        sig_int, sig_syscall, sig_trap, sig_itlbmiss, sig_immufault, sig_tick,
   sig_dmmufault, sig_int, sig_syscall, sig_trap, sig_itlbmiss, sig_immufault,
        ex_branch_taken, genpc_freeze, id_freeze, ex_freeze, wb_freeze, if_stall,
   sig_tick, ex_branch_taken, genpc_freeze, id_freeze, ex_freeze, wb_freeze,
        if_pc, id_pc, ex_pc, wb_pc, id_flushpipe, ex_flushpipe, extend_flush, except_flushpipe, except_type, except_start,
   if_stall,  if_pc, id_pc, ex_pc, wb_pc, id_flushpipe, ex_flushpipe,
        except_started, except_stop, except_trig, ex_void, abort_mvspr, branch_op,
   extend_flush, except_flushpipe, except_type, except_start, except_started,
        spr_dat_ppc, spr_dat_npc, datain, du_dsr, epcr_we, eear_we, esr_we, pc_we, epcr, eear,
   except_stop, except_trig, ex_void, abort_mvspr, branch_op, spr_dat_ppc,
        du_dmr1, du_hwbkpt, du_hwbkpt_ls_r,
   spr_dat_npc, datain, du_dsr, epcr_we, eear_we, esr_we, pc_we, epcr, eear,
        esr, sr_we, to_sr, sr, lsu_addr, abort_ex, icpu_ack_i, icpu_err_i, dcpu_ack_i, dcpu_err_i
   du_dmr1, du_hwbkpt, du_hwbkpt_ls_r, esr, sr_we, to_sr, sr, lsu_addr,
 
   abort_ex, icpu_ack_i, icpu_err_i, dcpu_ack_i, dcpu_err_i, sig_fp, fpcsr_fpee
 
 
);
);
 
 
//
//
// I/O
// I/O
Line 190... Line 98...
input                           sig_syscall;
input                           sig_syscall;
input                           sig_trap;
input                           sig_trap;
input                           sig_itlbmiss;
input                           sig_itlbmiss;
input                           sig_immufault;
input                           sig_immufault;
input                           sig_tick;
input                           sig_tick;
 
input                           sig_fp;
 
input                           fpcsr_fpee;
input                           ex_branch_taken;
input                           ex_branch_taken;
input                           genpc_freeze;
input                           genpc_freeze;
input                           id_freeze;
input                           id_freeze;
input                           ex_freeze;
input                           ex_freeze;
input                           wb_freeze;
input                           wb_freeze;
Line 223... Line 133...
output                          except_flushpipe;
output                          except_flushpipe;
output                          extend_flush;
output                          extend_flush;
output  [`OR1200_EXCEPT_WIDTH-1:0]       except_type;
output  [`OR1200_EXCEPT_WIDTH-1:0]       except_type;
output                          except_start;
output                          except_start;
output                          except_started;
output                          except_started;
output  [12:0]           except_stop;
output  [13:0]           except_stop;
output  [12:0]           except_trig;
output  [13:0]           except_trig;
input                           ex_void;
input                           ex_void;
input   [`OR1200_BRANCHOP_WIDTH-1:0]    branch_op;
input   [`OR1200_BRANCHOP_WIDTH-1:0]    branch_op;
output  [31:0]                   spr_dat_ppc;
output  [31:0]                   spr_dat_ppc;
output  [31:0]                   spr_dat_npc;
output  [31:0]                   spr_dat_npc;
output                          abort_ex;
output                          abort_ex;
Line 262... Line 172...
wire                            except_started;
wire                            except_started;
reg     [2:0]                    delayed_iee;
reg     [2:0]                    delayed_iee;
reg     [2:0]                    delayed_tee;
reg     [2:0]                    delayed_tee;
wire                            int_pending;
wire                            int_pending;
wire                            tick_pending;
wire                            tick_pending;
 
wire                            fp_pending;
 
 
reg trace_trap      ;
reg trace_trap      ;
reg ex_freeze_prev;
reg ex_freeze_prev;
reg sr_ted_prev;
reg sr_ted_prev;
reg dsr_te_prev;
reg dsr_te_prev;
reg dmr1_st_prev    ;
reg dmr1_st_prev    ;
Line 277... Line 189...
 
 
//
//
// Simple combinatorial logic
// Simple combinatorial logic
//
//
assign except_started = extend_flush & except_start;
assign except_started = extend_flush & except_start;
 
 
assign except_start = (except_type != `OR1200_EXCEPT_NONE) & extend_flush;
assign except_start = (except_type != `OR1200_EXCEPT_NONE) & extend_flush;
assign int_pending = sig_int & (sr[`OR1200_SR_IEE] | (sr_we & to_sr[`OR1200_SR_IEE])) & id_pc_val & delayed_iee[2] & ~ex_freeze & ~ex_branch_taken & ~ex_dslot & ~(sr_we & ~to_sr[`OR1200_SR_IEE]);
 
assign tick_pending = sig_tick & (sr[`OR1200_SR_TEE] | (sr_we & to_sr[`OR1200_SR_TEE])) & id_pc_val  & delayed_tee[2] & ~ex_freeze & ~ex_branch_taken & ~ex_dslot & ~(sr_we & ~to_sr[`OR1200_SR_TEE]);
assign int_pending = sig_int & (sr[`OR1200_SR_IEE] |
assign abort_ex = sig_dbuserr | sig_dmmufault | sig_dtlbmiss | sig_align | sig_illegal | ((du_hwbkpt | trace_trap) & ex_pc_val & !sr_ted & !dsr_te);            // Abort write into RF by load & other instructions
                                (sr_we & to_sr[`OR1200_SR_IEE]))
assign abort_mvspr  = sig_illegal | ((du_hwbkpt | trace_trap) & ex_pc_val & !sr_ted & !dsr_te) ; // abort spr read/writes
                    & id_pc_val & delayed_iee[2] & ~ex_freeze & ~ex_branch_taken
 
                     & ~ex_dslot & ~(sr_we & ~to_sr[`OR1200_SR_IEE]);
 
 
 
assign tick_pending = sig_tick & (sr[`OR1200_SR_TEE] |
 
                                  (sr_we & to_sr[`OR1200_SR_TEE])) & id_pc_val
 
                      & delayed_tee[2] & ~ex_freeze & ~ex_branch_taken
 
                      & ~ex_dslot & ~(sr_we & ~to_sr[`OR1200_SR_TEE]);
 
 
 
assign fp_pending = sig_fp & fpcsr_fpee & ~ex_freeze & ~ex_branch_taken
 
                    & ~ex_dslot;
 
 
 
// Abort write into RF by load & other instructions   
 
assign abort_ex = sig_dbuserr | sig_dmmufault | sig_dtlbmiss | sig_align |
 
                  sig_illegal | ((du_hwbkpt | trace_trap) & ex_pc_val
 
                                 & !sr_ted & !dsr_te);
 
 
 
// abort spr read/writes   
 
assign abort_mvspr  = sig_illegal | ((du_hwbkpt | trace_trap) & ex_pc_val
 
                                     & !sr_ted & !dsr_te) ;
assign spr_dat_ppc = wb_pc;
assign spr_dat_ppc = wb_pc;
 
 
assign spr_dat_npc = ex_void ? id_pc : ex_pc;
assign spr_dat_npc = ex_void ? id_pc : ex_pc;
 
 
//
//
// Order defines exception detection priority
// Order defines exception detection priority
//
//
Line 300... Line 232...
                      sig_trap          & ~du_dsr[`OR1200_DU_DSR_TE],
                      sig_trap          & ~du_dsr[`OR1200_DU_DSR_TE],
                      sig_syscall               & ~du_dsr[`OR1200_DU_DSR_SCE] & ~ex_freeze,
                      sig_syscall               & ~du_dsr[`OR1200_DU_DSR_SCE] & ~ex_freeze,
                      sig_dmmufault             & ~du_dsr[`OR1200_DU_DSR_DPFE],
                      sig_dmmufault             & ~du_dsr[`OR1200_DU_DSR_DPFE],
                      sig_dbuserr               & ~du_dsr[`OR1200_DU_DSR_BUSEE],
                      sig_dbuserr               & ~du_dsr[`OR1200_DU_DSR_BUSEE],
                      sig_range         & ~du_dsr[`OR1200_DU_DSR_RE],
                      sig_range         & ~du_dsr[`OR1200_DU_DSR_RE],
 
                      fp_pending        & ~du_dsr[`OR1200_DU_DSR_FPE],
                      int_pending               & ~du_dsr[`OR1200_DU_DSR_IE],
                      int_pending               & ~du_dsr[`OR1200_DU_DSR_IE],
                      tick_pending              & ~du_dsr[`OR1200_DU_DSR_TTE]
                      tick_pending              & ~du_dsr[`OR1200_DU_DSR_TTE]
                      };
                      };
 
 
wire    trace_cond  = !ex_freeze && !ex_void && (1'b0
wire    trace_cond  = !ex_freeze && !ex_void && (1'b0
`ifdef OR1200_DU_DMR1_ST
`ifdef OR1200_DU_DMR1_ST
    ||  dmr1_st
    ||  dmr1_st
`endif
`endif
`ifdef OR1200_DU_DMR1_BT
`ifdef OR1200_DU_DMR1_BT
Line 325... Line 259...
                        sig_dtlbmiss            & du_dsr[`OR1200_DU_DSR_DME],
                        sig_dtlbmiss            & du_dsr[`OR1200_DU_DSR_DME],
                        sig_dmmufault           & du_dsr[`OR1200_DU_DSR_DPFE],
                        sig_dmmufault           & du_dsr[`OR1200_DU_DSR_DPFE],
                        sig_dbuserr             & du_dsr[`OR1200_DU_DSR_BUSEE],
                        sig_dbuserr             & du_dsr[`OR1200_DU_DSR_BUSEE],
                        sig_range               & du_dsr[`OR1200_DU_DSR_RE],
                        sig_range               & du_dsr[`OR1200_DU_DSR_RE],
                        sig_trap                & du_dsr[`OR1200_DU_DSR_TE],
                        sig_trap                & du_dsr[`OR1200_DU_DSR_TE],
 
                        fp_pending              & du_dsr[`OR1200_DU_DSR_FPE],
                        sig_syscall             & du_dsr[`OR1200_DU_DSR_SCE] & ~ex_freeze
                        sig_syscall             & du_dsr[`OR1200_DU_DSR_SCE] & ~ex_freeze
                };
                };
 
 
always @(posedge clk or posedge rst) begin
always @(posedge clk or posedge rst) begin
        if (rst) begin
        if (rst) begin
Line 495... Line 430...
                                        state <= #1 `OR1200_EXCEPTFSM_FLU1;
                                        state <= #1 `OR1200_EXCEPTFSM_FLU1;
                                        extend_flush <= #1 1'b1;
                                        extend_flush <= #1 1'b1;
                                        esr <= #1 sr_we ? to_sr : sr;
                                        esr <= #1 sr_we ? to_sr : sr;
                                        casex (except_trig)
                                        casex (except_trig)
`ifdef OR1200_EXCEPT_ITLBMISS
`ifdef OR1200_EXCEPT_ITLBMISS
                                                13'b1_xxxx_xxxx_xxxx: begin
                    14'b1x_xxxx_xxxx_xxxx: begin
                                                        except_type <= #1 `OR1200_EXCEPT_ITLBMISS;
                                                        except_type <= #1 `OR1200_EXCEPT_ITLBMISS;
                                                        eear <= #1 ex_dslot ? ex_pc : ex_pc;
                       eear <= #1 ex_dslot ?
                                                        epcr <= #1 ex_dslot ? wb_pc : ex_pc;
                               ex_pc : ex_pc;
 
                       epcr <= #1 ex_dslot ?
 
                               wb_pc : ex_pc;
                                                end
                                                end
`endif
`endif
`ifdef OR1200_EXCEPT_IPF
`ifdef OR1200_EXCEPT_IPF
                                                13'b0_1xxx_xxxx_xxxx: begin
                    14'b01_xxxx_xxxx_xxxx: begin
                                                        except_type <= #1 `OR1200_EXCEPT_IPF;
                                                        except_type <= #1 `OR1200_EXCEPT_IPF;
                                                        eear <= #1 ex_dslot ? ex_pc : delayed1_ex_dslot ? id_pc : delayed2_ex_dslot ? id_pc : id_pc;
                       eear <= #1 ex_dslot ?
                                                        epcr <= #1 ex_dslot ? wb_pc : delayed1_ex_dslot ? id_pc : delayed2_ex_dslot ? id_pc : id_pc;
                               ex_pc : delayed1_ex_dslot ?
 
                               id_pc : delayed2_ex_dslot ?
 
                               id_pc : id_pc;
 
                       epcr <= #1 ex_dslot ?
 
                               wb_pc : delayed1_ex_dslot ?
 
                               id_pc : delayed2_ex_dslot ?
 
                               id_pc : id_pc;
                                                end
                                                end
`endif
`endif
`ifdef OR1200_EXCEPT_BUSERR
`ifdef OR1200_EXCEPT_BUSERR
                                                13'b0_01xx_xxxx_xxxx: begin
                    14'b00_1xxx_xxxx_xxxx: begin        // Insn. Bus Error
                                                        except_type <= #1 `OR1200_EXCEPT_BUSERR;
                                                        except_type <= #1 `OR1200_EXCEPT_BUSERR;
                                                        eear <= #1 ex_dslot ? wb_pc : ex_pc;
                       eear <= #1 ex_dslot ?
                                                        epcr <= #1 ex_dslot ? wb_pc : ex_pc;
                               wb_pc : ex_pc;
 
                       epcr <= #1 ex_dslot ?
 
                               wb_pc : ex_pc;
                                                end
                                                end
`endif
`endif
`ifdef OR1200_EXCEPT_ILLEGAL
`ifdef OR1200_EXCEPT_ILLEGAL
                                                13'b0_001x_xxxx_xxxx: begin
                    14'b00_01xx_xxxx_xxxx: begin
                                                        except_type <= #1 `OR1200_EXCEPT_ILLEGAL;
                                                        except_type <= #1 `OR1200_EXCEPT_ILLEGAL;
                                                        eear <= #1 ex_pc;
                                                        eear <= #1 ex_pc;
                                                        epcr <= #1 ex_dslot ? wb_pc : ex_pc;
                       epcr <= #1 ex_dslot ?
 
                               wb_pc : ex_pc;
                                                end
                                                end
`endif
`endif
`ifdef OR1200_EXCEPT_ALIGN
`ifdef OR1200_EXCEPT_ALIGN
                                                13'b0_0001_xxxx_xxxx: begin
                    14'b00_001x_xxxx_xxxx: begin
                                                        except_type <= #1 `OR1200_EXCEPT_ALIGN;
                                                        except_type <= #1 `OR1200_EXCEPT_ALIGN;
                                                        eear <= #1 lsu_addr;
                                                        eear <= #1 lsu_addr;
                                                        epcr <= #1 ex_dslot ? wb_pc : ex_pc;
                       epcr <= #1 ex_dslot ?
 
                               wb_pc : ex_pc;
                                                end
                                                end
`endif
`endif
`ifdef OR1200_EXCEPT_DTLBMISS
`ifdef OR1200_EXCEPT_DTLBMISS
                                                13'b0_0000_1xxx_xxxx: begin
                    14'b00_0001_xxxx_xxxx: begin
                                                        except_type <= #1 `OR1200_EXCEPT_DTLBMISS;
                                                        except_type <= #1 `OR1200_EXCEPT_DTLBMISS;
                                                        eear <= #1 lsu_addr;
                                                        eear <= #1 lsu_addr;
                                                        epcr <= #1 ex_dslot ? wb_pc : delayed1_ex_dslot ? dl_pc : ex_pc;
                       epcr <= #1 ex_dslot ?
 
                               wb_pc : delayed1_ex_dslot ?
 
                               dl_pc : ex_pc;
                                                end
                                                end
`endif
`endif
`ifdef OR1200_EXCEPT_TRAP                       13'b0_0000_01xx_xxxx: begin
`ifdef OR1200_EXCEPT_TRAP
 
                    14'b00_0000_1xxx_xxxx: begin
                                                        except_type <= #1 `OR1200_EXCEPT_TRAP;
                                                        except_type <= #1 `OR1200_EXCEPT_TRAP;
                                                        epcr <= #1 ex_dslot ? wb_pc : delayed1_ex_dslot ? id_pc : ex_pc;
                       epcr <= #1 ex_dslot ?
 
                               wb_pc : delayed1_ex_dslot ?
 
                               id_pc : ex_pc;
                                                end
                                                end
`endif
`endif
`ifdef OR1200_EXCEPT_SYSCALL
`ifdef OR1200_EXCEPT_SYSCALL
                                                13'b0_0000_001x_xxxx: begin
                    14'b00_0000_01xx_xxxx: begin
                                                        except_type <= #1 `OR1200_EXCEPT_SYSCALL;
                                                        except_type <= #1 `OR1200_EXCEPT_SYSCALL;
                                                        epcr <= #1 ex_dslot ? wb_pc : delayed1_ex_dslot ? id_pc : delayed2_ex_dslot ? id_pc : id_pc;
                       epcr <= #1 ex_dslot ?
 
                               wb_pc : delayed1_ex_dslot ?
 
                               id_pc : delayed2_ex_dslot ?
 
                               id_pc : id_pc;
                                                end
                                                end
`endif
`endif
`ifdef OR1200_EXCEPT_DPF
`ifdef OR1200_EXCEPT_DPF
                                                13'b0_0000_0001_xxxx: begin
                    14'b00_0000_001x_xxxx: begin
                                                        except_type <= #1 `OR1200_EXCEPT_DPF;
                                                        except_type <= #1 `OR1200_EXCEPT_DPF;
                                                        eear <= #1 lsu_addr;
                                                        eear <= #1 lsu_addr;
                                                        epcr <= #1 ex_dslot ? wb_pc : delayed1_ex_dslot ? dl_pc : ex_pc;
                       epcr <= #1 ex_dslot ?
 
                               wb_pc : delayed1_ex_dslot ?
 
                               dl_pc : ex_pc;
                                                end
                                                end
`endif
`endif
`ifdef OR1200_EXCEPT_BUSERR
`ifdef OR1200_EXCEPT_BUSERR
                                                13'b0_0000_0000_1xxx: begin     // Data Bus Error
                    14'b00_0000_0001_xxxx: begin        // Data Bus Error
                                                        except_type <= #1 `OR1200_EXCEPT_BUSERR;
                                                        except_type <= #1 `OR1200_EXCEPT_BUSERR;
                                                        eear <= #1 lsu_addr;
                                                        eear <= #1 lsu_addr;
                                                        epcr <= #1 ex_dslot ? wb_pc : delayed1_ex_dslot ? dl_pc : ex_pc;
                       epcr <= #1 ex_dslot ?
 
                               wb_pc : delayed1_ex_dslot ?
 
                               dl_pc : ex_pc;
                                                end
                                                end
`endif
`endif
`ifdef OR1200_EXCEPT_RANGE
`ifdef OR1200_EXCEPT_RANGE
                                                13'b0_0000_0000_01xx: begin
                    14'b00_0000_0000_1xxx: begin
                                                        except_type <= #1 `OR1200_EXCEPT_RANGE;
                                                        except_type <= #1 `OR1200_EXCEPT_RANGE;
                                                        epcr <= #1 ex_dslot ? wb_pc : delayed1_ex_dslot ? id_pc : delayed2_ex_dslot ? id_pc : id_pc;
                       epcr <= #1 ex_dslot ?
 
                               wb_pc : delayed1_ex_dslot ?
 
                               id_pc : delayed2_ex_dslot ?
 
                               id_pc : id_pc;
 
                    end
 
`endif
 
`ifdef OR1200_EXCEPT_FLOAT
 
                    14'b00_0000_0000_01xx: begin
 
                       except_type <= #1 `OR1200_EXCEPT_FLOAT;
 
                       epcr <= #1 id_pc;
                                                end
                                                end
`endif
`endif
`ifdef OR1200_EXCEPT_INT
`ifdef OR1200_EXCEPT_INT
                                                13'b0_0000_0000_001x: begin
                    14'b00_0000_0000_001x: begin
                                                        except_type <= #1 `OR1200_EXCEPT_INT;
                                                        except_type <= #1 `OR1200_EXCEPT_INT;
                                                        epcr <= #1 id_pc;
                                                        epcr <= #1 id_pc;
                                                        //epcr <= #1 ex_dslot ? wb_pc : delayed1_ex_dslot ? id_pc : delayed2_ex_dslot ? id_pc : id_pc;
 
                                                end
                                                end
`endif
`endif
`ifdef OR1200_EXCEPT_TICK
`ifdef OR1200_EXCEPT_TICK
                                                13'b0_0000_0000_0001: begin
                    14'b00_0000_0000_0001: begin
                                                        except_type <= #1 `OR1200_EXCEPT_TICK;
                                                        except_type <= #1 `OR1200_EXCEPT_TICK;
                                                        epcr <= #1 id_pc;
                                                        epcr <= #1 id_pc;
                                                        //epcr <= #1 ex_dslot ? wb_pc : delayed1_ex_dslot ? id_pc : delayed2_ex_dslot ? id_pc : id_pc;
 
                                                end
                                                end
`endif
`endif
 
 
                                                default:
                                                default:
                                                        except_type <= #1 `OR1200_EXCEPT_NONE;
                                                        except_type <= #1 `OR1200_EXCEPT_NONE;
                                        endcase
                                        endcase
                                end
                                end
                                else if (pc_we) begin
                                else if (pc_we) begin

powered by: WebSVN 2.1.0

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