📄 pci_conf_space(1).v
字号:
reg [ 7: 0] r_revision_id ;`ifdef HOST parameter r_class_code = 24'h06_00_00 ;`else parameter r_class_code = 24'h06_80_00 ;`endif reg [7 : 0] cache_line_size_reg ; reg [7 : 0] latency_timer ; parameter r_header_type = 8'h00 ; // REG bist NOT implemented !!!/*-----------------------------------------------------------------------------------------------------------[010h-03Ch] all other DWORDs (32-bit) of PCI configuration header - only for HEADER type 00h ! r_ prefix is a sign for read only registers BASE_ADDRESS_REGISTERS are the same as ones in the PCI Target configuration registers section. They are duplicated and therefor defined just ones and used with the same name as written below. If IMAGEx is NOT defined there is only parameter image_X assigned to '0' and this parameter is used elsewhere in the code. This parameter is defined in the INTERNAL SIGNALS part !!! Interrupt_Pin value 8'h01 is used for INT_A pin used. MIN_GNT and MAX_LAT are used for device's desired values for Latency Timer value. The value in boath registers specifies a period of time in units of 1/4 microsecond. ZERO indicates that there are no major requirements for the settings of Latency Timer. MIN_GNT specifieshow how long a burst period the device needs at 33MHz. MAX_LAT specifies how often the device needs to gain access to the PCI bus. Values are choosen assuming that the target does not insert any wait states. Follow the expamle of settings for simple display card. If we use 64 (32-bit) FIFO locations for one burst then we need 8 x 1/4 microsecond periods at 33MHz clock rate => MIN_GNT = 08h ! Resolution is 1024 x 768 (= 786432 pixels for one frame) with 16-bit color mode. We can transfere 2 16-bit pixels in one FIFO location. From that we calculate, that for one frame we need 6144 burst transferes in 1/25 second. So we need one burst every 6,51 microsecond and that is 26 x 1/4 microsecond or 1Ah x 1/4 microsecond => MAX_LAT = 1Ah !-----------------------------------------------------------------------------------------------------------*/ // REG x 6 base_address_register_X IMPLEMENTED as pci_ba_X !!! // REG r_cardbus_cis_pointer NOT implemented !!! // REG r_subsystem_vendor_id NOT implemented !!! // REG r_subsystem_id NOT implemented !!! // REG r_expansion_rom_base_address NOT implemented !!! // REG r_cap_list_pointer NOT implemented !!! reg [7 : 0] interrupt_line ; parameter r_interrupt_pin = 8'h01 ; reg [7 : 0] r_min_gnt ; reg [7 : 0] r_max_lat ;/*###########################################################################################################-------------------------------------------------------------------------------------------------------------PCI Target configuration registers There are also some registers with NOT all bits implemented and therefor uses _bitX or _bitX2_X1 to sign which bit or range of bits are implemented. Some special cases and examples are described below!-------------------------------------------------------------------------------------------------------------###########################################################################################################*//*-----------------------------------------------------------------------------------------------------------[100h-168h] Depending on defines (PCI_IMAGE1 or .. or PCI_IMAGE5 or (PCI_IMAGE0 and HOST)) in constants.v file, there are registers corresponding to each IMAGE defined to REG and parameter pci_image_X assigned to '1'. The maximum number of images is "6". By default there are first two images used and the first (PCI_IMAGE0) is assigned to Configuration space! With a 'define' PCI_IMAGEx you choose the number of used PCI IMAGES in a bridge without PCI_IMAGE0 (e.g. PCI_IMAGE3 tells, that PCI_IMAGE1, PCI_IMAGE2 and PCI_IMAGE3 are used for mapping the space from WB to PCI. Offcourse, PCI_IMAGE0 is assigned to Configuration space). That leave us PCI_IMAGE5 as the maximum number of images. There is one exeption, when the core is implemented as HOST. If so, then the PCI specification allowes the Configuration space NOT to be visible on the PCI bus. With `define PCI_IMAGE0 (and `define HOST), we assign PCI_IMAGE0 to normal WB to PCI image and not to configuration space! When error occurs, PCI ERR_ADDR and ERR_DATA registers stores address and data on the bus that caused error. While ERR_CS register stores Byte Enables and Bus Command in the MSByte. In bits 10 and 8 it reports Retry Counter Expired (for posted writes), Error Source (Master Abort) and Error Report Signal (signals that error has occured) respectively. With bit 0 we enable Error Reporting mechanism.-----------------------------------------------------------------------------------------------------------*/`ifdef HOST `ifdef NO_CNF_IMAGE `ifdef PCI_IMAGE0 // if PCI bridge is HOST and IMAGE0 is assigned as general image space reg [31 : 8] pci_ba0_bit31_8 ; reg [2 : 1] pci_img_ctrl0_bit2_1 ; reg pci_ba0_bit0 ; reg [31 : 8] pci_am0 ; reg [31 : 8] pci_ta0 ; `else // if PCI bridge is HOST and IMAGE0 is not used wire [31 : 8] pci_ba0_bit31_8 = 24'h0000_00 ; // NO base address needed wire [2 : 1] pci_img_ctrl0_bit2_1 = 2'b00 ; // NO addr.transl. and pre-fetch wire pci_ba0_bit0 = 0 ; // config. space is MEMORY space wire [31 : 8] pci_am0 = 24'h0000_00 ; // NO address mask needed wire [31 : 8] pci_ta0 = 24'h0000_00 ; // NO address translation needed `endif `else // if PCI bridge is HOST and IMAGE0 is assigned to PCI configuration space reg [31 : 8] pci_ba0_bit31_8 ; wire [2 : 1] pci_img_ctrl0_bit2_1 = 2'b00 ; // NO pre-fetch and read line support wire pci_ba0_bit0 = 0 ; // config. space is MEMORY space wire [31 : 8] pci_am0 = 24'hFFFF_F0 ; // address mask for configuration image always 20'hffff_f wire [31 : 8] pci_ta0 = 24'h0000_00 ; // NO address translation needed `endif`endif`ifdef GUEST // if PCI bridge is GUEST, then IMAGE0 is assigned to PCI configuration space reg [31 : 8] pci_ba0_bit31_8 ; wire [2 : 1] pci_img_ctrl0_bit2_1 = 2'b00 ; // NO addr.transl. and pre-fetch wire pci_ba0_bit0 = 0 ; // config. space is MEMORY space wire [31 : 8] pci_am0 = 24'hffff_f0 ; // address mask for configuration image always 24'hffff_f0 - 4KB mem image wire [31 : 8] pci_ta0 = 24'h0000_00 ; // NO address translation needed`endif// IMAGE1 is included by default, meanwhile other IMAGEs are optional !!! reg [2 : 1] pci_img_ctrl1_bit2_1 ; reg [31 : 8] pci_ba1_bit31_8 ; `ifdef HOST reg pci_ba1_bit0 ; `else wire pci_ba1_bit0 = `PCI_BA1_MEM_IO ; `endif reg [31 : 8] pci_am1 ; reg [31 : 8] pci_ta1 ;`ifdef PCI_IMAGE2 reg [2 : 1] pci_img_ctrl2_bit2_1 ; reg [31 : 8] pci_ba2_bit31_8 ; `ifdef HOST reg pci_ba2_bit0 ; `else wire pci_ba2_bit0 = `PCI_BA2_MEM_IO ; `endif reg [31 : 8] pci_am2 ; reg [31 : 8] pci_ta2 ;`else wire [2 : 1] pci_img_ctrl2_bit2_1 = 2'b00 ; wire [31 : 8] pci_ba2_bit31_8 = 24'h0000_00 ; wire pci_ba2_bit0 = 1'b0 ; wire [31 : 8] pci_am2 = 24'h0000_00 ; wire [31 : 8] pci_ta2 = 24'h0000_00 ;`endif`ifdef PCI_IMAGE3 reg [2 : 1] pci_img_ctrl3_bit2_1 ; reg [31 : 8] pci_ba3_bit31_8 ; `ifdef HOST reg pci_ba3_bit0 ; `else wire pci_ba3_bit0 = `PCI_BA3_MEM_IO ; `endif reg [31 : 8] pci_am3 ; reg [31 : 8] pci_ta3 ;`else wire [2 : 1] pci_img_ctrl3_bit2_1 = 2'b00 ; wire [31 : 8] pci_ba3_bit31_8 = 24'h0000_00 ; wire pci_ba3_bit0 = 1'b0 ; wire [31 : 8] pci_am3 = 24'h0000_00 ; wire [31 : 8] pci_ta3 = 24'h0000_00 ;`endif`ifdef PCI_IMAGE4 reg [2 : 1] pci_img_ctrl4_bit2_1 ; reg [31 : 8] pci_ba4_bit31_8 ; `ifdef HOST reg pci_ba4_bit0 ; `else wire pci_ba4_bit0 = `PCI_BA4_MEM_IO ; `endif reg [31 : 8] pci_am4 ; reg [31 : 8] pci_ta4 ;`else wire [2 : 1] pci_img_ctrl4_bit2_1 = 2'b00 ; wire [31 : 8] pci_ba4_bit31_8 = 24'h0000_00 ; wire pci_ba4_bit0 = 1'b0 ; wire [31 : 8] pci_am4 = 24'h0000_00 ; wire [31 : 8] pci_ta4 = 24'h0000_00 ;`endif`ifdef PCI_IMAGE5 reg [2 : 1] pci_img_ctrl5_bit2_1 ; reg [31 : 8] pci_ba5_bit31_8 ; `ifdef HOST reg pci_ba5_bit0 ; `else wire pci_ba5_bit0 = `PCI_BA5_MEM_IO ; `endif reg [31 : 8] pci_am5 ; reg [31 : 8] pci_ta5 ;`else wire [2 : 1] pci_img_ctrl5_bit2_1 = 2'b00 ; wire [31 : 8] pci_ba5_bit31_8 = 24'h0000_00 ; wire pci_ba5_bit0 = 1'b0 ; wire [31 : 8] pci_am5 = 24'h0000_00 ; wire [31 : 8] pci_ta5 = 24'h0000_00 ;`endif reg [31 : 24] pci_err_cs_bit31_24 ; reg pci_err_cs_bit10 ; reg pci_err_cs_bit9 ; reg pci_err_cs_bit8 ; reg pci_err_cs_bit0 ; reg [31 : 0] pci_err_addr ; reg [31 : 0] pci_err_data ;/*###########################################################################################################-------------------------------------------------------------------------------------------------------------WISHBONE Slave configuration registers There are also some registers with NOT all bits implemented and therefor uses _bitX or _bitX2_X1 to sign which bit or range of bits are implemented. Some special cases and examples are described below!-------------------------------------------------------------------------------------------------------------###########################################################################################################*//*-----------------------------------------------------------------------------------------------------------[800h-85Ch] Depending on defines (WB_IMAGE1 or .. or WB_IMAGE4 or WB_IMAGE5) in constants.v file, there are registers corresponding to each IMAGE defined to REG and parameter wb_image_X assigned to '1'. The maximum number of images is "6". By default there are first two images used and the first (WB_IMAGE0) is assigned to Configuration space! With a 'define' WB_IMAGEx you choose the number of used WB IMAGES in a bridge without WB_IMAGE0 (e.g. WB_IMAGE3 tells, that WB_IMAGE1, WB_IMAGE2 and WB_IMAGE3 are used for mapping the space from PCI to WB. Offcourse, WB_IMAGE0 is assigned to Configuration space). That leave us WB_IMAGE5 as the maximum number of images. When error occurs, WISHBONE ERR_ADDR and ERR_DATA registers stores address and data on the bus that caused error. While ERR_CS register stores Byte Enables and Bus Command in the MSByte. In bits 10, 9 and 8 it reports Retry Counter Expired (for posted writes), Error Source (Master Abort) and Error Report Signal (signals that error has occured) respectively. With bit 0 we enable Error Reporting mechanism.-----------------------------------------------------------------------------------------------------------*/// WB_IMAGE0 is always assigned to config. space or is not used wire [2 : 0] wb_img_ctrl0_bit2_0 = 3'b000 ; // NO addr.transl., pre-fetch and read-line wire [31 : 12] wb_ba0_bit31_12 = `WB_CONFIGURATION_BASE ; wire wb_ba0_bit0 = 0 ; // config. space is MEMORY space wire [31 : 12] wb_am0 = `WB_AM0 ; // 4KBytes of configuration space is minimum wire [31 : 12] wb_ta0 = 20'h0000_0 ; // NO address translation needed// WB_IMAGE1 is included by default meanwhile others are optional ! reg [2 : 0] wb_img_ctrl1_bit2_0 ; reg [31 : 12] wb_ba1_bit31_12 ; reg wb_ba1_bit0 ; reg [31 : 12] wb_am1 ; reg [31 : 12] wb_ta1 ;`ifdef WB_IMAGE2 reg [2 : 0] wb_img_ctrl2_bit2_0 ; reg [31 : 12] wb_ba2_bit31_12 ; reg wb_ba2_bit0 ; reg [31 : 12] wb_am2 ; reg [31 : 12] wb_ta2 ;`else wire [2 : 0] wb_img_ctrl2_bit2_0 = 3'b000 ; wire [31 : 12] wb_ba2_bit31_12 = 20'h0000_0 ; wire wb_ba2_bit0 = 1'b0 ; wire [31 : 12] wb_am2 = 20'h0000_0 ; wire [31 : 12] wb_ta2 = 20'h0000_0 ;`endif`ifdef WB_IMAGE3 reg [2 : 0] wb_img_ctrl3_bit2_0 ; reg [31 : 12] wb_ba3_bit31_12 ; reg wb_ba3_bit0 ; reg [31 : 12] wb_am3 ; reg [31 : 12] wb_ta3 ;`else wire [2 : 0] wb_img_ctrl3_bit2_0 = 3'b000 ; wire [31 : 12] wb_ba3_bit31_12 = 20'h0000_0 ; wire wb_ba3_bit0 = 1'b0 ; wire [31 : 12] wb_am3 = 20'h0000_0 ; wire [31 : 12] wb_ta3 = 20'h0000_0 ;`endif`ifdef WB_IMAGE4 reg [2 : 0] wb_img_ctrl4_bit2_0 ; reg [31 : 12] wb_ba4_bit31_12 ; reg wb_ba4_bit0 ; reg [31 : 12] wb_am4 ; reg [31 : 12] wb_ta4 ;`else wire [2 : 0] wb_img_ctrl4_bit2_0 = 3'b000 ; wire [31 : 12] wb_ba4_bit31_12 = 20'h0000_0 ; wire wb_ba4_bit0 = 1'b0 ; wire [31 : 12] wb_am4 = 20'h0000_0 ; wire [31 : 12] wb_ta4 = 20'h0000_0 ;`endif`ifdef WB_IMAGE5 reg [2 : 0] wb_img_ctrl5_bit2_0 ; reg [31 : 12] wb_ba5_bit31_12 ; reg wb_ba5_bit0 ; reg [31 : 12] wb_am5 ; reg [31 : 12] wb_ta5 ;`else wire [2 : 0] wb_img_ctrl5_bit2_0 = 3'b000 ; wire [31 : 12] wb_ba5_bit31_12 = 20'h0000_0 ; wire wb_ba5_bit0 = 1'b0 ; wire [31 : 12] wb_am5 = 20'h0000_0 ; wire [31 : 12] wb_ta5 = 20'h0000_0 ;`endif reg [31 : 24] wb_err_cs_bit31_24 ;/* reg wb_err_cs_bit10 ;*/ reg wb_err_cs_bit9 ; reg wb_err_cs_bit8 ; reg wb_err_cs_bit0 ; reg [31 : 0] wb_err_addr ; reg [31 : 0] wb_err_data ;/*###########################################################################################################-------------------------------------------------------------------------------------------------------------Configuration Cycle address register There are also some registers with NOT all bits implemented and therefor uses _bitX or _bitX2_X1 to sign which bit or range of bits are implemented.-------------------------------------------------------------------------------------------------------------###########################################################################################################*//*-----------------------------------------------------------------------------------------------------------[860h-868h] PCI bridge must ignore Type 1 configuration cycles (Master Abort) since they are used for PCI to PCI bridges. This is single function device, that means responding on configuration cycles to all functions (or responding only to function 0). Configuration address register for generating configuration cycles is prepared for all options (it includes Bus Number, Device, Function, Offset and Type). Interrupt acknowledge register stores interrupt vector data returned during Interrupt Acknowledge cycle.-----------------------------------------------------------------------------------------------------------*/`ifdef HOST reg [23 : 2] cnf_addr_bit23_2 ; reg cnf_addr_bit0 ;`else // GUEST wire [23 : 2] cnf_addr_bit23_2 = 22'h0 ; wire cnf_addr_bit0 = 1'b0 ;`endif // reg [31 : 0] cnf_data ; IMPLEMENTED elsewhere !!!!! // reg [31 : 0] int_ack ; IMPLEMENTED elsewhere !!!!!/*###########################################################################################################
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -