📄 or1200_defines.v
字号:
`define OR1200_TT_TTMR_M 31:30// Define if reading TT registers is allowed`define OR1200_TT_READREGS////////////////////////////////////////////////// MAC//`define OR1200_MAC_ADDR 0 // MACLO 0xxxxxxxx1, MACHI 0xxxxxxxx0`define OR1200_MAC_SPR_WE // Define if MACLO/MACHI are SPR writable////////////////////////////////////////////////// Data MMU (DMMU)////// Address that selects between TLB TR and MR//`define OR1200_DTLB_TM_ADDR 7//// DTLBMR fields//`define OR1200_DTLBMR_V_BITS 0`define OR1200_DTLBMR_CID_BITS 4:1`define OR1200_DTLBMR_RES_BITS 11:5`define OR1200_DTLBMR_VPN_BITS 31:13//// DTLBTR fields//`define OR1200_DTLBTR_CC_BITS 0`define OR1200_DTLBTR_CI_BITS 1`define OR1200_DTLBTR_WBC_BITS 2`define OR1200_DTLBTR_WOM_BITS 3`define OR1200_DTLBTR_A_BITS 4`define OR1200_DTLBTR_D_BITS 5`define OR1200_DTLBTR_URE_BITS 6`define OR1200_DTLBTR_UWE_BITS 7`define OR1200_DTLBTR_SRE_BITS 8`define OR1200_DTLBTR_SWE_BITS 9`define OR1200_DTLBTR_RES_BITS 11:10`define OR1200_DTLBTR_PPN_BITS 31:13//// DTLB configuration//`define OR1200_DMMU_PS 13 // 13 for 8KB page size`define OR1200_DTLB_INDXW 6 // 6 for 64 entry DTLB 7 for 128 entries`define OR1200_DTLB_INDXL `OR1200_DMMU_PS // 13 13`define OR1200_DTLB_INDXH `OR1200_DMMU_PS+`OR1200_DTLB_INDXW-1 // 18 19`define OR1200_DTLB_INDX `OR1200_DTLB_INDXH:`OR1200_DTLB_INDXL // 18:13 19:13`define OR1200_DTLB_TAGW 32-`OR1200_DTLB_INDXW-`OR1200_DMMU_PS // 13 12`define OR1200_DTLB_TAGL `OR1200_DTLB_INDXH+1 // 19 20`define OR1200_DTLB_TAG 31:`OR1200_DTLB_TAGL // 31:19 31:20`define OR1200_DTLBMRW `OR1200_DTLB_TAGW+1 // +1 because of V bit`define OR1200_DTLBTRW 32-`OR1200_DMMU_PS+5 // +5 because of protection bits and CI//// Cache inhibit while DMMU is not enabled/implemented//// cache inhibited 0GB-4GB 1'b1// cache inhibited 0GB-2GB !dcpu_adr_i[31]// cache inhibited 0GB-1GB 2GB-3GB !dcpu_adr_i[30]// cache inhibited 1GB-2GB 3GB-4GB dcpu_adr_i[30]// cache inhibited 2GB-4GB (default) dcpu_adr_i[31]// cached 0GB-4GB 1'b0//`define OR1200_DMMU_CI dcpu_adr_i[31]////////////////////////////////////////////////// Insn MMU (IMMU)////// Address that selects between TLB TR and MR//`define OR1200_ITLB_TM_ADDR 7//// ITLBMR fields//`define OR1200_ITLBMR_V_BITS 0`define OR1200_ITLBMR_CID_BITS 4:1`define OR1200_ITLBMR_RES_BITS 11:5`define OR1200_ITLBMR_VPN_BITS 31:13//// ITLBTR fields//`define OR1200_ITLBTR_CC_BITS 0`define OR1200_ITLBTR_CI_BITS 1`define OR1200_ITLBTR_WBC_BITS 2`define OR1200_ITLBTR_WOM_BITS 3`define OR1200_ITLBTR_A_BITS 4`define OR1200_ITLBTR_D_BITS 5`define OR1200_ITLBTR_SXE_BITS 6`define OR1200_ITLBTR_UXE_BITS 7`define OR1200_ITLBTR_RES_BITS 11:8`define OR1200_ITLBTR_PPN_BITS 31:13//// ITLB configuration//`define OR1200_IMMU_PS 13 // 13 for 8KB page size`define OR1200_ITLB_INDXW 6 // 6 for 64 entry ITLB 7 for 128 entries`define OR1200_ITLB_INDXL `OR1200_IMMU_PS // 13 13`define OR1200_ITLB_INDXH `OR1200_IMMU_PS+`OR1200_ITLB_INDXW-1 // 18 19`define OR1200_ITLB_INDX `OR1200_ITLB_INDXH:`OR1200_ITLB_INDXL // 18:13 19:13`define OR1200_ITLB_TAGW 32-`OR1200_ITLB_INDXW-`OR1200_IMMU_PS // 13 12`define OR1200_ITLB_TAGL `OR1200_ITLB_INDXH+1 // 19 20`define OR1200_ITLB_TAG 31:`OR1200_ITLB_TAGL // 31:19 31:20`define OR1200_ITLBMRW `OR1200_ITLB_TAGW+1 // +1 because of V bit`define OR1200_ITLBTRW 32-`OR1200_IMMU_PS+3 // +3 because of protection bits and CI//// Cache inhibit while IMMU is not enabled/implemented// Note: all combinations that use icpu_adr_i cause async loop//// cache inhibited 0GB-4GB 1'b1// cache inhibited 0GB-2GB !icpu_adr_i[31]// cache inhibited 0GB-1GB 2GB-3GB !icpu_adr_i[30]// cache inhibited 1GB-2GB 3GB-4GB icpu_adr_i[30]// cache inhibited 2GB-4GB (default) icpu_adr_i[31]// cached 0GB-4GB 1'b0//`define OR1200_IMMU_CI 1'b0///////////////////////////////////////////////////// Insn cache (IC)//// 3 for 8 bytes, 4 for 16 bytes etc`define OR1200_ICLS 4//// IC configurations//`ifdef OR1200_IC_1W_4KB`define OR1200_ICSIZE 12 // 4096`define OR1200_ICINDX `OR1200_ICSIZE-2 // 10`define OR1200_ICINDXH `OR1200_ICSIZE-1 // 11`define OR1200_ICTAGL `OR1200_ICINDXH+1 // 12`define OR1200_ICTAG `OR1200_ICSIZE-`OR1200_ICLS // 8`define OR1200_ICTAG_W 21`endif`ifdef OR1200_IC_1W_8KB`define OR1200_ICSIZE 13 // 8192`define OR1200_ICINDX `OR1200_ICSIZE-2 // 11`define OR1200_ICINDXH `OR1200_ICSIZE-1 // 12`define OR1200_ICTAGL `OR1200_ICINDXH+1 // 13`define OR1200_ICTAG `OR1200_ICSIZE-`OR1200_ICLS // 9`define OR1200_ICTAG_W 20`endif///////////////////////////////////////////////////// Data cache (DC)//// 3 for 8 bytes, 4 for 16 bytes etc`define OR1200_DCLS 4// Define to perform store refill (potential performance penalty)// `define OR1200_DC_STORE_REFILL//// DC configurations//`ifdef OR1200_DC_1W_4KB`define OR1200_DCSIZE 12 // 4096`define OR1200_DCINDX `OR1200_DCSIZE-2 // 10`define OR1200_DCINDXH `OR1200_DCSIZE-1 // 11`define OR1200_DCTAGL `OR1200_DCINDXH+1 // 12`define OR1200_DCTAG `OR1200_DCSIZE-`OR1200_DCLS // 8`define OR1200_DCTAG_W 21`endif`ifdef OR1200_DC_1W_8KB`define OR1200_DCSIZE 13 // 8192`define OR1200_DCINDX `OR1200_DCSIZE-2 // 11`define OR1200_DCINDXH `OR1200_DCSIZE-1 // 12`define OR1200_DCTAGL `OR1200_DCINDXH+1 // 13`define OR1200_DCTAG `OR1200_DCSIZE-`OR1200_DCLS // 9`define OR1200_DCTAG_W 20`endif///////////////////////////////////////////////////// Store buffer (SB)////// Store buffer//// It will improve performance by "caching" CPU stores// using store buffer. This is most important for function// prologues because DC can only work in write though mode// and all stores would have to complete external WB writes// to memory.// Store buffer is between DC and data BIU.// All stores will be stored into store buffer and immediately// completed by the CPU, even though actual external writes// will be performed later. As a consequence store buffer masks// all data bus errors related to stores (data bus errors// related to loads are delivered normally).// All pending CPU loads will wait until store buffer is empty to// ensure strict memory model. Right now this is necessary because// we don't make destinction between cached and cache inhibited// address space, so we simply empty store buffer until loads// can begin.//// It makes design a bit bigger, depending what is the number of// entries in SB FIFO. Number of entries can be changed further// down.////`define OR1200_SB_IMPLEMENTED//// Number of store buffer entries//// Verified number of entries are 4 and 8 entries// (2 and 3 for OR1200_SB_LOG). OR1200_SB_ENTRIES must// always match 2**OR1200_SB_LOG.// To disable store buffer, undefine// OR1200_SB_IMPLEMENTED.//`define OR1200_SB_LOG 2 // 2 or 3`define OR1200_SB_ENTRIES 4 // 4 or 8///////////////////////////////////////////////////////// VR, UPR and Configuration Registers////// VR, UPR and configuration registers are optional. If // implemented, operating system can automatically figure// out how to use the processor because it knows // what units are available in the processor and how they// are configured.//// This section must be last in or1200_defines.v file so// that all units are already configured and thus// configuration registers are properly set.// // Define if you want configuration registers implemented`define OR1200_CFGR_IMPLEMENTED// Define if you want full address decode inside SYS group`define OR1200_SYS_FULL_DECODE// Offsets of VR, UPR and CFGR registers`define OR1200_SPRGRP_SYS_VR 4'h0`define OR1200_SPRGRP_SYS_UPR 4'h1`define OR1200_SPRGRP_SYS_CPUCFGR 4'h2`define OR1200_SPRGRP_SYS_DMMUCFGR 4'h3`define OR1200_SPRGRP_SYS_IMMUCFGR 4'h4`define OR1200_SPRGRP_SYS_DCCFGR 4'h5`define OR1200_SPRGRP_SYS_ICCFGR 4'h6`define OR1200_SPRGRP_SYS_DCFGR 4'h7// VR fields`define OR1200_VR_REV_BITS 5:0`define OR1200_VR_RES1_BITS 15:6`define OR1200_VR_CFG_BITS 23:16`define OR1200_VR_VER_BITS 31:24// VR values`define OR1200_VR_REV 6'h00`define OR1200_VR_RES1 10'h000`define OR1200_VR_CFG 8'h00`define OR1200_VR_VER 8'h12// UPR fields`define OR1200_UPR_UP_BITS 0`define OR1200_UPR_DCP_BITS 1`define OR1200_UPR_ICP_BITS 2`define OR1200_UPR_DMP_BITS 3`define OR1200_UPR_IMP_BITS 4`define OR1200_UPR_MP_BITS 5`define OR1200_UPR_DUP_BITS 6`define OR1200_UPR_PCUP_BITS 7`define OR1200_UPR_PMP_BITS 8`define OR1200_UPR_PICP_BITS 9`define OR1200_UPR_TTP_BITS 10`define OR1200_UPR_RES1_BITS 23:11`define OR1200_UPR_CUP_BITS 31:24// UPR values`define OR1200_UPR_UP 1'b1`ifdef OR1200_NO_DC`define OR1200_UPR_DCP 1'b0`else`define OR1200_UPR_DCP 1'b1`endif`ifdef OR1200_NO_IC`define OR1200_UPR_ICP 1'b0`else`define OR1200_UPR_ICP 1'b1`endif`ifdef OR1200_NO_DMMU`define OR1200_UPR_DMP 1'b0`else`define OR1200_UPR_DMP 1'b1`endif`ifdef OR1200_NO_IMMU`define OR1200_UPR_IMP 1'b0`else`define OR1200_UPR_IMP 1'b1`endif`define OR1200_UPR_MP 1'b1 // MAC always present`ifdef OR1200_DU_IMPLEMENTED`define OR1200_UPR_DUP 1'b1`else`define OR1200_UPR_DUP 1'b0`endif`define OR1200_UPR_PCUP 1'b0 // Performance counters not present`ifdef OR1200_DU_IMPLEMENTED`define OR1200_UPR_PMP 1'b1`else`define OR1200_UPR_PMP 1'b0`endif`ifdef OR1200_DU_IMPLEMENTED`define OR1200_UPR_PICP 1'b1`else`define OR1200_UPR_PICP 1'b0`endif`ifdef OR1200_DU_IMPLEMENTED`define OR1200_UPR_TTP 1'b1`else`define OR1200_UPR_TTP 1'b0`endif`define OR1200_UPR_RES1 13'h0000`define OR1200_UPR_CUP 8'h00// CPUCFGR fields`define OR1200_CPUCFGR_NSGF_BITS 3:0`define OR1200_CPUCFGR_HGF_BITS 4`define OR1200_CPUCFGR_OB32S_BITS 5`define OR1200_CPUCFGR_OB64S_BITS 6`define OR1200_CPUCFGR_OF32S_BITS 7`define OR1200_CPUCFGR_OF64S_BITS 8`define OR1200_CPUCFGR_OV64S_BITS 9`define OR1200_CPUCFGR_RES1_BITS 31:10// CPUCFGR values`define OR1200_CPUCFGR_NSGF 4'h0`define OR1200_CPUCFGR_HGF 1'b0`define OR1200_CPUCFGR_OB32S 1'b1`define OR1200_CPUCFGR_OB64S 1'b0`define OR1200_CPUCFGR_OF32S 1'b0`define OR1200_CPUCFGR_OF64S 1'b0`define OR1200_CPUCFGR_OV64S 1'b0`define OR1200_CPUCFGR_RES1 22'h000000// DMMUCFGR fields`define OR1200_DMMUCFGR_NTW_BITS 1:0`define OR1200_DMMUCFGR_NTS_BITS 4:2`define OR1200_DMMUCFGR_NAE_BITS 7:5`define OR1200_DMMUCFGR_CRI_BITS 8`define OR1200_DMMUCFGR_PRI_BITS 9`define OR1200_DMMUCFGR_TEIRI_BITS 10`define OR1200_DMMUCFGR_HTR_BITS 11`define OR1200_DMMUCFGR_RES1_BITS 31:12// DMMUCFGR values`ifdef OR1200_NO_DMMU`define OR1200_DMMUCFGR_NTW 2'h0 // Irrelevant`define OR1200_DMMUCFGR_NTS 3'h0 // Irrelevant`define OR1200_DMMUCFGR_NAE 3'h0 // Irrelevant`define OR1200_DMMUCFGR_CRI 1'b0 // Irrelevant`define OR1200_DMMUCFGR_PRI 1'b0 // Irrelevant`define OR1200_DMMUCFGR_TEIRI 1'b0 // Irrelevant`define OR1200_DMMUCFGR_HTR 1'b0 // Irrelevant`define OR1200_DMMUCFGR_RES1 20'h00000`else`define OR1200_DMMUCFGR_NTW 2'h0 // 1 TLB way`define OR1200_DMMUCFGR_NTS 3'h`OR1200_DTLB_INDXW // Num TLB sets`define OR1200_DMMUCFGR_NAE 3'h0 // No ATB entries`define OR1200_DMMUCFGR_CRI 1'b0 // No control register`define OR1200_DMMUCFGR_PRI 1'b0 // No protection reg`define OR1200_DMMUCFGR_TEIRI 1'b1 // TLB entry inv reg impl.`define OR1200_DMMUCFGR_HTR 1'b0 // No HW TLB reload`define OR1200_DMMUCFGR_RES1 20'h00000`endif// IMMUCFGR fields`define OR1200_IMMUCFGR_NTW_BITS 1:0`define OR1200_IMMUCFGR_NTS_BITS 4:2`define OR1200_IMMUCFGR_NAE_BITS 7:5`define OR1200_IMMUCFGR_CRI_BITS 8`define OR1200_IMMUCFGR_PRI_BITS 9`define OR1200_IMMUCFGR_TEIRI_BITS 10`define OR1200_IMMUCFGR_HTR_BITS 11`define OR1200_IMMUCFGR_RES1_BITS 31:12// IMMUCFGR values`ifdef OR1200_NO_IMMU`define OR1200_IMMUCFGR_NTW 2'h0 // Irrelevant`define OR1200_IMMUCFGR_NTS 3'h0 // Irrelevant`define OR1200_IMMUCFGR_NAE 3'h0 // Irrelevant`define OR1200_IMMUCFGR_CRI 1'b0 // Irrelevant`define OR1200_IMMUCFGR_PRI 1'b0 // Irrelevant`define OR1200_IMMUCFGR_TEIRI 1'b0 // Irrelevant`define OR1200_IMMUCFGR_HTR 1'b0 // Irrelevant`define OR1200_IMMUCFGR_RES1 20'h00000`else`define OR1200_IMMUCFGR_NTW 2'h0 // 1 TLB way`define OR1200_IMMUCFGR_NTS 3'h`OR1200_ITLB_INDXW // Num TLB sets`define OR1200_IMMUCFGR_NAE 3'h0 // No ATB entry`define OR1200_IMMUCFGR_CRI 1'b0 // No control reg`define OR1200_IMMUCFGR_PRI 1'b0 // No protection reg`define OR1200_IMMUCFGR_TEIRI 1'b1 // TLB entry inv reg impl`define OR1200_IMMUCFGR_HTR 1'b0 // No HW TLB reload`define OR1200_IMMUCFGR_RES1 20'h00000`endif// DCCFGR fields`define OR1200_DCCFGR_NCW_BITS 2:0`define OR1200_DCCFGR_NCS_BITS 6:3`define OR1200_DCCFGR_CBS_BITS 7`define OR1200_DCCFGR_CWS_BITS 8`define OR1200_DCCFGR_CCRI_BITS 9`define OR1200_DCCFGR_CBIRI_BITS 10`define OR1200_DCCFGR_CBPRI_BITS 11`define OR1200_DCCFGR_CBLRI_BITS 12`define OR1200_DCCFGR_CBFRI_BITS 13`define OR1200_DCCFGR_CBWBRI_BITS 14`define OR1200_DCCFGR_RES1_BITS 31:15// DCCFGR values`ifdef OR1200_NO_DC`define OR1200_DCCFGR_NCW 3'h0 // Irrelevant`define OR1200_DCCFGR_NCS 4'h0 // Irrelevant`define OR1200_DCCFGR_CBS 1'b0 // Irrelevant`define OR1200_DCCFGR_CWS 1'b0 // Irrelevant`define OR1200_DCCFGR_CCRI 1'b1 // Irrelevant`define OR1200_DCCFGR_CBIRI 1'b1 // Irrelevant`define OR1200_DCCFGR_CBPRI 1'b0 // Irrelevant`define OR1200_DCCFGR_CBLRI 1'b0 // Irrelevant`define OR1200_DCCFGR_CBFRI 1'b1 // Irrelevant`define OR1200_DCCFGR_CBWBRI 1'b0 // Irrelevant`define OR1200_DCCFGR_RES1 17'h00000`else`define OR1200_DCCFGR_NCW 3'h0 // 1 cache way`define OR1200_DCCFGR_NCS (`OR1200_DCTAG) // Num cache sets`define OR1200_DCCFGR_CBS (`OR1200_DCLS-4) // 16 byte cache block`define OR1200_DCCFGR_CWS 1'b0 // Write-through strategy`define OR1200_DCCFGR_CCRI 1'b1 // Cache control reg impl.`define OR1200_DCCFGR_CBIRI 1'b1 // Cache block inv reg impl.`define OR1200_DCCFGR_CBPRI 1'b0 // Cache block prefetch reg not impl.`define OR1200_DCCFGR_CBLRI 1'b0 // Cache block lock reg not impl.`define OR1200_DCCFGR_CBFRI 1'b1 // Cache block flush reg impl.`define OR1200_DCCFGR_CBWBRI 1'b0 // Cache block WB reg not impl.`define OR1200_DCCFGR_RES1 17'h00000`endif// ICCFGR fields`define OR1200_ICCFGR_NCW_BITS 2:0`define OR1200_ICCFGR_NCS_BITS 6:3`define OR1200_ICCFGR_CBS_BITS 7`define OR1200_ICCFGR_CWS_BITS 8`define OR1200_ICCFGR_CCRI_BITS 9`define OR1200_ICCFGR_CBIRI_BITS 10`define OR1200_ICCFGR_CBPRI_BITS 11`define OR1200_ICCFGR_CBLRI_BITS 12`define OR1200_ICCFGR_CBFRI_BITS 13`define OR1200_ICCFGR_CBWBRI_BITS 14`define OR1200_ICCFGR_RES1_BITS 31:15// ICCFGR values`ifdef OR1200_NO_IC`define OR1200_ICCFGR_NCW 3'h0 // Irrelevant`define OR1200_ICCFGR_NCS 4'h0 // Irrelevant`define OR1200_ICCFGR_CBS 1'b0 // Irrelevant`define OR1200_ICCFGR_CWS 1'b0 // Irrelevant`define OR1200_ICCFGR_CCRI 1'b0 // Irrelevant`define OR1200_ICCFGR_CBIRI 1'b0 // Irrelevant`define OR1200_ICCFGR_CBPRI 1'b0 // Irrelevant`define OR1200_ICCFGR_CBLRI 1'b0 // Irrelevant`define OR1200_ICCFGR_CBFRI 1'b0 // Irrelevant`define OR1200_ICCFGR_CBWBRI 1'b0 // Irrelevant`define OR1200_ICCFGR_RES1 17'h00000`else`define OR1200_ICCFGR_NCW 3'h0 // 1 cache way`define OR1200_ICCFGR_NCS (`OR1200_ICTAG) // Num cache sets`define OR1200_ICCFGR_CBS (`OR1200_ICLS-4) // 16 byte cache block`define OR1200_ICCFGR_CWS 1'b0 // Irrelevant`define OR1200_ICCFGR_CCRI 1'b1 // Cache control reg impl.`define OR1200_ICCFGR_CBIRI 1'b1 // Cache block inv reg impl.`define OR1200_ICCFGR_CBPRI 1'b0 // Cache block prefetch reg not impl.`define OR1200_ICCFGR_CBLRI 1'b0 // Cache block lock reg not impl.`define OR1200_ICCFGR_CBFRI 1'b1 // Cache block flush reg impl.`define OR1200_ICCFGR_CBWBRI 1'b0 // Irrelevant`define OR1200_ICCFGR_RES1 17'h00000`endif// DCFGR fields`define OR1200_DCFGR_NDP_BITS 2:0`define OR1200_DCFGR_WPCI_BITS 3`define OR1200_DCFGR_RES1_BITS 31:4// DCFGR values`define OR1200_DCFGR_NDP 3'h0 // Zero DVR/DCR pairs`define OR1200_DCFGR_WPCI 1'b0 // WP counters not impl.`define OR1200_DCFGR_RES1 28'h0000000
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -