pci_conf_space(1).v
上传用户:quan1896
上传日期:2014-05-14
资源大小:211k
文件大小:170k
- <!-- pf_header_start -->
- <html>
- <head>
- <META NAME="keywords" CONTENT="cores, VHDL, Verilog HDL, ASIC, Synthesizable,
- standard cell, IP, Intellectual Property, 32-bit RISC, UART, PCI, SDRAM,
- full custom, system on a chip, SOC, reusable, design, development, synthesis,
- designs, developers, C, Linux, eCos, open, free, open source cores, RTL code,
- system-on-a-chip, circuits, digital, GNU, GPL, core, controller, processor,
- system design, chip design, EDA, design methodology, design tools, ASICs, programmable logic,
- FPGA's, PLDs, CPLDs, verification, Synthesis, HDL, Simulation, IC design software,
- semiconductor design, integrated circuits, system designs, chip designs, EDAs,
- design methodologies, design tool, ASIC, programmable logics, FPGA, PLD, CPLD, Synthesis,
- circuit, Synopsys, system design, chip design, programmable logic, FPGA's, PLDs,
- CPLDs, verification, Simulation">
- <META NAME="description" CONTENT="OPENCORES.ORG endorses development and hosts
- a repository of free, open-source cores (chip designs) and supplemental
- platforms (boards).">
- <STYLE type=text/css>
- BODY {margin: 0;}
- BODY, P, DIV, TD, TR, TH, FORM, OL, UL, LI, B, I, INPUT, TEXTAREA, SELECT,
- FONT {font-size: 10pt; FONT-FAMILY: Verdana, Tahoma, Arial, Helvetica;}
- P, TD, FORM, TEXTAREA {font-size: 10pt;}
- H1, H2 {FONT-FAMILY: Verdana, Tahoma, Arial, Helvetica; font-size: 13pt; text-decoration: none}
- .noline {text-decoration: none;}
- .menu_top {text-decoration: none; font-weight: bold;
- font-size: 7pt; color: #000000; FONT-FAMILY: Verdana, Tahoma, Arial, Helvetica;}
- .menu_section {text-decoration: none; font-weight: bold;
- font-size: 10pt; color: #ffffff; FONT-FAMILY: Verdana, Tahoma, Arial, Helvetica;}
- .menu_item {font-size: 10pt; color: #004488; FONT-FAMILY: Verdana, Tahoma, Arial, Helvetica;}
- .menu_section_admin {text-decoration: none; font-weight: bold;
- font-size: 10pt; color: #ffff44; FONT-FAMILY: Verdana, Tahoma, Arial, Helvetica;}
- .page_title {text-decoration: none; font-weight: bold; color: #c00000; font-size: 13pt; FONT-FAMILY: Verdana, Tahoma, Arial, Helvetica;}
- .block_title {text-decoration: none; font-weight: bold; font-size: 11pt; color: #000000; FONT-FAMILY: Verdana, Tahoma, Arial, Helvetica;}
- .block_subtitle {text-decoration: none; font-weight: bold; font-size: 10pt; color: #000000; FONT-FAMILY: Verdana, Tahoma, Arial, Helvetica;}
- .title {text-decoration: none; font-weight: bold; font-size: 10pt; color: #000000; FONT-FAMILY: Verdana, Tahoma, Arial, Helvetica;}
- .large {font-size: 13pt; FONT-FAMILY: Verdana, Tahoma, Arial, Helvetica;}
- .medium {font-size: 10pt; FONT-FAMILY: Verdana, Tahoma, Arial, Helvetica;}
- .small {font-size: 7pt; FONT-FAMILY: Verdana, Tahoma, Arial, Helvetica;}
- .ultrasmall {font-size: 3pt; FONT-FAMILY: Verdana, Tahoma, Arial, Helvetica;}
- .button { font-family:Verdana, Tahoma, Arial, Helvetica; }
- .searchfield {font-family: verdana, arial, helvetica; font-size: 10px; color: #333333; width: 80px; height: 17px;}
- </STYLE>
- <title>OPENCORES.ORG</title>
- <script laguage="Javascript">
- function check(msg) {
- if(confirm(msg)) {
- return true
- } else {
- return false
- }
- }
- </script>
- </head>
-
- <body
- bgcolor="#e0e0e0"
- topmargin="0"
- leftmargin="0"
- marginwidth="0"
- marginheight="0"
- link="#004488"
- alink="#ff3300"
- vlink="#444444"
- >
- <a name="top">
- <!-- pf_header_end -->
- <center>
- <table cellpadding=0 cellspacing=0 border=0 width=96%><tr>
- <td width=1 bgcolor=#000000><img width=1 src="/images/dotty.gif"></td>
- <td>
- <table border=0 cellpadding=0 cellspacing=0 width=100%>
- <tr><td background="/images/topbg.gif" bgcolor=#aaddff height=70>
- <table width=100% border=0 ><tr><td width=180>
- <a href="/"><img border=0 src="/images/oc_logo.gif"></a>
- </td><td>
- <center>
- <!--
- <a title="" href="/banner.cgi"><img width=468 height=60 border=0 alt="" src=""></a>
- //-->
- <script type="text/javascript"><!--
- google_ad_client = "pub-9285819221080148";
- xgoogle_ad_width = 728;
- xgoogle_ad_height = 79;
- xgoogle_ad_format = "728x90_as";
- google_ad_width = 468;
- google_ad_height = 47;
- google_ad_format = "468x60_as";
- google_ad_type = "text_image";
- google_ad_channel ="3274390903";
- google_color_border = "aaddff";
- xgoogle_color_border = "ffee88";
- xgoogle_color_bg = "FFEE88";
- google_color_bg = "aaddFF";
- google_color_link = "004488";
- google_color_url = "b00000";
- google_color_text = "000000";
- //--></script>
- <script type="text/javascript"
- src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
- </script>
- </center>
- </td><td align=right>
- </td>
- </tr></table>
- </td></tr>
- <tr bgcolor=#000000><td><img height=1 src="/images/dotty.gif"></td></tr>
- <tr><td bgcolor=#ffffff>
- <table border=0 cellpadding=0 cellspacing=0 width=100%><tr>
- <td bgcolor=#ffee88 width=60% background="/images/menu1.gif"></td>
- <td bgcolor=#ffee88 width=15 background="/images/menu1.gif" align=right><input type=image border=0 src="/images/exp1pf.gif" onclick="javascript:window.location='/pf.cgi?url=/cvsweb.shtml/pci/rtl/verilog/pci_conf_space.v?rev=1.10'"></a></td>
- <td bgcolor=#ffffff align=right nowrap>
-
- <font class=menu_top size=-1>
-
- <a class=menu_top href="/login.cgi/login">LOGIN</a>
-
- :::
-
-
- <a class=menu_top href="/recover_pass.cgi/recover_pass">RECOVER PASS</a>
-
- :::
-
-
- <a class=menu_top href="/get_account.cgi/get_account">GET ACCOUNT</a>
-
-
-
- </font>
- </td></tr>
- <tr bgcolor=#ffffff>
- <td></td>
- <td></td>
- <td bgcolor=#000000><img src="/images/dotty.gif"></td>
- </tr>
- </table>
- <table border=0 cellpadding=0 cellspacing=0>
- <tr>
- <td width=10><img width=10 src="/images/dotty.gif"></td>
- <td width=120 valign=top>
-
- <table width=100% border=0 cellpadding=2 cellspacing=0>
- <tr><td><img height=2 src="/images/dotty.gif"></td></tr>
-
- <tr><td bgcolor="#347FB8">
- <img src="/images/bullet.gif">
-
- <font class=menu_section>Browse</font>
-
- </td></tr>
-
- <tr><td>
-
-
- <li class=small>
-
-
-
- <a class=menu_item href="/browse.cgi/by_category"><font class=menu_item>Projects</font></a></li>
-
- </td></tr>
-
-
- <tr><td>
-
-
- <li class=small>
-
-
-
- <a class=menu_item href="/cvsweb.shtml/"><font class=menu_item>Code (CVS)</font></a></li>
-
- </td></tr>
-
-
- <tr><td>
-
-
- <li class=small>
-
-
-
- <a class=menu_item href="/forums.cgi"><font class=menu_item>Forums</font></a></li>
-
- </td></tr>
-
-
- <tr><td>
-
-
- <li class=small>
-
-
-
- <a class=menu_item href="/news.cgi/list/1"><font class=menu_item>News</font></a></li>
-
- </td></tr>
-
-
- <tr><td>
-
-
- <li class=small>
-
-
-
- <a class=menu_item href="/articles.cgi/list"><font class=menu_item>Articles</font></a></li>
-
- </td></tr>
-
-
- <tr><td>
-
-
- <li class=small>
-
-
-
- <a class=menu_item href="/polls.cgi/list"><font class=menu_item>Polls</font></a></li>
-
- </td></tr>
-
-
- <tr><td><font size=-2> </font></td></tr>
-
- <tr><td bgcolor="#347FB8">
- <img src="/images/bullet.gif">
-
- <font class=menu_section>OpenCores</font>
-
- </td></tr>
-
- <tr><td>
-
-
- <li class=small>
-
-
-
- <a class=menu_item href="/faq.cgi/index"><font class=menu_item>FAQ</font></a></li>
-
- </td></tr>
-
-
- <tr><td>
-
-
- <li class=small>
-
-
-
- <a class=menu_item href="/projects.cgi/web/opencores/cvs_howto"><font class=menu_item>CVS HowTo</font></a></li>
-
- </td></tr>
-
-
- <tr><td>
-
-
- <li class=small>
-
-
-
- <a class=menu_item href="/projects.cgi/web/opencores/mission"><font class=menu_item>Mission</font></a></li>
-
- </td></tr>
-
-
- <tr><td>
-
-
- <li class=small>
-
-
-
- <a class=menu_item href="/projects.cgi/web/opencores/media"><font class=menu_item>Media</font></a></li>
-
- </td></tr>
-
-
- <tr><td>
-
-
- <li class=small>
-
-
-
- <a class=menu_item href="/projects.cgi/web/opencores/tools"><font class=menu_item>Tools</font></a></li>
-
- </td></tr>
-
-
- <tr><td>
-
-
- <li class=small>
-
-
-
- <a class=menu_item href="/projects.cgi/web/opencores/sponsors"><font class=menu_item>Sponsors</font></a></li>
-
- </td></tr>
-
-
- <tr><td>
-
-
- <li class=small>
-
-
-
- <a class=menu_item href="/projects.cgi/web/opencores/mirrors"><font class=menu_item>Mirrors</font></a></li>
-
- </td></tr>
-
-
- <tr><td>
-
-
- <li class=small>
-
-
-
- <a class=menu_item href="/projects.cgi/web/opencores/logos"><font class=menu_item>Logos</font></a></li>
-
- </td></tr>
-
-
- <tr><td>
-
-
- <li class=small>
-
-
-
- <a class=menu_item href="/projects.cgi/web/opencores/contacts"><font class=menu_item>Contact us</font></a></li>
-
- </td></tr>
-
-
- <tr><td><font size=-2> </font></td></tr>
-
- <tr><td bgcolor="#347FB8">
- <img src="/images/bullet.gif">
-
- <font class=menu_section>Tools</font>
-
- </td></tr>
-
- <tr><td>
-
-
- <li class=small>
-
-
-
- <font class=menu_item><a href="/search.cgi">Search</a><br><table><tr><form action=/search.cgi/do_search><td><font class=small> </font></td><td><input class=searchfield type=text name=query></td></form></tr></table></font></li>
-
- </td></tr>
-
-
- <tr><td>
-
-
- <li class=small>
-
-
-
- <a class=menu_item href="/cvsget.shtml"><font class=menu_item>Download Cores (CVSGet)</font></a></li>
-
- </td></tr>
-
-
- <tr><td><font size=-2> </font></td></tr>
-
- <tr><td bgcolor="#347FB8">
- <img src="/images/bullet.gif">
-
- <font class=menu_section>More</font>
-
- </td></tr>
-
- <tr><td>
-
-
- <li class=small>
-
-
-
- <a class=menu_item href="/projects.cgi/web/wishbone/"><font class=menu_item>Wishbone</font></a></li>
-
- </td></tr>
-
-
- <tr><td>
-
-
- <li class=small>
-
-
-
- <a class=menu_item href="/projects.cgi/web/perlilog/"><font class=menu_item>Perlilog</font></a></li>
-
- </td></tr>
-
-
- <tr><td>
-
-
- <li class=small>
-
-
-
- <a class=menu_item href="/projects.cgi/web/edatools/"><font class=menu_item>EDA tools</font></a></li>
-
- </td></tr>
-
-
- <tr><td>
-
-
- <li class=small>
-
-
-
- <a class=menu_item href="/projects.cgi/web/opentech/"><font class=menu_item>OpenTech CD</font></a></li>
-
- </td></tr>
-
-
- <tr><td><font size=-2> </font></td></tr>
-
- </table>
- </td>
- <td width=10><img width=10 src="/images/dotty.gif"></td>
- <td background="/images/vpd.gif"><img width=1 src="/images/dotty.gif"></td>
- <td width=10><img width=10 src="/images/dotty.gif"></td>
- <td valign=top>
-
- <table width=100% cellpadding=2 cellspacing=0 border=0>
- <tr><td><img height=2 src="/images/dotty.gif"></td></tr>
- </table>
-
- <table width=100% cellspacing=0 cellpadding=0 border=0><tr><td>
- <!-- pf_body_start -->
-
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html>
- <head>
- <title>pci/rtl/verilog/pci_conf_space.v - view - 1.10</title>
- <meta name="robots" content="nofollow" />
- <meta name="generator" content="FreeBSD-CVSweb 3.0.5" />
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
- <meta http-equiv="Content-Style-Type" content="text/css" />
- <link rel="stylesheet" type="text/css" href="/css/cvsweb.css" />
- </head>
- <body class="src">
- <table class="navigate-header" width="100%" summary="Navigation">
- <tr>
- <td>
- <a href="./pci_conf_space.v#rev1.10"><img src="/icons/back.gif" alt="[BACK]" border="0" width="20" height="22" /></a><b>Return to <a href="./pci_conf_space.v#rev1.10">pci_conf_space.v</a> CVS log</b> <img src="/icons/text.gif" alt="[TXT]" border="0" width="20" height="22" /></td> <td style="text-align: right"><img src="/icons/dir.gif" alt="[DIR]" border="0" width="20" height="22" /> <b>Up to <a href="/cvsweb.shtml/#dirlist">[Official OpenCores CVS Repository]</a> / <a href="/cvsweb.shtml/pci/#dirlist">pci</a> / <a href="/cvsweb.shtml/pci/rtl/#dirlist">rtl</a> / <a href="/cvsweb.shtml/pci/rtl/verilog/#dirlist">verilog</a></b></td>
- </tr>
- </table>
- <hr />
- <div class="log-markup">
- File:
- <a href="/cvsweb.shtml/#dirlist">[Official OpenCores CVS Repository]</a> / <a href="/cvsweb.shtml/pci/#dirlist">pci</a> / <a href="/cvsweb.shtml/pci/rtl/#dirlist">rtl</a> / <a href="/cvsweb.shtml/pci/rtl/verilog/#dirlist">verilog</a> / <a href="/cvsweb.shtml/pci/rtl/verilog/pci_conf_space.v">pci_conf_space.v</a><br />
- <a name="rev1.10"></a><a name="HEAD"></a>
- Revision <b>1.10</b>: <a href="/cvsweb.cgi/~checkout~/pci/rtl/verilog/pci_conf_space.v?rev=1.10;content-type=text%2Fplain" class="download-link">download</a> - view: <a href="pci_conf_space.v?rev=1.10;content-type=text%2Fplain" class="display-link">text</a>, <a href="pci_conf_space.v?annotate=1.10">annotated</a> - <a href="pci_conf_space.v?r1=1.10#rev1.10">select for diffs</a><br />
- <i>Thu Aug 19 16:04:53 2004 UTC</i> (2 years, 8 months ago) by <i>mihad</i><br />
- Branches: <a href="./pci_conf_space.v?only_with_tag=MAIN">MAIN</a><br />
- CVS tags: <a href="./pci_conf_space.v?only_with_tag=HEAD">HEAD</a><br />
- <pre class="log">
- Removed some unused signals.
- </pre>
- </div>
- <hr /><pre>
- //////////////////////////////////////////////////////////////////////
- //// ////
- //// File name: pci_conf_space.v ////
- //// ////
- //// This file is part of the "PCI bridge" project ////
- //// http://www.opencores.org/cores/pci/ ////
- //// ////
- //// Author(s): ////
- //// - tadej@opencores.org ////
- //// - Tadej Markovic ////
- //// ////
- //// All additional information is avaliable in the README.txt ////
- //// file. ////
- //// ////
- //// ////
- //////////////////////////////////////////////////////////////////////
- //// ////
- //// Copyright (C) 2000 Tadej Markovic, tadej@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: pci_conf_space.v,v $
- // Revision 1.10 2004/08/19 16:04:53 mihad
- // Removed some unused signals.
- //
- // Revision 1.9 2004/08/19 15:27:34 mihad
- // Changed minimum pci image size to 256 bytes because
- // of some PC system problems with size of IO images.
- //
- // Revision 1.8 2004/07/07 12:45:01 mihad
- // Added SubsystemVendorID, SubsystemID, MAXLatency, MinGnt defines.
- // Enabled value loading from serial EEPROM for all of the above + VendorID and DeviceID registers.
- //
- // Revision 1.7 2004/01/24 11:54:18 mihad
- // Update! SPOCI Implemented!
- //
- // Revision 1.6 2003/12/28 09:54:48 fr2201
- // def_wb_imagex_addr_map defined correctly
- //
- // Revision 1.5 2003/12/28 09:20:00 fr2201
- // Reset values for PCI, WB defined (PCI_TAx,WB_BAx,WB_TAx,WB_AMx,WB_BAx_MEM_IO)
- //
- // Revision 1.4 2003/12/19 11:11:30 mihad
- // Compact PCI Hot Swap support added.
- // New testcases added.
- // Specification updated.
- // Test application changed to support WB B3 cycles.
- //
- // Revision 1.3 2003/08/14 13:06:02 simons
- // synchronizer_flop replaced with pci_synchronizer_flop, artisan ram instance updated.
- //
- // Revision 1.2 2003/03/26 13:16:18 mihad
- // Added the reset value parameter to the synchronizer flop module.
- // Added resets to all synchronizer flop instances.
- // Repaired initial sync value in fifos.
- //
- // Revision 1.1 2003/01/27 16:49:31 mihad
- // Changed module and file names. Updated scripts accordingly. FIFO synchronizations changed.
- //
- // Revision 1.4 2002/08/13 11:03:53 mihad
- // Added a few testcases. Repaired wrong reset value for PCI_AM5 register. Repaired Parity Error Detected bit setting. Changed PCI_AM0 to always enabled(regardles of PCI_AM0 define), if image 0 is used as configuration image
- //
- // Revision 1.3 2002/02/01 15:25:12 mihad
- // Repaired a few bugs, updated specification, added test bench files and design document
- //
- // Revision 1.2 2001/10/05 08:14:28 mihad
- // Updated all files with inclusion of timescale file for simulation purposes.
- //
- // Revision 1.1.1.1 2001/10/02 15:33:46 mihad
- // New project directory structure
- //
- //
- `include "pci_constants.v"
- // synopsys translate_off
- `include "timescale.v"
- // synopsys translate_on
- /*-----------------------------------------------------------------------------------------------------------
- w_ prefix is a sign for Write (and read) side of Dual-Port registers
- r_ prefix is a sign for Read only side of Dual-Port registers
- In the first line there are DATA and ADDRESS ports, in the second line there are write enable and read
- enable signals with chip-select (conf_hit) for config. space.
- In the third line there are output signlas from Command register of the PCI configuration header !!!
- In the fourth line there are input signals to Status register of the PCI configuration header !!!
- In the fifth line there is output from Latency Timer & r_Interrupt pin registers of the PCI conf. header !!!
- Following are IMAGE specific registers, from which PCI_BASE_ADDR registers are the same as base address
- registers from the PCI conf. header !!!
- -----------------------------------------------------------------------------------------------------------*/
- // normal R/W address, data and control
- module pci_conf_space
- ( w_conf_address_in, w_conf_data_in, w_conf_data_out, r_conf_address_in, r_conf_data_out,
- w_we_i, w_re, r_re, w_byte_en_in, w_clock, reset, pci_clk, wb_clk,
- // outputs from command register of the PCI header
- serr_enable, perr_response, pci_master_enable, memory_space_enable, io_space_enable,
- // inputs to status register of the PCI header
- perr_in, serr_in, master_abort_recv, target_abort_recv, target_abort_set, master_data_par_err,
- // output from cache_line_size, latency timer and r_interrupt_pin register of the PCI header
- cache_line_size_to_pci, cache_line_size_to_wb, cache_lsize_not_zero_to_wb,
- latency_tim,
- // output from all pci IMAGE registers
- pci_base_addr0, pci_base_addr1, pci_base_addr2, pci_base_addr3, pci_base_addr4, pci_base_addr5,
- pci_memory_io0, pci_memory_io1, pci_memory_io2, pci_memory_io3, pci_memory_io4, pci_memory_io5,
- pci_addr_mask0, pci_addr_mask1, pci_addr_mask2, pci_addr_mask3, pci_addr_mask4, pci_addr_mask5,
- pci_tran_addr0, pci_tran_addr1, pci_tran_addr2, pci_tran_addr3, pci_tran_addr4, pci_tran_addr5,
- pci_img_ctrl0, pci_img_ctrl1, pci_img_ctrl2, pci_img_ctrl3, pci_img_ctrl4, pci_img_ctrl5,
- // input to pci error control and status register, error address and error data registers
- pci_error_be, pci_error_bc, pci_error_rty_exp, pci_error_es, pci_error_sig, pci_error_addr,
- pci_error_data,
- // output from all wishbone IMAGE registers
- wb_base_addr0, wb_base_addr1, wb_base_addr2, wb_base_addr3, wb_base_addr4, wb_base_addr5,
- wb_memory_io0, wb_memory_io1, wb_memory_io2, wb_memory_io3, wb_memory_io4, wb_memory_io5,
- wb_addr_mask0, wb_addr_mask1, wb_addr_mask2, wb_addr_mask3, wb_addr_mask4, wb_addr_mask5,
- wb_tran_addr0, wb_tran_addr1, wb_tran_addr2, wb_tran_addr3, wb_tran_addr4, wb_tran_addr5,
- wb_img_ctrl0, wb_img_ctrl1, wb_img_ctrl2, wb_img_ctrl3, wb_img_ctrl4, wb_img_ctrl5,
- // input to wb error control and status register, error address and error data registers
- wb_error_be, wb_error_bc, wb_error_rty_exp, wb_error_es, wb_error_sig, wb_error_addr, wb_error_data,
- // output from conf. cycle generation register (sddress), int. control register & interrupt output
- config_addr, icr_soft_res, int_out,
- // input to interrupt status register
- isr_sys_err_int, isr_par_err_int, isr_int_prop,
- pci_init_complete_out, wb_init_complete_out
- `ifdef PCI_CPCI_HS_IMPLEMENT
- ,
- pci_cpci_hs_enum_oe_o, pci_cpci_hs_led_oe_o, pci_cpci_hs_es_i
- `endif
- `ifdef PCI_SPOCI
- ,
- spoci_scl_oe_o, spoci_sda_i, spoci_sda_oe_o
- `endif
- ) ;
- /*###########################################################################################################
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////
- Input and output ports
- ======================
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////
- ###########################################################################################################*/
- // output data
- output [31 : 0] w_conf_data_out ;
- output [31 : 0] r_conf_data_out ;
- reg [31 : 0] w_conf_data_out ;
- `ifdef NO_CNF_IMAGE
- `else
- reg [31 : 0] r_conf_data_out ;
- `endif
- // input data
- input [31 : 0] w_conf_data_in ;
- wire [31 : 0] w_conf_pdata_reduced ; // reduced data written into PCI image registers
- wire [31 : 0] w_conf_wdata_reduced ; // reduced data written into WB image registers
- // input address
- input [11 : 0] w_conf_address_in ;
- input [11 : 0] r_conf_address_in ;
- // input control signals
- input w_we_i ;
- input w_re ;
- input r_re ;
- input [3 : 0] w_byte_en_in ;
- input w_clock ;
- input reset ;
- input pci_clk ;
- input wb_clk ;
- // PCI header outputs from command register
- output serr_enable ;
- output perr_response ;
- output pci_master_enable ;
- output memory_space_enable ;
- output io_space_enable ;
- // PCI header inputs to status register
- input perr_in ;
- input serr_in ;
- input master_abort_recv ;
- input target_abort_recv ;
- input target_abort_set ;
- input master_data_par_err ;
- // PCI header output from cache_line_size, latency timer and interrupt pin
- output [7 : 0] cache_line_size_to_pci ; // sinchronized to PCI clock
- output [7 : 0] cache_line_size_to_wb ; // sinchronized to WB clock
- output cache_lsize_not_zero_to_wb ; // used in WBU and PCIU
- output [7 : 0] latency_tim ;
- //output [2 : 0] int_pin ; // only 3 LSbits are important!
- // PCI output from image registers
- `ifdef GUEST
- output [31:12] pci_base_addr0 ;
- `endif
- `ifdef HOST
- `ifdef NO_CNF_IMAGE
- output [31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] pci_base_addr0 ;
- `else
- output [31:12] pci_base_addr0 ;
- `endif
- `endif
- output [31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] pci_base_addr1 ;
- output [31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] pci_base_addr2 ;
- output [31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] pci_base_addr3 ;
- output [31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] pci_base_addr4 ;
- output [31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] pci_base_addr5 ;
- output pci_memory_io0 ;
- output pci_memory_io1 ;
- output pci_memory_io2 ;
- output pci_memory_io3 ;
- output pci_memory_io4 ;
- output pci_memory_io5 ;
- output [31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] pci_addr_mask0 ;
- output [31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] pci_addr_mask1 ;
- output [31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] pci_addr_mask2 ;
- output [31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] pci_addr_mask3 ;
- output [31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] pci_addr_mask4 ;
- output [31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] pci_addr_mask5 ;
- output [31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] pci_tran_addr0 ;
- output [31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] pci_tran_addr1 ;
- output [31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] pci_tran_addr2 ;
- output [31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] pci_tran_addr3 ;
- output [31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] pci_tran_addr4 ;
- output [31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] pci_tran_addr5 ;
- output [2 : 1] pci_img_ctrl0 ;
- output [2 : 1] pci_img_ctrl1 ;
- output [2 : 1] pci_img_ctrl2 ;
- output [2 : 1] pci_img_ctrl3 ;
- output [2 : 1] pci_img_ctrl4 ;
- output [2 : 1] pci_img_ctrl5 ;
- // PCI input to pci error control and status register, error address and error data registers
- input [3 : 0] pci_error_be ;
- input [3 : 0] pci_error_bc ;
- input pci_error_rty_exp ;
- input pci_error_es ;
- input pci_error_sig ;
- input [31 : 0] pci_error_addr ;
- input [31 : 0] pci_error_data ;
- // WISHBONE output from image registers
- output [31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] wb_base_addr0 ;
- output [31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] wb_base_addr1 ;
- output [31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] wb_base_addr2 ;
- output [31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] wb_base_addr3 ;
- output [31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] wb_base_addr4 ;
- output [31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] wb_base_addr5 ;
- output wb_memory_io0 ;
- output wb_memory_io1 ;
- output wb_memory_io2 ;
- output wb_memory_io3 ;
- output wb_memory_io4 ;
- output wb_memory_io5 ;
- output [31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] wb_addr_mask0 ;
- output [31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] wb_addr_mask1 ;
- output [31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] wb_addr_mask2 ;
- output [31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] wb_addr_mask3 ;
- output [31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] wb_addr_mask4 ;
- output [31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] wb_addr_mask5 ;
- output [31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] wb_tran_addr0 ;
- output [31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] wb_tran_addr1 ;
- output [31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] wb_tran_addr2 ;
- output [31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] wb_tran_addr3 ;
- output [31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] wb_tran_addr4 ;
- output [31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] wb_tran_addr5 ;
- output [2 : 0] wb_img_ctrl0 ;
- output [2 : 0] wb_img_ctrl1 ;
- output [2 : 0] wb_img_ctrl2 ;
- output [2 : 0] wb_img_ctrl3 ;
- output [2 : 0] wb_img_ctrl4 ;
- output [2 : 0] wb_img_ctrl5 ;
- // WISHBONE input to wb error control and status register, error address and error data registers
- input [3 : 0] wb_error_be ;
- input [3 : 0] wb_error_bc ;
- input wb_error_rty_exp ;
- input wb_error_es ;
- input wb_error_sig ;
- input [31 : 0] wb_error_addr ;
- input [31 : 0] wb_error_data ;
- // GENERAL output from conf. cycle generation register & int. control register
- output [23 : 0] config_addr ;
- output icr_soft_res ;
- output int_out ;
- // GENERAL input to interrupt status register
- input isr_sys_err_int ;
- input isr_par_err_int ;
- input isr_int_prop ;
- output pci_init_complete_out ;
- output wb_init_complete_out ;
- `ifdef PCI_CPCI_HS_IMPLEMENT
- output pci_cpci_hs_enum_oe_o ;
- output pci_cpci_hs_led_oe_o ;
- input pci_cpci_hs_es_i ;
- reg pci_cpci_hs_enum_oe_o ;
- reg pci_cpci_hs_led_oe_o ;
- // set the hot swap ejector switch debounce counter width
- // it is only 4 for simulation purposes
- `ifdef PCI_CPCI_SIM
- parameter hs_es_cnt_width = 4 ;
- `else
- `ifdef PCI33
-
- parameter hs_es_cnt_width = 16 ;
-
- `endif
-
- `ifdef PCI66
-
- parameter hs_es_cnt_width = 17 ;
-
- `endif
- `endif
- `endif
- `ifdef PCI_SPOCI
- output spoci_scl_oe_o ;
- input spoci_sda_i ;
- output spoci_sda_oe_o ;
- reg spoci_cs_nack,
- spoci_cs_write,
- spoci_cs_read;
- reg [10: 0] spoci_cs_adr ;
- reg [ 7: 0] spoci_cs_dat ;
- `endif
- /*###########################################################################################################
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////
- REGISTERS definition
- ====================
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////
- ###########################################################################################################*/
- // Decoded Register Select signals for writting (only one address decoder)
- reg [56 : 0] w_reg_select_dec ;
- /*###########################################################################################################
- -------------------------------------------------------------------------------------------------------------
- PCI CONFIGURATION SPACE HEADER (type 00h) registers
- BIST and some other registers are not implemented and therefor written in correct
- place with comment line. 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!
- -------------------------------------------------------------------------------------------------------------
- ###########################################################################################################*/
- /*-----------------------------------------------------------------------------------------------------------
- [000h-00Ch] First 4 DWORDs (32-bit) of PCI configuration header - the same regardless of the HEADER type !
- r_ prefix is a sign for read only registers
- Vendor_ID is an ID for a specific vendor defined by PCI_SIG - 2321h does not belong to anyone (e.g.
- Xilinx's Vendor_ID is 10EEh and Altera's Vendor_ID is 1172h). Device_ID and Revision_ID should be used
- together by application. Class_Code has 3 bytes to define BASE class (06h for PCI Bridge), SUB class
- (00h for HOST type, 80h for Other Bridge type) and Interface type (00h for normal).
- -----------------------------------------------------------------------------------------------------------*/
- reg [15: 0] r_vendor_id ;
- reg [15: 0] r_device_id ;
- reg [15: 0] r_subsys_vendor_id ;
- reg [15: 0] r_subsys_id ;
- reg command_bit8 ;
- reg command_bit6 ;
- reg [2 : 0] command_bit2_0 ;
- reg [15 : 11] status_bit15_11 ;
- parameter r_status_bit10_9 = 2'b01 ; // 2'b01 means MEDIUM devsel timing !!!
- reg status_bit8 ;
- parameter r_status_bit7 = 1'b1 ; // fast back-to-back capable response !!!
- parameter r_status_bit5 = `HEADER_66MHz ; // 1'b0 indicates 33 MHz capable !!!
- `ifdef PCI_CPCI_HS_IMPLEMENT
- wire r_status_bit4 = 1 ;
- reg hs_ins ;
- reg hs_ext ;
- wire [ 1: 0] hs_pi = 2'b00 ;
- reg hs_loo ;
- reg hs_eim ;
- wire [ 7: 0] hs_cap_id = 8'h06 ;
- reg hs_ins_armed ;
- reg hs_ext_armed ;
- `else
- wire r_status_bit4 = 0 ;
- `endif
- 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 !!!!!
- /*###########################################################################################################
- -------------------------------------------------------------------------------------------------------------
- General Interrupt 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.
- -------------------------------------------------------------------------------------------------------------
- ###########################################################################################################*/
- /*-----------------------------------------------------------------------------------------------------------
- [FF8h-FFCh]
- Bit 31 in the Interrupt Control register is set by software and used to generate SOFT RESET. Other 4
- bits are used to enable interrupt generations.
- 5 LSbits in the Interrupt Status register are indicating System Error Int, Parity Error Int, PCI & WB
- Error Int and Inerrupt respecively. System and Parity errors are implented only in HOST bridge
- implementations!
- -----------------------------------------------------------------------------------------------------------*/
- reg icr_bit31 ;
- `ifdef HOST
- reg [4 : 3] icr_bit4_3 ;
- reg [4 : 3] isr_bit4_3 ;
- reg [2 : 0] icr_bit2_0 ;
- reg [2 : 0] isr_bit2_0 ;
- `else // GUEST
- wire [4 : 3] icr_bit4_3 = 2'h0 ;
- wire [4 : 3] isr_bit4_3 = 2'h0 ;
- reg [2 : 0] icr_bit2_0 ;
- reg [2 : 0] isr_bit2_0 ;
- `endif
- /*###########################################################################################################
- -------------------------------------------------------------------------------------------------------------
- Initialization complete identifier
- When using I2C or similar initialisation mechanism,
- the bridge must not respond to transaction requests on PCI bus,
- not even to configuration cycles.
- Therefore, only when init_complete is set, the bridge starts
- participating on the PCI bus as an active device.
- Two additional flip flops are also provided for GUEST implementation,
- to synchronize to the pci clock after PCI reset is asynchronously de-asserted.
- -------------------------------------------------------------------------------------------------------------
- ###########################################################################################################*/
- `ifdef GUEST
- reg rst_inactive_sync ;
- reg rst_inactive ;
- `else
- wire rst_inactive = 1'b1 ;
- `endif
- reg init_complete ;
- wire sync_init_complete ;
- `ifdef HOST
- assign wb_init_complete_out = init_complete ;
- pci_synchronizer_flop #(1, 0) i_pci_init_complete_sync
- (
- .data_in ( init_complete ),
- .clk_out ( pci_clk ),
- .sync_data_out ( sync_init_complete ),
- .async_reset ( reset )
- );
- reg pci_init_complete_out ;
- always@(posedge pci_clk or posedge reset)
- begin
- if (reset)
- pci_init_complete_out <= 1'b0 ;
- else
- pci_init_complete_out <= sync_init_complete ;
- end
- `endif
- `ifdef GUEST
- assign pci_init_complete_out = init_complete ;
- pci_synchronizer_flop #(1, 0) i_wb_init_complete_sync
- (
- .data_in ( init_complete ),
- .clk_out ( wb_clk ),
- .sync_data_out ( sync_init_complete ),
- .async_reset ( reset )
- );
- reg wb_init_complete_out ;
- always@(posedge wb_clk or posedge reset)
- begin
- if (reset)
- wb_init_complete_out <= 1'b0 ;
- else
- wb_init_complete_out <= sync_init_complete ;
- end
- `endif
- /*###########################################################################################################
- -------------------------------------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------------------------------*/
- `ifdef NO_CNF_IMAGE // if IMAGE0 is assigned as general image space
- assign r_conf_data_out = 32'h0000_0000 ;
- `else
- always@(r_conf_address_in or
- status_bit15_11 or status_bit8 or r_status_bit4 or command_bit8 or command_bit6 or command_bit2_0 or
- latency_timer or cache_line_size_reg or r_vendor_id or r_device_id or r_revision_id or
- r_subsys_vendor_id or r_subsys_id or r_max_lat or r_min_gnt or
- pci_ba0_bit31_8 or
- pci_img_ctrl0_bit2_1 or pci_am0 or pci_ta0 or pci_ba0_bit0 or
- pci_img_ctrl1_bit2_1 or pci_am1 or pci_ta1 or pci_ba1_bit31_8 or pci_ba1_bit0 or
- pci_img_ctrl2_bit2_1 or pci_am2 or pci_ta2 or pci_ba2_bit31_8 or pci_ba2_bit0 or
- pci_img_ctrl3_bit2_1 or pci_am3 or pci_ta3 or pci_ba3_bit31_8 or pci_ba3_bit0 or
- pci_img_ctrl4_bit2_1 or pci_am4 or pci_ta4 or pci_ba4_bit31_8 or pci_ba4_bit0 or
- pci_img_ctrl5_bit2_1 or pci_am5 or pci_ta5 or pci_ba5_bit31_8 or pci_ba5_bit0 or
- interrupt_line or
- pci_err_cs_bit31_24 or pci_err_cs_bit10 or pci_err_cs_bit9 or pci_err_cs_bit8 or pci_err_cs_bit0 or
- pci_err_addr or pci_err_data or
- wb_ba0_bit31_12 or wb_ba0_bit0 or
- wb_img_ctrl1_bit2_0 or wb_ba1_bit31_12 or wb_ba1_bit0 or wb_am1 or wb_ta1 or
- wb_img_ctrl2_bit2_0 or wb_ba2_bit31_12 or wb_ba2_bit0 or wb_am2 or wb_ta2 or
- wb_img_ctrl3_bit2_0 or wb_ba3_bit31_12 or wb_ba3_bit0 or wb_am3 or wb_ta3 or
- wb_img_ctrl4_bit2_0 or wb_ba4_bit31_12 or wb_ba4_bit0 or wb_am4 or wb_ta4 or
- wb_img_ctrl5_bit2_0 or wb_ba5_bit31_12 or wb_ba5_bit0 or wb_am5 or wb_ta5 or
- wb_err_cs_bit31_24 or /*wb_err_cs_bit10 or*/ wb_err_cs_bit9 or wb_err_cs_bit8 or wb_err_cs_bit0 or
- wb_err_addr or wb_err_data or
- cnf_addr_bit23_2 or cnf_addr_bit0 or icr_bit31 or icr_bit4_3 or icr_bit2_0 or isr_bit4_3 or isr_bit2_0
- `ifdef PCI_CPCI_HS_IMPLEMENT
- or hs_ins or hs_ext or hs_pi or hs_loo or hs_eim or hs_cap_id
- `endif
- `ifdef PCI_SPOCI
- or spoci_cs_nack or spoci_cs_write or spoci_cs_read or spoci_cs_adr or spoci_cs_dat
- `endif
- )
- begin
- case (r_conf_address_in[9:2])
- // PCI header - configuration space
- 8'h0: r_conf_data_out = { r_device_id, r_vendor_id } ;
- 8'h1: r_conf_data_out = { status_bit15_11, r_status_bit10_9, status_bit8, r_status_bit7, 1'h0, r_status_bit5, r_status_bit4,
- 4'h0, 7'h00, command_bit8, 1'h0, command_bit6, 3'h0, command_bit2_0 } ;
- 8'h2: r_conf_data_out = { r_class_code, r_revision_id } ;
- 8'h3: r_conf_data_out = { 8'h00, r_header_type, latency_timer, cache_line_size_reg } ;
- 8'h4:
- begin
- `ifdef HOST
- `ifdef NO_CNF_IMAGE
- r_conf_data_out[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] = pci_ba0_bit31_8[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] &
- pci_am0[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] ;
- r_conf_data_out[(31-`PCI_NUM_OF_DEC_ADDR_LINES):1] = 0 ;
- r_conf_data_out[0] = pci_ba0_bit0 & pci_am0[31];
- `else
- r_conf_data_out[31:12] = pci_ba0_bit31_8[31:12] ;
- r_conf_data_out[11: 0] = 12'h000 ;
- `endif
- `endif
- `ifdef GUEST
- r_conf_data_out[31:12] = pci_ba0_bit31_8[31:12] ;
- r_conf_data_out[11: 0] = 12'h000 ;
- `endif
- end
- 8'h5:
- begin
- r_conf_data_out[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] = pci_ba1_bit31_8[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] &
- pci_am1[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] ;
- r_conf_data_out[(31-`PCI_NUM_OF_DEC_ADDR_LINES):1] = 0 ;
- r_conf_data_out[0] = pci_ba1_bit0 & pci_am1[31];
- end
- 8'h6:
- begin
- r_conf_data_out[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] = pci_ba2_bit31_8[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] &
- pci_am2[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] ;
- r_conf_data_out[(31-`PCI_NUM_OF_DEC_ADDR_LINES):1] = 0 ;
- r_conf_data_out[0] = pci_ba2_bit0 & pci_am2[31];
- end
- 8'h7:
- begin
- r_conf_data_out[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] = pci_ba3_bit31_8[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] &
- pci_am3[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] ;
- r_conf_data_out[(31-`PCI_NUM_OF_DEC_ADDR_LINES):1] = 0 ;
- r_conf_data_out[0] = pci_ba3_bit0 & pci_am3[31];
- end
- 8'h8:
- begin
- r_conf_data_out[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] = pci_ba4_bit31_8[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] &
- pci_am4[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] ;
- r_conf_data_out[(31-`PCI_NUM_OF_DEC_ADDR_LINES):1] = 0 ;
- r_conf_data_out[0] = pci_ba4_bit0 & pci_am4[31];
- end
- 8'h9:
- begin
- r_conf_data_out[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] = pci_ba5_bit31_8[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] &
- pci_am5[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] ;
- r_conf_data_out[(31-`PCI_NUM_OF_DEC_ADDR_LINES):1] = 0 ;
- r_conf_data_out[0] = pci_ba5_bit0 & pci_am5[31];
- end
- 8'hB:
- begin
- r_conf_data_out = {r_subsys_id, r_subsys_vendor_id} ;
- end
- `ifdef PCI_CPCI_HS_IMPLEMENT
- 8'hD:
- begin
- r_conf_data_out = {24'h0000_00, `PCI_CAP_PTR_VAL} ;
- end
- `endif
- 8'hf: r_conf_data_out = { r_max_lat, r_min_gnt, r_interrupt_pin, interrupt_line } ;
- `ifdef PCI_CPCI_HS_IMPLEMENT
- (`PCI_CAP_PTR_VAL >> 2):
- begin
- r_conf_data_out = {8'h00, hs_ins, hs_ext, hs_pi, hs_loo, 1'b0, hs_eim, 1'b0, 8'h00, hs_cap_id} ;
- end
- `endif
- // PCI target - configuration space
- {2'b01, `P_IMG_CTRL0_ADDR}: r_conf_data_out = { 29'h00000000, pci_img_ctrl0_bit2_1, 1'h0 } ;
- {2'b01, `P_BA0_ADDR} :
- begin
- `ifdef HOST
- `ifdef NO_CNF_IMAGE
- r_conf_data_out[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] = pci_ba0_bit31_8[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] &
- pci_am0[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] ;
- r_conf_data_out[(31-`PCI_NUM_OF_DEC_ADDR_LINES):1] = 0 ;
- r_conf_data_out[0] = pci_ba0_bit0 & pci_am0[31];
- `else
- r_conf_data_out[31:12] = pci_ba0_bit31_8[31:12] ;
- r_conf_data_out[11: 0] = 12'h000 ;
- `endif
- `endif
- `ifdef GUEST
- r_conf_data_out[31:12] = pci_ba0_bit31_8[31:12] ;
- r_conf_data_out[11: 0] = 12'h000 ;
- `endif
- end
- {2'b01, `P_AM0_ADDR}:
- begin
- `ifdef HOST
- `ifdef NO_CNF_IMAGE
- r_conf_data_out[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] = pci_am0[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] ;
- r_conf_data_out[(31-`PCI_NUM_OF_DEC_ADDR_LINES):0] = 0 ;
- `else
- r_conf_data_out[31:12] = pci_am0[31:12] ;
- r_conf_data_out[11: 0] = 12'h000 ;
- `endif
- `endif
- `ifdef GUEST
- r_conf_data_out[31:12] = pci_am0[31:12] ;
- r_conf_data_out[11: 0] = 12'h000 ;
- `endif
- end
- {2'b01, `P_TA0_ADDR}:
- begin
- r_conf_data_out[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] = pci_ta0[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] ;
- r_conf_data_out[(31-`PCI_NUM_OF_DEC_ADDR_LINES):0] = 0 ;
- end
- {2'b01, `P_IMG_CTRL1_ADDR}: r_conf_data_out = { 29'h00000000, pci_img_ctrl1_bit2_1, 1'h0 } ;
- {2'b01, `P_BA1_ADDR}:
- begin
- r_conf_data_out[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] = pci_ba1_bit31_8[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] &
- pci_am1[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] ;
- r_conf_data_out[(31-`PCI_NUM_OF_DEC_ADDR_LINES):1] = 0 ;
- r_conf_data_out[0] = pci_ba1_bit0 & pci_am1[31];
- end
- {2'b01, `P_AM1_ADDR}:
- begin
- r_conf_data_out[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] = pci_am1[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] ;
- r_conf_data_out[(31-`PCI_NUM_OF_DEC_ADDR_LINES):0] = 0 ;
- end
- {2'b01, `P_TA1_ADDR}:
- begin
- r_conf_data_out[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] = pci_ta1[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] ;
- r_conf_data_out[(31-`PCI_NUM_OF_DEC_ADDR_LINES):0] = 0 ;
- end
- {2'b01, `P_IMG_CTRL2_ADDR}: r_conf_data_out = { 29'h00000000, pci_img_ctrl2_bit2_1, 1'h0 } ;
- {2'b01, `P_BA2_ADDR}:
- begin
- r_conf_data_out[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] = pci_ba2_bit31_8[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] &
- pci_am2[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] ;
- r_conf_data_out[(31-`PCI_NUM_OF_DEC_ADDR_LINES):1] = 0 ;
- r_conf_data_out[0] = pci_ba2_bit0 & pci_am2[31];
- end
- {2'b01, `P_AM2_ADDR}:
- begin
- r_conf_data_out[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] = pci_am2[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] ;
- r_conf_data_out[(31-`PCI_NUM_OF_DEC_ADDR_LINES):0] = 0 ;
- end
- {2'b01, `P_TA2_ADDR}:
- begin
- r_conf_data_out[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] = pci_ta2[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] ;
- r_conf_data_out[(31-`PCI_NUM_OF_DEC_ADDR_LINES):0] = 0 ;
- end
- {2'b01, `P_IMG_CTRL3_ADDR}: r_conf_data_out = { 29'h00000000, pci_img_ctrl3_bit2_1, 1'h0 } ;
- {2'b01, `P_BA3_ADDR}:
- begin
- r_conf_data_out[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] = pci_ba3_bit31_8[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] &
- pci_am3[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] ;
- r_conf_data_out[(31-`PCI_NUM_OF_DEC_ADDR_LINES):1] = 0 ;
- r_conf_data_out[0] = pci_ba3_bit0 & pci_am3[31];
- end
- {2'b01, `P_AM3_ADDR}:
- begin
- r_conf_data_out[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] = pci_am3[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] ;
- r_conf_data_out[(31-`PCI_NUM_OF_DEC_ADDR_LINES):0] = 0 ;
- end
- {2'b01, `P_TA3_ADDR}:
- begin
- r_conf_data_out[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] = pci_ta3[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] ;
- r_conf_data_out[(31-`PCI_NUM_OF_DEC_ADDR_LINES):0] = 0 ;
- end
- {2'b01, `P_IMG_CTRL4_ADDR}: r_conf_data_out = { 29'h00000000, pci_img_ctrl4_bit2_1, 1'h0 } ;
- {2'b01, `P_BA4_ADDR}:
- begin
- r_conf_data_out[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] = pci_ba4_bit31_8[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] &
- pci_am4[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] ;
- r_conf_data_out[(31-`PCI_NUM_OF_DEC_ADDR_LINES):1] = 0 ;
- r_conf_data_out[0] = pci_ba4_bit0 & pci_am4[31];
- end
- {2'b01, `P_AM4_ADDR}:
- begin
- r_conf_data_out[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] = pci_am4[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] ;
- r_conf_data_out[(31-`PCI_NUM_OF_DEC_ADDR_LINES):0] = 0 ;
- end
- {2'b01, `P_TA4_ADDR}:
- begin
- r_conf_data_out[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] = pci_ta4[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] ;
- r_conf_data_out[(31-`PCI_NUM_OF_DEC_ADDR_LINES):0] = 0 ;
- end
- {2'b01, `P_IMG_CTRL5_ADDR}: r_conf_data_out = { 29'h00000000, pci_img_ctrl5_bit2_1, 1'h0 } ;
- {2'b01, `P_BA5_ADDR}:
- begin
- r_conf_data_out[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] = pci_ba5_bit31_8[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] &
- pci_am5[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] ;
- r_conf_data_out[(31-`PCI_NUM_OF_DEC_ADDR_LINES):1] = 0 ;
- r_conf_data_out[0] = pci_ba5_bit0 & pci_am5[31];
- end
- {2'b01, `P_AM5_ADDR}:
- begin
- r_conf_data_out[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] = pci_am5[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] ;
- r_conf_data_out[(31-`PCI_NUM_OF_DEC_ADDR_LINES):0] = 0 ;
- end
- {2'b01, `P_TA5_ADDR}:
- begin
- r_conf_data_out[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] = pci_ta5[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] ;
- r_conf_data_out[(31-`PCI_NUM_OF_DEC_ADDR_LINES):0] = 0 ;
- end
- {2'b01, `P_ERR_CS_ADDR}: r_conf_data_out = { pci_err_cs_bit31_24, 13'h0000, pci_err_cs_bit10, pci_err_cs_bit9,
- pci_err_cs_bit8, 7'h00, pci_err_cs_bit0 } ;
- {2'b01, `P_ERR_ADDR_ADDR}: r_conf_data_out = pci_err_addr ;
- {2'b01, `P_ERR_DATA_ADDR}: r_conf_data_out = pci_err_data ;
- // WB slave - configuration space
- {2'b01, `WB_CONF_SPC_BAR_ADDR}: r_conf_data_out = { wb_ba0_bit31_12, 11'h000, wb_ba0_bit0 } ;
- {2'b01, `W_IMG_CTRL1_ADDR}: r_conf_data_out = { 29'h00000000, wb_img_ctrl1_bit2_0 } ;
- {2'b01, `W_BA1_ADDR}:
- begin
- r_conf_data_out[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] = wb_ba1_bit31_12[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] &
- wb_am1[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] ;
- r_conf_data_out[(31-`WB_NUM_OF_DEC_ADDR_LINES):1] = 0 ;
- r_conf_data_out[0] = wb_ba1_bit0 ;
- end
- {2'b01, `W_AM1_ADDR}:
- begin
- r_conf_data_out[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] = wb_am1[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] ;
- r_conf_data_out[(31-`WB_NUM_OF_DEC_ADDR_LINES):0] = 0 ;
- end
- {2'b01, `W_TA1_ADDR}:
- begin
- r_conf_data_out[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] = wb_ta1[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] ;
- r_conf_data_out[(31-`WB_NUM_OF_DEC_ADDR_LINES):0] = 0 ;
- end
- {2'b01, `W_IMG_CTRL2_ADDR}: r_conf_data_out = { 29'h00000000, wb_img_ctrl2_bit2_0 } ;
- `W_BA2_ADDR :
- begin
- r_conf_data_out[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] = wb_ba2_bit31_12[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] &
- wb_am2[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] ;
- r_conf_data_out[(31-`WB_NUM_OF_DEC_ADDR_LINES):1] = 0 ;
- r_conf_data_out[0] = wb_ba2_bit0 ;
- end
- {2'b01, `W_AM2_ADDR}:
- begin
- r_conf_data_out[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] = wb_am2[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] ;
- r_conf_data_out[(31-`WB_NUM_OF_DEC_ADDR_LINES):0] = 0 ;
- end
- {2'b01, `W_TA2_ADDR}:
- begin
- r_conf_data_out[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] = wb_ta2[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] ;
- r_conf_data_out[(31-`WB_NUM_OF_DEC_ADDR_LINES):0] = 0 ;
- end
- {2'b01, `W_IMG_CTRL3_ADDR}: r_conf_data_out = { 29'h00000000, wb_img_ctrl3_bit2_0 } ;
- {2'b01, `W_BA3_ADDR}:
- begin
- r_conf_data_out[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] = wb_ba3_bit31_12[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] &
- wb_am3[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] ;
- r_conf_data_out[(31-`WB_NUM_OF_DEC_ADDR_LINES):1] = 0 ;
- r_conf_data_out[0] = wb_ba3_bit0 ;
- end
- {2'b01, `W_AM3_ADDR}:
- begin
- r_conf_data_out[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] = wb_am3[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] ;
- r_conf_data_out[(31-`WB_NUM_OF_DEC_ADDR_LINES):0] = 0 ;
- end
- {2'b01, `W_TA3_ADDR}:
- begin
- r_conf_data_out[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] = wb_ta3[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] ;
- r_conf_data_out[(31-`WB_NUM_OF_DEC_ADDR_LINES):0] = 0 ;
- end
- {2'b01, `W_IMG_CTRL4_ADDR}: r_conf_data_out = { 29'h00000000, wb_img_ctrl4_bit2_0 } ;
- {2'b01, `W_BA4_ADDR}:
- begin
- r_conf_data_out[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] = wb_ba4_bit31_12[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] &
- wb_am4[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] ;
- r_conf_data_out[(31-`WB_NUM_OF_DEC_ADDR_LINES):1] = 0 ;
- r_conf_data_out[0] = wb_ba4_bit0 ;
- end
- {2'b01, `W_AM4_ADDR}:
- begin
- r_conf_data_out[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] = wb_am4[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] ;
- r_conf_data_out[(31-`WB_NUM_OF_DEC_ADDR_LINES):0] = 0 ;
- end
- {2'b01, `W_TA4_ADDR}:
- begin
- r_conf_data_out[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] = wb_ta4[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] ;
- r_conf_data_out[(31-`WB_NUM_OF_DEC_ADDR_LINES):0] = 0 ;
- end
- {2'b01, `W_IMG_CTRL5_ADDR}: r_conf_data_out = { 29'h00000000, wb_img_ctrl5_bit2_0 } ;
- {2'b01, `W_BA5_ADDR}:
- begin
- r_conf_data_out[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] = wb_ba5_bit31_12[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] &
- wb_am5[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] ;
- r_conf_data_out[(31-`WB_NUM_OF_DEC_ADDR_LINES):1] = 0 ;
- r_conf_data_out[0] = wb_ba5_bit0 ;
- end
- {2'b01, `W_AM5_ADDR}:
- begin
- r_conf_data_out[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] = wb_am5[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] ;
- r_conf_data_out[(31-`WB_NUM_OF_DEC_ADDR_LINES):0] = 0 ;
- end
- {2'b01, `W_TA5_ADDR}:
- begin
- r_conf_data_out[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] = wb_ta5[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] ;
- r_conf_data_out[(31-`WB_NUM_OF_DEC_ADDR_LINES):0] = 0 ;
- end
- {2'b01, `W_ERR_CS_ADDR}: r_conf_data_out = { wb_err_cs_bit31_24, /*13*/14'h0000, /*wb_err_cs_bit10,*/
- wb_err_cs_bit9, wb_err_cs_bit8, 7'h00, wb_err_cs_bit0 } ;
- {2'b01, `W_ERR_ADDR_ADDR}: r_conf_data_out = wb_err_addr ;
- {2'b01, `W_ERR_DATA_ADDR}: r_conf_data_out = wb_err_data ;
- {2'b01, `CNF_ADDR_ADDR}: r_conf_data_out = { 8'h00, cnf_addr_bit23_2, 1'h0, cnf_addr_bit0 } ;
- // `CNF_DATA_ADDR: implemented elsewhere !!!
- // `INT_ACK_ADDR : implemented elsewhere !!!
- {2'b01, `ICR_ADDR}: r_conf_data_out = { icr_bit31, 26'h0000_000, icr_bit4_3, icr_bit2_0 } ;
- {2'b01, `ISR_ADDR}: r_conf_data_out = { 27'h0000_000, isr_bit4_3, isr_bit2_0 } ;
- `ifdef PCI_SPOCI
- 8'hff: r_conf_data_out = {spoci_cs_nack, 5'h0, spoci_cs_write, spoci_cs_read,
- 5'h0, spoci_cs_adr[10:8],
- spoci_cs_adr[7:0],
- spoci_cs_dat[7:0]} ;
- `endif
- default : r_conf_data_out = 32'h0000_0000 ;
- endcase
- end
- `endif
- `ifdef PCI_SPOCI
- reg [ 7: 0] spoci_reg_num ;
- wire [11: 0] w_conf_address = init_complete ? w_conf_address_in : {2'b00, spoci_reg_num, 2'b00} ;
- `else
- wire [11: 0] w_conf_address = w_conf_address_in ;
- wire [ 7: 0] spoci_reg_num = 'hff ;
- `endif
- always@(w_conf_address or
- status_bit15_11 or status_bit8 or r_status_bit4 or command_bit8 or command_bit6 or command_bit2_0 or
- latency_timer or cache_line_size_reg or r_vendor_id or r_device_id or r_revision_id or
- r_subsys_id or r_subsys_vendor_id or r_max_lat or r_min_gnt or
- pci_ba0_bit31_8 or
- pci_img_ctrl0_bit2_1 or pci_am0 or pci_ta0 or pci_ba0_bit0 or
- pci_img_ctrl1_bit2_1 or pci_am1 or pci_ta1 or pci_ba1_bit31_8 or pci_ba1_bit0 or
- pci_img_ctrl2_bit2_1 or pci_am2 or pci_ta2 or pci_ba2_bit31_8 or pci_ba2_bit0 or
- pci_img_ctrl3_bit2_1 or pci_am3 or pci_ta3 or pci_ba3_bit31_8 or pci_ba3_bit0 or
- pci_img_ctrl4_bit2_1 or pci_am4 or pci_ta4 or pci_ba4_bit31_8 or pci_ba4_bit0 or
- pci_img_ctrl5_bit2_1 or pci_am5 or pci_ta5 or pci_ba5_bit31_8 or pci_ba5_bit0 or
- interrupt_line or
- pci_err_cs_bit31_24 or pci_err_cs_bit10 or pci_err_cs_bit9 or pci_err_cs_bit8 or pci_err_cs_bit0 or
- pci_err_addr or pci_err_data or
- wb_ba0_bit31_12 or wb_ba0_bit0 or
- wb_img_ctrl1_bit2_0 or wb_ba1_bit31_12 or wb_ba1_bit0 or wb_am1 or wb_ta1 or
- wb_img_ctrl2_bit2_0 or wb_ba2_bit31_12 or wb_ba2_bit0 or wb_am2 or wb_ta2 or
- wb_img_ctrl3_bit2_0 or wb_ba3_bit31_12 or wb_ba3_bit0 or wb_am3 or wb_ta3 or
- wb_img_ctrl4_bit2_0 or wb_ba4_bit31_12 or wb_ba4_bit0 or wb_am4 or wb_ta4 or
- wb_img_ctrl5_bit2_0 or wb_ba5_bit31_12 or wb_ba5_bit0 or wb_am5 or wb_ta5 or
- wb_err_cs_bit31_24 or /*wb_err_cs_bit10 or*/ wb_err_cs_bit9 or wb_err_cs_bit8 or wb_err_cs_bit0 or
- wb_err_addr or wb_err_data or
- cnf_addr_bit23_2 or cnf_addr_bit0 or icr_bit31 or icr_bit4_3 or icr_bit2_0 or isr_bit4_3 or isr_bit2_0
- `ifdef PCI_CPCI_HS_IMPLEMENT
- or hs_ins or hs_ext or hs_pi or hs_loo or hs_eim or hs_cap_id
- `endif
- `ifdef PCI_SPOCI
- or spoci_cs_nack or spoci_cs_write or spoci_cs_read or spoci_cs_adr or spoci_cs_dat
- `endif
- )
- begin
- case (w_conf_address[9:2])
- 8'h0:
- begin
- w_conf_data_out = { r_device_id, r_vendor_id } ;
- w_reg_select_dec = 57'h000_0000_0000_0000 ; // Read-Only register
- end
- 8'h1: // w_reg_select_dec bit 0
- begin
- w_conf_data_out = { status_bit15_11, r_status_bit10_9, status_bit8, r_status_bit7, 1'h0, r_status_bit5, r_status_bit4,
- 4'h0, 7'h00, command_bit8, 1'h0, command_bit6, 3'h0, command_bit2_0 } ;
- w_reg_select_dec = 57'h000_0000_0000_0001 ;
- end
- 8'h2:
- begin
- w_conf_data_out = { r_class_code, r_revision_id } ;
- w_reg_select_dec = 57'h000_0000_0000_0000 ; // Read-Only register
- end
- 8'h3: // w_reg_select_dec bit 1
- begin
- w_conf_data_out = { 8'h00, r_header_type, latency_timer, cache_line_size_reg } ;
- w_reg_select_dec = 57'h000_0000_0000_0002 ;
- end
- 8'h4: // w_reg_select_dec bit 4
- begin
- `ifdef HOST
- `ifdef NO_CNF_IMAGE
- w_conf_data_out[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] = pci_ba0_bit31_8[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] &
- pci_am0[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] ;
- w_conf_data_out[(31-`PCI_NUM_OF_DEC_ADDR_LINES):1] = 0 ;
- w_conf_data_out[0] = pci_ba0_bit0 & pci_am0[31];
- `else
- w_conf_data_out[31:12] = pci_ba0_bit31_8[31:12] ;
- w_conf_data_out[11: 0] = 12'h000 ;
- `endif
- `endif
- `ifdef GUEST
- w_conf_data_out[31:12] = pci_ba0_bit31_8[31:12] ;
- w_conf_data_out[11: 0] = 12'h000 ;
- `endif
- w_reg_select_dec = 57'h000_0000_0000_0010 ; // The same for another address
- end
- 8'h5: // w_reg_select_dec bit 8
- begin
- w_conf_data_out[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] = pci_ba1_bit31_8[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] &
- pci_am1[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] ;
- w_conf_data_out[(31-`PCI_NUM_OF_DEC_ADDR_LINES):1] = 0 ;
- w_conf_data_out[0] = pci_ba1_bit0 & pci_am1[31];
- w_reg_select_dec = 57'h000_0000_0000_0100 ; // The same for another address
- end
- 8'h6: // w_reg_select_dec bit 12
- begin
- w_conf_data_out[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] = pci_ba2_bit31_8[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] &
- pci_am2[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] ;
- w_conf_data_out[(31-`PCI_NUM_OF_DEC_ADDR_LINES):1] = 0 ;
- w_conf_data_out[0] = pci_ba2_bit0 & pci_am2[31];
- w_reg_select_dec = 57'h000_0000_0000_1000 ; // The same for another address
- end
- 8'h7: // w_reg_select_dec bit 16
- begin
- w_conf_data_out[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] = pci_ba3_bit31_8[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] &
- pci_am3[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] ;
- w_conf_data_out[(31-`PCI_NUM_OF_DEC_ADDR_LINES):1] = 0 ;
- w_conf_data_out[0] = pci_ba3_bit0 & pci_am3[31];
- w_reg_select_dec = 57'h000_0000_0001_0000 ; // The same for another address
- end
- 8'h8: // w_reg_select_dec bit 20
- begin
- w_conf_data_out[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] = pci_ba4_bit31_8[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] &
- pci_am4[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] ;
- w_conf_data_out[(31-`PCI_NUM_OF_DEC_ADDR_LINES):1] = 0 ;
- w_conf_data_out[0] = pci_ba4_bit0 & pci_am4[31];
- w_reg_select_dec = 57'h000_0000_0010_0000 ; // The same for another address
- end
- 8'h9: // w_reg_select_dec bit 24
- begin
- w_conf_data_out[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] = pci_ba5_bit31_8[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] &
- pci_am5[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] ;
- w_conf_data_out[(31-`PCI_NUM_OF_DEC_ADDR_LINES):1] = 0 ;
- w_conf_data_out[0] = pci_ba5_bit0 & pci_am5[31];
- w_reg_select_dec = 57'h000_0000_0100_0000 ; // The same for another address
- end
- 8'hB:
- begin
- w_conf_data_out = {r_subsys_id, r_subsys_vendor_id} ;
- w_reg_select_dec = 57'h000_0000_0000_0000 ;
- end
- `ifdef PCI_CPCI_HS_IMPLEMENT
- 8'hD:
- begin
- w_conf_data_out = {24'h0000_00, `PCI_CAP_PTR_VAL} ;
- w_reg_select_dec = 57'h000_0000_0000_0000 ; // Read-Only register
- end
- `endif
- 8'hf: // w_reg_select_dec bit 2
- begin
- w_conf_data_out = { r_max_lat, r_min_gnt, r_interrupt_pin, interrupt_line } ;
- w_reg_select_dec = 57'h000_0000_0000_0004 ;
- end
- `ifdef PCI_CPCI_HS_IMPLEMENT
- (`PCI_CAP_PTR_VAL >> 2):
- begin
- w_reg_select_dec = 57'h100_0000_0000_0000 ;
- w_conf_data_out = {8'h00, hs_ins, hs_ext, hs_pi, hs_loo, 1'b0, hs_eim, 1'b0, 8'h00, hs_cap_id} ;
- end
- `endif
- {2'b01, `P_IMG_CTRL0_ADDR}: // w_reg_select_dec bit 3
- begin
- w_conf_data_out = { 29'h00000000, pci_img_ctrl0_bit2_1, 1'h0 } ;
- w_reg_select_dec = 57'h000_0000_0000_0008 ;
- end
- {2'b01, `P_BA0_ADDR}: // w_reg_select_dec bit 4
- begin
- `ifdef HOST
- `ifdef NO_CNF_IMAGE
- w_conf_data_out[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] = pci_ba0_bit31_8[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] &
- pci_am0[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] ;
- w_conf_data_out[(31-`PCI_NUM_OF_DEC_ADDR_LINES):1] = 0 ;
- w_conf_data_out[0] = pci_ba0_bit0 & pci_am0[31];
- `else
- w_conf_data_out[31:12] = pci_ba0_bit31_8[31:12] ;
- w_conf_data_out[11: 0] = 12'h000 ;
- `endif
- `endif
- `ifdef GUEST
- w_conf_data_out[31:12] = pci_ba0_bit31_8[31:12] ;
- w_conf_data_out[11: 0] = 12'h000 ;
- `endif
- w_reg_select_dec = 57'h000_0000_0000_0010 ; // The same for another address
- end
- {2'b01, `P_AM0_ADDR}: // w_reg_select_dec bit 5
- begin
- `ifdef HOST
- `ifdef NO_CNF_IMAGE
- w_conf_data_out[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] = pci_am0[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] ;
- w_conf_data_out[(31-`PCI_NUM_OF_DEC_ADDR_LINES):0] = 0 ;
- `else
- w_conf_data_out[31:12] = pci_am0[31:12] ;
- w_conf_data_out[11: 0] = 12'h000 ;
- `endif
- `endif
- `ifdef GUEST
- w_conf_data_out[31:12] = pci_am0[31:12] ;
- w_conf_data_out[11: 0] = 12'h000 ;
- `endif
- w_reg_select_dec = 57'h000_0000_0000_0020 ;
- end
- {2'b01, `P_TA0_ADDR}: // w_reg_select_dec bit 6
- begin
- w_conf_data_out[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] = pci_ta0[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] ;
- w_conf_data_out[(31-`PCI_NUM_OF_DEC_ADDR_LINES):0] = 0 ;
- w_reg_select_dec = 57'h000_0000_0000_0040 ;
- end
- {2'b01, `P_IMG_CTRL1_ADDR}: // w_reg_select_dec bit 7
- begin
- w_conf_data_out = { 29'h00000000, pci_img_ctrl1_bit2_1, 1'h0 } ;
- w_reg_select_dec = 57'h000_0000_0000_0080 ;
- end
- {2'b01, `P_BA1_ADDR}: // w_reg_select_dec bit 8
- begin
- w_conf_data_out[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] = pci_ba1_bit31_8[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] &
- pci_am1[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] ;
- w_conf_data_out[(31-`PCI_NUM_OF_DEC_ADDR_LINES):1] = 0 ;
- w_conf_data_out[0] = pci_ba1_bit0 & pci_am1[31];
- w_reg_select_dec = 57'h000_0000_0000_0100 ; // The same for another address
- end
- {2'b01, `P_AM1_ADDR}: // w_reg_select_dec bit 9
- begin
- w_conf_data_out[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] = pci_am1[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] ;
- w_conf_data_out[(31-`PCI_NUM_OF_DEC_ADDR_LINES):0] = 0 ;
- w_reg_select_dec = 57'h000_0000_0000_0200 ;
- end
- {2'b01, `P_TA1_ADDR}: // w_reg_select_dec bit 10
- begin
- w_conf_data_out[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] = pci_ta1[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] ;
- w_conf_data_out[(31-`PCI_NUM_OF_DEC_ADDR_LINES):0] = 0 ;
- w_reg_select_dec = 57'h000_0000_0000_0400 ;
- end
- {2'b01, `P_IMG_CTRL2_ADDR}: // w_reg_select_dec bit 11
- begin
- w_conf_data_out = { 29'h00000000, pci_img_ctrl2_bit2_1, 1'h0 } ;
- w_reg_select_dec = 57'h000_0000_0000_0800 ;
- end
- {2'b01, `P_BA2_ADDR}: // w_reg_select_dec bit 12
- begin
- w_conf_data_out[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] = pci_ba2_bit31_8[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] &
- pci_am2[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] ;
- w_conf_data_out[(31-`PCI_NUM_OF_DEC_ADDR_LINES):1] = 0 ;
- w_conf_data_out[0] = pci_ba2_bit0 & pci_am2[31];
- w_reg_select_dec = 57'h000_0000_0000_1000 ; // The same for another address
- end
- {2'b01, `P_AM2_ADDR}: // w_reg_select_dec bit 13
- begin
- w_conf_data_out[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] = pci_am2[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] ;
- w_conf_data_out[(31-`PCI_NUM_OF_DEC_ADDR_LINES):0] = 0 ;
- w_reg_select_dec = 57'h000_0000_0000_2000 ;
- end
- {2'b01, `P_TA2_ADDR}: // w_reg_select_dec bit 14
- begin
- w_conf_data_out[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] = pci_ta2[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] ;
- w_conf_data_out[(31-`PCI_NUM_OF_DEC_ADDR_LINES):0] = 0 ;
- w_reg_select_dec = 57'h000_0000_0000_4000 ;
- end
- {2'b01, `P_IMG_CTRL3_ADDR}: // w_reg_select_dec bit 15
- begin
- w_conf_data_out = { 29'h00000000, pci_img_ctrl3_bit2_1, 1'h0 } ;
- w_reg_select_dec = 57'h000_0000_0000_8000 ;
- end
- {2'b01, `P_BA3_ADDR}: // w_reg_select_dec bit 16
- begin
- w_conf_data_out[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] = pci_ba3_bit31_8[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] &
- pci_am3[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] ;
- w_conf_data_out[(31-`PCI_NUM_OF_DEC_ADDR_LINES):1] = 0 ;
- w_conf_data_out[0] = pci_ba3_bit0 & pci_am3[31];
- w_reg_select_dec = 57'h000_0000_0001_0000 ; // The same for another address
- end
- {2'b01, `P_AM3_ADDR}: // w_reg_select_dec bit 17
- begin
- w_conf_data_out[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] = pci_am3[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] ;
- w_conf_data_out[(31-`PCI_NUM_OF_DEC_ADDR_LINES):0] = 0 ;
- w_reg_select_dec = 57'h000_0000_0002_0000 ;
- end
- {2'b01, `P_TA3_ADDR}: // w_reg_select_dec bit 18
- begin
- w_conf_data_out[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] = pci_ta3[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] ;
- w_conf_data_out[(31-`PCI_NUM_OF_DEC_ADDR_LINES):0] = 0 ;
- w_reg_select_dec = 57'h000_0000_0004_0000 ;
- end
- {2'b01, `P_IMG_CTRL4_ADDR}: // w_reg_select_dec bit 19
- begin
- w_conf_data_out = { 29'h00000000, pci_img_ctrl4_bit2_1, 1'h0 } ;
- w_reg_select_dec = 57'h000_0000_0008_0000 ;
- end
- {2'b01, `P_BA4_ADDR}: // w_reg_select_dec bit 20
- begin
- w_conf_data_out[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] = pci_ba4_bit31_8[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] &
- pci_am4[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] ;
- w_conf_data_out[(31-`PCI_NUM_OF_DEC_ADDR_LINES):1] = 0 ;
- w_conf_data_out[0] = pci_ba4_bit0 & pci_am4[31];
- w_reg_select_dec = 57'h000_0000_0010_0000 ; // The same for another address
- end
- {2'b01, `P_AM4_ADDR}: // w_reg_select_dec bit 21
- begin
- w_conf_data_out[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] = pci_am4[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] ;
- w_conf_data_out[(31-`PCI_NUM_OF_DEC_ADDR_LINES):0] = 0 ;
- w_reg_select_dec = 57'h000_0000_0020_0000 ;
- end
- {2'b01, `P_TA4_ADDR}: // w_reg_select_dec bit 22
- begin
- w_conf_data_out[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] = pci_ta4[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] ;
- w_conf_data_out[(31-`PCI_NUM_OF_DEC_ADDR_LINES):0] = 0 ;
- w_reg_select_dec = 57'h000_0000_0040_0000 ;
- end
- {2'b01, `P_IMG_CTRL5_ADDR}: // w_reg_select_dec bit 23
- begin
- w_conf_data_out = { 29'h00000000, pci_img_ctrl5_bit2_1, 1'h0 } ;
- w_reg_select_dec = 57'h000_0000_0080_0000 ;
- end
- {2'b01, `P_BA5_ADDR}: // w_reg_select_dec bit 24
- begin
- w_conf_data_out[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] = pci_ba5_bit31_8[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] &
- pci_am5[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] ;
- w_conf_data_out[(31-`PCI_NUM_OF_DEC_ADDR_LINES):1] = 0 ;
- w_conf_data_out[0] = pci_ba5_bit0 & pci_am5[31];
- w_reg_select_dec = 57'h000_0000_0100_0000 ; // The same for another address
- end
- {2'b01, `P_AM5_ADDR}: // w_reg_select_dec bit 25
- begin
- w_conf_data_out[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] = pci_am5[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] ;
- w_conf_data_out[(31-`PCI_NUM_OF_DEC_ADDR_LINES):0] = 0 ;
- w_reg_select_dec = 57'h000_0000_0200_0000 ;
- end
- {2'b01, `P_TA5_ADDR}: // w_reg_select_dec bit 26
- begin
- w_conf_data_out[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] = pci_ta5[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] ;
- w_conf_data_out[(31-`PCI_NUM_OF_DEC_ADDR_LINES):0] = 0 ;
- w_reg_select_dec = 57'h000_0000_0400_0000 ;
- end
- {2'b01, `P_ERR_CS_ADDR}: // w_reg_select_dec bit 27
- begin
- w_conf_data_out = { pci_err_cs_bit31_24, 13'h0000, pci_err_cs_bit10, pci_err_cs_bit9,
- pci_err_cs_bit8, 7'h00, pci_err_cs_bit0 } ;
- w_reg_select_dec = 57'h000_0000_0800_0000 ;
- end
- {2'b01, `P_ERR_ADDR_ADDR}: // w_reg_select_dec bit 28
- begin
- w_conf_data_out = pci_err_addr ;
- w_reg_select_dec = 57'h000_0000_0000_0000 ; // = 56'h00_0000_1000_0000 ;
- end
- {2'b01, `P_ERR_DATA_ADDR}: // w_reg_select_dec bit 29
- begin
- w_conf_data_out = pci_err_data ;
- w_reg_select_dec = 57'h000_0000_0000_0000 ; // = 56'h00_0000_2000_0000 ;
- end
- // WB slave - configuration space
- {2'b01, `WB_CONF_SPC_BAR_ADDR}:
- begin
- w_conf_data_out = { wb_ba0_bit31_12, 11'h000, wb_ba0_bit0 } ;
- w_reg_select_dec = 57'h000_0000_0000_0000 ; // Read-Only register
- end
- {2'b01, `W_IMG_CTRL1_ADDR}: // w_reg_select_dec bit 30
- begin
- w_conf_data_out = { 29'h00000000, wb_img_ctrl1_bit2_0 } ;
- w_reg_select_dec = 57'h000_0000_4000_0000 ;
- end
- {2'b01, `W_BA1_ADDR}: // w_reg_select_dec bit 31
- begin
- w_conf_data_out[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] = wb_ba1_bit31_12[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] &
- wb_am1[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] ;
- w_conf_data_out[(31-`WB_NUM_OF_DEC_ADDR_LINES):1] = 0 ;
- w_conf_data_out[0] = wb_ba1_bit0 ;
- w_reg_select_dec = 57'h000_0000_8000_0000 ;
- end
- {2'b01, `W_AM1_ADDR}: // w_reg_select_dec bit 32
- begin
- w_conf_data_out[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] = wb_am1[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] ;
- w_conf_data_out[(31-`WB_NUM_OF_DEC_ADDR_LINES):0] = 0 ;
- w_reg_select_dec = 57'h000_0001_0000_0000 ;
- end
- {2'b01, `W_TA1_ADDR}: // w_reg_select_dec bit 33
- begin
- w_conf_data_out[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] = wb_ta1[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] ;
- w_conf_data_out[(31-`WB_NUM_OF_DEC_ADDR_LINES):0] = 0 ;
- w_reg_select_dec = 57'h000_0002_0000_0000 ;
- end
- {2'b01, `W_IMG_CTRL2_ADDR}: // w_reg_select_dec bit 34
- begin
- w_conf_data_out = { 29'h00000000, wb_img_ctrl2_bit2_0 } ;
- w_reg_select_dec = 57'h000_0004_0000_0000 ;
- end
- {2'b01, `W_BA2_ADDR}: // w_reg_select_dec bit 35
- begin
- w_conf_data_out[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] = wb_ba2_bit31_12[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] &
- wb_am2[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] ;
- w_conf_data_out[(31-`WB_NUM_OF_DEC_ADDR_LINES):1] = 0 ;
- w_conf_data_out[0] = wb_ba2_bit0 ;
- w_reg_select_dec = 57'h000_0008_0000_0000 ;
- end
- {2'b01, `W_AM2_ADDR}: // w_reg_select_dec bit 36
- begin
- w_conf_data_out[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] = wb_am2[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] ;
- w_conf_data_out[(31-`WB_NUM_OF_DEC_ADDR_LINES):0] = 0 ;
- w_reg_select_dec = 57'h000_0010_0000_0000 ;
- end
- {2'b01, `W_TA2_ADDR}: // w_reg_select_dec bit 37
- begin
- w_conf_data_out[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] = wb_ta2[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] ;
- w_conf_data_out[(31-`WB_NUM_OF_DEC_ADDR_LINES):0] = 0 ;
- w_reg_select_dec = 57'h000_0020_0000_0000 ;
- end
- {2'b01, `W_IMG_CTRL3_ADDR}: // w_reg_select_dec bit 38
- begin
- w_conf_data_out = { 29'h00000000, wb_img_ctrl3_bit2_0 } ;
- w_reg_select_dec = 57'h000_0040_0000_0000 ;
- end
- {2'b01, `W_BA3_ADDR}: // w_reg_select_dec bit 39
- begin
- w_conf_data_out[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] = wb_ba3_bit31_12[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] &
- wb_am3[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] ;
- w_conf_data_out[(31-`WB_NUM_OF_DEC_ADDR_LINES):1] = 0 ;
- w_conf_data_out[0] = wb_ba3_bit0 ;
- w_reg_select_dec = 57'h000_0080_0000_0000 ;
- end
- {2'b01, `W_AM3_ADDR}: // w_reg_select_dec bit 40
- begin
- w_conf_data_out[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] = wb_am3[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] ;
- w_conf_data_out[(31-`WB_NUM_OF_DEC_ADDR_LINES):0] = 0 ;
- w_reg_select_dec = 57'h000_0100_0000_0000 ;
- end
- {2'b01, `W_TA3_ADDR}: // w_reg_select_dec bit 41
- begin
- w_conf_data_out[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] = wb_ta3[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] ;
- w_conf_data_out[(31-`WB_NUM_OF_DEC_ADDR_LINES):0] = 0 ;
- w_reg_select_dec = 57'h000_0200_0000_0000 ;
- end
- {2'b01, `W_IMG_CTRL4_ADDR}: // w_reg_select_dec bit 42
- begin
- w_conf_data_out = { 29'h00000000, wb_img_ctrl4_bit2_0 } ;
- w_reg_select_dec = 57'h000_0400_0000_0000 ;
- end
- {2'b01, `W_BA4_ADDR}: // w_reg_select_dec bit 43
- begin
- w_conf_data_out[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] = wb_ba4_bit31_12[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] &
- wb_am4[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] ;
- w_conf_data_out[(31-`WB_NUM_OF_DEC_ADDR_LINES):1] = 0 ;
- w_conf_data_out[0] = wb_ba4_bit0 ;
- w_reg_select_dec = 57'h000_0800_0000_0000 ;
- end
- {2'b01, `W_AM4_ADDR}: // w_reg_select_dec bit 44
- begin
- w_conf_data_out[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] = wb_am4[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] ;
- w_conf_data_out[(31-`WB_NUM_OF_DEC_ADDR_LINES):0] = 0 ;
- w_reg_select_dec = 57'h000_1000_0000_0000 ;
- end
- {2'b01, `W_TA4_ADDR}: // w_reg_select_dec bit 45
- begin
- w_conf_data_out[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] = wb_ta4[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] ;
- w_conf_data_out[(31-`WB_NUM_OF_DEC_ADDR_LINES):0] = 0 ;
- w_reg_select_dec = 57'h000_2000_0000_0000 ;
- end
- {2'b01, `W_IMG_CTRL5_ADDR}: // w_reg_select_dec bit 46
- begin
- w_conf_data_out = { 29'h00000000, wb_img_ctrl5_bit2_0 } ;
- w_reg_select_dec = 57'h000_4000_0000_0000 ;
- end
- {2'b01, `W_BA5_ADDR}: // w_reg_select_dec bit 47
- begin
- w_conf_data_out[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] = wb_ba5_bit31_12[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] &
- wb_am5[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] ;
- w_conf_data_out[(31-`WB_NUM_OF_DEC_ADDR_LINES):1] = 0 ;
- w_conf_data_out[0] = wb_ba5_bit0 ;
- w_reg_select_dec = 57'h000_8000_0000_0000 ;
- end
- {2'b01, `W_AM5_ADDR}: // w_reg_select_dec bit 48
- begin
- w_conf_data_out[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] = wb_am5[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] ;
- w_conf_data_out[(31-`WB_NUM_OF_DEC_ADDR_LINES):0] = 0 ;
- w_reg_select_dec = 57'h001_0000_0000_0000 ;
- end
- {2'b01, `W_TA5_ADDR}: // w_reg_select_dec bit 49
- begin
- w_conf_data_out[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] = wb_ta5[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] ;
- w_conf_data_out[(31-`WB_NUM_OF_DEC_ADDR_LINES):0] = 0 ;
- w_reg_select_dec = 57'h002_0000_0000_0000 ;
- end
- {2'b01, `W_ERR_CS_ADDR}: // w_reg_select_dec bit 50
- begin
- w_conf_data_out = { wb_err_cs_bit31_24, /*13*/14'h0000, /*wb_err_cs_bit10,*/
- wb_err_cs_bit9, wb_err_cs_bit8, 7'h00, wb_err_cs_bit0 } ;
- w_reg_select_dec = 57'h004_0000_0000_0000 ;
- end
- {2'b01, `W_ERR_ADDR_ADDR}: // w_reg_select_dec bit 51
- begin
- w_conf_data_out = wb_err_addr ;
- w_reg_select_dec = 57'h008_0000_0000_0000 ;
- end
- {2'b01, `W_ERR_DATA_ADDR}: // w_reg_select_dec bit 52
- begin
- w_conf_data_out = wb_err_data ;
- w_reg_select_dec = 57'h010_0000_0000_0000 ;
- end
- {2'b01, `CNF_ADDR_ADDR}: // w_reg_select_dec bit 53
- begin
- w_conf_data_out = { 8'h00, cnf_addr_bit23_2, 1'h0, cnf_addr_bit0 } ;
- w_reg_select_dec = 57'h020_0000_0000_0000 ;
- end
- // `CNF_DATA_ADDR: implemented elsewhere !!!
- // `INT_ACK_ADDR: implemented elsewhere !!!
- {2'b01, `ICR_ADDR}: // w_reg_select_dec bit 54
- begin
- w_conf_data_out = { icr_bit31, 26'h0000_000, icr_bit4_3, icr_bit2_0 } ;
- w_reg_select_dec = 57'h040_0000_0000_0000 ;
- end
- {2'b01, `ISR_ADDR}: // w_reg_select_dec bit 55
- begin
- w_conf_data_out = { 27'h0000_000, isr_bit4_3, isr_bit2_0 } ;
- w_reg_select_dec = 57'h080_0000_0000_0000 ;
- end
- `ifdef PCI_SPOCI
- 8'hff:
- begin
- w_conf_data_out = {spoci_cs_nack, 5'h0, spoci_cs_write, spoci_cs_read,
- 5'h0, spoci_cs_adr[10:8],
- spoci_cs_adr[7:0],
- spoci_cs_dat[7:0]} ;
- // this register is implemented separate from other registers, because
- // it has special features implemented
- w_reg_select_dec = 57'h000_0000_0000_0000 ;
- end
- `endif
- default:
- begin
- w_conf_data_out = 32'h0000_0000 ;
- w_reg_select_dec = 57'h000_0000_0000_0000 ;
- end
- endcase
- end
- `ifdef PCI_SPOCI
- reg init_we ;
- reg init_cfg_done ;
- reg [31: 0] spoci_dat ;
- wire [31: 0] w_conf_data = init_cfg_done ? w_conf_data_in : spoci_dat ;
- wire [ 3: 0] w_byte_en = init_cfg_done ? w_byte_en_in : 4'b0000 ;
- `else
- wire init_we = 1'b0 ;
- wire init_cfg_done = 1'b1 ;
- wire [31: 0] w_conf_data = w_conf_data_in ;
- wire [ 3: 0] w_byte_en = w_byte_en_in ;
- wire [31: 0] spoci_dat = 'h0000_0000 ;
- `endif
- // Reduced write data for BASE, MASK and TRANSLATION registers of PCI and WB images
- assign w_conf_pdata_reduced[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] = w_conf_data[31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)] ;
- assign w_conf_pdata_reduced[(31-`PCI_NUM_OF_DEC_ADDR_LINES): 0] = 0 ;
- assign w_conf_wdata_reduced[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] = w_conf_data[31:(32-`WB_NUM_OF_DEC_ADDR_LINES)] ;
- assign w_conf_wdata_reduced[(31-`WB_NUM_OF_DEC_ADDR_LINES): 0] = 0 ;
- wire w_we = w_we_i | init_we ;
- always@(posedge w_clock or posedge reset)
- begin
- // Here are implemented all registers that are reset with RESET signal otherwise they can be normaly written!!!
- // Registers that are commented are implemented after this alwasy statement, because they are e.g. reset with
- // RESET signal, set with some status signal and they are erased with writting '1' into them !!!
- if (reset)
- begin
- /*status_bit15_11 ; status_bit8 ;*/ command_bit8 <= 1'h0 ; command_bit6 <= 1'h0 ; command_bit2_0 <= 3'h0 ;