⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 or1200_defines.v

📁 LEON(sparc)微处理器的源代码
💻 V
📖 第 1 页 / 共 4 页
字号:
////`define OR1200_WB_B3//// Enable additional synthesis directives if using// _Synopsys_ synthesis tool////`define OR1200_ADDITIONAL_SYNOPSYS_DIRECTIVES//// Enables default statement in some case blocks// and disables Synopsys synthesis directive full_case//// By default it is enabled. When disabled it// can increase clock frequency.//`define OR1200_CASE_DEFAULT//// Operand width / register file address width//// (DO NOT CHANGE)//`define OR1200_OPERAND_WIDTH		32`define OR1200_REGFILE_ADDR_WIDTH	5//// l.add/l.addi/l.and and optional l.addc/l.addic// also set (compare) flag when result of their// operation equals zero//// At the time of writing this, default or32// C/C++ compiler doesn't generate code that// would benefit from this optimization.//// By default this optimization is disabled to// save area.////`define OR1200_ADDITIONAL_FLAG_MODIFIERS//// Implement l.addc/l.addic instructions//// By default implementation of l.addc/l.addic// instructions is enabled in case you need them.// If you don't use them, then disable implementation// to save area.//`define OR1200_IMPL_ADDC//// Implement carry bit SR[CY]//// By default implementation of SR[CY] is enabled// to be compliant with the simulator. However// SR[CY] is explicitly only used by l.addc/l.addic// instructions and if these two insns are not// implemented there is not much point having SR[CY].//`define OR1200_IMPL_CY//// Implement optional l.div/l.divu instructions//// By default divide instructions are not implemented// to save area and increase clock frequency. or32 C/C++// compiler can use soft library for division.//// To implement divide, multiplier needs to be implemented.////`define OR1200_IMPL_DIV//// Implement rotate in the ALU//// At the time of writing this, or32// C/C++ compiler doesn't generate rotate// instructions. However or32 assembler// can assemble code that uses rotate insn.// This means that rotate instructions// must be used manually inserted.//// By default implementation of rotate// is disabled to save area and increase// clock frequency.////`define OR1200_IMPL_ALU_ROTATE//// Type of ALU compare to implement//// Try either one to find what yields// higher clock frequencyin your case.////`define OR1200_IMPL_ALU_COMP1`define OR1200_IMPL_ALU_COMP2//// Implement multiplier//// By default multiplier is implemented//`define OR1200_MULT_IMPLEMENTED//// Implement multiply-and-accumulate//// By default MAC is implemented. To// implement MAC, multiplier needs to be// implemented.//`define OR1200_MAC_IMPLEMENTED//// Low power, slower multiplier//// Select between low-power (larger) multiplier// and faster multiplier. The actual difference// is only AND logic that prevents distribution// of operands into the multiplier when instruction// in execution is not multiply instruction////`define OR1200_LOWPWR_MULT//// Clock ratio RISC clock versus WB clock//// If you plan to run WB:RISC clock fixed to 1:1, disable// both defines//// For WB:RISC 1:2 or 1:1, enable OR1200_CLKDIV_2_SUPPORTED// and use clmode to set ratio//// For WB:RISC 1:4, 1:2 or 1:1, enable both defines and use// clmode to set ratio//`define OR1200_CLKDIV_2_SUPPORTED//`define OR1200_CLKDIV_4_SUPPORTED//// Type of register file RAM//// Memory macro w/ two ports (see or1200_tpram_32x32.v)//`define OR1200_RFRAM_TWOPORT//// Memory macro dual port (see or1200_dpram_32x32.v)//`define OR1200_RFRAM_DUALPORT//// Generic (flip-flop based) register file (see or1200_rfram_generic.v)`define OR1200_RFRAM_GENERIC//// Type of mem2reg aligner to implement.//// Once OR1200_IMPL_MEM2REG2 yielded faster// circuit, however with today tools it will// most probably give you slower circuit.//`define OR1200_IMPL_MEM2REG1//`define OR1200_IMPL_MEM2REG2//// ALUOPs//`define OR1200_ALUOP_WIDTH	4`define OR1200_ALUOP_NOP	4'd4/* Order defined by arith insns that have two source operands both in regs   (see binutils/include/opcode/or32.h) */`define OR1200_ALUOP_ADD	4'd0`define OR1200_ALUOP_ADDC	4'd1`define OR1200_ALUOP_SUB	4'd2`define OR1200_ALUOP_AND	4'd3`define OR1200_ALUOP_OR		4'd4`define OR1200_ALUOP_XOR	4'd5`define OR1200_ALUOP_MUL	4'd6`define OR1200_ALUOP_CUST5	4'd7`define OR1200_ALUOP_SHROT	4'd8`define OR1200_ALUOP_DIV	4'd9`define OR1200_ALUOP_DIVU	4'd10/* Order not specifically defined. */`define OR1200_ALUOP_IMM	4'd11`define OR1200_ALUOP_MOVHI	4'd12`define OR1200_ALUOP_COMP	4'd13`define OR1200_ALUOP_MTSR	4'd14`define OR1200_ALUOP_MFSR	4'd15`define OR1200_ALUOP_CMOV 4'd14`define OR1200_ALUOP_FF1  4'd15//// MACOPs//`define OR1200_MACOP_WIDTH	2`define OR1200_MACOP_NOP	2'b00`define OR1200_MACOP_MAC	2'b01`define OR1200_MACOP_MSB	2'b10//// Shift/rotate ops//`define OR1200_SHROTOP_WIDTH	2`define OR1200_SHROTOP_NOP	2'd0`define OR1200_SHROTOP_SLL	2'd0`define OR1200_SHROTOP_SRL	2'd1`define OR1200_SHROTOP_SRA	2'd2`define OR1200_SHROTOP_ROR	2'd3// Execution cycles per instruction`define OR1200_MULTICYCLE_WIDTH	2`define OR1200_ONE_CYCLE		2'd0`define OR1200_TWO_CYCLES		2'd1// Operand MUX selects`define OR1200_SEL_WIDTH		2`define OR1200_SEL_RF			2'd0`define OR1200_SEL_IMM			2'd1`define OR1200_SEL_EX_FORW		2'd2`define OR1200_SEL_WB_FORW		2'd3//// BRANCHOPs//`define OR1200_BRANCHOP_WIDTH		3`define OR1200_BRANCHOP_NOP		3'd0`define OR1200_BRANCHOP_J		3'd1`define OR1200_BRANCHOP_JR		3'd2`define OR1200_BRANCHOP_BAL		3'd3`define OR1200_BRANCHOP_BF		3'd4`define OR1200_BRANCHOP_BNF		3'd5`define OR1200_BRANCHOP_RFE		3'd6//// LSUOPs//// Bit 0: sign extend// Bits 1-2: 00 doubleword, 01 byte, 10 halfword, 11 singleword// Bit 3: 0 load, 1 store`define OR1200_LSUOP_WIDTH		4`define OR1200_LSUOP_NOP		4'b0000`define OR1200_LSUOP_LBZ		4'b0010`define OR1200_LSUOP_LBS		4'b0011`define OR1200_LSUOP_LHZ		4'b0100`define OR1200_LSUOP_LHS		4'b0101`define OR1200_LSUOP_LWZ		4'b0110`define OR1200_LSUOP_LWS		4'b0111`define OR1200_LSUOP_LD		4'b0001`define OR1200_LSUOP_SD		4'b1000`define OR1200_LSUOP_SB		4'b1010`define OR1200_LSUOP_SH		4'b1100`define OR1200_LSUOP_SW		4'b1110// FETCHOPs`define OR1200_FETCHOP_WIDTH		1`define OR1200_FETCHOP_NOP		1'b0`define OR1200_FETCHOP_LW		1'b1//// Register File Write-Back OPs//// Bit 0: register file write enable// Bits 2-1: write-back mux selects`define OR1200_RFWBOP_WIDTH		3`define OR1200_RFWBOP_NOP		3'b000`define OR1200_RFWBOP_ALU		3'b001`define OR1200_RFWBOP_LSU		3'b011`define OR1200_RFWBOP_SPRS		3'b101`define OR1200_RFWBOP_LR		3'b111// Compare instructions`define OR1200_COP_SFEQ       3'b000`define OR1200_COP_SFNE       3'b001`define OR1200_COP_SFGT       3'b010`define OR1200_COP_SFGE       3'b011`define OR1200_COP_SFLT       3'b100`define OR1200_COP_SFLE       3'b101`define OR1200_COP_X          3'b111`define OR1200_SIGNED_COMPARE 'd3`define OR1200_COMPOP_WIDTH	4//// TAGs for instruction bus//`define OR1200_ITAG_IDLE	4'h0	// idle bus`define	OR1200_ITAG_NI		4'h1	// normal insn`define OR1200_ITAG_BE		4'hb	// Bus error exception`define OR1200_ITAG_PE		4'hc	// Page fault exception`define OR1200_ITAG_TE		4'hd	// TLB miss exception//// TAGs for data bus//`define OR1200_DTAG_IDLE	4'h0	// idle bus`define	OR1200_DTAG_ND		4'h1	// normal data`define OR1200_DTAG_AE		4'ha	// Alignment exception`define OR1200_DTAG_BE		4'hb	// Bus error exception`define OR1200_DTAG_PE		4'hc	// Page fault exception`define OR1200_DTAG_TE		4'hd	// TLB miss exception////////////////////////////////////////////////// ORBIS32 ISA specifics//// SHROT_OP position in machine word`define OR1200_SHROTOP_POS		7:6// ALU instructions multicycle field in machine word`define OR1200_ALUMCYC_POS		9:8//// Instruction opcode groups (basic)//`define OR1200_OR32_J                 6'b000000`define OR1200_OR32_JAL               6'b000001`define OR1200_OR32_BNF               6'b000011`define OR1200_OR32_BF                6'b000100`define OR1200_OR32_NOP               6'b000101`define OR1200_OR32_MOVHI             6'b000110`define OR1200_OR32_XSYNC             6'b001000`define OR1200_OR32_RFE               6'b001001/* */`define OR1200_OR32_JR                6'b010001`define OR1200_OR32_JALR              6'b010010`define OR1200_OR32_MACI              6'b010011/* */`define OR1200_OR32_LWZ               6'b100001`define OR1200_OR32_LBZ               6'b100011`define OR1200_OR32_LBS               6'b100100`define OR1200_OR32_LHZ               6'b100101`define OR1200_OR32_LHS               6'b100110`define OR1200_OR32_ADDI              6'b100111`define OR1200_OR32_ADDIC             6'b101000`define OR1200_OR32_ANDI              6'b101001`define OR1200_OR32_ORI               6'b101010`define OR1200_OR32_XORI              6'b101011`define OR1200_OR32_MULI              6'b101100`define OR1200_OR32_MFSPR             6'b101101`define OR1200_OR32_SH_ROTI 	      6'b101110`define OR1200_OR32_SFXXI             6'b101111/* */`define OR1200_OR32_MTSPR             6'b110000`define OR1200_OR32_MACMSB            6'b110001/* */`define OR1200_OR32_SW                6'b110101`define OR1200_OR32_SB                6'b110110`define OR1200_OR32_SH                6'b110111`define OR1200_OR32_ALU               6'b111000`define OR1200_OR32_SFXX              6'b111001//`define OR1200_OR32_CUST5             6'b111100///////////////////////////////////////////////////////// Exceptions////// Exception vectors per OR1K architecture:// 0xPPPPP100 - reset// 0xPPPPP200 - bus error// ... etc// where P represents exception prefix.//// Exception vectors can be customized as per// the following formula:// 0xPPPPPNVV - exception N//// P represents exception prefix// N represents exception N// VV represents length of the individual vector space,//   usually it is 8 bits wide and starts with all bits zero////// PPPPP and VV parts//// Sum of these two defines needs to be 28//`define OR1200_EXCEPT_EPH0_P 20'h00000`define OR1200_EXCEPT_EPH1_P 20'hF0000`define OR1200_EXCEPT_V		   8'h00//// N part width//`define OR1200_EXCEPT_WIDTH 4//// Definition of exception vectors//// To avoid implementation of a certain exception,// simply comment out corresponding line//`define OR1200_EXCEPT_UNUSED		`OR1200_EXCEPT_WIDTH'hf`define OR1200_EXCEPT_TRAP		`OR1200_EXCEPT_WIDTH'he`define OR1200_EXCEPT_BREAK		`OR1200_EXCEPT_WIDTH'hd`define OR1200_EXCEPT_SYSCALL		`OR1200_EXCEPT_WIDTH'hc`define OR1200_EXCEPT_RANGE		`OR1200_EXCEPT_WIDTH'hb`define OR1200_EXCEPT_ITLBMISS		`OR1200_EXCEPT_WIDTH'ha`define OR1200_EXCEPT_DTLBMISS		`OR1200_EXCEPT_WIDTH'h9`define OR1200_EXCEPT_INT		`OR1200_EXCEPT_WIDTH'h8`define OR1200_EXCEPT_ILLEGAL		`OR1200_EXCEPT_WIDTH'h7`define OR1200_EXCEPT_ALIGN		`OR1200_EXCEPT_WIDTH'h6`define OR1200_EXCEPT_TICK		`OR1200_EXCEPT_WIDTH'h5`define OR1200_EXCEPT_IPF		`OR1200_EXCEPT_WIDTH'h4`define OR1200_EXCEPT_DPF		`OR1200_EXCEPT_WIDTH'h3`define OR1200_EXCEPT_BUSERR		`OR1200_EXCEPT_WIDTH'h2`define OR1200_EXCEPT_RESET		`OR1200_EXCEPT_WIDTH'h1`define OR1200_EXCEPT_NONE		`OR1200_EXCEPT_WIDTH'h0///////////////////////////////////////////////////////// SPR groups//// Bits that define the group`define OR1200_SPR_GROUP_BITS	15:11// Width of the group bits`define OR1200_SPR_GROUP_WIDTH 	5// Bits that define offset inside the group`define OR1200_SPR_OFS_BITS 10:0// List of groups`define OR1200_SPR_GROUP_SYS	5'd00`define OR1200_SPR_GROUP_DMMU	5'd01`define OR1200_SPR_GROUP_IMMU	5'd02`define OR1200_SPR_GROUP_DC	5'd03`define OR1200_SPR_GROUP_IC	5'd04`define OR1200_SPR_GROUP_MAC	5'd05`define OR1200_SPR_GROUP_DU	5'd06`define OR1200_SPR_GROUP_PM	5'd08`define OR1200_SPR_GROUP_PIC	5'd09`define OR1200_SPR_GROUP_TT	5'd10///////////////////////////////////////////////////////// System group

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -