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

Subversion Repositories or1k

[/] [or1k/] [tags/] [rel_26/] [or1200/] [rtl/] [verilog/] [or1200_sprs.v] - Diff between revs 788 and 1011

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

Rev 788 Rev 1011
Line 42... Line 42...
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//
//
// CVS Revision History
// CVS Revision History
//
//
// $Log: not supported by cvs2svn $
// $Log: not supported by cvs2svn $
 
// Revision 1.7  2002/03/29 15:16:56  lampret
 
// Some of the warnings fixed.
 
//
// Revision 1.6  2002/03/11 01:26:57  lampret
// Revision 1.6  2002/03/11 01:26:57  lampret
// Changed generation of SPR address. Now it is ORed from base and offset instead of a sum.
// Changed generation of SPR address. Now it is ORed from base and offset instead of a sum.
//
//
// Revision 1.5  2002/02/01 19:56:54  lampret
// Revision 1.5  2002/02/01 19:56:54  lampret
// Fixed combinational loops.
// Fixed combinational loops.
Line 101... Line 104...
                clk, rst,
                clk, rst,
 
 
                // Internal CPU interface
                // Internal CPU interface
                flagforw, flag_we, flag, addrbase, addrofs, dat_i, alu_op, branch_op,
                flagforw, flag_we, flag, addrbase, addrofs, dat_i, alu_op, branch_op,
                epcr, eear, esr, except_started,
                epcr, eear, esr, except_started,
                to_wbmux, epcr_we, eear_we, esr_we, pc_we, sr,
                to_wbmux, epcr_we, eear_we, esr_we, pc_we, sr_we, to_sr, sr,
                spr_dat_cfgr, spr_dat_rf, spr_dat_npc, spr_dat_ppc, spr_dat_mac,
                spr_dat_cfgr, spr_dat_rf, spr_dat_npc, spr_dat_ppc, spr_dat_mac,
 
 
                // From/to other RISC units
                // From/to other RISC units
                spr_dat_pic, spr_dat_tt, spr_dat_pm,
                spr_dat_pic, spr_dat_tt, spr_dat_pm,
                spr_dat_dmmu, spr_dat_immu, spr_dat_du,
                spr_dat_dmmu, spr_dat_immu, spr_dat_du,
Line 142... Line 145...
output  [width-1:0]              to_wbmux;       // For l.mfspr
output  [width-1:0]              to_wbmux;       // For l.mfspr
output                          epcr_we;        // EPCR0 write enable
output                          epcr_we;        // EPCR0 write enable
output                          eear_we;        // EEAR0 write enable
output                          eear_we;        // EEAR0 write enable
output                          esr_we;         // ESR0 write enable
output                          esr_we;         // ESR0 write enable
output                          pc_we;          // PC write enable
output                          pc_we;          // PC write enable
 
output                          sr_we;          // Write enable SR
 
output  [`OR1200_SR_WIDTH-1:0]   to_sr;          // Data to SR
output  [`OR1200_SR_WIDTH-1:0]           sr;             // SR
output  [`OR1200_SR_WIDTH-1:0]           sr;             // SR
input   [31:0]                   spr_dat_cfgr;   // Data from CFGR
input   [31:0]                   spr_dat_cfgr;   // Data from CFGR
input   [31:0]                   spr_dat_rf;     // Data from RF
input   [31:0]                   spr_dat_rf;     // Data from RF
input   [31:0]                   spr_dat_npc;    // Data from NPC
input   [31:0]                   spr_dat_npc;    // Data from NPC
input   [31:0]                   spr_dat_ppc;    // Data from PPC   
input   [31:0]                   spr_dat_ppc;    // Data from PPC   
Line 179... Line 184...
//
//
reg     [`OR1200_SR_WIDTH-1:0]           sr;             // SR
reg     [`OR1200_SR_WIDTH-1:0]           sr;             // SR
reg                             write_spr;      // Write SPR
reg                             write_spr;      // Write SPR
reg                             read_spr;       // Read SPR
reg                             read_spr;       // Read SPR
reg     [width-1:0]              to_wbmux;       // For l.mfspr
reg     [width-1:0]              to_wbmux;       // For l.mfspr
wire                            sr_we;          // Write enable SR
 
wire                            cfgr_sel;       // Select for cfg regs
wire                            cfgr_sel;       // Select for cfg regs
wire                            rf_sel;         // Select for RF
wire                            rf_sel;         // Select for RF
wire                            npc_sel;        // Select for NPC
wire                            npc_sel;        // Select for NPC
wire                            ppc_sel;        // Select for PPC
wire                            ppc_sel;        // Select for PPC
wire                            sr_sel;         // Select for SR        
wire                            sr_sel;         // Select for SR        
wire                            epcr_sel;       // Select for EPCR0
wire                            epcr_sel;       // Select for EPCR0
wire                            eear_sel;       // Select for EEAR0
wire                            eear_sel;       // Select for EEAR0
wire                            esr_sel;        // Select for ESR0
wire                            esr_sel;        // Select for ESR0
wire    [31:0]                   sys_data;       // Read data from system SPRs
wire    [31:0]                   sys_data;       // Read data from system SPRs
wire    [`OR1200_SR_WIDTH-1:0]           to_sr;          // Data to SR
 
wire                            du_access;      // Debug unit access
wire                            du_access;      // Debug unit access
wire    [`OR1200_ALUOP_WIDTH-1:0]        sprs_op;        // ALU operation
wire    [`OR1200_ALUOP_WIDTH-1:0]        sprs_op;        // ALU operation
reg     [31:0]                   unqualified_cs; // Unqualified chip selects
reg     [31:0]                   unqualified_cs; // Unqualified chip selects
 
 
//
//
Line 279... Line 282...
//
//
 
 
//
//
// What to write into SR
// What to write into SR
//
//
assign to_sr = (branch_op == `OR1200_BRANCHOP_RFE) ? esr : {1'b1, spr_dat_o[`OR1200_SR_WIDTH-2:0]};
assign to_sr = (branch_op == `OR1200_BRANCHOP_RFE) ? esr :
 
                flag_we ? {sr[`OR1200_SR_FO:`OR1200_SR_CY], flagforw, sr[`OR1200_SR_CE:`OR1200_SR_SM]} : {1'b1, spr_dat_o[`OR1200_SR_WIDTH-2:0]};
 
 
//
//
// Selects for system SPRs
// Selects for system SPRs
//
//
assign cfgr_sel = (spr_cs[`OR1200_SPR_GROUP_SYS] && (spr_addr[10:4] == `OR1200_SPR_CFGR));
assign cfgr_sel = (spr_cs[`OR1200_SPR_GROUP_SYS] && (spr_addr[10:4] == `OR1200_SPR_CFGR));
Line 296... Line 300...
assign esr_sel = (spr_cs[`OR1200_SPR_GROUP_SYS] && (spr_addr[10:0] == `OR1200_SPR_ESR));
assign esr_sel = (spr_cs[`OR1200_SPR_GROUP_SYS] && (spr_addr[10:0] == `OR1200_SPR_ESR));
 
 
//
//
// Write enables for system SPRs
// Write enables for system SPRs
//
//
assign sr_we = (write_spr && sr_sel) | (branch_op == `OR1200_BRANCHOP_RFE);
assign sr_we = (write_spr && sr_sel) | (branch_op == `OR1200_BRANCHOP_RFE) | flag_we;
assign pc_we = (write_spr && (npc_sel | ppc_sel));
assign pc_we = (write_spr && (npc_sel | ppc_sel));
assign epcr_we = (write_spr && epcr_sel);
assign epcr_we = (write_spr && epcr_sel);
assign eear_we = (write_spr && eear_sel);
assign eear_we = (write_spr && eear_sel);
assign esr_we = (write_spr && esr_sel);
assign esr_we = (write_spr && esr_sel);
 
 
Line 334... Line 338...
                sr[`OR1200_SR_DME] <= #1 1'b0;
                sr[`OR1200_SR_DME] <= #1 1'b0;
                sr[`OR1200_SR_IME] <= #1 1'b0;
                sr[`OR1200_SR_IME] <= #1 1'b0;
        end
        end
        else if (sr_we)
        else if (sr_we)
                sr <= #1 to_sr[`OR1200_SR_WIDTH-1:0];
                sr <= #1 to_sr[`OR1200_SR_WIDTH-1:0];
        else if (flag_we)
 
                sr[`OR1200_SR_F] <= #1 flagforw;
 
 
 
//
//
// MTSPR/MFSPR interface
// MTSPR/MFSPR interface
//
//
always @(sprs_op or spr_addr or sys_data or spr_dat_mac or spr_dat_pic or spr_dat_pm or
always @(sprs_op or spr_addr or sys_data or spr_dat_mac or spr_dat_pic or spr_dat_pm or

powered by: WebSVN 2.1.0

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