📄 or1200_sprs.v
字号:
////////////////////////////////////////////////////////////////////////// //////// OR1200's interface to SPRs //////// //////// This file is part of the OpenRISC 1200 project //////// http://www.opencores.org/cores/or1k/ //////// //////// Description //////// Decoding of SPR addresses and access to SPRs //////// //////// To Do: //////// - make it smaller and faster //////// //////// Author(s): //////// - Damjan Lampret, lampret@opencores.org //////// ////////////////////////////////////////////////////////////////////////////// //////// Copyright (C) 2000 Authors and OPENCORES.ORG //////// //////// This source file may be used and distributed without //////// restriction provided that this copyright statement is not //////// removed from the file and that any derivative work contains //////// the original copyright notice and the associated disclaimer. //////// //////// 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 by the Free Software Foundation; //////// either version 2.1 of the License, or (at your option) any //////// later version. //////// //////// This source is distributed in the hope that it will be //////// useful, but WITHOUT ANY WARRANTY; without even the implied //////// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR //////// PURPOSE. See the GNU Lesser General Public License for more //////// details. //////// //////// You should have received a copy of the GNU Lesser General //////// Public License along with this source; if not, download it //////// from http://www.opencores.org/lgpl.shtml //////// ////////////////////////////////////////////////////////////////////////////// CVS Revision History//// $Log: or1200_sprs.v,v $// Revision 1.11 2004/04/05 08:29:57 lampret// Merged branch_qmem into main tree.//// Revision 1.9.4.1 2003/12/17 13:43:38 simons// Exception prefix configuration changed.//// Revision 1.9 2002/09/07 05:42:02 lampret// Added optional SR[CY]. Added define to enable additional (compare) flag modifiers. Defines are OR1200_IMPL_ADDC and OR1200_ADDITIONAL_FLAG_MODIFIERS.//// Revision 1.8 2002/08/28 01:44:25 lampret// Removed some commented RTL. Fixed SR/ESR flag bug.//// 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// 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// Fixed combinational loops.//// Revision 1.4 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.3 2002/01/19 09:27:49 lampret// SR[TEE] should be zero after reset.//// Revision 1.2 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.1 2002/01/03 08:16:15 lampret// New prefixes for RTL files, prefixed module names. Updated cache controllers and MMUs.//// Revision 1.12 2001/11/23 21:42:31 simons// Program counter divided to PPC and NPC.//// Revision 1.11 2001/11/23 08:38:51 lampret// Changed DSR/DRR behavior and exception detection.//// Revision 1.10 2001/11/12 01:45:41 lampret// Moved flag bit into SR. Changed RF enable from constant enable to dynamic enable for read ports.//// Revision 1.9 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.8 2001/10/14 13:12:10 lampret// MP3 version.//// Revision 1.1.1.1 2001/10/06 10:18:36 igorm// no message//// Revision 1.3 2001/08/13 03:36:20 lampret// Added cfg regs. Moved all defines into one defines.v file. More cleanup.//// Revision 1.2 2001/08/09 13:39:33 lampret// Major clean-up.//// Revision 1.1 2001/07/20 00:46:21 lampret// Development version of RTL. Libraries are missing.////// synopsys translate_off`include "timescale.v"// synopsys translate_on`include "or1200_defines.v"module or1200_sprs( // Clk & Rst clk, rst, // Internal CPU interface flagforw, flag_we, flag, cyforw, cy_we, carry, addrbase, addrofs, dat_i, alu_op, branch_op, epcr, eear, esr, except_started, 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, // From/to other RISC units spr_dat_pic, spr_dat_tt, spr_dat_pm, spr_dat_dmmu, spr_dat_immu, spr_dat_du, spr_addr, spr_dat_o, spr_cs, spr_we, du_addr, du_dat_du, du_read, du_write, du_dat_cpu);parameter width = `OR1200_OPERAND_WIDTH;//// I/O Ports////// Internal CPU interface//input clk; // Clockinput rst; // Resetinput flagforw; // From ALUinput flag_we; // From ALUoutput flag; // SR[F]input cyforw; // From ALUinput cy_we; // From ALUoutput carry; // SR[CY]input [width-1:0] addrbase; // SPR base addressinput [15:0] addrofs; // SPR offsetinput [width-1:0] dat_i; // SPR write datainput [`OR1200_ALUOP_WIDTH-1:0] alu_op; // ALU operationinput [`OR1200_BRANCHOP_WIDTH-1:0] branch_op; // Branch operationinput [width-1:0] epcr; // EPCR0input [width-1:0] eear; // EEAR0input [`OR1200_SR_WIDTH-1:0] esr; // ESR0input except_started; // Exception was startedoutput [width-1:0] to_wbmux; // For l.mfsproutput epcr_we; // EPCR0 write enableoutput eear_we; // EEAR0 write enableoutput esr_we; // ESR0 write enableoutput pc_we; // PC write enableoutput sr_we; // Write enable SRoutput [`OR1200_SR_WIDTH-1:0] to_sr; // Data to SRoutput [`OR1200_SR_WIDTH-1:0] sr; // SRinput [31:0] spr_dat_cfgr; // Data from CFGRinput [31:0] spr_dat_rf; // Data from RFinput [31:0] spr_dat_npc; // Data from NPCinput [31:0] spr_dat_ppc; // Data from PPC input [31:0] spr_dat_mac; // Data from MAC//// To/from other RISC units//input [31:0] spr_dat_pic; // Data from PICinput [31:0] spr_dat_tt; // Data from TTinput [31:0] spr_dat_pm; // Data from PMinput [31:0] spr_dat_dmmu; // Data from DMMUinput [31:0] spr_dat_immu; // Data from IMMUinput [31:0] spr_dat_du; // Data from DUoutput [31:0] spr_addr; // SPR Addressoutput [31:0] spr_dat_o; // Data to unitoutput [31:0] spr_cs; // Unit selectoutput spr_we; // SPR write enable//// To/from Debug Unit//input [width-1:0] du_addr; // Addressinput [width-1:0] du_dat_du; // Data from DU to SPRSinput du_read; // Read qualifierinput du_write; // Write qualifieroutput [width-1:0] du_dat_cpu; // Data from SPRS to DU//// Internal regs & wires//reg [`OR1200_SR_WIDTH-1:0] sr; // SRreg write_spr; // Write SPRreg read_spr; // Read SPRreg [width-1:0] to_wbmux; // For l.mfsprwire cfgr_sel; // Select for cfg regswire rf_sel; // Select for RFwire npc_sel; // Select for NPCwire ppc_sel; // Select for PPCwire sr_sel; // Select for SR wire epcr_sel; // Select for EPCR0wire eear_sel; // Select for EEAR0wire esr_sel; // Select for ESR0wire [31:0] sys_data; // Read data from system SPRs
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -