ELGIP-98 added address decoding for XAUI registers and transceiver reconfiguration registers (newly added). Updated XAUI for additional status ports and added simulation files

This commit is contained in:
Simon Southwell 2020-10-30 14:56:29 +00:00
commit eea1a9c067
342 changed files with 112977 additions and 758 deletions

View file

@ -3,7 +3,7 @@
"bus" : "csr",
"addr_hi_bit" : "6",
"addr_lo_bit" : "4",
"description" : "This block is the top level for the GMA SOM board soft IP",
"description" : "This block is the print streamer for the Presto products. It is a collection of data streamers (see https://confluence.gisapps.co.uk/display/EL/Embedded+Logic+Data+Streamer+New+Architecture) and support logic for multiple heads. More details can be found at https://confluence.gisapps.co.uk/display/EL/Print+Streamer.",
"sub_blocks" : {
"data_streamer_7:a" : {
"instance" : "0",

View file

@ -3,7 +3,7 @@
"bus" : "csr",
"addr_width" : "6",
"description" : "This block is the emergency shutdown monitor for HMB-FD-HV",
"notes" : "The shutdown monitor is used in various products to facilitate the powering up and down of power supplies, and the monitoring of critical signals and alerts in order to shutdown the supplies in the case of a failure mode. More details of a deployment of the shutdown monitor, and its use, can be found at https://confluence.gisapps.co.uk/pages/viewpage.action?spaceKey=DHBTTCF3&title=CF3+Logic+Design#CF3LogicDesign-ShutdownMonitor.",
"notes" : "The shutdown monitor is used in various products to facilitate the powering up and down of power supplies, and the monitoring of critical signals and alerts in order to shutdown the supplies in the case of a failure mode. More details of the shutdown monitor, and its use, can be found at https://confluence.gisapps.co.uk/display/EL/Shutdown+Monitor .",
"registers" : {
"ip_id" : {
"address" : "0",

View file

@ -0,0 +1,143 @@
/*
WARNING: Do NOT edit the input and output ports in this file in a text
editor if you plan to continue editing the block that represents it in
the Block Editor! File corruption is VERY likely to occur.
*/
/*
Copyright (C) 2018 Intel Corporation. All rights reserved.
Your use of Intel Corporation's design tools, logic functions
and other software and tools, and its AMPP partner logic
functions, and any output files from any of the foregoing
(including device programming or simulation files), and any
associated documentation or information are expressly subject
to the terms and conditions of the Intel Program License
Subscription Agreement, the Intel Quartus Prime License Agreement,
the Intel FPGA IP License Agreement, or other applicable license
agreement, including, without limitation, that your use is for
the sole purpose of programming logic devices manufactured by
Intel and sold by Intel or its authorized distributors. Please
refer to the applicable agreement for further details.
*/
(header "symbol" (version "1.1"))
(symbol
(rect 0 0 544 304)
(text "transconfig" (rect 240 -1 283 11)(font "Arial" (font_size 10)))
(text "inst" (rect 8 288 20 300)(font "Arial" ))
(port
(pt 0 72)
(input)
(text "mgmt_clk_clk" (rect 0 0 56 12)(font "Arial" (font_size 8)))
(text "mgmt_clk_clk" (rect 4 61 76 72)(font "Arial" (font_size 8)))
(line (pt 0 72)(pt 176 72)(line_width 1))
)
(port
(pt 0 112)
(input)
(text "mgmt_rst_reset" (rect 0 0 66 12)(font "Arial" (font_size 8)))
(text "mgmt_rst_reset" (rect 4 101 88 112)(font "Arial" (font_size 8)))
(line (pt 0 112)(pt 176 112)(line_width 1))
)
(port
(pt 0 152)
(input)
(text "reconfig_mgmt_address[6..0]" (rect 0 0 119 12)(font "Arial" (font_size 8)))
(text "reconfig_mgmt_address[6..0]" (rect 4 141 166 152)(font "Arial" (font_size 8)))
(line (pt 0 152)(pt 176 152)(line_width 3))
)
(port
(pt 0 168)
(input)
(text "reconfig_mgmt_read" (rect 0 0 84 12)(font "Arial" (font_size 8)))
(text "reconfig_mgmt_read" (rect 4 157 112 168)(font "Arial" (font_size 8)))
(line (pt 0 168)(pt 176 168)(line_width 1))
)
(port
(pt 0 216)
(input)
(text "reconfig_mgmt_write" (rect 0 0 84 12)(font "Arial" (font_size 8)))
(text "reconfig_mgmt_write" (rect 4 205 118 216)(font "Arial" (font_size 8)))
(line (pt 0 216)(pt 176 216)(line_width 1))
)
(port
(pt 0 232)
(input)
(text "reconfig_mgmt_writedata[31..0]" (rect 0 0 125 12)(font "Arial" (font_size 8)))
(text "reconfig_mgmt_writedata[31..0]" (rect 4 221 184 232)(font "Arial" (font_size 8)))
(line (pt 0 232)(pt 176 232)(line_width 3))
)
(port
(pt 0 272)
(input)
(text "reconfig_from_xcvr[229..0]" (rect 0 0 112 12)(font "Arial" (font_size 8)))
(text "reconfig_from_xcvr[229..0]" (rect 4 261 160 272)(font "Arial" (font_size 8)))
(line (pt 0 272)(pt 176 272)(line_width 3))
)
(port
(pt 544 72)
(output)
(text "reconfig_busy" (rect 0 0 57 12)(font "Arial" (font_size 8)))
(text "reconfig_busy" (rect 470 61 548 72)(font "Arial" (font_size 8)))
(line (pt 544 72)(pt 368 72)(line_width 1))
)
(port
(pt 0 184)
(output)
(text "reconfig_mgmt_readdata[31..0]" (rect 0 0 125 12)(font "Arial" (font_size 8)))
(text "reconfig_mgmt_readdata[31..0]" (rect 4 173 178 184)(font "Arial" (font_size 8)))
(line (pt 0 184)(pt 176 184)(line_width 3))
)
(port
(pt 0 200)
(output)
(text "reconfig_mgmt_waitrequest" (rect 0 0 110 12)(font "Arial" (font_size 8)))
(text "reconfig_mgmt_waitrequest" (rect 4 189 154 200)(font "Arial" (font_size 8)))
(line (pt 0 200)(pt 176 200)(line_width 1))
)
(port
(pt 544 112)
(output)
(text "reconfig_to_xcvr[349..0]" (rect 0 0 100 12)(font "Arial" (font_size 8)))
(text "reconfig_to_xcvr[349..0]" (rect 420 101 564 112)(font "Arial" (font_size 8)))
(line (pt 544 112)(pt 368 112)(line_width 3))
)
(drawing
(text "reconfig_busy" (rect 369 43 816 99)(font "Arial" (color 128 0 0)(font_size 9)))
(text "reconfig_busy" (rect 303 67 684 144)(font "Arial" (color 0 0 0)))
(text "mgmt_clk_clk" (rect 96 43 264 99)(font "Arial" (color 128 0 0)(font_size 9)))
(text "clk" (rect 181 67 380 144)(font "Arial" (color 0 0 0)))
(text "mgmt_rst_reset" (rect 82 83 248 179)(font "Arial" (color 128 0 0)(font_size 9)))
(text "reset" (rect 181 107 392 224)(font "Arial" (color 0 0 0)))
(text "reconfig_mgmt" (rect 89 123 256 259)(font "Arial" (color 128 0 0)(font_size 9)))
(text "address" (rect 181 147 404 304)(font "Arial" (color 0 0 0)))
(text "read" (rect 181 163 386 336)(font "Arial" (color 0 0 0)))
(text "readdata" (rect 181 179 410 368)(font "Arial" (color 0 0 0)))
(text "waitrequest" (rect 181 195 428 400)(font "Arial" (color 0 0 0)))
(text "write" (rect 181 211 392 432)(font "Arial" (color 0 0 0)))
(text "writedata" (rect 181 227 416 464)(font "Arial" (color 0 0 0)))
(text "reconfig_to_xcvr" (rect 369 83 834 179)(font "Arial" (color 128 0 0)(font_size 9)))
(text "reconfig_to_xcvr" (rect 290 107 676 224)(font "Arial" (color 0 0 0)))
(text "reconfig_from_xcvr" (rect 63 243 234 499)(font "Arial" (color 128 0 0)(font_size 9)))
(text "reconfig_from_xcvr" (rect 181 267 470 544)(font "Arial" (color 0 0 0)))
(text " alt_xcvr_reconfig " (rect 464 288 1042 586)(font "Arial" ))
(line (pt 176 32)(pt 368 32)(line_width 1))
(line (pt 368 32)(pt 368 288)(line_width 1))
(line (pt 176 288)(pt 368 288)(line_width 1))
(line (pt 176 32)(pt 176 288)(line_width 1))
(line (pt 367 52)(pt 367 76)(line_width 1))
(line (pt 366 52)(pt 366 76)(line_width 1))
(line (pt 177 52)(pt 177 76)(line_width 1))
(line (pt 178 52)(pt 178 76)(line_width 1))
(line (pt 177 92)(pt 177 116)(line_width 1))
(line (pt 178 92)(pt 178 116)(line_width 1))
(line (pt 177 132)(pt 177 236)(line_width 1))
(line (pt 178 132)(pt 178 236)(line_width 1))
(line (pt 367 92)(pt 367 116)(line_width 1))
(line (pt 366 92)(pt 366 116)(line_width 1))
(line (pt 177 252)(pt 177 276)(line_width 1))
(line (pt 178 252)(pt 178 276)(line_width 1))
(line (pt 0 0)(pt 544 0)(line_width 1))
(line (pt 544 0)(pt 544 304)(line_width 1))
(line (pt 0 304)(pt 544 304)(line_width 1))
(line (pt 0 0)(pt 0 304)(line_width 1))
)
)

View file

@ -0,0 +1,16 @@
component transconfig is
port (
reconfig_busy : out std_logic; -- reconfig_busy
mgmt_clk_clk : in std_logic := 'X'; -- clk
mgmt_rst_reset : in std_logic := 'X'; -- reset
reconfig_mgmt_address : in std_logic_vector(6 downto 0) := (others => 'X'); -- address
reconfig_mgmt_read : in std_logic := 'X'; -- read
reconfig_mgmt_readdata : out std_logic_vector(31 downto 0); -- readdata
reconfig_mgmt_waitrequest : out std_logic; -- waitrequest
reconfig_mgmt_write : in std_logic := 'X'; -- write
reconfig_mgmt_writedata : in std_logic_vector(31 downto 0) := (others => 'X'); -- writedata
reconfig_to_xcvr : out std_logic_vector(349 downto 0); -- reconfig_to_xcvr
reconfig_from_xcvr : in std_logic_vector(229 downto 0) := (others => 'X') -- reconfig_from_xcvr
);
end component transconfig;

View file

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<pinplan
variation_name="transconfig"
megafunction_name="ALT_XCVR_RECONFIG"
intended_family="Cyclone V"
specifies="all_ports">
<global>
<pin name="reconfig_busy" direction="output" scope="external" />
<pin name="mgmt_clk_clk" direction="input" scope="external" />
<pin name="mgmt_rst_reset" direction="input" scope="external" />
<pin name="reconfig_mgmt_address[6..0]" direction="input" scope="external" />
<pin name="reconfig_mgmt_read" direction="input" scope="external" />
<pin
name="reconfig_mgmt_readdata[31..0]"
direction="output"
scope="external" />
<pin name="reconfig_mgmt_waitrequest" direction="output" scope="external" />
<pin name="reconfig_mgmt_write" direction="input" scope="external" />
<pin
name="reconfig_mgmt_writedata[31..0]"
direction="input"
scope="external" />
<pin name="reconfig_to_xcvr[349..0]" direction="output" scope="external" />
<pin name="reconfig_from_xcvr[229..0]" direction="input" scope="external" />
</global>
</pinplan>

View file

@ -0,0 +1,119 @@
set_global_assignment -entity "transconfig" -library "transconfig" -name IP_TOOL_NAME "alt_xcvr_reconfig"
set_global_assignment -entity "transconfig" -library "transconfig" -name IP_TOOL_VERSION "18.1"
set_global_assignment -entity "transconfig" -library "transconfig" -name IP_TOOL_ENV "mwpim"
set_global_assignment -library "transconfig" -name MISC_FILE [file join $::quartus(qip_path) "transconfig.cmp"]
set_global_assignment -entity "transconfig" -library "transconfig" -name IP_TARGETED_DEVICE_FAMILY "Cyclone V"
set_global_assignment -entity "transconfig" -library "transconfig" -name IP_GENERATED_DEVICE_FAMILY "{Cyclone V}"
set_global_assignment -entity "transconfig" -library "transconfig" -name IP_QSYS_MODE "UNKNOWN"
set_global_assignment -name SYNTHESIS_ONLY_QIP ON
set_global_assignment -entity "transconfig" -library "transconfig" -name IP_COMPONENT_NAME "dHJhbnNjb25maWc="
set_global_assignment -entity "transconfig" -library "transconfig" -name IP_COMPONENT_DISPLAY_NAME "VHJhbnNjZWl2ZXIgUmVjb25maWd1cmF0aW9uIENvbnRyb2xsZXIgSW50ZWwgRlBHQSBJUA=="
set_global_assignment -entity "transconfig" -library "transconfig" -name IP_COMPONENT_REPORT_HIERARCHY "Off"
set_global_assignment -entity "transconfig" -library "transconfig" -name IP_COMPONENT_INTERNAL "Off"
set_global_assignment -entity "transconfig" -library "transconfig" -name IP_COMPONENT_AUTHOR "QWx0ZXJhIENvcnBvcmF0aW9u"
set_global_assignment -entity "transconfig" -library "transconfig" -name IP_COMPONENT_VERSION "MTguMQ=="
set_global_assignment -entity "transconfig" -library "transconfig" -name IP_COMPONENT_DESCRIPTION "VHJhbnNjZWl2ZXIgUmVjb25maWd1cmF0aW9uIENvbnRyb2xsZXIgaXMgdXNlZCB0byBkeW5hbWljYWxseSBjYWxpYnJhdGUgYW5kIHJlY29uZmlndXJlIGZlYXR1cmVzIG9mIFBIWSBJUCBjb3Jlcw=="
set_global_assignment -entity "alt_xcvr_reconfig" -library "transconfig" -name IP_COMPONENT_NAME "YWx0X3hjdnJfcmVjb25maWc="
set_global_assignment -entity "alt_xcvr_reconfig" -library "transconfig" -name IP_COMPONENT_DISPLAY_NAME "VHJhbnNjZWl2ZXIgUmVjb25maWd1cmF0aW9uIENvbnRyb2xsZXIgSW50ZWwgRlBHQSBJUA=="
set_global_assignment -entity "alt_xcvr_reconfig" -library "transconfig" -name IP_COMPONENT_REPORT_HIERARCHY "Off"
set_global_assignment -entity "alt_xcvr_reconfig" -library "transconfig" -name IP_COMPONENT_INTERNAL "Off"
set_global_assignment -entity "alt_xcvr_reconfig" -library "transconfig" -name IP_COMPONENT_AUTHOR "QWx0ZXJhIENvcnBvcmF0aW9u"
set_global_assignment -entity "alt_xcvr_reconfig" -library "transconfig" -name IP_COMPONENT_VERSION "MTguMQ=="
set_global_assignment -entity "alt_xcvr_reconfig" -library "transconfig" -name IP_COMPONENT_DESCRIPTION "VHJhbnNjZWl2ZXIgUmVjb25maWd1cmF0aW9uIENvbnRyb2xsZXIgaXMgdXNlZCB0byBkeW5hbWljYWxseSBjYWxpYnJhdGUgYW5kIHJlY29uZmlndXJlIGZlYXR1cmVzIG9mIFBIWSBJUCBjb3Jlcw=="
set_global_assignment -entity "alt_xcvr_reconfig" -library "transconfig" -name IP_COMPONENT_PARAMETER "bnVtYmVyX29mX3JlY29uZmlnX2ludGVyZmFjZXM=::NQ==::TnVtYmVyIG9mIHJlY29uZmlndXJhdGlvbiBpbnRlcmZhY2Vz"
set_global_assignment -entity "alt_xcvr_reconfig" -library "transconfig" -name IP_COMPONENT_PARAMETER "ZW5hYmxlX2RjZA==::MA==::RW5hYmxlIGR1dHkgY3ljbGUgY2FsaWJyYXRpb24="
set_global_assignment -entity "alt_xcvr_reconfig" -library "transconfig" -name IP_COMPONENT_PARAMETER "ZW5hYmxlX2FuYWxvZw==::MQ==::RW5hYmxlIEFuYWxvZyBjb250cm9scw=="
set_global_assignment -entity "alt_xcvr_reconfig" -library "transconfig" -name IP_COMPONENT_PARAMETER "ZW5hYmxlX2V5ZW1vbg==::MA==::RW5hYmxlIEV5ZVEgYmxvY2s="
set_global_assignment -entity "alt_xcvr_reconfig" -library "transconfig" -name IP_COMPONENT_PARAMETER "ZW5hYmxlX2Jlcg==::MA==::RW5hYmxlIEJpdCBFcnJvciBSYXRlIEJsb2Nr"
set_global_assignment -entity "alt_xcvr_reconfig" -library "transconfig" -name IP_COMPONENT_PARAMETER "ZW5hYmxlX2RmZQ==::MA==::RW5hYmxlIGRlY2lzaW9uIGZlZWRiYWNrIGVxdWFsaXplciAoREZFKSBibG9jaw=="
set_global_assignment -entity "alt_xcvr_reconfig" -library "transconfig" -name IP_COMPONENT_PARAMETER "ZW5hYmxlX2FkY2U=::MA==::RW5hYmxlIGFkYXB0aXZlIGVxdWFsaXphdGlvbiAoQUVRKSBibG9jaw=="
set_global_assignment -entity "alt_xcvr_reconfig" -library "transconfig" -name IP_COMPONENT_PARAMETER "ZW5hYmxlX21pZg==::MA==::RW5hYmxlIGNoYW5uZWwvUExMIHJlY29uZmlndXJhdGlvbg=="
set_global_assignment -entity "alt_xcvr_reconfig" -library "transconfig" -name IP_COMPONENT_PARAMETER "Z3VpX2VuYWJsZV9wbGw=::MA==::RW5hYmxlIFBMTCByZWNvbmZpZ3VyYXRpb24gc3VwcG9ydCBibG9jaw=="
set_global_assignment -entity "alt_xcvr_reconfig" -library "transconfig" -name IP_COMPONENT_PARAMETER "Z3VpX2NhbF9zdGF0dXNfcG9ydA==::ZmFsc2U=::Q3JlYXRlIG9wdGlvbmFsIGNhbGlicmF0aW9uIHN0YXR1cyBwb3J0cw=="
set_global_assignment -library "transconfig" -name VHDL_FILE [file join $::quartus(qip_path) "transconfig.vhd"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/altera_xcvr_functions.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/av_xcvr_h.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/alt_xcvr_resync.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/alt_xcvr_reconfig_h.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/alt_xcvr_reconfig.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/alt_xcvr_reconfig_cal_seq.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/alt_xreconf_cif.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/alt_xreconf_uif.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/alt_xreconf_basic_acq.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/alt_xcvr_reconfig_analog.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/alt_xcvr_reconfig_analog_av.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/alt_xreconf_analog_datactrl_av.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/alt_xreconf_analog_rmw_av.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/alt_xreconf_analog_ctrlsm.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/alt_xcvr_reconfig_offset_cancellation.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/alt_xcvr_reconfig_offset_cancellation_av.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/alt_xcvr_reconfig_eyemon.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/alt_xcvr_reconfig_dfe.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/alt_xcvr_reconfig_adce.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/alt_xcvr_reconfig_dcd.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/alt_xcvr_reconfig_dcd_av.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/alt_xcvr_reconfig_dcd_cal_av.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/alt_xcvr_reconfig_dcd_control_av.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/alt_xcvr_reconfig_mif.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/av_xcvr_reconfig_mif.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/av_xcvr_reconfig_mif_ctrl.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/av_xcvr_reconfig_mif_avmm.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/alt_xcvr_reconfig_pll.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/av_xcvr_reconfig_pll.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/av_xcvr_reconfig_pll_ctrl.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/alt_xcvr_reconfig_soc.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/alt_xcvr_reconfig_cpu_ram.sv"]
set_global_assignment -library "transconfig" -name SOURCE_FILE [file join $::quartus(qip_path) "transconfig/alt_xcvr_reconfig_cpu_ram.hex"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/alt_xcvr_reconfig_direct.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/alt_arbiter_acq.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/alt_xcvr_reconfig_basic.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/av_xrbasic_l2p_addr.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/av_xrbasic_l2p_ch.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/av_xrbasic_l2p_rom.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/av_xrbasic_lif_csr.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/av_xrbasic_lif.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/av_xcvr_reconfig_basic.sv"]
set_global_assignment -library "transconfig" -name SDC_FILE [file join $::quartus(qip_path) "transconfig/av_xcvr_reconfig.sdc"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/alt_xcvr_arbiter.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/alt_xcvr_m2s.sv"]
set_global_assignment -library "transconfig" -name VERILOG_FILE [file join $::quartus(qip_path) "transconfig/altera_wait_generate.v"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/alt_xcvr_csr_selector.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/sv_reconfig_bundle_to_basic.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/av_reconfig_bundle_to_basic.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/av_reconfig_bundle_to_xcvr.sv"]
set_global_assignment -library "transconfig" -name VERILOG_FILE [file join $::quartus(qip_path) "transconfig/alt_xcvr_reconfig_cpu.v"]
set_global_assignment -library "transconfig" -name VERILOG_FILE [file join $::quartus(qip_path) "transconfig/alt_xcvr_reconfig_cpu_reconfig_cpu.v"]
set_global_assignment -library "transconfig" -name SOURCE_FILE [file join $::quartus(qip_path) "transconfig/alt_xcvr_reconfig_cpu_reconfig_cpu_rf_ram_a.mif"]
set_global_assignment -library "transconfig" -name SOURCE_FILE [file join $::quartus(qip_path) "transconfig/alt_xcvr_reconfig_cpu_reconfig_cpu_rf_ram_b.mif"]
set_global_assignment -library "transconfig" -name VERILOG_FILE [file join $::quartus(qip_path) "transconfig/alt_xcvr_reconfig_cpu_reconfig_cpu_test_bench.v"]
set_global_assignment -library "transconfig" -name VERILOG_FILE [file join $::quartus(qip_path) "transconfig/alt_xcvr_reconfig_cpu_mm_interconnect_0.v"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/alt_xcvr_reconfig_cpu_irq_mapper.sv"]
set_global_assignment -library "transconfig" -name VERILOG_FILE [file join $::quartus(qip_path) "transconfig/altera_reset_controller.v"]
set_global_assignment -library "transconfig" -name VERILOG_FILE [file join $::quartus(qip_path) "transconfig/altera_reset_synchronizer.v"]
set_global_assignment -library "transconfig" -name SDC_FILE [file join $::quartus(qip_path) "transconfig/altera_reset_controller.sdc"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/altera_merlin_master_translator.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/altera_merlin_slave_translator.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/altera_merlin_master_agent.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/altera_merlin_slave_agent.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/altera_merlin_burst_uncompressor.sv"]
set_global_assignment -library "transconfig" -name VERILOG_FILE [file join $::quartus(qip_path) "transconfig/altera_avalon_sc_fifo.v"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/alt_xcvr_reconfig_cpu_mm_interconnect_0_router.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/alt_xcvr_reconfig_cpu_mm_interconnect_0_router_001.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/alt_xcvr_reconfig_cpu_mm_interconnect_0_router_002.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/alt_xcvr_reconfig_cpu_mm_interconnect_0_router_003.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/alt_xcvr_reconfig_cpu_mm_interconnect_0_cmd_demux.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/alt_xcvr_reconfig_cpu_mm_interconnect_0_cmd_demux_001.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/alt_xcvr_reconfig_cpu_mm_interconnect_0_cmd_mux.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/altera_merlin_arbitrator.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/alt_xcvr_reconfig_cpu_mm_interconnect_0_cmd_mux_001.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/alt_xcvr_reconfig_cpu_mm_interconnect_0_rsp_mux.sv"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/alt_xcvr_reconfig_cpu_mm_interconnect_0_rsp_mux_001.sv"]
set_global_assignment -library "transconfig" -name VERILOG_FILE [file join $::quartus(qip_path) "transconfig/alt_xcvr_reconfig_cpu_mm_interconnect_0_avalon_st_adapter.v"]
set_global_assignment -library "transconfig" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "transconfig/alt_xcvr_reconfig_cpu_mm_interconnect_0_avalon_st_adapter_error_adapter_0.sv"]
set_global_assignment -library "transconfig" -name SOURCE_FILE [file join $::quartus(qip_path) "transconfig/plain_files.txt"]
set_global_assignment -library "transconfig" -name SOURCE_FILE [file join $::quartus(qip_path) "transconfig/qencrypt_files.txt"]
set_global_assignment -entity "alt_xcvr_reconfig" -library "transconfig" -name IP_TOOL_NAME "alt_xcvr_reconfig"
set_global_assignment -entity "alt_xcvr_reconfig" -library "transconfig" -name IP_TOOL_VERSION "18.1"
set_global_assignment -entity "alt_xcvr_reconfig" -library "transconfig" -name IP_TOOL_ENV "mwpim"

View file

@ -0,0 +1,105 @@
set_global_assignment -entity "transconfig" -library "lib_transconfig" -name IP_TOOL_NAME "alt_xcvr_reconfig"
set_global_assignment -entity "transconfig" -library "lib_transconfig" -name IP_TOOL_VERSION "18.1"
set_global_assignment -entity "transconfig" -library "lib_transconfig" -name IP_TOOL_ENV "mwpim"
set_global_assignment -library "lib_transconfig" -name SPD_FILE [file join $::quartus(sip_path) "transconfig.spd"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/transconfig.vhd"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/altera_xcvr_functions.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/mentor/altera_xcvr_functions.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/av_xcvr_h.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/mentor/av_xcvr_h.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/alt_xcvr_resync.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_resync.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_h.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig_h.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_cal_seq.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig_cal_seq.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/alt_xreconf_cif.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/mentor/alt_xreconf_cif.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/alt_xreconf_uif.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/mentor/alt_xreconf_uif.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/alt_xreconf_basic_acq.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/mentor/alt_xreconf_basic_acq.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_analog.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig_analog.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_analog_av.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig_analog_av.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/alt_xreconf_analog_datactrl_av.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/mentor/alt_xreconf_analog_datactrl_av.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/alt_xreconf_analog_rmw_av.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/mentor/alt_xreconf_analog_rmw_av.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/alt_xreconf_analog_ctrlsm.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/mentor/alt_xreconf_analog_ctrlsm.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_offset_cancellation.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig_offset_cancellation.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_offset_cancellation_av.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig_offset_cancellation_av.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_eyemon.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig_eyemon.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_dfe.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig_dfe.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_adce.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig_adce.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_dcd.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig_dcd.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_dcd_av.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_dcd_cal_av.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_dcd_control_av.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig_dcd_av.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig_dcd_cal_av.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig_dcd_control_av.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_mif.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig_mif.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/av_xcvr_reconfig_mif.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/av_xcvr_reconfig_mif_ctrl.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/av_xcvr_reconfig_mif_avmm.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/mentor/av_xcvr_reconfig_mif.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/mentor/av_xcvr_reconfig_mif_ctrl.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/mentor/av_xcvr_reconfig_mif_avmm.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_pll.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig_pll.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/av_xcvr_reconfig_pll.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/av_xcvr_reconfig_pll_ctrl.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/mentor/av_xcvr_reconfig_pll.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/mentor/av_xcvr_reconfig_pll_ctrl.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_soc.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_cpu_ram.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_cpu_ram.hex"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_direct.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/alt_arbiter_acq.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_basic.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/mentor/alt_arbiter_acq.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig_basic.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/av_xrbasic_l2p_addr.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/av_xrbasic_l2p_ch.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/av_xrbasic_l2p_rom.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/av_xrbasic_lif_csr.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/av_xrbasic_lif.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/av_xcvr_reconfig_basic.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/mentor/av_xrbasic_l2p_addr.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/mentor/av_xrbasic_l2p_ch.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/mentor/av_xrbasic_l2p_rom.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/mentor/av_xrbasic_lif_csr.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/mentor/av_xrbasic_lif.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/mentor/av_xcvr_reconfig_basic.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/alt_xcvr_arbiter.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/alt_xcvr_m2s.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/altera_wait_generate.v"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/alt_xcvr_csr_selector.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_arbiter.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_m2s.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/mentor/altera_wait_generate.v"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_csr_selector.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/sv_reconfig_bundle_to_basic.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/mentor/sv_reconfig_bundle_to_basic.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/av_reconfig_bundle_to_basic.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/av_reconfig_bundle_to_xcvr.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/mentor/av_reconfig_bundle_to_basic.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/mentor/av_reconfig_bundle_to_xcvr.sv"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/plain_files.txt"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/mentor_files.txt"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/cadence_files.txt"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/synopsys_files.txt"]
set_global_assignment -library "lib_transconfig" -name MISC_FILE [file join $::quartus(sip_path) "transconfig_sim/alt_xcvr_reconfig/aldec_files.txt"]

View file

@ -0,0 +1,447 @@
<?xml version="1.0" encoding="UTF-8"?>
<simPackage>
<file
path="transconfig_sim/alt_xcvr_reconfig/altera_xcvr_functions.sv"
type="SYSTEM_VERILOG"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/mentor/altera_xcvr_functions.sv"
type="SYSTEM_VERILOG_ENCRYPT"
library="transconfig"
simulator="modelsim" />
<file
path="transconfig_sim/alt_xcvr_reconfig/av_xcvr_h.sv"
type="SYSTEM_VERILOG"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/mentor/av_xcvr_h.sv"
type="SYSTEM_VERILOG_ENCRYPT"
library="transconfig"
simulator="modelsim" />
<file
path="transconfig_sim/alt_xcvr_reconfig/alt_xcvr_resync.sv"
type="SYSTEM_VERILOG"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_resync.sv"
type="SYSTEM_VERILOG_ENCRYPT"
library="transconfig"
simulator="modelsim" />
<file
path="transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_h.sv"
type="SYSTEM_VERILOG"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig_h.sv"
type="SYSTEM_VERILOG_ENCRYPT"
library="transconfig"
simulator="modelsim" />
<file
path="transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig.sv"
type="SYSTEM_VERILOG"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig.sv"
type="SYSTEM_VERILOG_ENCRYPT"
library="transconfig"
simulator="modelsim" />
<file
path="transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_cal_seq.sv"
type="SYSTEM_VERILOG"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig_cal_seq.sv"
type="SYSTEM_VERILOG_ENCRYPT"
library="transconfig"
simulator="modelsim" />
<file
path="transconfig_sim/alt_xcvr_reconfig/alt_xreconf_cif.sv"
type="SYSTEM_VERILOG"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/mentor/alt_xreconf_cif.sv"
type="SYSTEM_VERILOG_ENCRYPT"
library="transconfig"
simulator="modelsim" />
<file
path="transconfig_sim/alt_xcvr_reconfig/alt_xreconf_uif.sv"
type="SYSTEM_VERILOG"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/mentor/alt_xreconf_uif.sv"
type="SYSTEM_VERILOG_ENCRYPT"
library="transconfig"
simulator="modelsim" />
<file
path="transconfig_sim/alt_xcvr_reconfig/alt_xreconf_basic_acq.sv"
type="SYSTEM_VERILOG"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/mentor/alt_xreconf_basic_acq.sv"
type="SYSTEM_VERILOG_ENCRYPT"
library="transconfig"
simulator="modelsim" />
<file
path="transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_analog.sv"
type="SYSTEM_VERILOG"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig_analog.sv"
type="SYSTEM_VERILOG_ENCRYPT"
library="transconfig"
simulator="modelsim" />
<file
path="transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_analog_av.sv"
type="SYSTEM_VERILOG"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig_analog_av.sv"
type="SYSTEM_VERILOG_ENCRYPT"
library="transconfig"
simulator="modelsim" />
<file
path="transconfig_sim/alt_xcvr_reconfig/alt_xreconf_analog_datactrl_av.sv"
type="SYSTEM_VERILOG"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/mentor/alt_xreconf_analog_datactrl_av.sv"
type="SYSTEM_VERILOG_ENCRYPT"
library="transconfig"
simulator="modelsim" />
<file
path="transconfig_sim/alt_xcvr_reconfig/alt_xreconf_analog_rmw_av.sv"
type="SYSTEM_VERILOG"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/mentor/alt_xreconf_analog_rmw_av.sv"
type="SYSTEM_VERILOG_ENCRYPT"
library="transconfig"
simulator="modelsim" />
<file
path="transconfig_sim/alt_xcvr_reconfig/alt_xreconf_analog_ctrlsm.sv"
type="SYSTEM_VERILOG"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/mentor/alt_xreconf_analog_ctrlsm.sv"
type="SYSTEM_VERILOG_ENCRYPT"
library="transconfig"
simulator="modelsim" />
<file
path="transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_offset_cancellation.sv"
type="SYSTEM_VERILOG"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig_offset_cancellation.sv"
type="SYSTEM_VERILOG_ENCRYPT"
library="transconfig"
simulator="modelsim" />
<file
path="transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_offset_cancellation_av.sv"
type="SYSTEM_VERILOG"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig_offset_cancellation_av.sv"
type="SYSTEM_VERILOG_ENCRYPT"
library="transconfig"
simulator="modelsim" />
<file
path="transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_eyemon.sv"
type="SYSTEM_VERILOG"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig_eyemon.sv"
type="SYSTEM_VERILOG_ENCRYPT"
library="transconfig"
simulator="modelsim" />
<file
path="transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_dfe.sv"
type="SYSTEM_VERILOG"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig_dfe.sv"
type="SYSTEM_VERILOG_ENCRYPT"
library="transconfig"
simulator="modelsim" />
<file
path="transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_adce.sv"
type="SYSTEM_VERILOG"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig_adce.sv"
type="SYSTEM_VERILOG_ENCRYPT"
library="transconfig"
simulator="modelsim" />
<file
path="transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_dcd.sv"
type="SYSTEM_VERILOG"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig_dcd.sv"
type="SYSTEM_VERILOG_ENCRYPT"
library="transconfig"
simulator="modelsim" />
<file
path="transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_dcd_av.sv"
type="SYSTEM_VERILOG"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_dcd_cal_av.sv"
type="SYSTEM_VERILOG"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_dcd_control_av.sv"
type="SYSTEM_VERILOG"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig_dcd_av.sv"
type="SYSTEM_VERILOG_ENCRYPT"
library="transconfig"
simulator="modelsim" />
<file
path="transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig_dcd_cal_av.sv"
type="SYSTEM_VERILOG_ENCRYPT"
library="transconfig"
simulator="modelsim" />
<file
path="transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig_dcd_control_av.sv"
type="SYSTEM_VERILOG_ENCRYPT"
library="transconfig"
simulator="modelsim" />
<file
path="transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_mif.sv"
type="SYSTEM_VERILOG"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig_mif.sv"
type="SYSTEM_VERILOG_ENCRYPT"
library="transconfig"
simulator="modelsim" />
<file
path="transconfig_sim/alt_xcvr_reconfig/av_xcvr_reconfig_mif.sv"
type="SYSTEM_VERILOG"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/av_xcvr_reconfig_mif_ctrl.sv"
type="SYSTEM_VERILOG"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/av_xcvr_reconfig_mif_avmm.sv"
type="SYSTEM_VERILOG"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/mentor/av_xcvr_reconfig_mif.sv"
type="SYSTEM_VERILOG_ENCRYPT"
library="transconfig"
simulator="modelsim" />
<file
path="transconfig_sim/alt_xcvr_reconfig/mentor/av_xcvr_reconfig_mif_ctrl.sv"
type="SYSTEM_VERILOG_ENCRYPT"
library="transconfig"
simulator="modelsim" />
<file
path="transconfig_sim/alt_xcvr_reconfig/mentor/av_xcvr_reconfig_mif_avmm.sv"
type="SYSTEM_VERILOG_ENCRYPT"
library="transconfig"
simulator="modelsim" />
<file
path="transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_pll.sv"
type="SYSTEM_VERILOG"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig_pll.sv"
type="SYSTEM_VERILOG_ENCRYPT"
library="transconfig"
simulator="modelsim" />
<file
path="transconfig_sim/alt_xcvr_reconfig/av_xcvr_reconfig_pll.sv"
type="SYSTEM_VERILOG"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/av_xcvr_reconfig_pll_ctrl.sv"
type="SYSTEM_VERILOG"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/mentor/av_xcvr_reconfig_pll.sv"
type="SYSTEM_VERILOG_ENCRYPT"
library="transconfig"
simulator="modelsim" />
<file
path="transconfig_sim/alt_xcvr_reconfig/mentor/av_xcvr_reconfig_pll_ctrl.sv"
type="SYSTEM_VERILOG_ENCRYPT"
library="transconfig"
simulator="modelsim" />
<file
path="transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_soc.sv"
type="SYSTEM_VERILOG"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_cpu_ram.sv"
type="SYSTEM_VERILOG"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_cpu_ram.hex"
type="OTHER"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_direct.sv"
type="SYSTEM_VERILOG"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/alt_arbiter_acq.sv"
type="SYSTEM_VERILOG"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_basic.sv"
type="SYSTEM_VERILOG"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/mentor/alt_arbiter_acq.sv"
type="SYSTEM_VERILOG_ENCRYPT"
library="transconfig"
simulator="modelsim" />
<file
path="transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig_basic.sv"
type="SYSTEM_VERILOG_ENCRYPT"
library="transconfig"
simulator="modelsim" />
<file
path="transconfig_sim/alt_xcvr_reconfig/av_xrbasic_l2p_addr.sv"
type="SYSTEM_VERILOG"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/av_xrbasic_l2p_ch.sv"
type="SYSTEM_VERILOG"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/av_xrbasic_l2p_rom.sv"
type="SYSTEM_VERILOG"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/av_xrbasic_lif_csr.sv"
type="SYSTEM_VERILOG"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/av_xrbasic_lif.sv"
type="SYSTEM_VERILOG"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/av_xcvr_reconfig_basic.sv"
type="SYSTEM_VERILOG"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/mentor/av_xrbasic_l2p_addr.sv"
type="SYSTEM_VERILOG_ENCRYPT"
library="transconfig"
simulator="modelsim" />
<file
path="transconfig_sim/alt_xcvr_reconfig/mentor/av_xrbasic_l2p_ch.sv"
type="SYSTEM_VERILOG_ENCRYPT"
library="transconfig"
simulator="modelsim" />
<file
path="transconfig_sim/alt_xcvr_reconfig/mentor/av_xrbasic_l2p_rom.sv"
type="SYSTEM_VERILOG_ENCRYPT"
library="transconfig"
simulator="modelsim" />
<file
path="transconfig_sim/alt_xcvr_reconfig/mentor/av_xrbasic_lif_csr.sv"
type="SYSTEM_VERILOG_ENCRYPT"
library="transconfig"
simulator="modelsim" />
<file
path="transconfig_sim/alt_xcvr_reconfig/mentor/av_xrbasic_lif.sv"
type="SYSTEM_VERILOG_ENCRYPT"
library="transconfig"
simulator="modelsim" />
<file
path="transconfig_sim/alt_xcvr_reconfig/mentor/av_xcvr_reconfig_basic.sv"
type="SYSTEM_VERILOG_ENCRYPT"
library="transconfig"
simulator="modelsim" />
<file
path="transconfig_sim/alt_xcvr_reconfig/alt_xcvr_arbiter.sv"
type="SYSTEM_VERILOG"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/alt_xcvr_m2s.sv"
type="SYSTEM_VERILOG"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/altera_wait_generate.v"
type="VERILOG"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/alt_xcvr_csr_selector.sv"
type="SYSTEM_VERILOG"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_arbiter.sv"
type="SYSTEM_VERILOG_ENCRYPT"
library="transconfig"
simulator="modelsim" />
<file
path="transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_m2s.sv"
type="SYSTEM_VERILOG_ENCRYPT"
library="transconfig"
simulator="modelsim" />
<file
path="transconfig_sim/alt_xcvr_reconfig/mentor/altera_wait_generate.v"
type="VERILOG_ENCRYPT"
library="transconfig"
simulator="modelsim" />
<file
path="transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_csr_selector.sv"
type="SYSTEM_VERILOG_ENCRYPT"
library="transconfig"
simulator="modelsim" />
<file
path="transconfig_sim/alt_xcvr_reconfig/sv_reconfig_bundle_to_basic.sv"
type="SYSTEM_VERILOG"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/mentor/sv_reconfig_bundle_to_basic.sv"
type="SYSTEM_VERILOG_ENCRYPT"
library="transconfig"
simulator="modelsim" />
<file
path="transconfig_sim/alt_xcvr_reconfig/av_reconfig_bundle_to_basic.sv"
type="SYSTEM_VERILOG"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/av_reconfig_bundle_to_xcvr.sv"
type="SYSTEM_VERILOG"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/mentor/av_reconfig_bundle_to_basic.sv"
type="SYSTEM_VERILOG_ENCRYPT"
library="transconfig"
simulator="modelsim" />
<file
path="transconfig_sim/alt_xcvr_reconfig/mentor/av_reconfig_bundle_to_xcvr.sv"
type="SYSTEM_VERILOG_ENCRYPT"
library="transconfig"
simulator="modelsim" />
<file
path="transconfig_sim/alt_xcvr_reconfig/plain_files.txt"
type="OTHER"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/mentor_files.txt"
type="OTHER"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/cadence_files.txt"
type="OTHER"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/synopsys_files.txt"
type="OTHER"
library="transconfig" />
<file
path="transconfig_sim/alt_xcvr_reconfig/aldec_files.txt"
type="OTHER"
library="transconfig" />
<file path="transconfig_sim/transconfig.vhd" type="VHDL" />
<topLevel name="transconfig" />
<deviceFamily name="cyclonev" />
</simPackage>

View file

@ -0,0 +1,149 @@
-- megafunction wizard: %Transceiver Reconfiguration Controller Intel FPGA IP v18.1%
-- GENERATION: XML
-- transconfig.vhd
-- Generated using ACDS version 18.1 625
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;
entity transconfig is
port (
reconfig_busy : out std_logic; -- reconfig_busy.reconfig_busy
mgmt_clk_clk : in std_logic := '0'; -- mgmt_clk_clk.clk
mgmt_rst_reset : in std_logic := '0'; -- mgmt_rst_reset.reset
reconfig_mgmt_address : in std_logic_vector(6 downto 0) := (others => '0'); -- reconfig_mgmt.address
reconfig_mgmt_read : in std_logic := '0'; -- .read
reconfig_mgmt_readdata : out std_logic_vector(31 downto 0); -- .readdata
reconfig_mgmt_waitrequest : out std_logic; -- .waitrequest
reconfig_mgmt_write : in std_logic := '0'; -- .write
reconfig_mgmt_writedata : in std_logic_vector(31 downto 0) := (others => '0'); -- .writedata
reconfig_to_xcvr : out std_logic_vector(349 downto 0); -- reconfig_to_xcvr.reconfig_to_xcvr
reconfig_from_xcvr : in std_logic_vector(229 downto 0) := (others => '0') -- reconfig_from_xcvr.reconfig_from_xcvr
);
end entity transconfig;
architecture rtl of transconfig is
component alt_xcvr_reconfig is
generic (
device_family : string := "Stratix V";
number_of_reconfig_interfaces : integer := 2;
enable_offset : integer := 1;
enable_lc : integer := 1;
enable_dcd : integer := 0;
enable_dcd_power_up : integer := 1;
enable_analog : integer := 1;
enable_eyemon : integer := 0;
enable_ber : integer := 0;
enable_dfe : integer := 0;
enable_adce : integer := 0;
enable_mif : integer := 0;
enable_pll : integer := 0
);
port (
reconfig_busy : out std_logic; -- reconfig_busy
mgmt_clk_clk : in std_logic := 'X'; -- clk
mgmt_rst_reset : in std_logic := 'X'; -- reset
reconfig_mgmt_address : in std_logic_vector(6 downto 0) := (others => 'X'); -- address
reconfig_mgmt_read : in std_logic := 'X'; -- read
reconfig_mgmt_readdata : out std_logic_vector(31 downto 0); -- readdata
reconfig_mgmt_waitrequest : out std_logic; -- waitrequest
reconfig_mgmt_write : in std_logic := 'X'; -- write
reconfig_mgmt_writedata : in std_logic_vector(31 downto 0) := (others => 'X'); -- writedata
reconfig_to_xcvr : out std_logic_vector(349 downto 0); -- reconfig_to_xcvr
reconfig_from_xcvr : in std_logic_vector(229 downto 0) := (others => 'X'); -- reconfig_from_xcvr
tx_cal_busy : out std_logic; -- tx_cal_busy
rx_cal_busy : out std_logic; -- tx_cal_busy
cal_busy_in : in std_logic := 'X'; -- cal_busy_in
reconfig_mif_address : out std_logic_vector(31 downto 0); -- address
reconfig_mif_read : out std_logic; -- read
reconfig_mif_readdata : in std_logic_vector(15 downto 0) := (others => 'X'); -- readdata
reconfig_mif_waitrequest : in std_logic := 'X' -- waitrequest
);
end component alt_xcvr_reconfig;
begin
transconfig_inst : component alt_xcvr_reconfig
generic map (
device_family => "Cyclone V",
number_of_reconfig_interfaces => 5,
enable_offset => 1,
enable_lc => 0,
enable_dcd => 0,
enable_dcd_power_up => 1,
enable_analog => 1,
enable_eyemon => 0,
enable_ber => 0,
enable_dfe => 0,
enable_adce => 0,
enable_mif => 0,
enable_pll => 0
)
port map (
reconfig_busy => reconfig_busy, -- reconfig_busy.reconfig_busy
mgmt_clk_clk => mgmt_clk_clk, -- mgmt_clk_clk.clk
mgmt_rst_reset => mgmt_rst_reset, -- mgmt_rst_reset.reset
reconfig_mgmt_address => reconfig_mgmt_address, -- reconfig_mgmt.address
reconfig_mgmt_read => reconfig_mgmt_read, -- .read
reconfig_mgmt_readdata => reconfig_mgmt_readdata, -- .readdata
reconfig_mgmt_waitrequest => reconfig_mgmt_waitrequest, -- .waitrequest
reconfig_mgmt_write => reconfig_mgmt_write, -- .write
reconfig_mgmt_writedata => reconfig_mgmt_writedata, -- .writedata
reconfig_to_xcvr => reconfig_to_xcvr, -- reconfig_to_xcvr.reconfig_to_xcvr
reconfig_from_xcvr => reconfig_from_xcvr, -- reconfig_from_xcvr.reconfig_from_xcvr
tx_cal_busy => open, -- (terminated)
rx_cal_busy => open, -- (terminated)
cal_busy_in => '0', -- (terminated)
reconfig_mif_address => open, -- (terminated)
reconfig_mif_read => open, -- (terminated)
reconfig_mif_readdata => "0000000000000000", -- (terminated)
reconfig_mif_waitrequest => '0' -- (terminated)
);
end architecture rtl; -- of transconfig
-- Retrieval info: <?xml version="1.0"?>
--<!--
-- Generated by Altera MegaWizard Launcher Utility version 1.0
-- ************************************************************
-- THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE!
-- ************************************************************
-- Copyright (C) 1991-2020 Altera Corporation
-- Any megafunction design, and related net list (encrypted or decrypted),
-- support information, device programming or simulation file, and any other
-- associated documentation or information provided by Altera or a partner
-- under Altera's Megafunction Partnership Program may be used only to
-- program PLD devices (but not masked PLD devices) from Altera. Any other
-- use of such megafunction design, net list, support information, device
-- programming or simulation file, or any other related documentation or
-- information is prohibited for any other purpose, including, but not
-- limited to modification, reverse engineering, de-compiling, or use with
-- any other silicon devices, unless such use is explicitly licensed under
-- a separate agreement with Altera or a megafunction partner. Title to
-- the intellectual property, including patents, copyrights, trademarks,
-- trade secrets, or maskworks, embodied in any such megafunction design,
-- net list, support information, device programming or simulation file, or
-- any other related documentation or information provided by Altera or a
-- megafunction partner, remains with Altera, the megafunction partner, or
-- their respective licensors. No other licenses, including any licenses
-- needed under any third party's intellectual property, are provided herein.
---->
-- Retrieval info: <instance entity-name="alt_xcvr_reconfig" version="18.1" >
-- Retrieval info: <generic name="device_family" value="Cyclone V" />
-- Retrieval info: <generic name="number_of_reconfig_interfaces" value="5" />
-- Retrieval info: <generic name="gui_split_sizes" value="" />
-- Retrieval info: <generic name="enable_offset" value="1" />
-- Retrieval info: <generic name="enable_dcd" value="0" />
-- Retrieval info: <generic name="enable_dcd_power_up" value="1" />
-- Retrieval info: <generic name="enable_analog" value="1" />
-- Retrieval info: <generic name="enable_eyemon" value="0" />
-- Retrieval info: <generic name="ber_en" value="0" />
-- Retrieval info: <generic name="enable_dfe" value="0" />
-- Retrieval info: <generic name="enable_adce" value="0" />
-- Retrieval info: <generic name="enable_mif" value="0" />
-- Retrieval info: <generic name="gui_enable_pll" value="0" />
-- Retrieval info: <generic name="gui_cal_status_port" value="false" />
-- Retrieval info: </instance>
-- IPFS_FILES : transconfig.vho
-- RELATED_FILES: transconfig.vhd, altera_xcvr_functions.sv, av_xcvr_h.sv, alt_xcvr_resync.sv, alt_xcvr_reconfig_h.sv, alt_xcvr_reconfig.sv, alt_xcvr_reconfig_cal_seq.sv, alt_xreconf_cif.sv, alt_xreconf_uif.sv, alt_xreconf_basic_acq.sv, alt_xcvr_reconfig_analog.sv, alt_xcvr_reconfig_analog_av.sv, alt_xreconf_analog_datactrl_av.sv, alt_xreconf_analog_rmw_av.sv, alt_xreconf_analog_ctrlsm.sv, alt_xcvr_reconfig_offset_cancellation.sv, alt_xcvr_reconfig_offset_cancellation_av.sv, alt_xcvr_reconfig_eyemon.sv, alt_xcvr_reconfig_dfe.sv, alt_xcvr_reconfig_adce.sv, alt_xcvr_reconfig_dcd.sv, alt_xcvr_reconfig_dcd_av.sv, alt_xcvr_reconfig_dcd_cal_av.sv, alt_xcvr_reconfig_dcd_control_av.sv, alt_xcvr_reconfig_mif.sv, av_xcvr_reconfig_mif.sv, av_xcvr_reconfig_mif_ctrl.sv, av_xcvr_reconfig_mif_avmm.sv, alt_xcvr_reconfig_pll.sv, av_xcvr_reconfig_pll.sv, av_xcvr_reconfig_pll_ctrl.sv, alt_xcvr_reconfig_soc.sv, alt_xcvr_reconfig_cpu_ram.sv, alt_xcvr_reconfig_direct.sv, alt_arbiter_acq.sv, alt_xcvr_reconfig_basic.sv, av_xrbasic_l2p_addr.sv, av_xrbasic_l2p_ch.sv, av_xrbasic_l2p_rom.sv, av_xrbasic_lif_csr.sv, av_xrbasic_lif.sv, av_xcvr_reconfig_basic.sv, alt_xcvr_arbiter.sv, alt_xcvr_m2s.sv, altera_wait_generate.v, alt_xcvr_csr_selector.sv, sv_reconfig_bundle_to_basic.sv, av_reconfig_bundle_to_basic.sv, av_reconfig_bundle_to_xcvr.sv, alt_xcvr_reconfig_cpu.v, alt_xcvr_reconfig_cpu_reconfig_cpu.v, alt_xcvr_reconfig_cpu_reconfig_cpu_test_bench.v, alt_xcvr_reconfig_cpu_mm_interconnect_0.v, alt_xcvr_reconfig_cpu_irq_mapper.sv, altera_reset_controller.v, altera_reset_synchronizer.v, altera_merlin_master_translator.sv, altera_merlin_slave_translator.sv, altera_merlin_master_agent.sv, altera_merlin_slave_agent.sv, altera_merlin_burst_uncompressor.sv, altera_avalon_sc_fifo.v, alt_xcvr_reconfig_cpu_mm_interconnect_0_router.sv, alt_xcvr_reconfig_cpu_mm_interconnect_0_router_001.sv, alt_xcvr_reconfig_cpu_mm_interconnect_0_router_002.sv, alt_xcvr_reconfig_cpu_mm_interconnect_0_router_003.sv, alt_xcvr_reconfig_cpu_mm_interconnect_0_cmd_demux.sv, alt_xcvr_reconfig_cpu_mm_interconnect_0_cmd_demux_001.sv, alt_xcvr_reconfig_cpu_mm_interconnect_0_cmd_mux.sv, altera_merlin_arbitrator.sv, alt_xcvr_reconfig_cpu_mm_interconnect_0_cmd_mux_001.sv, alt_xcvr_reconfig_cpu_mm_interconnect_0_rsp_mux.sv, alt_xcvr_reconfig_cpu_mm_interconnect_0_rsp_mux_001.sv, alt_xcvr_reconfig_cpu_mm_interconnect_0_avalon_st_adapter.v, alt_xcvr_reconfig_cpu_mm_interconnect_0_avalon_st_adapter_error_adapter_0.sv

View file

@ -0,0 +1,71 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
// Transceiver Reconfiguration Basic Arbiter Acquisition
//
// Client must make request to see grant. While not granted,
// all outputs to basic reconfig block will be gated to '0'
// $Header$
`timescale 1 ps / 1 ps
module alt_arbiter_acq #(
parameter addr_width = 3,
parameter data_width = 32
)
(
input wire clk, // this will be the reconfig clk
input wire reset,
// Internal interface for the bigger controlling module, like analog reconfig
input wire [addr_width-1:0] address, // MM address
input wire [data_width-1:0] writedata,
input wire write,
input wire read,
output reg waitrequest, // can use to tell internal master to wait when auto-request+release
output wire [data_width-1:0] readdata,
// MM master external interface, that connects to mutex-slave, like the reconfig_basic block
output wire [addr_width-1:0] master_address, // MM address
output wire [data_width-1:0] master_writedata,
output wire master_write,
output wire master_read,
input wire master_waitrequest, // needed for a valid master interface
input wire [data_width-1:0] master_readdata, // from mutex-slave
// external connect to switch fabric: request basic access from arbiter
output wire arb_req,
input wire arb_grant,
// internal request from local client: request mutex access and should be held high as long as mutex is used
input wire mutex_req,
output wire mutex_grant
);
wire granted; // true when request is active, and grant is active
assign arb_req = mutex_req; // forward client request to arbiter
assign granted = mutex_req & arb_grant; // only tell client they're granted access to basic is they are requesting
assign mutex_grant = granted;
// basic-block facing: master Avalon interface
assign master_address = address & {addr_width{granted}};
assign master_writedata = writedata & {data_width{granted}};
assign master_write = write & granted;
assign master_read = read & granted;
// internal client facing: slave Avalon interface
assign waitrequest = master_waitrequest | ~granted; // always in wait request if not granted access
assign readdata = master_readdata;
endmodule

View file

@ -0,0 +1,68 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
// Clocked priority encoder with state
//
// On each clock cycle, updates state to show which request is granted.
// Most recent grant holder is always the highest priority.
// If current grant holder is not making a request, while others are,
// then new grant holder is always the requester with lowest bit number.
// If no requests, current grant holder retains grant state
// $Header$
`timescale 1 ns / 1 ns
module alt_xcvr_arbiter #(
parameter width = 2
) (
input wire clock,
input wire [width-1:0] req, // req[n] requests for this cycle
output reg [width-1:0] grant // grant[n] means requester n is grantee in this cycle
);
wire idle; // idle when no requests
wire [width-1:0] keep; // keep[n] means requester n is requesting, and already has the grant
// Note: current grantee is always highest priority for next grant
wire [width-1:0] take; // take[n] means requester n is requesting, and there are no higher-priority requests
assign keep = req & grant; // current grantee is always highest priority for next grant
assign idle = ~| req; // idle when no requests
initial begin
grant = 0;
end
// grant next state depends on current grant and take priority
always @(posedge clock) begin
grant <=
// synthesis translate_off
(grant === {width{1'bx}})? {width{1'b0}} :
// synthesis translate_on
keep // if current grantee is requesting, gets to keep grant
| ({width{idle}} & grant) // if no requests, grant state remains unchanged
| take; // take applies only if current grantee is not requesting
end
// 'take' bus encodes priority. Request with lowest bit number wins when current grantee not requesting
assign take[0] = req[0]
& (~| (keep & ({width{1'b1}} << 1))); // no 'keep' from lower-priority inputs
genvar i;
generate
for (i=1; i < width; i = i + 1) begin : arb
assign take[i] = req[i]
& (~| (keep & ({width{1'b1}} << (i+1)))) // no 'keep' from lower-priority inputs
& (~| (req & {i{1'b1}})); // no 'req' from higher-priority inputs
end
endgenerate
endmodule

View file

@ -0,0 +1,122 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
//
// Select a sub-group from a wide register
// Useful for indirection indexing
//
// $Header$
//
`timescale 1 ns / 1 ns
module csr_mux #(
parameter groups = 2,
parameter grp_size = 1,
parameter sel_size = 1
)
(
input wire [groups*grp_size-1:0] in_wide,
input tri0 [sel_size-1:0] sel,
output wire [grp_size-1:0] out_narrow
);
// lpm_mux #(.lpm_size(groups), .lpm_width(grp_size), .lpm_widths(sel_size))
// mux (.data(in_wide), .sel(sel), .result(out_narrow));
wire [grp_size-1:0] in_groups [groups-1:0];
// a synthesizable mux, with a parameterized number of inputs
genvar i;
assign in_groups[0] = in_wide[grp_size-1:0] & {grp_size{sel == 0}};
generate for (i=1; i<groups; i = i+1) begin: mux
assign in_groups[i] = in_groups[i-1] | in_wide[i*grp_size +: grp_size] & {grp_size{sel == i}};
end
endgenerate
assign out_narrow = in_groups[groups-1];
endmodule
//
// write to a sub-group of a wide register
// Useful for indirection indexing on write
//
module csr_indexed_write_mux #(
parameter groups = 2,
parameter grp_size = 1,
parameter sel_size = 1,
parameter init_value = 0
)
(
input wire [grp_size-1:0] in_narrow,
input tri0 [sel_size-1:0] sel,
output wire [grp_size-1:0] out_narrow, // for read back to mgmt interface
input wire [groups*grp_size-1:0] in_wide, // full-width control reg state
output wire [groups*grp_size-1:0] out_wide // to write to full-width control reg
);
wire [groups*grp_size-1:0] wire_wide [groups-1:0];
// in_narrow is output in the group position indicated by .sel() input
genvar i;
assign wire_wide[0] = (in_wide & {grp_size{sel != 0}}) | (in_narrow & {grp_size{sel == 0}});
generate for (i=1; i<groups; i = i+1) begin: mux
assign wire_wide[i] = wire_wide[i-1]
| (in_wide & {{grp_size{sel != i}}, {(grp_size*i){1'b0}}})
| ({in_narrow & {grp_size{sel == i}}, {(grp_size*i){1'b0}}});
end
endgenerate
assign out_wide = wire_wide[groups-1];
// generate out_narrow as ordinary mux of in_wide
csr_mux #(.groups(groups), .grp_size(grp_size), .sel_size(sel_size))
o_narrow(.in_wide(in_wide), .sel(sel), .out_narrow(out_narrow));
endmodule
//
// read from a sub-group of a wide, async status input
// Creates synchronization logic to sample in local clock domain
// Useful for indirection indexing on read-only status bits
//
module csr_indexed_read_only_reg #(
parameter groups = 2,
parameter grp_size = 1,
parameter sel_size = 1,
parameter sync_stages = 2
)
(
input wire clk,
input tri0 [sel_size-1:0] sel,
output wire [grp_size-1:0] out_narrow, // for read back to mgmt interface
input wire [groups*grp_size-1:0] async_in_wide // full-width async status inputs
);
localparam sync_stages_str = sync_stages[7:0] + 8'd48; // number of sync stages specified as string (for timing constraints)
localparam SYNC_SREG_CONSTRAINT = {"-name SDC_STATEMENT \"set regs [get_registers -nowarn *csr_indexed_read_only_reg*sreg[",sync_stages_str,"]*]; if {[llength [query_collection -report -all $regs]] > 0} {set_false_path -to $regs}\""};
localparam SDC_CONSTRAINTS = {SYNC_SREG_CONSTRAINT};
// read-only status registers are synchronized forms of async status signals
// async inputs go to sreg [sync_stages], and come out synchronized at sreg [1]
// Apply false path timing constraints to synchronization registers.
(* altera_attribute = SDC_CONSTRAINTS *)
reg [groups*grp_size-1:0] sreg [sync_stages:1];
integer stage;
always @(posedge clk) begin
sreg[sync_stages] <= async_in_wide;
for (stage=2; stage <= sync_stages; stage = stage + 1) begin
// additional sync stages
sreg[stage-1] <= sreg[stage];
end
end
// generate out_narrow as ordinary mux of out_wide
csr_mux #(.groups(groups), .grp_size(grp_size), .sel_size(sel_size))
o_narrow(.in_wide(sreg[1]), .sel(sel), .out_narrow(out_narrow));
endmodule

View file

@ -0,0 +1,61 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
// Master-to-slave access fabric
//
// Combined with external multi-master arbitration, this block gates
// master read, write, address, and writedata outputs, and generates
// a waitrequest when arbiter indicates access is not granted
// $Header$
`timescale 1 ns / 1 ns
module alt_xcvr_m2s #(
parameter width_addr = 3,
parameter width_data = 32
) (
input wire clock,
output wire req, // request to arbiter for slave access
input wire grant,
// signals from/to master
input wire m_read,
input wire m_write,
input wire [width_addr-1:0] m_address,
input wire [width_data-1:0] m_writedata,
output wire [width_data-1:0] m_readdata,
output wire m_waitrequest,
// signals from/to slave
output wire s_read,
output wire s_write,
output wire [width_addr-1:0] s_address,
output wire [width_data-1:0] s_writedata,
input wire [width_data-1:0] s_readdata,
input wire s_waitrequest
);
// If master is requesting access, generate waitreq until granted
assign req = m_read | m_write; // master access requests
assign m_waitrequest = grant ? s_waitrequest : req;
// gate outputs to slave with grant signal
assign s_read = m_read & grant;
assign s_write = m_write & grant;
assign s_address = m_address & {width_addr{grant}};
assign s_writedata = m_writedata & {width_data{grant}};
// slave data outputs pass through directly
assign m_readdata = s_readdata;
endmodule

View file

@ -0,0 +1,994 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
// Transceiver Reconfiguration Module
//
// Includes many function-specific sub-modules, such as:
// - analog reconfig (alt_xcvr_reconfig_analog)
// - offset cancellation (alt_xcvr_reconfig_offset_cancellation)
// - ...
// TODO - Add support to read configuration (enabled options)
// $Header$
`timescale 1 ns / 1 ns
module alt_xcvr_reconfig #(
parameter device_family = "Stratix V",
// reconfig blocks to enable or disable
parameter enable_offset = 1, // always need offset cancellation to calibrate buffers
parameter enable_lc = 1, // LC Tuning
parameter enable_dcd = 0, // DCD
parameter enable_dcd_power_up = 1, // 0: manual trigger; 1: manual trigger + auto run upon power up
parameter enable_analog = 0, // manual tuning of buffer analog parameters
parameter enable_eyemon = 0, // EyeQ
parameter enable_ber = 0, //Enables the BER Counter
parameter enable_dfe = 0, // DFE
parameter enable_adce = 0, // ADCE
parameter enable_mif = 0, // MIF streaming
parameter enable_pll = 0, // PLL reconfig
parameter enable_direct = 1, // Direct Basic access
// number of physical reconfig interfaces
parameter number_of_reconfig_interfaces = 1
) (
input wire mgmt_clk_clk,
input wire mgmt_rst_reset,
// user reconfiguration management interface
input wire [6:0] reconfig_mgmt_address,
output wire reconfig_mgmt_waitrequest,
input wire reconfig_mgmt_read,
output wire [31:0] reconfig_mgmt_readdata,
input wire reconfig_mgmt_write,
input wire [31:0] reconfig_mgmt_writedata,
output wire reconfig_busy,
// calibration port
input wire cal_busy_in,
output wire tx_cal_busy,
output wire rx_cal_busy,
//MIF storage interface
output wire [31:0] reconfig_mif_address,
output wire reconfig_mif_read,
input wire reconfig_mif_waitrequest,
input wire [15:0] reconfig_mif_readdata,
// bundled reconfig buses
output wire [altera_xcvr_functions::get_reconfig_to_width(device_family,number_of_reconfig_interfaces) -1:0] reconfig_to_xcvr, // all native xcvr reconfig sinks
input wire [altera_xcvr_functions::get_reconfig_from_width(device_family,number_of_reconfig_interfaces)-1:0] reconfig_from_xcvr // all native xcvr reconfig sources
);
// Enable CMU kickstart IP for Arria V and Cyclone V ES.
localparam l_enable_lc =
`ifdef ALTERA_RESERVED_QIS_ES
`ifndef ALTERA_RESERVED_XCVR_DISABLE_CMU_KICKSTART
(altera_xcvr_functions::has_a5_style_hssi(device_family) || altera_xcvr_functions::has_c5_style_hssi(device_family)) ? 1 :
`endif
`endif
enable_lc;
import alt_xcvr_reconfig_h::*;
// count of the total number of sub-components that can act
// as slaves to the mgmt interface, and masters to the 'basic' block
localparam arb_count = INDEX_XR_END;
// Use CPU for various features
localparam enable_soc_offset = enable_offset ? ((altera_xcvr_functions::has_s5_style_hssi(device_family)) ? 1 : 0) : 0; // use SOC for OC, but only for Stratix V
localparam enable_soc_dcd = enable_dcd ? 0 : 0; // use SOC for DCD
localparam enable_soc_lc = l_enable_lc ? 1 : 0; // use SOC for LC Tuning and CMU kickstart
localparam enable_soc_analog = enable_analog ? 0 : 0; // use SOC for manual tuning of buffer analog parameters
localparam enable_soc_eyemon = enable_eyemon ? 0 : 0; // use SOC for EyeQ
localparam enable_soc_dfe = enable_dfe ? 0 : 0; // use SOC for DFE
localparam enable_soc_adce = enable_adce ? 0 : 0; // use SOC for ADCE
localparam enable_soc_mif = enable_mif ? 0 : 0; // use SOC for MIF streaming
localparam enable_soc_pll = enable_pll ? 0 : 0; // use SOC for PLL reconfig
localparam enable_soc_direct = enable_direct ? 0 : 0; // use SOC for Direct Basic access
// Conditions for enabling the reconfig CPU
localparam [arb_count-1:0] enable_soc_mask
= (enable_soc_offset[arb_count-1:0] << INDEX_XR_OFFSET )
| (enable_soc_dcd [arb_count-1:0] << INDEX_XR_DCD )
| (enable_soc_lc [arb_count-1:0] << INDEX_XR_LC )
| (enable_soc_analog[arb_count-1:0] << INDEX_XR_ANALOG )
| (enable_soc_eyemon[arb_count-1:0] << INDEX_XR_EYEMON )
| (enable_soc_dfe [arb_count-1:0] << INDEX_XR_DFE )
| (enable_soc_adce [arb_count-1:0] << INDEX_XR_ADCE )
| (enable_soc_mif [arb_count-1:0] << INDEX_XR_MIF )
| (enable_soc_pll [arb_count-1:0] << INDEX_XR_PLL )
| (enable_soc_direct[arb_count-1:0] << INDEX_XR_DIRECT );
localparam width_awa = W_XR_FEATURE_LADDR; // word address width of interface to analog reconfig block
localparam width_bwa = W_XR_FEATURE_LADDR; // word address width of interface to basic reconfig block
// decoder block index, for 8-word address blocks
localparam arb_offset = INDEX_XR_OFFSET;
localparam arb_analog = INDEX_XR_ANALOG;
localparam arb_eyemon = INDEX_XR_EYEMON;
localparam arb_dfe = INDEX_XR_DFE;
localparam arb_direct = INDEX_XR_DIRECT;
localparam arb_adce = INDEX_XR_ADCE;
localparam arb_lc = INDEX_XR_LC;
localparam arb_mif = INDEX_XR_MIF;
localparam arb_dcd = INDEX_XR_DCD;
localparam arb_pll = INDEX_XR_PLL;
///////////////////////////////////////////////////////////////////////
// Connections between sub-components and the basic interface (switch)
///////////////////////////////////////////////////////////////////////
// Decoded slave block output ports, mgmt facing
wire [31:0] blk2mgmt_readdata [arb_count-1:0];
wire blk2mgmt_waitrequest [arb_count-1:0];
// CPU -> MGMT connections
wire [31:0] cpu_mgmt_readdata;
wire cpu_mgmt_waitrequest;
wire [arb_count-1:0] cpu_busy;
// Decoded slave block output ports, basic facing (from CPU)
wire cpu_basic_read;
wire cpu_basic_write;
wire [width_bwa-1:0] cpu_basic_address;
wire [31:0] cpu_basic_writedata;
wire [arb_count-1:0] cpu_basic_req;
// Decoded slave block output ports, basic facing
wire blk2basic_read [arb_count-1:0];
wire blk2basic_write [arb_count-1:0];
wire [width_bwa-1:0] blk2basic_address [arb_count-1:0];
wire [31:0] blk2basic_writedata [arb_count-1:0];
// master interface to basic reconfiguration block that interfaces to the transceiver channel
wire [width_bwa-1:0] basic_address;
wire basic_waitrequest;
wire basic_irq;
wire basic_read;
wire [31:0] basic_readdata;
wire basic_write;
wire [31:0] basic_writedata;
// native testbus interfaces: to logical interface:
wire [7:0] lch_testbus; // testbus from native reconfig, for selected channel, from basic block
wire [23:0] pch_testbus; // triplet testbus
wire lch_atbout;
// gate soft-IPs from running by holding off logical mutex until interface select is done
wire ifsel_notdone;
reg ifsel_notdone_resync;
wire reconfig_subblock_reset;
///////////////////////////////////////////////////////////////////////
// Decoder for multiple slaves of reconfig_mgmt interface
///////////////////////////////////////////////////////////////////////
wire [arb_count-1:0] r_decode;
// intermediate wires for mgmt readdata and waitrequest muxes
wire [31:0] wmgmt_readdata [arb_count-1:0];
wire wmgmt_waitrequest [arb_count-1:0];
// intermediate wires for basic read, write, address, and writedata OR's
wire [width_bwa-1:0] wbasic_address [arb_count-1:0]; // basic.address
wire wbasic_read [arb_count-1:0]; // .read
wire wbasic_write [arb_count-1:0]; // .write
wire [31:0] wbasic_writedata [arb_count-1:0]; // .writedata
// interconnection between PLL and MIF IP
wire pll_mif_busy;
wire pll_mif_err;
wire mif_pll_go;
wire mif_pll_type;
wire [9:0] mif_pll_lch;
wire [3:0] mif_pll_data;
wire mif_pll_pll_type;
// Busy and done signals for each feature IP
wire [arb_count-1:0] busy;
wire [arb_count-1:0] done;
wire [arb_count-1:0] hold;
wire oc_cal_busy;
wire cpu_unused; //dummy wire for warning reduction
// prevent warnings
assign cpu_unused = & {1'b0,cpu_basic_address,cpu_mgmt_readdata,cpu_mgmt_waitrequest,cpu_basic_read,
cpu_basic_writedata,cpu_basic_write,cpu_busy,cpu_basic_req};
wire r_mgmt_rst_reset;
//////////////////////////////////////////////////////////////////////////////////////
// Synchronize the reset
// This is a data synchronizer; ensures synchronous assertion and deassertion
// NOTE: This is different from reset synchronizer; reset synchronizer only ensures
// synchronous deassertion.
//////////////////////////////////////////////////////////////////////////////////////
alt_xcvr_resync #(
.INIT_VALUE (1)
) inst_reconfig_reset_sync (
.clk (mgmt_clk_clk ),
.reset (1'd0 ),
.d (mgmt_rst_reset ),
.q (r_mgmt_rst_reset )
);
genvar i;
generate for (i=0; i<arb_count; i = i+1) begin: dec
// a synthesizable decoder, with a parameterized number of outputs
assign r_decode[i] = (reconfig_mgmt_address[6:width_awa] == i);
// reconfig_mgmt output generation is muxing of decoded slave output
// basic block input generation is OR-ing of blk2basic outputs
if (i == 0) begin
assign wmgmt_readdata[0] = blk2mgmt_readdata[0] & {32{r_decode[0]}};
assign wmgmt_waitrequest[0] = blk2mgmt_waitrequest[0] & r_decode[0];
assign wbasic_address[i] = blk2basic_address[i];
assign wbasic_read[i] = blk2basic_read[i];
assign wbasic_write[i] = blk2basic_write[i];
assign wbasic_writedata[i] = blk2basic_writedata[i];
end
else begin
assign wmgmt_readdata[i] = wmgmt_readdata[i-1] | blk2mgmt_readdata[i] & {32{r_decode[i]}};
assign wmgmt_waitrequest[i] = wmgmt_waitrequest[i-1] | blk2mgmt_waitrequest[i] & r_decode[i];
assign wbasic_address[i] = wbasic_address[i-1] | blk2basic_address[i];
assign wbasic_read[i] = wbasic_read[i-1] | blk2basic_read[i];
assign wbasic_write[i] = wbasic_write[i-1] | blk2basic_write[i];
assign wbasic_writedata[i] = wbasic_writedata[i-1] | blk2basic_writedata[i];
end
end
endgenerate
//use bit 8 as the combined busy bit for the user
assign reconfig_mgmt_readdata = (reconfig_mgmt_address[width_awa-1:0] == XR_STATUS_OFST) ?
wmgmt_readdata[arb_count-1] | (reconfig_busy << XR_STATUS_OFST_COMB_BUSY) :
wmgmt_readdata[arb_count-1];
//assign reconfig_mgmt_readdata = wmgmt_readdata[arb_count-1];
assign reconfig_mgmt_waitrequest = wmgmt_waitrequest[arb_count-1];
assign basic_address = wbasic_address[arb_count-1];
assign basic_read = wbasic_read[arb_count-1];
assign basic_write = wbasic_write[arb_count-1];
assign basic_writedata = wbasic_writedata[arb_count-1];
///////////////////////////////////////////////////////////////////////
// Arbiter for multiple masters accessing 'basic' reconfig slave port
///////////////////////////////////////////////////////////////////////
wire [arb_count-1:0] req; // req[0] is highest priority when current grantee is done
wire [arb_count-1:0] temp_grant;
wire [arb_count-1:0] grant;
reg [arb_count-1:0] reg_grant_last;
wire lif_is_active; // indicates at least 1 request & grant pair present. Must go low 1 cycle on grant change
// -ifsel_done indicates that serial shift load is completed and interface_select has be switched over to enable DPRIO access
// -if serial shift load is not done, then grant should remain '0'
assign grant = temp_grant;
// generate lif_is_active low when no request, or in cycle after grant change
assign lif_is_active = ( | req) & (grant == reg_grant_last);
alt_xcvr_arbiter #(
.width(arb_count) // count total number of sub-components that act as masters to 'basic'
) arbiter (
.clock(mgmt_clk_clk),
.req(req),
.grant(temp_grant)
);
// grant last state, for change detection
always @(posedge mgmt_clk_clk or posedge r_mgmt_rst_reset) begin
if (r_mgmt_rst_reset == 1)
reg_grant_last <= {arb_count{1'b0}};
else
reg_grant_last <= grant | cpu_unused; // cpu_unused is always 1'b0, but is used as warning reduction
end
///////////////////////////////////////////
// Sub-component: offset cancellation
// word address offset: +0 (0x00 in bytes)
///////////////////////////////////////////
generate if (enable_offset && !enable_soc_offset) begin:offset
assign busy[arb_offset] = ~done[arb_offset];
alt_xcvr_reconfig_offset_cancellation #(
.number_of_reconfig_interfaces(number_of_reconfig_interfaces),
.device_family(device_family)
) sc_offset (
.reconfig_clk(mgmt_clk_clk),
.reset(reconfig_subblock_reset),
// external mgmt interface facing
.offset_cancellation_address (reconfig_mgmt_address[2:0]),
.offset_cancellation_writedata (reconfig_mgmt_writedata),
.offset_cancellation_write (reconfig_mgmt_write & r_decode[arb_offset]),
.offset_cancellation_read (reconfig_mgmt_read & r_decode[arb_offset]),
.offset_cancellation_readdata (blk2mgmt_readdata[arb_offset]),
.offset_cancellation_waitrequest(blk2mgmt_waitrequest[arb_offset]),
.offset_cancellation_done (done[arb_offset]),
.testbus_data ({number_of_reconfig_interfaces{16'd0}} | lch_testbus[7:0]),
// master-to-slave fabric facing, to basic reconfig
.offset_cancellation_irq_from_base(),
.offset_cancellation_waitrequest_from_base(basic_waitrequest),
.offset_cancellation_readdata_base (basic_readdata),
.offset_cancellation_address_base (blk2basic_address [arb_offset]),
.offset_cancellation_writedata_base (blk2basic_writedata[arb_offset]),
.offset_cancellation_write_base (blk2basic_write [arb_offset]),
.offset_cancellation_read_base (blk2basic_read [arb_offset]),
// fabric acquisition for basic block access
.arb_req (req[arb_offset]),
.arb_grant(grant[arb_offset])
);
end else if (enable_offset && enable_soc_offset) begin:soc_offset
// Use soft offset cancellation block
// CPU <-> MGMT connections
assign blk2mgmt_readdata [arb_offset] = cpu_mgmt_readdata;
assign blk2mgmt_waitrequest[arb_offset] = cpu_mgmt_waitrequest;
// CPU <-> Basic connections
assign blk2basic_address [arb_offset] = cpu_basic_address;
assign blk2basic_writedata [arb_offset] = cpu_basic_writedata;
assign blk2basic_write [arb_offset] = cpu_basic_write;
assign blk2basic_read [arb_offset] = cpu_basic_read;
assign req [arb_offset] = cpu_basic_req[arb_offset];
assign busy [arb_offset] = cpu_busy[arb_offset];
assign done [arb_offset] = ~busy[arb_offset];
end else begin:no_offset
// plceholders for missing block
assign blk2mgmt_readdata [arb_offset] = 32'd0;
assign blk2mgmt_waitrequest [arb_offset] = 1'b0;
assign blk2basic_address [arb_offset] = {width_bwa{1'b0}};
assign blk2basic_writedata [arb_offset] = 32'd0;
assign blk2basic_write [arb_offset] = 1'b0;
assign blk2basic_read [arb_offset] = 1'b0;
assign req [arb_offset] = 1'b0;
assign busy [arb_offset] = 1'b0;
assign done [arb_offset] = ~busy[arb_offset];
end
endgenerate
////////////////////////////////////
// Sub-component: analog controls
// word address offset: +8
////////////////////////////////////
generate if (enable_analog && !enable_soc_analog) begin:analog
// Use hard analog block
assign busy[arb_analog] = ~done[arb_analog];
alt_xcvr_reconfig_analog #(
.device_family(device_family)
) sc_analog (
.reconfig_clk(mgmt_clk_clk),
.reset(reconfig_subblock_reset),
// external mgmt interface facing
.analog_reconfig_address (reconfig_mgmt_address[width_awa-1:0]),
.analog_reconfig_writedata (reconfig_mgmt_writedata),
.analog_reconfig_write (reconfig_mgmt_write & r_decode[arb_analog]),
.analog_reconfig_read (reconfig_mgmt_read & r_decode[arb_analog]),
.analog_reconfig_readdata (blk2mgmt_readdata[arb_analog]),
.analog_reconfig_waitrequest(blk2mgmt_waitrequest[arb_analog]),
.analog_reconfig_done (done[arb_analog]),
// master-to-slave fabric facing, to basic reconfig
.analog_reconfig_irq_from_base(),
.analog_reconfig_waitrequest_from_base(basic_waitrequest),
.analog_reconfig_readdata_base (basic_readdata),
.analog_reconfig_address_base (blk2basic_address [arb_analog]),
.analog_reconfig_writedata_base (blk2basic_writedata[arb_analog]),
.analog_reconfig_write_base (blk2basic_write [arb_analog]),
.analog_reconfig_read_base (blk2basic_read [arb_analog]),
// fabric acquisition for basic block access
.arb_req (req[arb_analog]),
.arb_grant(grant[arb_analog])
);
end else if(enable_analog && enable_soc_analog) begin:soc_analog
// Use soft analog block
// CPU <-> MGMT connections
assign blk2mgmt_readdata [arb_analog] = cpu_mgmt_readdata;
assign blk2mgmt_waitrequest[arb_analog] = cpu_mgmt_waitrequest;
// CPU <-> Basic connections
assign blk2basic_address [arb_analog] = cpu_basic_address;
assign blk2basic_writedata [arb_analog] = cpu_basic_writedata;
assign blk2basic_write [arb_analog] = cpu_basic_write;
assign blk2basic_read [arb_analog] = cpu_basic_read;
assign req [arb_analog] = cpu_basic_req[arb_analog];
assign busy [arb_analog] = cpu_busy[arb_analog];
assign done [arb_analog] = ~busy[arb_analog];
end else begin:no_analog
// Disable analog block
assign blk2mgmt_readdata [arb_analog] = 32'd0;
assign blk2mgmt_waitrequest [arb_analog] = 1'b0;
assign blk2basic_address [arb_analog] = {width_bwa{1'b0}};
assign blk2basic_writedata [arb_analog] = 32'd0;
assign blk2basic_write [arb_analog] = 1'b0;
assign blk2basic_read [arb_analog] = 1'b0;
assign req [arb_analog] = 1'b0;
assign busy [arb_analog] = 1'b0;
assign done [arb_analog] = ~busy[arb_analog];
end
endgenerate
///////////////////////////////////////////
// Sub-component: "EyeQ" eye monitor
// word address offset: +16
///////////////////////////////////////////
generate if (enable_eyemon) begin:eyemon
assign busy[arb_eyemon] = ~done[arb_eyemon];
alt_xcvr_reconfig_eyemon #(
.number_of_reconfig_interfaces (number_of_reconfig_interfaces),
.enable_ber_counter (enable_ber),
.device_family (device_family)
) sc_eyemon (
.reconfig_clk (mgmt_clk_clk),
.reset (reconfig_subblock_reset),
// external mgmt interface facing
.eyemon_address (reconfig_mgmt_address[2:0]),
.eyemon_writedata (reconfig_mgmt_writedata),
.eyemon_write (reconfig_mgmt_write & r_decode[arb_eyemon]),
.eyemon_read (reconfig_mgmt_read & r_decode[arb_eyemon]),
.eyemon_readdata (blk2mgmt_readdata[arb_eyemon]),
.eyemon_waitrequest (blk2mgmt_waitrequest[arb_eyemon]),
.eyemon_done (done[arb_eyemon]),
// master-to-slave fabric facing, to basic reconfig
.eyemon_waitrequest_from_base (basic_waitrequest),
.eyemon_readdata_base (basic_readdata),
.eyemon_address_base (blk2basic_address [arb_eyemon]),
.eyemon_writedata_base (blk2basic_writedata[arb_eyemon]),
.eyemon_write_base (blk2basic_write [arb_eyemon]),
.eyemon_read_base (blk2basic_read [arb_eyemon]),
.eyemon_irq_from_base (),
// fabric acquisition for basic block access
.arb_req (req[arb_eyemon]),
.arb_grant (grant[arb_eyemon]),
//testbus
.eyemon_testbus (lch_testbus)
);
end
else begin:no_eyemon
// placeholders for missing block
assign blk2mgmt_readdata [arb_eyemon] = 32'd0;
assign blk2mgmt_waitrequest[arb_eyemon] = 1'b0;
assign blk2basic_address [arb_eyemon] = {width_bwa{1'b0}};
assign blk2basic_writedata[arb_eyemon] = 32'd0;
assign blk2basic_write [arb_eyemon] = 1'b0;
assign blk2basic_read [arb_eyemon] = 1'b0;
assign req [arb_eyemon] = 1'b0;
assign busy [arb_eyemon] = 1'b0;
assign done [arb_eyemon] = ~busy[arb_eyemon];
end
endgenerate
///////////////////////////////////////////
// Sub-component: DFE
// word address offset: +24
///////////////////////////////////////////
// DFE controls 'done' signal, mainly for S4 legacy
generate if (enable_dfe) begin:dfe
assign busy[arb_dfe] = ~done[arb_dfe];
alt_xcvr_reconfig_dfe #(
.number_of_reconfig_interfaces (number_of_reconfig_interfaces),
.device_family (device_family)
) sc_dfe (
.reconfig_clk (mgmt_clk_clk),
.reset (reconfig_subblock_reset),
.hold (hold[arb_dfe]),
// external mgmt interface facing
.dfe_address (reconfig_mgmt_address[2:0]),
.dfe_writedata (reconfig_mgmt_writedata),
.dfe_write (reconfig_mgmt_write & r_decode[arb_dfe]),
.dfe_read (reconfig_mgmt_read & r_decode[arb_dfe]),
.dfe_readdata (blk2mgmt_readdata[arb_dfe]),
.dfe_waitrequest (blk2mgmt_waitrequest[arb_dfe]),
.dfe_done (done[arb_dfe]),
// master-to-slave fabric facing, to basic reconfig
.dfe_waitrequest_from_base (basic_waitrequest),
.dfe_readdata_base (basic_readdata),
.dfe_address_base (blk2basic_address [arb_dfe]),
.dfe_writedata_base (blk2basic_writedata[arb_dfe]),
.dfe_write_base (blk2basic_write [arb_dfe]),
.dfe_read_base (blk2basic_read [arb_dfe]),
.dfe_irq_from_base(),
// fabric acquisition for basic block access
.arb_req (req[arb_dfe]),
.arb_grant (grant[arb_dfe]),
// testbus
.dfe_testbus (lch_testbus)
);
end
else begin:no_dfe
// placeholders for missing block
assign blk2mgmt_readdata [arb_dfe] = 32'd0;
assign blk2mgmt_waitrequest[arb_dfe] = 1'b0;
assign blk2basic_address [arb_dfe] = {width_bwa{1'b0}};
assign blk2basic_writedata[arb_dfe] = 32'd0;
assign blk2basic_write [arb_dfe] = 1'b0;
assign blk2basic_read [arb_dfe] = 1'b0;
assign req [arb_dfe] = 1'b0;
assign busy [arb_dfe] = 1'b0;
assign done [arb_dfe] = ~busy[arb_dfe];
end
endgenerate
///////////////////////////////////////////
// Sub-component: direct access
// word address offset: +32
///////////////////////////////////////////
assign busy[arb_direct] = 1'b0;
assign done[arb_direct] = ~busy[arb_direct];
generate
if (enable_direct) begin:direct
alt_xcvr_reconfig_direct #(
.device_family(device_family)
) sc_direct (
.clk(mgmt_clk_clk),
.reset(reconfig_subblock_reset),
// external mgmt interface facing
.address (reconfig_mgmt_address[2:0]),
.writedata (reconfig_mgmt_writedata),
.write (reconfig_mgmt_write & r_decode[arb_direct]),
.read (reconfig_mgmt_read & r_decode[arb_direct]),
.readdata (blk2mgmt_readdata[arb_direct]),
.waitrequest(blk2mgmt_waitrequest[arb_direct]),
// master-to-slave fabric facing, to basic reconfig
.basic_waitrequest(basic_waitrequest),
.basic_readdata (basic_readdata),
.basic_address (blk2basic_address [arb_direct]),
.basic_writedata (blk2basic_writedata[arb_direct]),
.basic_write (blk2basic_write [arb_direct]),
.basic_read (blk2basic_read [arb_direct]),
// fabric acquisition for basic block access
.arb_req (req[arb_direct]),
.arb_grant(grant[arb_direct])
);
end
else begin:no_direct
// placeholders for missing block
assign req[arb_direct] = 1'b0;
assign blk2mgmt_readdata [arb_direct] = 32'd0;
assign blk2mgmt_waitrequest[arb_direct] = 1'b0;
assign blk2basic_address [arb_direct] = {width_bwa{1'b0}};
assign blk2basic_writedata[arb_direct] = 32'd0;
assign blk2basic_write [arb_direct] = 1'b0;
assign blk2basic_read [arb_direct] = 1'b0;
end
endgenerate
///////////////////////////////////////////
// Sub-component: ADCE
// word address offset: +40 (0x28)
///////////////////////////////////////////
generate
if (enable_adce) begin:adce
assign busy[arb_adce]= ~done[arb_adce];
alt_xcvr_reconfig_adce
#(
.number_of_reconfig_interfaces ( number_of_reconfig_interfaces ),
.device_family ( device_family )
) sc_adce
(
.reconfig_clk ( mgmt_clk_clk ),
.reset ( reconfig_subblock_reset ),
.hold ( hold[arb_adce] ),
// external mgmt interface facing
.adce_address ( reconfig_mgmt_address[ 2:0 ] ),
.adce_writedata ( reconfig_mgmt_writedata),
.adce_write ( reconfig_mgmt_write & r_decode[ arb_adce ] ),
.adce_read ( reconfig_mgmt_read & r_decode[ arb_adce ] ),
.adce_readdata ( blk2mgmt_readdata [ arb_adce ] ),
.adce_waitrequest ( blk2mgmt_waitrequest[ arb_adce ] ),
.adce_done ( done[arb_adce] ),
// master-to-slave fabric facing, to basic reconfig
.adce_b_waitrequest ( basic_waitrequest ),
.adce_b_readdata ( basic_readdata ),
.adce_b_address ( blk2basic_address [ arb_adce ] ),
.adce_b_writedata ( blk2basic_writedata[ arb_adce ] ),
.adce_b_write ( blk2basic_write [ arb_adce ] ),
.adce_b_read ( blk2basic_read [ arb_adce ] ),
.adce_b_irq ( ),
// fabric acquisition for basic block access
.adce_b_arb_req ( req[ arb_adce ] ),
.adce_b_arb_grant ( grant[ arb_adce ] ),
// testbus
.adce_testbus ( lch_testbus )
);
end else begin:no_adce
// placeholders for missing block
assign blk2mgmt_readdata [arb_adce] = 32'd0;
assign blk2mgmt_waitrequest [arb_adce] = 1'b0;
assign blk2basic_address [arb_adce] = {width_bwa{1'b0}};
assign blk2basic_writedata [arb_adce] = 32'd0;
assign blk2basic_write [arb_adce] = 1'b0;
assign blk2basic_read [arb_adce] = 1'b0;
assign req [arb_adce] = 1'b0;
assign busy [arb_adce] = 1'b0;
assign done [arb_adce] = ~busy[arb_adce];
end
endgenerate
///////////////////////////////////////////
// Sub-component: DCD
// word address offset: +72
///////////////////////////////////////////
generate if (enable_dcd) begin:dcd
assign busy[arb_dcd] = ~done[arb_dcd];
alt_xcvr_reconfig_dcd #(
.number_of_reconfig_interfaces (number_of_reconfig_interfaces),
.enable_dcd_power_up(enable_dcd_power_up),
.device_family (device_family)
) sc_dcd (
.reconfig_clk (mgmt_clk_clk),
.reset (reconfig_subblock_reset),
.hold (hold[arb_dcd]),
// ATB comparator output for Arria V
.lch_atbout (lch_atbout),
// external mgmt interface facing
.dcd_address (reconfig_mgmt_address[2:0]),
.dcd_writedata (reconfig_mgmt_writedata),
.dcd_write (reconfig_mgmt_write & r_decode[arb_dcd]),
.dcd_read (reconfig_mgmt_read & r_decode[arb_dcd]),
.dcd_readdata (blk2mgmt_readdata[arb_dcd]),
.dcd_waitrequest (blk2mgmt_waitrequest[arb_dcd]),
.dcd_done (done[arb_dcd]),
// master-to-slave fabric facing, to basic reconfig
.dcd_waitrequest_from_base (basic_waitrequest),
.dcd_readdata_base (basic_readdata),
.dcd_address_base (blk2basic_address [arb_dcd]),
.dcd_writedata_base (blk2basic_writedata[arb_dcd]),
.dcd_write_base (blk2basic_write [arb_dcd]),
.dcd_read_base (blk2basic_read [arb_dcd]),
.dcd_irq_from_base(),
// fabric acquisition for basic block access
.arb_req (req[arb_dcd]),
.arb_grant (grant[arb_dcd])
);
end
else begin:no_dcd
// placeholders for missing block
assign blk2mgmt_readdata [arb_dcd] = 32'd0;
assign blk2mgmt_waitrequest[arb_dcd] = 1'b0;
assign blk2basic_address [arb_dcd] = {width_bwa{1'b0}};
assign blk2basic_writedata[arb_dcd] = 32'd0;
assign blk2basic_write [arb_dcd] = 1'b0;
assign blk2basic_read [arb_dcd] = 1'b0;
assign req [arb_dcd] = 1'b0;
assign busy [arb_dcd] = 1'b0;
assign done [arb_dcd] = ~busy[arb_dcd];
end
endgenerate
//*************************************************************************
//***************************** LC PLL Tuning *****************************
assign done[arb_lc] = ~busy[arb_lc];
generate if(l_enable_lc == 1) begin:lc
// CPU <-> MGMT connections
assign blk2mgmt_readdata [arb_lc] = cpu_mgmt_readdata;
assign blk2mgmt_waitrequest[arb_lc] = cpu_mgmt_waitrequest;
// CPU <-> Basic connections
assign blk2basic_address [arb_lc] = cpu_basic_address;
assign blk2basic_writedata [arb_lc] = cpu_basic_writedata;
assign blk2basic_write [arb_lc] = cpu_basic_write;
assign blk2basic_read [arb_lc] = cpu_basic_read;
assign req [arb_lc] = cpu_basic_req[arb_lc];
assign busy [arb_lc] = cpu_busy[arb_lc];
end else begin:no_lc
assign blk2mgmt_readdata [arb_lc] = 32'd0;
assign blk2mgmt_waitrequest [arb_lc] = 1'b0;
assign blk2basic_address [arb_lc] = {width_bwa{1'b0}};
assign blk2basic_writedata [arb_lc] = 32'd0;
assign blk2basic_write [arb_lc] = 1'b0;
assign blk2basic_read [arb_lc] = 1'b0;
assign req [arb_lc] = 1'b0;
assign busy [arb_lc] = 1'b0;
end
endgenerate
//*************************** End LC PLL Tuning ***************************
//*************************************************************************
//*************************************************************************
//***************************** MIF Streamer ******************************
generate if(enable_mif == 1) begin:mif
assign busy[arb_mif] = ~done[arb_mif];
alt_xcvr_reconfig_mif #(
.device_family ( device_family ),
.enable_mif ( enable_mif )
) sc_mif (
//User interface
.reconfig_clk ( mgmt_clk_clk ),
.reset ( reconfig_subblock_reset ),
.mif_reconfig_address ( reconfig_mgmt_address[2:0] ),
.mif_reconfig_writedata ( reconfig_mgmt_writedata ),
.mif_reconfig_write ( reconfig_mgmt_write & r_decode[arb_mif] ),
.mif_reconfig_read ( reconfig_mgmt_read & r_decode[arb_mif] ),
.mif_reconfig_readdata ( blk2mgmt_readdata[arb_mif] ),
.mif_reconfig_waitrequest ( blk2mgmt_waitrequest[arb_mif] ),
.mif_reconfig_done ( done[arb_mif] ),
//PLL reconfig interface
.mif_pll_busy ( pll_mif_busy ),
.mif_pll_err ( pll_mif_err ),
.mif_pll_go ( mif_pll_go ),
.mif_pll_type ( mif_pll_type ),
.mif_pll_lch ( mif_pll_lch ),
.mif_pll_data ( mif_pll_data ),
.mif_pll_pll_type ( mif_pll_pll_type),
//MIF storage interface
.mif_stream_address ( reconfig_mif_address ),
.mif_stream_read ( reconfig_mif_read ),
.mif_stream_waitrequest ( reconfig_mif_waitrequest ),
.mif_stream_readdata ( reconfig_mif_readdata ),
//Basic interface
.mif_base_address ( blk2basic_address[arb_mif] ),
.mif_base_writedata ( blk2basic_writedata[arb_mif] ),
.mif_base_write ( blk2basic_write[arb_mif] ),
.mif_base_read ( blk2basic_read[arb_mif] ),
.mif_base_readdata ( basic_readdata ),
.mif_base_waitrequest ( basic_waitrequest ),
.mif_base_irq ( 1'd0 ), //unused
//arbiter
.arb_req (req[arb_mif] ),
.arb_grant (grant[arb_mif] )
);
end else begin:no_mif
wire mif_unused;
assign blk2mgmt_readdata [arb_mif] = 32'd0;
assign blk2mgmt_waitrequest [arb_mif] = 1'b0;
assign blk2basic_address [arb_mif] = {width_bwa{1'b0}};
assign blk2basic_writedata [arb_mif] = 32'd0;
assign blk2basic_write [arb_mif] = 1'b0;
assign blk2basic_read [arb_mif] = 1'b0;
assign req [arb_mif] = 1'b0;
assign busy [arb_mif] = 1'b0 | mif_unused;
assign done [arb_mif] = ~busy[arb_mif];
assign reconfig_mif_read = 1'b0;
assign reconfig_mif_address = 32'd0;
assign mif_pll_go = 1'b0;
assign mif_pll_type = 1'b0;
assign mif_pll_lch = 10'd0;
assign mif_pll_data = 4'd0;
assign mif_pll_pll_type = 1'b0;
// prevent warnings
assign mif_unused = & {1'b0,mif_pll_pll_type,mif_pll_data,mif_pll_lch,mif_pll_type,mif_pll_go};
end
endgenerate
//*************************** End MIF Streamer ****************************
//*************************************************************************
//*************************************************************************
//***************************** PLL Reconfig ******************************
generate if(enable_pll == 1 || enable_mif == 1) begin:pll
assign busy[arb_pll] = ~done[arb_pll];
alt_xcvr_reconfig_pll #(
.device_family ( device_family )
) sc_pll (
//User interface
.reconfig_clk ( mgmt_clk_clk ),
.reset ( reconfig_subblock_reset ),
.pll_reconfig_address ( reconfig_mgmt_address[2:0] ),
.pll_reconfig_writedata ( reconfig_mgmt_writedata ),
.pll_reconfig_write ( reconfig_mgmt_write & r_decode[arb_pll] ),
.pll_reconfig_read ( reconfig_mgmt_read & r_decode[arb_pll] ),
.pll_reconfig_readdata ( blk2mgmt_readdata[arb_pll] ),
.pll_reconfig_waitrequest ( blk2mgmt_waitrequest[arb_pll] ),
.pll_reconfig_done ( done[arb_pll] ),
//MIF interface
.pll_mif_busy ( pll_mif_busy ),
.pll_mif_err ( pll_mif_err ),
.pll_mif_go ( mif_pll_go ),
.pll_mif_type ( mif_pll_type ),
.pll_mif_lch ( mif_pll_lch ),
.pll_mif_data ( mif_pll_data ),
.pll_mif_pll_type ( mif_pll_pll_type),
//Basic interface
.pll_base_address ( blk2basic_address[arb_pll] ),
.pll_base_writedata ( blk2basic_writedata[arb_pll] ),
.pll_base_write ( blk2basic_write[arb_pll] ),
.pll_base_read ( blk2basic_read[arb_pll] ),
.pll_base_readdata ( basic_readdata ),
.pll_base_waitrequest ( basic_waitrequest ),
// .pll_base_irq ( 1'd0 ), //unused
//arbiter
.arb_req (req[arb_pll] ),
.arb_grant (grant[arb_pll] )
);
end else begin:no_pll
wire pll_unused;
assign blk2mgmt_readdata [arb_pll] = 32'd0;
assign blk2mgmt_waitrequest [arb_pll] = 1'b0;
assign blk2basic_address [arb_pll] = {width_bwa{1'b0}};
assign blk2basic_writedata [arb_pll] = 32'd0;
assign blk2basic_write [arb_pll] = 1'b0;
assign blk2basic_read [arb_pll] = 1'b0;
assign req [arb_pll] = 1'b0;
assign busy [arb_pll] = 1'b0 | pll_unused;
assign done [arb_pll] = ~busy[arb_pll];
assign pll_mif_busy = 1'b0;
assign pll_mif_err = 1'b0;
// prevent warnings
assign pll_unused = & {1'b0,pll_mif_err,pll_mif_busy};
end
endgenerate
//*************************** End PLL Reconfig ****************************
//*************************************************************************
//*************************************************************************
//**************************** Reconfig CPU *******************************
generate if(enable_soc_mask != 0) begin:soc
wire [arb_count-1:0] cpu_decode;
assign cpu_decode = r_decode & enable_soc_mask;
alt_xcvr_reconfig_soc #(
.device_family (device_family),
.arb_count (arb_count ),
.width_awa (width_awa ),
.width_bwa (width_bwa ),
.number_of_reconfig_interfaces(number_of_reconfig_interfaces),
.enable_soc_mask(enable_soc_mask)
) sc_soc(
// user reconfiguration management interface
.mgmt_clk (mgmt_clk_clk ),
.mgmt_rst (reconfig_subblock_reset),
.mgmt_address (reconfig_mgmt_address ),
.mgmt_read (reconfig_mgmt_read ),
.mgmt_write (reconfig_mgmt_write ),
.mgmt_writedata (reconfig_mgmt_writedata),
.mgmt_readdata (cpu_mgmt_readdata ),
.mgmt_waitrequest (cpu_mgmt_waitrequest ),
.mgmt_decode (cpu_decode ),
.hold (hold ),
.busy (cpu_busy ),
.hard_busy (busy ),
// CPU <-> Basic interface
.basic_address (cpu_basic_address ),
.basic_writedata (cpu_basic_writedata ),
.basic_write (cpu_basic_write ),
.basic_read (cpu_basic_read ),
.basic_readdata (basic_readdata ),
.basic_waitrequest(basic_waitrequest ),
.basic_req (cpu_basic_req ), // request access to B block
.basic_grant (grant ), // granted access to B block
// Testbus
.lch_testbus (lch_testbus ),
.pch_testbus (pch_testbus )
);
end else begin:no_soc // No CPU
assign cpu_mgmt_readdata = 32'd0;
assign cpu_mgmt_waitrequest = 1'b0;
assign cpu_basic_read = 1'b0;
assign cpu_basic_write = 1'b0;
assign cpu_basic_address = {width_bwa{1'b0}};
assign cpu_basic_writedata = 32'd0;
assign cpu_basic_req = {arb_count{1'b0}};
assign cpu_busy = {arb_count{1'b0}};
end
endgenerate
//**************************** Reconfig CPU *******************************
//*************************************************************************
////////////////////////////////////////////////////////////////////
// Calibration Start-up sequencing control and coordination
////////////////////////////////////////////////////////////////////
alt_xcvr_reconfig_cal_seq #(
.arb_count(arb_count)
)
cal_seq (
.reconfig_clk (mgmt_clk_clk),
.reset (reconfig_subblock_reset),
.busy (busy ),
.cal_busy_in (cal_busy_in),
// user reconfiguration management interface
.hold (hold ),
.reconfig_busy (reconfig_busy ),
.tx_cal_busy (tx_cal_busy ),
.rx_cal_busy (rx_cal_busy ),
.oc_cal_busy (oc_cal_busy )
);
////////////////////////////////////////////////////////////////////
// The basic block is a switch and interface to the native reconfig
////////////////////////////////////////////////////////////////////
alt_xcvr_reconfig_basic #(
.basic_ifs(1),
.native_ifs(number_of_reconfig_interfaces),
.device_family(device_family)
) basic (
.reconfig_clk(mgmt_clk_clk),
.reset(r_mgmt_rst_reset),
.lif_is_active(lif_is_active),
.oc_cal_busy(oc_cal_busy),
.tx_cal_busy(tx_cal_busy),
.rx_cal_busy(rx_cal_busy),
.reconfig_to_xcvr(reconfig_to_xcvr),
.reconfig_from_xcvr(reconfig_from_xcvr),
.basic_reconfig_write(basic_write),
.basic_reconfig_read(basic_read),
.basic_reconfig_writedata(basic_writedata),
.basic_reconfig_address(basic_address),
.basic_reconfig_readdata(basic_readdata),
.basic_reconfig_waitrequest(basic_waitrequest),
.ifsel_notdone(ifsel_notdone),
.lch_testbus(lch_testbus),
.pch_testbus(pch_testbus),
.lch_atbout(lch_atbout)
//.basic_reconfig_irq(basic_reconfig_irq)
);
///////////////////////////////////////////
// Status to external mgmt interface
///////////////////////////////////////////
// assign reconfig_busy = |busy;
//////////////////////////////////////////////////////////////////////////////////////
// Synchronize the ifsel_notdone into each Reconfig IP block
//////////////////////////////////////////////////////////////////////////////////////
always @(posedge mgmt_clk_clk or posedge r_mgmt_rst_reset) begin
if (r_mgmt_rst_reset == 1)
ifsel_notdone_resync <= 1'b1;
else
ifsel_notdone_resync <= ifsel_notdone;
end
assign reconfig_subblock_reset = ifsel_notdone_resync;
endmodule

View file

@ -0,0 +1,111 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
// $Header: //acds/rel/18.1std/ip/alt_xcvr_reconfig/alt_xcvr_reconfig_adce/alt_xcvr_reconfig_adce.sv#1 $
`timescale 1 ps / 1 ps
module alt_xcvr_reconfig_adce
#(
parameter device_family = "Stratix V",
parameter number_of_reconfig_interfaces = 1,
parameter logic [number_of_reconfig_interfaces-1:0] AUTO_START = { number_of_reconfig_interfaces { 1'b0 } }
)
(
input wire reconfig_clk,
input wire reset,
input wire hold,
// user Avalon-MM interface
input wire [2:0] adce_address,
input wire [31:0] adce_writedata,
input wire adce_write,
input wire adce_read,
output wire [31:0] adce_readdata,
output wire adce_waitrequest,
output wire adce_done, // AA What is this for? It's tied to an irq line.
// Avalon-MM interface to the basic block
input wire adce_b_waitrequest,
output wire [2:0] adce_b_address,
output wire [31:0] adce_b_writedata,
output wire adce_b_write,
output wire adce_b_read,
input wire [31:0] adce_b_readdata,
input wire adce_b_irq, // AA Is this really used?
// Basic block arbitration
output wire adce_b_arb_req,
input wire adce_b_arb_grant,
// Digital test bus
input wire [7:0] adce_testbus
);
import altera_xcvr_functions::*;
localparam is_s5 = has_s5_style_hssi(device_family);
generate
if ( is_s5 ) begin:stratixv
alt_xcvr_reconfig_adce_sv
#(
.number_of_reconfig_interfaces( number_of_reconfig_interfaces ),
.AUTO_START ( AUTO_START )
)
adce_sv
(
.clk ( reconfig_clk ),
.reset ( reset ),
.hold ( hold ),
.adce_address ( adce_address ),
.adce_writedata ( adce_writedata ),
.adce_write ( adce_write ),
.adce_read ( adce_read ),
.adce_readdata ( adce_readdata ),
.adce_waitrequest ( adce_waitrequest ),
.adce_done ( adce_done ),
.adce_b_waitrequest ( adce_b_waitrequest ),
.adce_b_address ( adce_b_address ),
.adce_b_writedata ( adce_b_writedata ),
.adce_b_write ( adce_b_write ),
.adce_b_read ( adce_b_read ),
.adce_b_readdata ( adce_b_readdata ),
.adce_b_irq ( adce_b_irq ),
.adce_b_arb_req ( adce_b_arb_req ),
.adce_b_arb_grant ( adce_b_arb_grant ),
.adce_testbus ( adce_testbus )
);
end else begin
// Default case for unsupported families, just tie off outputs to idle states.
assign adce_readdata = 32'b0;
assign adce_waitrequest = 1'b0;
assign adce_done = 1'b1;
assign adce_b_address = 3'b0;
assign adce_b_writedata = 32'b0;
assign adce_b_write = 1'b0;
assign adce_b_read = 1'b0;
assign adce_b_arb_req = 1'b0;
end
endgenerate
endmodule : alt_xcvr_reconfig_adce

View file

@ -0,0 +1,170 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
`timescale 1 ps / 1 ps
module alt_xcvr_reconfig_analog #(
parameter device_family = "Stratix V"
)
(
input wire reconfig_clk, // this will be the reconfig clk
input wire reset,
//avalon MM slave
input wire [2:0] analog_reconfig_address, // MM address
input wire [31:0] analog_reconfig_writedata,
input wire analog_reconfig_write,
input wire analog_reconfig_read,
//output MM slave
output wire [31:0] analog_reconfig_readdata, // from MM
output wire analog_reconfig_waitrequest,
//output wire analog_reconfig_error,
output wire analog_reconfig_done,
// input from base_reconfig
input wire analog_reconfig_irq_from_base,
input wire analog_reconfig_waitrequest_from_base,
// output to base_reconfig
// Avalon MM Master
output wire [2:0] analog_reconfig_address_base, // 3 bit MM
output wire [31:0] analog_reconfig_writedata_base,
output wire analog_reconfig_write_base, // start write to GXB
output wire analog_reconfig_read_base, // start read from GXB
// input from base reconfig
input wire [31:0] analog_reconfig_readdata_base, // data from read command
output wire arb_req,
input wire arb_grant
);
//parameter device_family = "StratixIV"; // or ArriaII
generate
//Deepak - added namespace support for CIVGX and AII GX
if((device_family == "Stratix IV") || (device_family == "Arria II") || (device_family == "Cyclone IV GX") || (device_family == "Arria II GX") || (device_family == "Arria II GZ") || (device_family == "HardCopy IV"))
begin
wire [4:0] w_tgx_analog_reconfig_address_base;
alt_xcvr_reconfig_analog_tgx reconfig_analog_tgx(
.reconfig_clk(reconfig_clk),
.reset(reset),
.analog_reconfig_address(analog_reconfig_address),
.analog_reconfig_writedata(analog_reconfig_writedata),
.analog_reconfig_write(analog_reconfig_write),
.analog_reconfig_read(analog_reconfig_read),
.analog_reconfig_readdata(analog_reconfig_readdata),
.analog_reconfig_waitrequest(analog_reconfig_waitrequest),
.analog_reconfig_done(analog_reconfig_done),
.analog_reconfig_irq_from_base(analog_reconfig_irq_from_base),
.analog_reconfig_waitrequest_from_base(analog_reconfig_waitrequest_from_base),
.analog_reconfig_address_base(analog_reconfig_address_base),
.analog_reconfig_writedata_base(analog_reconfig_writedata_base),
.analog_reconfig_write_base(analog_reconfig_write_base),
.analog_reconfig_read_base(analog_reconfig_read_base),
.analog_reconfig_readdata_base(analog_reconfig_readdata_base)
);
assign analog_reconfig_address_base = w_tgx_analog_reconfig_address_base[4:2];
assign arb_req = 1'b0 & arb_grant; // not currently used in S4 architecture
end
else if((device_family == "Stratix V") || (device_family == "Arria V GZ"))
begin
alt_xcvr_reconfig_analog_sv reconfig_analog_sv(
.reconfig_clk(reconfig_clk),
.reset(reset),
.analog_reconfig_address(analog_reconfig_address),
.analog_reconfig_writedata(analog_reconfig_writedata),
.analog_reconfig_write(analog_reconfig_write),
.analog_reconfig_read(analog_reconfig_read),
.analog_reconfig_readdata(analog_reconfig_readdata),
.analog_reconfig_waitrequest(analog_reconfig_waitrequest),
.analog_reconfig_done(analog_reconfig_done),
.analog_reconfig_irq_from_base(analog_reconfig_irq_from_base),
.analog_reconfig_waitrequest_from_base(analog_reconfig_waitrequest_from_base),
.analog_reconfig_address_base(analog_reconfig_address_base),
.analog_reconfig_writedata_base(analog_reconfig_writedata_base),
.analog_reconfig_write_base(analog_reconfig_write_base),
.analog_reconfig_read_base(analog_reconfig_read_base),
.analog_reconfig_readdata_base(analog_reconfig_readdata_base),
.arb_req(arb_req),
.arb_grant(arb_grant)
);
end
else if(device_family == "Arria V")
begin
alt_xcvr_reconfig_analog_av reconfig_analog_av(
.reconfig_clk(reconfig_clk),
.reset(reset),
.analog_reconfig_address(analog_reconfig_address),
.analog_reconfig_writedata(analog_reconfig_writedata),
.analog_reconfig_write(analog_reconfig_write),
.analog_reconfig_read(analog_reconfig_read),
.analog_reconfig_readdata(analog_reconfig_readdata),
.analog_reconfig_waitrequest(analog_reconfig_waitrequest),
.analog_reconfig_done(analog_reconfig_done),
.analog_reconfig_irq_from_base(analog_reconfig_irq_from_base),
.analog_reconfig_waitrequest_from_base(analog_reconfig_waitrequest_from_base),
.analog_reconfig_address_base(analog_reconfig_address_base),
.analog_reconfig_writedata_base(analog_reconfig_writedata_base),
.analog_reconfig_write_base(analog_reconfig_write_base),
.analog_reconfig_read_base(analog_reconfig_read_base),
.analog_reconfig_readdata_base(analog_reconfig_readdata_base),
.arb_req(arb_req),
.arb_grant(arb_grant)
);
end
else if(device_family == "Cyclone V")
begin
alt_xcvr_reconfig_analog_av reconfig_analog_cv(
.reconfig_clk(reconfig_clk),
.reset(reset),
.analog_reconfig_address(analog_reconfig_address),
.analog_reconfig_writedata(analog_reconfig_writedata),
.analog_reconfig_write(analog_reconfig_write),
.analog_reconfig_read(analog_reconfig_read),
.analog_reconfig_readdata(analog_reconfig_readdata),
.analog_reconfig_waitrequest(analog_reconfig_waitrequest),
.analog_reconfig_done(analog_reconfig_done),
.analog_reconfig_irq_from_base(analog_reconfig_irq_from_base),
.analog_reconfig_waitrequest_from_base(analog_reconfig_waitrequest_from_base),
.analog_reconfig_address_base(analog_reconfig_address_base),
.analog_reconfig_writedata_base(analog_reconfig_writedata_base),
.analog_reconfig_write_base(analog_reconfig_write_base),
.analog_reconfig_read_base(analog_reconfig_read_base),
.analog_reconfig_readdata_base(analog_reconfig_readdata_base),
.arb_req(arb_req),
.arb_grant(arb_grant)
);
end
else
begin
assign analog_reconfig_readdata = 32'd0;
assign analog_reconfig_waitrequest = 1'd0;
assign analog_reconfig_done = 1'd1;
assign analog_reconfig_address_base = 3'd0;
assign analog_reconfig_writedata_base = 32'd0;
assign analog_reconfig_write_base = 1'd0;
assign analog_reconfig_read_base = 1'd0;
assign arb_req = 1'd0;
end
endgenerate
endmodule

View file

@ -0,0 +1,226 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
// Top level Analog reconfig file for SV
// data will flow like
// UIF => DATA_CTRL => CIF => RECONFIG BASIC
//
// $Header$
`timescale 1 ns / 1 ps
module alt_xcvr_reconfig_analog_av
#(
parameter number_of_reconfig_interfaces = 1
) (
input wire reconfig_clk, // this will be the reconfig clk
input wire reset,
//avalon MM slave
input wire [2:0] analog_reconfig_address, // MM address
input wire [31:0] analog_reconfig_writedata,
input wire analog_reconfig_write,
input wire analog_reconfig_read,
//output MM slave
output reg [31:0] analog_reconfig_readdata, // from MM
output reg analog_reconfig_waitrequest,
output wire analog_reconfig_done,
// input from base_reconfig
input wire analog_reconfig_irq_from_base,
input wire analog_reconfig_waitrequest_from_base,
// output to base_reconfig
// Avalon MM Master
output wire [2:0] analog_reconfig_address_base, // 3 bit MM
output wire [31:0] analog_reconfig_writedata_base,
output wire analog_reconfig_write_base, // start write to GXB
output wire analog_reconfig_read_base, // start read from GXB
// input from base reconfig
input wire [31:0] analog_reconfig_readdata_base, // data from read command
input arb_grant,
output arb_req
);
localparam device_family = "StratixV";
//------------------------------------------------------------------
// address | type | data
//---------|---------|----------------------------------------------
// 0 | wr/rd | logical channel address
// 1 | rd | physical channel address
// 2 | wr/rd | control (write, read) / status (error, busy), status[1:0] = error, busy
// 3 | wr/rd | address offset
// 4 | wr/rd | avalon data
//------------------------------------------------------------------
//------------------------------------------------------------------
// addr_offset | data
//-------------|--------------------------------------------------------
// 0 | VOD
// 1 | Preemp_0t (not supported in AV)
// 2 | Preemp_1t
// 3 | Preemp_2t (not supported in AV)
// 4-15 | Reserved for TX Analog reconfig
// 16 | Eq_ctrl
// 17 | Eq_dcgain
// 18 - 31 | Reserved for RX Analog reconfig
// 32 | Pre-CDR reverse serial loopback
// 33 | Post-CDR reverse serial loopback
//------------------------------------------------------------------
import alt_xcvr_reconfig_h::*; //alt_xcvr_reconfig/alt_xcvr_reconfig/alt_xcvr_reconfig_h.sv
// import sv_xcvr_h::*; //altera_xcvr_generic/sv/sv_xcvr_h.sv
wire [31:0] uif_writedata;
wire [5:0] uif_addr_offset;
wire [2:0] uif_mode;
wire [9:0] uif_logical_ch_addr;
wire uif_go;
wire [31:0] uif_readdata;
wire uif_illegal_pch_error;
wire uif_illegal_offset_error;
wire ctrl_go;
wire [2:0] ctrl_opcode;
wire ctrl_lock;
wire [10:0] ctrl_addr_offset;
wire [31:0] ctrl_writedata;
wire [31:0] ctrl_readdata;
wire [31:0] ctrl_phreaddata;
wire ctrl_illegal_phy_ch;
wire ctrl_waitrequest;
wire uif_busy;
// Common user interface block, this block talks with user
alt_xreconf_uif
#(
.RECONFIG_USER_ADDR_WIDTH(3),
.RECONFIG_USER_DATA_WIDTH(32),
.RECONFIG_USER_OFFSET_WIDTH(6)
) inst_xreconf_uif (
.reconfig_clk(reconfig_clk),
.reset(reset),
.user_reconfig_address(analog_reconfig_address),
.user_reconfig_writedata(analog_reconfig_writedata),
.user_reconfig_write(analog_reconfig_write),
.user_reconfig_read(analog_reconfig_read),
.user_reconfig_readdata(analog_reconfig_readdata),
.user_reconfig_waitrequest(analog_reconfig_waitrequest),
.user_reconfig_done(analog_reconfig_done),
// to /from data control logic
.uif_writedata(uif_writedata), // to data control logic
.uif_addr_offset(uif_addr_offset), // to data control logic/rmw block
.uif_mode(uif_mode), // to data control logic
.uif_logical_ch_addr(uif_logical_ch_addr), // to data
.uif_go(uif_go), // to data control logic
.uif_ctrl(), //unused
.uif_readdata(uif_readdata),// from data control logic
.uif_phreaddata(ctrl_phreaddata),// from cif logic
.uif_illegal_pch_error(uif_illegal_pch_error), // from data control logic
.uif_illegal_offset_error(uif_illegal_offset_error), // from data control logic
.uif_busy(uif_busy) // from data control logic
);
// Analog Reconfig data control block, this block sits between uif and cif block
alt_xreconf_analog_datactrl_av
#(
.RECONFIG_USER_ADDR_WIDTH(3),
.RECONFIG_USER_DATA_WIDTH(32),
.RECONFIG_USER_OFFSET_WIDTH(6),
.RECONFIG_BASIC_OFFSET_ADDR_WIDTH(11)
) inst_analog_datactrl (
.clk(reconfig_clk),
.reset(reset),
// to/from uif block
.uif_addr_offset(uif_addr_offset),
.uif_go(uif_go),
.uif_mode(uif_mode),
.uif_writedata(uif_writedata),
.uif_busy(uif_busy),
.uif_illegal_pch_error(uif_illegal_pch_error), // from data control logic
.uif_illegal_offset_error(uif_illegal_offset_error), // from data control logic
.uif_readdata(uif_readdata),
// to/from control block
.ctrl_go(ctrl_go),
.ctrl_opcode(ctrl_opcode),
.ctrl_lock(ctrl_lock),
.ctrl_wait(ctrl_waitrequest),
.ctrl_illegal_phy_ch(ctrl_illegal_phy_ch),
.ctrl_readdata(ctrl_readdata), // this is i/p data coming from cif for read modify writes
.ctrl_writedata(ctrl_writedata),
.ctrl_addr_offset(ctrl_addr_offset),
.waitrequest_from_base(analog_reconfig_waitrequest_from_base)
);
//Common interface block which talks with reconfig basic B Block
alt_xreconf_cif
#(
.CIF_RECONFIG_ADDR_WIDTH (3),
.CIF_RECONFIG_DATA_WIDTH(32),
.CIF_OFFSET_ADDR_WIDTH(11),
.CIF_MASTER_ADDR_WIDTH(3),
.CIF_RECONFIG_OFFSET_WIDTH(6)
) inst_xreconf_cif (
// user Interface
.reconfig_clk(reconfig_clk),
.reset(reset),
.ctrl_go(ctrl_go), // from data control
.ctrl_opcode(ctrl_opcode), // from data control
.ctrl_lock(ctrl_lock), // from data control
.ctrl_addr_offset(ctrl_addr_offset), // from data control block
.ctrl_writedata(ctrl_writedata), // from data control, read modified write writedata block
.uif_logical_ch_addr(uif_logical_ch_addr), // from uif block
.ctrl_readdata(ctrl_readdata), // readdata to data control for read modify writes
.ctrl_phreaddata(ctrl_phreaddata), // this is i/p data coming from cif for read modify writes
.ctrl_illegal_phy_ch(ctrl_illegal_phy_ch), // illegal phy ch for data control logic
.ctrl_waitrequest(ctrl_waitrequest), // waitrequest from fsm to data control logic
// base reconfig interface
.reconfig_address_base(analog_reconfig_address_base),
.reconfig_writedata_base(analog_reconfig_writedata_base),
.reconfig_write_base(analog_reconfig_write_base),
.reconfig_read_base(analog_reconfig_read_base),
.reconfig_readdata_base(analog_reconfig_readdata_base),
.reconfig_irq_from_base(analog_reconfig_irq_from_base),
.reconfig_waitrequest_from_base(analog_reconfig_waitrequest_from_base),
.arb_grant(arb_grant),
.arb_req(arb_req)
);
endmodule

View file

@ -0,0 +1,125 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
`timescale 1 ns / 1 ps
module alt_xcvr_reconfig_basic #(
parameter basic_ifs = 1, // post-merge, allow multiple basic interfaces
parameter native_ifs = 1, // number of native reconfig interfaces
parameter device_family = "Stratix V",
parameter physical_channel_mapping = ""
) (
// avalon clock interface
input wire reconfig_clk,
input wire reset,
input wire lif_is_active,
// avalon MM, "basic" interface
input wire [basic_ifs -1:0] basic_reconfig_write,
input wire [basic_ifs -1:0] basic_reconfig_read,
input wire [basic_ifs*32-1:0] basic_reconfig_writedata,
input wire [basic_ifs*3 -1:0] basic_reconfig_address, // address to MM described below
output reg [basic_ifs*32-1:0] basic_reconfig_readdata,
output wire [basic_ifs -1:0] basic_reconfig_waitrequest,
//output reg [basic_ifs-1:0] basic_reconfig_irq, // interrupt to Master
// native testbus interfaces: to logical interface:
output wire [basic_ifs*8 -1:0] lch_testbus, // testbus from native reconfig, for selected channel
output wire [basic_ifs*24-1:0] pch_testbus, // testbus from native reconfig, for entire triplet
output wire lch_atbout, // voltage comparator output from native reconfig, for selected channel
// gate soft-IPs from running by holding off logical mutex until interface select is done
output wire ifsel_notdone,
// bundled reconfig buses
// input wire reconfig_busy, // input from reconfig master blocks, to forward through the bundles
input wire oc_cal_busy,
input wire tx_cal_busy,
input wire rx_cal_busy,
output wire [altera_xcvr_functions::get_reconfig_to_width(device_family,native_ifs) -1:0] reconfig_to_xcvr, // all inputs from reconfig block to native xcvr reconfig ports
input wire [altera_xcvr_functions::get_reconfig_from_width(device_family,native_ifs)-1:0] reconfig_from_xcvr // all input s from native xcvr reconfig ports to reconfig block
);
import altera_xcvr_functions::*;
localparam is_s5 = has_s5_style_hssi(device_family);
localparam is_a5 = has_a5_style_hssi(device_family);
localparam is_c5 = has_c5_style_hssi(device_family);
// Conditional generation of sub-instances
generate
// s5 => sv_xcvr_reconfig_basic
if ( is_s5 ) begin
sv_xcvr_reconfig_basic #(
.basic_ifs(basic_ifs),
.native_ifs(native_ifs),
.physical_channel_mapping(physical_channel_mapping)
) s5 (
.reconfig_clk(reconfig_clk),
.reset(reset),
.lif_is_active(lif_is_active),
.basic_reconfig_write(basic_reconfig_write),
.basic_reconfig_read(basic_reconfig_read),
.basic_reconfig_writedata(basic_reconfig_writedata),
.basic_reconfig_address(basic_reconfig_address),
.basic_reconfig_readdata(basic_reconfig_readdata),
.basic_reconfig_waitrequest(basic_reconfig_waitrequest),
.lch_testbus(lch_testbus),
.pch_testbus(pch_testbus),
.ifsel_notdone(ifsel_notdone),
.oc_cal_busy(oc_cal_busy),
.tx_cal_busy(tx_cal_busy),
.rx_cal_busy(rx_cal_busy),
.reconfig_to_xcvr(reconfig_to_xcvr),
.reconfig_from_xcvr(reconfig_from_xcvr)
);
assign lch_atbout = 1'b0;
end
else if (is_a5 || is_c5) begin
av_xcvr_reconfig_basic #(
.basic_ifs(basic_ifs),
.native_ifs(native_ifs),
.physical_channel_mapping(physical_channel_mapping)
) a5 (
.reconfig_clk(reconfig_clk),
.reset(reset),
.lif_is_active(lif_is_active),
.basic_reconfig_write(basic_reconfig_write),
.basic_reconfig_read(basic_reconfig_read),
.basic_reconfig_writedata(basic_reconfig_writedata),
.basic_reconfig_address(basic_reconfig_address),
.basic_reconfig_readdata(basic_reconfig_readdata),
.basic_reconfig_waitrequest(basic_reconfig_waitrequest),
.lch_testbus(lch_testbus),
.pch_testbus(pch_testbus),
.atbout(lch_atbout),
.ifsel_notdone(ifsel_notdone),
.oc_cal_busy(oc_cal_busy),
.tx_cal_busy(tx_cal_busy),
.rx_cal_busy(rx_cal_busy),
.reconfig_to_xcvr(reconfig_to_xcvr),
.reconfig_from_xcvr(reconfig_from_xcvr)
);
end
// default case when family did not match known strings
else begin
initial begin
$display("Critical Warning: device_family value, '%s', is not supported", current_device_family(device_family));
end
end
endgenerate
endmodule

View file

@ -0,0 +1,163 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
// Transceiver Reconfiguration
// calibration Start-up sequencer block
//
// $Header$
`timescale 1 ns / 1 ns
module alt_xcvr_reconfig_cal_seq #(
parameter arb_count = 10
) (
input wire reconfig_clk,
input wire reset,
input wire [arb_count-1:0] busy,
input wire cal_busy_in,
// user reconfiguration management interface
output wire [arb_count-1:0] hold,
output reg reconfig_busy,
output reg tx_cal_busy,
output reg rx_cal_busy,
output wire oc_cal_busy
);
import alt_xcvr_reconfig_h::*;
// decoder block index, for 8-word address blocks
localparam arb_offset = INDEX_XR_OFFSET;
localparam arb_analog = INDEX_XR_ANALOG;
localparam arb_eyemon = INDEX_XR_EYEMON;
localparam arb_dfe = INDEX_XR_DFE;
localparam arb_direct = INDEX_XR_DIRECT;
localparam arb_adce = INDEX_XR_ADCE;
localparam arb_lc = INDEX_XR_LC;
localparam arb_mif = INDEX_XR_MIF;
localparam arb_pll = INDEX_XR_PLL;
localparam arb_dcd = INDEX_XR_DCD;
wire w_rx_cal_busy;
wire w_tx_cal_busy;
wire reconfig_busy_fe;
wire next_reconfig_busy;
reg startup_cal_done;
///////////////////////////////////////////////////////////////////////
// Generate the hold signals to sequence start-up calibration
// Current calibration order is as follows
// Offset -> LC tuning -> DCD -> DFE -> ADCE -> Done
// Expection is the start-up cal IP comes out of reset with busy set.
///////////////////////////////////////////////////////////////////////
//offset cancellation is first block. No dependancy
assign hold[arb_offset] = ~(startup_cal_done);
//LC tuning waits for Offset cancellation
assign hold[arb_lc] = busy[arb_offset] & ~(startup_cal_done);
//DCD tuning waits for Offset cancellation & LC tuning
assign hold[arb_dcd] = (busy[arb_offset] |
busy[arb_lc] |
cal_busy_in) &
~(startup_cal_done); //only hold off IP during initial start-up cal
//DFE cal waits for Offset cancellation & LC tuning & DCD
assign hold[arb_dfe] = (busy[arb_offset] |
busy[arb_dcd] |
busy[arb_lc] ) &
~(startup_cal_done); //only hold off IP during initial start-up cal
//DFE cal waits for Offset cancellation & LC tuning & DCD & DFE
assign hold[arb_adce] = (busy[arb_offset] |
busy[arb_dcd] |
busy[arb_dfe] |
busy[arb_lc] ) &
~(startup_cal_done); //only hold off IP during initial start-up cal
//Non-startup IPs
assign hold[arb_analog] = 1'b0;
assign hold[arb_eyemon] = 1'b0;
assign hold[arb_direct] = 1'b0;
assign hold[arb_mif] = 1'b0;
assign hold[arb_pll] = 1'b0;
///////////////////////////////////////////
// Status to external mgmt interface
///////////////////////////////////////////
assign next_reconfig_busy = |busy;
always @ (posedge reconfig_clk or posedge reset) begin
if(reset)
reconfig_busy <= 1'b1;
else
reconfig_busy <= next_reconfig_busy;
end
///////////////////////////////////////////////////////////
// Generate cal busy status to PHY-IP to hold
// off tx_ready and rx_ready assertion during
// startup calibration
// oc_cal_busy is needed to allow rx_analog_reset to de-assert
///////////////////////////////////////////////////////////
//detect the completeion of initial start-up calibration (falling edge of combined busy)
assign reconfig_busy_fe = reconfig_busy & ~(next_reconfig_busy);
always @ (posedge reconfig_clk or posedge reset) begin
if(reset)
startup_cal_done <= 1'b0;
else begin
if(reconfig_busy_fe)
startup_cal_done <= 1'b1;
end
end
//tx_cal_busy is provided to the PHY-IP reset conntroller to indicate that tx_ready should no be asserted
//waits for LC tuning and DCD calibration to finish
assign w_tx_cal_busy = busy[arb_lc] |
busy[arb_dcd];
always @ (posedge reconfig_clk or posedge reset) begin
if(reset)
tx_cal_busy <= 1'b1;
else begin
if(!w_tx_cal_busy)
tx_cal_busy <= 1'b0;
end
end
//tx_cal_busy is provided to the PHY-IP reset conntroller to indicate that rx_ready should no be asserted
//waits for Offset, DFE, DCD and ADCE calibration to finish
assign w_rx_cal_busy = busy[arb_offset] |
busy[arb_adce] |
busy[arb_dcd] |
busy[arb_dfe];
always @ (posedge reconfig_clk or posedge reset) begin
if(reset)
rx_cal_busy <= 1'b1;
else begin
if(!w_rx_cal_busy)
rx_cal_busy <= 1'b0;
end
end
assign oc_cal_busy = busy[arb_offset];
endmodule

View file

@ -0,0 +1,158 @@
// alt_xcvr_reconfig_cpu.v
// Generated using ACDS version 18.1 625
`timescale 1 ps / 1 ps
module alt_xcvr_reconfig_cpu (
input wire clk_clk, // clk.clk
input wire reset_reset_n, // reset.reset_n
output wire [9:0] reconfig_mem_mem_address, // reconfig_mem_mem.address
output wire reconfig_mem_mem_read, // .read
input wire [31:0] reconfig_mem_mem_readdata, // .readdata
output wire reconfig_mem_mem_write, // .write
output wire [31:0] reconfig_mem_mem_writedata, // .writedata
output wire [3:0] reconfig_mem_mem_byteenable, // .byteenable
output wire reconfig_mem_reset_reset, // reconfig_mem_reset.reset
output wire reconfig_mem_reset_reset_req, // .reset_req
output wire reconfig_ctrl_reset_reset, // reconfig_ctrl_reset.reset
output wire [4:0] reconfig_ctrl_ctrl_address, // reconfig_ctrl_ctrl.address
output wire reconfig_ctrl_ctrl_read, // .read
input wire [31:0] reconfig_ctrl_ctrl_readdata, // .readdata
output wire reconfig_ctrl_ctrl_write, // .write
output wire [31:0] reconfig_ctrl_ctrl_writedata, // .writedata
input wire reconfig_ctrl_ctrl_waitrequest, // .waitrequest
input wire reconfig_ctrl_ctrl_irq_irq // reconfig_ctrl_ctrl_irq.irq
);
wire [31:0] reconfig_cpu_data_master_readdata; // mm_interconnect_0:reconfig_cpu_data_master_readdata -> reconfig_cpu:d_readdata
wire reconfig_cpu_data_master_waitrequest; // mm_interconnect_0:reconfig_cpu_data_master_waitrequest -> reconfig_cpu:d_waitrequest
wire [13:0] reconfig_cpu_data_master_address; // reconfig_cpu:d_address -> mm_interconnect_0:reconfig_cpu_data_master_address
wire [3:0] reconfig_cpu_data_master_byteenable; // reconfig_cpu:d_byteenable -> mm_interconnect_0:reconfig_cpu_data_master_byteenable
wire reconfig_cpu_data_master_read; // reconfig_cpu:d_read -> mm_interconnect_0:reconfig_cpu_data_master_read
wire reconfig_cpu_data_master_write; // reconfig_cpu:d_write -> mm_interconnect_0:reconfig_cpu_data_master_write
wire [31:0] reconfig_cpu_data_master_writedata; // reconfig_cpu:d_writedata -> mm_interconnect_0:reconfig_cpu_data_master_writedata
wire [31:0] reconfig_cpu_instruction_master_readdata; // mm_interconnect_0:reconfig_cpu_instruction_master_readdata -> reconfig_cpu:i_readdata
wire reconfig_cpu_instruction_master_waitrequest; // mm_interconnect_0:reconfig_cpu_instruction_master_waitrequest -> reconfig_cpu:i_waitrequest
wire [11:0] reconfig_cpu_instruction_master_address; // reconfig_cpu:i_address -> mm_interconnect_0:reconfig_cpu_instruction_master_address
wire reconfig_cpu_instruction_master_read; // reconfig_cpu:i_read -> mm_interconnect_0:reconfig_cpu_instruction_master_read
wire [31:0] reconfig_cpu_d_irq_irq; // irq_mapper:sender_irq -> reconfig_cpu:d_irq
alt_xcvr_reconfig_cpu_reconfig_cpu reconfig_cpu (
.clk (clk_clk), // clk.clk
.reset_n (~reconfig_ctrl_reset_reset), // reset_n.reset_n
.d_address (reconfig_cpu_data_master_address), // data_master.address
.d_byteenable (reconfig_cpu_data_master_byteenable), // .byteenable
.d_read (reconfig_cpu_data_master_read), // .read
.d_readdata (reconfig_cpu_data_master_readdata), // .readdata
.d_waitrequest (reconfig_cpu_data_master_waitrequest), // .waitrequest
.d_write (reconfig_cpu_data_master_write), // .write
.d_writedata (reconfig_cpu_data_master_writedata), // .writedata
.i_address (reconfig_cpu_instruction_master_address), // instruction_master.address
.i_read (reconfig_cpu_instruction_master_read), // .read
.i_readdata (reconfig_cpu_instruction_master_readdata), // .readdata
.i_waitrequest (reconfig_cpu_instruction_master_waitrequest), // .waitrequest
.d_irq (reconfig_cpu_d_irq_irq), // d_irq.irq
.no_ci_readra () // custom_instruction_master.readra
);
alt_xcvr_reconfig_cpu_mm_interconnect_0 mm_interconnect_0 (
.clk_0_clk_clk (clk_clk), // clk_0_clk.clk
.reconfig_cpu_reset_n_reset_bridge_in_reset_reset (reconfig_ctrl_reset_reset), // reconfig_cpu_reset_n_reset_bridge_in_reset.reset
.reconfig_cpu_data_master_address (reconfig_cpu_data_master_address), // reconfig_cpu_data_master.address
.reconfig_cpu_data_master_waitrequest (reconfig_cpu_data_master_waitrequest), // .waitrequest
.reconfig_cpu_data_master_byteenable (reconfig_cpu_data_master_byteenable), // .byteenable
.reconfig_cpu_data_master_read (reconfig_cpu_data_master_read), // .read
.reconfig_cpu_data_master_readdata (reconfig_cpu_data_master_readdata), // .readdata
.reconfig_cpu_data_master_write (reconfig_cpu_data_master_write), // .write
.reconfig_cpu_data_master_writedata (reconfig_cpu_data_master_writedata), // .writedata
.reconfig_cpu_instruction_master_address (reconfig_cpu_instruction_master_address), // reconfig_cpu_instruction_master.address
.reconfig_cpu_instruction_master_waitrequest (reconfig_cpu_instruction_master_waitrequest), // .waitrequest
.reconfig_cpu_instruction_master_read (reconfig_cpu_instruction_master_read), // .read
.reconfig_cpu_instruction_master_readdata (reconfig_cpu_instruction_master_readdata), // .readdata
.reconfig_ctrl_ctrl_address (reconfig_ctrl_ctrl_address), // reconfig_ctrl_ctrl.address
.reconfig_ctrl_ctrl_write (reconfig_ctrl_ctrl_write), // .write
.reconfig_ctrl_ctrl_read (reconfig_ctrl_ctrl_read), // .read
.reconfig_ctrl_ctrl_readdata (reconfig_ctrl_ctrl_readdata), // .readdata
.reconfig_ctrl_ctrl_writedata (reconfig_ctrl_ctrl_writedata), // .writedata
.reconfig_ctrl_ctrl_waitrequest (reconfig_ctrl_ctrl_waitrequest), // .waitrequest
.reconfig_mem_mem_address (reconfig_mem_mem_address), // reconfig_mem_mem.address
.reconfig_mem_mem_write (reconfig_mem_mem_write), // .write
.reconfig_mem_mem_read (reconfig_mem_mem_read), // .read
.reconfig_mem_mem_readdata (reconfig_mem_mem_readdata), // .readdata
.reconfig_mem_mem_writedata (reconfig_mem_mem_writedata), // .writedata
.reconfig_mem_mem_byteenable (reconfig_mem_mem_byteenable) // .byteenable
);
alt_xcvr_reconfig_cpu_irq_mapper irq_mapper (
.clk (clk_clk), // clk.clk
.reset (reconfig_ctrl_reset_reset), // clk_reset.reset
.receiver0_irq (reconfig_ctrl_ctrl_irq_irq), // receiver0.irq
.sender_irq (reconfig_cpu_d_irq_irq) // sender.irq
);
altera_reset_controller #(
.NUM_RESET_INPUTS (1),
.OUTPUT_RESET_SYNC_EDGES ("deassert"),
.SYNC_DEPTH (2),
.RESET_REQUEST_PRESENT (1),
.RESET_REQ_WAIT_TIME (1),
.MIN_RST_ASSERTION_TIME (3),
.RESET_REQ_EARLY_DSRT_TIME (1),
.USE_RESET_REQUEST_IN0 (0),
.USE_RESET_REQUEST_IN1 (0),
.USE_RESET_REQUEST_IN2 (0),
.USE_RESET_REQUEST_IN3 (0),
.USE_RESET_REQUEST_IN4 (0),
.USE_RESET_REQUEST_IN5 (0),
.USE_RESET_REQUEST_IN6 (0),
.USE_RESET_REQUEST_IN7 (0),
.USE_RESET_REQUEST_IN8 (0),
.USE_RESET_REQUEST_IN9 (0),
.USE_RESET_REQUEST_IN10 (0),
.USE_RESET_REQUEST_IN11 (0),
.USE_RESET_REQUEST_IN12 (0),
.USE_RESET_REQUEST_IN13 (0),
.USE_RESET_REQUEST_IN14 (0),
.USE_RESET_REQUEST_IN15 (0),
.ADAPT_RESET_REQUEST (0)
) rst_controller (
.reset_in0 (~reset_reset_n), // reset_in0.reset
.clk (clk_clk), // clk.clk
.reset_out (reconfig_ctrl_reset_reset), // reset_out.reset
.reset_req (reconfig_mem_reset_reset_req), // .reset_req
.reset_req_in0 (1'b0), // (terminated)
.reset_in1 (1'b0), // (terminated)
.reset_req_in1 (1'b0), // (terminated)
.reset_in2 (1'b0), // (terminated)
.reset_req_in2 (1'b0), // (terminated)
.reset_in3 (1'b0), // (terminated)
.reset_req_in3 (1'b0), // (terminated)
.reset_in4 (1'b0), // (terminated)
.reset_req_in4 (1'b0), // (terminated)
.reset_in5 (1'b0), // (terminated)
.reset_req_in5 (1'b0), // (terminated)
.reset_in6 (1'b0), // (terminated)
.reset_req_in6 (1'b0), // (terminated)
.reset_in7 (1'b0), // (terminated)
.reset_req_in7 (1'b0), // (terminated)
.reset_in8 (1'b0), // (terminated)
.reset_req_in8 (1'b0), // (terminated)
.reset_in9 (1'b0), // (terminated)
.reset_req_in9 (1'b0), // (terminated)
.reset_in10 (1'b0), // (terminated)
.reset_req_in10 (1'b0), // (terminated)
.reset_in11 (1'b0), // (terminated)
.reset_req_in11 (1'b0), // (terminated)
.reset_in12 (1'b0), // (terminated)
.reset_req_in12 (1'b0), // (terminated)
.reset_in13 (1'b0), // (terminated)
.reset_req_in13 (1'b0), // (terminated)
.reset_in14 (1'b0), // (terminated)
.reset_req_in14 (1'b0), // (terminated)
.reset_in15 (1'b0), // (terminated)
.reset_req_in15 (1'b0) // (terminated)
);
assign reconfig_mem_reset_reset = reconfig_ctrl_reset_reset;
endmodule

View file

@ -0,0 +1,58 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
// $Id: //acds/rel/18.1std/ip/merlin/altera_irq_mapper/altera_irq_mapper.sv.terp#1 $
// $Revision: #1 $
// $Date: 2018/07/18 $
// $Author: psgswbuild $
// -------------------------------------------------------
// Altera IRQ Mapper
//
// Parameters
// NUM_RCVRS : 1
// SENDER_IRW_WIDTH : 32
// IRQ_MAP : 0:0
//
// -------------------------------------------------------
`timescale 1 ns / 1 ns
module alt_xcvr_reconfig_cpu_irq_mapper
(
// -------------------
// Clock & Reset
// -------------------
input clk,
input reset,
// -------------------
// IRQ Receivers
// -------------------
input receiver0_irq,
// -------------------
// Command Source (Output)
// -------------------
output reg [31 : 0] sender_irq
);
always @* begin
sender_irq = 0;
sender_irq[0] = receiver0_irq;
end
endmodule

View file

@ -0,0 +1,202 @@
// alt_xcvr_reconfig_cpu_mm_interconnect_0_avalon_st_adapter.v
// This file was auto-generated from altera_avalon_st_adapter_hw.tcl. If you edit it your changes
// will probably be lost.
//
// Generated using ACDS version 18.1 625
`timescale 1 ps / 1 ps
module alt_xcvr_reconfig_cpu_mm_interconnect_0_avalon_st_adapter #(
parameter inBitsPerSymbol = 34,
parameter inUsePackets = 0,
parameter inDataWidth = 34,
parameter inChannelWidth = 0,
parameter inErrorWidth = 0,
parameter inUseEmptyPort = 0,
parameter inUseValid = 1,
parameter inUseReady = 1,
parameter inReadyLatency = 0,
parameter outDataWidth = 34,
parameter outChannelWidth = 0,
parameter outErrorWidth = 1,
parameter outUseEmptyPort = 0,
parameter outUseValid = 1,
parameter outUseReady = 1,
parameter outReadyLatency = 0
) (
input wire in_clk_0_clk, // in_clk_0.clk
input wire in_rst_0_reset, // in_rst_0.reset
input wire [33:0] in_0_data, // in_0.data
input wire in_0_valid, // .valid
output wire in_0_ready, // .ready
output wire [33:0] out_0_data, // out_0.data
output wire out_0_valid, // .valid
input wire out_0_ready, // .ready
output wire [0:0] out_0_error // .error
);
generate
// If any of the display statements (or deliberately broken
// instantiations) within this generate block triggers then this module
// has been instantiated this module with a set of parameters different
// from those it was generated for. This will usually result in a
// non-functioning system.
if (inBitsPerSymbol != 34)
begin
initial begin
$display("Generated module instantiated with wrong parameters");
$stop;
end
instantiated_with_wrong_parameters_error_see_comment_above
inbitspersymbol_check ( .error(1'b1) );
end
if (inUsePackets != 0)
begin
initial begin
$display("Generated module instantiated with wrong parameters");
$stop;
end
instantiated_with_wrong_parameters_error_see_comment_above
inusepackets_check ( .error(1'b1) );
end
if (inDataWidth != 34)
begin
initial begin
$display("Generated module instantiated with wrong parameters");
$stop;
end
instantiated_with_wrong_parameters_error_see_comment_above
indatawidth_check ( .error(1'b1) );
end
if (inChannelWidth != 0)
begin
initial begin
$display("Generated module instantiated with wrong parameters");
$stop;
end
instantiated_with_wrong_parameters_error_see_comment_above
inchannelwidth_check ( .error(1'b1) );
end
if (inErrorWidth != 0)
begin
initial begin
$display("Generated module instantiated with wrong parameters");
$stop;
end
instantiated_with_wrong_parameters_error_see_comment_above
inerrorwidth_check ( .error(1'b1) );
end
if (inUseEmptyPort != 0)
begin
initial begin
$display("Generated module instantiated with wrong parameters");
$stop;
end
instantiated_with_wrong_parameters_error_see_comment_above
inuseemptyport_check ( .error(1'b1) );
end
if (inUseValid != 1)
begin
initial begin
$display("Generated module instantiated with wrong parameters");
$stop;
end
instantiated_with_wrong_parameters_error_see_comment_above
inusevalid_check ( .error(1'b1) );
end
if (inUseReady != 1)
begin
initial begin
$display("Generated module instantiated with wrong parameters");
$stop;
end
instantiated_with_wrong_parameters_error_see_comment_above
inuseready_check ( .error(1'b1) );
end
if (inReadyLatency != 0)
begin
initial begin
$display("Generated module instantiated with wrong parameters");
$stop;
end
instantiated_with_wrong_parameters_error_see_comment_above
inreadylatency_check ( .error(1'b1) );
end
if (outDataWidth != 34)
begin
initial begin
$display("Generated module instantiated with wrong parameters");
$stop;
end
instantiated_with_wrong_parameters_error_see_comment_above
outdatawidth_check ( .error(1'b1) );
end
if (outChannelWidth != 0)
begin
initial begin
$display("Generated module instantiated with wrong parameters");
$stop;
end
instantiated_with_wrong_parameters_error_see_comment_above
outchannelwidth_check ( .error(1'b1) );
end
if (outErrorWidth != 1)
begin
initial begin
$display("Generated module instantiated with wrong parameters");
$stop;
end
instantiated_with_wrong_parameters_error_see_comment_above
outerrorwidth_check ( .error(1'b1) );
end
if (outUseEmptyPort != 0)
begin
initial begin
$display("Generated module instantiated with wrong parameters");
$stop;
end
instantiated_with_wrong_parameters_error_see_comment_above
outuseemptyport_check ( .error(1'b1) );
end
if (outUseValid != 1)
begin
initial begin
$display("Generated module instantiated with wrong parameters");
$stop;
end
instantiated_with_wrong_parameters_error_see_comment_above
outusevalid_check ( .error(1'b1) );
end
if (outUseReady != 1)
begin
initial begin
$display("Generated module instantiated with wrong parameters");
$stop;
end
instantiated_with_wrong_parameters_error_see_comment_above
outuseready_check ( .error(1'b1) );
end
if (outReadyLatency != 0)
begin
initial begin
$display("Generated module instantiated with wrong parameters");
$stop;
end
instantiated_with_wrong_parameters_error_see_comment_above
outreadylatency_check ( .error(1'b1) );
end
endgenerate
alt_xcvr_reconfig_cpu_mm_interconnect_0_avalon_st_adapter_error_adapter_0 error_adapter_0 (
.clk (in_clk_0_clk), // clk.clk
.reset_n (~in_rst_0_reset), // reset.reset_n
.in_data (in_0_data), // in.data
.in_valid (in_0_valid), // .valid
.in_ready (in_0_ready), // .ready
.out_data (out_0_data), // out.data
.out_valid (out_0_valid), // .valid
.out_ready (out_0_ready), // .ready
.out_error (out_0_error) // .error
);
endmodule

View file

@ -0,0 +1,107 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
// (C) 2001-2013 Altera Corporation. All rights reserved.
// Your use of Altera Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Altera Program License Subscription
// Agreement, Altera MegaCore Function License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Altera and sold by
// Altera or its authorized distributors. Please refer to the applicable
// agreement for further details.
// $Id: //acds/rel/13.1/ip/.../avalon-st_error_adapter.sv.terp#1 $
// $Revision: #1 $
// $Date: 2013/09/09 $
// $Author: dmunday $
// --------------------------------------------------------------------------------
//| Avalon Streaming Error Adapter
// --------------------------------------------------------------------------------
`timescale 1ns / 100ps
// ------------------------------------------
// Generation parameters:
// output_name: alt_xcvr_reconfig_cpu_mm_interconnect_0_avalon_st_adapter_error_adapter_0
// use_ready: true
// use_packets: false
// use_empty: 0
// empty_width: 0
// data_width: 34
// channel_width: 0
// in_error_width: 0
// out_error_width: 1
// in_errors_list
// in_errors_indices 0
// out_errors_list
// has_in_error_desc: FALSE
// has_out_error_desc: FALSE
// out_has_other: FALSE
// out_other_index: -1
// dumpVar:
// inString: in_error[
// closeString: ] |
// ------------------------------------------
module alt_xcvr_reconfig_cpu_mm_interconnect_0_avalon_st_adapter_error_adapter_0
(
// Interface: in
output reg in_ready,
input in_valid,
input [34-1: 0] in_data,
// Interface: out
input out_ready,
output reg out_valid,
output reg [34-1: 0] out_data,
output reg [0:0] out_error,
// Interface: clk
input clk,
// Interface: reset
input reset_n
/*AUTOARG*/);
reg in_error = 0;
initial in_error = 0;
// ---------------------------------------------------------------------
//| Pass-through Mapping
// ---------------------------------------------------------------------
always_comb begin
in_ready = out_ready;
out_valid = in_valid;
out_data = in_data;
end
// ---------------------------------------------------------------------
//| Error Mapping
// ---------------------------------------------------------------------
always_comb begin
out_error = 0;
out_error = in_error;
end //always @*
endmodule

View file

@ -0,0 +1,115 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
// $Id: //acds/rel/18.1std/ip/merlin/altera_merlin_demultiplexer/altera_merlin_demultiplexer.sv.terp#1 $
// $Revision: #1 $
// $Date: 2018/07/18 $
// $Author: psgswbuild $
// -------------------------------------
// Merlin Demultiplexer
//
// Asserts valid on the appropriate output
// given a one-hot channel signal.
// -------------------------------------
`timescale 1 ns / 1 ns
// ------------------------------------------
// Generation parameters:
// output_name: alt_xcvr_reconfig_cpu_mm_interconnect_0_cmd_demux
// ST_DATA_W: 86
// ST_CHANNEL_W: 2
// NUM_OUTPUTS: 2
// VALID_WIDTH: 1
// ------------------------------------------
//------------------------------------------
// Message Supression Used
// QIS Warnings
// 15610 - Warning: Design contains x input pin(s) that do not drive logic
//------------------------------------------
module alt_xcvr_reconfig_cpu_mm_interconnect_0_cmd_demux
(
// -------------------
// Sink
// -------------------
input [1-1 : 0] sink_valid,
input [86-1 : 0] sink_data, // ST_DATA_W=86
input [2-1 : 0] sink_channel, // ST_CHANNEL_W=2
input sink_startofpacket,
input sink_endofpacket,
output sink_ready,
// -------------------
// Sources
// -------------------
output reg src0_valid,
output reg [86-1 : 0] src0_data, // ST_DATA_W=86
output reg [2-1 : 0] src0_channel, // ST_CHANNEL_W=2
output reg src0_startofpacket,
output reg src0_endofpacket,
input src0_ready,
output reg src1_valid,
output reg [86-1 : 0] src1_data, // ST_DATA_W=86
output reg [2-1 : 0] src1_channel, // ST_CHANNEL_W=2
output reg src1_startofpacket,
output reg src1_endofpacket,
input src1_ready,
// -------------------
// Clock & Reset
// -------------------
(*altera_attribute = "-name MESSAGE_DISABLE 15610" *) // setting message suppression on clk
input clk,
(*altera_attribute = "-name MESSAGE_DISABLE 15610" *) // setting message suppression on reset
input reset
);
localparam NUM_OUTPUTS = 2;
wire [NUM_OUTPUTS - 1 : 0] ready_vector;
// -------------------
// Demux
// -------------------
always @* begin
src0_data = sink_data;
src0_startofpacket = sink_startofpacket;
src0_endofpacket = sink_endofpacket;
src0_channel = sink_channel >> NUM_OUTPUTS;
src0_valid = sink_channel[0] && sink_valid;
src1_data = sink_data;
src1_startofpacket = sink_startofpacket;
src1_endofpacket = sink_endofpacket;
src1_channel = sink_channel >> NUM_OUTPUTS;
src1_valid = sink_channel[1] && sink_valid;
end
// -------------------
// Backpressure
// -------------------
assign ready_vector[0] = src0_ready;
assign ready_vector[1] = src1_ready;
assign sink_ready = |(sink_channel & ready_vector);
endmodule

View file

@ -0,0 +1,100 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
// $Id: //acds/rel/18.1std/ip/merlin/altera_merlin_demultiplexer/altera_merlin_demultiplexer.sv.terp#1 $
// $Revision: #1 $
// $Date: 2018/07/18 $
// $Author: psgswbuild $
// -------------------------------------
// Merlin Demultiplexer
//
// Asserts valid on the appropriate output
// given a one-hot channel signal.
// -------------------------------------
`timescale 1 ns / 1 ns
// ------------------------------------------
// Generation parameters:
// output_name: alt_xcvr_reconfig_cpu_mm_interconnect_0_cmd_demux_001
// ST_DATA_W: 86
// ST_CHANNEL_W: 2
// NUM_OUTPUTS: 1
// VALID_WIDTH: 1
// ------------------------------------------
//------------------------------------------
// Message Supression Used
// QIS Warnings
// 15610 - Warning: Design contains x input pin(s) that do not drive logic
//------------------------------------------
module alt_xcvr_reconfig_cpu_mm_interconnect_0_cmd_demux_001
(
// -------------------
// Sink
// -------------------
input [1-1 : 0] sink_valid,
input [86-1 : 0] sink_data, // ST_DATA_W=86
input [2-1 : 0] sink_channel, // ST_CHANNEL_W=2
input sink_startofpacket,
input sink_endofpacket,
output sink_ready,
// -------------------
// Sources
// -------------------
output reg src0_valid,
output reg [86-1 : 0] src0_data, // ST_DATA_W=86
output reg [2-1 : 0] src0_channel, // ST_CHANNEL_W=2
output reg src0_startofpacket,
output reg src0_endofpacket,
input src0_ready,
// -------------------
// Clock & Reset
// -------------------
(*altera_attribute = "-name MESSAGE_DISABLE 15610" *) // setting message suppression on clk
input clk,
(*altera_attribute = "-name MESSAGE_DISABLE 15610" *) // setting message suppression on reset
input reset
);
localparam NUM_OUTPUTS = 1;
wire [NUM_OUTPUTS - 1 : 0] ready_vector;
// -------------------
// Demux
// -------------------
always @* begin
src0_data = sink_data;
src0_startofpacket = sink_startofpacket;
src0_endofpacket = sink_endofpacket;
src0_channel = sink_channel >> NUM_OUTPUTS;
src0_valid = sink_channel[0] && sink_valid;
end
// -------------------
// Backpressure
// -------------------
assign ready_vector[0] = src0_ready;
assign sink_ready = |(sink_channel & {{1{1'b0}},{ready_vector[NUM_OUTPUTS - 1 : 0]}});
endmodule

View file

@ -0,0 +1,322 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
// (C) 2001-2014 Altera Corporation. All rights reserved.
// Your use of Altera Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Altera Program License Subscription
// Agreement, Altera MegaCore Function License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Altera and sold by
// Altera or its authorized distributors. Please refer to the applicable
// agreement for further details.
// $Id: //acds/rel/18.1std/ip/merlin/altera_merlin_multiplexer/altera_merlin_multiplexer.sv.terp#1 $
// $Revision: #1 $
// $Date: 2018/07/18 $
// $Author: psgswbuild $
// ------------------------------------------
// Merlin Multiplexer
// ------------------------------------------
`timescale 1 ns / 1 ns
// ------------------------------------------
// Generation parameters:
// output_name: alt_xcvr_reconfig_cpu_mm_interconnect_0_cmd_mux
// NUM_INPUTS: 2
// ARBITRATION_SHARES: 1 1
// ARBITRATION_SCHEME "round-robin"
// PIPELINE_ARB: 1
// PKT_TRANS_LOCK: 54 (arbitration locking enabled)
// ST_DATA_W: 86
// ST_CHANNEL_W: 2
// ------------------------------------------
module alt_xcvr_reconfig_cpu_mm_interconnect_0_cmd_mux
(
// ----------------------
// Sinks
// ----------------------
input sink0_valid,
input [86-1 : 0] sink0_data,
input [2-1: 0] sink0_channel,
input sink0_startofpacket,
input sink0_endofpacket,
output sink0_ready,
input sink1_valid,
input [86-1 : 0] sink1_data,
input [2-1: 0] sink1_channel,
input sink1_startofpacket,
input sink1_endofpacket,
output sink1_ready,
// ----------------------
// Source
// ----------------------
output src_valid,
output [86-1 : 0] src_data,
output [2-1 : 0] src_channel,
output src_startofpacket,
output src_endofpacket,
input src_ready,
// ----------------------
// Clock & Reset
// ----------------------
input clk,
input reset
);
localparam PAYLOAD_W = 86 + 2 + 2;
localparam NUM_INPUTS = 2;
localparam SHARE_COUNTER_W = 1;
localparam PIPELINE_ARB = 1;
localparam ST_DATA_W = 86;
localparam ST_CHANNEL_W = 2;
localparam PKT_TRANS_LOCK = 54;
// ------------------------------------------
// Signals
// ------------------------------------------
wire [NUM_INPUTS - 1 : 0] request;
wire [NUM_INPUTS - 1 : 0] valid;
wire [NUM_INPUTS - 1 : 0] grant;
wire [NUM_INPUTS - 1 : 0] next_grant;
reg [NUM_INPUTS - 1 : 0] saved_grant;
reg [PAYLOAD_W - 1 : 0] src_payload;
wire last_cycle;
reg packet_in_progress;
reg update_grant;
wire [PAYLOAD_W - 1 : 0] sink0_payload;
wire [PAYLOAD_W - 1 : 0] sink1_payload;
assign valid[0] = sink0_valid;
assign valid[1] = sink1_valid;
wire [NUM_INPUTS - 1 : 0] eop;
assign eop[0] = sink0_endofpacket;
assign eop[1] = sink1_endofpacket;
// ------------------------------------------
// ------------------------------------------
// Grant Logic & Updates
// ------------------------------------------
// ------------------------------------------
reg [NUM_INPUTS - 1 : 0] lock;
always @* begin
lock[0] = sink0_data[54];
lock[1] = sink1_data[54];
end
reg [NUM_INPUTS - 1 : 0] locked = '0;
always @(posedge clk or posedge reset) begin
if (reset) begin
locked <= '0;
end
else begin
locked <= next_grant & lock;
end
end
assign last_cycle = src_valid & src_ready & src_endofpacket & ~(|(lock & grant));
// ------------------------------------------
// We're working on a packet at any time valid is high, except
// when this is the endofpacket.
// ------------------------------------------
always @(posedge clk or posedge reset) begin
if (reset) begin
packet_in_progress <= 1'b0;
end
else begin
if (last_cycle)
packet_in_progress <= 1'b0;
else if (src_valid)
packet_in_progress <= 1'b1;
end
end
// ------------------------------------------
// Shares
//
// Special case: all-equal shares _should_ be optimized into assigning a
// constant to next_grant_share.
// Special case: all-1's shares _should_ result in the share counter
// being optimized away.
// ------------------------------------------
// Input | arb shares | counter load value
// 0 | 1 | 0
// 1 | 1 | 0
wire [SHARE_COUNTER_W - 1 : 0] share_0 = 1'd0;
wire [SHARE_COUNTER_W - 1 : 0] share_1 = 1'd0;
// ------------------------------------------
// Choose the share value corresponding to the grant.
// ------------------------------------------
reg [SHARE_COUNTER_W - 1 : 0] next_grant_share;
always @* begin
next_grant_share =
share_0 & { SHARE_COUNTER_W {next_grant[0]} } |
share_1 & { SHARE_COUNTER_W {next_grant[1]} };
end
// ------------------------------------------
// Flag to indicate first packet of an arb sequence.
// ------------------------------------------
// ------------------------------------------
// Compute the next share-count value.
// ------------------------------------------
reg [SHARE_COUNTER_W - 1 : 0] p1_share_count;
reg [SHARE_COUNTER_W - 1 : 0] share_count;
reg share_count_zero_flag;
always @* begin
// Update the counter, but don't decrement below 0.
p1_share_count = share_count_zero_flag ? '0 : share_count - 1'b1;
end
// ------------------------------------------
// Update the share counter and share-counter=zero flag.
// ------------------------------------------
always @(posedge clk or posedge reset) begin
if (reset) begin
share_count <= '0;
share_count_zero_flag <= 1'b1;
end
else begin
if (update_grant) begin
share_count <= next_grant_share;
share_count_zero_flag <= (next_grant_share == '0);
end
else if (last_cycle) begin
share_count <= p1_share_count;
share_count_zero_flag <= (p1_share_count == '0);
end
end
end
always @* begin
update_grant = 0;
// ------------------------------------------
// The pipeline delays grant by one cycle, so
// we have to calculate the update_grant signal
// one cycle ahead of time.
//
// Possible optimization: omit the first clause
// "if (!packet_in_progress & ~src_valid) ..."
// cost: one idle cycle at the the beginning of each
// grant cycle.
// benefit: save a small amount of logic.
// ------------------------------------------
if (!packet_in_progress & !src_valid)
update_grant = 1;
if (last_cycle && share_count_zero_flag)
update_grant = 1;
end
wire save_grant;
assign save_grant = update_grant;
assign grant = saved_grant;
always @(posedge clk, posedge reset) begin
if (reset)
saved_grant <= '0;
else if (save_grant)
saved_grant <= next_grant;
end
// ------------------------------------------
// ------------------------------------------
// Arbitrator
// ------------------------------------------
// ------------------------------------------
// ------------------------------------------
// Create a request vector that stays high during
// the packet for unpipelined arbitration.
//
// The pipelined arbitration scheme does not require
// request to be held high during the packet.
// ------------------------------------------
reg [NUM_INPUTS - 1 : 0] prev_request;
always @(posedge clk, posedge reset) begin
if (reset)
prev_request <= '0;
else
prev_request <= request & ~(valid & eop);
end
assign request = (PIPELINE_ARB == 1) ? valid | locked :
prev_request | valid | locked;
wire [NUM_INPUTS - 1 : 0] next_grant_from_arb;
altera_merlin_arbitrator
#(
.NUM_REQUESTERS(NUM_INPUTS),
.SCHEME ("round-robin"),
.PIPELINE (1)
) arb (
.clk (clk),
.reset (reset),
.request (request),
.grant (next_grant_from_arb),
.save_top_priority (src_valid),
.increment_top_priority (update_grant)
);
assign next_grant = next_grant_from_arb;
// ------------------------------------------
// ------------------------------------------
// Mux
//
// Implemented as a sum of products.
// ------------------------------------------
// ------------------------------------------
assign sink0_ready = src_ready && grant[0];
assign sink1_ready = src_ready && grant[1];
assign src_valid = |(grant & valid);
always @* begin
src_payload =
sink0_payload & {PAYLOAD_W {grant[0]} } |
sink1_payload & {PAYLOAD_W {grant[1]} };
end
// ------------------------------------------
// Mux Payload Mapping
// ------------------------------------------
assign sink0_payload = {sink0_channel,sink0_data,
sink0_startofpacket,sink0_endofpacket};
assign sink1_payload = {sink1_channel,sink1_data,
sink1_startofpacket,sink1_endofpacket};
assign {src_channel,src_data,src_startofpacket,src_endofpacket} = src_payload;
endmodule

View file

@ -0,0 +1,96 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
// (C) 2001-2014 Altera Corporation. All rights reserved.
// Your use of Altera Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Altera Program License Subscription
// Agreement, Altera MegaCore Function License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Altera and sold by
// Altera or its authorized distributors. Please refer to the applicable
// agreement for further details.
// $Id: //acds/rel/18.1std/ip/merlin/altera_merlin_multiplexer/altera_merlin_multiplexer.sv.terp#1 $
// $Revision: #1 $
// $Date: 2018/07/18 $
// $Author: psgswbuild $
// ------------------------------------------
// Merlin Multiplexer
// ------------------------------------------
`timescale 1 ns / 1 ns
// ------------------------------------------
// Generation parameters:
// output_name: alt_xcvr_reconfig_cpu_mm_interconnect_0_cmd_mux_001
// NUM_INPUTS: 1
// ARBITRATION_SHARES: 1
// ARBITRATION_SCHEME "round-robin"
// PIPELINE_ARB: 1
// PKT_TRANS_LOCK: 54 (arbitration locking enabled)
// ST_DATA_W: 86
// ST_CHANNEL_W: 2
// ------------------------------------------
module alt_xcvr_reconfig_cpu_mm_interconnect_0_cmd_mux_001
(
// ----------------------
// Sinks
// ----------------------
input sink0_valid,
input [86-1 : 0] sink0_data,
input [2-1: 0] sink0_channel,
input sink0_startofpacket,
input sink0_endofpacket,
output sink0_ready,
// ----------------------
// Source
// ----------------------
output src_valid,
output [86-1 : 0] src_data,
output [2-1 : 0] src_channel,
output src_startofpacket,
output src_endofpacket,
input src_ready,
// ----------------------
// Clock & Reset
// ----------------------
input clk,
input reset
);
localparam PAYLOAD_W = 86 + 2 + 2;
localparam NUM_INPUTS = 1;
localparam SHARE_COUNTER_W = 1;
localparam PIPELINE_ARB = 1;
localparam ST_DATA_W = 86;
localparam ST_CHANNEL_W = 2;
localparam PKT_TRANS_LOCK = 54;
assign src_valid = sink0_valid;
assign src_data = sink0_data;
assign src_channel = sink0_channel;
assign src_startofpacket = sink0_startofpacket;
assign src_endofpacket = sink0_endofpacket;
assign sink0_ready = src_ready;
endmodule

View file

@ -0,0 +1,227 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
// Your use of Altera Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Altera Program License Subscription
// Agreement, Altera MegaCore Function License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Altera and sold by
// Altera or its authorized distributors. Please refer to the applicable
// agreement for further details.
// $Id: //acds/rel/18.1std/ip/merlin/altera_merlin_router/altera_merlin_router.sv.terp#1 $
// $Revision: #1 $
// $Date: 2018/07/18 $
// $Author: psgswbuild $
// -------------------------------------------------------
// Merlin Router
//
// Asserts the appropriate one-hot encoded channel based on
// either (a) the address or (b) the dest id. The DECODER_TYPE
// parameter controls this behaviour. 0 means address decoder,
// 1 means dest id decoder.
//
// In the case of (a), it also sets the destination id.
// -------------------------------------------------------
`timescale 1 ns / 1 ns
module alt_xcvr_reconfig_cpu_mm_interconnect_0_router_default_decode
#(
parameter DEFAULT_CHANNEL = 0,
DEFAULT_WR_CHANNEL = -1,
DEFAULT_RD_CHANNEL = -1,
DEFAULT_DESTID = 1
)
(output [72 - 72 : 0] default_destination_id,
output [2-1 : 0] default_wr_channel,
output [2-1 : 0] default_rd_channel,
output [2-1 : 0] default_src_channel
);
assign default_destination_id =
DEFAULT_DESTID[72 - 72 : 0];
generate
if (DEFAULT_CHANNEL == -1) begin : no_default_channel_assignment
assign default_src_channel = '0;
end
else begin : default_channel_assignment
assign default_src_channel = 2'b1 << DEFAULT_CHANNEL;
end
endgenerate
generate
if (DEFAULT_RD_CHANNEL == -1) begin : no_default_rw_channel_assignment
assign default_wr_channel = '0;
assign default_rd_channel = '0;
end
else begin : default_rw_channel_assignment
assign default_wr_channel = 2'b1 << DEFAULT_WR_CHANNEL;
assign default_rd_channel = 2'b1 << DEFAULT_RD_CHANNEL;
end
endgenerate
endmodule
module alt_xcvr_reconfig_cpu_mm_interconnect_0_router
(
// -------------------
// Clock & Reset
// -------------------
input clk,
input reset,
// -------------------
// Command Sink (Input)
// -------------------
input sink_valid,
input [86-1 : 0] sink_data,
input sink_startofpacket,
input sink_endofpacket,
output sink_ready,
// -------------------
// Command Source (Output)
// -------------------
output src_valid,
output reg [86-1 : 0] src_data,
output reg [2-1 : 0] src_channel,
output src_startofpacket,
output src_endofpacket,
input src_ready
);
// -------------------------------------------------------
// Local parameters and variables
// -------------------------------------------------------
localparam PKT_ADDR_H = 49;
localparam PKT_ADDR_L = 36;
localparam PKT_DEST_ID_H = 72;
localparam PKT_DEST_ID_L = 72;
localparam PKT_PROTECTION_H = 76;
localparam PKT_PROTECTION_L = 74;
localparam ST_DATA_W = 86;
localparam ST_CHANNEL_W = 2;
localparam DECODER_TYPE = 0;
localparam PKT_TRANS_WRITE = 52;
localparam PKT_TRANS_READ = 53;
localparam PKT_ADDR_W = PKT_ADDR_H-PKT_ADDR_L + 1;
localparam PKT_DEST_ID_W = PKT_DEST_ID_H-PKT_DEST_ID_L + 1;
// -------------------------------------------------------
// Figure out the number of bits to mask off for each slave span
// during address decoding
// -------------------------------------------------------
localparam PAD0 = log2ceil(64'h1000 - 64'h0);
localparam PAD1 = log2ceil(64'h2080 - 64'h2000);
// -------------------------------------------------------
// Work out which address bits are significant based on the
// address range of the slaves. If the required width is too
// large or too small, we use the address field width instead.
// -------------------------------------------------------
localparam ADDR_RANGE = 64'h2080;
localparam RANGE_ADDR_WIDTH = log2ceil(ADDR_RANGE);
localparam OPTIMIZED_ADDR_H = (RANGE_ADDR_WIDTH > PKT_ADDR_W) ||
(RANGE_ADDR_WIDTH == 0) ?
PKT_ADDR_H :
PKT_ADDR_L + RANGE_ADDR_WIDTH - 1;
localparam RG = RANGE_ADDR_WIDTH-1;
localparam REAL_ADDRESS_RANGE = OPTIMIZED_ADDR_H - PKT_ADDR_L;
reg [PKT_ADDR_W-1 : 0] address;
always @* begin
address = {PKT_ADDR_W{1'b0}};
address [REAL_ADDRESS_RANGE:0] = sink_data[OPTIMIZED_ADDR_H : PKT_ADDR_L];
end
// -------------------------------------------------------
// Pass almost everything through, untouched
// -------------------------------------------------------
assign sink_ready = src_ready;
assign src_valid = sink_valid;
assign src_startofpacket = sink_startofpacket;
assign src_endofpacket = sink_endofpacket;
wire [PKT_DEST_ID_W-1:0] default_destid;
wire [2-1 : 0] default_src_channel;
alt_xcvr_reconfig_cpu_mm_interconnect_0_router_default_decode the_default_decode(
.default_destination_id (default_destid),
.default_wr_channel (),
.default_rd_channel (),
.default_src_channel (default_src_channel)
);
always @* begin
src_data = sink_data;
src_channel = default_src_channel;
src_data[PKT_DEST_ID_H:PKT_DEST_ID_L] = default_destid;
// --------------------------------------------------
// Address Decoder
// Sets the channel and destination ID based on the address
// --------------------------------------------------
// ( 0x0 .. 0x1000 )
if ( {address[RG:PAD0],{PAD0{1'b0}}} == 14'h0 ) begin
src_channel = 2'b01;
src_data[PKT_DEST_ID_H:PKT_DEST_ID_L] = 1;
end
// ( 0x2000 .. 0x2080 )
if ( {address[RG:PAD1],{PAD1{1'b0}}} == 14'h2000 ) begin
src_channel = 2'b10;
src_data[PKT_DEST_ID_H:PKT_DEST_ID_L] = 0;
end
end
// --------------------------------------------------
// Ceil(log2()) function
// --------------------------------------------------
function integer log2ceil;
input reg[65:0] val;
reg [65:0] i;
begin
i = 1;
log2ceil = 0;
while (i < val) begin
log2ceil = log2ceil + 1;
i = i << 1;
end
end
endfunction
endmodule

View file

@ -0,0 +1,216 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
// Your use of Altera Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Altera Program License Subscription
// Agreement, Altera MegaCore Function License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Altera and sold by
// Altera or its authorized distributors. Please refer to the applicable
// agreement for further details.
// $Id: //acds/rel/18.1std/ip/merlin/altera_merlin_router/altera_merlin_router.sv.terp#1 $
// $Revision: #1 $
// $Date: 2018/07/18 $
// $Author: psgswbuild $
// -------------------------------------------------------
// Merlin Router
//
// Asserts the appropriate one-hot encoded channel based on
// either (a) the address or (b) the dest id. The DECODER_TYPE
// parameter controls this behaviour. 0 means address decoder,
// 1 means dest id decoder.
//
// In the case of (a), it also sets the destination id.
// -------------------------------------------------------
`timescale 1 ns / 1 ns
module alt_xcvr_reconfig_cpu_mm_interconnect_0_router_001_default_decode
#(
parameter DEFAULT_CHANNEL = 0,
DEFAULT_WR_CHANNEL = -1,
DEFAULT_RD_CHANNEL = -1,
DEFAULT_DESTID = 1
)
(output [72 - 72 : 0] default_destination_id,
output [2-1 : 0] default_wr_channel,
output [2-1 : 0] default_rd_channel,
output [2-1 : 0] default_src_channel
);
assign default_destination_id =
DEFAULT_DESTID[72 - 72 : 0];
generate
if (DEFAULT_CHANNEL == -1) begin : no_default_channel_assignment
assign default_src_channel = '0;
end
else begin : default_channel_assignment
assign default_src_channel = 2'b1 << DEFAULT_CHANNEL;
end
endgenerate
generate
if (DEFAULT_RD_CHANNEL == -1) begin : no_default_rw_channel_assignment
assign default_wr_channel = '0;
assign default_rd_channel = '0;
end
else begin : default_rw_channel_assignment
assign default_wr_channel = 2'b1 << DEFAULT_WR_CHANNEL;
assign default_rd_channel = 2'b1 << DEFAULT_RD_CHANNEL;
end
endgenerate
endmodule
module alt_xcvr_reconfig_cpu_mm_interconnect_0_router_001
(
// -------------------
// Clock & Reset
// -------------------
input clk,
input reset,
// -------------------
// Command Sink (Input)
// -------------------
input sink_valid,
input [86-1 : 0] sink_data,
input sink_startofpacket,
input sink_endofpacket,
output sink_ready,
// -------------------
// Command Source (Output)
// -------------------
output src_valid,
output reg [86-1 : 0] src_data,
output reg [2-1 : 0] src_channel,
output src_startofpacket,
output src_endofpacket,
input src_ready
);
// -------------------------------------------------------
// Local parameters and variables
// -------------------------------------------------------
localparam PKT_ADDR_H = 49;
localparam PKT_ADDR_L = 36;
localparam PKT_DEST_ID_H = 72;
localparam PKT_DEST_ID_L = 72;
localparam PKT_PROTECTION_H = 76;
localparam PKT_PROTECTION_L = 74;
localparam ST_DATA_W = 86;
localparam ST_CHANNEL_W = 2;
localparam DECODER_TYPE = 0;
localparam PKT_TRANS_WRITE = 52;
localparam PKT_TRANS_READ = 53;
localparam PKT_ADDR_W = PKT_ADDR_H-PKT_ADDR_L + 1;
localparam PKT_DEST_ID_W = PKT_DEST_ID_H-PKT_DEST_ID_L + 1;
// -------------------------------------------------------
// Figure out the number of bits to mask off for each slave span
// during address decoding
// -------------------------------------------------------
localparam PAD0 = log2ceil(64'h1000 - 64'h0);
// -------------------------------------------------------
// Work out which address bits are significant based on the
// address range of the slaves. If the required width is too
// large or too small, we use the address field width instead.
// -------------------------------------------------------
localparam ADDR_RANGE = 64'h1000;
localparam RANGE_ADDR_WIDTH = log2ceil(ADDR_RANGE);
localparam OPTIMIZED_ADDR_H = (RANGE_ADDR_WIDTH > PKT_ADDR_W) ||
(RANGE_ADDR_WIDTH == 0) ?
PKT_ADDR_H :
PKT_ADDR_L + RANGE_ADDR_WIDTH - 1;
localparam RG = RANGE_ADDR_WIDTH;
localparam REAL_ADDRESS_RANGE = OPTIMIZED_ADDR_H - PKT_ADDR_L;
// -------------------------------------------------------
// Pass almost everything through, untouched
// -------------------------------------------------------
assign sink_ready = src_ready;
assign src_valid = sink_valid;
assign src_startofpacket = sink_startofpacket;
assign src_endofpacket = sink_endofpacket;
wire [PKT_DEST_ID_W-1:0] default_destid;
wire [2-1 : 0] default_src_channel;
alt_xcvr_reconfig_cpu_mm_interconnect_0_router_001_default_decode the_default_decode(
.default_destination_id (default_destid),
.default_wr_channel (),
.default_rd_channel (),
.default_src_channel (default_src_channel)
);
always @* begin
src_data = sink_data;
src_channel = default_src_channel;
src_data[PKT_DEST_ID_H:PKT_DEST_ID_L] = default_destid;
// --------------------------------------------------
// Address Decoder
// Sets the channel and destination ID based on the address
// --------------------------------------------------
// ( 0 .. 1000 )
src_channel = 2'b1;
src_data[PKT_DEST_ID_H:PKT_DEST_ID_L] = 1;
end
// --------------------------------------------------
// Ceil(log2()) function
// --------------------------------------------------
function integer log2ceil;
input reg[65:0] val;
reg [65:0] i;
begin
i = 1;
log2ceil = 0;
while (i < val) begin
log2ceil = log2ceil + 1;
i = i << 1;
end
end
endfunction
endmodule

View file

@ -0,0 +1,224 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
// Your use of Altera Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Altera Program License Subscription
// Agreement, Altera MegaCore Function License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Altera and sold by
// Altera or its authorized distributors. Please refer to the applicable
// agreement for further details.
// $Id: //acds/rel/18.1std/ip/merlin/altera_merlin_router/altera_merlin_router.sv.terp#1 $
// $Revision: #1 $
// $Date: 2018/07/18 $
// $Author: psgswbuild $
// -------------------------------------------------------
// Merlin Router
//
// Asserts the appropriate one-hot encoded channel based on
// either (a) the address or (b) the dest id. The DECODER_TYPE
// parameter controls this behaviour. 0 means address decoder,
// 1 means dest id decoder.
//
// In the case of (a), it also sets the destination id.
// -------------------------------------------------------
`timescale 1 ns / 1 ns
module alt_xcvr_reconfig_cpu_mm_interconnect_0_router_002_default_decode
#(
parameter DEFAULT_CHANNEL = 0,
DEFAULT_WR_CHANNEL = -1,
DEFAULT_RD_CHANNEL = -1,
DEFAULT_DESTID = 0
)
(output [72 - 72 : 0] default_destination_id,
output [2-1 : 0] default_wr_channel,
output [2-1 : 0] default_rd_channel,
output [2-1 : 0] default_src_channel
);
assign default_destination_id =
DEFAULT_DESTID[72 - 72 : 0];
generate
if (DEFAULT_CHANNEL == -1) begin : no_default_channel_assignment
assign default_src_channel = '0;
end
else begin : default_channel_assignment
assign default_src_channel = 2'b1 << DEFAULT_CHANNEL;
end
endgenerate
generate
if (DEFAULT_RD_CHANNEL == -1) begin : no_default_rw_channel_assignment
assign default_wr_channel = '0;
assign default_rd_channel = '0;
end
else begin : default_rw_channel_assignment
assign default_wr_channel = 2'b1 << DEFAULT_WR_CHANNEL;
assign default_rd_channel = 2'b1 << DEFAULT_RD_CHANNEL;
end
endgenerate
endmodule
module alt_xcvr_reconfig_cpu_mm_interconnect_0_router_002
(
// -------------------
// Clock & Reset
// -------------------
input clk,
input reset,
// -------------------
// Command Sink (Input)
// -------------------
input sink_valid,
input [86-1 : 0] sink_data,
input sink_startofpacket,
input sink_endofpacket,
output sink_ready,
// -------------------
// Command Source (Output)
// -------------------
output src_valid,
output reg [86-1 : 0] src_data,
output reg [2-1 : 0] src_channel,
output src_startofpacket,
output src_endofpacket,
input src_ready
);
// -------------------------------------------------------
// Local parameters and variables
// -------------------------------------------------------
localparam PKT_ADDR_H = 49;
localparam PKT_ADDR_L = 36;
localparam PKT_DEST_ID_H = 72;
localparam PKT_DEST_ID_L = 72;
localparam PKT_PROTECTION_H = 76;
localparam PKT_PROTECTION_L = 74;
localparam ST_DATA_W = 86;
localparam ST_CHANNEL_W = 2;
localparam DECODER_TYPE = 1;
localparam PKT_TRANS_WRITE = 52;
localparam PKT_TRANS_READ = 53;
localparam PKT_ADDR_W = PKT_ADDR_H-PKT_ADDR_L + 1;
localparam PKT_DEST_ID_W = PKT_DEST_ID_H-PKT_DEST_ID_L + 1;
// -------------------------------------------------------
// Figure out the number of bits to mask off for each slave span
// during address decoding
// -------------------------------------------------------
// -------------------------------------------------------
// Work out which address bits are significant based on the
// address range of the slaves. If the required width is too
// large or too small, we use the address field width instead.
// -------------------------------------------------------
localparam ADDR_RANGE = 64'h0;
localparam RANGE_ADDR_WIDTH = log2ceil(ADDR_RANGE);
localparam OPTIMIZED_ADDR_H = (RANGE_ADDR_WIDTH > PKT_ADDR_W) ||
(RANGE_ADDR_WIDTH == 0) ?
PKT_ADDR_H :
PKT_ADDR_L + RANGE_ADDR_WIDTH - 1;
localparam RG = RANGE_ADDR_WIDTH;
localparam REAL_ADDRESS_RANGE = OPTIMIZED_ADDR_H - PKT_ADDR_L;
reg [PKT_DEST_ID_W-1 : 0] destid;
// -------------------------------------------------------
// Pass almost everything through, untouched
// -------------------------------------------------------
assign sink_ready = src_ready;
assign src_valid = sink_valid;
assign src_startofpacket = sink_startofpacket;
assign src_endofpacket = sink_endofpacket;
wire [2-1 : 0] default_src_channel;
// -------------------------------------------------------
// Write and read transaction signals
// -------------------------------------------------------
wire read_transaction;
assign read_transaction = sink_data[PKT_TRANS_READ];
alt_xcvr_reconfig_cpu_mm_interconnect_0_router_002_default_decode the_default_decode(
.default_destination_id (),
.default_wr_channel (),
.default_rd_channel (),
.default_src_channel (default_src_channel)
);
always @* begin
src_data = sink_data;
src_channel = default_src_channel;
// --------------------------------------------------
// DestinationID Decoder
// Sets the channel based on the destination ID.
// --------------------------------------------------
destid = sink_data[PKT_DEST_ID_H : PKT_DEST_ID_L];
if (destid == 0 ) begin
src_channel = 2'b01;
end
if (destid == 1 && read_transaction) begin
src_channel = 2'b10;
end
end
// --------------------------------------------------
// Ceil(log2()) function
// --------------------------------------------------
function integer log2ceil;
input reg[65:0] val;
reg [65:0] i;
begin
i = 1;
log2ceil = 0;
while (i < val) begin
log2ceil = log2ceil + 1;
i = i << 1;
end
end
endfunction
endmodule

View file

@ -0,0 +1,215 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
// Your use of Altera Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Altera Program License Subscription
// Agreement, Altera MegaCore Function License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Altera and sold by
// Altera or its authorized distributors. Please refer to the applicable
// agreement for further details.
// $Id: //acds/rel/18.1std/ip/merlin/altera_merlin_router/altera_merlin_router.sv.terp#1 $
// $Revision: #1 $
// $Date: 2018/07/18 $
// $Author: psgswbuild $
// -------------------------------------------------------
// Merlin Router
//
// Asserts the appropriate one-hot encoded channel based on
// either (a) the address or (b) the dest id. The DECODER_TYPE
// parameter controls this behaviour. 0 means address decoder,
// 1 means dest id decoder.
//
// In the case of (a), it also sets the destination id.
// -------------------------------------------------------
`timescale 1 ns / 1 ns
module alt_xcvr_reconfig_cpu_mm_interconnect_0_router_003_default_decode
#(
parameter DEFAULT_CHANNEL = 0,
DEFAULT_WR_CHANNEL = -1,
DEFAULT_RD_CHANNEL = -1,
DEFAULT_DESTID = 0
)
(output [72 - 72 : 0] default_destination_id,
output [2-1 : 0] default_wr_channel,
output [2-1 : 0] default_rd_channel,
output [2-1 : 0] default_src_channel
);
assign default_destination_id =
DEFAULT_DESTID[72 - 72 : 0];
generate
if (DEFAULT_CHANNEL == -1) begin : no_default_channel_assignment
assign default_src_channel = '0;
end
else begin : default_channel_assignment
assign default_src_channel = 2'b1 << DEFAULT_CHANNEL;
end
endgenerate
generate
if (DEFAULT_RD_CHANNEL == -1) begin : no_default_rw_channel_assignment
assign default_wr_channel = '0;
assign default_rd_channel = '0;
end
else begin : default_rw_channel_assignment
assign default_wr_channel = 2'b1 << DEFAULT_WR_CHANNEL;
assign default_rd_channel = 2'b1 << DEFAULT_RD_CHANNEL;
end
endgenerate
endmodule
module alt_xcvr_reconfig_cpu_mm_interconnect_0_router_003
(
// -------------------
// Clock & Reset
// -------------------
input clk,
input reset,
// -------------------
// Command Sink (Input)
// -------------------
input sink_valid,
input [86-1 : 0] sink_data,
input sink_startofpacket,
input sink_endofpacket,
output sink_ready,
// -------------------
// Command Source (Output)
// -------------------
output src_valid,
output reg [86-1 : 0] src_data,
output reg [2-1 : 0] src_channel,
output src_startofpacket,
output src_endofpacket,
input src_ready
);
// -------------------------------------------------------
// Local parameters and variables
// -------------------------------------------------------
localparam PKT_ADDR_H = 49;
localparam PKT_ADDR_L = 36;
localparam PKT_DEST_ID_H = 72;
localparam PKT_DEST_ID_L = 72;
localparam PKT_PROTECTION_H = 76;
localparam PKT_PROTECTION_L = 74;
localparam ST_DATA_W = 86;
localparam ST_CHANNEL_W = 2;
localparam DECODER_TYPE = 1;
localparam PKT_TRANS_WRITE = 52;
localparam PKT_TRANS_READ = 53;
localparam PKT_ADDR_W = PKT_ADDR_H-PKT_ADDR_L + 1;
localparam PKT_DEST_ID_W = PKT_DEST_ID_H-PKT_DEST_ID_L + 1;
// -------------------------------------------------------
// Figure out the number of bits to mask off for each slave span
// during address decoding
// -------------------------------------------------------
// -------------------------------------------------------
// Work out which address bits are significant based on the
// address range of the slaves. If the required width is too
// large or too small, we use the address field width instead.
// -------------------------------------------------------
localparam ADDR_RANGE = 64'h0;
localparam RANGE_ADDR_WIDTH = log2ceil(ADDR_RANGE);
localparam OPTIMIZED_ADDR_H = (RANGE_ADDR_WIDTH > PKT_ADDR_W) ||
(RANGE_ADDR_WIDTH == 0) ?
PKT_ADDR_H :
PKT_ADDR_L + RANGE_ADDR_WIDTH - 1;
localparam RG = RANGE_ADDR_WIDTH;
localparam REAL_ADDRESS_RANGE = OPTIMIZED_ADDR_H - PKT_ADDR_L;
reg [PKT_DEST_ID_W-1 : 0] destid;
// -------------------------------------------------------
// Pass almost everything through, untouched
// -------------------------------------------------------
assign sink_ready = src_ready;
assign src_valid = sink_valid;
assign src_startofpacket = sink_startofpacket;
assign src_endofpacket = sink_endofpacket;
wire [2-1 : 0] default_src_channel;
alt_xcvr_reconfig_cpu_mm_interconnect_0_router_003_default_decode the_default_decode(
.default_destination_id (),
.default_wr_channel (),
.default_rd_channel (),
.default_src_channel (default_src_channel)
);
always @* begin
src_data = sink_data;
src_channel = default_src_channel;
// --------------------------------------------------
// DestinationID Decoder
// Sets the channel based on the destination ID.
// --------------------------------------------------
destid = sink_data[PKT_DEST_ID_H : PKT_DEST_ID_L];
if (destid == 0 ) begin
src_channel = 2'b1;
end
end
// --------------------------------------------------
// Ceil(log2()) function
// --------------------------------------------------
function integer log2ceil;
input reg[65:0] val;
reg [65:0] i;
begin
i = 1;
log2ceil = 0;
while (i < val) begin
log2ceil = log2ceil + 1;
i = i << 1;
end
end
endfunction
endmodule

View file

@ -0,0 +1,345 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
// (C) 2001-2014 Altera Corporation. All rights reserved.
// Your use of Altera Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Altera Program License Subscription
// Agreement, Altera MegaCore Function License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Altera and sold by
// Altera or its authorized distributors. Please refer to the applicable
// agreement for further details.
// $Id: //acds/rel/18.1std/ip/merlin/altera_merlin_multiplexer/altera_merlin_multiplexer.sv.terp#1 $
// $Revision: #1 $
// $Date: 2018/07/18 $
// $Author: psgswbuild $
// ------------------------------------------
// Merlin Multiplexer
// ------------------------------------------
`timescale 1 ns / 1 ns
// ------------------------------------------
// Generation parameters:
// output_name: alt_xcvr_reconfig_cpu_mm_interconnect_0_rsp_mux
// NUM_INPUTS: 2
// ARBITRATION_SHARES: 1 1
// ARBITRATION_SCHEME "no-arb"
// PIPELINE_ARB: 0
// PKT_TRANS_LOCK: 54 (arbitration locking enabled)
// ST_DATA_W: 86
// ST_CHANNEL_W: 2
// ------------------------------------------
module alt_xcvr_reconfig_cpu_mm_interconnect_0_rsp_mux
(
// ----------------------
// Sinks
// ----------------------
input sink0_valid,
input [86-1 : 0] sink0_data,
input [2-1: 0] sink0_channel,
input sink0_startofpacket,
input sink0_endofpacket,
output sink0_ready,
input sink1_valid,
input [86-1 : 0] sink1_data,
input [2-1: 0] sink1_channel,
input sink1_startofpacket,
input sink1_endofpacket,
output sink1_ready,
// ----------------------
// Source
// ----------------------
output src_valid,
output [86-1 : 0] src_data,
output [2-1 : 0] src_channel,
output src_startofpacket,
output src_endofpacket,
input src_ready,
// ----------------------
// Clock & Reset
// ----------------------
input clk,
input reset
);
localparam PAYLOAD_W = 86 + 2 + 2;
localparam NUM_INPUTS = 2;
localparam SHARE_COUNTER_W = 1;
localparam PIPELINE_ARB = 0;
localparam ST_DATA_W = 86;
localparam ST_CHANNEL_W = 2;
localparam PKT_TRANS_LOCK = 54;
// ------------------------------------------
// Signals
// ------------------------------------------
wire [NUM_INPUTS - 1 : 0] request;
wire [NUM_INPUTS - 1 : 0] valid;
wire [NUM_INPUTS - 1 : 0] grant;
wire [NUM_INPUTS - 1 : 0] next_grant;
reg [NUM_INPUTS - 1 : 0] saved_grant;
reg [PAYLOAD_W - 1 : 0] src_payload;
wire last_cycle;
reg packet_in_progress;
reg update_grant;
wire [PAYLOAD_W - 1 : 0] sink0_payload;
wire [PAYLOAD_W - 1 : 0] sink1_payload;
assign valid[0] = sink0_valid;
assign valid[1] = sink1_valid;
// ------------------------------------------
// ------------------------------------------
// Grant Logic & Updates
// ------------------------------------------
// ------------------------------------------
reg [NUM_INPUTS - 1 : 0] lock;
always @* begin
lock[0] = sink0_data[54];
lock[1] = sink1_data[54];
end
assign last_cycle = src_valid & src_ready & src_endofpacket & ~(|(lock & grant));
// ------------------------------------------
// We're working on a packet at any time valid is high, except
// when this is the endofpacket.
// ------------------------------------------
always @(posedge clk or posedge reset) begin
if (reset) begin
packet_in_progress <= 1'b0;
end
else begin
if (last_cycle)
packet_in_progress <= 1'b0;
else if (src_valid)
packet_in_progress <= 1'b1;
end
end
// ------------------------------------------
// Shares
//
// Special case: all-equal shares _should_ be optimized into assigning a
// constant to next_grant_share.
// Special case: all-1's shares _should_ result in the share counter
// being optimized away.
// ------------------------------------------
// Input | arb shares | counter load value
// 0 | 1 | 0
// 1 | 1 | 0
wire [SHARE_COUNTER_W - 1 : 0] share_0 = 1'd0;
wire [SHARE_COUNTER_W - 1 : 0] share_1 = 1'd0;
// ------------------------------------------
// Choose the share value corresponding to the grant.
// ------------------------------------------
reg [SHARE_COUNTER_W - 1 : 0] next_grant_share;
always @* begin
next_grant_share =
share_0 & { SHARE_COUNTER_W {next_grant[0]} } |
share_1 & { SHARE_COUNTER_W {next_grant[1]} };
end
// ------------------------------------------
// Flag to indicate first packet of an arb sequence.
// ------------------------------------------
wire grant_changed = ~packet_in_progress && ~(|(saved_grant & valid));
reg first_packet_r;
wire first_packet = grant_changed | first_packet_r;
always @(posedge clk or posedge reset) begin
if (reset) begin
first_packet_r <= 1'b0;
end
else begin
if (update_grant)
first_packet_r <= 1'b1;
else if (last_cycle)
first_packet_r <= 1'b0;
else if (grant_changed)
first_packet_r <= 1'b1;
end
end
// ------------------------------------------
// Compute the next share-count value.
// ------------------------------------------
reg [SHARE_COUNTER_W - 1 : 0] p1_share_count;
reg [SHARE_COUNTER_W - 1 : 0] share_count;
reg share_count_zero_flag;
always @* begin
if (first_packet) begin
p1_share_count = next_grant_share;
end
else begin
// Update the counter, but don't decrement below 0.
p1_share_count = share_count_zero_flag ? '0 : share_count - 1'b1;
end
end
// ------------------------------------------
// Update the share counter and share-counter=zero flag.
// ------------------------------------------
always @(posedge clk or posedge reset) begin
if (reset) begin
share_count <= '0;
share_count_zero_flag <= 1'b1;
end
else begin
if (last_cycle) begin
share_count <= p1_share_count;
share_count_zero_flag <= (p1_share_count == '0);
end
end
end
// ------------------------------------------
// For each input, maintain a final_packet signal which goes active for the
// last packet of a full-share packet sequence. Example: if I have 4
// shares and I'm continuously requesting, final_packet is active in the
// 4th packet.
// ------------------------------------------
wire final_packet_0 = 1'b1;
wire final_packet_1 = 1'b1;
// ------------------------------------------
// Concatenate all final_packet signals (wire or reg) into a handy vector.
// ------------------------------------------
wire [NUM_INPUTS - 1 : 0] final_packet = {
final_packet_1,
final_packet_0
};
// ------------------------------------------
// ------------------------------------------
wire p1_done = |(final_packet & grant);
// ------------------------------------------
// Flag for the first cycle of packets within an
// arb sequence
// ------------------------------------------
reg first_cycle;
always @(posedge clk, posedge reset) begin
if (reset)
first_cycle <= 0;
else
first_cycle <= last_cycle && ~p1_done;
end
always @* begin
update_grant = 0;
// ------------------------------------------
// No arbitration pipeline, update grant whenever
// the current arb winner has consumed all shares,
// or all requests are low
// ------------------------------------------
update_grant = (last_cycle && p1_done) || (first_cycle && ~(|valid));
update_grant = last_cycle;
end
wire save_grant;
assign save_grant = 1;
assign grant = next_grant;
always @(posedge clk, posedge reset) begin
if (reset)
saved_grant <= '0;
else if (save_grant)
saved_grant <= next_grant;
end
// ------------------------------------------
// ------------------------------------------
// Arbitrator
// ------------------------------------------
// ------------------------------------------
// ------------------------------------------
// Create a request vector that stays high during
// the packet for unpipelined arbitration.
//
// The pipelined arbitration scheme does not require
// request to be held high during the packet.
// ------------------------------------------
assign request = valid;
wire [NUM_INPUTS - 1 : 0] next_grant_from_arb;
altera_merlin_arbitrator
#(
.NUM_REQUESTERS(NUM_INPUTS),
.SCHEME ("no-arb"),
.PIPELINE (0)
) arb (
.clk (clk),
.reset (reset),
.request (request),
.grant (next_grant_from_arb),
.save_top_priority (src_valid),
.increment_top_priority (update_grant)
);
assign next_grant = next_grant_from_arb;
// ------------------------------------------
// ------------------------------------------
// Mux
//
// Implemented as a sum of products.
// ------------------------------------------
// ------------------------------------------
assign sink0_ready = src_ready && grant[0];
assign sink1_ready = src_ready && grant[1];
assign src_valid = |(grant & valid);
always @* begin
src_payload =
sink0_payload & {PAYLOAD_W {grant[0]} } |
sink1_payload & {PAYLOAD_W {grant[1]} };
end
// ------------------------------------------
// Mux Payload Mapping
// ------------------------------------------
assign sink0_payload = {sink0_channel,sink0_data,
sink0_startofpacket,sink0_endofpacket};
assign sink1_payload = {sink1_channel,sink1_data,
sink1_startofpacket,sink1_endofpacket};
assign {src_channel,src_data,src_startofpacket,src_endofpacket} = src_payload;
endmodule

View file

@ -0,0 +1,96 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
// (C) 2001-2014 Altera Corporation. All rights reserved.
// Your use of Altera Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Altera Program License Subscription
// Agreement, Altera MegaCore Function License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Altera and sold by
// Altera or its authorized distributors. Please refer to the applicable
// agreement for further details.
// $Id: //acds/rel/18.1std/ip/merlin/altera_merlin_multiplexer/altera_merlin_multiplexer.sv.terp#1 $
// $Revision: #1 $
// $Date: 2018/07/18 $
// $Author: psgswbuild $
// ------------------------------------------
// Merlin Multiplexer
// ------------------------------------------
`timescale 1 ns / 1 ns
// ------------------------------------------
// Generation parameters:
// output_name: alt_xcvr_reconfig_cpu_mm_interconnect_0_rsp_mux_001
// NUM_INPUTS: 1
// ARBITRATION_SHARES: 1
// ARBITRATION_SCHEME "no-arb"
// PIPELINE_ARB: 0
// PKT_TRANS_LOCK: 54 (arbitration locking enabled)
// ST_DATA_W: 86
// ST_CHANNEL_W: 2
// ------------------------------------------
module alt_xcvr_reconfig_cpu_mm_interconnect_0_rsp_mux_001
(
// ----------------------
// Sinks
// ----------------------
input sink0_valid,
input [86-1 : 0] sink0_data,
input [2-1: 0] sink0_channel,
input sink0_startofpacket,
input sink0_endofpacket,
output sink0_ready,
// ----------------------
// Source
// ----------------------
output src_valid,
output [86-1 : 0] src_data,
output [2-1 : 0] src_channel,
output src_startofpacket,
output src_endofpacket,
input src_ready,
// ----------------------
// Clock & Reset
// ----------------------
input clk,
input reset
);
localparam PAYLOAD_W = 86 + 2 + 2;
localparam NUM_INPUTS = 1;
localparam SHARE_COUNTER_W = 1;
localparam PIPELINE_ARB = 0;
localparam ST_DATA_W = 86;
localparam ST_CHANNEL_W = 2;
localparam PKT_TRANS_LOCK = 54;
assign src_valid = sink0_valid;
assign src_data = sink0_data;
assign src_channel = sink0_channel;
assign src_startofpacket = sink0_startofpacket;
assign src_endofpacket = sink0_endofpacket;
assign sink0_ready = src_ready;
endmodule

View file

@ -0,0 +1,130 @@
:020000020000FC
:2000000000400034084008140800683A00000000000000000000000000000000000000005E
:2000080006C00034DEC4001406800034D6A0DA14008000341080DC1400C0003418C12C14C9
:2000100010C00326100000151080010410FFFD3600002C00003FFF06008000341080DB0448
:2000180010800017DEFFFA04200B883A10800B17DFC00515DD000415DCC00315DC800215D1
:20002000DC400115DC0000150102020400FFFFC428803C2E008000341080DA0414800017F3
:2000280091400115000031401080030C1004D0BA00C000440102020410C0042600003140AB
:200030001080008C00FFFF8410002E26008202849080041500C0010490C0051590000315A6
:200038009080041590000515010003849000031500003140050004841080C00C04C004047F
:20004000A009883A0007883A10001E1E0080008490800315000031401023883A10820014E8
:200048009500041510BFFFCC908005159809883A9000031500003140141FFFCC94C004153F
:20005000940005150100004490000315000034C08420001494C004159400051501000044E9
:2000580090000315000034C08C7FFFCC95000415944005159000031501000044000034C099
:200060000007883A1805883ADFC00517DD000417DCC00317DC800217DC400117DC000017D3
:20006800DEC00604F800283ADEFFFD04008000341080DB04DC0000151400001701801004C4
:20007000DFC0021580800217DC4001151186703A18001826008000341080DC04110030175C
:2000780011403317108032171080004C1005003A10000A1E2800081E818004153023883A14
:20008000808006171080100C103FFD26000005801007883A844005151800012600C0800466
:20008800008000341080DC0410C032150080100480800315DFC00217DC400117DC00001792
:20009000DEC00304F800283ADEFFFD04008000341080DB04DC00001514000017DFC002157E
:20009800DC400115808001171080100C103FFD1E0080100480800415808006171080100C72
:2000A000103FFD260023883A00000206000005808C40004480800B178809883A88BFFB365F
:2000A800008010048080051580800315DFC00217DC400117DC000017DEC00304F800283A94
:2000B000DEFFFE04DC000015DFC0011500003300008000341080DB041100001720C00C172A
:2000B8001880004C1005003A1C00100C1000021E1890002C10000226008000442080031505
:2000C0008000012600002480803FFF2600001A80003FFD0600A0003410881004110004156B
:2000C80000C0004410C0031510800517F800283A008000341080DC041004D0BA00E0003450
:2000D00018C8000418800015F800283A20000526213FFFC40080019410BFFFC4103FFE1EA5
:2000D800203FFB1EF800283A800020408000200000000000000000000000000000000000B6
:2000E000000000000000000000000000000000000000000000000000000000000000000000
:2000E8000000000000000000000000000000000000000000000000000000000000000000F8
:2000F0000000000000000000000000000000000000000000000000000000000000000000F0
:2000F8000000000000000000000000000000000000000000000000000000000000000000E8
:200100000000000000000000000000000000000000000000000000000000000000000000DF
:200108000000000000000000000000000000000000000000000000000000000000000000D7
:200110000000000000000000000000000000000000000000000000000000000000000000CF
:200118000000000000000000000000000000000000000000000000000000000000000000C7
:200120000000000000000000000000000000000000000000000000000000000000000000BF
:200128000000000000000000000000000000000000000000000000000000000000000000B7
:200130000000000000000000000000000000000000000000000000000000000000000000AF
:200138000000000000000000000000000000000000000000000000000000000000000000A7
:2001400000000000000000000000000000000000000000000000000000000000000000009F
:20014800000000000000000000000000000000000000000000000000000000000000000097
:2001500000000000000000000000000000000000000000000000000000000000000000008F
:20015800000000000000000000000000000000000000000000000000000000000000000087
:2001600000000000000000000000000000000000000000000000000000000000000000007F
:20016800000000000000000000000000000000000000000000000000000000000000000077
:2001700000000000000000000000000000000000000000000000000000000000000000006F
:20017800000000000000000000000000000000000000000000000000000000000000000067
:2001800000000000000000000000000000000000000000000000000000000000000000005F
:20018800000000000000000000000000000000000000000000000000000000000000000057
:2001900000000000000000000000000000000000000000000000000000000000000000004F
:20019800000000000000000000000000000000000000000000000000000000000000000047
:2001A00000000000000000000000000000000000000000000000000000000000000000003F
:2001A800000000000000000000000000000000000000000000000000000000000000000037
:2001B00000000000000000000000000000000000000000000000000000000000000000002F
:2001B800000000000000000000000000000000000000000000000000000000000000000027
:2001C00000000000000000000000000000000000000000000000000000000000000000001F
:2001C800000000000000000000000000000000000000000000000000000000000000000017
:2001D00000000000000000000000000000000000000000000000000000000000000000000F
:2001D800000000000000000000000000000000000000000000000000000000000000000007
:2001E0000000000000000000000000000000000000000000000000000000000000000000FF
:2001E8000000000000000000000000000000000000000000000000000000000000000000F7
:2001F0000000000000000000000000000000000000000000000000000000000000000000EF
:2001F8000000000000000000000000000000000000000000000000000000000000000000E7
:200200000000000000000000000000000000000000000000000000000000000000000000DE
:200208000000000000000000000000000000000000000000000000000000000000000000D6
:200210000000000000000000000000000000000000000000000000000000000000000000CE
:200218000000000000000000000000000000000000000000000000000000000000000000C6
:200220000000000000000000000000000000000000000000000000000000000000000000BE
:200228000000000000000000000000000000000000000000000000000000000000000000B6
:200230000000000000000000000000000000000000000000000000000000000000000000AE
:200238000000000000000000000000000000000000000000000000000000000000000000A6
:2002400000000000000000000000000000000000000000000000000000000000000000009E
:20024800000000000000000000000000000000000000000000000000000000000000000096
:2002500000000000000000000000000000000000000000000000000000000000000000008E
:20025800000000000000000000000000000000000000000000000000000000000000000086
:2002600000000000000000000000000000000000000000000000000000000000000000007E
:20026800000000000000000000000000000000000000000000000000000000000000000076
:2002700000000000000000000000000000000000000000000000000000000000000000006E
:20027800000000000000000000000000000000000000000000000000000000000000000066
:2002800000000000000000000000000000000000000000000000000000000000000000005E
:20028800000000000000000000000000000000000000000000000000000000000000000056
:2002900000000000000000000000000000000000000000000000000000000000000000004E
:20029800000000000000000000000000000000000000000000000000000000000000000046
:2002A00000000000000000000000000000000000000000000000000000000000000000003E
:2002A800000000000000000000000000000000000000000000000000000000000000000036
:2002B00000000000000000000000000000000000000000000000000000000000000000002E
:2002B800000000000000000000000000000000000000000000000000000000000000000026
:2002C00000000000000000000000000000000000000000000000000000000000000000001E
:2002C800000000000000000000000000000000000000000000000000000000000000000016
:2002D00000000000000000000000000000000000000000000000000000000000000000000E
:2002D800000000000000000000000000000000000000000000000000000000000000000006
:2002E0000000000000000000000000000000000000000000000000000000000000000000FE
:2002E8000000000000000000000000000000000000000000000000000000000000000000F6
:2002F0000000000000000000000000000000000000000000000000000000000000000000EE
:2002F8000000000000000000000000000000000000000000000000000000000000000000E6
:200300000000000000000000000000000000000000000000000000000000000000000000DD
:200308000000000000000000000000000000000000000000000000000000000000000000D5
:200310000000000000000000000000000000000000000000000000000000000000000000CD
:200318000000000000000000000000000000000000000000000000000000000000000000C5
:200320000000000000000000000000000000000000000000000000000000000000000000BD
:200328000000000000000000000000000000000000000000000000000000000000000000B5
:200330000000000000000000000000000000000000000000000000000000000000000000AD
:200338000000000000000000000000000000000000000000000000000000000000000000A5
:2003400000000000000000000000000000000000000000000000000000000000000000009D
:20034800000000000000000000000000000000000000000000000000000000000000000095
:2003500000000000000000000000000000000000000000000000000000000000000000008D
:20035800000000000000000000000000000000000000000000000000000000000000000085
:2003600000000000000000000000000000000000000000000000000000000000000000007D
:20036800000000000000000000000000000000000000000000000000000000000000000075
:2003700000000000000000000000000000000000000000000000000000000000000000006D
:20037800000000000000000000000000000000000000000000000000000000000000000065
:2003800000000000000000000000000000000000000000000000000000000000000000005D
:20038800000000000000000000000000000000000000000000000000000000000000000055
:2003900000000000000000000000000000000000000000000000000000000000000000004D
:20039800000000000000000000000000000000000000000000000000000000000000000045
:2003A00000000000000000000000000000000000000000000000000000000000000000003D
:2003A800000000000000000000000000000000000000000000000000000000000000000035
:2003B00000000000000000000000000000000000000000000000000000000000000000002D
:2003B800000000000000000000000000000000000000000000000000000000000000000025
:2003C00000000000000000000000000000000000000000000000000000000000000000001D
:2003C800000000000000000000000000000000000000000000000000000000000000000015
:2003D00000000000000000000000000000000000000000000000000000000000000000000D
:2003D800000000000000000000000000000000000000000000000000000000000000000005
:2003E0000000000000000000000000000000000000000000000000000000000000000000FD
:2003E8000000000000000000000000000000000000000000000000000000000000000000F5
:2003F0000000000000000000000000000000000000000000000000000000000000000000ED
:2003F8000000000000000000000000000000000000000000000000000000000000000000E5
:00000001FF

View file

@ -0,0 +1,134 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
import altera_xcvr_functions::*;
`timescale 1 ns / 1 ns
//***************************************************************************
// Module: alt_xcvr_reconfig_cpu_ram
//
// Description:
// A simple single clock true dual-port RAM. 32-bit data width with byte enable signals
//
//
module alt_xcvr_reconfig_cpu_ram #(
parameter DEPTH = 4096
) (
input clk,
// Port A
input [clogb2(DEPTH-1)-1:0] a_address,
input a_write,
input [3:0] a_byteenable,
input [31:0] a_writedata,
output reg [31:0] a_readdata,
// clock enable input of alt_sync_ram
input ram_ce,
// Port B
input [clogb2(DEPTH-1)-1:0] b_address,
input b_write,
input [3:0] b_byteenable,
input [31:0] b_writedata,
output reg [31:0] b_readdata
);
altsyncram altsyncram_component (
.clock0 (clk ),
.wren_a (a_write ),
.address_b (b_address ),
.data_b (b_writedata ),
.wren_b (b_write ),
.address_a (a_address ),
.data_a (a_writedata ),
.q_a (a_readdata ),
.q_b (b_readdata ),
.aclr0 (1'b0 ),
.aclr1 (1'b0 ),
.addressstall_a (1'b0 ),
.addressstall_b (1'b0 ),
.byteena_a (a_byteenable ),
.byteena_b (b_byteenable ),
.clock1 (/*unused*/ ),
.clocken0 (ram_ce ),
.clocken1 (1'b1 ),
.clocken2 (1'b1 ),
.clocken3 (1'b1 ),
.eccstatus (/*unused*/ ),
.rden_a (1'b1 ),
.rden_b (1'b1 )
);
defparam
altsyncram_component.address_reg_b = "CLOCK0",
altsyncram_component.byteena_reg_b = "CLOCK0",
altsyncram_component.byte_size = 8,
altsyncram_component.clock_enable_input_a = "NORMAL",
altsyncram_component.clock_enable_input_b = "NORMAL",
altsyncram_component.clock_enable_output_a = "NORMAL",
altsyncram_component.clock_enable_output_b = "NORMAL",
altsyncram_component.indata_reg_b = "CLOCK0",
altsyncram_component.init_file = "alt_xcvr_reconfig_cpu_ram.hex",
altsyncram_component.intended_device_family = "Stratix V",
altsyncram_component.lpm_type = "altsyncram",
altsyncram_component.numwords_a = DEPTH,
altsyncram_component.numwords_b = DEPTH,
altsyncram_component.operation_mode = "BIDIR_DUAL_PORT",
altsyncram_component.outdata_aclr_a = "NONE",
altsyncram_component.outdata_aclr_b = "NONE",
altsyncram_component.outdata_reg_a = "UNREGISTERED",
altsyncram_component.outdata_reg_b = "UNREGISTERED",
altsyncram_component.power_up_uninitialized = "FALSE",
altsyncram_component.read_during_write_mode_mixed_ports = "OLD_DATA",
altsyncram_component.read_during_write_mode_port_a = "NEW_DATA_NO_NBE_READ",
altsyncram_component.read_during_write_mode_port_b = "NEW_DATA_NO_NBE_READ",
altsyncram_component.widthad_a = clogb2(DEPTH-1),
altsyncram_component.widthad_b = clogb2(DEPTH-1),
altsyncram_component.width_a = 32,
altsyncram_component.width_b = 32,
altsyncram_component.width_byteena_a = 4,
altsyncram_component.width_byteena_b = 4,
altsyncram_component.wrcontrol_wraddress_reg_b = "CLOCK0";
/*
//reg [31:0] ram [0:DEPTH-1];
(* ramstyle="no_rw_check" *)
logic [3:0][7:0] ram[0:DEPTH-1];
// Port A
always_ff @(posedge clk) begin
// write
if(a_write) begin
if(a_byteenable[0]) ram[a_address][0] <= a_writedata[ 7: 0];
if(a_byteenable[1]) ram[a_address][1] <= a_writedata[15: 8];
if(a_byteenable[2]) ram[a_address][2] <= a_writedata[23:16];
if(a_byteenable[3]) ram[a_address][3] <= a_writedata[31:24];
end
// read
a_readdata <= ram[a_address];
end
// Port B
always_ff @(posedge clk) begin
// write
if(b_write) begin
if(b_byteenable[0]) ram[b_address][0] <= b_writedata[ 7: 0];
if(b_byteenable[1]) ram[b_address][1] <= b_writedata[15: 8];
if(b_byteenable[2]) ram[b_address][2] <= b_writedata[23:16];
if(b_byteenable[3]) ram[b_address][3] <= b_writedata[31:24];
end
// read
b_readdata <= ram[b_address];
end
*/
endmodule

View file

@ -0,0 +1,42 @@
WIDTH=32;
DEPTH=32;
ADDRESS_RADIX=HEX;
DATA_RADIX=HEX;
CONTENT BEGIN
00 : deadbeef;
01 : deadbeef;
02 : deadbeef;
03 : deadbeef;
04 : deadbeef;
05 : deadbeef;
06 : deadbeef;
07 : deadbeef;
08 : deadbeef;
09 : deadbeef;
0a : deadbeef;
0b : deadbeef;
0c : deadbeef;
0d : deadbeef;
0e : deadbeef;
0f : deadbeef;
10 : deadbeef;
11 : deadbeef;
12 : deadbeef;
13 : deadbeef;
14 : deadbeef;
15 : deadbeef;
16 : deadbeef;
17 : deadbeef;
18 : deadbeef;
19 : deadbeef;
1a : deadbeef;
1b : deadbeef;
1c : deadbeef;
1d : deadbeef;
1e : deadbeef;
1f : deadbeef;
END;

View file

@ -0,0 +1,42 @@
WIDTH=32;
DEPTH=32;
ADDRESS_RADIX=HEX;
DATA_RADIX=HEX;
CONTENT BEGIN
00 : deadbeef;
01 : deadbeef;
02 : deadbeef;
03 : deadbeef;
04 : deadbeef;
05 : deadbeef;
06 : deadbeef;
07 : deadbeef;
08 : deadbeef;
09 : deadbeef;
0a : deadbeef;
0b : deadbeef;
0c : deadbeef;
0d : deadbeef;
0e : deadbeef;
0f : deadbeef;
10 : deadbeef;
11 : deadbeef;
12 : deadbeef;
13 : deadbeef;
14 : deadbeef;
15 : deadbeef;
16 : deadbeef;
17 : deadbeef;
18 : deadbeef;
19 : deadbeef;
1a : deadbeef;
1b : deadbeef;
1c : deadbeef;
1d : deadbeef;
1e : deadbeef;
1f : deadbeef;
END;

View file

@ -0,0 +1,656 @@
//Legal Notice: (C)2020 Altera Corporation. All rights reserved. Your
//use of Altera Corporation's design tools, logic functions and other
//software and tools, and its AMPP partner logic functions, and any
//output files any of the foregoing (including device programming or
//simulation files), and any associated documentation or information are
//expressly subject to the terms and conditions of the Altera Program
//License Subscription Agreement or other applicable license agreement,
//including, without limitation, that your use is for the sole purpose
//of programming logic devices manufactured by Altera and sold by Altera
//or its authorized distributors. Please refer to the applicable
//agreement for further details.
// synthesis translate_off
`timescale 1ns / 1ps
// synthesis translate_on
// turn off superfluous verilog processor warnings
// altera message_level Level1
// altera message_off 10034 10035 10036 10037 10230 10240 10030
module alt_xcvr_reconfig_cpu_reconfig_cpu_test_bench (
// inputs:
D_iw,
D_iw_op,
D_iw_opx,
D_valid,
E_valid,
F_pcb,
F_valid,
R_ctrl_ld,
R_ctrl_ld_non_io,
R_dst_regnum,
R_wr_dst_reg,
W_valid,
W_vinst,
W_wr_data,
av_ld_data_aligned_unfiltered,
clk,
d_address,
d_byteenable,
d_read,
d_write,
i_address,
i_read,
i_readdata,
i_waitrequest,
reset_n,
// outputs:
av_ld_data_aligned_filtered,
test_has_ended
)
;
output [ 31: 0] av_ld_data_aligned_filtered;
output test_has_ended;
input [ 31: 0] D_iw;
input [ 5: 0] D_iw_op;
input [ 5: 0] D_iw_opx;
input D_valid;
input E_valid;
input [ 11: 0] F_pcb;
input F_valid;
input R_ctrl_ld;
input R_ctrl_ld_non_io;
input [ 4: 0] R_dst_regnum;
input R_wr_dst_reg;
input W_valid;
input [ 55: 0] W_vinst;
input [ 31: 0] W_wr_data;
input [ 31: 0] av_ld_data_aligned_unfiltered;
input clk;
input [ 13: 0] d_address;
input [ 3: 0] d_byteenable;
input d_read;
input d_write;
input [ 11: 0] i_address;
input i_read;
input [ 31: 0] i_readdata;
input i_waitrequest;
input reset_n;
wire D_op_add;
wire D_op_addi;
wire D_op_and;
wire D_op_andhi;
wire D_op_andi;
wire D_op_beq;
wire D_op_bge;
wire D_op_bgeu;
wire D_op_blt;
wire D_op_bltu;
wire D_op_bne;
wire D_op_br;
wire D_op_break;
wire D_op_bret;
wire D_op_call;
wire D_op_callr;
wire D_op_cmpeq;
wire D_op_cmpeqi;
wire D_op_cmpge;
wire D_op_cmpgei;
wire D_op_cmpgeu;
wire D_op_cmpgeui;
wire D_op_cmplt;
wire D_op_cmplti;
wire D_op_cmpltu;
wire D_op_cmpltui;
wire D_op_cmpne;
wire D_op_cmpnei;
wire D_op_crst;
wire D_op_custom;
wire D_op_div;
wire D_op_divu;
wire D_op_eret;
wire D_op_flushd;
wire D_op_flushda;
wire D_op_flushi;
wire D_op_flushp;
wire D_op_hbreak;
wire D_op_initd;
wire D_op_initda;
wire D_op_initi;
wire D_op_intr;
wire D_op_jmp;
wire D_op_jmpi;
wire D_op_ldb;
wire D_op_ldbio;
wire D_op_ldbu;
wire D_op_ldbuio;
wire D_op_ldh;
wire D_op_ldhio;
wire D_op_ldhu;
wire D_op_ldhuio;
wire D_op_ldl;
wire D_op_ldw;
wire D_op_ldwio;
wire D_op_mul;
wire D_op_muli;
wire D_op_mulxss;
wire D_op_mulxsu;
wire D_op_mulxuu;
wire D_op_nextpc;
wire D_op_nor;
wire D_op_opx;
wire D_op_or;
wire D_op_orhi;
wire D_op_ori;
wire D_op_rdctl;
wire D_op_rdprs;
wire D_op_ret;
wire D_op_rol;
wire D_op_roli;
wire D_op_ror;
wire D_op_rsv02;
wire D_op_rsv09;
wire D_op_rsv10;
wire D_op_rsv17;
wire D_op_rsv18;
wire D_op_rsv25;
wire D_op_rsv26;
wire D_op_rsv33;
wire D_op_rsv34;
wire D_op_rsv41;
wire D_op_rsv42;
wire D_op_rsv49;
wire D_op_rsv57;
wire D_op_rsv61;
wire D_op_rsv62;
wire D_op_rsv63;
wire D_op_rsvx00;
wire D_op_rsvx10;
wire D_op_rsvx15;
wire D_op_rsvx17;
wire D_op_rsvx21;
wire D_op_rsvx25;
wire D_op_rsvx33;
wire D_op_rsvx34;
wire D_op_rsvx35;
wire D_op_rsvx42;
wire D_op_rsvx43;
wire D_op_rsvx44;
wire D_op_rsvx47;
wire D_op_rsvx50;
wire D_op_rsvx51;
wire D_op_rsvx55;
wire D_op_rsvx56;
wire D_op_rsvx60;
wire D_op_rsvx63;
wire D_op_sll;
wire D_op_slli;
wire D_op_sra;
wire D_op_srai;
wire D_op_srl;
wire D_op_srli;
wire D_op_stb;
wire D_op_stbio;
wire D_op_stc;
wire D_op_sth;
wire D_op_sthio;
wire D_op_stw;
wire D_op_stwio;
wire D_op_sub;
wire D_op_sync;
wire D_op_trap;
wire D_op_wrctl;
wire D_op_wrprs;
wire D_op_xor;
wire D_op_xorhi;
wire D_op_xori;
wire [ 31: 0] av_ld_data_aligned_filtered;
wire av_ld_data_aligned_unfiltered_0_is_x;
wire av_ld_data_aligned_unfiltered_10_is_x;
wire av_ld_data_aligned_unfiltered_11_is_x;
wire av_ld_data_aligned_unfiltered_12_is_x;
wire av_ld_data_aligned_unfiltered_13_is_x;
wire av_ld_data_aligned_unfiltered_14_is_x;
wire av_ld_data_aligned_unfiltered_15_is_x;
wire av_ld_data_aligned_unfiltered_16_is_x;
wire av_ld_data_aligned_unfiltered_17_is_x;
wire av_ld_data_aligned_unfiltered_18_is_x;
wire av_ld_data_aligned_unfiltered_19_is_x;
wire av_ld_data_aligned_unfiltered_1_is_x;
wire av_ld_data_aligned_unfiltered_20_is_x;
wire av_ld_data_aligned_unfiltered_21_is_x;
wire av_ld_data_aligned_unfiltered_22_is_x;
wire av_ld_data_aligned_unfiltered_23_is_x;
wire av_ld_data_aligned_unfiltered_24_is_x;
wire av_ld_data_aligned_unfiltered_25_is_x;
wire av_ld_data_aligned_unfiltered_26_is_x;
wire av_ld_data_aligned_unfiltered_27_is_x;
wire av_ld_data_aligned_unfiltered_28_is_x;
wire av_ld_data_aligned_unfiltered_29_is_x;
wire av_ld_data_aligned_unfiltered_2_is_x;
wire av_ld_data_aligned_unfiltered_30_is_x;
wire av_ld_data_aligned_unfiltered_31_is_x;
wire av_ld_data_aligned_unfiltered_3_is_x;
wire av_ld_data_aligned_unfiltered_4_is_x;
wire av_ld_data_aligned_unfiltered_5_is_x;
wire av_ld_data_aligned_unfiltered_6_is_x;
wire av_ld_data_aligned_unfiltered_7_is_x;
wire av_ld_data_aligned_unfiltered_8_is_x;
wire av_ld_data_aligned_unfiltered_9_is_x;
wire test_has_ended;
assign D_op_call = D_iw_op == 0;
assign D_op_jmpi = D_iw_op == 1;
assign D_op_ldbu = D_iw_op == 3;
assign D_op_addi = D_iw_op == 4;
assign D_op_stb = D_iw_op == 5;
assign D_op_br = D_iw_op == 6;
assign D_op_ldb = D_iw_op == 7;
assign D_op_cmpgei = D_iw_op == 8;
assign D_op_ldhu = D_iw_op == 11;
assign D_op_andi = D_iw_op == 12;
assign D_op_sth = D_iw_op == 13;
assign D_op_bge = D_iw_op == 14;
assign D_op_ldh = D_iw_op == 15;
assign D_op_cmplti = D_iw_op == 16;
assign D_op_initda = D_iw_op == 19;
assign D_op_ori = D_iw_op == 20;
assign D_op_stw = D_iw_op == 21;
assign D_op_blt = D_iw_op == 22;
assign D_op_ldw = D_iw_op == 23;
assign D_op_cmpnei = D_iw_op == 24;
assign D_op_flushda = D_iw_op == 27;
assign D_op_xori = D_iw_op == 28;
assign D_op_stc = D_iw_op == 29;
assign D_op_bne = D_iw_op == 30;
assign D_op_ldl = D_iw_op == 31;
assign D_op_cmpeqi = D_iw_op == 32;
assign D_op_ldbuio = D_iw_op == 35;
assign D_op_muli = D_iw_op == 36;
assign D_op_stbio = D_iw_op == 37;
assign D_op_beq = D_iw_op == 38;
assign D_op_ldbio = D_iw_op == 39;
assign D_op_cmpgeui = D_iw_op == 40;
assign D_op_ldhuio = D_iw_op == 43;
assign D_op_andhi = D_iw_op == 44;
assign D_op_sthio = D_iw_op == 45;
assign D_op_bgeu = D_iw_op == 46;
assign D_op_ldhio = D_iw_op == 47;
assign D_op_cmpltui = D_iw_op == 48;
assign D_op_initd = D_iw_op == 51;
assign D_op_orhi = D_iw_op == 52;
assign D_op_stwio = D_iw_op == 53;
assign D_op_bltu = D_iw_op == 54;
assign D_op_ldwio = D_iw_op == 55;
assign D_op_rdprs = D_iw_op == 56;
assign D_op_flushd = D_iw_op == 59;
assign D_op_xorhi = D_iw_op == 60;
assign D_op_rsv02 = D_iw_op == 2;
assign D_op_rsv09 = D_iw_op == 9;
assign D_op_rsv10 = D_iw_op == 10;
assign D_op_rsv17 = D_iw_op == 17;
assign D_op_rsv18 = D_iw_op == 18;
assign D_op_rsv25 = D_iw_op == 25;
assign D_op_rsv26 = D_iw_op == 26;
assign D_op_rsv33 = D_iw_op == 33;
assign D_op_rsv34 = D_iw_op == 34;
assign D_op_rsv41 = D_iw_op == 41;
assign D_op_rsv42 = D_iw_op == 42;
assign D_op_rsv49 = D_iw_op == 49;
assign D_op_rsv57 = D_iw_op == 57;
assign D_op_rsv61 = D_iw_op == 61;
assign D_op_rsv62 = D_iw_op == 62;
assign D_op_rsv63 = D_iw_op == 63;
assign D_op_eret = D_op_opx & (D_iw_opx == 1);
assign D_op_roli = D_op_opx & (D_iw_opx == 2);
assign D_op_rol = D_op_opx & (D_iw_opx == 3);
assign D_op_flushp = D_op_opx & (D_iw_opx == 4);
assign D_op_ret = D_op_opx & (D_iw_opx == 5);
assign D_op_nor = D_op_opx & (D_iw_opx == 6);
assign D_op_mulxuu = D_op_opx & (D_iw_opx == 7);
assign D_op_cmpge = D_op_opx & (D_iw_opx == 8);
assign D_op_bret = D_op_opx & (D_iw_opx == 9);
assign D_op_ror = D_op_opx & (D_iw_opx == 11);
assign D_op_flushi = D_op_opx & (D_iw_opx == 12);
assign D_op_jmp = D_op_opx & (D_iw_opx == 13);
assign D_op_and = D_op_opx & (D_iw_opx == 14);
assign D_op_cmplt = D_op_opx & (D_iw_opx == 16);
assign D_op_slli = D_op_opx & (D_iw_opx == 18);
assign D_op_sll = D_op_opx & (D_iw_opx == 19);
assign D_op_wrprs = D_op_opx & (D_iw_opx == 20);
assign D_op_or = D_op_opx & (D_iw_opx == 22);
assign D_op_mulxsu = D_op_opx & (D_iw_opx == 23);
assign D_op_cmpne = D_op_opx & (D_iw_opx == 24);
assign D_op_srli = D_op_opx & (D_iw_opx == 26);
assign D_op_srl = D_op_opx & (D_iw_opx == 27);
assign D_op_nextpc = D_op_opx & (D_iw_opx == 28);
assign D_op_callr = D_op_opx & (D_iw_opx == 29);
assign D_op_xor = D_op_opx & (D_iw_opx == 30);
assign D_op_mulxss = D_op_opx & (D_iw_opx == 31);
assign D_op_cmpeq = D_op_opx & (D_iw_opx == 32);
assign D_op_divu = D_op_opx & (D_iw_opx == 36);
assign D_op_div = D_op_opx & (D_iw_opx == 37);
assign D_op_rdctl = D_op_opx & (D_iw_opx == 38);
assign D_op_mul = D_op_opx & (D_iw_opx == 39);
assign D_op_cmpgeu = D_op_opx & (D_iw_opx == 40);
assign D_op_initi = D_op_opx & (D_iw_opx == 41);
assign D_op_trap = D_op_opx & (D_iw_opx == 45);
assign D_op_wrctl = D_op_opx & (D_iw_opx == 46);
assign D_op_cmpltu = D_op_opx & (D_iw_opx == 48);
assign D_op_add = D_op_opx & (D_iw_opx == 49);
assign D_op_break = D_op_opx & (D_iw_opx == 52);
assign D_op_hbreak = D_op_opx & (D_iw_opx == 53);
assign D_op_sync = D_op_opx & (D_iw_opx == 54);
assign D_op_sub = D_op_opx & (D_iw_opx == 57);
assign D_op_srai = D_op_opx & (D_iw_opx == 58);
assign D_op_sra = D_op_opx & (D_iw_opx == 59);
assign D_op_intr = D_op_opx & (D_iw_opx == 61);
assign D_op_crst = D_op_opx & (D_iw_opx == 62);
assign D_op_rsvx00 = D_op_opx & (D_iw_opx == 0);
assign D_op_rsvx10 = D_op_opx & (D_iw_opx == 10);
assign D_op_rsvx15 = D_op_opx & (D_iw_opx == 15);
assign D_op_rsvx17 = D_op_opx & (D_iw_opx == 17);
assign D_op_rsvx21 = D_op_opx & (D_iw_opx == 21);
assign D_op_rsvx25 = D_op_opx & (D_iw_opx == 25);
assign D_op_rsvx33 = D_op_opx & (D_iw_opx == 33);
assign D_op_rsvx34 = D_op_opx & (D_iw_opx == 34);
assign D_op_rsvx35 = D_op_opx & (D_iw_opx == 35);
assign D_op_rsvx42 = D_op_opx & (D_iw_opx == 42);
assign D_op_rsvx43 = D_op_opx & (D_iw_opx == 43);
assign D_op_rsvx44 = D_op_opx & (D_iw_opx == 44);
assign D_op_rsvx47 = D_op_opx & (D_iw_opx == 47);
assign D_op_rsvx50 = D_op_opx & (D_iw_opx == 50);
assign D_op_rsvx51 = D_op_opx & (D_iw_opx == 51);
assign D_op_rsvx55 = D_op_opx & (D_iw_opx == 55);
assign D_op_rsvx56 = D_op_opx & (D_iw_opx == 56);
assign D_op_rsvx60 = D_op_opx & (D_iw_opx == 60);
assign D_op_rsvx63 = D_op_opx & (D_iw_opx == 63);
assign D_op_opx = D_iw_op == 58;
assign D_op_custom = D_iw_op == 50;
assign test_has_ended = 1'b0;
//synthesis translate_off
//////////////// SIMULATION-ONLY CONTENTS
//Clearing 'X' data bits
assign av_ld_data_aligned_unfiltered_0_is_x = ^(av_ld_data_aligned_unfiltered[0]) === 1'bx;
assign av_ld_data_aligned_filtered[0] = (av_ld_data_aligned_unfiltered_0_is_x & (R_ctrl_ld_non_io)) ? 1'b0 : av_ld_data_aligned_unfiltered[0];
assign av_ld_data_aligned_unfiltered_1_is_x = ^(av_ld_data_aligned_unfiltered[1]) === 1'bx;
assign av_ld_data_aligned_filtered[1] = (av_ld_data_aligned_unfiltered_1_is_x & (R_ctrl_ld_non_io)) ? 1'b0 : av_ld_data_aligned_unfiltered[1];
assign av_ld_data_aligned_unfiltered_2_is_x = ^(av_ld_data_aligned_unfiltered[2]) === 1'bx;
assign av_ld_data_aligned_filtered[2] = (av_ld_data_aligned_unfiltered_2_is_x & (R_ctrl_ld_non_io)) ? 1'b0 : av_ld_data_aligned_unfiltered[2];
assign av_ld_data_aligned_unfiltered_3_is_x = ^(av_ld_data_aligned_unfiltered[3]) === 1'bx;
assign av_ld_data_aligned_filtered[3] = (av_ld_data_aligned_unfiltered_3_is_x & (R_ctrl_ld_non_io)) ? 1'b0 : av_ld_data_aligned_unfiltered[3];
assign av_ld_data_aligned_unfiltered_4_is_x = ^(av_ld_data_aligned_unfiltered[4]) === 1'bx;
assign av_ld_data_aligned_filtered[4] = (av_ld_data_aligned_unfiltered_4_is_x & (R_ctrl_ld_non_io)) ? 1'b0 : av_ld_data_aligned_unfiltered[4];
assign av_ld_data_aligned_unfiltered_5_is_x = ^(av_ld_data_aligned_unfiltered[5]) === 1'bx;
assign av_ld_data_aligned_filtered[5] = (av_ld_data_aligned_unfiltered_5_is_x & (R_ctrl_ld_non_io)) ? 1'b0 : av_ld_data_aligned_unfiltered[5];
assign av_ld_data_aligned_unfiltered_6_is_x = ^(av_ld_data_aligned_unfiltered[6]) === 1'bx;
assign av_ld_data_aligned_filtered[6] = (av_ld_data_aligned_unfiltered_6_is_x & (R_ctrl_ld_non_io)) ? 1'b0 : av_ld_data_aligned_unfiltered[6];
assign av_ld_data_aligned_unfiltered_7_is_x = ^(av_ld_data_aligned_unfiltered[7]) === 1'bx;
assign av_ld_data_aligned_filtered[7] = (av_ld_data_aligned_unfiltered_7_is_x & (R_ctrl_ld_non_io)) ? 1'b0 : av_ld_data_aligned_unfiltered[7];
assign av_ld_data_aligned_unfiltered_8_is_x = ^(av_ld_data_aligned_unfiltered[8]) === 1'bx;
assign av_ld_data_aligned_filtered[8] = (av_ld_data_aligned_unfiltered_8_is_x & (R_ctrl_ld_non_io)) ? 1'b0 : av_ld_data_aligned_unfiltered[8];
assign av_ld_data_aligned_unfiltered_9_is_x = ^(av_ld_data_aligned_unfiltered[9]) === 1'bx;
assign av_ld_data_aligned_filtered[9] = (av_ld_data_aligned_unfiltered_9_is_x & (R_ctrl_ld_non_io)) ? 1'b0 : av_ld_data_aligned_unfiltered[9];
assign av_ld_data_aligned_unfiltered_10_is_x = ^(av_ld_data_aligned_unfiltered[10]) === 1'bx;
assign av_ld_data_aligned_filtered[10] = (av_ld_data_aligned_unfiltered_10_is_x & (R_ctrl_ld_non_io)) ? 1'b0 : av_ld_data_aligned_unfiltered[10];
assign av_ld_data_aligned_unfiltered_11_is_x = ^(av_ld_data_aligned_unfiltered[11]) === 1'bx;
assign av_ld_data_aligned_filtered[11] = (av_ld_data_aligned_unfiltered_11_is_x & (R_ctrl_ld_non_io)) ? 1'b0 : av_ld_data_aligned_unfiltered[11];
assign av_ld_data_aligned_unfiltered_12_is_x = ^(av_ld_data_aligned_unfiltered[12]) === 1'bx;
assign av_ld_data_aligned_filtered[12] = (av_ld_data_aligned_unfiltered_12_is_x & (R_ctrl_ld_non_io)) ? 1'b0 : av_ld_data_aligned_unfiltered[12];
assign av_ld_data_aligned_unfiltered_13_is_x = ^(av_ld_data_aligned_unfiltered[13]) === 1'bx;
assign av_ld_data_aligned_filtered[13] = (av_ld_data_aligned_unfiltered_13_is_x & (R_ctrl_ld_non_io)) ? 1'b0 : av_ld_data_aligned_unfiltered[13];
assign av_ld_data_aligned_unfiltered_14_is_x = ^(av_ld_data_aligned_unfiltered[14]) === 1'bx;
assign av_ld_data_aligned_filtered[14] = (av_ld_data_aligned_unfiltered_14_is_x & (R_ctrl_ld_non_io)) ? 1'b0 : av_ld_data_aligned_unfiltered[14];
assign av_ld_data_aligned_unfiltered_15_is_x = ^(av_ld_data_aligned_unfiltered[15]) === 1'bx;
assign av_ld_data_aligned_filtered[15] = (av_ld_data_aligned_unfiltered_15_is_x & (R_ctrl_ld_non_io)) ? 1'b0 : av_ld_data_aligned_unfiltered[15];
assign av_ld_data_aligned_unfiltered_16_is_x = ^(av_ld_data_aligned_unfiltered[16]) === 1'bx;
assign av_ld_data_aligned_filtered[16] = (av_ld_data_aligned_unfiltered_16_is_x & (R_ctrl_ld_non_io)) ? 1'b0 : av_ld_data_aligned_unfiltered[16];
assign av_ld_data_aligned_unfiltered_17_is_x = ^(av_ld_data_aligned_unfiltered[17]) === 1'bx;
assign av_ld_data_aligned_filtered[17] = (av_ld_data_aligned_unfiltered_17_is_x & (R_ctrl_ld_non_io)) ? 1'b0 : av_ld_data_aligned_unfiltered[17];
assign av_ld_data_aligned_unfiltered_18_is_x = ^(av_ld_data_aligned_unfiltered[18]) === 1'bx;
assign av_ld_data_aligned_filtered[18] = (av_ld_data_aligned_unfiltered_18_is_x & (R_ctrl_ld_non_io)) ? 1'b0 : av_ld_data_aligned_unfiltered[18];
assign av_ld_data_aligned_unfiltered_19_is_x = ^(av_ld_data_aligned_unfiltered[19]) === 1'bx;
assign av_ld_data_aligned_filtered[19] = (av_ld_data_aligned_unfiltered_19_is_x & (R_ctrl_ld_non_io)) ? 1'b0 : av_ld_data_aligned_unfiltered[19];
assign av_ld_data_aligned_unfiltered_20_is_x = ^(av_ld_data_aligned_unfiltered[20]) === 1'bx;
assign av_ld_data_aligned_filtered[20] = (av_ld_data_aligned_unfiltered_20_is_x & (R_ctrl_ld_non_io)) ? 1'b0 : av_ld_data_aligned_unfiltered[20];
assign av_ld_data_aligned_unfiltered_21_is_x = ^(av_ld_data_aligned_unfiltered[21]) === 1'bx;
assign av_ld_data_aligned_filtered[21] = (av_ld_data_aligned_unfiltered_21_is_x & (R_ctrl_ld_non_io)) ? 1'b0 : av_ld_data_aligned_unfiltered[21];
assign av_ld_data_aligned_unfiltered_22_is_x = ^(av_ld_data_aligned_unfiltered[22]) === 1'bx;
assign av_ld_data_aligned_filtered[22] = (av_ld_data_aligned_unfiltered_22_is_x & (R_ctrl_ld_non_io)) ? 1'b0 : av_ld_data_aligned_unfiltered[22];
assign av_ld_data_aligned_unfiltered_23_is_x = ^(av_ld_data_aligned_unfiltered[23]) === 1'bx;
assign av_ld_data_aligned_filtered[23] = (av_ld_data_aligned_unfiltered_23_is_x & (R_ctrl_ld_non_io)) ? 1'b0 : av_ld_data_aligned_unfiltered[23];
assign av_ld_data_aligned_unfiltered_24_is_x = ^(av_ld_data_aligned_unfiltered[24]) === 1'bx;
assign av_ld_data_aligned_filtered[24] = (av_ld_data_aligned_unfiltered_24_is_x & (R_ctrl_ld_non_io)) ? 1'b0 : av_ld_data_aligned_unfiltered[24];
assign av_ld_data_aligned_unfiltered_25_is_x = ^(av_ld_data_aligned_unfiltered[25]) === 1'bx;
assign av_ld_data_aligned_filtered[25] = (av_ld_data_aligned_unfiltered_25_is_x & (R_ctrl_ld_non_io)) ? 1'b0 : av_ld_data_aligned_unfiltered[25];
assign av_ld_data_aligned_unfiltered_26_is_x = ^(av_ld_data_aligned_unfiltered[26]) === 1'bx;
assign av_ld_data_aligned_filtered[26] = (av_ld_data_aligned_unfiltered_26_is_x & (R_ctrl_ld_non_io)) ? 1'b0 : av_ld_data_aligned_unfiltered[26];
assign av_ld_data_aligned_unfiltered_27_is_x = ^(av_ld_data_aligned_unfiltered[27]) === 1'bx;
assign av_ld_data_aligned_filtered[27] = (av_ld_data_aligned_unfiltered_27_is_x & (R_ctrl_ld_non_io)) ? 1'b0 : av_ld_data_aligned_unfiltered[27];
assign av_ld_data_aligned_unfiltered_28_is_x = ^(av_ld_data_aligned_unfiltered[28]) === 1'bx;
assign av_ld_data_aligned_filtered[28] = (av_ld_data_aligned_unfiltered_28_is_x & (R_ctrl_ld_non_io)) ? 1'b0 : av_ld_data_aligned_unfiltered[28];
assign av_ld_data_aligned_unfiltered_29_is_x = ^(av_ld_data_aligned_unfiltered[29]) === 1'bx;
assign av_ld_data_aligned_filtered[29] = (av_ld_data_aligned_unfiltered_29_is_x & (R_ctrl_ld_non_io)) ? 1'b0 : av_ld_data_aligned_unfiltered[29];
assign av_ld_data_aligned_unfiltered_30_is_x = ^(av_ld_data_aligned_unfiltered[30]) === 1'bx;
assign av_ld_data_aligned_filtered[30] = (av_ld_data_aligned_unfiltered_30_is_x & (R_ctrl_ld_non_io)) ? 1'b0 : av_ld_data_aligned_unfiltered[30];
assign av_ld_data_aligned_unfiltered_31_is_x = ^(av_ld_data_aligned_unfiltered[31]) === 1'bx;
assign av_ld_data_aligned_filtered[31] = (av_ld_data_aligned_unfiltered_31_is_x & (R_ctrl_ld_non_io)) ? 1'b0 : av_ld_data_aligned_unfiltered[31];
always @(posedge clk)
begin
if (reset_n)
if (^(F_valid) === 1'bx)
begin
$write("%0d ns: ERROR: alt_xcvr_reconfig_cpu_reconfig_cpu_test_bench/F_valid is 'x'\n", $time);
$stop;
end
end
always @(posedge clk)
begin
if (reset_n)
if (^(D_valid) === 1'bx)
begin
$write("%0d ns: ERROR: alt_xcvr_reconfig_cpu_reconfig_cpu_test_bench/D_valid is 'x'\n", $time);
$stop;
end
end
always @(posedge clk)
begin
if (reset_n)
if (^(E_valid) === 1'bx)
begin
$write("%0d ns: ERROR: alt_xcvr_reconfig_cpu_reconfig_cpu_test_bench/E_valid is 'x'\n", $time);
$stop;
end
end
always @(posedge clk)
begin
if (reset_n)
if (^(W_valid) === 1'bx)
begin
$write("%0d ns: ERROR: alt_xcvr_reconfig_cpu_reconfig_cpu_test_bench/W_valid is 'x'\n", $time);
$stop;
end
end
always @(posedge clk or negedge reset_n)
begin
if (reset_n == 0)
begin
end
else if (W_valid)
if (^(R_wr_dst_reg) === 1'bx)
begin
$write("%0d ns: ERROR: alt_xcvr_reconfig_cpu_reconfig_cpu_test_bench/R_wr_dst_reg is 'x'\n", $time);
$stop;
end
end
always @(posedge clk or negedge reset_n)
begin
if (reset_n == 0)
begin
end
else if (W_valid & R_wr_dst_reg)
if (^(W_wr_data) === 1'bx)
begin
$write("%0d ns: ERROR: alt_xcvr_reconfig_cpu_reconfig_cpu_test_bench/W_wr_data is 'x'\n", $time);
$stop;
end
end
always @(posedge clk or negedge reset_n)
begin
if (reset_n == 0)
begin
end
else if (W_valid & R_wr_dst_reg)
if (^(R_dst_regnum) === 1'bx)
begin
$write("%0d ns: ERROR: alt_xcvr_reconfig_cpu_reconfig_cpu_test_bench/R_dst_regnum is 'x'\n", $time);
$stop;
end
end
always @(posedge clk)
begin
if (reset_n)
if (^(d_write) === 1'bx)
begin
$write("%0d ns: ERROR: alt_xcvr_reconfig_cpu_reconfig_cpu_test_bench/d_write is 'x'\n", $time);
$stop;
end
end
always @(posedge clk or negedge reset_n)
begin
if (reset_n == 0)
begin
end
else if (d_write)
if (^(d_byteenable) === 1'bx)
begin
$write("%0d ns: ERROR: alt_xcvr_reconfig_cpu_reconfig_cpu_test_bench/d_byteenable is 'x'\n", $time);
$stop;
end
end
always @(posedge clk or negedge reset_n)
begin
if (reset_n == 0)
begin
end
else if (d_write | d_read)
if (^(d_address) === 1'bx)
begin
$write("%0d ns: ERROR: alt_xcvr_reconfig_cpu_reconfig_cpu_test_bench/d_address is 'x'\n", $time);
$stop;
end
end
always @(posedge clk)
begin
if (reset_n)
if (^(d_read) === 1'bx)
begin
$write("%0d ns: ERROR: alt_xcvr_reconfig_cpu_reconfig_cpu_test_bench/d_read is 'x'\n", $time);
$stop;
end
end
always @(posedge clk)
begin
if (reset_n)
if (^(i_read) === 1'bx)
begin
$write("%0d ns: ERROR: alt_xcvr_reconfig_cpu_reconfig_cpu_test_bench/i_read is 'x'\n", $time);
$stop;
end
end
always @(posedge clk or negedge reset_n)
begin
if (reset_n == 0)
begin
end
else if (i_read)
if (^(i_address) === 1'bx)
begin
$write("%0d ns: ERROR: alt_xcvr_reconfig_cpu_reconfig_cpu_test_bench/i_address is 'x'\n", $time);
$stop;
end
end
always @(posedge clk or negedge reset_n)
begin
if (reset_n == 0)
begin
end
else if (i_read & ~i_waitrequest)
if (^(i_readdata) === 1'bx)
begin
$write("%0d ns: ERROR: alt_xcvr_reconfig_cpu_reconfig_cpu_test_bench/i_readdata is 'x'\n", $time);
$stop;
end
end
always @(posedge clk or negedge reset_n)
begin
if (reset_n == 0)
begin
end
else if (W_valid & R_ctrl_ld)
if (^(av_ld_data_aligned_unfiltered) === 1'bx)
begin
$write("%0d ns: WARNING: alt_xcvr_reconfig_cpu_reconfig_cpu_test_bench/av_ld_data_aligned_unfiltered is 'x'\n", $time);
end
end
always @(posedge clk or negedge reset_n)
begin
if (reset_n == 0)
begin
end
else if (W_valid & R_wr_dst_reg)
if (^(W_wr_data) === 1'bx)
begin
$write("%0d ns: WARNING: alt_xcvr_reconfig_cpu_reconfig_cpu_test_bench/W_wr_data is 'x'\n", $time);
end
end
//////////////// END SIMULATION-ONLY CONTENTS
//synthesis translate_on
//synthesis read_comments_as_HDL on
//
// assign av_ld_data_aligned_filtered = av_ld_data_aligned_unfiltered;
//
//synthesis read_comments_as_HDL off
endmodule

View file

@ -0,0 +1,135 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
// $Header$
`timescale 1 ns / 1 ps
module alt_xcvr_reconfig_dcd #(
parameter device_family = "Stratix IV",
parameter enable_dcd_power_up = 1,
parameter number_of_reconfig_interfaces = 1
)
(
input wire reconfig_clk,
input wire reset,
input wire hold,
input wire lch_atbout,
//user
input wire [2:0] dcd_address,
input wire [31:0] dcd_writedata,
input wire dcd_write,
input wire dcd_read,
output wire [31:0] dcd_readdata,
output wire dcd_waitrequest,
output wire dcd_done,
// basic
input wire dcd_irq_from_base,
input wire dcd_waitrequest_from_base,
output wire [2:0] dcd_address_base,
output wire [31:0] dcd_writedata_base,
output wire dcd_write_base,
output wire dcd_read_base,
input wire [31:0] dcd_readdata_base,
output wire arb_req,
input wire arb_grant
);
import altera_xcvr_functions::*;
localparam is_s4 = has_s4_style_hssi(device_family);
localparam is_s5 = has_s5_style_hssi(device_family);
localparam is_a5 = has_a5_style_hssi(device_family);
localparam is_c5 = has_c5_style_hssi(device_family);
generate
// // if (is_s5)
// if (0) // disable DCD pending algorithm modification
// begin
// alt_xcvr_reconfig_dcd_sv #(
// .number_of_reconfig_interfaces(number_of_reconfig_interfaces)
// )
// inst_alt_xcvr_reconfig_dcd_sv (
// .reconfig_clk (reconfig_clk),
// .reset (reset),
// .hold (hold),
//
// .dcd_address (dcd_address),
// .dcd_writedata (dcd_writedata),
// .dcd_write (dcd_write),
// .dcd_read (dcd_read),
// .dcd_readdata (dcd_readdata),
// .dcd_waitrequest (dcd_waitrequest),
// .dcd_irq (dcd_done),
//
// .dcd_irq_from_base (dcd_irq_from_base),
// .dcd_waitrequest_from_base (dcd_waitrequest_from_base),
// .dcd_address_base (dcd_address_base),
// .dcd_writedata_base (dcd_writedata_base),
// .dcd_write_base (dcd_write_base),
// .dcd_read_base (dcd_read_base),
// .dcd_readdata_base (dcd_readdata_base),
// .arb_req (arb_req),
// .arb_grant (arb_grant)
// );
// end
// else
if (is_a5 || is_c5)
begin
alt_xcvr_reconfig_dcd_av #(
.number_of_reconfig_interfaces(number_of_reconfig_interfaces),
.enable_dcd_power_up(enable_dcd_power_up)
)
inst_alt_xcvr_reconfig_dcd_av (
.reconfig_clk (reconfig_clk),
.reset (reset),
.hold (hold),
.lch_atbout (lch_atbout),
.dcd_address (dcd_address),
.dcd_writedata (dcd_writedata),
.dcd_write (dcd_write),
.dcd_read (dcd_read),
.dcd_readdata (dcd_readdata),
.dcd_waitrequest (dcd_waitrequest),
.dcd_irq (dcd_done),
.dcd_irq_from_base (dcd_irq_from_base),
.dcd_waitrequest_from_base (dcd_waitrequest_from_base),
.dcd_address_base (dcd_address_base),
.dcd_writedata_base (dcd_writedata_base),
.dcd_write_base (dcd_write_base),
.dcd_read_base (dcd_read_base),
.dcd_readdata_base (dcd_readdata_base),
.arb_req (arb_req),
.arb_grant (arb_grant)
);
end
else
begin
assign dcd_readdata = 32'b0;
assign dcd_waitrequest = 1'b0;
assign dcd_done = 1'b1;
assign dcd_address_base = 3'b0;
assign dcd_writedata_base = 32'b0;
assign dcd_write_base = 1'b0;
assign dcd_read_base = 1'b0;
assign arb_req = 1'b0;
end
endgenerate
endmodule

View file

@ -0,0 +1,196 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
// dcd calibration for Arria 5
//
// This module instantiates the user Avalon Bus interface,
// the DCD calibration module and the Basic Block interface code.
// The user interface is for user_busy only.
// $Header$
`timescale 1 ns / 1 ps
module alt_xcvr_reconfig_dcd_av #(
parameter number_of_reconfig_interfaces = 1,
parameter enable_dcd_power_up = 1
)
(
input wire reconfig_clk,
input wire reset,
input wire hold,
input wire lch_atbout,
// avalon MM slave
input wire [2:0] dcd_address,
input wire [31:0] dcd_writedata,
input wire dcd_write,
input wire dcd_read,
output reg [31:0] dcd_readdata,
output reg dcd_waitrequest,
output wire dcd_irq,
// base_reconfig
input wire dcd_irq_from_base,
input wire dcd_waitrequest_from_base,
output wire [2:0] dcd_address_base,
output wire [31:0] dcd_writedata_base,
output wire dcd_write_base,
output wire dcd_read_base,
input wire [31:0] dcd_readdata_base,
output wire arb_req,
input wire arb_grant
);
localparam device_family = "ArriaV";
import alt_xcvr_reconfig_h::*; //alt_xcvr_reconfig/alt_xcvr_reconfig/alt_xcvr_reconfig_h.sv
wire dcd_done;
wire ctrl_go;
wire [2:0] ctrl_opcode;
wire ctrl_lock;
wire [11:0] ctrl_addr;
wire [31:0] ctrl_wdata;
wire [31:0] ctrl_rdata;
wire [9:0] ctrl_chan;
wire [9:0] dcd_logical_address;
wire [9:0] cif_logical_ch_addr;
wire ctrl_chan_err;
wire ctrl_wait;
wire uif_busy;
wire [31:0] uif_writedata;
wire [11:0] uif_addr_offset;
wire uif_mode;
wire [6:0] uif_logical_ch_addr;
wire uif_go;
wire [31:0] uif_readdata;
wire uif_illegal_pch_error;
wire uif_illegal_offset_error;
// user interface
alt_xreconf_uif #(
.RECONFIG_USER_ADDR_WIDTH (3),
.RECONFIG_USER_DATA_WIDTH (32),
.RECONFIG_USER_OFFSET_WIDTH (6)
)
inst_alt_xreconf_uif (
.reconfig_clk (reconfig_clk),
.reset (reset),
// User ports
.user_reconfig_address (dcd_address),
.user_reconfig_writedata (dcd_writedata),
.user_reconfig_write (dcd_write),
.user_reconfig_read (dcd_read),
.user_reconfig_readdata (dcd_readdata),
.user_reconfig_waitrequest (dcd_waitrequest),
.user_reconfig_done (dcd_irq),
// data control signals
.uif_writedata (uif_writedata), //(uif_writedata),
.uif_addr_offset (), //(uif_addr_offset),
.uif_mode (), //(uif_mode),
.uif_logical_ch_addr (dcd_logical_address), //(uif_logical_ch_addr),
.uif_go (), //(uif_go),
.uif_readdata (32'h0000_0000), //(uif_readdata),
.uif_phreaddata (32'h0000_0000), //(ctrl_phread_data),
.uif_illegal_pch_error (1'b0), //(ctrl_illegal_phy_ch),
.uif_illegal_offset_error (1'b0), //(uif_error),
.uif_busy (uif_busy) //(uif_busy)
);
// dcd cal
alt_xcvr_reconfig_dcd_cal_av #(
.NUM_OF_CHANNELS (number_of_reconfig_interfaces),
.enable_dcd_power_up (enable_dcd_power_up)
)
inst_alt_xcvr_reconfig_dcd_cal (
.clk (reconfig_clk),
.reset (reset),
.hold (hold),
.dcd_start (uif_writedata[0]),
.dcd_done (dcd_done),
.lch_atbout (lch_atbout),
// user interface
// .uif_go (uif_go), // start user cycle
// .uif_mode (uif_mode), // transfer type
// .uif_busy (uif_reg_busy), // transfer in process
// .uif_addr (uif_addr_offset), // address offset
// .uif_wdata (uif_writedata[15:0]), // data in
// .uif_rdata (uif_readdata[15:0]), // data out
// .uif_chan_err (ctrl_illegal_phy_ch), // illegal channel
// .uif_addr_err (uif_error), // illegal address
// basic block interface
.ctrl_go (ctrl_go), // start basic block cycle
.ctrl_lock (ctrl_lock), // multicycle lock
.ctrl_wait (ctrl_wait), // transfer in process
.ctrl_chan (ctrl_chan), // channel
.ctrl_chan_err (ctrl_chan_err), // channel error
.ctrl_addr (ctrl_addr), // address
.ctrl_opcode (ctrl_opcode), // 0=read; 1=write;
.ctrl_wdata (ctrl_wdata[15:0]), // data out
.ctrl_rdata (ctrl_rdata[15:0]), // data in
.user_busy (uif_busy)
);
// unused signals
//assign uif_writedata[31:16] = 16'h0000;
assign ctrl_wdata[31:16] = 16'h0000;
assign cif_logical_ch_addr = ((enable_dcd_power_up || dcd_done == 1'b0) && !uif_writedata[0]) ? ctrl_chan : dcd_logical_address ;
// Basic Block interface
alt_xreconf_cif #(
.CIF_RECONFIG_ADDR_WIDTH (3),
.CIF_RECONFIG_DATA_WIDTH (32),
.CIF_OFFSET_ADDR_WIDTH (12),
.CIF_MASTER_ADDR_WIDTH (3),
.CIF_RECONFIG_OFFSET_WIDTH (6)
)
inst_alt_xreconf_cif (
.reconfig_clk (reconfig_clk),
.reset (reset),
// data control signals
.ctrl_go (ctrl_go),
.ctrl_opcode (ctrl_opcode),
.ctrl_lock (ctrl_lock),
.ctrl_addr_offset (ctrl_addr),
.ctrl_writedata (ctrl_wdata),
.uif_logical_ch_addr (cif_logical_ch_addr),
.ctrl_readdata (ctrl_rdata),
.ctrl_phreaddata (),
.ctrl_illegal_phy_ch (ctrl_chan_err),
.ctrl_waitrequest (ctrl_wait),
// basic block ports
.reconfig_address_base (dcd_address_base),
.reconfig_writedata_base (dcd_writedata_base),
.reconfig_write_base (dcd_write_base),
.reconfig_read_base (dcd_read_base),
.reconfig_readdata_base (dcd_readdata_base),
.reconfig_irq_from_base (dcd_irq_from_base),
.reconfig_waitrequest_from_base (dcd_waitrequest_from_base),
.arb_grant (arb_grant),
.arb_req (arb_req)
);
endmodule

View file

@ -0,0 +1,117 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
// DCD calibration
//
// DCD calibration top module.
//
// dcd_control.sv controls calibration
// dcd_pll_reset.sv sequences pll resets
module alt_xcvr_reconfig_dcd_cal_av (
input wire clk,
input wire reset,
input wire hold,
input wire dcd_start,
output wire dcd_done,
input wire lch_atbout,
output wire ctrl_go,
output wire ctrl_lock,
input wire ctrl_wait,
output wire [9:0] ctrl_chan,
input wire ctrl_chan_err,
output wire [11:0] ctrl_addr,
output wire [2:0] ctrl_opcode,
output wire [15:0] ctrl_wdata,
input wire [15:0] ctrl_rdata,
output wire user_busy
);
parameter [6:0] NUM_OF_CHANNELS = 66;
parameter enable_dcd_power_up = 1;
// done state machine
localparam [1:0] STATE_DONE0 = 2'b00;
localparam [1:0] STATE_DONE1 = 2'b01;
localparam [1:0] STATE_DONE2 = 2'b10;
// declarations
wire ctrl_done;
reg [1:0] state_done;
reg [6:0] reset_ff;
wire reset_sync1;
// control
alt_xcvr_reconfig_dcd_control_av #(
.NUM_OF_CHANNELS (NUM_OF_CHANNELS),
.enable_dcd_power_up (enable_dcd_power_up)
)
inst_alt_xcvr_reconfig_dcd_control (
.clk (clk),
.reset (reset_sync1),
.hold (hold),
.dcd_start (dcd_start),
.dcd_done (dcd_done),
.lch_atbout (lch_atbout),
.ctrl_go (ctrl_go),
.ctrl_lock (ctrl_lock),
.ctrl_done (ctrl_done),
.ctrl_chan (ctrl_chan),
.ctrl_chan_err (ctrl_chan_err),
.ctrl_addr (ctrl_addr),
.ctrl_opcode (ctrl_opcode),
.ctrl_wdata (ctrl_wdata),
.ctrl_rdata (ctrl_rdata),
.user_busy (user_busy)
);
// creating CTRL_DONE from CTRL_WAIT
always @(posedge clk)
begin
if (reset_sync1)
state_done <= STATE_DONE0;
else
case (state_done)
// wait for ctrl_go
STATE_DONE0: if (ctrl_go)
state_done <= STATE_DONE1;
// wait ctrl_to negate
STATE_DONE1: if (!ctrl_wait)
state_done <= STATE_DONE2;
// generate ctrl_done for 1 clock period
STATE_DONE2: state_done <= STATE_DONE0;
endcase
end
assign ctrl_done = (state_done == STATE_DONE2);
// synchronize reset
always @(posedge clk or posedge reset)
begin
if (reset)
reset_ff <= 7'h00;
else
reset_ff <= {reset_ff[5:0], 1'b1};
end
assign reset_sync1 = ~reset_ff[6];
endmodule

View file

@ -0,0 +1,661 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
// (C) 2001-2013 Altera Corporation. All rights reserved.
// Your use of Altera Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Altera Program License Subscription
// Agreement, Altera MegaCore Function License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Altera and sold by
// Altera or its authorized distributors. Please refer to the applicable
// agreement for further details.
// DCD implementation
//
// Perform DCD calibration by force serializer output into clock pattern (101010...)
//
// Check the voltage comparator output (from PLL AUX) and sets rser_dc_tune accordingly. Algorithm as below:
//
// 1. Sets reser_dc_tune to default value.
// 2. Check comparator logic level.
// 3. Comparator output = 1, rser_dc_tune[2:0] need to be swept from default value to 000.
// 4. Comparator output = 0, rser_dc_tune[2:0] need to be swept from default value to 111.
// 5. Once the change of comparator output logic state is detected, rser_dc_tune[2:0] should be set to the
// value before the logic state change happen.
// 6. If comparator never change state, sets rser_dc_tune to max/min depending on level of comparator output.
// $Header$
`timescale 1 ns / 1 ps
module alt_xcvr_reconfig_dcd_control_av (
input wire clk,
input wire reset,
input wire hold, // stops after current channel while asserted
input wire dcd_start,
output reg dcd_done,
// comparator output
input wire lch_atbout,
// Basic Block control
output reg ctrl_go,
output reg ctrl_lock,
input wire ctrl_done,
output reg [9:0] ctrl_chan,
input wire ctrl_chan_err,
output reg [11:0] ctrl_addr,
output reg [2:0] ctrl_opcode,
output reg [15:0] ctrl_wdata,
input wire [15:0] ctrl_rdata,
output reg user_busy
);
parameter [6:0] NUM_OF_CHANNELS = 36;
parameter enable_dcd_power_up = 1;
//states
localparam [4:0] STATE_IDLE = 5'h00;
localparam [4:0] STATE_RD_PHY_REQ = 5'h01;
localparam [4:0] STATE_RD_PHY_ID = 5'h02;
localparam [4:0] STATE_RD_PHY_FIN = 5'h12; // (201074)
localparam [4:0] STATE_RD_RSER_CLKMON = 5'h03;
localparam [4:0] STATE_WR_RSER_CLKMON = 5'h04; // Force ser to clock output
localparam [4:0] STATE_RD_RTX_LST = 5'h05;
localparam [4:0] STATE_WR_RTX_LST = 5'h06; // Sets ATB network to LPF mode
localparam [4:0] STATE_RD_DEFAULT_DCTUNE = 5'h07;
localparam [4:0] STATE_RESET_DCTUNE = 5'h08; // Sets rser_dc_tune to default value
localparam [4:0] STATE_RD_CMP_OUT = 5'h09; // Reads voltage comparator output logic level
localparam [4:0] STATE_INC_DCTUNE = 5'h0a;
localparam [4:0] STATE_DEC_DCTUNE = 5'h0b;
localparam [4:0] STATE_RD_CMP_TOGGLE = 5'h0c;
localparam [4:0] STATE_SET_DCTUNE = 5'h0d;
localparam [4:0] STATE_RD_DCTUNE = 5'h0e;
localparam [4:0] STATE_RESET_RSER_CLKMON = 5'h0f;
localparam [4:0] STATE_RESET_RTX_LST = 5'h10;
localparam [4:0] STATE_DONE = 5'h11;
localparam MANUAL_IDLE = 2'b00;
localparam MANUAL_ASSERT = 2'b01;
localparam MANUAL_DEASSERT = 2'b10;
// register addresses
import av_xcvr_h::*;
// register bits values
localparam REQUEST_DCD = 1'b1; // PHY RX present
localparam PHY_TX_ID = 1'b1; // PHY TX present
localparam RSER_CLK_MON_ON = 1'b1;
localparam RTX_LST_ON = 4'b1100;
localparam RTX_LST_OFF = 4'b0000;
localparam DC_TUNE_DEFAULT = 3'b011;
// Commands
localparam [2:0] OPCODE_READ = 3'h0;
localparam [2:0] OPCODE_WRITE = 3'h1;
// waiting time for comparator
localparam MAX_CNT = 11'h4E3;
reg cmp_wait_cnt = 1'b0;
reg cmp_wait_cnt_reg = 1'b0;
reg [10:0] count = {11{1'b0}};
reg cal_done = 1'b0;
wire count_lim;
reg [1:0] hold_ff;
reg [1:0] dcd_start_ff;
wire hold_sync;
wire dcd_start_sync;
reg [5:0] state = 6'b000000;
reg [1:0] manual_state = 2'b00;
wire phy_req;
wire phy_id;
wire ctrl_chan_tc;
reg ctrl_go_ff;
reg [2:0] dc_tune_value;
reg [2:0] dc_tune_inc;
reg [2:0] dc_tune_dec;
reg [2:0] dc_tune_prev;
reg cmp_out_reg;
reg cmp_out_prev;
reg cmp_toggle;
reg dctune_max;
reg dctune_min;
reg [1:0] rdata_done;
reg reset_rser_clkmon;
reg reset_rtx_lst;
reg dcd_start_sync_reg = 1'b0;
assign dcd_done = cal_done;
// synchronize signals
always @(posedge clk)
begin
hold_ff <= {hold_ff[0], hold};
end
assign hold_sync = hold_ff[1];
always @ (posedge clk)
begin
case(manual_state)
MANUAL_IDLE: begin
dcd_start_sync_reg <= 1'b0;
if (dcd_start)
manual_state <= MANUAL_ASSERT;
else
manual_state <= MANUAL_IDLE;
end
MANUAL_ASSERT: begin
dcd_start_sync_reg <= 1'b1;
if (dcd_start)
manual_state <= MANUAL_DEASSERT;
else
manual_state <= MANUAL_IDLE;
end
MANUAL_DEASSERT: begin
dcd_start_sync_reg <= 1'b0;
if (dcd_start)
manual_state <= MANUAL_DEASSERT;
else
manual_state <= MANUAL_IDLE;
end
endcase
end
// State transfer
always @(posedge clk)
begin
if (reset || dcd_start_sync_reg) begin
state <= STATE_IDLE;
ctrl_addr <= 12'h000;
reset_rser_clkmon <= 1'b0;
reset_rtx_lst <= 1'b0;
end
else
case (state)
STATE_IDLE: if (!hold_sync & !cal_done & !dcd_start) begin
if (enable_dcd_power_up)
begin
state <= STATE_RD_PHY_REQ;
ctrl_addr <= AV_XR_ABS_ADDR_REQUEST;
end
else begin
state <= STATE_DONE;
ctrl_addr <= 12'h000;
end
end
else if (!hold_sync & dcd_start) begin
state <= STATE_RD_PHY_REQ;
cal_done <= 1'b0;
ctrl_addr <= AV_XR_ABS_ADDR_REQUEST;
end
// check phy channel and request
STATE_RD_PHY_REQ: if ((ctrl_done && ctrl_chan_tc && ctrl_chan_err) ||
(ctrl_done && ctrl_chan_tc && !phy_req)) begin
// state <= STATE_DONE; // (201074) Reroute to new finish state
state <= STATE_RD_PHY_FIN;
ctrl_addr <= 12'h000;
end
else if ((ctrl_done && !ctrl_chan_tc && ctrl_chan_err) ||
(ctrl_done && !ctrl_chan_tc && !phy_req)) begin
state <= STATE_IDLE;
ctrl_addr <= 12'h000;
end
else if (ctrl_done ) begin
state <= STATE_RD_PHY_ID;
ctrl_addr <= AV_XR_ABS_ADDR_ID;
end
// check phy channel and channel ID
STATE_RD_PHY_ID: if (ctrl_done && ctrl_chan_tc && !phy_id) begin
// state <= STATE_DONE; // (201074) Reroute to new finish state
state <= STATE_RD_PHY_FIN;
ctrl_addr <= 12'h000;
end
else if (ctrl_done && !ctrl_chan_tc && !phy_id) begin
state <= STATE_IDLE;
ctrl_addr <= 12'h000;
end
else if (ctrl_done ) begin
state <= STATE_RD_RSER_CLKMON;
ctrl_addr <= RECONFIG_PMA_CH0_DCD_RSER_CLK_MON;
end
// (201074): added this state to release the channel lock after aborting DCD
STATE_RD_PHY_FIN:
if (ctrl_done) begin
state <= STATE_DONE;
ctrl_addr <= 12'h000;
end
STATE_RD_RSER_CLKMON: if (ctrl_done) begin
ctrl_addr <= RECONFIG_PMA_CH0_DCD_RSER_CLK_MON;
if(!reset_rser_clkmon)
state <= STATE_WR_RSER_CLKMON;
else begin
state <= STATE_RESET_RSER_CLKMON;
reset_rser_clkmon <= 1'b0;
end
end
STATE_WR_RSER_CLKMON: if(ctrl_done) begin
state <= STATE_RD_RTX_LST;
ctrl_addr <= RECONFIG_PMA_CH0_DCD_RTX_LST;
end
STATE_RD_RTX_LST: if(ctrl_done) begin
ctrl_addr <= RECONFIG_PMA_CH0_DCD_RTX_LST;
if (!reset_rtx_lst)
state <= STATE_WR_RTX_LST;
else begin
state <= STATE_RESET_RTX_LST;
reset_rtx_lst <= 1'b0;
end
end
STATE_WR_RTX_LST: if(ctrl_done) begin
state <= STATE_RD_DEFAULT_DCTUNE;
ctrl_addr <= RECONFIG_PMA_CH0_DCD_DC_TUNE;
end
STATE_RD_DEFAULT_DCTUNE: if(ctrl_done) begin
state <= STATE_RESET_DCTUNE;
end
STATE_RESET_DCTUNE: if(ctrl_done) begin
// wait 10us after reset dc tune
if (!(cmp_wait_cnt_reg))
state <= STATE_RESET_DCTUNE;
else
state <= STATE_RD_CMP_OUT;
end
STATE_RD_CMP_OUT: begin
ctrl_addr <= RECONFIG_PMA_CH0_DCD_DC_TUNE;
if (cmp_out_reg && (!(cmp_toggle)))
state <= STATE_DEC_DCTUNE;
else if (!(cmp_toggle))
state <= STATE_INC_DCTUNE;
else
state <= STATE_SET_DCTUNE;
end
STATE_DEC_DCTUNE: if(ctrl_done) begin
state <= STATE_RD_CMP_TOGGLE;
ctrl_addr <= 12'h000;
end
STATE_INC_DCTUNE: if(ctrl_done) begin
state <= STATE_RD_CMP_TOGGLE;
ctrl_addr <= 12'h000;
end
STATE_RD_CMP_TOGGLE: begin
ctrl_addr <= RECONFIG_PMA_CH0_DCD_DC_TUNE;
if (!(cmp_wait_cnt_reg))
state <= STATE_RD_CMP_TOGGLE;
else if (cmp_toggle)
state <= STATE_SET_DCTUNE;
else
state <= STATE_RD_DCTUNE;
end
STATE_RD_DCTUNE: begin
if (rdata_done != 2'b11)
state <= STATE_RD_DCTUNE;
else if (dctune_max || dctune_min) begin
if(ctrl_done)
state <= STATE_SET_DCTUNE;
else
state <= STATE_RD_DCTUNE;
end
else
if(ctrl_done) begin
state <= STATE_RD_CMP_OUT;
ctrl_addr <= 12'h000;
end
else
state <= STATE_RD_DCTUNE;
end
STATE_SET_DCTUNE: if(ctrl_done) begin
state <= STATE_RD_RSER_CLKMON;
ctrl_addr <= RECONFIG_PMA_CH0_DCD_RSER_CLK_MON;
reset_rser_clkmon <= 1'b1;
end
STATE_RESET_RSER_CLKMON: if(ctrl_done) begin
state <= STATE_RD_RTX_LST;
ctrl_addr <= RECONFIG_PMA_CH0_DCD_RTX_LST;
reset_rtx_lst <= 1'b1;
end
STATE_RESET_RTX_LST: if(ctrl_done) begin
state <= STATE_DONE;
ctrl_addr <= 12'h000;
end
// done
STATE_DONE: if(ctrl_chan_tc || cal_done || !enable_dcd_power_up) begin
state <= STATE_DONE;
cal_done <= 1'b1;
end
else
state <= STATE_IDLE;
default: state <= STATE_IDLE;
endcase
end
// PHY_ID
assign phy_req = (ctrl_rdata[AV_XR_REQUEST_DCD_OFST] == REQUEST_DCD);
assign phy_id = (ctrl_rdata[AV_XR_ID_TX_CHANNEL_OFST] == PHY_TX_ID);
// channel counter
always @(posedge clk)
begin
if (reset || dcd_start_sync_reg)
ctrl_chan <= 10'h000;
else if (((state == STATE_RD_PHY_REQ) && ctrl_done && ctrl_chan_err) ||
((state == STATE_RD_PHY_REQ) && ctrl_done && !phy_req && !ctrl_chan_tc) ||
((state == STATE_RD_PHY_ID) && ctrl_done && !phy_id && !ctrl_chan_tc) ||
(state == STATE_RESET_RTX_LST && ctrl_done))
ctrl_chan <= ctrl_chan + 1'b1;
end
assign ctrl_chan_tc = ((enable_dcd_power_up || cal_done == 1'b0) && !dcd_start) ? (ctrl_chan == NUM_OF_CHANNELS -1) : (ctrl_chan == 1) ;
// ctrl_opcode
always @(posedge clk)
begin
case (state)
STATE_IDLE: ctrl_opcode <= 3'h0;
STATE_RD_PHY_REQ: ctrl_opcode <= OPCODE_READ;
STATE_RD_PHY_ID: ctrl_opcode <= OPCODE_READ;
STATE_RD_PHY_FIN: ctrl_opcode <= OPCODE_READ; // (201074) New state to release arbiter lock properly
STATE_RD_RSER_CLKMON: ctrl_opcode <= OPCODE_READ;
STATE_WR_RSER_CLKMON: ctrl_opcode <= OPCODE_WRITE;
STATE_RD_RTX_LST: ctrl_opcode <= OPCODE_READ;
STATE_WR_RTX_LST: ctrl_opcode <= OPCODE_WRITE;
STATE_RD_DEFAULT_DCTUNE: ctrl_opcode <= OPCODE_READ;
STATE_RESET_DCTUNE: ctrl_opcode <= OPCODE_WRITE;
STATE_RD_CMP_OUT: ctrl_opcode <= 3'h0;
STATE_INC_DCTUNE: ctrl_opcode <= OPCODE_WRITE;
STATE_DEC_DCTUNE: ctrl_opcode <= OPCODE_WRITE;
STATE_RD_CMP_TOGGLE: ctrl_opcode <= 3'h0;
STATE_SET_DCTUNE: ctrl_opcode <= OPCODE_WRITE;
STATE_RD_DCTUNE: ctrl_opcode <= OPCODE_READ;
STATE_RESET_RSER_CLKMON: ctrl_opcode <= OPCODE_WRITE;
STATE_RESET_RTX_LST: ctrl_opcode <= OPCODE_WRITE;
STATE_DONE: ctrl_opcode <= 3'h0;
default: ctrl_opcode <= 3'h0;
endcase
end
// ctrl_addr
// always @(posedge clk)
// begin
// case (state)
// STATE_IDLE: ctrl_addr <= 12'h000;
// STATE_RD_PHY_REQ: ctrl_addr <= AV_XR_ABS_ADDR_REQUEST;
// STATE_RD_PHY_ID: ctrl_addr <= AV_XR_ABS_ADDR_ID;
// STATE_WR_RSER_CLKMON: ctrl_addr <= RECONFIG_PMA_CH0_DCD_RSER_CLK_MON;
// STATE_WR_RTX_LST: ctrl_addr <= RECONFIG_PMA_CH0_DCD_RTX_LST;
// STATE_RESET_DCTUNE: ctrl_addr <= RECONFIG_PMA_CH0_DCD_DC_TUNE;
// STATE_RD_CMP_OUT: ctrl_addr <= 12'h000;
// STATE_INC_DCTUNE: ctrl_addr <= RECONFIG_PMA_CH0_DCD_DC_TUNE;
// STATE_DEC_DCTUNE: ctrl_addr <= RECONFIG_PMA_CH0_DCD_DC_TUNE;
// STATE_RD_CMP_TOGGLE: ctrl_addr <= 12'h000;
// STATE_SET_DCTUNE: ctrl_addr <= RECONFIG_PMA_CH0_DCD_DC_TUNE;
// STATE_RD_DCTUNE: ctrl_addr <= RECONFIG_PMA_CH0_DCD_DC_TUNE;
// STATE_RESET_RSER_CLKMON: ctrl_addr <= RECONFIG_PMA_CH0_DCD_RSER_CLK_MON;
// STATE_RESET_RTX_LST: ctrl_addr <= RECONFIG_PMA_CH0_DCD_RTX_LST;
// STATE_DONE: ctrl_addr <= 12'h000;
// default: ctrl_addr <= 12'h000;
// endcase
// end
// ctrl_wdata
always @(posedge clk)
begin
ctrl_wdata <= ctrl_rdata;
case (state)
STATE_WR_RSER_CLKMON : ctrl_wdata[RSER_CLK_MON_OFST]
<= RSER_CLK_MON_ON;
STATE_WR_RTX_LST: begin
//ctrl_wdata <= dcd_rdata;
ctrl_wdata[RTX_LST_3_OFST : RTX_LST_0_OFST]
<= RTX_LST_ON;
end
STATE_RESET_DCTUNE: begin
//ctrl_wdata <= dcd_rdata;
ctrl_wdata[RSER_DC_TUNE_2_OFST : RSER_DC_TUNE_0_OFST]
<= DC_TUNE_DEFAULT;
end
STATE_INC_DCTUNE: ctrl_wdata[RSER_DC_TUNE_2_OFST : RSER_DC_TUNE_0_OFST]
<= dc_tune_inc;
STATE_DEC_DCTUNE: ctrl_wdata[RSER_DC_TUNE_2_OFST : RSER_DC_TUNE_0_OFST]
<= dc_tune_dec;
STATE_SET_DCTUNE: ctrl_wdata[RSER_DC_TUNE_2_OFST : RSER_DC_TUNE_0_OFST]
<= dc_tune_value;
STATE_RESET_RSER_CLKMON: ctrl_wdata[RSER_CLK_MON_OFST]
<= ~RSER_CLK_MON_ON;
STATE_RESET_RTX_LST: ctrl_wdata[RTX_LST_3_OFST : RTX_LST_0_OFST]
<= RTX_LST_OFF;
default: ctrl_wdata <= 16'h0000;
endcase
end
// Read rser_dc_tune value
always @(posedge clk)
begin
if ((state == STATE_IDLE) || (state == STATE_RD_CMP_OUT))
begin
rdata_done <= 2'b00;
dctune_min <= 1'b0;
dctune_max <= 1'b0;
end
if (state == STATE_RD_DCTUNE)
begin
if (dc_tune_value == 3'b000)
begin
dctune_min <= 1'b1;
rdata_done <= 2'b11;
end
else if (dc_tune_value == 3'b111)
begin
dctune_max <= 1'b1;
rdata_done <= 2'b11;
end
else
if (rdata_done != 2'b11)
rdata_done <= rdata_done + 1'b1;
end
end
// read ATB output
assign count_lim = (count == MAX_CNT);
always @(posedge clk)
begin
if (reset || dcd_start_sync_reg) begin
cmp_out_reg <= 1'b0;
cmp_out_prev <= cmp_out_reg;
cmp_toggle <= 1'b0;
end
begin
cmp_out_reg <= lch_atbout;
if (state == STATE_RD_CMP_TOGGLE || state == STATE_RESET_DCTUNE) begin
if (~count_lim) begin
cmp_wait_cnt <= 1'b0;
count <= count + 1'b1;
end
else begin
cmp_wait_cnt <= 1'b1;
end
cmp_wait_cnt_reg <= cmp_wait_cnt;
end
if (state == STATE_RD_CMP_TOGGLE) begin
if (cmp_out_reg != cmp_out_prev)
cmp_toggle <= 1'b1;
end
end
// reset reg when in idle state
if (state == STATE_IDLE)
begin
cmp_toggle <= 1'b0;
end
if (state == STATE_RD_DCTUNE || state == STATE_SET_DCTUNE || state == STATE_RD_CMP_OUT) begin
cmp_wait_cnt <= 1'b0;
cmp_wait_cnt_reg <= 1'b0;
count <= 0;
end
if ((state != STATE_SET_DCTUNE) && (state != STATE_INC_DCTUNE) && (state != STATE_DEC_DCTUNE))
cmp_out_prev <= cmp_out_reg;
end
// set dc_tune value
always @(posedge clk)
begin
if (reset || dcd_start_sync_reg)
dc_tune_value <= DC_TUNE_DEFAULT;
else if (state == STATE_WR_RSER_CLKMON) // Set to default value everytime the algorithm start over
dc_tune_value <= DC_TUNE_DEFAULT;
else if ((state == STATE_SET_DCTUNE) && (cmp_toggle == 1'b1)) // Set to previous value before comparator toggle
dc_tune_value <= dc_tune_prev;
else if (state == STATE_INC_DCTUNE) // Set to previous value before comparator toggle
dc_tune_value <= dc_tune_inc;
else if (state == STATE_DEC_DCTUNE) // Set to previous value before comparator toggle
dc_tune_value <= dc_tune_dec;
else if (state == STATE_RD_DCTUNE && ctrl_done)
dc_tune_value <= ctrl_rdata[RSER_DC_TUNE_2_OFST : RSER_DC_TUNE_0_OFST];
end
// Ready with both up sweeping and down sweeping value for rser_dc_tune
always @(posedge clk)
begin
if (reset || dcd_start_sync_reg) begin
dc_tune_prev <= DC_TUNE_DEFAULT;
dc_tune_inc <= DC_TUNE_DEFAULT;
dc_tune_dec <= DC_TUNE_DEFAULT;
end
else if (state == STATE_RD_CMP_OUT)
begin
if (!(cmp_toggle))
dc_tune_prev <= dc_tune_value;
if (!(dc_tune_value == 3'b111))
dc_tune_inc <= dc_tune_value + 3'b001;
if (!(dc_tune_value == 3'b000))
dc_tune_dec <= dc_tune_value - 3'b001;
end
end
// ctrl_lock
always @(posedge clk or posedge reset)
begin
if (reset)
ctrl_lock <= 1'b0;
else
ctrl_lock <= ~((state == STATE_IDLE) |
// (state == STATE_RD_PHY_REQ) | // (201074) lock should be asserted in an intermediate state
(state == STATE_RD_PHY_FIN) | // (201074) release arbiter lock in this finished state
(state == STATE_RESET_RTX_LST) |
(state == STATE_DONE));
end
// ctrl_go
always @(posedge clk)
begin
if (reset || dcd_start_sync_reg)
begin
ctrl_go_ff <= 1'b0;
end
else
case (state)
STATE_IDLE: ctrl_go_ff <= ~hold_sync;
// (201074) changed to always kick off an extra access to release the arbiter lock - ctrl_lock
// STATE_RD_PHY_REQ: ctrl_go_ff <= ctrl_done & ~ctrl_chan_err & phy_req;
// STATE_RD_PHY_ID: ctrl_go_ff <= ctrl_done & phy_id;
STATE_RD_PHY_REQ: ctrl_go_ff <= ctrl_done & (ctrl_chan_tc | phy_req);
STATE_RD_PHY_ID: ctrl_go_ff <= ctrl_done & (ctrl_chan_tc | phy_id);
STATE_RD_RSER_CLKMON: ctrl_go_ff <= ctrl_done;
STATE_WR_RSER_CLKMON: ctrl_go_ff <= ctrl_done;
STATE_RD_RTX_LST: ctrl_go_ff <= ctrl_done;
STATE_WR_RTX_LST: ctrl_go_ff <= ctrl_done;
STATE_RD_DEFAULT_DCTUNE: ctrl_go_ff <= ctrl_done;
STATE_RESET_DCTUNE: ctrl_go_ff <= ctrl_done;
STATE_INC_DCTUNE: ctrl_go_ff <= ctrl_done;
STATE_DEC_DCTUNE: ctrl_go_ff <= ctrl_done;
STATE_SET_DCTUNE: ctrl_go_ff <= ctrl_done;
STATE_RD_CMP_TOGGLE: ctrl_go_ff <= cmp_wait_cnt;
STATE_RD_DCTUNE: ctrl_go_ff <= ctrl_done & rdata_done[0] & rdata_done[1];
STATE_RESET_RSER_CLKMON: ctrl_go_ff <= ctrl_done;
STATE_RESET_RTX_LST: ctrl_go_ff <= 1'b0;
default: ctrl_go_ff <= 1'b0;
endcase
end
// delay GO to match write data
always @(posedge clk)
begin
if (reset || dcd_start_sync_reg)
begin
ctrl_go <= 1'b0;
end
else
begin
ctrl_go <= ctrl_go_ff;
end
end
// user busy
always @(posedge clk)
begin
if (reset & !cal_done)
user_busy <= 1'b1;
else
user_busy <= !cal_done;
end
endmodule

View file

@ -0,0 +1,128 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
`timescale 1 ps / 1 ps
module alt_xcvr_reconfig_dfe #(
parameter device_family = "Stratix IV",
parameter number_of_reconfig_interfaces = 1
)
(
input wire reconfig_clk,
input wire reset,
input wire hold,
//user
input wire [2:0] dfe_address,
input wire [31:0] dfe_writedata,
input wire dfe_write,
input wire dfe_read,
output wire [31:0] dfe_readdata,
output wire dfe_waitrequest,
output wire dfe_done,
// basic
input wire dfe_irq_from_base,
input wire dfe_waitrequest_from_base,
output wire [2:0] dfe_address_base,
output wire [31:0] dfe_writedata_base,
output wire dfe_write_base,
output wire dfe_read_base,
input wire [31:0] dfe_readdata_base,
output wire arb_req,
input wire arb_grant,
input wire [7:0] dfe_testbus
);
import altera_xcvr_functions::*;
localparam is_s4 = has_s4_style_hssi(device_family);
localparam is_s5 = has_s5_style_hssi(device_family);
generate
if (is_s4)
begin
alt_xcvr_reconfig_dfe_tgx #(
.device_family(device_family),
.number_of_reconfig_interfaces(number_of_reconfig_interfaces)
)
dfe_tgx (
.reconfig_clk (reconfig_clk),
.reset (reset),
.dfe_address (dfe_address),
.dfe_writedata (dfe_writedata),
.dfe_write (dfe_write),
.dfe_read (dfe_read),
.dfe_readdata (dfe_readdata),
.dfe_waitrequest (dfe_waitrequest),
.dfe_irq (dfe_done),
.dfe_irq_from_base (dfe_irq_from_base),
.dfe_waitrequest_from_base (dfe_waitrequest_from_base),
.dfe_address_base (dfe_address_base),
.dfe_writedata_base (dfe_writedata_base),
.dfe_write_base (dfe_write_base),
.dfe_read_base (dfe_read_base),
.dfe_readdata_base (dfe_readdata_base)
);
assign arb_req = 1'b0;
end
else if (is_s5)
begin
alt_xcvr_reconfig_dfe_sv #(
.number_of_reconfig_interfaces(number_of_reconfig_interfaces)
)
dfe_sv (
.reconfig_clk (reconfig_clk),
.reset (reset),
.hold (hold),
.dfe_address (dfe_address),
.dfe_writedata (dfe_writedata),
.dfe_write (dfe_write),
.dfe_read (dfe_read),
.dfe_readdata (dfe_readdata),
.dfe_waitrequest (dfe_waitrequest),
.dfe_irq (dfe_done),
.dfe_irq_from_base (dfe_irq_from_base),
.dfe_waitrequest_from_base (dfe_waitrequest_from_base),
.dfe_address_base (dfe_address_base),
.dfe_writedata_base (dfe_writedata_base),
.dfe_write_base (dfe_write_base),
.dfe_read_base (dfe_read_base),
.dfe_readdata_base (dfe_readdata_base),
.arb_req (arb_req),
.arb_grant (arb_grant),
.dfe_testbus (dfe_testbus)
);
end
else
begin
assign dfe_readdata = 32'b0;
assign dfe_waitrequest = 1'b0;
assign dfe_done = 1'b1;
assign dfe_address_base = 3'b0;
assign dfe_writedata_base = 32'b0;
assign dfe_write_base = 1'b0;
assign dfe_read_base = 1'b0;
assign arb_req = 1'b0;
end
endgenerate
endmodule

View file

@ -0,0 +1,107 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
`timescale 1 ns / 1 ps
module alt_xcvr_reconfig_direct #(
parameter device_family = "Stratix V"
) (
// avalon clock interface
input wire clk,
input wire reset,
// user avalon MM slave interface
input wire write,
input wire read,
input wire [31:0] writedata,
input wire [2:0] address,
output reg [31:0] readdata,
output wire waitrequest,
// master interface to control "basic" block
output wire basic_write,
output wire basic_read,
output wire [31:0] basic_writedata,
output wire [2:0] basic_address,
input wire [31:0] basic_readdata,
input wire basic_waitrequest,
// external connect to switch fabric: request basic access from arbiter
output wire arb_req,
input wire arb_grant
);
import altera_xcvr_functions::*;
import alt_xcvr_reconfig_h::*;
localparam ADDR_XCVR_RECONFIG_DIRECT_CONTROL = 3'(ADDR_XR_DIRECT_ARB_ACQ - ADDR_XR_DIRECT_BASE);
reg reg_arb_req = 0;
// 161000: added to block outbound waitrequest when arbitration is not requested
wire waitrequest_int;
assign waitrequest = waitrequest_int & reg_arb_req;
////////////////////////////////////////////
// Memory-mapped register write interface
////////////////////////////////////////////
// logical channel register
always @(posedge clk or posedge reset) begin
if (reset == 1) begin
reg_arb_req <= 0;
end
else if (write && address == ADDR_XCVR_RECONFIG_DIRECT_CONTROL) begin
// Manually control arbiter request signal
reg_arb_req <= writedata[0];
end
end
//////////////////////////////////////////////
// Pass-through to basic block for everything
//////////////////////////////////////////////
alt_arbiter_acq #(
.addr_width(3),
.data_width(32)
)
mutex_inst (
.clk(clk),
.reset(reset),
// local slave-side connections
.address (address),
.writedata (writedata),
.write (write),
.read (read),
.waitrequest(waitrequest_int),
.readdata (readdata),
// connections to the basic block
.master_address (basic_address),
.master_writedata (basic_writedata),
.master_write (basic_write),
.master_read (basic_read),
.master_waitrequest(basic_waitrequest),
.master_readdata (basic_readdata),
// request access to fabric & basic block
.mutex_req(reg_arb_req),
.mutex_grant(),
// external arbiter connections for fabric access
.arb_req(arb_req),
.arb_grant(arb_grant)
);
endmodule

View file

@ -0,0 +1,131 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
`timescale 1 ps / 1 ps
module alt_xcvr_reconfig_eyemon #(
parameter device_family = "Stratix IV",
parameter number_of_reconfig_interfaces = 1,
parameter enable_ber_counter = 0
)
(
input wire reconfig_clk,
input wire reset,
//user
input wire [2:0] eyemon_address,
input wire [31:0] eyemon_writedata,
input wire eyemon_write,
input wire eyemon_read,
output wire [31:0] eyemon_readdata,
output wire eyemon_waitrequest,
output wire eyemon_done,
// basic
input wire eyemon_irq_from_base,
input wire eyemon_waitrequest_from_base,
output wire [2:0] eyemon_address_base,
output wire [31:0] eyemon_writedata_base,
output wire eyemon_write_base,
output wire eyemon_read_base,
input wire [31:0] eyemon_readdata_base,
output wire arb_req,
input wire arb_grant,
//testbus
input wire [7:0] eyemon_testbus
);
import altera_xcvr_functions::*;
localparam is_s4 = has_s4_style_hssi(device_family);
localparam is_s5 = has_s5_style_hssi(device_family);
generate
if (is_s4)
begin: gen_eyemon_tgx
alt_xcvr_reconfig_eyemon_tgx #(
.device_family (device_family),
.number_of_reconfig_interfaces (number_of_reconfig_interfaces)
)
eyemon_tgx (
.reconfig_clk (reconfig_clk),
.reset (reset),
.eyemon_address (eyemon_address),
.eyemon_writedata (eyemon_writedata),
.eyemon_write (eyemon_write),
.eyemon_read (eyemon_read),
.eyemon_readdata (eyemon_readdata),
.eyemon_waitrequest (eyemon_waitrequest),
.eyemon_irq (eyemon_done),
.eyemon_irq_from_base (eyemon_irq_from_base),
.eyemon_waitrequest_from_base (eyemon_waitrequest_from_base),
.eyemon_address_base (eyemon_address_base),
.eyemon_writedata_base (eyemon_writedata_base),
.eyemon_write_base (eyemon_write_base),
.eyemon_read_base (eyemon_read_base),
.eyemon_readdata_base (eyemon_readdata_base)
);
assign arb_req = 1'b0;
end
else if (is_s5)
begin: gen_eyemon_sv
alt_xcvr_reconfig_eyemon_sv #(
.number_of_reconfig_interfaces (number_of_reconfig_interfaces),
.enable_ber_counter (enable_ber_counter)
)
eyemon_sv (
.reconfig_clk (reconfig_clk),
.reset (reset),
.eyemon_address (eyemon_address),
.eyemon_writedata (eyemon_writedata),
.eyemon_write (eyemon_write),
.eyemon_read (eyemon_read),
.eyemon_readdata (eyemon_readdata),
.eyemon_waitrequest (eyemon_waitrequest),
.eyemon_irq (eyemon_done),
.eyemon_irq_from_base (eyemon_irq_from_base),
.eyemon_waitrequest_from_base (eyemon_waitrequest_from_base),
.eyemon_address_base (eyemon_address_base),
.eyemon_writedata_base (eyemon_writedata_base),
.eyemon_write_base (eyemon_write_base),
.eyemon_read_base (eyemon_read_base),
.eyemon_readdata_base (eyemon_readdata_base),
.arb_req (arb_req),
.arb_grant (arb_grant),
.eyemon_testbus (eyemon_testbus)
);
end
else
begin
assign eyemon_readdata = 32'b0;
assign eyemon_waitrequest = 1'b0;
assign eyemon_done = 1'b1;
assign eyemon_address_base = 3'b0;
assign eyemon_writedata_base = 32'b0;
assign eyemon_write_base = 1'b0;
assign eyemon_read_base = 1'b0;
assign arb_req = 1'b0;
end
endgenerate
endmodule

View file

@ -0,0 +1,280 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
// Top-level definitions for transceiver reconfig IP
//
// $Header$
//
// PACKAGE DECLARATION
package alt_xcvr_reconfig_h;
////////////////////////////////////////////////////////
// Top-level register map for transceiver reconfig IP
////////////////////////////////////////////////////////
localparam W_XR_ADDR = 7; // address width on mgmt interface
localparam W_XR_FEATURE_LADDR = 3; // address width of standard feature block, and basic logical interface
typedef bit [W_XR_ADDR -1:0] t_xreconf_addr;
typedef bit [W_XR_FEATURE_LADDR-1:0] t_xr_feature_addr;
// Feature block indices (used for address decoding for each block)
localparam INDEX_XR_OFFSET = 0;
localparam INDEX_XR_ANALOG = 1;
localparam INDEX_XR_EYEMON = 2;
localparam INDEX_XR_DFE = 3;
localparam INDEX_XR_DIRECT = 4;
localparam INDEX_XR_ADCE = 5;
localparam INDEX_XR_LC = 6;
localparam INDEX_XR_MIF = 7;
localparam INDEX_XR_PLL = 8;
localparam INDEX_XR_DCD = 9;
localparam INDEX_XR_END = 10; // must always mark end of address space
// Each feature block is allocated an 8-word address range
localparam [W_XR_ADDR-1:0] ADDR_XR_OFFSET_BASE = t_xreconf_addr'(INDEX_XR_OFFSET << W_XR_FEATURE_LADDR);
localparam [W_XR_ADDR-1:0] ADDR_XR_ANALOG_BASE = t_xreconf_addr'(INDEX_XR_ANALOG << W_XR_FEATURE_LADDR);
localparam [W_XR_ADDR-1:0] ADDR_XR_EYEMON_BASE = t_xreconf_addr'(INDEX_XR_EYEMON << W_XR_FEATURE_LADDR);
localparam [W_XR_ADDR-1:0] ADDR_XR_DFE_BASE = t_xreconf_addr'(INDEX_XR_DFE << W_XR_FEATURE_LADDR);
localparam [W_XR_ADDR-1:0] ADDR_XR_DIRECT_BASE = t_xreconf_addr'(INDEX_XR_DIRECT << W_XR_FEATURE_LADDR);
localparam [W_XR_ADDR-1:0] ADDR_XR_ADCE_BASE = t_xreconf_addr'(INDEX_XR_ADCE << W_XR_FEATURE_LADDR);
localparam [W_XR_ADDR-1:0] ADDR_XR_LC_BASE = t_xreconf_addr'(INDEX_XR_LC << W_XR_FEATURE_LADDR);
localparam [W_XR_ADDR-1:0] ADDR_XR_MIF_BASE = t_xreconf_addr'(INDEX_XR_MIF << W_XR_FEATURE_LADDR);
localparam [W_XR_ADDR-1:0] ADDR_XR_PLL_BASE = t_xreconf_addr'(INDEX_XR_PLL << W_XR_FEATURE_LADDR);
localparam [W_XR_ADDR-1:0] ADDR_XR_DCD_BASE = t_xreconf_addr'(INDEX_XR_DCD << W_XR_FEATURE_LADDR);
localparam [W_XR_ADDR-1:0] ADDR_XR_END_BASE = t_xreconf_addr'(INDEX_XR_END << W_XR_FEATURE_LADDR); // must always mark end of address space
localparam [W_XR_FEATURE_LADDR-1:0] XR_STATUS_OFST = t_xr_feature_addr'(2);
localparam XR_STATUS_OFST_COMB_BUSY = 8;
////////////////////////////////////////////////////////
// Offset Cancellation block addresses
////////////////////////////////////////////////////////
localparam [W_XR_ADDR-1:0] ADDR_XR_OFFSET_STATUS = t_xreconf_addr'(ADDR_XR_OFFSET_BASE + 2);
////////////////////////////////////////////////////////
// Analog block addresses
////////////////////////////////////////////////////////
localparam [W_XR_ADDR-1:0] ADDR_XR_ANALOG_LCH = t_xreconf_addr'(ADDR_XR_ANALOG_BASE + 0);
localparam [W_XR_ADDR-1:0] ADDR_XR_ANALOG_PCH = t_xreconf_addr'(ADDR_XR_ANALOG_BASE + 1);
localparam [W_XR_ADDR-1:0] ADDR_XR_ANALOG_STATUS = t_xreconf_addr'(ADDR_XR_ANALOG_BASE + 2);
localparam [W_XR_ADDR-1:0] ADDR_XR_ANALOG_OFFSET = t_xreconf_addr'(ADDR_XR_ANALOG_BASE + 3);
localparam [W_XR_ADDR-1:0] ADDR_XR_ANALOG_DATA = t_xreconf_addr'(ADDR_XR_ANALOG_BASE + 4);
// Analog internal register offsets
// These are to be written to the analog offset address register, ADDR_XR_ANALOG_OFFSET
localparam XR_ANALOG_OFFSET_VOD = 0;
localparam XR_ANALOG_OFFSET_PREEMPH0T = 1;
localparam XR_ANALOG_OFFSET_PREEMPH1T = 2;
localparam XR_ANALOG_OFFSET_PREEMPH2T = 3;
localparam XR_ANALOG_OFFSET_RXDCGAIN = 16;
localparam XR_ANALOG_OFFSET_RXEQCTRL = 17;
localparam XR_ANALOG_OFFSET_PRECDRLPBK = 32;
localparam XR_ANALOG_OFFSET_POSTCDRLPBK = 33;
////////////////////////////////////////////////////////
// DFE block addresses
////////////////////////////////////////////////////////
localparam [W_XR_ADDR-1:0] ADDR_XR_DFE_LCH = t_xreconf_addr'(ADDR_XR_DFE_BASE + 0);
localparam [W_XR_ADDR-1:0] ADDR_XR_DFE_PCH = t_xreconf_addr'(ADDR_XR_DFE_BASE + 1);
localparam [W_XR_ADDR-1:0] ADDR_XR_DFE_STATUS = t_xreconf_addr'(ADDR_XR_DFE_BASE + 2);
localparam [W_XR_ADDR-1:0] ADDR_XR_DFE_OFFSET = t_xreconf_addr'(ADDR_XR_DFE_BASE + 3);
localparam [W_XR_ADDR-1:0] ADDR_XR_DFE_DATA = t_xreconf_addr'(ADDR_XR_DFE_BASE + 4);
// DFE internal register offsets
// These are to be written to the DFE offset address register, ADDR_XR_DFE_OFFSET
localparam XR_DFE_OFFSET_CTRL = 0;
localparam XR_DFE_OFFSET_TAP1 = 1;
localparam XR_DFE_OFFSET_TAP2 = 2;
localparam XR_DFE_OFFSET_TAP3 = 3;
localparam XR_DFE_OFFSET_TAP4 = 4;
localparam XR_DFE_OFFSET_TAP5 = 5;
localparam XR_DFE_OFFSET_REF = 6;
localparam XR_DFE_OFFSET_STEP = 7;
localparam XR_DFE_OFFSET_ADAPT_TIME= 8;
localparam XR_DFE_OFFSET_RUN = 10;
localparam XR_DFE_OFFSET_TAP_ADAPT = 11;
localparam XR_DFE_OFFSET_DFE12 = 18;
localparam XR_DFE_OFFSET_DFE13 = 19;
localparam XR_DFE_OFFSET_DFE14 = 20;
localparam XR_DFE_OFFSET_DFE15 = 21;
localparam XR_DFE_OFFSET_CAL_PLL = 22;
localparam XR_DFE_OFFSET_CAL_TBUS = 23;
localparam XR_DFE_OFFSET_CAL_SAMPL = 24;
localparam XR_DFE_OFFSET_CAL_RESET = 25;
localparam XR_DFE_OFFSET_ADAPT_WAIT = 26;
localparam XR_DFE_OFFSET_ADAPT_COUNT= 27;
////////////////////////////////////////////////////////
// Eyemon block addresses
////////////////////////////////////////////////////////
localparam [W_XR_ADDR-1:0] ADDR_XR_EYEMON_LCH = t_xreconf_addr'(ADDR_XR_EYEMON_BASE + 0);
localparam [W_XR_ADDR-1:0] ADDR_XR_EYEMON_PCH = t_xreconf_addr'(ADDR_XR_EYEMON_BASE + 1);
localparam [W_XR_ADDR-1:0] ADDR_XR_EYEMON_STATUS = t_xreconf_addr'(ADDR_XR_EYEMON_BASE + 2);
localparam [W_XR_ADDR-1:0] ADDR_XR_EYEMON_OFFSET = t_xreconf_addr'(ADDR_XR_EYEMON_BASE + 3);
localparam [W_XR_ADDR-1:0] ADDR_XR_EYEMON_DATA = t_xreconf_addr'(ADDR_XR_EYEMON_BASE + 4);
// EYEMON internal register offsets
// These are to be written to the EYEMON offset address register, ADDR_XR_EYEMON_OFFSET
localparam XR_EYEMON_OFFSET_CTRL = 0;
localparam XR_EYEMON_OFFSET_HPHASE = 1;
localparam XR_EYEMON_OFFSET_VHEIGHT = 2;
localparam XR_EYEMON_OFFSET_EYEMON16 = 3;
localparam XR_EYEMON_OFFSET_EYEMON17 = 4;
localparam XR_EYEMON_OFFSET_BIT_LOW = 5;
localparam XR_EYEMON_OFFSET_BIT_HI = 6;
localparam XR_EYEMON_OFFSET_ERR_LOW = 7;
localparam XR_EYEMON_OFFSET_ERR_HI = 8;
localparam XR_EYEMON_OFFSET_EXCP_LOW = 9;
localparam XR_EYEMON_OFFSET_BERTHRESH= 10;
////////////////////////////////////////////////////////
// ADCE block addresses
////////////////////////////////////////////////////////
localparam [W_XR_ADDR-1:0] ADDR_XR_ADCE_LCH = t_xreconf_addr'(ADDR_XR_ADCE_BASE + 0); // Logical channel number
localparam [W_XR_ADDR-1:0] ADDR_XR_ADCE_PCH = t_xreconf_addr'(ADDR_XR_ADCE_BASE + 1); // Physical channel number
localparam [W_XR_ADDR-1:0] ADDR_XR_ADCE_STATUS = t_xreconf_addr'(ADDR_XR_ADCE_BASE + 2);
localparam [W_XR_ADDR-1:0] ADDR_XR_ADCE_OFFSET = t_xreconf_addr'(ADDR_XR_ADCE_BASE + 3);
localparam [W_XR_ADDR-1:0] ADDR_XR_ADCE_DATA = t_xreconf_addr'(ADDR_XR_ADCE_BASE + 4);
// ADCE internal register offsets
// These are to be written to the ADCE offset address register, ADDR_XR_ADCE_OFFSET
localparam XR_ADCE_OFFSET_CTRL = 0;
localparam XR_ADCE_OFFSET_RESULTS = 1; // Manual setting equivalent to ADCE results
localparam XR_ADCE_OFFSET_BW = 2;
localparam XR_ADCE_OFFSET_TIMEOUT = 3; // Timeout override register for adapt_done signal
localparam XR_ADCE_OFFSET_RADCE_ATT_0 = 9; // radce_att[15: 0]
localparam XR_ADCE_OFFSET_RADCE_ATT_1 = 10; // radce_att[31:15]
localparam XR_ADCE_OFFSET_RADCE_ATT_2 = 11; // radce_att[47:32]
localparam XR_ADCE_OFFSET_RADCE_ATT_3 = 12; // radce_att[63:48]
localparam XR_ADCE_OFFSET_RADCE_ATT_4 = 13; // radce_att[79:64]
localparam XR_ADCE_OFFSET_RADCE_ATT_5 = 14; // radce_att[95:80]
localparam XR_ADCE_OFFSET_RADCE_ATT_6 = 15; // radce_att[111:96]
////////////////////////////////////////////////////////
// DCD block addresses
////////////////////////////////////////////////////////
localparam [W_XR_ADDR-1:0] ADDR_XR_DCD_LCH = t_xreconf_addr'(ADDR_XR_DCD_BASE + 0);
localparam [W_XR_ADDR-1:0] ADDR_XR_DCD_PCH = t_xreconf_addr'(ADDR_XR_DCD_BASE + 1);
localparam [W_XR_ADDR-1:0] ADDR_XR_DCD_STATUS = t_xreconf_addr'(ADDR_XR_DCD_BASE + 2);
localparam [W_XR_ADDR-1:0] ADDR_XR_DCD_OFFSET = t_xreconf_addr'(ADDR_XR_DCD_BASE + 3);
localparam [W_XR_ADDR-1:0] ADDR_XR_DCD_DATA = t_xreconf_addr'(ADDR_XR_DCD_BASE + 4);
// DCD internal register offsets
// These are to be written to the DFE offset address register, ADDR_XR_DCD_OFFSET
localparam XR_DCD_OFFSET_CTRL = 0;
////////////////////////////////////////////////////////
// MIF block addresses
////////////////////////////////////////////////////////
localparam [W_XR_ADDR-1:0] ADDR_XR_MIF_LCH = t_xreconf_addr'(ADDR_XR_MIF_BASE + 0);
localparam [W_XR_ADDR-1:0] ADDR_XR_MIF_PCH = t_xreconf_addr'(ADDR_XR_MIF_BASE + 1);
localparam [W_XR_ADDR-1:0] ADDR_XR_MIF_STATUS = t_xreconf_addr'(ADDR_XR_MIF_BASE + 2);
localparam [W_XR_ADDR-1:0] ADDR_XR_MIF_OFFSET = t_xreconf_addr'(ADDR_XR_MIF_BASE + 3);
localparam [W_XR_ADDR-1:0] ADDR_XR_MIF_DATA = t_xreconf_addr'(ADDR_XR_MIF_BASE + 4);
////////////////////////////////////////////////////////
// PLL block addresses
////////////////////////////////////////////////////////
localparam [W_XR_ADDR-1:0] ADDR_XR_PLL_LCH = t_xreconf_addr'(ADDR_XR_PLL_BASE + 0);
localparam [W_XR_ADDR-1:0] ADDR_XR_PLL_PCH = t_xreconf_addr'(ADDR_XR_PLL_BASE + 1);
localparam [W_XR_ADDR-1:0] ADDR_XR_PLL_STATUS = t_xreconf_addr'(ADDR_XR_PLL_BASE + 2);
localparam [W_XR_ADDR-1:0] ADDR_XR_PLL_OFFSET = t_xreconf_addr'(ADDR_XR_PLL_BASE + 3);
localparam [W_XR_ADDR-1:0] ADDR_XR_PLL_DATA = t_xreconf_addr'(ADDR_XR_PLL_BASE + 4);
////////////////////////////////////////////////////////
// Basic block addresses (internal, private addresses)
////////////////////////////////////////////////////////
// The 'basic' interface block is the switch that routes requests to
// an appropriate physical reconfiguration interface. A logical channel
// number acts as a channel ID, which allows the basic block to find
// the corresponding physical reconfiguration interface, and a physical
// channel index within a physical interface.
//
// The Basic (B) block features are also available via the direct access block.
// All users of the basic block, including the direct access block, must
// acquire appropriate semaphores before using an interface, and release
// the semaphores when done, to avoid locking out other feature blocks.
localparam [W_XR_FEATURE_LADDR-1:0] ADDR_XCVR_RECONFIG_BASIC_MUTEX = t_xr_feature_addr'(0);
localparam [W_XR_FEATURE_LADDR-1:0] ADDR_XCVR_RECONFIG_BASIC_LOGICAL_CHANNEL = t_xr_feature_addr'(1);
localparam [W_XR_FEATURE_LADDR-1:0] ADDR_XCVR_RECONFIG_BASIC_PHYSICAL_CHANNEL = t_xr_feature_addr'(2);
localparam [W_XR_FEATURE_LADDR-1:0] ADDR_XCVR_RECONFIG_BASIC_CONTROL = t_xr_feature_addr'(3);
localparam [W_XR_FEATURE_LADDR-1:0] ADDR_XCVR_RECONFIG_BASIC_OFFSET_ADDR = t_xr_feature_addr'(4);
localparam [W_XR_FEATURE_LADDR-1:0] ADDR_XCVR_RECONFIG_BASIC_DATA = t_xr_feature_addr'(5);
////////////////////////////////////////////////////////
// Direct Access & Basic block addresses
////////////////////////////////////////////////////////
//
// The minimum steps to read & write a reconfiguration word are the following:
// Step 1 - acquire basic arbiter lock (write 1 to ADDR_XR_DIRECT_ARB_ACQ)
// Step 2 - write logical channel number to ADDR_XR_DIRECT_LCH
// Step 3 - acquire channel lock
// 3a - request channel lock (write XR_DIRECT_CONTROL_PHYS_LOCK_SET to ADDR_XR_DIRECT_CONTROL)
// 3b - confirm channel lock (read ADDR_XR_DIRECT_CONTROL, mask with XR_DIRECT_STATUS_BITMASK_PHYS_LOCK_GRANTED)
// -- repeat step 3b until result after applying mask is != 0
// Step 4 - write channel offset address to ADDR_XR_DIRECT_OFFSET
// Step 5 - read existing value from reconfig space, modify, then write back
// 5a (read cycle part 1) - write XR_DIRECT_CONTROL_RECONF_READ to ADDR_XR_DIRECT_CONTROL
// 5b (read cycle part 2) - read data from ADDR_XR_DIRECT_DATA
// 5c (write cycle part 1) - write modified value to ADDR_XR_DIRECT_DATA
// 5d (write cycle part 2) - write XR_DIRECT_CONTROL_RECONF_WRITE to ADDR_XR_DIRECT_CONTROL
// -- addtional read-modify-write cycles, repeat from step 2 or 4 (can skip step 3a)
// Step 6 - release channel lock (write XR_DIRECT_CONTROL_PHYS_LOCK_CLEAR to ADDR_XR_DIRECT_CONTROL)
// Step 7 - release basic arbiter lock (write 0 to ADDR_XR_DIRECT_ARB_ACQ)
//
// Direct/Basic register bitmap ---------------------------------------------------------
// word addr wr/rd description
// ------------------------------------------------------
// 0 wr basic arbiter, 1 to request access, 0 to release lock
// 1 wr/rd logical channel number
// 2 rd physical channel number. When lower 3 bits are 3'b111, means ch is not present
// 3 wr/rd status/control -- see XR_DIRECT_CONTROL_* opcodes and XR_DIRECT_STATUS_* bitfield definitions
// 4 wr/rd offset_addr -- for opcode-based reads & writes
// 5 wr/rd data -- for opcode-based reads & writes
// 6 -- reserved
// 7 -- reserved
localparam [W_XR_ADDR-1:0] ADDR_XR_DIRECT_ARB_ACQ = t_xreconf_addr'(ADDR_XR_DIRECT_BASE + 0); // write 1 to request B access, 0 to release
localparam [W_XR_ADDR-1:0] ADDR_XR_DIRECT_LCH = t_xreconf_addr'(ADDR_XR_DIRECT_BASE + ADDR_XCVR_RECONFIG_BASIC_LOGICAL_CHANNEL);
localparam [W_XR_ADDR-1:0] ADDR_XR_DIRECT_PCH = t_xreconf_addr'(ADDR_XR_DIRECT_BASE + ADDR_XCVR_RECONFIG_BASIC_PHYSICAL_CHANNEL);
localparam [W_XR_ADDR-1:0] ADDR_XR_DIRECT_CONTROL = t_xreconf_addr'(ADDR_XR_DIRECT_BASE + ADDR_XCVR_RECONFIG_BASIC_CONTROL);
localparam [W_XR_ADDR-1:0] ADDR_XR_DIRECT_OFFSET = t_xreconf_addr'(ADDR_XR_DIRECT_BASE + ADDR_XCVR_RECONFIG_BASIC_OFFSET_ADDR);
localparam [W_XR_ADDR-1:0] ADDR_XR_DIRECT_DATA = t_xreconf_addr'(ADDR_XR_DIRECT_BASE + ADDR_XCVR_RECONFIG_BASIC_DATA);
// Opcode values for writes to control word, ADDR_XR_DIRECT_CONTROL
localparam XR_DIRECT_CONTROL_RECONF_WRITE = 32'b0000; // reconfig space: write current DATA to OFFSET addr (as physical addr or ch offset addr)
localparam XR_DIRECT_CONTROL_RECONF_READ = 32'b0001; // reconfig space: read from OFFSET_ADDR, save result in DATA
localparam XR_DIRECT_CONTROL_LADDR_SET = 32'b0010; // interpret OFFSET_ADDR as logical addr, with automatic ch addr offset
localparam XR_DIRECT_CONTROL_PADDR_SET = 32'b0011; // interpret OFFSET_ADDR as physical addr, with no automatic addr offset
localparam XR_DIRECT_CONTROL_PHYS_LOCK_CLEAR = 32'b0100; // clear lock request for current channel
localparam XR_DIRECT_CONTROL_PHYS_LOCK_SET = 32'b0101; // set lock request for current channel
localparam XR_DIRECT_CONTROL_ADDR_AUTO_INCR_CLEAR = 32'b0110; // clear auto-write-and-address-increment mode for data writes
localparam XR_DIRECT_CONTROL_ADDR_AUTO_INCR_SET = 32'b0111; // set auto-write-and-address-increment mode for data writes
localparam XR_DIRECT_CONTROL_INTERNAL_WRITE = 32'b1000; // Internal registers, mainly testbus control
//localparam XR_DIRECT_CONTROL_INTERNAL_READ = 32'b1001; // internal reg space: read from OFFSET_ADDR, save result in DATA
localparam XR_DIRECT_CONTROL_TABLE_READ = 32'b1011; // ROM table lookup, especially for PLL and clock mux remapping
// Read of control/status reg returns this bitfield data
localparam XR_DIRECT_STATUS_BITMASK_PHYS_LOCK_GRANTED = 32'b0001; // on read, bit 0 is grant status
localparam XR_DIRECT_STATUS_BITMASK_PHYS_LOCK_REQUESTED = 32'b0010; // on read, bit 1 is physical lock request flag
localparam XR_DIRECT_STATUS_BITMASK_USING_PHYS_ADDR = 32'b0100; // on read, bit 2 is physical addr mode indicator (0 mean logical addr)
localparam XR_DIRECT_STATUS_BITMASK_USING_ADDR_AUTO_INCR = 32'b1000; // on read, bit 3 is auto-write-and-addr-incr mode indicator
// Internal register addresses, for read/write via these opcodes: XR_DIRECT_CONTROL_INTERNAL_*
localparam XR_DIRECT_OFFSET_TESTBUS_SEL = 2'd0; // internal register for testbus sel
endpackage

View file

@ -0,0 +1,205 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
`timescale 1 ps / 1 ps
module alt_xcvr_reconfig_mif #(
parameter device_family = "Stratix V",
parameter enable_mif = 1
)
(
input wire reconfig_clk,
input wire reset,
////////////////////////////////
// User Avalon Slave interface
// User input MM slave
input wire [2:0] mif_reconfig_address,
input wire [31:0] mif_reconfig_writedata,
input wire mif_reconfig_write,
input wire mif_reconfig_read,
// User output MM slave
output wire [31:0] mif_reconfig_readdata,
output wire mif_reconfig_waitrequest,
output wire mif_reconfig_done,
///////////////////////////////
// PLL reconfiguration interface
// input from PLL reconfig
input wire mif_pll_busy,
input wire mif_pll_err,
// output from PLL reconfig
output wire mif_pll_go,
output wire mif_pll_type, //0=Refclk switching, 1=CGB switching
output wire [9:0] mif_pll_lch,
output wire [3:0] mif_pll_data,
output wire mif_pll_pll_type, //0=CDR/CMU, 1=ATX
//////////////////////////////////
// Avalon Master streaming interface
// output to MIF entity (ROM)
output wire [31:0] mif_stream_address,
output wire mif_stream_read,
// input from MIF entity (ROM)
input wire mif_stream_waitrequest,
input wire [15:0] mif_stream_readdata,
//////////////////////////////////
// Basic block interface
// output to base_reconfig
output wire [2:0] mif_base_address,
output wire [31:0] mif_base_writedata,
output wire mif_base_write,
output wire mif_base_read,
// input from base reconfig
input wire [31:0] mif_base_readdata,
input wire mif_base_waitrequest,
input wire mif_base_irq,
//////////////////////////////////
// Arbiter interface
output wire arb_req,
input wire arb_grant
);
import altera_xcvr_functions::*;
localparam is_s5 = has_s5_style_hssi(device_family);
localparam is_a5 = has_a5_style_hssi(device_family);
localparam is_c5 = has_c5_style_hssi(device_family);
generate
if ( is_s5 ) begin
sv_xcvr_reconfig_mif #(
.MIF_ADDR_WIDTH(8),
.MIF_DATA_WIDTH(16),
.enable_mif( enable_mif )
) mif_strm_sv
(
.reconfig_clk ( reconfig_clk ),
.reset ( reset ),
//User I/F
.mif_reconfig_address ( mif_reconfig_address ),
.mif_reconfig_writedata ( mif_reconfig_writedata ),
.mif_reconfig_write ( mif_reconfig_write ),
.mif_reconfig_read ( mif_reconfig_read ),
.mif_reconfig_readdata ( mif_reconfig_readdata ),
.mif_reconfig_waitrequest ( mif_reconfig_waitrequest ),
.mif_reconfig_done ( mif_reconfig_done ),
//PLL Reconf I/F
.mif_pll_busy ( mif_pll_busy ),
.mif_pll_err ( mif_pll_err ),
.mif_pll_go ( mif_pll_go ),
.mif_pll_type ( mif_pll_type ),
.mif_pll_lch ( mif_pll_lch ),
.mif_pll_data ( mif_pll_data ),
.mif_pll_pll_type ( mif_pll_pll_type),
//Stream interface
.mif_stream_address ( mif_stream_address ),
.mif_stream_read ( mif_stream_read ),
.mif_stream_waitrequest ( mif_stream_waitrequest ),
.mif_stream_readdata ( mif_stream_readdata ),
//Basic I/F
.mif_base_waitrequest ( mif_base_waitrequest ),
.mif_base_address ( mif_base_address ),
.mif_base_writedata ( mif_base_writedata ),
.mif_base_write ( mif_base_write ),
.mif_base_read ( mif_base_read ),
.mif_base_readdata ( mif_base_readdata ),
.mif_base_irq ( mif_base_irq ),
//Arbiter interface
.arb_req ( arb_req ),
.arb_grant ( arb_grant )
);
end else if ( is_a5 || is_c5 ) begin
av_xcvr_reconfig_mif #(
.MIF_ADDR_WIDTH(8),
.MIF_DATA_WIDTH(16),
.enable_mif( enable_mif )
) mif_strm_av
(
.reconfig_clk ( reconfig_clk ),
.reset ( reset ),
//User I/F
.mif_reconfig_address ( mif_reconfig_address ),
.mif_reconfig_writedata ( mif_reconfig_writedata ),
.mif_reconfig_write ( mif_reconfig_write ),
.mif_reconfig_read ( mif_reconfig_read ),
.mif_reconfig_readdata ( mif_reconfig_readdata ),
.mif_reconfig_waitrequest ( mif_reconfig_waitrequest ),
.mif_reconfig_done ( mif_reconfig_done ),
//PLL Reconf I/F
.mif_pll_busy ( mif_pll_busy ),
.mif_pll_err ( mif_pll_err ),
.mif_pll_go ( mif_pll_go ),
.mif_pll_type ( mif_pll_type ),
.mif_pll_lch ( mif_pll_lch ),
.mif_pll_data ( mif_pll_data ),
//Stream interface
.mif_stream_address ( mif_stream_address ),
.mif_stream_read ( mif_stream_read ),
.mif_stream_waitrequest ( mif_stream_waitrequest ),
.mif_stream_readdata ( mif_stream_readdata ),
//Basic I/F
.mif_base_waitrequest ( mif_base_waitrequest ),
.mif_base_address ( mif_base_address ),
.mif_base_writedata ( mif_base_writedata ),
.mif_base_write ( mif_base_write ),
.mif_base_read ( mif_base_read ),
.mif_base_readdata ( mif_base_readdata ),
.mif_base_irq ( mif_base_irq ),
//Arbiter interface
.arb_req ( arb_req ),
.arb_grant ( arb_grant )
);
end else begin
// Default case for unsupported families, just tie off outputs to idle states.
assign mif_reconfig_readdata = 32'b0;
assign mif_reconfig_waitrequest = 1'b0;
assign mif_reconfig_done = 1'b1;
assign mif_pll_go = 1'b0;
assign mif_pll_type = 1'd0;
assign mif_pll_data = 4'd0;
assign mif_pll_lch = 8'd0;
assign mif_pll_pll_type = 1'd0;
assign mif_base_address = 3'b0;
assign mif_base_writedata = 32'b0;
assign mif_base_write = 1'b0;
assign mif_base_read = 1'b0;
end
endgenerate
endmodule

View file

@ -0,0 +1,174 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
`timescale 1 ps / 1 ps
module alt_xcvr_reconfig_offset_cancellation
#(
parameter device_family = "StratixV",
parameter number_of_reconfig_interfaces = 1
)
(
input wire reconfig_clk, // this will be the reconfig clk
input wire reset,
//avalon MM slave
input wire [2:0] offset_cancellation_address, // MM address
input wire [31:0] offset_cancellation_writedata,
input wire offset_cancellation_write,
input wire offset_cancellation_read,
//output MM slave
output wire [31:0] offset_cancellation_readdata, // from MM
output wire offset_cancellation_done,
// input from base_reconfig
input wire offset_cancellation_irq_from_base,
input wire offset_cancellation_waitrequest_from_base,
output wire offset_cancellation_waitrequest,
// output to base_reconfig
// Avalon MM Master
output wire [2:0] offset_cancellation_address_base, // 3 bit MM
output wire [31:0] offset_cancellation_writedata_base,
output wire offset_cancellation_write_base, // start write to GXB
output wire offset_cancellation_read_base, // start read from GXB
// input from base reconfig
input wire [31:0] offset_cancellation_readdata_base, // data from read command
// Avalon ST
input wire [number_of_reconfig_interfaces*16 - 1 : 0] testbus_data,
// external connect to switch fabric: request basic access from arbiter
output wire arb_req,
input wire arb_grant
);
import altera_xcvr_functions::*;
localparam is_s4 = has_s4_style_hssi(device_family);
localparam is_s5 = has_s5_style_hssi(device_family);
localparam is_a5 = has_a5_style_hssi(device_family);
localparam is_c5 = has_c5_style_hssi(device_family);
generate
//Deepak - Namespace support for AII GX and CIVGX
if(is_s4)
begin
wire [4:0] w_tgx_offset_cancellation_address_base;
alt_xcvr_reconfig_offset_cancellation_tgx
#(
.device_family(device_family),
.number_of_reconfig_interfaces(number_of_reconfig_interfaces)
) offset_cancellation_tgx
(
.reconfig_clk(reconfig_clk),
.reset(reset),
.offset_cancellation_address(offset_cancellation_address),
.offset_cancellation_writedata(offset_cancellation_writedata),
.offset_cancellation_write(offset_cancellation_write),
.offset_cancellation_read(offset_cancellation_read),
.offset_cancellation_readdata(offset_cancellation_readdata),
.offset_cancellation_done(offset_cancellation_done),
.offset_cancellation_irq_from_base(offset_cancellation_irq_from_base),
.offset_cancellation_waitrequest_from_base(offset_cancellation_waitrequest_from_base),
.offset_cancellation_waitrequest(offset_cancellation_waitrequest),
.offset_cancellation_address_base(w_tgx_offset_cancellation_address_base),
.offset_cancellation_writedata_base(offset_cancellation_writedata_base),
.offset_cancellation_write_base(offset_cancellation_write_base),
.offset_cancellation_read_base(offset_cancellation_read_base),
.offset_cancellation_readdata_base(offset_cancellation_readdata_base),
.testbus_data(testbus_data)
);
assign offset_cancellation_address_base = w_tgx_offset_cancellation_address_base[4:2];
assign arb_req = 1'b0 & arb_grant; // not currently used in S4 architecture
end
else if (is_s5)
begin
alt_xcvr_reconfig_offset_cancellation_sv
#(
.device_family(device_family),
.number_of_reconfig_interfaces(number_of_reconfig_interfaces)
) offset_cancellation_sv
(
.reconfig_clk(reconfig_clk),
.reset(reset),
.offset_cancellation_address(offset_cancellation_address),
.offset_cancellation_writedata(offset_cancellation_writedata),
.offset_cancellation_write(offset_cancellation_write),
.offset_cancellation_read(offset_cancellation_read),
.offset_cancellation_readdata(offset_cancellation_readdata),
.offset_cancellation_done(offset_cancellation_done),
.offset_cancellation_irq_from_base(offset_cancellation_irq_from_base),
.offset_cancellation_waitrequest_from_base(offset_cancellation_waitrequest_from_base),
.offset_cancellation_waitrequest(offset_cancellation_waitrequest),
.offset_cancellation_address_base(offset_cancellation_address_base),
.offset_cancellation_writedata_base(offset_cancellation_writedata_base),
.offset_cancellation_write_base(offset_cancellation_write_base),
.offset_cancellation_read_base(offset_cancellation_read_base),
.offset_cancellation_readdata_base(offset_cancellation_readdata_base),
.testbus_data(testbus_data[7:0]), // testbus data is now provided on a per-channel basis from the 'B' - only need the lower 8 bits
.arb_req(arb_req),
.arb_grant(arb_grant)
);
end
else if (is_a5 || is_c5)
begin
alt_xcvr_reconfig_offset_cancellation_av
#(
.device_family(device_family),
.number_of_reconfig_interfaces(number_of_reconfig_interfaces)
) offset_cancellation_av
(
.reconfig_clk(reconfig_clk),
.reset(reset),
.offset_cancellation_address(offset_cancellation_address),
.offset_cancellation_writedata(offset_cancellation_writedata),
.offset_cancellation_write(offset_cancellation_write),
.offset_cancellation_read(offset_cancellation_read),
.offset_cancellation_readdata(offset_cancellation_readdata),
.offset_cancellation_done(offset_cancellation_done),
.offset_cancellation_irq_from_base(offset_cancellation_irq_from_base),
.offset_cancellation_waitrequest_from_base(offset_cancellation_waitrequest_from_base),
.offset_cancellation_waitrequest(offset_cancellation_waitrequest),
.offset_cancellation_address_base(offset_cancellation_address_base),
.offset_cancellation_writedata_base(offset_cancellation_writedata_base),
.offset_cancellation_write_base(offset_cancellation_write_base),
.offset_cancellation_read_base(offset_cancellation_read_base),
.offset_cancellation_readdata_base(offset_cancellation_readdata_base),
.testbus_data(testbus_data[7:0]), // testbus data is now provided on a per-channel basis from the 'B' - only need the lower 8 bits
.arb_req(arb_req),
.arb_grant(arb_grant)
);
end
else
begin
assign offset_cancellation_readdata = 32'd0;
assign offset_cancellation_done = 1'd0;
assign offset_cancellation_waitrequest = 1'd0;
assign offset_cancellation_address_base = 3'd0;
assign offset_cancellation_writedata_base = 32'd0;
assign offset_cancellation_write_base = 1'd0;
assign offset_cancellation_read_base = 1'd0;
assign arb_req = 1'd0;
end
endgenerate
endmodule

View file

@ -0,0 +1,735 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
// (C) 2001-2011 Altera Corporation. All rights reserved.
// Your use of Altera Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Altera Program License Subscription
// Agreement, Altera MegaCore Function License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Altera and sold by
// Altera or its authorized distributors. Please refer to the applicable
// agreement for further details.
`timescale 1 ps / 1 ps
// need to review the interface - figure out if anything needs to be added, or if anything can be removed - fix me!
module alt_xcvr_reconfig_offset_cancellation_av #(
parameter device_family = "Arria V",
parameter number_of_reconfig_interfaces = 1
)
(
input wire reconfig_clk, // this will be the reconfig clk
input wire reset,
//avalon MM slave
input wire [2:0] offset_cancellation_address, // MM address
input wire [31:0] offset_cancellation_writedata,
input wire offset_cancellation_write,
input wire offset_cancellation_read,
//output MM slave
output reg [31:0] offset_cancellation_readdata, // from MM
output wire offset_cancellation_done,
// input from base_reconfig
input wire offset_cancellation_irq_from_base,
input wire offset_cancellation_waitrequest_from_base,
output wire offset_cancellation_waitrequest,
// output to base_reconfig
// Avalon MM Master
output wire [2:0] offset_cancellation_address_base, // 3 bit MM
output wire [31:0] offset_cancellation_writedata_base,
output wire offset_cancellation_write_base, // start write to GXB
output wire offset_cancellation_read_base, // start read from GXB
// input from base reconfig
input wire [31:0] offset_cancellation_readdata_base, // data from read command
// Avalon ST
input wire [7 : 0] testbus_data, // testbus data is now provided on a per-channel basis from the 'B'
// external connect to switch fabric: request basic access from arbiter
output wire arb_req,
input wire arb_grant
);
import alt_xcvr_reconfig_h::*;
import av_xcvr_h::*;
///////////////////////////////////////////////////////////////////
// Memory map | wr/rd | Description
//----------------------------------------------------------------
// 0 | wr/rd | [31:10] Reserved
// | | [9] Error
// | | [8] Busy
// | | [7:1] Reserved
// | | [0] Start (hidden for QII 9.1)
///////////////////////////////////////////////////////////////////
//local parameters
//state
localparam IDLE_STATE = 6'b000000;
localparam LOGICAL_ADDRESS_STATE = 6'b000001;
localparam WRITE_DATA_STATE = 6'b000010;
localparam CONTROL_STATE = 6'b000011;
localparam BUSY_STATE = 6'b000100;
localparam READ_PHY_ADDR_STATE = 6'b000101;
localparam CHECK_PHY_ADDR_STATE = 6'b000110;
localparam SET_ADDR_OFFSET_REQ_STATE = 6'b000111;
localparam REQUEST_CONTROL_STATE = 6'b001000;
localparam READ_REQ_DATA_STATE = 6'b001001;
localparam CHECK_REQ_DATA_STATE = 6'b001010;
localparam ADDRESS_OFFSET_STATE = 6'b001011;
localparam BASE_BUSY_STATE = 6'b001100;
localparam READ_DATA_STATE = 6'b001101;
localparam WRITE_DONE_STATE = 6'b001110;
localparam ACQUIRE_PMUTEX_STATE = 6'b001111;
localparam READ_PMUTEX_STATE = 6'b010000;
localparam CHECK_PMUTEX_STATE = 6'b010001;
localparam RELEASE_PMUTEX_STATE = 6'b010010;
localparam WAIT_FOR_NEXT_STATE = 6'b010011;
localparam GET_TESTBUS_ADDR_STATE = 6'b010100;
localparam GET_TESTBUS_DATA_STATE = 6'b010101;
localparam SET_OC_CALEN_ADDR_STATE = 6'b010110;
localparam SET_OC_CALEN_DATA_STATE = 6'b010111;
localparam START_OC_CALEN_STATE = 6'b011000;
localparam RELEASE_OC_CALEN_DATA_STATE = 6'b011001;
localparam RELEASE_OC_CALEN_START_STATE = 6'b011010;
localparam RELEASE_OC_CALEN_DONE_STATE = 6'b011011;
localparam SET_PHY_RESET_OVERRIDE_ADDR_STATE = 6'b011100;
localparam SET_PHY_RESET_OVERRIDE_DATA_STATE = 6'b011101;
localparam SET_PHY_RESET_OVERRIDE_START_STATE = 6'b011110;
localparam RELEASE_PHY_RESET_OVERRIDE_ADDR_STATE = 6'b11111;
localparam RELEASE_PHY_RESET_OVERRIDE_DATA_STATE = 6'b100000;
localparam RELEASE_PHY_RESET_OVERRIDE_START_STATE = 6'b100001;
localparam ILLEGAL_PHYSICAL_CHNL = 3'b111; // lower 3 bits of the physical address will be all 1 - the channel index within the triplet
wire mutex_grant; // don't need to check if we check waitrequest - waitrequest from the arbiter_acq module is gated by grant
wire [31:0] master_read_data;
wire mutex_waitrequest_from_base;
reg [5:0] state = 0;
reg write_read_control = 0;
reg master_write = 0;
reg master_read = 0;
reg [31:0] master_write_data = 0;
reg [15:0] prev_logical_channel = 0;
reg [W_XR_FEATURE_LADDR-1:0] master_address = 0;
reg req_and_use_mutex = 0;
//alt_cal instantiation
wire alt_cal_busy;
wire [15:0] alt_cal_dprio_dataout;
wire alt_cal_dprio_wren;
wire alt_cal_dprio_rden;
wire [15:0] alt_cal_dprio_addr;
wire [8:0] alt_cal_quad_addr;
reg [11:0] alt_cal_remap_addr = 0;
reg alt_cal_dprio_busy = 0;
reg [15:0] alt_cal_dprio_datain = 0;
reg oc_started = 1'b0;
reg pmutex_acquired = 1'b0;
reg start, start0q;
wire start_trigger;
assign start_trigger = start & ~start0q; // rising edge of start
function integer CLogB2;
input integer Depth;
integer i;
begin
i = Depth;
for(CLogB2 = 0; i > 0; CLogB2 = CLogB2 + 1)
i = i >> 1;
end
endfunction
// Implement waitrequest to match previous implementation
altera_wait_generate wait_gen(
.rst(reset),
.clk(reconfig_clk),
.launch_signal(offset_cancellation_read),
.wait_req(offset_cancellation_waitrequest)
);
// synopsys translate_off
initial begin
state = 5'b0;
alt_cal_remap_addr = 12'h000;
req_and_use_mutex = 1'b0;
alt_cal_dprio_datain = 16'h0000;
alt_cal_dprio_busy = 1'b0;
master_write = 1'b0;
master_read = 1'b0;
master_write_data = {32{1'b0}};
prev_logical_channel = {16{1'b0}};
master_address = 3'h0;
write_read_control = 1'b0; // 1 for write, 0 for read
oc_started = 1'b0;
pmutex_acquired = 1'b0;
end
// synopsys translate_on
// offset_cancellation_done starts at 0
// -once alt_cal_busy goes high, then we are allowed to change OC done
// -once alt_cal_busy has gone high once, then oc_done is equal to ~oc_busy
// -oc_started should not be in the reset block - oc only needs to run once at initial powerup
// -we also need to make sure state is IDLE, since the mutex release state occurs after alt_cal is no longer busy
assign offset_cancellation_done = oc_started ? (~alt_cal_busy && (state == IDLE_STATE)) : 1'b0;
integer count;
always @ (posedge reconfig_clk) begin
// starts as 0, and is asserted to 1 the first time alt_cal goes busy. Do not unset this flag for subsequent runs, as OC should only run once at initial powerup
if (oc_started == 1'b1) begin
oc_started <= 1'b1;
end else begin
oc_started <= alt_cal_busy;
end
end
always @(posedge reconfig_clk or posedge reset)
begin
if (reset) begin
master_write <= 1'b0;
master_read <= 1'b0;
master_write_data <= {32{1'b0}};
prev_logical_channel <= {16{1'b0}};
master_address <= 3'h0;
write_read_control <= 1'b0; // 1 for write, 0 for read
state <= IDLE_STATE;
offset_cancellation_readdata[31:0] <= {32{1'b0}};
req_and_use_mutex <= 1'b0;
pmutex_acquired <= 1'b0;
start <= 1'b0;
start0q <= 1'b0;
alt_cal_remap_addr <= 12'h000;
alt_cal_dprio_datain <= 16'h0000;
alt_cal_dprio_busy <= 1'b0;
end else begin
if(offset_cancellation_read == 1'b1) begin
if(offset_cancellation_address == 3'h2) begin // SPR 377710 - change the address to register 0x2 to be consistent with other reconfig interfaces
offset_cancellation_readdata <= {{23{1'b0}}, alt_cal_busy , {8{1'b0}}};
end
end else if (offset_cancellation_write == 1'b1) begin // read and write can not be asserted at the same time
if (offset_cancellation_address == 3'h2) begin // SPR 377710 - change the address to register 0x2 to be consistent with other reconfig interfaces
start <= offset_cancellation_writedata[0]; // differs slightly from other reconfig interfaces - only the write itself triggers a restart of offset cancellation
start0q <= start;
end
end else begin
start <= 1'b0;
start0q <= start;
end
if(alt_cal_busy == 1'b0 && (state == IDLE_STATE)) // make sure we have released the physical mutex before releasing request
req_and_use_mutex <= 1'b0;
else
req_and_use_mutex <= 1'b1;
case (state)
IDLE_STATE: begin
//reset the signal
master_write <= 1'b0;
master_read <= 1'b0;
alt_cal_remap_addr <= 12'h000;
//alt_cal will not assert wren and rden at the same time
if((alt_cal_dprio_wren == 1'b1) || (alt_cal_dprio_rden == 1'b1)) begin
if(alt_cal_dprio_wren == 1'b1) begin
write_read_control <= 1'b1; // 1 for write
end else begin
write_read_control <= 1'b0; // 0 for read
end
state <= LOGICAL_ADDRESS_STATE; // need to change to request arbiter lock
master_write <= 1'b1; // next step is to send address to alt_dprio
master_address <= ADDR_XCVR_RECONFIG_BASIC_LOGICAL_CHANNEL;
master_write_data <= {{21{1'b0}}, alt_cal_quad_addr, alt_cal_dprio_addr[13:12]}; // the logical channel is just sent as is - we can revise alt_cal_sv.v to account for this, but leave it for now - fix me!
prev_logical_channel <= {5'b0, alt_cal_quad_addr, alt_cal_dprio_addr[13:12]}; // store the previous logical channel
end else begin
state <= IDLE_STATE;
end
end
LOGICAL_ADDRESS_STATE: begin //sending channel and quad address
if (~mutex_waitrequest_from_base) begin
master_write <= 1'b0;
master_read <= 1'b1; // do a read operation
master_address <= ADDR_XCVR_RECONFIG_BASIC_PHYSICAL_CHANNEL;
state <= READ_PHY_ADDR_STATE;
end else begin
state <= LOGICAL_ADDRESS_STATE;
end
end
READ_PHY_ADDR_STATE: begin //read phsical address
if (~mutex_waitrequest_from_base) begin
master_read <= 1'b0;
master_write <= 1'b0;
state <= CHECK_PHY_ADDR_STATE;
end else begin // waitrequest is asserted - keep control signals constant
state <= READ_PHY_ADDR_STATE;
end
end
CHECK_PHY_ADDR_STATE: begin //check physical address correct or not
master_read <= 1'b0;
master_write <= 1'b0;
if (master_read_data[2:0] == ILLEGAL_PHYSICAL_CHNL) begin
// synopsys translate_off
$display ("Illegal physical address: 10'h%h", master_read_data);
$display ("Time: %0t Instance: %m", $time);
// synopsys translate_on
alt_cal_remap_addr <= 12'hfff;
state <= IDLE_STATE;
end else begin
alt_cal_remap_addr <= master_read_data[11:0];
// if we already have the physical mutex, we are guaranteed it until we are done
state <= SET_ADDR_OFFSET_REQ_STATE; // get the physical mutex if we haven't yet
end
end
SET_ADDR_OFFSET_REQ_STATE: begin // send address request to alt_dprio
if (~mutex_waitrequest_from_base) begin
master_address <= ADDR_XCVR_RECONFIG_BASIC_OFFSET_ADDR;
master_write_data <= AV_XR_ABS_ADDR_REQUEST;
master_write <= 1'b1;
master_read <= 1'b0;
state <= REQUEST_CONTROL_STATE;
end else begin
state <= SET_ADDR_OFFSET_REQ_STATE;
end
end
REQUEST_CONTROL_STATE: begin
if (~mutex_waitrequest_from_base) begin
master_address <= ADDR_XCVR_RECONFIG_BASIC_CONTROL; // get ready to send control command to alt_dprio
master_write_data <= XR_DIRECT_CONTROL_RECONF_READ; // set control to read
master_write <= 1'b1;
master_read <= 1'b0;
state <= READ_REQ_DATA_STATE;
end else begin
state <= REQUEST_CONTROL_STATE;
end
end
READ_REQ_DATA_STATE: begin // read offset request bit
if (master_read && ~mutex_waitrequest_from_base) begin // irq is deprecated - the basic now blocks (using waitrequest) until the operation is done
master_read <= 1'b0;
state <= CHECK_REQ_DATA_STATE;
end else if (master_write && ~mutex_waitrequest_from_base) begin // we just came from ACQUIRE_PMUTEX_STATE
master_read <= 1'b1;
master_write <= 1'b0;
master_address <= ADDR_XCVR_RECONFIG_BASIC_DATA; // get the addr request data from the DPRIO result register
state <= READ_REQ_DATA_STATE; // need to stall for one more cycle
end else begin // waitrequested
state <= READ_REQ_DATA_STATE;
end
end
CHECK_REQ_DATA_STATE: begin //check logical if whether offset cancellation is required
master_read <= 1'b0;
master_write <= 1'b0;
if (master_read_data[2] == 1'b0) begin
// synopsys translate_off
$display ("Offset cancellation is not required");
$display ("Time: %0t Instance: %m", $time);
// synopsys translate_on
alt_cal_remap_addr <= 12'hfff;
state <= IDLE_STATE;
end else begin
// if we already have the physical mutex, we are guaranteed it until we are done
state <= pmutex_acquired ? ADDRESS_OFFSET_STATE : ACQUIRE_PMUTEX_STATE; // get the physical mutex if we haven't yet
end
end
ACQUIRE_PMUTEX_STATE: begin
master_read <= 1'b0;
master_write <= 1'b1;
master_address <= 3'h3; // status and control word
master_write_data <= XR_DIRECT_CONTROL_PHYS_LOCK_SET; // write to request physical mutex
state <= READ_PMUTEX_STATE;
end
READ_PMUTEX_STATE: begin // read the mutex state back to see if we got it
if (master_read && ~mutex_waitrequest_from_base) begin // we just read the mutex state
master_read <= 1'b0;
state <= CHECK_PMUTEX_STATE;
end else if (master_write && ~mutex_waitrequest_from_base) begin // we just came from ACQUIRE_PMUTEX_STATE
master_read <= 1'b1;
master_write <= 1'b0;
master_address <= 3'h3; // status and control word to read back the pmutex state
state <= READ_PMUTEX_STATE; // need to stall for one more cycle
end else begin // waitrequested
state <= READ_PMUTEX_STATE;
end
end
CHECK_PMUTEX_STATE: begin
if (master_read_data[0]) begin // we got the mutex
pmutex_acquired <= 1'b1;
master_read <= 1'b0;
master_write <= 1'b1;
master_address <= ADDR_XCVR_RECONFIG_BASIC_OFFSET_ADDR;
master_write_data <= AV_XR_LOCAL_OFFSET + AV_XR_ADDR_RSTCTL; // phy reset override control
state <= SET_PHY_RESET_OVERRIDE_ADDR_STATE; // get the testbus
end else begin // we didn't get the mutex - try again
state <= ACQUIRE_PMUTEX_STATE;
end
end
SET_PHY_RESET_OVERRIDE_ADDR_STATE: begin // override the PHY reset via the soft-CSR
if (~mutex_waitrequest_from_base) begin
master_read <= 1'b0;
master_write <= 1'b1;
master_address <= ADDR_XCVR_RECONFIG_BASIC_DATA;
master_write_data <= (1 << AV_XR_RSTCTL_RX_RST_OVR_OFST) | (1 << AV_XR_RSTCTL_RX_ANALOG_RST_N_VAL_OFST); // override the rx analog reset - active low
state <= SET_PHY_RESET_OVERRIDE_DATA_STATE;
end else begin // wait until waitrequest clears
state <= SET_PHY_RESET_OVERRIDE_ADDR_STATE;
end
end
SET_PHY_RESET_OVERRIDE_DATA_STATE: begin // override the PHY reset via the soft-CSR
if (~mutex_waitrequest_from_base) begin
master_read <= 1'b0;
master_write <= 1'b1;
master_address <= ADDR_XCVR_RECONFIG_BASIC_CONTROL;
master_write_data <= XR_DIRECT_CONTROL_RECONF_WRITE;
state <= SET_PHY_RESET_OVERRIDE_START_STATE;
end else begin // wait until waitrequest clears
state <= SET_PHY_RESET_OVERRIDE_DATA_STATE;
end
end
SET_PHY_RESET_OVERRIDE_START_STATE: begin // override the PHY reset via the soft-CSR
if (~mutex_waitrequest_from_base) begin
master_read <= 1'b0;
master_write <= 1'b1;
master_address <= ADDR_XCVR_RECONFIG_BASIC_OFFSET_ADDR; // status and control word
master_write_data <= XR_DIRECT_OFFSET_TESTBUS_SEL; // write to get testbus
state <= GET_TESTBUS_ADDR_STATE;
end else begin // wait until waitrequest clears
state <= SET_PHY_RESET_OVERRIDE_START_STATE;
end
end
GET_TESTBUS_ADDR_STATE: begin
if (~mutex_waitrequest_from_base) begin
master_address <= ADDR_XCVR_RECONFIG_BASIC_DATA;
master_write_data <= 16'b110; // set testbus to 4'b0110 for offset cancellation
master_write <= 1'b1; // send address to alt_dprio
master_read <= 1'b0;
state <= GET_TESTBUS_DATA_STATE;
end else begin // wait until waitrequest clears
state <= GET_TESTBUS_ADDR_STATE;
end
end
GET_TESTBUS_DATA_STATE: begin
if (~mutex_waitrequest_from_base) begin
master_address <= ADDR_XCVR_RECONFIG_BASIC_CONTROL;
master_write_data <= XR_DIRECT_CONTROL_INTERNAL_WRITE;
master_write <= 1'b1; // send address to alt_dprio
master_read <= 1'b0;
state <= SET_OC_CALEN_ADDR_STATE;
end else begin // wait until waitrequest clears
state <= GET_TESTBUS_DATA_STATE;
end
end
SET_OC_CALEN_ADDR_STATE: begin // set address to hardoc_calen internal register
if (~mutex_waitrequest_from_base) begin
master_read <= 1'b0;
master_write <= 1'b1;
master_address <= ADDR_XCVR_RECONFIG_BASIC_OFFSET_ADDR; // status and control word
master_write_data <= AV_XR_LOCAL_OFFSET + AV_XR_ADDR_OC;// write to get hardoc_calen register
state <= SET_OC_CALEN_DATA_STATE;
end else begin
state <= SET_OC_CALEN_ADDR_STATE;
end
end
SET_OC_CALEN_DATA_STATE: begin // prepare data to enable oc_calen
if (~mutex_waitrequest_from_base) begin
master_address <= ADDR_XCVR_RECONFIG_BASIC_DATA;
master_write_data <= AV_XR_OC_CALEN_MASK; //set the lowest bit to 1'b1 to enable oc_calen
master_write <= 1'b1; // send address to alt_dprio
master_read <= 1'b0;
state <= START_OC_CALEN_STATE;
end else begin // wait until waitrequest clears
state <= SET_OC_CALEN_DATA_STATE;
end
end
START_OC_CALEN_STATE: begin // kick off indirect operation
if (~mutex_waitrequest_from_base) begin
master_address <= ADDR_XCVR_RECONFIG_BASIC_CONTROL;
master_write_data <= XR_DIRECT_CONTROL_RECONF_WRITE;
master_write <= 1'b1; // send address to alt_dprio
master_read <= 1'b0;
state <= ADDRESS_OFFSET_STATE;
end else begin // wait until waitrequest clears
state <= START_OC_CALEN_STATE;
end
end
ADDRESS_OFFSET_STATE: begin // send address offset to alt_dprio
if (~mutex_waitrequest_from_base) begin
master_address <= ADDR_XCVR_RECONFIG_BASIC_OFFSET_ADDR;
master_write_data <= {{17{1'b0}}, alt_cal_dprio_addr[14:0]};
master_write <= 1'b1;
master_read <= 1'b0;
if(write_read_control == 1'b1) begin
state <= WRITE_DATA_STATE;
end else begin
state <= CONTROL_STATE;
end
end else begin
state <= ADDRESS_OFFSET_STATE;
end
end
WRITE_DATA_STATE: begin
if (~mutex_waitrequest_from_base) begin
master_address <= ADDR_XCVR_RECONFIG_BASIC_DATA;
master_write_data <= {{16{1'b0}}, alt_cal_dprio_dataout};
master_write <= 1'b1; // send address to alt_dprio
master_read <= 1'b0;
state <= CONTROL_STATE;
end else begin // wait until waitrequest clears
state <= WRITE_DATA_STATE;
end
end
CONTROL_STATE: begin // sending write/read command
if (~mutex_waitrequest_from_base) begin
master_address <= ADDR_XCVR_RECONFIG_BASIC_CONTROL; // get ready to send control command to alt_dprio
master_write_data <= write_read_control ? XR_DIRECT_CONTROL_RECONF_WRITE : XR_DIRECT_CONTROL_RECONF_READ; // write_read_control == 0 is a read
master_write <= 1'b1;
master_read <= 1'b0;
state <= BUSY_STATE;
end else begin
state <= CONTROL_STATE;
end
end
BUSY_STATE: begin // wait for write done
if(~mutex_waitrequest_from_base) begin // irq is deprecated - the basic now blocks (using waitrequest) until the operation is done
alt_cal_dprio_busy <= 1'b1;
if(write_read_control == 1'b0) begin //read
master_address <= ADDR_XCVR_RECONFIG_BASIC_DATA; // get the data from the DPRIO result register
master_write <= 1'b0;
master_read <= 1'b1;
alt_cal_dprio_busy <= 1'b1;
state <= READ_DATA_STATE;
end else begin
master_write <= 1'b0;
master_read <= 1'b0;
state <= WRITE_DONE_STATE; // nothing to clean up for write state
end
end else begin
alt_cal_dprio_busy <= 1'b1;
state <= BUSY_STATE;
end
end
WRITE_DONE_STATE: begin
alt_cal_dprio_busy <= 1'b0; // clear the dprio operation
master_read <= 1'b0;
master_write <= 1'b0;
master_address <= 3'h0;
master_write_data <= 32'b0;
state <= WAIT_FOR_NEXT_STATE;
end
READ_DATA_STATE: begin
if (~mutex_waitrequest_from_base) begin // make sure read was accepted
alt_cal_dprio_datain <= master_read_data[15:0];
alt_cal_dprio_busy <= 1'b0;
master_read <= 1'b0;
master_write <= 1'b0;
master_address <= 3'h0;
master_write_data <= 32'b0; // write to clear physical mutex
state <= WAIT_FOR_NEXT_STATE;
end else begin
state <= READ_DATA_STATE;
end
end
WAIT_FOR_NEXT_STATE: begin // wait here for next operation, or else wait for busy to drop and then release the physical mutex
if (~alt_cal_busy) begin // oc is done - clear the mutex
master_read <= 1'b0;
master_write <= 1'b1;
master_address <= ADDR_XCVR_RECONFIG_BASIC_CONTROL; // status and control word
master_write_data <= XR_DIRECT_CONTROL_PHYS_LOCK_CLEAR; // write to clear physical mutex
state <= RELEASE_PMUTEX_STATE; // release the physical mutex
end else begin
if((alt_cal_dprio_wren == 1'b1) || (alt_cal_dprio_rden == 1'b1)) begin
if(alt_cal_dprio_wren == 1'b1) begin
write_read_control <= 1'b1; // 1 for write
end else begin
write_read_control <= 1'b0; // 0 for read
end
if ({alt_cal_quad_addr, alt_cal_dprio_addr[13:12]} != prev_logical_channel[10:0]) begin // different channel - we need to release the mutex and unset offset cancellation mode
master_read <= 1'b0;
master_write <= 1'b1;
master_address <= ADDR_XCVR_RECONFIG_BASIC_CONTROL; // status and control word
master_write_data <= XR_DIRECT_CONTROL_PHYS_LOCK_CLEAR; // write to clear physical mutex
state <= RELEASE_PMUTEX_STATE; // release the physical mutex
end else begin // same channel - continue
state <= LOGICAL_ADDRESS_STATE; // need to change to request arbiter lock
master_write <= 1'b1; // next step is to send address to alt_dprio
master_address <= ADDR_XCVR_RECONFIG_BASIC_LOGICAL_CHANNEL;
master_write_data <= {{21{1'b0}}, alt_cal_quad_addr, alt_cal_dprio_addr[13:12]}; // the logical channel is just sent as is - we can revise alt_cal_sv.v to account for this, but leave it for now - fix me!
end
end else begin
state <= WAIT_FOR_NEXT_STATE;
end
end
end
RELEASE_PMUTEX_STATE: begin
if (~mutex_waitrequest_from_base) begin
pmutex_acquired <= 1'b0; // clear the mutex flag
master_read <= 1'b0;
master_write <= 1'b1;
master_address <= ADDR_XCVR_RECONFIG_BASIC_OFFSET_ADDR;
master_write_data <= AV_XR_LOCAL_OFFSET + AV_XR_ADDR_RSTCTL; // phy reset override control
state <= RELEASE_PHY_RESET_OVERRIDE_ADDR_STATE;
end else begin
state <= RELEASE_PMUTEX_STATE;
end
end
RELEASE_PHY_RESET_OVERRIDE_ADDR_STATE: begin
if (~mutex_waitrequest_from_base) begin
master_read <= 1'b0;
master_write <= 1'b1;
master_address <= ADDR_XCVR_RECONFIG_BASIC_DATA;
master_write_data <= (0 << AV_XR_RSTCTL_RX_RST_OVR_OFST) | (0 << AV_XR_RSTCTL_RX_ANALOG_RST_N_VAL_OFST); // release reset override
state <= RELEASE_PHY_RESET_OVERRIDE_DATA_STATE;
end else begin
state <= RELEASE_PHY_RESET_OVERRIDE_ADDR_STATE;
end
end
RELEASE_PHY_RESET_OVERRIDE_DATA_STATE: begin
if (~mutex_waitrequest_from_base) begin
master_read <= 1'b0;
master_write <= 1'b1;
master_address <= ADDR_XCVR_RECONFIG_BASIC_CONTROL;
master_write_data <= XR_DIRECT_CONTROL_RECONF_WRITE;
state <= RELEASE_PHY_RESET_OVERRIDE_START_STATE;
end else begin
state <= RELEASE_PHY_RESET_OVERRIDE_DATA_STATE;
end
end
RELEASE_PHY_RESET_OVERRIDE_START_STATE: begin
if (~mutex_waitrequest_from_base) begin
master_read <= 1'b0;
master_write <= 1'b1;
master_address <= ADDR_XCVR_RECONFIG_BASIC_OFFSET_ADDR; // status and control word
master_write_data <= AV_XR_LOCAL_OFFSET + AV_XR_ADDR_OC; // write to get hardoc_calen register
state <= RELEASE_OC_CALEN_DATA_STATE;
end else begin
state <= RELEASE_PHY_RESET_OVERRIDE_START_STATE;
end
end
RELEASE_OC_CALEN_DATA_STATE: begin
if (~mutex_waitrequest_from_base) begin
master_address <= ADDR_XCVR_RECONFIG_BASIC_DATA;
master_write_data <= 16'b0; //set the lowest bit to 1'b0 to disable oc_calen
master_write <= 1'b1; // send address to alt_dprio
master_read <= 1'b0;
state <= RELEASE_OC_CALEN_START_STATE;
end else begin // wait until waitrequest clears
state <= RELEASE_OC_CALEN_DATA_STATE;
end
end
RELEASE_OC_CALEN_START_STATE: begin
if (~mutex_waitrequest_from_base) begin
master_address <= ADDR_XCVR_RECONFIG_BASIC_CONTROL;
master_write_data <= XR_DIRECT_CONTROL_RECONF_WRITE;
master_write <= 1'b1; // send address to alt_dprio
master_read <= 1'b0;
state <= RELEASE_OC_CALEN_DONE_STATE;
end else begin // wait until waitrequest clears
state <= RELEASE_OC_CALEN_START_STATE;
end
end
RELEASE_OC_CALEN_DONE_STATE: begin
if (~mutex_waitrequest_from_base) begin
master_write <= 1'b0; // send address to alt_dprio
master_read <= 1'b0;
state <= IDLE_STATE;
end else begin // wait until waitrequest clears
state <= RELEASE_OC_CALEN_DONE_STATE;
end
end
// need to add a state to release the reset override here
default: begin
state <= IDLE_STATE;
end
endcase
end
end
alt_cal_av #(
.number_of_channels (number_of_reconfig_interfaces), // updated for AV - one reconfig interface is one channel
.channel_address_width (CLogB2(number_of_reconfig_interfaces)),
.pma_base_address (0) // for now it's 0 - we can override if it changes later
)alt_cal_inst
(
.clock(reconfig_clk),
.reset(reset),
.start(start_trigger), // start bit written - rising edge triggers start (note - no effect if OC already running)
.busy(alt_cal_busy),
.dprio_addr(alt_cal_dprio_addr), // only extract the logical channel address
.quad_addr(alt_cal_quad_addr),
.dprio_dataout(alt_cal_dprio_dataout),
.dprio_datain(alt_cal_dprio_datain),
.dprio_wren(alt_cal_dprio_wren),
.dprio_rden(alt_cal_dprio_rden),
.dprio_busy(alt_cal_dprio_busy),
.remap_addr(alt_cal_remap_addr),
.testbuses(testbus_data)
);
alt_arbiter_acq #(
.addr_width(3),
.data_width(32)
)
mutex_inst (
.clk(reconfig_clk),
.reset(reset),
// inputs to the base that should be routed through the mutex
.address(master_address),
.writedata(master_write_data),
.write(master_write),
.read(master_read),
// output from the mutex which is processed form of output from base
.waitrequest(mutex_waitrequest_from_base),
.readdata(master_read_data),
// outputs from mutex to be routed to the base
.master_address(offset_cancellation_address_base),
.master_writedata(offset_cancellation_writedata_base),
.master_write(offset_cancellation_write_base),
.master_read(offset_cancellation_read_base),
// these ports are from the base routed to the mutex
.master_waitrequest(offset_cancellation_waitrequest_from_base),
.master_readdata(offset_cancellation_readdata_base), // from MM
//request signal to the mutex should be kept high as long as the mutex is being used
.mutex_req(req_and_use_mutex),
// output from mutex indicates whether you have mutex or not
.mutex_grant(mutex_grant),
// external arbiter connections for fabric access
.arb_req(arb_req),
.arb_grant(arb_grant)
);
endmodule

View file

@ -0,0 +1,169 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
`timescale 1 ps / 1 ps
module alt_xcvr_reconfig_pll #(
parameter device_family = "Stratix V"
)
(
input wire reconfig_clk,
input wire reset,
////////////////////////////////
// User Avalon Slave interface
// User input MM slave
input wire [2:0] pll_reconfig_address,
input wire [31:0] pll_reconfig_writedata,
input wire pll_reconfig_write,
input wire pll_reconfig_read,
// User output MM slave
output wire [31:0] pll_reconfig_readdata,
output wire pll_reconfig_waitrequest,
output wire pll_reconfig_done,
///////////////////////////////
// PLL reconfiguration interface
// outputs to MIF reconfig
output wire pll_mif_busy,
output wire pll_mif_err,
// inputs from MIF reconfig
input wire pll_mif_go,
input wire pll_mif_type,
input wire [3:0] pll_mif_data,
input wire [9:0] pll_mif_lch,
input wire pll_mif_pll_type,
//////////////////////////////////
// Basic block interface
// output to base_reconfig
output wire [2:0] pll_base_address,
output wire [31:0] pll_base_writedata,
output wire pll_base_write,
output wire pll_base_read,
// input from base reconfig
input wire [31:0] pll_base_readdata,
input wire pll_base_waitrequest,
//////////////////////////////////
// Arbiter interface
output wire arb_req,
input wire arb_grant
);
import altera_xcvr_functions::*;
localparam is_s5 = has_s5_style_hssi(device_family);
localparam is_a5 = has_a5_style_hssi(device_family);
localparam is_c5 = has_c5_style_hssi(device_family);
generate
if ( is_s5 ) begin
sv_xcvr_reconfig_pll
pll_reconfig_sv
(
.reconfig_clk ( reconfig_clk ),
.reset ( reset ),
//User I/F
.pll_reconfig_address ( pll_reconfig_address ),
.pll_reconfig_writedata ( pll_reconfig_writedata ),
.pll_reconfig_write ( pll_reconfig_write ),
.pll_reconfig_read ( pll_reconfig_read ),
.pll_reconfig_readdata ( pll_reconfig_readdata ),
.pll_reconfig_waitrequest ( pll_reconfig_waitrequest ),
.pll_reconfig_done ( pll_reconfig_done ),
//PLL Reconf I/F
.pll_mif_busy ( pll_mif_busy ),
.pll_mif_err ( pll_mif_err ),
.pll_mif_go ( pll_mif_go ),
.pll_mif_type ( pll_mif_type ),
.pll_mif_data ( pll_mif_data ),
.pll_mif_lch ( pll_mif_lch ),
.pll_mif_pll_type ( pll_mif_pll_type),
//Basic I/F
.pll_base_waitrequest ( pll_base_waitrequest ),
.pll_base_address ( pll_base_address ),
.pll_base_writedata ( pll_base_writedata ),
.pll_base_write ( pll_base_write ),
.pll_base_read ( pll_base_read ),
.pll_base_readdata ( pll_base_readdata ),
//Arbiter interface
.arb_req ( arb_req ),
.arb_grant ( arb_grant )
);
end else if ( is_a5 || is_c5 ) begin
av_xcvr_reconfig_pll
pll_reconfig_av
(
.reconfig_clk ( reconfig_clk ),
.reset ( reset ),
//User I/F
.pll_reconfig_address ( pll_reconfig_address ),
.pll_reconfig_writedata ( pll_reconfig_writedata ),
.pll_reconfig_write ( pll_reconfig_write ),
.pll_reconfig_read ( pll_reconfig_read ),
.pll_reconfig_readdata ( pll_reconfig_readdata ),
.pll_reconfig_waitrequest ( pll_reconfig_waitrequest ),
.pll_reconfig_done ( pll_reconfig_done ),
//PLL Reconf I/F
.pll_mif_busy ( pll_mif_busy ),
.pll_mif_err ( pll_mif_err ),
.pll_mif_go ( pll_mif_go ),
.pll_mif_type ( pll_mif_type ),
.pll_mif_data ( pll_mif_data ),
.pll_mif_lch ( pll_mif_lch ),
//Basic I/F
.pll_base_waitrequest ( pll_base_waitrequest ),
.pll_base_address ( pll_base_address ),
.pll_base_writedata ( pll_base_writedata ),
.pll_base_write ( pll_base_write ),
.pll_base_read ( pll_base_read ),
.pll_base_readdata ( pll_base_readdata ),
//Arbiter interface
.arb_req ( arb_req ),
.arb_grant ( arb_grant )
);
end else begin
// Default case for unsupported families, just tie off outputs to idle states.
assign pll_reconfig_readdata = 32'b0;
assign pll_reconfig_waitrequest = 1'b0;
assign pll_reconfig_done = 1'b1;
assign pll_mif_busy = 1'b0;
assign pll_mif_err = 1'b0;
assign pll_base_address = 3'b0;
assign pll_base_writedata = 32'b0;
assign pll_base_write = 1'b0;
assign pll_base_read = 1'b0;
end
endgenerate
endmodule

View file

@ -0,0 +1,359 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
import altera_xcvr_functions::*;
`timescale 1 ns / 1 ns
module alt_xcvr_reconfig_soc #(
parameter device_family = "Stratix V",
parameter arb_count = 6, // Number of IPs
parameter width_awa = 3, // Number of address bits per PHY IP (direct registers)
parameter width_bwa = 3, // Number of address bits for basic block
parameter number_of_reconfig_interfaces = 1, // Number of reconfig interfaces
parameter [arb_count-1:0] enable_soc_mask = 0 // encoded bit field. Each bit acts as enable for respective IP
) (
// user reconfiguration management interface
input wire mgmt_clk,
input wire mgmt_rst,
input wire [6:0] mgmt_address,
output wire mgmt_waitrequest,
input wire mgmt_read,
output wire [31:0] mgmt_readdata,
input wire mgmt_write,
input wire [31:0] mgmt_writedata,
input wire [arb_count-1:0] mgmt_decode,
input wire [arb_count-1:0] hold, // Hold signal for IP sequencing
output wire [arb_count-1:0] busy, // Busy status per IP
input wire [arb_count-1:0] hard_busy, // Busy status input from other IP
// CPU <-> Basic interface
output wire [width_bwa-1:0] basic_address,
output wire [31:0] basic_writedata,
output wire basic_write,
output wire basic_read,
input wire [31:0] basic_readdata,
input wire basic_waitrequest,
output wire [arb_count-1:0] basic_req, // request access to B block
input wire [arb_count-1:0] basic_grant,// granted access to B block
// Testbus
input wire [7:0] lch_testbus,
input wire [23:0] pch_testbus
);
`ifdef ALTERA_RESERVED_QIS
// Enable full model for synthesis. Fast model for sim
`define ALTERA_RESERVED_XCVR_FULL_RECONFIG_SOC
`endif // ifdef ALTERA_RESERVED_QIS
`ifdef ALTERA_RESERVED_XCVR_FULL_RECONFIG_SOC
// Addresses for local registers
localparam [3:0] ADDR_RAM_OFFSET = 0,
ADDR_HOLD = 1,
ADDR_BUSY_SET = 2,
ADDR_BUSY_CLR = 3,
ADDR_BASIC_REQ_SET = 4,
ADDR_BASIC_REQ_CLR = 5,
ADDR_BASIC_GRANT = 6,
ADDR_LCH_TESTBUS = 7,
ADDR_PCH_TESTBUS0 = 8,
ADDR_PCH_TESTBUS1 = 9,
ADDR_PCH_TESTBUS2 = 10,
ADDR_IF_COUNT = 11,
ADDR_CONFIG = 12;
localparam RAM_SIZE_IN_BYTES = 4096;
localparam RAM_DEPTH = RAM_SIZE_IN_BYTES / 4;
localparam RAM_BITS = clogb2(RAM_DEPTH-1);
// CPU <-> RAM connections
wire [RAM_BITS-1:0] cpu_ram_address;
wire [ 3:0] cpu_ram_byteenable;
wire cpu_ram_write;
wire [31:0] cpu_ram_writedata;
wire [31:0] cpu_ram_readdata;
// CPU <-> control connections
wire ctrl_reset;
wire [4:0] ctrl_address;
wire ctrl_read;
wire ctrl_write;
wire [31:0] ctrl_writedata;
wire [31:0] ctrl_readdata;
wire ctrl_basic_sel; // 1 = CPU addressing basic block,
// 0 = CPU addressing local config registers
wire ctrl_local_sel; // 1 = CPU addressing local config registers
// 0 = CPU addressing basic block
wire ctrl_waitrequest;
// CPU <-> Local register signals
wire [3:0] ctrl_local_address;
wire [31:0] ctrl_local_readdata;
wire ctrl_local_read;
wire ctrl_local_write;
wire [31:0] ctrl_local_writedata;
// Busy controls
reg [arb_count-1:0] r_busy;
wire ctrl_local_busy_set;
wire ctrl_local_busy_clr;
wire mgmt_busy_set;
// MGMT <-> RAM connections
wire [RAM_BITS-1:0] mgmt_ram_address;
wire [31:0] mgmt_ram_readdata;
reg [RAM_BITS-1:0] mgmt_ram_offset; // Stores address offset of mgmt interface in RAM
wire mgmt_ram_write; // Gated mgmt_ram_write
// Basic arbitration
reg [arb_count-1:0] r_basic_req; // request access to B block
wire granted; // request & grant
// Configuration
wire is_es; // 1 - if compiled for ES, 0 otherwise
reg oc_done = 0; // 1 if OC has completed its first run, otherwise 0
wire cpu_reset_req;
// Static assignments
`ifdef ALTERA_RESERVED_QIS_ES
assign is_es = 1'b1;
`else
assign is_es = 1'b0;
`endif
// Initial register values
initial begin
r_busy = enable_soc_mask;
r_basic_req = {arb_count{1'b0}};
mgmt_ram_offset = {RAM_BITS{1'b0}};
end
//***************************************************************************
//*********************** Basic / Local Arbitration *************************
// Decode avalon signals between CPU and basic
assign ctrl_basic_sel = ctrl_address[4];
assign ctrl_local_sel = ~ctrl_basic_sel;
assign ctrl_readdata = ctrl_basic_sel ? basic_readdata : (ctrl_local_readdata & {32{ctrl_local_read}});
assign ctrl_waitrequest = ctrl_basic_sel ? basic_waitrequest : 1'b0;
// CPU -> Basic connections
assign basic_req = r_basic_req;
assign granted = |(r_basic_req & basic_grant);
assign basic_address = ctrl_address[width_bwa-1:0] & {width_bwa{granted}};
assign basic_writedata = ctrl_writedata & {32{granted}};
assign basic_write = ctrl_write & ctrl_basic_sel & granted;
assign basic_read = ctrl_read & ctrl_basic_sel & granted;
// CPU -> Local registers connection
assign ctrl_local_address = ctrl_address[3:0];
assign ctrl_local_writedata = ctrl_writedata;
assign ctrl_local_write = ctrl_write & ctrl_local_sel;
assign ctrl_local_read = ctrl_read & ctrl_local_sel;
//********************* End Basic / Local Arbitration ***********************
//***************************************************************************
//*************************************************************************
//*************************** Local Registers *****************************
// Local registers write decoder
always @(posedge mgmt_clk or posedge ctrl_reset)
if(ctrl_reset) begin
r_basic_req <= {arb_count{1'b0}}; // TODO (reset levels)
mgmt_ram_offset <= {RAM_BITS{1'b0}};
end else if(ctrl_local_write) begin
if(ctrl_local_address == ADDR_RAM_OFFSET) begin
mgmt_ram_offset <= ctrl_writedata[RAM_BITS-1:0];
end
if(ctrl_local_address == ADDR_BASIC_REQ_SET)
r_basic_req <= r_basic_req | ctrl_local_writedata[arb_count-1:0];
if(ctrl_local_address == ADDR_BASIC_REQ_CLR)
r_basic_req <= r_basic_req & ~ctrl_local_writedata[arb_count-1:0];
end
always @(posedge mgmt_clk)
begin
if(ctrl_local_write) begin
if (ctrl_local_address == ADDR_CONFIG) begin // only allow bit [30] to be writeable
oc_done <= ctrl_local_writedata[30];
end
end
end
// Local registers readback data
// We are intentionally leaving out reading certain registers to save logic
assign ctrl_local_readdata =
(ctrl_local_address == ADDR_HOLD ) ? {{32-arb_count{1'b0}},hold } :
(ctrl_local_address == ADDR_BUSY_SET ) ? {{32-arb_count{1'b0}},hard_busy } :
(ctrl_local_address == ADDR_BASIC_GRANT ) ? {{32-arb_count{1'b0}},basic_grant } :
(ctrl_local_address == ADDR_LCH_TESTBUS ) ? {24'd0,lch_testbus} :
(ctrl_local_address == ADDR_PCH_TESTBUS0) ? {24'd0,pch_testbus[ 7: 0]} :
(ctrl_local_address == ADDR_PCH_TESTBUS1) ? {24'd0,pch_testbus[15: 8]} :
(ctrl_local_address == ADDR_PCH_TESTBUS2) ? {24'd0,pch_testbus[23:16]} :
(ctrl_local_address == ADDR_IF_COUNT ) ? number_of_reconfig_interfaces[31:0] :
(ctrl_local_address == ADDR_CONFIG ) ? {is_es, oc_done, {30-arb_count{1'b0}},enable_soc_mask } :
32'd0;
//************************* End Local Registers ***************************
//*************************************************************************
//*************************************************************************
//****************************** CPU System *******************************
alt_xcvr_reconfig_cpu alt_xcvr_reconfig_cpu_inst(
// Clocks and resets
.reset_reset_n (~mgmt_rst ),
.clk_clk (mgmt_clk ),
// RAM
.reconfig_mem_reset_reset (/*unused*/ ),
.reconfig_mem_reset_reset_req (cpu_reset_req ), // reset_req
.reconfig_mem_mem_address (cpu_ram_address ),
.reconfig_mem_mem_read (/*unused*/ ),
.reconfig_mem_mem_write (cpu_ram_write ),
.reconfig_mem_mem_byteenable (cpu_ram_byteenable ),
.reconfig_mem_mem_readdata (cpu_ram_readdata ),
.reconfig_mem_mem_writedata (cpu_ram_writedata ),
// Control
.reconfig_ctrl_reset_reset (ctrl_reset ),
.reconfig_ctrl_ctrl_write (ctrl_write ),
.reconfig_ctrl_ctrl_address (ctrl_address ),
.reconfig_ctrl_ctrl_waitrequest (ctrl_waitrequest ),
.reconfig_ctrl_ctrl_readdata (ctrl_readdata ),
.reconfig_ctrl_ctrl_writedata (ctrl_writedata ),
.reconfig_ctrl_ctrl_read (ctrl_read ),
.reconfig_ctrl_ctrl_irq_irq (1'b0 )
);
//**************************** End CPU System *****************************
//*************************************************************************
//*************************************************************************
//**************************** Busy Registers *****************************
// TODO - move these to alt_xcvr_reconfig_h.sv
localparam ADDR_XR_STATUS = 2;
localparam XR_STATUS_OFST_BUSY = 8;
//
assign mgmt_busy_set = mgmt_ram_write & (mgmt_address[width_awa-1:0] == ADDR_XR_STATUS);
assign ctrl_local_busy_set = ctrl_local_write & (ctrl_local_address == ADDR_BUSY_SET);
assign ctrl_local_busy_clr = ctrl_local_write & (ctrl_local_address == ADDR_BUSY_CLR);
assign busy = r_busy;
genvar ig;
generate begin
for(ig=0;ig<arb_count;ig=ig+1) begin: busy_regs
// Busy registers
always @(posedge mgmt_clk or posedge mgmt_rst)
if(mgmt_rst)
r_busy[ig] <= enable_soc_mask[ig];
else if(mgmt_busy_set & mgmt_decode[ig]) // Set from mgmt interface
r_busy[ig] <= 1'b1;
else if(ctrl_local_busy_set) // Set from CPU
r_busy[ig] <= r_busy[ig] | ctrl_writedata[ig];
else if(ctrl_local_busy_clr) // Clear from CPU
r_busy[ig] <= r_busy[ig] & ~ctrl_writedata[ig];
end
end
endgenerate
//************************** End Busy Registers ***************************
//*************************************************************************
//*************************************************************************
//******************************* CPU RAM *********************************
// Add offset to mgmt address to access ram
assign mgmt_ram_address = mgmt_address + mgmt_ram_offset;
// Gate write access with busy registers
assign mgmt_ram_write = mgmt_write & |(mgmt_decode & ~r_busy);
// Dual-port RAM block
alt_xcvr_reconfig_cpu_ram #(
.DEPTH(RAM_DEPTH)
) alt_xcvr_reconfig_cpu_ram_inst(
// Clocks and resets
.clk (mgmt_clk ),
// Port A
.a_address (cpu_ram_address ),
.a_write (cpu_ram_write ),
.a_byteenable (cpu_ram_byteenable ),
.a_writedata (cpu_ram_writedata ),
.a_readdata (cpu_ram_readdata ),
// clock enable input of alt_sync_ram
// cpu_reset_req goes HIGH when reset is asserted and is LOW when reset
// is deasserted.
// Clock enable has to be the opposite of cpu_reset_req
.ram_ce (~cpu_reset_req ),
// Port B
.b_address (mgmt_ram_address ),
.b_write (mgmt_ram_write ),
.b_byteenable (4'b1111 ),
.b_writedata (mgmt_writedata ),
.b_readdata (mgmt_ram_readdata )
);
//***************************** End CPU RAM *******************************
//*************************************************************************
//*************************************************************************
//*************************** Avalon Interface ****************************
// Modify readdata to include busy bit for appropriate addresses
assign mgmt_readdata = (mgmt_address[width_awa-1:0] == ADDR_XR_STATUS)
? {mgmt_ram_readdata[31:(XR_STATUS_OFST_BUSY+1)],
r_busy[mgmt_address[6:width_awa]],
mgmt_ram_readdata[XR_STATUS_OFST_BUSY-1:0]}
: mgmt_ram_readdata;
// Generate waitrequest signal for managment interface
altera_wait_generate altera_wait_generate_inst(
.rst (mgmt_rst ),
.clk (mgmt_clk ),
.launch_signal(mgmt_read ),
.wait_req (mgmt_waitrequest )
);
//************************** End Avalon Interface *************************
//*************************************************************************
`else // ifdef ALTERA_RESERVED_XCVR_FULL_RECONFIG_SOC
reg oc_busy;
// No model. Drive outputs to 0. Use up all inputs to avoid warnings.
// Assert waitrequest during reset to make simulation behavior consistent
assign mgmt_waitrequest = mgmt_rst | &{1'b0,mgmt_clk, mgmt_rst, mgmt_address, mgmt_read,
mgmt_write, mgmt_writedata, hard_busy, basic_readdata,
basic_waitrequest, basic_grant, hold, lch_testbus,
pch_testbus}; // warning avoidance
assign mgmt_readdata = 32'hdeadbeef;
assign busy = {{arb_count-1{1'b0}}, oc_busy};
assign basic_address = {width_bwa{1'b0}};
assign basic_writedata = 32'd0;
assign basic_write = 1'b0;
assign basic_read = 1'b0;
assign basic_req = {arb_count{1'b0}};
initial begin
$display("[alt_xcvr_reconfig_soc.v] Full model disabled");
oc_busy = 1'b1; // fake out offset cancellation at the start - this edge is needed for the cal sequencer module
repeat (100) @ (posedge mgmt_clk);
oc_busy = 1'b0;
end
`endif // ifdef ALTERA_RESERVED_XCVR_FULL_RECONFIG_SOC
endmodule

View file

@ -0,0 +1,97 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
// Module: alt_xcvr_resync
//
// Description:
// A general purpose resynchronization module.
//
// Parameters:
// SYNC_CHAIN_LENGTH
// - Specifies the length of the synchronizer chain for metastability
// retiming.
// WIDTH
// - Specifies the number of bits you want to synchronize. Controls the width of the
// d and q ports.
// SLOW_CLOCK - USE WITH CAUTION.
// - Leaving this setting at its default will create a standard resynch circuit that
// merely passes the input data through a chain of flip-flops. This setting assumes
// that the input data has a pulse width longer than one clock cycle sufficient to
// satisfy setup and hold requirements on at least one clock edge.
// - By setting this to 1 (USE CAUTION) you are creating an asynchronous
// circuit that will capture the input data regardless of the pulse width and
// its relationship to the clock. However it is more difficult to apply static
// timing constraints as it ties the data input to the clock input of the flop.
// This implementation assumes the data rate is slow enough
// INIT_VALUE
// - Specifies the initial values of the synchronization registers.
//
// Apply embedded false path timing constraint
(* altera_attribute = "-name SDC_STATEMENT \"set regs [get_registers -nowarn *alt_xcvr_resync*sync_r[0]]; if {[llength [query_collection -report -all $regs]] > 0} {set_false_path -to $regs}\"" *)
`timescale 1ps/1ps
module alt_xcvr_resync #(
parameter SYNC_CHAIN_LENGTH = 2, // Number of flip-flops for retiming. Must be >1
parameter WIDTH = 1, // Number of bits to resync
parameter SLOW_CLOCK = 0, // See description above
parameter INIT_VALUE = 0
) (
input wire clk,
input wire reset,
input wire [WIDTH-1:0] d,
output wire [WIDTH-1:0] q
);
localparam INT_LEN = (SYNC_CHAIN_LENGTH > 1) ? SYNC_CHAIN_LENGTH : 2;
localparam [INT_LEN-1:0] L_INIT_VALUE = (INIT_VALUE == 1) ? {INT_LEN{1'b1}} : {INT_LEN{1'b0}};
genvar ig;
// Generate a synchronizer chain for each bit
generate begin
for(ig=0;ig<WIDTH;ig=ig+1) begin : resync_chains
wire d_in; // Input to sychronization chain.
(* altera_attribute = "disable_da_rule=D103" *)
reg [INT_LEN-1:0] sync_r = L_INIT_VALUE;
assign q[ig] = sync_r[INT_LEN-1]; // Output signal
always @(posedge clk or posedge reset)
if(reset)
sync_r <= L_INIT_VALUE;
else
sync_r <= {sync_r[INT_LEN-2:0],d_in};
// Generate asynchronous capture circuit if specified.
if(SLOW_CLOCK == 0) begin
assign d_in = d[ig];
end else begin
wire d_clk;
reg d_r = L_INIT_VALUE[0];
wire clr_n;
assign d_clk = d[ig];
assign d_in = d_r;
assign clr_n = ~q[ig] | d_clk; // Clear when output is logic 1 and input is logic 0
// Asynchronously latch the input signal.
always @(posedge d_clk or negedge clr_n)
if(!clr_n) d_r <= 1'b0;
else if(d_clk) d_r <= 1'b1;
end // SLOW_CLOCK
end // for loop
end // generate
endgenerate
endmodule

View file

@ -0,0 +1,208 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
// analog data control
//
//
// This state machine receives commands from the user interface
// and controls the basic block.
//
// User writes are read modify write to the basic block.
// User read data and user read physical channel requests are a single basic read.
//
// User to basic block address mapping in not part of this module.
// Modification of the read data for RMW cycles is also outside this module.
//
// $Header$
`timescale 1 ns / 1 ps
module alt_xreconf_analog_ctrlsm (
input wire clk,
input wire reset,
// user interface
input wire uif_go, // start user cycle
input wire [2:0] uif_mode, // 000=read; 001=write; 010=read physical channel
output reg uif_busy = 1'b0, // transfer in process
// basic block control interface
output reg ctrl_go = 1'b0, // start basic block cycle
output reg [2:0] ctrl_opcode = 1'b0, // 00=read; 01=write; 10=rd phy channel; 11=testbus
output reg ctrl_lock = 1'b0, // multicycle lock
input wire ctrl_wait, // transfer in process
input wire illegal_offset_f,
input wire illegal_ph_ch,
input wire lpbk_lock,
output reg lpbk_lock_ack = 1'b0
);
// state assignments
localparam [3:0] STATE_IDLE = 4'b0000;
localparam [3:0] STATE_GO = 4'b0001;
localparam [3:0] STATE_READ = 4'b0010;
localparam [3:0] STATE_RMW_GO = 4'b0011;
localparam [3:0] STATE_RMW_RD = 4'b0100;
localparam [3:0] STATE_RMW_WAIT = 4'b0101;
localparam [3:0] STATE_RMW_GO2 = 4'b0110;
localparam [3:0] STATE_RMW_WR = 4'b0111;
localparam [3:0] STATE_LOCK_CHK = 4'b1000;
localparam [3:0] STATE_GO_WRAGAIN = 4'b1001;
// user modes
localparam [2:0] UIF_MODE_RD = 3'b000;
localparam [2:0] UIF_MODE_WR = 3'b001;
localparam [2:0] UIF_MODE_PHYS = 3'b010;
// basic control commands
localparam [2:0] CTRL_OP_RD = 3'b000;
localparam [2:0] CTRL_OP_WR = 3'b001;
localparam [2:0] CTRL_OP_PHYS = 3'b010;
// declarations
reg [3:0] next_state;
reg [3:0] state;
// next state
always @(*)
begin
case (state)
STATE_IDLE : if (uif_go && uif_mode == UIF_MODE_WR && !illegal_offset_f)
next_state = STATE_RMW_GO;
else if (uif_go && !illegal_offset_f)
next_state = STATE_GO;
else
next_state = STATE_IDLE;
// GO to basic block for a read
STATE_GO: next_state = STATE_READ;
// read cycle
STATE_READ: if (!ctrl_wait)
next_state = STATE_IDLE;
else
next_state = STATE_READ;
// GO for read part of read-modify-write
STATE_RMW_GO: next_state = STATE_RMW_RD;
// read cycle of read-modify-write
STATE_RMW_RD:
if (!ctrl_wait && !illegal_ph_ch)
next_state = STATE_RMW_WAIT;
else if (!ctrl_wait && illegal_ph_ch)
next_state = STATE_IDLE;
else
next_state = STATE_RMW_RD;
// delay to modify data
STATE_RMW_WAIT: next_state = STATE_RMW_GO2;
// GO for write cycle of read-modify-write
STATE_RMW_GO2 : next_state = STATE_RMW_WR;
// write cycle of read-modify-write
STATE_RMW_WR: if (!ctrl_wait)
// next_state = STATE_IDLE;
next_state = STATE_LOCK_CHK;
else
next_state = STATE_RMW_WR;
// check lock from data control logic
// do read modify write again if lock
STATE_LOCK_CHK:
begin
if (!lpbk_lock)
next_state = STATE_IDLE;
else
next_state = STATE_GO_WRAGAIN;
end
STATE_GO_WRAGAIN:
begin
if (!uif_go)
next_state = STATE_GO_WRAGAIN;
else
next_state = STATE_RMW_GO;
end
default: next_state = STATE_IDLE;
endcase
end
// present state
always @(posedge clk or posedge reset)
begin
if (reset)
state <= STATE_IDLE;
else
state <= next_state;
end
// outputs
always @(posedge clk or posedge reset)
begin
if (reset)
begin
uif_busy <= 1'b0;
ctrl_go <= 1'b0;
ctrl_lock <= 1'b0;
ctrl_opcode <= 3'b000;
lpbk_lock_ack <= 1'b0;
end
else
begin
// busy to user
uif_busy <= (next_state != STATE_IDLE);
// go to basic
ctrl_go <= (next_state == STATE_GO) |
(next_state == STATE_RMW_GO) |
(next_state == STATE_RMW_GO2);
// lock to basic
if (!lpbk_lock)
begin
ctrl_lock <= (next_state == STATE_RMW_GO) |
(next_state == STATE_RMW_RD);
end
else
begin
ctrl_lock <= (next_state == STATE_RMW_GO) |
(next_state == STATE_RMW_RD) |
(next_state == STATE_RMW_WAIT) |
(next_state == STATE_RMW_GO2) |
(next_state == STATE_RMW_WR) |
(next_state == STATE_LOCK_CHK) |
(next_state == STATE_GO_WRAGAIN);
end
lpbk_lock_ack <= (next_state == STATE_GO_WRAGAIN);
// opcode to basic
if ((next_state == STATE_IDLE) || (next_state == STATE_GO_WRAGAIN))
ctrl_opcode <= CTRL_OP_RD;
else if ((next_state == STATE_GO) && (uif_mode == UIF_MODE_PHYS))
ctrl_opcode <= CTRL_OP_PHYS;
else if (next_state == STATE_RMW_GO2)
ctrl_opcode <= CTRL_OP_WR;
end
end
endmodule

View file

@ -0,0 +1,572 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
// Analog Data control Interface Block
// This Block talks with common uif (alt_xreconf_uif) and cif (alt_xreconf_cif) interface
//
// $Header$
`timescale 1 ns / 1 ps
module alt_xreconf_analog_datactrl_av
#(
parameter RECONFIG_USER_ADDR_WIDTH = 3,
parameter RECONFIG_USER_DATA_WIDTH = 32,
parameter RECONFIG_USER_OFFSET_WIDTH=6,
parameter RECONFIG_BASIC_OFFSET_ADDR_WIDTH=11
) (
// Inputs
input wire clk,
input wire reset,
// from/to uif module
input wire [RECONFIG_USER_OFFSET_WIDTH-1:0] uif_addr_offset,
input wire uif_go,
input wire [2:0] uif_mode,
input wire [RECONFIG_USER_DATA_WIDTH-1:0] uif_writedata,
output wire uif_busy ,
output reg uif_illegal_pch_error = 1'b0,
output reg uif_illegal_offset_error = 1'b0,
output reg [RECONFIG_USER_DATA_WIDTH-1:0] uif_readdata = 32'd0,
// from/to cif module
output wire ctrl_go,
output wire [2:0] ctrl_opcode,
output wire ctrl_lock,
input wire ctrl_wait, // connect this to waitrequest from cif block
input wire ctrl_illegal_phy_ch,
input wire [RECONFIG_USER_DATA_WIDTH-1:0] ctrl_readdata, // readadata from cif block
output wire [RECONFIG_USER_DATA_WIDTH-1:0] ctrl_writedata, // this is read modified data from rmw block
output reg [RECONFIG_BASIC_OFFSET_ADDR_WIDTH-1:0] ctrl_addr_offset, // ch_offset_addr
input wire waitrequest_from_base
);
reg [4:0] analog_offset = 5'b00000;
reg [4:0] analog_length = 5'b00000;
import alt_xcvr_reconfig_h::*; //alt_xcvr_reconfig/alt_xcvr_reconfig/alt_xcvr_reconfig_h.sv
import av_xcvr_h::*; //altera_xcvr_generic/av/av_xcvr_h.sv
// Preempashsis pretap and Posttap2 Implementation
// RX DCGAIN implemnatation is similar to SIVGX
//////////////////////////////////////////////////
//Port | DRIO CRAM bit value
//2..0 | 10..7
//////////////////////////////////////////////////
//000 | 0000
//001 | 0001
//010 | 0011
//011 | 0111
//100 | 1111
//Others | Assume to be 1's
// bit offsets and bit length for all features
localparam [4:0] TX_VOD_BIT_OFFSET = 6;
localparam [4:0] TX_VOD_BIT_LENGTH = 6;
// pretap, 1st posttap and 2nd psoattap all backened address is same ch_reg_3
localparam [4:0] TX_PRETAP_INV_BIT_OFFSET = 1;
localparam [4:0] TX_PRETAP_INV_LENGTH = 1;
localparam [4:0] TX_PRETAP_BIT_OFFSET = 12;
localparam [4:0] TX_PRETAP_LENGTH = 4;
localparam [4:0] TX_POSTTAP1_BIT_OFFSET = 2;
localparam [4:0] TX_POSTTAP1_LENGTH = 5;
localparam [4:0] TX_POSTTAP_2INV_BIT_OFFSET = 0;
localparam [4:0] TX_POSTTAP_2INV_LENGTH = 1;
localparam [4:0] TX_POSTTAP2_BIT_OFFSET = 8;
localparam [4:0] TX_POSTTAP2_LENGTH = 4;
localparam [4:0] RX_DCGAIN_BIT_OFFSET = 2;
localparam [4:0] RX_DCGAIN_LENGTH = 1;
localparam [4:0] RX_EQASET_BIT_OFFSET = 14;
localparam [4:0] RX_EQASET_LENGTH = 2;
localparam [4:0] RX_EQVSET_BIT_OFFSET = 0;
localparam [4:0] RX_EQVSET_LENGTH = 2;
// For Loopback need to do 2 cosecutive writes
// First write to CRAM rrevlb_sw (1 for postcdr and 0 for precdr)
// Then write to cram rrx_dlpbk for pre-cdr and rcru_rlpbk for postcdr
localparam [4:0] RCRU_RLBK_BIT_OFFSET = 14;
localparam [4:0] RCRU_RLBK_BIT_LENGTH = 1;
localparam [4:0] RREVLB_SW_BIT_OFFSET = 10;
localparam [4:0] RREVLB_SW_BIT_LENGTH = 1;
localparam [4:0] RRX_DLPBK_BIT_OFFSET = 3;
localparam [4:0] RRX_DLPBK_BIT_LENGTH = 1;
// user modes
localparam [2:0] UIF_MODE_RD = 3'b000;
localparam [2:0] UIF_MODE_WR = 3'b001;
localparam [2:0] UIF_MODE_PHYS = 3'b010;
reg [31:0] datain_rmw = 32'h00000000;
wire [31:0] analog_rddata;
integer i =0;
reg rxdcgain_f = 1'b0;
reg lpbk_lock = 1'b0;
wire lpbk_lock_ack;
reg lpbk_go = 1'b0;
reg lpbk_done = 1'b0;
reg lpbk_precdr_reg = 1'b0;
reg lpbk_postcdr_reg = 1'b0;
reg precdr_lpbk_f = 1'b0;
reg postcdr_lpbk_f = 1'b0;
reg eqctrl_f = 1'b0;
reg illegal_offset_f = 1'b0;
// This block decodes the uif_addr_offset and assigns proper bit_offset, bit_length and
// write data for read modify write (rmw) module
// It also assigns the ctrl_addr_offset for CIF function
// uif_addr_offset is from UIF block when address is offset address and write is enabled
always @(*)
begin
rxdcgain_f = 1'b0;
precdr_lpbk_f = 1'b0;
postcdr_lpbk_f = 1'b0;
eqctrl_f = 1'b0;
illegal_offset_f = 1'b0;
case (uif_addr_offset)
XR_ANALOG_OFFSET_VOD:
begin
analog_offset= TX_VOD_BIT_OFFSET;
analog_length = TX_VOD_BIT_LENGTH;
ctrl_addr_offset = RECONFIG_PMA_CH0_VOD;
datain_rmw = uif_writedata;
end
XR_ANALOG_OFFSET_PREEMPH1T:
begin
analog_offset = TX_POSTTAP1_BIT_OFFSET;
analog_length = TX_POSTTAP1_LENGTH;
ctrl_addr_offset = RECONFIG_PMA_CH0_POSTTAP1;
datain_rmw = uif_writedata;
end
XR_ANALOG_OFFSET_RXDCGAIN:
begin
analog_offset = RX_DCGAIN_BIT_OFFSET;
analog_length = RX_DCGAIN_LENGTH;
ctrl_addr_offset = RECONFIG_PMA_CH0_RX_EQDCGAIN;
rxdcgain_f = 1'b1;
datain_rmw [31:1] = 31'd0;
if (uif_writedata[0] == 1'b0)
datain_rmw[0] = 1'b0;
else if (uif_writedata[0] == 1'b1)
datain_rmw[0] = 1'b1;
else
datain_rmw[0] = 1'b1;
end // case: XR_ANALOG_OFFSET_RXDCGAIN
// For PRECDR Loopback need to do 2 cosecutive writes
// First write to CRAM rrevlb_sw 0 for precdr
// Then write to cram rrx_dlpbk to 1"
XR_ANALOG_OFFSET_PRECDRLPBK:
begin
precdr_lpbk_f = 1'b1;
if (!lpbk_lock_ack & !lpbk_done)
begin
datain_rmw = {{31{1'b0}}, 1'b0}; // First write 0 to rrevlb_sw
analog_offset = RREVLB_SW_BIT_OFFSET;
analog_length = RREVLB_SW_BIT_LENGTH;
ctrl_addr_offset = RECONFIG_PMA_CH0_RREVLB_SW;
end
else
begin
datain_rmw = {{31{1'b0}}, uif_writedata[0]}; // Now write user entered data[0] to cram rrx_dlpbk
analog_offset = RRX_DLPBK_BIT_OFFSET;
analog_length = RRX_DLPBK_BIT_LENGTH;
ctrl_addr_offset = RECONFIG_PMA_CH0_RRX_DLPBK;
end // else: !if(!lpbk_lock_ack)
end // case: XR_ANALOG_OFFSET_PRECDRLPBK
// For POSTCDR Loopback need to do 2 cosecutive writes
// First write to CRAM rrevlb_sw 1 for precdr
// Then write to cram rcru_rlpbk to 1"
XR_ANALOG_OFFSET_POSTCDRLPBK:
begin
postcdr_lpbk_f = 1'b1;
if (!lpbk_lock_ack & !lpbk_done)
begin
datain_rmw = {{31{1'b0}}, 1'b1}; // First write 1 to rrevlb_sw
analog_offset = RREVLB_SW_BIT_OFFSET;
analog_length = RREVLB_SW_BIT_LENGTH;
ctrl_addr_offset = RECONFIG_PMA_CH0_RREVLB_SW;
end
else
begin
datain_rmw = {{31{1'b0}}, uif_writedata[0]}; // Now write user entered data[0] to cram rcru_rlbk
analog_offset = RCRU_RLBK_BIT_OFFSET;
analog_length = RCRU_RLBK_BIT_LENGTH;
ctrl_addr_offset = RECONFIG_PMA_CH0_RCRU_RLBK;
end // else: !if(!lpbk_lock_ack)
end // case: XR_ANALOG_OFFSET_PRECDRLPBK
// For EQCTRL need to do 2 cosecutive writes (eqa & eqv registers)
// EQCTRL
XR_ANALOG_OFFSET_RXEQCTRL:
begin
//debug add code here
eqctrl_f = 1'b1;
if (!lpbk_lock_ack & !lpbk_done)
begin
analog_offset = RX_EQASET_BIT_OFFSET;
analog_length = RX_EQASET_LENGTH;
ctrl_addr_offset = RECONFIG_PMA_CH0_RX_EQA;
// First write 2 bits to rrx_eqa_set
datain_rmw [31:2] = 30'd0;
case (uif_writedata[1:0])
2'b00: //L0
begin
datain_rmw[1:0] = 2'b00; //eqa
end
2'b01: //L1
begin
datain_rmw[1:0] = 2'b10; //eqa
end
2'b10: //L2
begin
datain_rmw[1:0] = 2'b11; //eqa
end
default:
begin
datain_rmw[1:0] = 2'b11; //eqa
end
endcase // case (uif_writedata[1:0])
end
else
begin
//datain_rmw = {{30{1'b0}}, uif_writedata[1:0]};
analog_offset = RX_EQVSET_BIT_OFFSET;
analog_length = RX_EQVSET_LENGTH;
ctrl_addr_offset = RECONFIG_PMA_CH0_RX_EQV;
// First write 2 bits to rrx_eqv_set
datain_rmw [31:2] = 30'd0;
case (uif_writedata[1:0])
2'b00: //L0
begin
datain_rmw[1:0] = 2'b00; //eqv
end
2'b01: //L1
begin
datain_rmw[1:0] = 2'b00; //eqv
end
2'b10: //L2
begin
datain_rmw[1:0] = 2'b11; //eqv
end
default:
begin
datain_rmw[1:0] = 2'b11; //eqv
end
endcase // case (uif_writedata[1:0])
end // else: !if(!lpbk_lock_ack)
end // case: XR_ANALOG_OFFSET_RXEQCTRL
default:
begin
analog_offset= 5'b00000;
analog_length = 5'b00000;
ctrl_addr_offset = 11'd0;
datain_rmw = 32'd0;
illegal_offset_f = 1'b1;
end
endcase // case (add_offset)
end // always @ (*)
// assert lpbk_lock only if PRECDR or POSTCDR loopback offset or eq control is enabled (which requires 2 writes to seperate registers)
always @(posedge clk or posedge reset)
begin
if (reset)
lpbk_lock <= 1'b0;
else
begin
if ((uif_addr_offset == XR_ANALOG_OFFSET_PRECDRLPBK || uif_addr_offset == XR_ANALOG_OFFSET_POSTCDRLPBK) & !lpbk_lock_ack)
begin
if (analog_offset == RREVLB_SW_BIT_OFFSET)
lpbk_lock <= 1'b1;
else
lpbk_lock <= 1'b0;
end
else if ((uif_addr_offset == XR_ANALOG_OFFSET_RXEQCTRL) & !lpbk_lock_ack)
begin
if (analog_offset == RX_EQASET_BIT_OFFSET)
lpbk_lock <= 1'b1;
else
lpbk_lock <= 1'b0;
end
else
lpbk_lock <= 1'b0;
end // else: !if(reset)
end // always @ (posedge clk or posedge reset)
// Following block asserts the lpbk_go signal for control state machien which controls the ctrl_lock, ctrl_go
// and ctrl_opcode for CIF block
always @(posedge clk or posedge reset)
begin
if (reset)
begin
lpbk_go <= 1'b0;
end
else
begin
if (uif_addr_offset == XR_ANALOG_OFFSET_PRECDRLPBK || uif_addr_offset == XR_ANALOG_OFFSET_POSTCDRLPBK || uif_addr_offset == XR_ANALOG_OFFSET_RXEQCTRL)
begin
if (lpbk_lock_ack)
begin
lpbk_go <= 1'b1;
end
else
lpbk_go <= 1'b0;
end
else
begin
lpbk_go <= 1'b0;
end
end // always @ (posedge clk or posedge reset)
end // always @ (posedge clk or posedge reset)
always @(posedge clk or posedge reset)
begin
if (reset)
lpbk_done <= 1'b0;
else
begin
if (uif_addr_offset == XR_ANALOG_OFFSET_PRECDRLPBK || uif_addr_offset == XR_ANALOG_OFFSET_POSTCDRLPBK || uif_addr_offset == XR_ANALOG_OFFSET_RXEQCTRL)
begin
if (lpbk_lock_ack)
lpbk_done <= 1'b1;
else
if (lpbk_done & !lpbk_go & !uif_busy)
begin
lpbk_done <= 1'b0;
end
end
else
lpbk_done <= 1'b0;
end // else: !if(reset)
end // always @ (posedge clk or posedge reset)
// Store precdr and postcdr Loopback values in internal register for reading purpose
always @(posedge clk or posedge reset)
begin
if (reset)
begin
lpbk_precdr_reg <= 1'b0;
lpbk_postcdr_reg <= 1'b0;
end
else
begin
if (uif_addr_offset == XR_ANALOG_OFFSET_PRECDRLPBK && uif_mode == UIF_MODE_WR)
lpbk_precdr_reg <= uif_writedata[0];
else if (uif_addr_offset == XR_ANALOG_OFFSET_POSTCDRLPBK && uif_mode == UIF_MODE_WR)
lpbk_postcdr_reg <= uif_writedata[0];
end // else: !if(reset)
end // always @ (posedge clk or posedge reset)
// Assert uif_illegal_pch_error
always @(posedge clk or posedge reset)
begin
if (reset)
uif_illegal_pch_error <= 1'b0;
else
begin
if (ctrl_illegal_phy_ch)
uif_illegal_pch_error <= 1'b1;
else
uif_illegal_pch_error <= 1'b0;
end
end
// Assert uif_illegal_offset_error
always @(posedge clk or posedge reset)
begin
if (reset)
uif_illegal_offset_error <= 1'b0;
else
begin
if (illegal_offset_f)
uif_illegal_offset_error <= 1'b1;
else
uif_illegal_offset_error <= 1'b0;
end
end
// Control state machine which reads uif and lpbk go signal
// and gives ctrl_go, ctrl_opcode and ctrl_lock to ths cif block
// this state machine looks for the lpbk_lock signal and does 2 consecutive writes
// at the end of first write aserted the lpbk_ack signal for 1 clock cycle
alt_xreconf_analog_ctrlsm
inst_analog_ctrlsm (
.clk(clk),
.reset(reset),
.uif_go(uif_go | lpbk_go),
.uif_mode(uif_mode),
.uif_busy(uif_busy),
.ctrl_go(ctrl_go),
.ctrl_opcode(ctrl_opcode),
.ctrl_lock(ctrl_lock),
.ctrl_wait(ctrl_wait),
.lpbk_lock(lpbk_lock),
.lpbk_lock_ack(lpbk_lock_ack),
.illegal_offset_f(illegal_offset_f),
.illegal_ph_ch(ctrl_illegal_phy_ch)
);
// Read modify write module - Takes in the writedata from user and readdata from control block (cif block)
// and does masking and shifting and returns the modified data for Basic
alt_xreconf_analog_rmw_av #(
.DATA_WIDTH(32)
) inst_rmw_sm (
.clk(clk),
.reset(reset),
.offset(analog_offset),
.length(analog_length),
.waitrequest_from_base(waitrequest_from_base),
.uif_mode(uif_mode),
.writedata(datain_rmw),
.readdata(ctrl_readdata),
.outdata(ctrl_writedata)
);
//right shift the read data from control block (basic block) with offset to align it to lsb
assign analog_rddata = ctrl_readdata >> analog_offset;
// Read logic, assign uf_readdata with proper value when mode is UIF_MODE_RD
always @(*)
begin
i = 0;
if (uif_mode == UIF_MODE_RD)
begin
if (rxdcgain_f)
begin
uif_readdata[31:1] = 31'd0;
if (analog_rddata[0] == 1'b0)
uif_readdata[0] = 1'b0;
else if (analog_rddata[0] == 1'b1)
uif_readdata[0] = 1'b1;
else
uif_readdata[0] = 1'b0;
end // if (rxdcgain_f)
else if (precdr_lpbk_f)
begin
uif_readdata[31:1] = 31'd0;
uif_readdata[0] = lpbk_precdr_reg;
end
else if (postcdr_lpbk_f)
begin
uif_readdata[31:1] = 31'd0;
uif_readdata[0] = lpbk_postcdr_reg;
end
else if (eqctrl_f)
begin
uif_readdata[31:2] = 30'd0;
if (analog_rddata[1:0] == 2'b00) //read from eqa - 00(L0), 10(L1), 11(L2)
uif_readdata[1:0] = 2'b00; //EQ ctrl L0
else if (analog_rddata[1:0] == 2'b10)
uif_readdata[1:0] = 2'b01; //EQ ctrl L1
else if (analog_rddata[1:0] == 2'b11)
uif_readdata[1:0] = 2'b10; //EQ ctrl L2
else
uif_readdata[1:0] = 2'b00;
end
else
begin
for (i = 0; i<= 31; i=i+1)
begin
if (i >= analog_length)
uif_readdata[i] = 1'b0;
else
uif_readdata[i] = analog_rddata[i];
end
end // else: !if(posttap2_f)
end // if (uif_mode == UIF_MODE_RD)
else
uif_readdata = analog_rddata;
end // always @ (*)
endmodule // alt_xreconf_analog_datactrl_av

View file

@ -0,0 +1,104 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
// Common Read Modify Write module for Analog reconfig
//
// $Header$
`timescale 1 ns / 1 ps
module alt_xreconf_analog_rmw_av
#(
parameter DATA_WIDTH=32
) (
input wire clk,
input wire reset,
input wire [4:0] offset,
input wire [4:0] length,
input wire waitrequest_from_base,
input wire [2:0] uif_mode,
input wire [DATA_WIDTH-1:0] writedata,
input wire [DATA_WIDTH-1:0] readdata,
output reg [DATA_WIDTH-1:0] outdata
);
reg [31:0] mask_wd_reg = 32'h00000000;
reg [31:0] mask_wd_reg_2 = 32'h00000000;
wire [31:0] shifted_mask_wd;
wire [31:0] shifted_mask_wd2;
wire [31:0] inv_shifted_mask_wd2;
wire [31:0] wd_and_rd;
wire [31:0] result_data;
reg [31:0] final_data = 32'h00000000;
integer i;
// mask write data
// decode length, if i < = length then mask that bit and put it as it is
// if i >= length then write 0 to those bits
// e.g. say length is 6 bits then writedata[5:0] = 6'b101101
// mask_wd_reg = 16'b0, 6'6'b101101
always @(*)
begin
for (i = 0; i< 32; i=i+1)
begin
if (i>=length) //
begin
mask_wd_reg[i] = writedata[i] & 1'b0;
mask_wd_reg_2[i] = writedata[i] & 1'b0;
end
else
begin
mask_wd_reg[i] = writedata[i] & 1'b1;
mask_wd_reg_2[i] = 1'b1;
end
end
end // always @ (*)
// shift the masked bits with offset 2 times
assign shifted_mask_wd = mask_wd_reg << offset;
assign shifted_mask_wd2 = mask_wd_reg_2 << offset;
// Assemble the result_data based on masked writedata and readdata (from basic)
// assign inv_shifted_mask_wd = ~shifted_mask_wd;
assign inv_shifted_mask_wd2 = ~shifted_mask_wd2;
assign wd_and_rd = readdata & inv_shifted_mask_wd2;
assign result_data = wd_and_rd | shifted_mask_wd;
always @(*)
begin
final_data = result_data;
end
// Assemble writedata till reconfig basic gives back the readata
always @(posedge clk or posedge reset)
begin
if (reset)
begin
outdata <= 32'h00000000;
end
else
begin
if (!waitrequest_from_base & uif_mode == 3'b001)
outdata <= final_data;
end
end // always (posedge clk or posedge reset)
endmodule // top_data

View file

@ -0,0 +1,598 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
////////////////////////////////////////////////////////
// Reconfig BASIC Acquistion block Code
//
////////////////////////////////////////////////////////
// Reconfig IP and Reconfig basic State machine
////////////////////////////////////////////////////////
//
// The minimum steps to read & write a reconfiguration word are the following:
// Step 1 - Check for mutex grant
// Step 2 - write logical channel number to ADDR_XCVR_RECONFIG_BASIC_LOGICAL_CHANNEL = 1
// Step 3 - acquire channel lock
// 3a - request channel lock (write XR_DIRECT_CONTROL_PHYS_LOCK_SET to ADDR_XCVR_RECONFIG_BASIC_CONTROL = 3)
// 3b - confirm channel lock (read ADDR_XCVR_RECONFIG_BASIC_CONTROL, mask with XR_DIRECT_STATUS_BITMASK_PHYS_LOCK_GRANTED)
// -- repeat step 3b until result after applying mask is 1
// Step 4 - write channel offset address to ADDR_XCVR_RECONFIG_BASIC_OFFSET_ADDR
// Step 5 - read existing value from reconfig space, modify, then write back
// 5a (read cycle part 1) - write XR_DIRECT_CONTROL_RECONF_READ to ADDR_XCVR_RECONFIG_BASIC_CONTROL = 3;
// 5b (read cycle part 2) - read data from ADDR_XCVR_RECONFIG_BASIC_DATA = 5;
// 5c (write cycle part 1) - write modified value to ADDR_XCVR_RECONFIG_BASIC_DATA = 5;
// 5d (write cycle part 2) - write XR_DIRECT_CONTROL_RECONF_WRITE to ADDR_XCVR_RECONFIG_BASIC_CONTROL
// -- addtional read-modify-write cycles, repeat from step 2 or 4 (can skip step 3)
// Step 6 - release channel lock (write XR_DIRECT_CONTROL_PHYS_LOCK_CLEAR to ADDR_XCVR_RECONFIG_BASIC_CONTROL)
// Step 7 - release mutex_request
//
// For read cycle
// Update step5 as
// 5a (read cycle part 1) - write XR_DIRECT_CONTROL_RECONF_READ to ADDR_XCVR_RECONFIG_BASIC_CONTROL = 3;
// 5b (read cycle part 2) - read data from ADDR_XCVR_RECONFIG_BASIC_DATA = 5;
// 5c read cycle part 3) - read and shift the data read from master_readdata
// $Header$
`timescale 1 ns / 1 ps
module alt_xreconf_basic_acq
#(
parameter OFFSET_ADDR_WIDTH = 11,
parameter MASTER_ADDR_WIDTH = 3
) (
input wire clk,
input wire reset,
// to/from data control logic which handles, opcode generation and rmw, data control logic
input wire ctrl_go, // go from data control_logic, which tells go and start the operation and acquire mutex
input wire ctrl_lock, // lock from data control_logic indicates want to do more operations
input wire [2:0] opcode,
input wire [31:0] ctrl_writedata, // read modified writedata from rmw block
output reg illegal_phy_ch = 1'b0,
output reg waitrequest_to_ctrl = 1'b0,
// to/from uif block
input wire [9:0] logical_ch_addr,
input wire [OFFSET_ADDR_WIDTH-1:0] ch_offset_addr, // same as backend address
input wire waitrequest_from_basic,
output reg [31:0] readdata_for_user = 32'h00000000, // Actual readdaa
output reg [31:0] ph_readdata = 32'h00000000, // Actual readdaa
// From/to mutex_acq
input wire [31:0] master_readdata,
input wire mutex_grant,
output reg mutex_req = 1'b0,
// Following outputs to mutex_acq block
output reg master_read = 1'b0,
output reg master_write = 1'b0,
output reg [31:0] master_writedata = 32'h00000000,
output reg [MASTER_ADDR_WIDTH-1:0] master_address = {MASTER_ADDR_WIDTH{1'b0}}
);
// Opcode encoding
localparam READ_CH_ADD = 3'b000;
localparam WRITE_CH_ADD = 3'b001;
localparam READ_PHY_CH = 3'b010;
localparam WRITE_INTERNAL_REGISTER = 3'b011;
localparam READ_INTERNAL_ROM_TABLE = 3'b100;
localparam READ_PHY_ADD = 3'b101;
localparam WRITE_PHY_ADD = 3'b110;
// Memory Map for reconfig basic
// word addr wr/rd description
// ------------------------------------------------------
// 0 wr/rd mutex : bit[0]
// 1 wr/rd logical_ch_addr (10 bits)
// 2 rd physical_chnl_map
// 3 rd/wr status/control -- bit 0 busy/bit 1 read, bit 2 write, bit 3 = absolute addressing
// 4 wr/rd DPRIO addr_offset
// 5 wr/rd DPRIO data
// 6 -- reserved
// 7 -- reserved
////////////////////////////////////////////////////////
// Basic block addresses (internal, private addresses)
////////////////////////////////////////////////////////
// The 'basic' interface block is the switch that routes requests to
// an appropriate physical reconfiguration interface. A logical channel
// number acts as a channel ID, which allows the basic block to find
// the corresponding physical reconfiguration interface, and a physical
// channel index within a physical interface.
//
// The Basic (B) block features are also available via the direct access block.
// All users of the basic block, including the direct access block, must
// acquire appropriate semaphores before using an interface, and release
// the semaphores when done, to avoid locking out other feature blocks.
// localparam [W_XR_FEATURE_LADDR-1:0] ADDR_XCVR_RECONFIG_BASIC_MUTEX = 0;
// localparam [W_XR_FEATURE_LADDR-1:0] ADDR_XCVR_RECONFIG_BASIC_LOGICAL_CHANNEL = 1;
// localparam [W_XR_FEATURE_LADDR-1:0] ADDR_XCVR_RECONFIG_BASIC_PHYSICAL_CHANNEL = 2;
// localparam [W_XR_FEATURE_LADDR-1:0] ADDR_XCVR_RECONFIG_BASIC_CONTROL = 3;
// localparam [W_XR_FEATURE_LADDR-1:0] ADDR_XCVR_RECONFIG_BASIC_OFFSET_ADDR = 4;
// localparam [W_XR_FEATURE_LADDR-1:0] ADDR_XCVR_RECONFIG_BASIC_DATA = 5;
import alt_xcvr_reconfig_h::*; //alt_xcvr_reconfig/alt_xcvr_reconfig/alt_xcvr_reconfig_h.sv
localparam ST_IDLE = 4'h0,
ST_REQ_MUTEX = 4'h1,
ST_WRITE_RECONFIG_BASIC_LCH = 4'h2,
ST_READ_PHY_ADDRESS = 4'h3,
ST_CHECK_PHY_ADD_LEGAL = 4'h4,
//ST_REQ_RECONFIG_BASIC_CH_LOCK = 4'h5,
ST_SET_RECONFIG_BASIC_PADDR_MODE = 4'h5,
ST_CONFIRM_RECONFIG_BASIC_CH_LOCK = 4'h6,
ST_ACCESS_RECONFIG_BASIC_OFFSET_REG = 4'h7,
ST_WRITE_DATA_TO_RECONFIG_BASIC = 4'h8,
ST_SET_RECONFIG_BASIC_WRITE = 4'h9,
ST_SET_RECONFIG_BASIC_READ = 4'ha,
ST_READ_RECONFIG_BASIC_DATA = 4'hb,
ST_CHECK_CTRLLOCK =4'hc,
ST_START_AGAIN = 4'hd,
ST_RELEASE_REQ = 4'he,
ST_CLR_RECONFIG_BASIC_PADDR_MODE = 4'hf;
reg [3:0] state = 4'b0000;
reg [3:0] next_state = 4'b0000;
reg lch_legal; //save logical channel legality check is the same LCH is continuously used
reg [9:0] lch_dly;
reg phy_addr_is_set;
wire lch_changed;
always @(posedge clk or posedge reset)
begin
if (reset)
lch_dly <= 10'd0;
else
lch_dly <= logical_ch_addr;
end
// detect a change in the logical channel to determine if we need to re-check legality
assign lch_changed = lch_dly != logical_ch_addr;
always @(posedge clk or posedge reset)
begin
if (reset)
lch_legal <= 1'd0;
else begin
if(lch_changed || opcode == READ_PHY_CH)
lch_legal <= 1'd0;
else if(state == ST_CHECK_PHY_ADD_LEGAL && next_state == ST_CONFIRM_RECONFIG_BASIC_CH_LOCK)
lch_legal <= 1'b1;
end
end
// create a flag to track whether physicall addressing is set.
// we switch back to logical addressing after each physical read/write request.
always @(posedge clk or posedge reset)
begin
if (reset)
phy_addr_is_set <= 1'd0;
else begin
if(next_state == ST_CLR_RECONFIG_BASIC_PADDR_MODE )
phy_addr_is_set <= 1'd0;
else if(next_state == ST_SET_RECONFIG_BASIC_PADDR_MODE)
phy_addr_is_set <= 1'b1;
end
end
localparam ILLEGAL_PHYSICAL_CHNL = 3'b111;
// State machine which controls the communication with basic B block
// Using three always blocks - registered outputs style
// state
always @(posedge clk or posedge reset)
begin
if (reset)
state <= ST_IDLE;
else
state <= next_state;
end
// Following state machine reads the go siganl and opcode from UIF block and generates the RD, WR for basic B block
// Typical flow for CH Address WR
// 1) Read LCH, 2) Read PCH from basic 3) Check PCH is legal 4) Acquire lock 5) Confirm basic lock
// 6) if write opcode then write data reg 7) set basic wr bit "1" 8) check lock input, if no lock then release req
// 9) if ctrl_go then repeat step 6
//
// For Read Cycle
// 1) Read LCH, 2) Read PCH from basic 3) Check PCH is legal 4) Acquire lock 5) Confirm basic lock
// 6) if read opcode then set basic rd bit "1" 7) Read data from basic 8) check lock input, if no lock then release req
// 9) if ctrl_go then repeat step 6
// next_state
always @(*)
begin
next_state = state;
case (state)
ST_IDLE:
begin
if (ctrl_go)
begin
if (opcode == WRITE_CH_ADD || opcode == READ_CH_ADD ||
opcode == WRITE_PHY_ADD || opcode == READ_PHY_ADD ||
opcode == READ_PHY_CH || opcode == WRITE_INTERNAL_REGISTER ||
opcode == READ_INTERNAL_ROM_TABLE)
next_state = ST_REQ_MUTEX;
else
next_state = ST_IDLE;
end
else
next_state = ST_IDLE;
end // case: ST_IDLE
ST_REQ_MUTEX:
begin
if (mutex_grant)
next_state = ST_WRITE_RECONFIG_BASIC_LCH;
else
next_state = ST_REQ_MUTEX;
end
ST_WRITE_RECONFIG_BASIC_LCH: // send logical channel address // step 2
begin
if (!waitrequest_from_basic && !lch_legal)
begin
next_state = ST_READ_PHY_ADDRESS;
end
//new
else if (!waitrequest_from_basic && lch_legal)
begin
next_state = ST_CONFIRM_RECONFIG_BASIC_CH_LOCK;
end
end
ST_READ_PHY_ADDRESS:
begin
if (!waitrequest_from_basic)
next_state = ST_CHECK_PHY_ADD_LEGAL;
end
ST_CHECK_PHY_ADD_LEGAL:
begin
if (master_readdata[2:0] == ILLEGAL_PHYSICAL_CHNL)
begin
//synopsys translate_off
$display ("Illegal physical address: 10'h%h", master_readdata);
$display ("Time: %0t Instance: %m", $time);
// synopsys translate_on
next_state = ST_IDLE;
end
else
begin
if (!waitrequest_from_basic)
begin
if (opcode == READ_PHY_CH) // if cmd phy ch read then read phy ch and check for ctrl_lock
next_state = ST_CHECK_CTRLLOCK;
else
//next_state = ST_REQ_RECONFIG_BASIC_CH_LOCK;
next_state = ST_CONFIRM_RECONFIG_BASIC_CH_LOCK; //Basic lock is automatically aquired by logical interface
end
end // else: !if(master_readdata[2:0] = ILLEGAL_PHYSICAL_CHNL)
end // case: ST_CHECK_PHY_ADD_LEGAL
/*
ST_REQ_RECONFIG_BASIC_CH_LOCK: // step 3a
begin
if (!waitrequest_from_basic)
next_state = ST_CONFIRM_RECONFIG_BASIC_CH_LOCK;
end
*/
ST_CONFIRM_RECONFIG_BASIC_CH_LOCK: // step 3b
begin
if (!waitrequest_from_basic)
begin
if (master_readdata & XR_DIRECT_STATUS_BITMASK_PHYS_LOCK_GRANTED) // that means the LOCK is granted
next_state = ST_ACCESS_RECONFIG_BASIC_OFFSET_REG;
else
next_state = ST_CONFIRM_RECONFIG_BASIC_CH_LOCK;
end
end
ST_ACCESS_RECONFIG_BASIC_OFFSET_REG: // step 4 : Write backend address to reconfig basic's offset register, aslo check for opcode and decide whether its read or write operation
begin
if (!waitrequest_from_basic)
begin
if ((opcode == READ_PHY_ADD) || (opcode == WRITE_PHY_ADD))
next_state = ST_SET_RECONFIG_BASIC_PADDR_MODE;
else if ((opcode == WRITE_CH_ADD) || (opcode == WRITE_INTERNAL_REGISTER))
next_state = ST_WRITE_DATA_TO_RECONFIG_BASIC;
else if ((opcode == READ_CH_ADD) || (opcode == READ_INTERNAL_ROM_TABLE) )
next_state = ST_SET_RECONFIG_BASIC_READ;
end
end
ST_SET_RECONFIG_BASIC_PADDR_MODE:
begin
if (!waitrequest_from_basic) begin
if (opcode == WRITE_PHY_ADD)
next_state = ST_WRITE_DATA_TO_RECONFIG_BASIC;
else if(opcode == READ_PHY_ADD)
next_state = ST_SET_RECONFIG_BASIC_READ;
end
end
ST_WRITE_DATA_TO_RECONFIG_BASIC:
begin
if (!waitrequest_from_basic)
next_state = ST_SET_RECONFIG_BASIC_WRITE;
end
ST_SET_RECONFIG_BASIC_WRITE:
begin
if(phy_addr_is_set && !waitrequest_from_basic)
next_state = ST_CLR_RECONFIG_BASIC_PADDR_MODE;
else if (!waitrequest_from_basic)
next_state = ST_CHECK_CTRLLOCK;
end
ST_SET_RECONFIG_BASIC_READ: // write reconfig read to basic's control reg, set rd = 1
begin
if (!waitrequest_from_basic)
next_state = ST_READ_RECONFIG_BASIC_DATA;
end
ST_READ_RECONFIG_BASIC_DATA:
begin
if(phy_addr_is_set && !waitrequest_from_basic)
next_state = ST_CLR_RECONFIG_BASIC_PADDR_MODE;
else if (!waitrequest_from_basic)
next_state = ST_CHECK_CTRLLOCK;
end
ST_CLR_RECONFIG_BASIC_PADDR_MODE:
begin
if (!waitrequest_from_basic)
next_state = ST_CHECK_CTRLLOCK;
end
ST_CHECK_CTRLLOCK:
begin
if (ctrl_lock)
next_state = ST_START_AGAIN;
else
next_state = ST_RELEASE_REQ;
end
ST_START_AGAIN: // if lock "1" then wait for go signal and go back and check for opcode again
begin
//contnue to monitor ctrl_lock to allow arbiter req release
// if(!ctrl_lock)
// next_state = ST_RELEASE_REQ;
if (ctrl_go)
next_state = ST_ACCESS_RECONFIG_BASIC_OFFSET_REG;
else
next_state = ST_START_AGAIN;
end
ST_RELEASE_REQ: //Step 6
begin
if (!waitrequest_from_basic)
next_state = ST_IDLE;
end
default:
next_state = ST_IDLE;
endcase // case (state)
end // always @ (*)
// Assign outputs (registered outputs), these are the outputs to the master reconfig_basic
always @(posedge clk or posedge reset)
begin
if (reset)
begin
master_address <= {MASTER_ADDR_WIDTH{1'b0}};
master_write <= 1'b0;
master_read <= 1'b0;
illegal_phy_ch <= 1'b0;
mutex_req <= 1'b0;
master_writedata <= 32'd0;
readdata_for_user <= 32'd0;
ph_readdata <= 32'd0;
waitrequest_to_ctrl <= 1'b0;
end
else
begin
master_address <= {MASTER_ADDR_WIDTH{1'b0}};
master_write <= 1'b0;
master_read <= 1'b0;
master_writedata <= 32'd0;
case (next_state)
ST_IDLE:
begin
master_address <= {MASTER_ADDR_WIDTH{1'b0}};
master_write <= 1'b0;
master_read <= 1'b0;
waitrequest_to_ctrl <= 1'b0;
master_writedata <= 32'd0;
mutex_req <= 1'b0;
waitrequest_to_ctrl <= 1'b0;
end // case: ST_IDLE
ST_REQ_MUTEX:
begin
mutex_req <= 1'b1;
waitrequest_to_ctrl <= 1'b1;
end
ST_WRITE_RECONFIG_BASIC_LCH:
begin
master_address <= ADDR_XCVR_RECONFIG_BASIC_LOGICAL_CHANNEL; //1
master_writedata <= (32'd0 | logical_ch_addr);
master_write <= 1'b1;
master_read <= 1'b0;
// ST_WRITE_RECONFIG_BASIC_LCH is always a first state of any opcode operation so need to set waitrequest here to tell adta control logic that FSM is running and don't give other request till waitrequest goes "0"
waitrequest_to_ctrl <= 1'b1;
end
ST_READ_PHY_ADDRESS:
begin
master_address <= ADDR_XCVR_RECONFIG_BASIC_PHYSICAL_CHANNEL;
master_write <= 1'b0;
master_read <= 1'b1;
waitrequest_to_ctrl <= 1'b1;
end
ST_CHECK_PHY_ADD_LEGAL:
begin
ph_readdata <= master_readdata;
waitrequest_to_ctrl <= 1'b1;
if (master_readdata[2:0]== ILLEGAL_PHYSICAL_CHNL)
illegal_phy_ch <= 1'b1;
else
illegal_phy_ch <= 1'b0;
end
/*
//Basic Lock automatically aquired. This state is redundant.
ST_REQ_RECONFIG_BASIC_CH_LOCK:
begin
master_address <= ADDR_XCVR_RECONFIG_BASIC_CONTROL; // 3
master_writedata <= XR_DIRECT_CONTROL_PHYS_LOCK_SET; // opcode <= 32'b0101, set lock request for current channel
master_write <= 1'b1;
master_read <= 1'b0;
waitrequest_to_ctrl <= 1'b1;
end
*/
ST_CONFIRM_RECONFIG_BASIC_CH_LOCK:
begin
master_address <= ADDR_XCVR_RECONFIG_BASIC_CONTROL; // 3
master_write <= 1'b0;
master_read <= 1'b1;
waitrequest_to_ctrl <= 1'b1;
end
ST_ACCESS_RECONFIG_BASIC_OFFSET_REG: // Write backend address to reconfig basic's offset register
begin
master_address <= ADDR_XCVR_RECONFIG_BASIC_OFFSET_ADDR; // 4
// master_writedata <= {{20{1'b0}, backend_add};
master_writedata <= (32'd0 | ch_offset_addr);
master_write <= 1'b1;
master_read <= 1'b0;
waitrequest_to_ctrl <= 1'b1;
end
ST_SET_RECONFIG_BASIC_PADDR_MODE: //set Physical addressing mode
begin
master_address <= ADDR_XCVR_RECONFIG_BASIC_CONTROL; // 4
master_writedata <= XR_DIRECT_CONTROL_PADDR_SET;
master_write <= 1'b1;
master_read <= 1'b0;
waitrequest_to_ctrl <= 1'b1;
end
ST_WRITE_DATA_TO_RECONFIG_BASIC:
begin
master_address <= ADDR_XCVR_RECONFIG_BASIC_DATA; //5
master_writedata <= ctrl_writedata; // this is from data control block
master_write <= 1'b1;
master_read <= 1'b0;
waitrequest_to_ctrl <= 1'b1;
end
ST_SET_RECONFIG_BASIC_WRITE:
begin
master_address <= ADDR_XCVR_RECONFIG_BASIC_CONTROL; // 3
if (opcode == WRITE_INTERNAL_REGISTER)
master_writedata <= XR_DIRECT_CONTROL_INTERNAL_WRITE;
else
master_writedata <= XR_DIRECT_CONTROL_RECONF_WRITE;
master_write <= 1'b1;
master_read <= 1'b0;
waitrequest_to_ctrl <= 1'b1;
end
ST_SET_RECONFIG_BASIC_READ: // write reconfig read to basic's control reg, set rd <= 1
begin
master_address <= ADDR_XCVR_RECONFIG_BASIC_CONTROL; // 3
master_write <= 1'b1;
master_read <= 1'b0;
if(opcode == READ_INTERNAL_ROM_TABLE)
master_writedata <= XR_DIRECT_CONTROL_TABLE_READ;
else
master_writedata <= XR_DIRECT_CONTROL_RECONF_READ; //XR_DIRECT_CONTROL_RECONF_READ <= 32'b0001; reconfig space: read from OFFSET_ADDR, save result in DATA
waitrequest_to_ctrl <= 1'b1;
end
ST_READ_RECONFIG_BASIC_DATA:
begin
master_address <= ADDR_XCVR_RECONFIG_BASIC_DATA; //5
master_read <= 1'b1;
master_write <= 1'b0;
// readdata_for_user <= master_readdata;
waitrequest_to_ctrl <= 1'b1;
end
ST_CLR_RECONFIG_BASIC_PADDR_MODE: //clear Physical addressing mode
begin
master_address <= ADDR_XCVR_RECONFIG_BASIC_CONTROL; // 4
master_writedata <= XR_DIRECT_CONTROL_LADDR_SET;
master_write <= 1'b1;
master_read <= 1'b0;
waitrequest_to_ctrl <= 1'b1;
end
ST_CHECK_CTRLLOCK:
begin
if (state == ST_READ_RECONFIG_BASIC_DATA || state == ST_CHECK_PHY_ADD_LEGAL || state == ST_CLR_RECONFIG_BASIC_PADDR_MODE)
begin
master_read <= 1'b0;
if (state == ST_READ_RECONFIG_BASIC_DATA || state == ST_CLR_RECONFIG_BASIC_PADDR_MODE)
readdata_for_user <= master_readdata;
if (state == ST_CHECK_PHY_ADD_LEGAL)
begin
ph_readdata <= master_readdata;
if (master_readdata[2:0]== ILLEGAL_PHYSICAL_CHNL)
illegal_phy_ch <= 1'b1;
else
illegal_phy_ch <= 1'b0;
end
end // if (state == ST_READ_RECONFIG_BASIC_DATA || state == ST_CHECK_PHY_ADD_LEGAL)
if (ctrl_lock)
waitrequest_to_ctrl <= 1'b0;
else
waitrequest_to_ctrl <= 1'b1;
end
ST_START_AGAIN:
begin
if (ctrl_go)
waitrequest_to_ctrl <= 1'b1;
else
waitrequest_to_ctrl <= 1'b1;
end
ST_RELEASE_REQ:
begin
master_address <= ADDR_XCVR_RECONFIG_BASIC_CONTROL; // 3
master_writedata <= XR_DIRECT_CONTROL_PHYS_LOCK_CLEAR;
master_write <= 1'b1;
master_read <= 1'b0;
waitrequest_to_ctrl <= 1'b1;
mutex_req <= 1'b0;
end
endcase // case (next_state)
end // else: !if(reset)
end // always @ (posedge clk or posedge reset)
endmodule

View file

@ -0,0 +1,149 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
// Common framework for many reconfig blocks
//
// $Header$
`timescale 1 ns / 1 ps
module alt_xreconf_cif
#(
parameter CIF_RECONFIG_ADDR_WIDTH = 3,
parameter CIF_RECONFIG_DATA_WIDTH = 32,
parameter CIF_RECONFIG_OFFSET_WIDTH = 5,
parameter CIF_OFFSET_ADDR_WIDTH = 11,
parameter CIF_MASTER_ADDR_WIDTH = 3
)
(
input wire reconfig_clk,
input wire reset,
// to/From user inteface, data control control logic:
input wire ctrl_go,
input wire [2:0] ctrl_opcode,
input wire ctrl_lock,
input [CIF_OFFSET_ADDR_WIDTH-1:0] ctrl_addr_offset, //offset address for reconfig_basic same as ch_offset_addr
input wire [CIF_RECONFIG_DATA_WIDTH-1:0] ctrl_writedata, // read odified write writedata from data control block
input wire [9:0] uif_logical_ch_addr,
output wire [CIF_RECONFIG_DATA_WIDTH-1:0] ctrl_readdata, //readdata for user, this will go to the uif block
output wire [CIF_RECONFIG_DATA_WIDTH-1:0] ctrl_phreaddata, //readdata for user, this will go to the uif block
output wire ctrl_illegal_phy_ch,//to data control
output wire ctrl_waitrequest, // to data control
// output to base_reconfig
// outputs from mutex to be routed to the base
// Avalon MM Master
output wire [CIF_RECONFIG_ADDR_WIDTH-1:0] reconfig_address_base, // 3 bit MM
output wire [CIF_RECONFIG_DATA_WIDTH-1:0] reconfig_writedata_base,
output wire reconfig_write_base,
output wire reconfig_read_base,
// input from base reconfig
input wire [CIF_RECONFIG_DATA_WIDTH-1:0] reconfig_readdata_base, // data from read command
input wire reconfig_irq_from_base,
input wire reconfig_waitrequest_from_base,
input wire arb_grant,
output wire arb_req
);
// Following wire definitions for FSM connection
wire mutex_req;
wire mutex_grant;
wire master_read;
wire master_write;
wire [31:0] master_writedata;
wire [CIF_MASTER_ADDR_WIDTH-1:0] master_address;
wire [31:0] master_readdata;
// State machine which talks with Reconfig basic B block
alt_xreconf_basic_acq
#(
.OFFSET_ADDR_WIDTH(CIF_OFFSET_ADDR_WIDTH),
.MASTER_ADDR_WIDTH(CIF_MASTER_ADDR_WIDTH)
) inst_basic_acq (
.clk(reconfig_clk),
.reset(reset),
.ctrl_go(ctrl_go),
.ctrl_lock(ctrl_lock),
.opcode(ctrl_opcode),
.ctrl_writedata(ctrl_writedata),
.illegal_phy_ch(ctrl_illegal_phy_ch),
.waitrequest_to_ctrl(ctrl_waitrequest),
// to/from uif block
.logical_ch_addr(uif_logical_ch_addr),
.ch_offset_addr(ctrl_addr_offset),
.waitrequest_from_basic(reconfig_waitrequest_from_base),
.readdata_for_user(ctrl_readdata),
.ph_readdata(ctrl_phreaddata),
//arb_acq block interface
.mutex_grant(mutex_grant),
.mutex_req(mutex_req),
.master_read(master_read),
.master_write(master_write),
.master_writedata(master_writedata),
.master_address(master_address),
.master_readdata(master_readdata)
);
// Arbiter acq block which talks with basic and generates request and reads grant from basic
alt_arbiter_acq #(
.addr_width(CIF_RECONFIG_ADDR_WIDTH),
.data_width(CIF_RECONFIG_DATA_WIDTH)
)
mutex_inst (
.clk(reconfig_clk),
.reset(reset),
// inputs to the base that should be routed through the mutex
.address(master_address),
.writedata(master_writedata),
.write(master_write),
.read(master_read),
// output from the mutex which is processed form of output from base
.waitrequest(),
.readdata(master_readdata),
// outputs from mutex to be routed to the base
.master_address(reconfig_address_base),
.master_writedata(reconfig_writedata_base),
.master_write(reconfig_write_base),
.master_read(reconfig_read_base),
// these ports are from the base routed to the mutex
.master_waitrequest(reconfig_waitrequest_from_base),
.master_readdata(reconfig_readdata_base), // from MM
//request signal to the mutex should be kept high as long as the mutex is being used
.mutex_req(mutex_req),
// output from mutex indicates whether you have mutex or not
.mutex_grant(mutex_grant),
.arb_req(arb_req),
.arb_grant(arb_grant)
);
endmodule

View file

@ -0,0 +1,250 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
// Modification of Common register interface for many reconfig blocks
// Added a mode filed in the control register
// $Header$
`timescale 1 ns / 1 ps
module alt_xreconf_uif
#(
parameter RECONFIG_USER_ADDR_WIDTH = 3,
parameter RECONFIG_USER_DATA_WIDTH = 32,
parameter RECONFIG_USER_CTRL_WIDTH = 2,
parameter RECONFIG_USER_ENABLE_CTRL = 0,
parameter RECONFIG_USER_MODE_WIDTH = 3,
parameter RECONFIG_USER_OFFSET_WIDTH = 5
)
(
input wire reconfig_clk,
input wire reset,
//avalon MM slave
input wire [RECONFIG_USER_ADDR_WIDTH-1:0] user_reconfig_address, // MM address
input wire [RECONFIG_USER_DATA_WIDTH-1:0] user_reconfig_writedata,
input wire user_reconfig_write,
input wire user_reconfig_read,
output reg [RECONFIG_USER_DATA_WIDTH-1:0] user_reconfig_readdata, // from MM
output wire user_reconfig_waitrequest,
output wire user_reconfig_done,
// to/from data control logic
output reg [RECONFIG_USER_DATA_WIDTH-1:0] uif_writedata, // user data for data control module
output reg [RECONFIG_USER_OFFSET_WIDTH-1:0] uif_addr_offset, // offset address for data control module
output reg [RECONFIG_USER_MODE_WIDTH-1:0] uif_mode, // rd, write or physical rd mode of operation
output reg [RECONFIG_USER_CTRL_WIDTH-1:0] uif_ctrl, //spare control register bits
output reg [9:0] uif_logical_ch_addr, // Logical channel address for data control module
output reg uif_go, // go signal for data control logic to start the operation
input wire [RECONFIG_USER_DATA_WIDTH-1:0] uif_readdata, // readdata from data control logic/basic
input wire [RECONFIG_USER_DATA_WIDTH-1:0] uif_phreaddata, // readdata from data control logic/basic
input wire uif_illegal_pch_error, //illegal physical error signal from control block
input wire uif_illegal_offset_error, // illegal offset error from control block
input wire uif_busy // busy from control block
);
// Parameters for reconfig address
localparam LADDR_XR_LCH = 0;
localparam LADDR_XR_PCH = 1;
localparam LADDR_XR_STATUS = 2;
localparam LADDR_XR_OFFSET = 3;
localparam LADDR_XR_DATA = 4;
// different modes of operation
localparam READ_CH_ADD = 3'b000;
localparam WRITE_CH_ADD = 3'b001;
localparam READ_PHY_CH = 3'b010;
localparam MODE_OPCODE_LEN = 3;
//register declaration
wire int_status_error;
reg illegal_addr_error= 1'b0;
wire [1:0] status_reg;
wire mode_done;
wire [RECONFIG_USER_CTRL_WIDTH-1:0] uif_ctrl_rd;
assign int_status_error = illegal_addr_error | uif_illegal_pch_error | uif_illegal_offset_error;
assign status_reg = {int_status_error,uif_busy};
assign user_reconfig_done = !uif_busy;
// Memory mapped Write Interface
always @(posedge reconfig_clk or posedge reset)
begin
if (reset)
begin
illegal_addr_error <= 1'b0;
uif_addr_offset <= {RECONFIG_USER_OFFSET_WIDTH{1'b0}};
uif_writedata <= {RECONFIG_USER_DATA_WIDTH{1'b0}};
uif_logical_ch_addr <= 10'b0000000000;
uif_go <= 1'b0;
uif_mode <= {RECONFIG_USER_MODE_WIDTH{1'b0}};
uif_ctrl <= {RECONFIG_USER_CTRL_WIDTH{1'b0}};
end
else
begin
// decode reconfig_address and take an action accordingly
// generae uif_mode and uif_go pulse to start the operation
case (user_reconfig_address)
LADDR_XR_LCH : // write logical ch address
begin
uif_go <= 1'b0;
illegal_addr_error <= 1'b0;
if (user_reconfig_write && !uif_busy)
begin
uif_logical_ch_addr <= user_reconfig_writedata[9:0]; // write logical ch address
end
end
LADDR_XR_OFFSET: // write offset register
begin
uif_go <= 1'b0;
illegal_addr_error <= 1'b0;
if (user_reconfig_write && !uif_busy)
uif_addr_offset <= user_reconfig_writedata[RECONFIG_USER_OFFSET_WIDTH-1:0];// if add offset then write txrx offset to offset_reg
end
LADDR_XR_DATA: // write into data register
begin
uif_go <= 1'b0;
illegal_addr_error <= 1'b0;
begin
if (user_reconfig_write && !uif_busy)
uif_writedata <= user_reconfig_writedata; // write data to register
end
end
LADDR_XR_STATUS: // bit[0] = wr, bit[1]= rd, bit[8] = busy
begin
illegal_addr_error <= 1'b0;
if (user_reconfig_write && !uif_busy)
begin
if (user_reconfig_writedata[0] == 1'b1) // check for wr bit is 1, if yes then enable go for data_control logic
begin
uif_go <= 1'b1; // give go to data control logic to start the operation
uif_mode[MODE_OPCODE_LEN-1:0] <= WRITE_CH_ADD;
uif_ctrl <= (RECONFIG_USER_ENABLE_CTRL == 1) ? user_reconfig_writedata[3:2] : {RECONFIG_USER_CTRL_WIDTH{1'b0}};
end
else if (user_reconfig_writedata[1] == 1'b1) // check for rd bit is 1, if yes then enable go for data_control logic
begin
uif_go <= 1'b1; // give go to data control logic to start the operation
uif_mode[MODE_OPCODE_LEN-1:0] <= READ_CH_ADD;
uif_ctrl <= (RECONFIG_USER_ENABLE_CTRL == 1) ? user_reconfig_writedata[3:2] : {RECONFIG_USER_CTRL_WIDTH{1'b0}};
end
else
begin
uif_go <= 1'b0;
uif_ctrl <= (RECONFIG_USER_ENABLE_CTRL == 1) ? user_reconfig_writedata[3:2] : {RECONFIG_USER_CTRL_WIDTH{1'b0}};
end
end // if (user_reconfig_write && !status_busy_reg)
else
uif_go <= 1'b0;
end // case: LADDR_XR_STATUS
LADDR_XR_PCH: // physical channel read
begin
illegal_addr_error <= 1'b0;
if (user_reconfig_read && !uif_busy)
begin
uif_go <= 1'b1;
uif_mode[MODE_OPCODE_LEN-1:0] <= READ_PHY_CH;
end
else
uif_go <= 1'b0;
end
default:
begin
uif_go <= 1'b0;
if (user_reconfig_write | user_reconfig_read)
begin
illegal_addr_error <= 1'b1; // assert the error if address is other than, lch, offset, control/status pch and data
// synopsys translate_off
$display ("Illegal operation to reserved address %h", user_reconfig_address);
$display ("Time: %0t Instance: %m", $time);
// synopsys translate_on
end
end // case: default
endcase // case (user_reconfig_address)
end // else: !if(reset)
end // always @ (posedge reconfig_clk or posedge reset)
// Memory Mapped Read Interface - READ logic
//------------------------------------------------------------------
// Address reg | read is allowed
//-----------------|--------------------------------------------------------
// LCH | YES, always
// PCH | YES, only when busy is low
// control/status| YES, only Status bits
// offset | YES, Always
// data | YES, only when busy is low
assign uif_ctrl_rd = (RECONFIG_USER_ENABLE_CTRL == 1) ? uif_ctrl : {RECONFIG_USER_CTRL_WIDTH{1'b0}};
always @(posedge reconfig_clk or posedge reset)
begin
if (reset)
begin
user_reconfig_readdata <= {RECONFIG_USER_DATA_WIDTH{1'b0}};
end
else
begin
if (user_reconfig_read == 1'b1)
begin
case (user_reconfig_address)
LADDR_XR_LCH:
user_reconfig_readdata <= (32'd0 | uif_logical_ch_addr);
LADDR_XR_PCH:
begin
if (!uif_busy)
user_reconfig_readdata <= uif_phreaddata;
end
LADDR_XR_STATUS:
begin
user_reconfig_readdata <= {{22{1'b0}}, status_reg, {4{1'b0}},uif_ctrl_rd, {2{1'b0}}};
//user_reconfig_readdata <= {{22{1'b0}}, status_reg, {8{1'b0}}};
end
LADDR_XR_OFFSET:
user_reconfig_readdata <= (32'd0 | uif_addr_offset);
LADDR_XR_DATA:
if (!uif_busy)
begin
if (uif_mode[MODE_OPCODE_LEN-1:0] == WRITE_CH_ADD)
user_reconfig_readdata <= (32'd0 | uif_writedata);
else if ((uif_mode[MODE_OPCODE_LEN-1:0] == READ_CH_ADD) || (uif_mode[MODE_OPCODE_LEN-1:0] == READ_PHY_CH) )
user_reconfig_readdata <= uif_readdata;
end
default:
user_reconfig_readdata <= {32{1'b0}};
endcase // case (reconfig_address)
end // if (reconfig_read == 1'b1)
end // else: !if(reset)
end // always @ (posedge reconfig_clk or posedge reset)
// Implement 1-cycle waitrequest to match previous implementation
altera_wait_generate wait_gen(
.rst(reset),
.clk(reconfig_clk),
.launch_signal(user_reconfig_read),
.wait_req(user_reconfig_waitrequest)
);
endmodule // altera_xcvr_reconfig_common_user_if

View file

@ -0,0 +1,915 @@
// -----------------------------------------------------------
// Legal Notice: (C)2007 Altera Corporation. All rights reserved. Your
// use of Altera Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any
// output files any of the foregoing (including device programming or
// simulation files), and any associated documentation or information are
// expressly subject to the terms and conditions of the Altera Program
// License Subscription Agreement or other applicable license agreement,
// including, without limitation, that your use is for the sole purpose
// of programming logic devices manufactured by Altera and sold by Altera
// or its authorized distributors. Please refer to the applicable
// agreement for further details.
//
// Description: Single clock Avalon-ST FIFO.
// -----------------------------------------------------------
`timescale 1 ns / 1 ns
//altera message_off 10036
module altera_avalon_sc_fifo
#(
// --------------------------------------------------
// Parameters
// --------------------------------------------------
parameter SYMBOLS_PER_BEAT = 1,
parameter BITS_PER_SYMBOL = 8,
parameter FIFO_DEPTH = 16,
parameter CHANNEL_WIDTH = 0,
parameter ERROR_WIDTH = 0,
parameter USE_PACKETS = 0,
parameter USE_FILL_LEVEL = 0,
parameter USE_STORE_FORWARD = 0,
parameter USE_ALMOST_FULL_IF = 0,
parameter USE_ALMOST_EMPTY_IF = 0,
// --------------------------------------------------
// Empty latency is defined as the number of cycles
// required for a write to deassert the empty flag.
// For example, a latency of 1 means that the empty
// flag is deasserted on the cycle after a write.
//
// Another way to think of it is the latency for a
// write to propagate to the output.
//
// An empty latency of 0 implies lookahead, which is
// only implemented for the register-based FIFO.
// --------------------------------------------------
parameter EMPTY_LATENCY = 3,
parameter USE_MEMORY_BLOCKS = 1,
// --------------------------------------------------
// Internal Parameters
// --------------------------------------------------
parameter DATA_WIDTH = SYMBOLS_PER_BEAT * BITS_PER_SYMBOL,
parameter EMPTY_WIDTH = log2ceil(SYMBOLS_PER_BEAT)
)
(
// --------------------------------------------------
// Ports
// --------------------------------------------------
input clk,
input reset,
input [DATA_WIDTH-1: 0] in_data,
input in_valid,
input in_startofpacket,
input in_endofpacket,
input [((EMPTY_WIDTH>0) ? (EMPTY_WIDTH-1):0) : 0] in_empty,
input [((ERROR_WIDTH>0) ? (ERROR_WIDTH-1):0) : 0] in_error,
input [((CHANNEL_WIDTH>0) ? (CHANNEL_WIDTH-1):0): 0] in_channel,
output in_ready,
output [DATA_WIDTH-1 : 0] out_data,
output reg out_valid,
output out_startofpacket,
output out_endofpacket,
output [((EMPTY_WIDTH>0) ? (EMPTY_WIDTH-1):0) : 0] out_empty,
output [((ERROR_WIDTH>0) ? (ERROR_WIDTH-1):0) : 0] out_error,
output [((CHANNEL_WIDTH>0) ? (CHANNEL_WIDTH-1):0): 0] out_channel,
input out_ready,
input [(USE_STORE_FORWARD ? 2 : 1) : 0] csr_address,
input csr_write,
input csr_read,
input [31 : 0] csr_writedata,
output reg [31 : 0] csr_readdata,
output wire almost_full_data,
output wire almost_empty_data
);
// --------------------------------------------------
// Local Parameters
// --------------------------------------------------
localparam ADDR_WIDTH = log2ceil(FIFO_DEPTH);
localparam DEPTH = FIFO_DEPTH;
localparam PKT_SIGNALS_WIDTH = 2 + EMPTY_WIDTH;
localparam PAYLOAD_WIDTH = (USE_PACKETS == 1) ?
2 + EMPTY_WIDTH + DATA_WIDTH + ERROR_WIDTH + CHANNEL_WIDTH:
DATA_WIDTH + ERROR_WIDTH + CHANNEL_WIDTH;
// --------------------------------------------------
// Internal Signals
// --------------------------------------------------
genvar i;
reg [PAYLOAD_WIDTH-1 : 0] mem [DEPTH-1 : 0];
reg [ADDR_WIDTH-1 : 0] wr_ptr;
reg [ADDR_WIDTH-1 : 0] rd_ptr;
reg [DEPTH-1 : 0] mem_used;
wire [ADDR_WIDTH-1 : 0] next_wr_ptr;
wire [ADDR_WIDTH-1 : 0] next_rd_ptr;
wire [ADDR_WIDTH-1 : 0] incremented_wr_ptr;
wire [ADDR_WIDTH-1 : 0] incremented_rd_ptr;
wire [ADDR_WIDTH-1 : 0] mem_rd_ptr;
wire read;
wire write;
reg empty;
reg next_empty;
reg full;
reg next_full;
wire [PKT_SIGNALS_WIDTH-1 : 0] in_packet_signals;
wire [PKT_SIGNALS_WIDTH-1 : 0] out_packet_signals;
wire [PAYLOAD_WIDTH-1 : 0] in_payload;
reg [PAYLOAD_WIDTH-1 : 0] internal_out_payload;
reg [PAYLOAD_WIDTH-1 : 0] out_payload;
reg internal_out_valid;
wire internal_out_ready;
reg [ADDR_WIDTH : 0] fifo_fill_level;
reg [ADDR_WIDTH : 0] fill_level;
reg [ADDR_WIDTH-1 : 0] sop_ptr = 0;
wire [ADDR_WIDTH-1 : 0] curr_sop_ptr;
reg [23:0] almost_full_threshold;
reg [23:0] almost_empty_threshold;
reg [23:0] cut_through_threshold;
reg [15:0] pkt_cnt;
reg drop_on_error_en;
reg error_in_pkt;
reg pkt_has_started;
reg sop_has_left_fifo;
reg fifo_too_small_r;
reg pkt_cnt_eq_zero;
reg pkt_cnt_eq_one;
wire wait_for_threshold;
reg pkt_mode;
wire wait_for_pkt;
wire ok_to_forward;
wire in_pkt_eop_arrive;
wire out_pkt_leave;
wire in_pkt_start;
wire in_pkt_error;
wire drop_on_error;
wire fifo_too_small;
wire out_pkt_sop_leave;
wire [31:0] max_fifo_size;
reg fifo_fill_level_lt_cut_through_threshold;
// --------------------------------------------------
// Define Payload
//
// Icky part where we decide which signals form the
// payload to the FIFO with generate blocks.
// --------------------------------------------------
generate
if (EMPTY_WIDTH > 0) begin : gen_blk1
assign in_packet_signals = {in_startofpacket, in_endofpacket, in_empty};
assign {out_startofpacket, out_endofpacket, out_empty} = out_packet_signals;
end
else begin : gen_blk1_else
assign out_empty = in_error;
assign in_packet_signals = {in_startofpacket, in_endofpacket};
assign {out_startofpacket, out_endofpacket} = out_packet_signals;
end
endgenerate
generate
if (USE_PACKETS) begin : gen_blk2
if (ERROR_WIDTH > 0) begin : gen_blk3
if (CHANNEL_WIDTH > 0) begin : gen_blk4
assign in_payload = {in_packet_signals, in_data, in_error, in_channel};
assign {out_packet_signals, out_data, out_error, out_channel} = out_payload;
end
else begin : gen_blk4_else
assign out_channel = in_channel;
assign in_payload = {in_packet_signals, in_data, in_error};
assign {out_packet_signals, out_data, out_error} = out_payload;
end
end
else begin : gen_blk3_else
assign out_error = in_error;
if (CHANNEL_WIDTH > 0) begin : gen_blk5
assign in_payload = {in_packet_signals, in_data, in_channel};
assign {out_packet_signals, out_data, out_channel} = out_payload;
end
else begin : gen_blk5_else
assign out_channel = in_channel;
assign in_payload = {in_packet_signals, in_data};
assign {out_packet_signals, out_data} = out_payload;
end
end
end
else begin : gen_blk2_else
assign out_packet_signals = 0;
if (ERROR_WIDTH > 0) begin : gen_blk6
if (CHANNEL_WIDTH > 0) begin : gen_blk7
assign in_payload = {in_data, in_error, in_channel};
assign {out_data, out_error, out_channel} = out_payload;
end
else begin : gen_blk7_else
assign out_channel = in_channel;
assign in_payload = {in_data, in_error};
assign {out_data, out_error} = out_payload;
end
end
else begin : gen_blk6_else
assign out_error = in_error;
if (CHANNEL_WIDTH > 0) begin : gen_blk8
assign in_payload = {in_data, in_channel};
assign {out_data, out_channel} = out_payload;
end
else begin : gen_blk8_else
assign out_channel = in_channel;
assign in_payload = in_data;
assign out_data = out_payload;
end
end
end
endgenerate
// --------------------------------------------------
// Memory-based FIFO storage
//
// To allow a ready latency of 0, the read index is
// obtained from the next read pointer and memory
// outputs are unregistered.
//
// If the empty latency is 1, we infer bypass logic
// around the memory so writes propagate to the
// outputs on the next cycle.
//
// Do not change the way this is coded: Quartus needs
// a perfect match to the template, and any attempt to
// refactor the two always blocks into one will break
// memory inference.
// --------------------------------------------------
generate if (USE_MEMORY_BLOCKS == 1) begin : gen_blk9
if (EMPTY_LATENCY == 1) begin : gen_blk10
always @(posedge clk) begin
if (in_valid && in_ready)
mem[wr_ptr] = in_payload;
internal_out_payload = mem[mem_rd_ptr];
end
end else begin : gen_blk10_else
always @(posedge clk) begin
if (in_valid && in_ready)
mem[wr_ptr] <= in_payload;
internal_out_payload <= mem[mem_rd_ptr];
end
end
assign mem_rd_ptr = next_rd_ptr;
end else begin : gen_blk9_else
// --------------------------------------------------
// Register-based FIFO storage
//
// Uses a shift register as the storage element. Each
// shift register slot has a bit which indicates if
// the slot is occupied (credit to Sam H for the idea).
// The occupancy bits are contiguous and start from the
// lsb, so 0000, 0001, 0011, 0111, 1111 for a 4-deep
// FIFO.
//
// Each slot is enabled during a read or when it
// is unoccupied. New data is always written to every
// going-to-be-empty slot (we keep track of which ones
// are actually useful with the occupancy bits). On a
// read we shift occupied slots.
//
// The exception is the last slot, which always gets
// new data when it is unoccupied.
// --------------------------------------------------
for (i = 0; i < DEPTH-1; i = i + 1) begin : shift_reg
always @(posedge clk or posedge reset) begin
if (reset) begin
mem[i] <= 0;
end
else if (read || !mem_used[i]) begin
if (!mem_used[i+1])
mem[i] <= in_payload;
else
mem[i] <= mem[i+1];
end
end
end
always @(posedge clk, posedge reset) begin
if (reset) begin
mem[DEPTH-1] <= 0;
end
else begin
if (DEPTH == 1) begin
if (write)
mem[DEPTH-1] <= in_payload;
end
else if (!mem_used[DEPTH-1])
mem[DEPTH-1] <= in_payload;
end
end
end
endgenerate
assign read = internal_out_ready && internal_out_valid && ok_to_forward;
assign write = in_ready && in_valid;
// --------------------------------------------------
// Pointer Management
// --------------------------------------------------
generate if (USE_MEMORY_BLOCKS == 1) begin : gen_blk11
assign incremented_wr_ptr = wr_ptr + 1'b1;
assign incremented_rd_ptr = rd_ptr + 1'b1;
assign next_wr_ptr = drop_on_error ? curr_sop_ptr : write ? incremented_wr_ptr : wr_ptr;
assign next_rd_ptr = (read) ? incremented_rd_ptr : rd_ptr;
always @(posedge clk or posedge reset) begin
if (reset) begin
wr_ptr <= 0;
rd_ptr <= 0;
end
else begin
wr_ptr <= next_wr_ptr;
rd_ptr <= next_rd_ptr;
end
end
end else begin : gen_blk11_else
// --------------------------------------------------
// Shift Register Occupancy Bits
//
// Consider a 4-deep FIFO with 2 entries: 0011
// On a read and write, do not modify the bits.
// On a write, left-shift the bits to get 0111.
// On a read, right-shift the bits to get 0001.
//
// Also, on a write we set bit0 (the head), while
// clearing the tail on a read.
// --------------------------------------------------
always @(posedge clk or posedge reset) begin
if (reset) begin
mem_used[0] <= 0;
end
else begin
if (write ^ read) begin
if (write)
mem_used[0] <= 1;
else if (read) begin
if (DEPTH > 1)
mem_used[0] <= mem_used[1];
else
mem_used[0] <= 0;
end
end
end
end
if (DEPTH > 1) begin : gen_blk12
always @(posedge clk or posedge reset) begin
if (reset) begin
mem_used[DEPTH-1] <= 0;
end
else begin
if (write ^ read) begin
mem_used[DEPTH-1] <= 0;
if (write)
mem_used[DEPTH-1] <= mem_used[DEPTH-2];
end
end
end
end
for (i = 1; i < DEPTH-1; i = i + 1) begin : storage_logic
always @(posedge clk, posedge reset) begin
if (reset) begin
mem_used[i] <= 0;
end
else begin
if (write ^ read) begin
if (write)
mem_used[i] <= mem_used[i-1];
else if (read)
mem_used[i] <= mem_used[i+1];
end
end
end
end
end
endgenerate
// --------------------------------------------------
// Memory FIFO Status Management
//
// Generates the full and empty signals from the
// pointers. The FIFO is full when the next write
// pointer will be equal to the read pointer after
// a write. Reading from a FIFO clears full.
//
// The FIFO is empty when the next read pointer will
// be equal to the write pointer after a read. Writing
// to a FIFO clears empty.
//
// A simultaneous read and write must not change any of
// the empty or full flags unless there is a drop on error event.
// --------------------------------------------------
generate if (USE_MEMORY_BLOCKS == 1) begin : gen_blk13
always @* begin
next_full = full;
next_empty = empty;
if (read && !write) begin
next_full = 1'b0;
if (incremented_rd_ptr == wr_ptr)
next_empty = 1'b1;
end
if (write && !read) begin
if (!drop_on_error)
next_empty = 1'b0;
else if (curr_sop_ptr == rd_ptr) // drop on error and only 1 pkt in fifo
next_empty = 1'b1;
if (incremented_wr_ptr == rd_ptr && !drop_on_error)
next_full = 1'b1;
end
if (write && read && drop_on_error) begin
if (curr_sop_ptr == next_rd_ptr)
next_empty = 1'b1;
end
end
always @(posedge clk or posedge reset) begin
if (reset) begin
empty <= 1;
full <= 0;
end
else begin
empty <= next_empty;
full <= next_full;
end
end
end else begin : gen_blk13_else
// --------------------------------------------------
// Register FIFO Status Management
//
// Full when the tail occupancy bit is 1. Empty when
// the head occupancy bit is 0.
// --------------------------------------------------
always @* begin
full = mem_used[DEPTH-1];
empty = !mem_used[0];
// ------------------------------------------
// For a single slot FIFO, reading clears the
// full status immediately.
// ------------------------------------------
if (DEPTH == 1)
full = mem_used[0] && !read;
internal_out_payload = mem[0];
// ------------------------------------------
// Writes clear empty immediately for lookahead modes.
// Note that we use in_valid instead of write to avoid
// combinational loops (in lookahead mode, qualifying
// with in_ready is meaningless).
//
// In a 1-deep FIFO, a possible combinational loop runs
// from write -> out_valid -> out_ready -> write
// ------------------------------------------
if (EMPTY_LATENCY == 0) begin
empty = !mem_used[0] && !in_valid;
if (!mem_used[0] && in_valid)
internal_out_payload = in_payload;
end
end
end
endgenerate
// --------------------------------------------------
// Avalon-ST Signals
//
// The in_ready signal is straightforward.
//
// To match memory latency when empty latency > 1,
// out_valid assertions must be delayed by one clock
// cycle.
//
// Note: out_valid deassertions must not be delayed or
// the FIFO will underflow.
// --------------------------------------------------
assign in_ready = !full;
assign internal_out_ready = out_ready || !out_valid;
generate if (EMPTY_LATENCY > 1) begin : gen_blk14
always @(posedge clk or posedge reset) begin
if (reset)
internal_out_valid <= 0;
else begin
internal_out_valid <= !empty & ok_to_forward & ~drop_on_error;
if (read) begin
if (incremented_rd_ptr == wr_ptr)
internal_out_valid <= 1'b0;
end
end
end
end else begin : gen_blk14_else
always @* begin
internal_out_valid = !empty & ok_to_forward;
end
end
endgenerate
// --------------------------------------------------
// Single Output Pipeline Stage
//
// This output pipeline stage is enabled if the FIFO's
// empty latency is set to 3 (default). It is disabled
// for all other allowed latencies.
//
// Reason: The memory outputs are unregistered, so we have to
// register the output or fmax will drop if combinatorial
// logic is present on the output datapath.
//
// Q: The Avalon-ST spec says that I have to register my outputs
// But isn't the memory counted as a register?
// A: The path from the address lookup to the memory output is
// slow. Registering the memory outputs is a good idea.
//
// The registers get packed into the memory by the fitter
// which means minimal resources are consumed (the result
// is a altsyncram with registered outputs, available on
// all modern Altera devices).
//
// This output stage acts as an extra slot in the FIFO,
// and complicates the fill level.
// --------------------------------------------------
generate if (EMPTY_LATENCY == 3) begin : gen_blk15
always @(posedge clk or posedge reset) begin
if (reset) begin
out_valid <= 0;
out_payload <= 0;
end
else begin
if (internal_out_ready) begin
out_valid <= internal_out_valid & ok_to_forward;
out_payload <= internal_out_payload;
end
end
end
end
else begin : gen_blk15_else
always @* begin
out_valid = internal_out_valid;
out_payload = internal_out_payload;
end
end
endgenerate
// --------------------------------------------------
// Fill Level
//
// The fill level is calculated from the next write
// and read pointers to avoid unnecessary latency
// and logic.
//
// However, if the store-and-forward mode of the FIFO
// is enabled, the fill level is an up-down counter
// for fmax optimization reasons.
//
// If the output pipeline is enabled, the fill level
// must account for it, or we'll always be off by one.
// This may, or may not be important depending on the
// application.
//
// For now, we'll always calculate the exact fill level
// at the cost of an extra adder when the output stage
// is enabled.
// --------------------------------------------------
generate if (USE_FILL_LEVEL) begin : gen_blk16
wire [31:0] depth32;
assign depth32 = DEPTH;
if (USE_STORE_FORWARD) begin
reg [ADDR_WIDTH : 0] curr_packet_len_less_one;
// --------------------------------------------------
// We only drop on endofpacket. As long as we don't add to the fill
// level on the dropped endofpacket cycle, we can simply subtract
// (packet length - 1) from the fill level for dropped packets.
// --------------------------------------------------
always @(posedge clk or posedge reset) begin
if (reset) begin
curr_packet_len_less_one <= 0;
end else begin
if (write) begin
curr_packet_len_less_one <= curr_packet_len_less_one + 1'b1;
if (in_endofpacket)
curr_packet_len_less_one <= 0;
end
end
end
always @(posedge clk or posedge reset) begin
if (reset) begin
fifo_fill_level <= 0;
end else if (drop_on_error) begin
fifo_fill_level <= fifo_fill_level - curr_packet_len_less_one;
if (read)
fifo_fill_level <= fifo_fill_level - curr_packet_len_less_one - 1'b1;
end else if (write && !read) begin
fifo_fill_level <= fifo_fill_level + 1'b1;
end else if (read && !write) begin
fifo_fill_level <= fifo_fill_level - 1'b1;
end
end
end else begin
always @(posedge clk or posedge reset) begin
if (reset)
fifo_fill_level <= 0;
else if (next_full & !drop_on_error)
fifo_fill_level <= depth32[ADDR_WIDTH:0];
else begin
fifo_fill_level[ADDR_WIDTH] <= 1'b0;
fifo_fill_level[ADDR_WIDTH-1 : 0] <= next_wr_ptr - next_rd_ptr;
end
end
end
always @* begin
fill_level = fifo_fill_level;
if (EMPTY_LATENCY == 3)
fill_level = fifo_fill_level + {{ADDR_WIDTH{1'b0}}, out_valid};
end
end
else begin : gen_blk16_else
always @* begin
fill_level = 0;
end
end
endgenerate
generate if (USE_ALMOST_FULL_IF) begin : gen_blk17
assign almost_full_data = (fill_level >= almost_full_threshold);
end
else
assign almost_full_data = 0;
endgenerate
generate if (USE_ALMOST_EMPTY_IF) begin : gen_blk18
assign almost_empty_data = (fill_level <= almost_empty_threshold);
end
else
assign almost_empty_data = 0;
endgenerate
// --------------------------------------------------
// Avalon-MM Status & Control Connection Point
//
// Register map:
//
// | Addr | RW | 31 - 0 |
// | 0 | R | Fill level |
//
// The registering of this connection point means
// that there is a cycle of latency between
// reads/writes and the updating of the fill level.
// --------------------------------------------------
generate if (USE_STORE_FORWARD) begin : gen_blk19
assign max_fifo_size = FIFO_DEPTH - 1;
always @(posedge clk or posedge reset) begin
if (reset) begin
almost_full_threshold <= max_fifo_size[23 : 0];
almost_empty_threshold <= 0;
cut_through_threshold <= 0;
drop_on_error_en <= 0;
csr_readdata <= 0;
pkt_mode <= 1'b1;
end
else begin
if (csr_read) begin
csr_readdata <= 32'b0;
if (csr_address == 5)
csr_readdata <= {31'b0, drop_on_error_en};
else if (csr_address == 4)
csr_readdata <= {8'b0, cut_through_threshold};
else if (csr_address == 3)
csr_readdata <= {8'b0, almost_empty_threshold};
else if (csr_address == 2)
csr_readdata <= {8'b0, almost_full_threshold};
else if (csr_address == 0)
csr_readdata <= {{(31 - ADDR_WIDTH){1'b0}}, fill_level};
end
else if (csr_write) begin
if(csr_address == 3'b101)
drop_on_error_en <= csr_writedata[0];
else if(csr_address == 3'b100) begin
cut_through_threshold <= csr_writedata[23:0];
pkt_mode <= (csr_writedata[23:0] == 0);
end
else if(csr_address == 3'b011)
almost_empty_threshold <= csr_writedata[23:0];
else if(csr_address == 3'b010)
almost_full_threshold <= csr_writedata[23:0];
end
end
end
end
else if (USE_ALMOST_FULL_IF || USE_ALMOST_EMPTY_IF) begin : gen_blk19_else1
assign max_fifo_size = FIFO_DEPTH - 1;
always @(posedge clk or posedge reset) begin
if (reset) begin
almost_full_threshold <= max_fifo_size[23 : 0];
almost_empty_threshold <= 0;
csr_readdata <= 0;
end
else begin
if (csr_read) begin
csr_readdata <= 32'b0;
if (csr_address == 3)
csr_readdata <= {8'b0, almost_empty_threshold};
else if (csr_address == 2)
csr_readdata <= {8'b0, almost_full_threshold};
else if (csr_address == 0)
csr_readdata <= {{(31 - ADDR_WIDTH){1'b0}}, fill_level};
end
else if (csr_write) begin
if(csr_address == 3'b011)
almost_empty_threshold <= csr_writedata[23:0];
else if(csr_address == 3'b010)
almost_full_threshold <= csr_writedata[23:0];
end
end
end
end
else begin : gen_blk19_else2
always @(posedge clk or posedge reset) begin
if (reset) begin
csr_readdata <= 0;
end
else if (csr_read) begin
csr_readdata <= 0;
if (csr_address == 0)
csr_readdata <= {{(31 - ADDR_WIDTH){1'b0}}, fill_level};
end
end
end
endgenerate
// --------------------------------------------------
// Store and forward logic
// --------------------------------------------------
// if the fifo gets full before the entire packet or the
// cut-threshold condition is met then start sending out
// data in order to avoid dead-lock situation
generate if (USE_STORE_FORWARD) begin : gen_blk20
assign wait_for_threshold = (fifo_fill_level_lt_cut_through_threshold) & wait_for_pkt ;
assign wait_for_pkt = pkt_cnt_eq_zero | (pkt_cnt_eq_one & out_pkt_leave);
assign ok_to_forward = (pkt_mode ? (~wait_for_pkt | ~pkt_has_started) :
~wait_for_threshold) | fifo_too_small_r;
assign in_pkt_eop_arrive = in_valid & in_ready & in_endofpacket;
assign in_pkt_start = in_valid & in_ready & in_startofpacket;
assign in_pkt_error = in_valid & in_ready & |in_error;
assign out_pkt_sop_leave = out_valid & out_ready & out_startofpacket;
assign out_pkt_leave = out_valid & out_ready & out_endofpacket;
assign fifo_too_small = (pkt_mode ? wait_for_pkt : wait_for_threshold) & full & out_ready;
// count packets coming and going into the fifo
always @(posedge clk or posedge reset) begin
if (reset) begin
pkt_cnt <= 0;
pkt_has_started <= 0;
sop_has_left_fifo <= 0;
fifo_too_small_r <= 0;
pkt_cnt_eq_zero <= 1'b1;
pkt_cnt_eq_one <= 1'b0;
fifo_fill_level_lt_cut_through_threshold <= 1'b1;
end
else begin
fifo_fill_level_lt_cut_through_threshold <= fifo_fill_level < cut_through_threshold;
fifo_too_small_r <= fifo_too_small;
if( in_pkt_eop_arrive )
sop_has_left_fifo <= 1'b0;
else if (out_pkt_sop_leave & pkt_cnt_eq_zero )
sop_has_left_fifo <= 1'b1;
if (in_pkt_eop_arrive & ~out_pkt_leave & ~drop_on_error ) begin
pkt_cnt <= pkt_cnt + 1'b1;
pkt_cnt_eq_zero <= 0;
if (pkt_cnt == 0)
pkt_cnt_eq_one <= 1'b1;
else
pkt_cnt_eq_one <= 1'b0;
end
else if((~in_pkt_eop_arrive | drop_on_error) & out_pkt_leave) begin
pkt_cnt <= pkt_cnt - 1'b1;
if (pkt_cnt == 1)
pkt_cnt_eq_zero <= 1'b1;
else
pkt_cnt_eq_zero <= 1'b0;
if (pkt_cnt == 2)
pkt_cnt_eq_one <= 1'b1;
else
pkt_cnt_eq_one <= 1'b0;
end
if (in_pkt_start)
pkt_has_started <= 1'b1;
else if (in_pkt_eop_arrive)
pkt_has_started <= 1'b0;
end
end
// drop on error logic
always @(posedge clk or posedge reset) begin
if (reset) begin
sop_ptr <= 0;
error_in_pkt <= 0;
end
else begin
// save the location of the SOP
if ( in_pkt_start )
sop_ptr <= wr_ptr;
// remember if error in pkt
// log error only if packet has already started
if (in_pkt_eop_arrive)
error_in_pkt <= 1'b0;
else if ( in_pkt_error & (pkt_has_started | in_pkt_start))
error_in_pkt <= 1'b1;
end
end
assign drop_on_error = drop_on_error_en & (error_in_pkt | in_pkt_error) & in_pkt_eop_arrive &
~sop_has_left_fifo & ~(out_pkt_sop_leave & pkt_cnt_eq_zero);
assign curr_sop_ptr = (write && in_startofpacket && in_endofpacket) ? wr_ptr : sop_ptr;
end
else begin : gen_blk20_else
assign ok_to_forward = 1'b1;
assign drop_on_error = 1'b0;
if (ADDR_WIDTH <= 1)
assign curr_sop_ptr = 1'b0;
else
assign curr_sop_ptr = {ADDR_WIDTH - 1 { 1'b0 }};
end
endgenerate
// --------------------------------------------------
// Calculates the log2ceil of the input value
// --------------------------------------------------
function integer log2ceil;
input integer val;
reg[31:0] i;
begin
i = 1;
log2ceil = 0;
while (i < val) begin
log2ceil = log2ceil + 1;
i = i[30:0] << 1;
end
end
endfunction
endmodule

View file

@ -0,0 +1,272 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
// (C) 2001-2010 Altera Corporation. All rights reserved.
// Your use of Altera Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Altera Program License Subscription
// Agreement, Altera MegaCore Function License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Altera and sold by
// Altera or its authorized distributors. Please refer to the applicable
// agreement for further details.
// $Id: //acds/main/ip/merlin/altera_merlin_std_arbitrator/altera_merlin_std_arbitrator_core.sv#3 $
// $Revision: #3 $
// $Date: 2010/07/07 $
// $Author: jyeap $
/* -----------------------------------------------------------------------
Round-robin/fixed arbitration implementation.
Q: how do you find the least-significant set-bit in an n-bit binary number, X?
A: M = X & (~X + 1)
Example: X = 101000100
101000100 &
010111011 + 1 =
101000100 &
010111100 =
-----------
000000100
The method can be generalized to find the first set-bit
at a bit index no lower than bit-index N, simply by adding
2**N rather than 1.
Q: how does this relate to round-robin arbitration?
A:
Let X be the concatenation of all request signals.
Let the number to be added to X (hereafter called the
top_priority) initialize to 1, and be assigned from the
concatenation of the previous saved-grant, left-rotated
by one position, each time arbitration occurs. The
concatenation of grants is then M.
Problem: consider this case:
top_priority = 010000
request = 001001
~request + top_priority = 000110
next_grant = 000000 <- no one is granted!
There was no "set bit at a bit index no lower than bit-index 4", so
the result was 0.
We need to propagate the carry out from (~request + top_priority) to the LSB, so
that the sum becomes 000111, and next_grant is 000001. This operation could be
called a "circular add".
A bit of experimentation on the circular add reveals a significant amount of
delay in exiting and re-entering the carry chain - this will vary with device
family. Quartus also reports a combinational loop warning. Finally,
Modelsim 6.3g has trouble with the expression, evaluating it to 'X'. But
Modelsim _doesn't_ report a combinational loop!)
An alternate solution: concatenate the request vector with itself, and OR
corresponding bits from the top and bottom halves to determine next_grant.
Example:
top_priority = 010000
{request, request} = 001001 001001
{~request, ~request} + top_priority = 110111 000110
result of & operation = 000001 000000
next_grant = 000001
Notice that if request = 0, the sum operation will overflow, but we can ignore
this; the next_grant result is 0 (no one granted), as you might expect.
In the implementation, the last-granted value must be maintained as
a non-zero value - best probably simply not to update it when no requests
occur.
----------------------------------------------------------------------- */
`timescale 1 ns / 1 ns
module altera_merlin_arbitrator
#(
parameter NUM_REQUESTERS = 8,
// --------------------------------------
// Implemented schemes
// "round-robin"
// "fixed-priority"
// "no-arb"
// --------------------------------------
parameter SCHEME = "round-robin",
parameter PIPELINE = 0
)
(
input clk,
input reset,
// --------------------------------------
// Requests
// --------------------------------------
input [NUM_REQUESTERS-1:0] request,
// --------------------------------------
// Grants
// --------------------------------------
output [NUM_REQUESTERS-1:0] grant,
// --------------------------------------
// Control Signals
// --------------------------------------
input increment_top_priority,
input save_top_priority
);
// --------------------------------------
// Signals
// --------------------------------------
wire [NUM_REQUESTERS-1:0] top_priority;
reg [NUM_REQUESTERS-1:0] top_priority_reg;
reg [NUM_REQUESTERS-1:0] last_grant;
wire [2*NUM_REQUESTERS-1:0] result;
// --------------------------------------
// Scheme Selection
// --------------------------------------
generate
if (SCHEME == "round-robin" && NUM_REQUESTERS > 1) begin
assign top_priority = top_priority_reg;
end
else begin
// Fixed arbitration (or single-requester corner case)
assign top_priority = 1'b1;
end
endgenerate
// --------------------------------------
// Decision Logic
// --------------------------------------
altera_merlin_arb_adder
#(
.WIDTH (2 * NUM_REQUESTERS)
)
adder
(
.a ({ ~request, ~request }),
.b ({{NUM_REQUESTERS{1'b0}}, top_priority}),
.sum (result)
);
generate if (SCHEME == "no-arb") begin
// --------------------------------------
// No arbitration: just wire request directly to grant
// --------------------------------------
assign grant = request;
end else begin
// Do the math in double-vector domain
wire [2*NUM_REQUESTERS-1:0] grant_double_vector;
assign grant_double_vector = {request, request} & result;
// --------------------------------------
// Extract grant from the top and bottom halves
// of the double vector.
// --------------------------------------
assign grant =
grant_double_vector[NUM_REQUESTERS - 1 : 0] |
grant_double_vector[2 * NUM_REQUESTERS - 1 : NUM_REQUESTERS];
end
endgenerate
// --------------------------------------
// Left-rotate the last grant vector to create top_priority.
// --------------------------------------
always @(posedge clk or posedge reset) begin
if (reset) begin
top_priority_reg <= 1'b1;
end
else begin
if (PIPELINE) begin
if (increment_top_priority) begin
top_priority_reg <= (|request) ? {grant[NUM_REQUESTERS-2:0],
grant[NUM_REQUESTERS-1]} : top_priority_reg;
end
end else begin
if (increment_top_priority) begin
if (|request)
top_priority_reg <= { grant[NUM_REQUESTERS-2:0],
grant[NUM_REQUESTERS-1] };
else
top_priority_reg <= { top_priority_reg[NUM_REQUESTERS-2:0], top_priority_reg[NUM_REQUESTERS-1] };
end
else if (save_top_priority) begin
top_priority_reg <= grant;
end
end
end
end
endmodule
// ----------------------------------------------
// Adder for the standard arbitrator
// ----------------------------------------------
module altera_merlin_arb_adder
#(
parameter WIDTH = 8
)
(
input [WIDTH-1:0] a,
input [WIDTH-1:0] b,
output [WIDTH-1:0] sum
);
wire [WIDTH:0] sum_lint;
// ----------------------------------------------
// Benchmarks indicate that for small widths, the full
// adder has higher fmax because synthesis can merge
// it with the mux, allowing partial decisions to be
// made early.
//
// The magic number is 4 requesters, which means an
// 8 bit adder.
// ----------------------------------------------
genvar i;
generate if (WIDTH <= 8) begin : full_adder
wire cout[WIDTH-1:0];
assign sum[0] = (a[0] ^ b[0]);
assign cout[0] = (a[0] & b[0]);
for (i = 1; i < WIDTH; i = i+1) begin : arb
assign sum[i] = (a[i] ^ b[i]) ^ cout[i-1];
assign cout[i] = (a[i] & b[i]) | (cout[i-1] & (a[i] ^ b[i]));
end
end else begin : carry_chain
assign sum_lint = a + b;
assign sum = sum_lint[WIDTH-1:0];
end
endgenerate
endmodule

View file

@ -0,0 +1,296 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
// (C) 2001-2012 Altera Corporation. All rights reserved.
// Your use of Altera Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Altera Program License Subscription
// Agreement, Altera MegaCore Function License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Altera and sold by
// Altera or its authorized distributors. Please refer to the applicable
// agreement for further details.
// $Id: //acds/rel/18.1std/ip/merlin/altera_merlin_slave_agent/altera_merlin_burst_uncompressor.sv#1 $
// $Revision: #1 $
// $Date: 2018/07/18 $
// $Author: psgswbuild $
// ------------------------------------------
// Merlin Burst Uncompressor
//
// Compressed read bursts -> uncompressed
// ------------------------------------------
`timescale 1 ns / 1 ns
module altera_merlin_burst_uncompressor
#(
parameter ADDR_W = 16,
parameter BURSTWRAP_W = 3,
parameter BYTE_CNT_W = 4,
parameter PKT_SYMBOLS = 4,
parameter BURST_SIZE_W = 3
)
(
input clk,
input reset,
// sink ST signals
input sink_startofpacket,
input sink_endofpacket,
input sink_valid,
output sink_ready,
// sink ST "data"
input [ADDR_W - 1: 0] sink_addr,
input [BURSTWRAP_W - 1 : 0] sink_burstwrap,
input [BYTE_CNT_W - 1 : 0] sink_byte_cnt,
input sink_is_compressed,
input [BURST_SIZE_W-1 : 0] sink_burstsize,
// source ST signals
output source_startofpacket,
output source_endofpacket,
output source_valid,
input source_ready,
// source ST "data"
output [ADDR_W - 1: 0] source_addr,
output [BURSTWRAP_W - 1 : 0] source_burstwrap,
output [BYTE_CNT_W - 1 : 0] source_byte_cnt,
// Note: in the slave agent, the output should always be uncompressed. In
// other applications, it may be required to leave-compressed or not. How to
// control? Seems like a simple mux - pass-through if no uncompression is
// required.
output source_is_compressed,
output [BURST_SIZE_W-1 : 0] source_burstsize
);
//----------------------------------------------------
// AXSIZE decoding
//
// Turns the axsize value into the actual number of bytes
// being transferred.
// ---------------------------------------------------
function reg[63:0] bytes_in_transfer;
input [BURST_SIZE_W-1:0] axsize;
case (axsize)
4'b0000: bytes_in_transfer = 64'b0000000000000000000000000000000000000000000000000000000000000001;
4'b0001: bytes_in_transfer = 64'b0000000000000000000000000000000000000000000000000000000000000010;
4'b0010: bytes_in_transfer = 64'b0000000000000000000000000000000000000000000000000000000000000100;
4'b0011: bytes_in_transfer = 64'b0000000000000000000000000000000000000000000000000000000000001000;
4'b0100: bytes_in_transfer = 64'b0000000000000000000000000000000000000000000000000000000000010000;
4'b0101: bytes_in_transfer = 64'b0000000000000000000000000000000000000000000000000000000000100000;
4'b0110: bytes_in_transfer = 64'b0000000000000000000000000000000000000000000000000000000001000000;
4'b0111: bytes_in_transfer = 64'b0000000000000000000000000000000000000000000000000000000010000000;
4'b1000: bytes_in_transfer = 64'b0000000000000000000000000000000000000000000000000000000100000000;
4'b1001: bytes_in_transfer = 64'b0000000000000000000000000000000000000000000000000000001000000000;
default:bytes_in_transfer = 64'b0000000000000000000000000000000000000000000000000000000000000001;
endcase
endfunction
// num_symbols is PKT_SYMBOLS, appropriately sized.
wire [31:0] int_num_symbols = PKT_SYMBOLS;
wire [BYTE_CNT_W-1:0] num_symbols = int_num_symbols[BYTE_CNT_W-1:0];
// def: Burst Compression. In a merlin network, a compressed burst is one
// which is transmitted in a single beat. Example: read burst. In
// constrast, an uncompressed burst (example: write burst) is transmitted in
// one beat per writedata item.
//
// For compressed bursts which require response packets, burst
// uncompression is required. Concrete example: a read burst of size 8
// occupies one response-fifo position. When that fifo position reaches the
// front of the FIFO, the slave starts providing the required 8 readdatavalid
// pulses. The 8 return response beats must be provided in a single packet,
// with incrementing address and decrementing byte_cnt fields. Upon receipt
// of the final readdata item of the burst, the response FIFO item is
// retired.
// Burst uncompression logic provides:
// a) 2-state FSM (idle, busy)
// reset to idle state
// transition to busy state for 2nd and subsequent rdv pulses
// - a single-cycle burst (aka non-burst read) causes no transition to
// busy state.
// b) response startofpacket/endofpacket logic. The response FIFO item
// will have sop asserted, and may have eop asserted. (In the case of
// multiple read bursts transmit in the command fabric in a single packet,
// the eop assertion will come in a later FIFO item.) To support packet
// conservation, and emit a well-formed packet on the response fabric,
// i) response fabric startofpacket is asserted only for the first resp.
// beat;
// ii) response fabric endofpacket is asserted only for the last resp.
// beat.
// c) response address field. The response address field contains an
// incrementing sequence, such that each readdata item is associated with
// its slave-map location. N.b. a) computing the address correctly requires
// knowledge of burstwrap behavior b) there may be no clients of the address
// field, which makes this field a good target for optimization. See
// burst_uncompress_address_counter below.
// d) response byte_cnt field. The response byte_cnt field contains a
// decrementing sequence, such that each beat of the response contains the
// count of bytes to follow. In the case of sub-bursts in a single packet,
// the byte_cnt field may decrement down to num_symbols, then back up to
// some value, multiple times in the packet.
reg burst_uncompress_busy;
reg [BYTE_CNT_W:0] burst_uncompress_byte_counter;
wire [BYTE_CNT_W-1:0] burst_uncompress_byte_counter_lint;
wire first_packet_beat;
wire last_packet_beat;
assign first_packet_beat = sink_valid & ~burst_uncompress_busy;
assign burst_uncompress_byte_counter_lint = burst_uncompress_byte_counter[BYTE_CNT_W-1:0];
// First cycle: burst_uncompress_byte_counter isn't ready yet, mux the input to
// the output.
assign source_byte_cnt =
first_packet_beat ? sink_byte_cnt : burst_uncompress_byte_counter_lint;
assign source_valid = sink_valid;
// Last packet beat is set throughout receipt of an uncompressed read burst
// from the response FIFO - this forces all the burst uncompression machinery
// idle.
assign last_packet_beat = ~sink_is_compressed |
(
burst_uncompress_busy ?
(sink_valid & (burst_uncompress_byte_counter_lint == num_symbols)) :
sink_valid & (sink_byte_cnt == num_symbols)
);
always @(posedge clk or posedge reset) begin
if (reset) begin
burst_uncompress_busy <= '0;
burst_uncompress_byte_counter <= '0;
end
else begin
if (source_valid & source_ready & sink_valid) begin
// No matter what the current state, last_packet_beat leads to
// idle.
if (last_packet_beat) begin
burst_uncompress_busy <= '0;
burst_uncompress_byte_counter <= '0;
end
else begin
if (burst_uncompress_busy) begin
burst_uncompress_byte_counter <= (burst_uncompress_byte_counter > 0) ?
(burst_uncompress_byte_counter_lint - num_symbols) :
(sink_byte_cnt - num_symbols);
end
else begin // not busy, at least one more beat to go
burst_uncompress_byte_counter <= sink_byte_cnt - num_symbols;
// To do: should busy go true for numsymbols-size compressed
// bursts?
burst_uncompress_busy <= 1'b1;
end
end
end
end
end
reg [ADDR_W - 1 : 0 ] burst_uncompress_address_base;
reg [ADDR_W - 1 : 0] burst_uncompress_address_offset;
wire [63:0] decoded_burstsize_wire;
wire [ADDR_W-1:0] decoded_burstsize;
localparam ADD_BURSTWRAP_W = (ADDR_W > BURSTWRAP_W) ? ADDR_W : BURSTWRAP_W;
wire [ADD_BURSTWRAP_W-1:0] addr_width_burstwrap;
// The input burstwrap value can be used as a mask against address values,
// but with one caveat: the address width may be (probably is) wider than
// the burstwrap width. The spec says: extend the msb of the burstwrap
// value out over the entire address width (but only if the address width
// actually is wider than the burstwrap width; otherwise it's a 0-width or
// negative range and concatenation multiplier).
generate
if (ADDR_W > BURSTWRAP_W) begin : addr_sign_extend
// Sign-extend, just wires:
assign addr_width_burstwrap[ADDR_W - 1 : BURSTWRAP_W] =
{(ADDR_W - BURSTWRAP_W) {sink_burstwrap[BURSTWRAP_W - 1]}};
assign addr_width_burstwrap[BURSTWRAP_W-1:0] = sink_burstwrap [BURSTWRAP_W-1:0];
end
else begin
assign addr_width_burstwrap[BURSTWRAP_W-1 : 0] = sink_burstwrap;
end
endgenerate
always @(posedge clk or posedge reset) begin
if (reset) begin
burst_uncompress_address_base <= '0;
end
else if (first_packet_beat & source_ready) begin
burst_uncompress_address_base <= sink_addr & ~addr_width_burstwrap[ADDR_W-1:0];
end
end
assign decoded_burstsize_wire = bytes_in_transfer(sink_burstsize); //expand it to 64 bits
assign decoded_burstsize = decoded_burstsize_wire[ADDR_W-1:0]; //then take the width that is needed
wire [ADDR_W : 0] p1_burst_uncompress_address_offset =
(
(first_packet_beat ?
sink_addr :
burst_uncompress_address_offset) + decoded_burstsize
) &
addr_width_burstwrap[ADDR_W-1:0];
wire [ADDR_W-1:0] p1_burst_uncompress_address_offset_lint = p1_burst_uncompress_address_offset [ADDR_W-1:0];
always @(posedge clk or posedge reset) begin
if (reset) begin
burst_uncompress_address_offset <= '0;
end
else begin
if (source_ready & source_valid) begin
burst_uncompress_address_offset <= p1_burst_uncompress_address_offset_lint;
// if (first_packet_beat) begin
// burst_uncompress_address_offset <=
// (sink_addr + num_symbols) & addr_width_burstwrap;
// end
// else begin
// burst_uncompress_address_offset <=
// (burst_uncompress_address_offset + num_symbols) & addr_width_burstwrap;
// end
end
end
end
// On the first packet beat, send the input address out unchanged,
// while values are computed/registered for 2nd and subsequent beats.
assign source_addr = first_packet_beat ? sink_addr :
burst_uncompress_address_base | burst_uncompress_address_offset;
assign source_burstwrap = sink_burstwrap;
assign source_burstsize = sink_burstsize;
//-------------------------------------------------------------------
// A single (compressed) read burst will have sop/eop in the same beat.
// A sequence of read sub-bursts emitted by a burst adapter in response to a
// single read burst will have sop on the first sub-burst, eop on the last.
// Assert eop only upon (sink_endofpacket & last_packet_beat) to preserve
// packet conservation.
assign source_startofpacket = sink_startofpacket & ~burst_uncompress_busy;
assign source_endofpacket = sink_endofpacket & last_packet_beat;
assign sink_ready = source_valid & source_ready & last_packet_beat;
// This is correct for the slave agent usage, but won't always be true in the
// width adapter. To do: add an "please uncompress" input, and use it to
// pass-through or modify, and set source_is_compressed accordingly.
assign source_is_compressed = 1'b0;
endmodule

View file

@ -0,0 +1,303 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
// $Id: //acds/rel/18.1std/ip/merlin/altera_merlin_master_agent/altera_merlin_master_agent.sv#1 $
// $Revision: #1 $
// $Date: 2018/07/18 $
// $Author: psgswbuild $
// --------------------------------------
// Merlin Master Agent
//
// Converts Avalon-MM transactions into
// Merlin network packets.
// --------------------------------------
`timescale 1 ns / 1 ns
module altera_merlin_master_agent
#(
// -------------------
// Packet Format Parameters
// -------------------
parameter
PKT_QOS_H = 109,
PKT_QOS_L = 106,
PKT_DATA_SIDEBAND_H = 105,
PKT_DATA_SIDEBAND_L = 98,
PKT_ADDR_SIDEBAND_H = 97,
PKT_ADDR_SIDEBAND_L = 93,
PKT_CACHE_H = 92,
PKT_CACHE_L = 89,
PKT_THREAD_ID_H = 88,
PKT_THREAD_ID_L = 87,
PKT_BEGIN_BURST = 81,
PKT_PROTECTION_H = 80,
PKT_PROTECTION_L = 80,
PKT_BURSTWRAP_H = 79,
PKT_BURSTWRAP_L = 77,
PKT_BYTE_CNT_H = 76,
PKT_BYTE_CNT_L = 74,
PKT_ADDR_H = 73,
PKT_ADDR_L = 42,
PKT_BURST_SIZE_H = 86,
PKT_BURST_SIZE_L = 84,
PKT_BURST_TYPE_H = 94,
PKT_BURST_TYPE_L = 93,
PKT_TRANS_EXCLUSIVE = 83,
PKT_TRANS_LOCK = 82,
PKT_TRANS_COMPRESSED_READ = 41,
PKT_TRANS_POSTED = 40,
PKT_TRANS_WRITE = 39,
PKT_TRANS_READ = 38,
PKT_DATA_H = 37,
PKT_DATA_L = 6,
PKT_BYTEEN_H = 5,
PKT_BYTEEN_L = 2,
PKT_SRC_ID_H = 1,
PKT_SRC_ID_L = 1,
PKT_DEST_ID_H = 0,
PKT_DEST_ID_L = 0,
PKT_RESPONSE_STATUS_L = 110,
PKT_RESPONSE_STATUS_H = 111,
PKT_ORI_BURST_SIZE_L = 112,
PKT_ORI_BURST_SIZE_H = 114,
ST_DATA_W = 115,
ST_CHANNEL_W = 1,
// -------------------
// Agent Parameters
// -------------------
AV_BURSTCOUNT_W = 3,
ID = 1,
SUPPRESS_0_BYTEEN_RSP = 1,
BURSTWRAP_VALUE = 4,
CACHE_VALUE = 0,
SECURE_ACCESS_BIT = 1,
USE_READRESPONSE = 0,
USE_WRITERESPONSE = 0,
// -------------------
// Derived Parameters
// -------------------
PKT_BURSTWRAP_W = PKT_BURSTWRAP_H - PKT_BURSTWRAP_L + 1,
PKT_BYTE_CNT_W = PKT_BYTE_CNT_H - PKT_BYTE_CNT_L + 1,
PKT_PROTECTION_W = PKT_PROTECTION_H - PKT_PROTECTION_L + 1,
PKT_ADDR_W = PKT_ADDR_H - PKT_ADDR_L + 1,
PKT_DATA_W = PKT_DATA_H - PKT_DATA_L + 1,
PKT_BYTEEN_W = PKT_BYTEEN_H - PKT_BYTEEN_L + 1,
PKT_SRC_ID_W = PKT_SRC_ID_H - PKT_SRC_ID_L + 1,
PKT_DEST_ID_W = PKT_DEST_ID_H - PKT_DEST_ID_L + 1,
PKT_BURST_SIZE_W = PKT_BURST_SIZE_H - PKT_BURST_SIZE_L + 1
) (
// -------------------
// Clock & Reset
// -------------------
input clk,
input reset,
// -------------------
// Avalon-MM Anti-Master
// -------------------
input [PKT_ADDR_W-1 : 0] av_address,
input av_write,
input av_read,
input [PKT_DATA_W-1 : 0] av_writedata,
output reg [PKT_DATA_W-1 : 0] av_readdata,
output reg av_waitrequest,
output reg av_readdatavalid,
input [PKT_BYTEEN_W-1 : 0] av_byteenable,
input [AV_BURSTCOUNT_W-1 : 0] av_burstcount,
input av_debugaccess,
input av_lock,
output reg [1 : 0] av_response,
output reg av_writeresponsevalid,
// -------------------
// Command Source
// -------------------
output reg cp_valid,
output reg [ST_DATA_W-1 : 0] cp_data,
output wire cp_startofpacket,
output wire cp_endofpacket,
input cp_ready,
// -------------------
// Response Sink
// -------------------
input rp_valid,
input [ST_DATA_W-1 : 0] rp_data,
input [ST_CHANNEL_W-1 : 0] rp_channel,
input rp_startofpacket,
input rp_endofpacket,
output reg rp_ready
);
// ------------------------------------------------------------
// Utility Functions
// ------------------------------------------------------------
function integer clogb2;
input [31 : 0] value;
begin
for (clogb2 = 0; value > 0; clogb2 = clogb2 + 1)
value = value >> 1;
clogb2 = clogb2 - 1;
end
endfunction // clogb2
localparam MAX_BURST = 1 << (AV_BURSTCOUNT_W - 1);
localparam NUMSYMBOLS = PKT_BYTEEN_W;
localparam BURSTING = (MAX_BURST > NUMSYMBOLS);
localparam BITS_TO_ZERO = clogb2(NUMSYMBOLS);
localparam BURST_SIZE = clogb2(NUMSYMBOLS);
typedef enum bit [1 : 0]
{
FIXED = 2'b00,
INCR = 2'b01,
WRAP = 2'b10,
OTHER_WRAP = 2'b11
} MerlinBurstType;
// --------------------------------------
// Potential optimization: compare in words to save bits?
// --------------------------------------
wire is_burst;
assign is_burst = (BURSTING) & (av_burstcount > NUMSYMBOLS);
wire [31 : 0] burstwrap_value_int = BURSTWRAP_VALUE;
wire [31 : 0] id_int = ID;
wire [PKT_BURST_SIZE_W-1 : 0] burstsize_sig = BURST_SIZE[PKT_BURST_SIZE_W-1 : 0];
wire [1 : 0] bursttype_value = burstwrap_value_int[PKT_BURSTWRAP_W-1] ? INCR : WRAP;
// --------------------------------------
// Address alignment
//
// The packet format requires that addresses be aligned to
// the transaction size.
// --------------------------------------
wire [PKT_ADDR_W-1 : 0] av_address_aligned;
generate
if (NUMSYMBOLS > 1) begin
assign av_address_aligned =
{av_address[PKT_ADDR_W-1 : BITS_TO_ZERO], {BITS_TO_ZERO {1'b0}}};
end
else begin
assign av_address_aligned = av_address;
end
endgenerate
// --------------------------------------
// Command & Response Construction
// --------------------------------------
always_comb begin
cp_data = '0;
cp_data[PKT_PROTECTION_L] = av_debugaccess;
cp_data[PKT_PROTECTION_L+1] = SECURE_ACCESS_BIT[0]; // secure cache bit
cp_data[PKT_PROTECTION_L+2] = 1'b0; // instruction/data cache bit
cp_data[PKT_BURSTWRAP_H : PKT_BURSTWRAP_L] = burstwrap_value_int[PKT_BURSTWRAP_W-1 : 0];
cp_data[PKT_BYTE_CNT_H : PKT_BYTE_CNT_L] = av_burstcount;
cp_data[PKT_ADDR_H : PKT_ADDR_L] = av_address_aligned;
cp_data[PKT_TRANS_EXCLUSIVE] = 1'b0;
cp_data[PKT_TRANS_LOCK] = av_lock;
cp_data[PKT_TRANS_COMPRESSED_READ] = av_read & is_burst;
cp_data[PKT_TRANS_READ] = av_read;
cp_data[PKT_TRANS_WRITE] = av_write;
cp_data[PKT_TRANS_POSTED] = av_write & !USE_WRITERESPONSE;
cp_data[PKT_DATA_H : PKT_DATA_L] = av_writedata;
cp_data[PKT_BYTEEN_H : PKT_BYTEEN_L] = av_byteenable;
cp_data[PKT_BURST_SIZE_H : PKT_BURST_SIZE_L] = burstsize_sig;
cp_data[PKT_ORI_BURST_SIZE_H : PKT_ORI_BURST_SIZE_L] = burstsize_sig;
cp_data[PKT_BURST_TYPE_H : PKT_BURST_TYPE_L] = bursttype_value;
cp_data[PKT_SRC_ID_H : PKT_SRC_ID_L] = id_int[PKT_SRC_ID_W-1 : 0];
cp_data[PKT_THREAD_ID_H : PKT_THREAD_ID_L] = '0;
cp_data[PKT_CACHE_H : PKT_CACHE_L] = CACHE_VALUE[3 : 0];
cp_data[PKT_QOS_H : PKT_QOS_L] = '0;
cp_data[PKT_ADDR_SIDEBAND_H : PKT_ADDR_SIDEBAND_L] = '0;
cp_data[PKT_DATA_SIDEBAND_H : PKT_DATA_SIDEBAND_L] = '0;
av_readdata = rp_data[PKT_DATA_H : PKT_DATA_L];
if (USE_WRITERESPONSE || USE_READRESPONSE)
av_response = rp_data[PKT_RESPONSE_STATUS_H : PKT_RESPONSE_STATUS_L];
else
av_response = '0;
end
// --------------------------------------
// Command Control
// --------------------------------------
reg hold_waitrequest;
always @ (posedge clk, posedge reset) begin
if (reset)
hold_waitrequest <= 1'b1;
else
hold_waitrequest <= 1'b0;
end
always_comb begin
cp_valid = 0;
if ((av_write || av_read) && ~hold_waitrequest)
cp_valid = 1;
end
generate if (BURSTING) begin
reg sop_enable;
always @(posedge clk, posedge reset) begin
if (reset) begin
sop_enable <= 1'b1;
end
else begin
if (cp_valid && cp_ready) begin
sop_enable <= 1'b0;
if (cp_endofpacket)
sop_enable <= 1'b1;
end
end
end
assign cp_startofpacket = sop_enable;
assign cp_endofpacket = (av_read) | (av_burstcount == NUMSYMBOLS);
end
else begin
assign cp_startofpacket = 1'b1;
assign cp_endofpacket = 1'b1;
end
endgenerate
// --------------------------------------
// Backpressure & Readdatavalid
// --------------------------------------
always_comb begin
rp_ready = 1;
av_readdatavalid = 0;
av_writeresponsevalid = 0;
av_waitrequest = hold_waitrequest | !cp_ready;
if (USE_WRITERESPONSE && (rp_data[PKT_TRANS_WRITE] == 1))
av_writeresponsevalid = rp_valid;
else
av_readdatavalid = rp_valid;
if (SUPPRESS_0_BYTEEN_RSP) begin
if (rp_data[PKT_BYTEEN_H : PKT_BYTEEN_L] == 0)
av_readdatavalid = 0;
end
end
endmodule

View file

@ -0,0 +1,556 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
// $Id: //acds/rel/18.1std/ip/merlin/altera_merlin_master_translator/altera_merlin_master_translator.sv#1 $
// $Revision: #1 $
// $Date: 2018/07/18 $
// $Author: psgswbuild $
// --------------------------------------
// Merlin Master Translator
//
// Converts an Avalon-MM master interface into an
// Avalon-MM "universal" master interface.
//
// The universal interface is defined as the superset of ports
// and parameters that can represent any legal Avalon
// interface.
// --------------------------------------
`timescale 1 ns / 1 ns
module altera_merlin_master_translator #(
parameter
// widths
AV_ADDRESS_W = 32,
AV_DATA_W = 32,
AV_BURSTCOUNT_W = 4,
AV_BYTEENABLE_W = 4,
UAV_ADDRESS_W = 38,
UAV_BURSTCOUNT_W = 10,
// optional ports
USE_BURSTCOUNT = 1,
USE_BEGINBURSTTRANSFER = 0,
USE_BEGINTRANSFER = 0,
USE_CHIPSELECT = 0,
USE_READ = 1,
USE_READDATAVALID = 1,
USE_WRITE = 1,
USE_WAITREQUEST = 1,
USE_WRITERESPONSE = 0,
USE_READRESPONSE = 0,
AV_REGISTERINCOMINGSIGNALS = 0,
AV_SYMBOLS_PER_WORD = 4,
AV_ADDRESS_SYMBOLS = 0,
// must be enabled for a bursting master
AV_CONSTANT_BURST_BEHAVIOR = 1,
UAV_CONSTANT_BURST_BEHAVIOR = 0,
AV_BURSTCOUNT_SYMBOLS = 0,
AV_LINEWRAPBURSTS = 0
)(
input wire clk,
input wire reset,
// Universal Avalon Master
output reg uav_write,
output reg uav_read,
output reg [UAV_ADDRESS_W -1 : 0] uav_address,
output reg [UAV_BURSTCOUNT_W -1 : 0] uav_burstcount,
output wire [AV_BYTEENABLE_W -1 : 0] uav_byteenable,
output wire [AV_DATA_W -1 : 0] uav_writedata,
output wire uav_lock,
output wire uav_debugaccess,
output wire uav_clken,
input wire [AV_DATA_W -1 : 0] uav_readdata,
input wire uav_readdatavalid,
input wire uav_waitrequest,
input wire [1 : 0] uav_response,
input wire uav_writeresponsevalid,
// Avalon-MM Anti-master (slave)
input reg av_write,
input reg av_read,
input wire [AV_ADDRESS_W -1 : 0] av_address,
input wire [AV_BYTEENABLE_W -1 : 0] av_byteenable,
input wire [AV_BURSTCOUNT_W -1 : 0] av_burstcount,
input wire [AV_DATA_W -1 : 0] av_writedata,
input wire av_begintransfer,
input wire av_beginbursttransfer,
input wire av_lock,
input wire av_chipselect,
input wire av_debugaccess,
input wire av_clken,
output wire [AV_DATA_W -1 : 0] av_readdata,
output wire av_readdatavalid,
output reg av_waitrequest,
output reg [1 : 0] av_response,
output reg av_writeresponsevalid
);
localparam BITS_PER_WORD = clog2(AV_SYMBOLS_PER_WORD);
localparam AV_MAX_SYMBOL_BURST = flog2(pow2(AV_BURSTCOUNT_W - 1) * (AV_BURSTCOUNT_SYMBOLS ? 1 : AV_SYMBOLS_PER_WORD));
localparam AV_MAX_SYMBOL_BURST_MINUS_ONE = AV_MAX_SYMBOL_BURST ? AV_MAX_SYMBOL_BURST - 1 : 0;
localparam UAV_BURSTCOUNT_H_OR_31 = (UAV_BURSTCOUNT_W > 32) ? 31 : UAV_BURSTCOUNT_W - 1;
localparam UAV_ADDRESS_H_OR_31 = (UAV_ADDRESS_W > 32) ? 31 : UAV_ADDRESS_W - 1;
localparam BITS_PER_WORD_BURSTCOUNT = (UAV_BURSTCOUNT_W == 1) ? 0 : BITS_PER_WORD;
localparam BITS_PER_WORD_ADDRESS = (UAV_ADDRESS_W == 1) ? 0 : BITS_PER_WORD;
localparam ADDRESS_LOW = AV_ADDRESS_SYMBOLS ? 0 : BITS_PER_WORD_ADDRESS;
localparam BURSTCOUNT_LOW = AV_BURSTCOUNT_SYMBOLS ? 0 : BITS_PER_WORD_BURSTCOUNT;
localparam ADDRESS_HIGH = (UAV_ADDRESS_W > AV_ADDRESS_W + ADDRESS_LOW) ? AV_ADDRESS_W : (UAV_ADDRESS_W - ADDRESS_LOW);
localparam BURSTCOUNT_HIGH = (UAV_BURSTCOUNT_W > AV_BURSTCOUNT_W + BURSTCOUNT_LOW) ? AV_BURSTCOUNT_W : (UAV_BURSTCOUNT_W - BURSTCOUNT_LOW);
function integer flog2;
input [31:0] depth;
integer i;
begin
i = depth;
if ( i <= 0 ) flog2 = 0;
else begin
for (flog2 = -1; i > 0; flog2 = flog2 + 1)
i = i >> 1;
end
end
endfunction // flog2
// ------------------------------------------------------------
// Calculates the ceil(log2()) of the input val.
//
// Limited to a positive 32-bit input value.
// ------------------------------------------------------------
function integer clog2;
input[31:0] val;
reg[31:0] i;
begin
i = 1;
clog2 = 0;
while (i < val) begin
clog2 = clog2 + 1;
i = i[30:0] << 1;
end
end
endfunction
function integer pow2;
input [31:0] toShift;
begin
pow2 = 1;
pow2 = pow2 << toShift;
end
endfunction // pow2
// -------------------------------------------------
// Assign some constants to appropriately-sized signals to
// avoid synthesis warnings. This also helps some simulators
// with their inferred sensitivity lists.
//
// The symbols per word calculation here rounds non-power of two
// symbols to the next highest power of two, which is what we want
// when calculating the decrementing byte count.
// -------------------------------------------------
wire [31 : 0] symbols_per_word_int = 2**(clog2(AV_SYMBOLS_PER_WORD[UAV_BURSTCOUNT_H_OR_31 : 0]));
wire [UAV_BURSTCOUNT_H_OR_31 : 0] symbols_per_word = symbols_per_word_int[UAV_BURSTCOUNT_H_OR_31 : 0];
reg internal_beginbursttransfer;
reg internal_begintransfer;
reg [UAV_ADDRESS_W -1 : 0] uav_address_pre;
reg [UAV_BURSTCOUNT_W -1 : 0] uav_burstcount_pre;
reg uav_read_pre;
reg uav_write_pre;
reg read_accepted;
// -------------------------------------------------
// Pass through signals that we don't touch
// -------------------------------------------------
assign uav_writedata = av_writedata;
assign uav_byteenable = av_byteenable;
assign uav_lock = av_lock;
assign uav_debugaccess = av_debugaccess;
assign uav_clken = av_clken;
assign av_readdata = uav_readdata;
assign av_readdatavalid = uav_readdatavalid;
// -------------------------------------------------
// Response signals
// -------------------------------------------------
always_comb begin
if (!USE_READRESPONSE && !USE_WRITERESPONSE)
av_response = '0;
else
av_response = uav_response;
if (USE_WRITERESPONSE) begin
av_writeresponsevalid = uav_writeresponsevalid;
end else begin
av_writeresponsevalid = '0;
end
end
// -------------------------------------------------
// Convert byte and word addresses into byte addresses
// -------------------------------------------------
always_comb begin
uav_address_pre = {UAV_ADDRESS_W{1'b0}};
if (AV_ADDRESS_SYMBOLS)
uav_address_pre[(ADDRESS_HIGH ? ADDRESS_HIGH - 1 : 0) : 0] = av_address[(ADDRESS_HIGH ? ADDRESS_HIGH - 1 : 0) : 0];
else begin
uav_address_pre[ADDRESS_LOW + ADDRESS_HIGH - 1 : ADDRESS_LOW] = av_address[(ADDRESS_HIGH ? ADDRESS_HIGH - 1 : 0) : 0];
end
end
// -------------------------------------------------
// Convert burstcount into symbol units
// -------------------------------------------------
always_comb begin
uav_burstcount_pre = symbols_per_word; // default to a single transfer
if (USE_BURSTCOUNT) begin
uav_burstcount_pre = {UAV_BURSTCOUNT_W{1'b0}};
if (AV_BURSTCOUNT_SYMBOLS)
uav_burstcount_pre[(BURSTCOUNT_HIGH ? BURSTCOUNT_HIGH - 1 : 0) :0] = av_burstcount[(BURSTCOUNT_HIGH ? BURSTCOUNT_HIGH - 1 : 0) : 0];
else begin
uav_burstcount_pre[UAV_BURSTCOUNT_W - 1 : BURSTCOUNT_LOW] = av_burstcount[(BURSTCOUNT_HIGH ? BURSTCOUNT_HIGH - 1 : 0) : 0];
end
end
end
// -------------------------------------------------
// This is where we perform the per-transfer address and burstcount
// calculations that are required by downstream modules.
// -------------------------------------------------
reg [UAV_ADDRESS_W -1 : 0] address_register;
wire [UAV_BURSTCOUNT_W -1 : 0] burstcount_register;
reg [UAV_BURSTCOUNT_W : 0] burstcount_register_lint;
assign burstcount_register = burstcount_register_lint[UAV_BURSTCOUNT_W -1 : 0];
always_comb begin
uav_address = uav_address_pre;
uav_burstcount = uav_burstcount_pre;
if (AV_CONSTANT_BURST_BEHAVIOR && !UAV_CONSTANT_BURST_BEHAVIOR && ~internal_beginbursttransfer) begin
uav_address = address_register;
uav_burstcount = burstcount_register;
end
end
reg first_burst_stalled;
reg burst_stalled;
wire [UAV_ADDRESS_W -1 : 0] combi_burst_addr_reg;
wire [UAV_ADDRESS_W -1 : 0] combi_addr_reg;
generate
if (AV_LINEWRAPBURSTS && AV_MAX_SYMBOL_BURST != 0) begin
if (AV_MAX_SYMBOL_BURST > UAV_ADDRESS_W - 1) begin
assign combi_burst_addr_reg = { uav_address_pre[UAV_ADDRESS_W-1:0] + AV_SYMBOLS_PER_WORD[UAV_ADDRESS_W-1:0] };
assign combi_addr_reg = { address_register[UAV_ADDRESS_W-1:0] + AV_SYMBOLS_PER_WORD[UAV_ADDRESS_W-1:0] };
end
else begin
assign combi_burst_addr_reg = { uav_address_pre[UAV_ADDRESS_W - 1 : AV_MAX_SYMBOL_BURST], uav_address_pre[AV_MAX_SYMBOL_BURST_MINUS_ONE:0] + AV_SYMBOLS_PER_WORD[AV_MAX_SYMBOL_BURST_MINUS_ONE:0] };
assign combi_addr_reg = { address_register[UAV_ADDRESS_W - 1 : AV_MAX_SYMBOL_BURST], address_register[AV_MAX_SYMBOL_BURST_MINUS_ONE:0] + AV_SYMBOLS_PER_WORD[AV_MAX_SYMBOL_BURST_MINUS_ONE:0] };
end
end
else begin
assign combi_burst_addr_reg = uav_address_pre + AV_SYMBOLS_PER_WORD[UAV_ADDRESS_H_OR_31:0];
assign combi_addr_reg = address_register + AV_SYMBOLS_PER_WORD[UAV_ADDRESS_H_OR_31:0];
end
endgenerate
always @(posedge clk, posedge reset) begin
if (reset) begin
address_register <= '0;
burstcount_register_lint <= '0;
end else begin
address_register <= address_register;
burstcount_register_lint <= burstcount_register_lint;
if (internal_beginbursttransfer || first_burst_stalled) begin
if (av_waitrequest) begin
address_register <= uav_address_pre;
burstcount_register_lint[UAV_BURSTCOUNT_W - 1 : 0] <= uav_burstcount_pre;
end else begin
address_register <= combi_burst_addr_reg;
burstcount_register_lint <= uav_burstcount_pre - symbols_per_word;
end
end else if (internal_begintransfer || burst_stalled) begin
if (~av_waitrequest) begin
address_register <= combi_addr_reg;
burstcount_register_lint <= burstcount_register - symbols_per_word;
end
end
end
end
always @(posedge clk, posedge reset) begin
if (reset) begin
first_burst_stalled <= 1'b0;
burst_stalled <= 1'b0;
end else begin
if (internal_beginbursttransfer || first_burst_stalled) begin
if (av_waitrequest) begin
first_burst_stalled <= 1'b1;
end else begin
first_burst_stalled <= 1'b0;
end
end else if (internal_begintransfer || burst_stalled) begin
if (~av_waitrequest) begin
burst_stalled <= 1'b0;
end else begin
burst_stalled <= 1'b1;
end
end
end
end
// -------------------------------------------------
// Waitrequest translation
// -------------------------------------------------
always @(posedge clk, posedge reset) begin
if (reset)
read_accepted <= 1'b0;
else begin
read_accepted <= read_accepted;
if (read_accepted == 0)
read_accepted <= av_waitrequest ? uav_read_pre & ~uav_waitrequest : 1'b0;
else if (read_accepted == 1 && uav_readdatavalid == 1) // reset acceptance only when rdv arrives
read_accepted <= 1'b0;
end
end
reg write_accepted = 0;
generate if (AV_REGISTERINCOMINGSIGNALS) begin
always @(posedge clk, posedge reset) begin
if (reset)
write_accepted <= 1'b0;
else begin
write_accepted <=
~av_waitrequest ? 1'b0 :
uav_write & ~uav_waitrequest? 1'b1 :
write_accepted;
end
end
end endgenerate
always_comb begin
av_waitrequest = uav_waitrequest;
if (USE_READDATAVALID == 0) begin
av_waitrequest = uav_read_pre ? ~uav_readdatavalid : uav_waitrequest;
end
if (AV_REGISTERINCOMINGSIGNALS) begin
av_waitrequest =
uav_read_pre ? ~uav_readdatavalid :
uav_write_pre ? (internal_begintransfer | uav_waitrequest) & ~write_accepted :
1'b1;
end
if (USE_WAITREQUEST == 0) begin
av_waitrequest = 0;
end
end
// -------------------------------------------------
// Determine the output read and write signals from
// the read/write/chipselect input signals.
// -------------------------------------------------
always_comb begin
uav_write = 1'b0;
uav_write_pre = 1'b0;
uav_read = 1'b0;
uav_read_pre = 1'b0;
if (!USE_CHIPSELECT) begin
if (USE_READ) begin
uav_read_pre = av_read;
end
if (USE_WRITE) begin
uav_write_pre = av_write;
end
end else begin
if (!USE_WRITE && USE_READ) begin
uav_write_pre = av_chipselect & ~av_read;
uav_read_pre = av_read;
end else if (!USE_READ && USE_WRITE) begin
uav_write_pre = av_write;
uav_read_pre = av_chipselect & ~av_write;
end else if (USE_READ && USE_WRITE) begin
uav_write_pre = av_write;
uav_read_pre = av_read;
end
end
if (USE_READDATAVALID == 0)
uav_read = uav_read_pre & ~read_accepted;
else
uav_read = uav_read_pre;
if (AV_REGISTERINCOMINGSIGNALS == 0)
uav_write = uav_write_pre;
else
uav_write = uav_write_pre & ~write_accepted;
end
// -------------------------------------------------
// Begintransfer assignment
// -------------------------------------------------
reg end_begintransfer;
always_comb begin
if (USE_BEGINTRANSFER) begin
internal_begintransfer = av_begintransfer;
end else begin
internal_begintransfer = ( uav_write | uav_read ) & ~end_begintransfer;
end
end
always @(posedge clk or posedge reset) begin
if (reset) begin
end_begintransfer <= 1'b0;
end else begin
if (internal_begintransfer == 1 && uav_waitrequest)
end_begintransfer <= 1'b1;
else if (uav_waitrequest)
end_begintransfer <= end_begintransfer;
else
end_begintransfer <= 1'b0;
end
end
// -------------------------------------------------
// Beginbursttransfer assignment
// -------------------------------------------------
reg end_beginbursttransfer;
wire last_burst_transfer_pre;
wire last_burst_transfer_reg;
wire last_burst_transfer;
// compare values before the mux to shorten critical path; benchmark before changing
assign last_burst_transfer_pre = (uav_burstcount_pre == symbols_per_word);
assign last_burst_transfer_reg = (burstcount_register == symbols_per_word);
assign last_burst_transfer = (internal_beginbursttransfer) ? last_burst_transfer_pre : last_burst_transfer_reg;
always_comb begin
if (USE_BEGINBURSTTRANSFER) begin
internal_beginbursttransfer = av_beginbursttransfer;
end else begin
internal_beginbursttransfer = uav_read ? internal_begintransfer : internal_begintransfer && ~end_beginbursttransfer;
end
end
always @(posedge clk or posedge reset) begin
if (reset) begin
end_beginbursttransfer <= 1'b0;
end else begin
end_beginbursttransfer <= end_beginbursttransfer;
if (last_burst_transfer && internal_begintransfer || uav_read) begin
end_beginbursttransfer <= 1'b0;
end
else if (uav_write && internal_begintransfer) begin
end_beginbursttransfer <= 1'b1;
end
end
end
// synthesis translate_off
// ------------------------------------------------
// check_1 : for waitrequest signal violation
// Ensure that when waitreqeust is asserted, the master is not allowed to change its controls
// Exception : begintransfer / beginbursttransfer
// : previously not in any transaction (idle)
// Note : Not checking clken which is not exactly part of Avalon controls/inputs
// : Not using system verilog assertions (seq/prop) since it is not supported if using Modelsim_SE
// ------------------------------------------------
reg av_waitrequest_r;
reg av_write_r, av_read_r, av_lock_r, av_chipselect_r, av_debugaccess_r;
reg [AV_ADDRESS_W-1:0] av_address_r;
reg [AV_BYTEENABLE_W-1:0] av_byteenable_r;
reg [AV_BURSTCOUNT_W-1:0] av_burstcount_r;
reg [AV_DATA_W-1:0] av_writedata_r;
always @(posedge clk or posedge reset) begin
if (reset) begin
av_waitrequest_r <= '0;
av_write_r <= '0;
av_read_r <= '0;
av_lock_r <= '0;
av_chipselect_r <= '0;
av_debugaccess_r <= '0;
av_address_r <= '0;
av_byteenable_r <= '0;
av_burstcount_r <= '0;
av_writedata_r <= '0;
end else begin
av_waitrequest_r <= av_waitrequest;
av_write_r <= av_write;
av_read_r <= av_read;
av_lock_r <= av_lock;
av_chipselect_r <= av_chipselect;
av_debugaccess_r <= av_debugaccess;
av_address_r <= av_address;
av_byteenable_r <= av_byteenable;
av_burstcount_r <= av_burstcount;
av_writedata_r <= av_writedata;
if (
av_waitrequest_r && // When waitrequest is asserted
(
(av_write != av_write_r) || // Checks that : Input controls/data does not change
(av_read != av_read_r) ||
(av_lock != av_lock_r) ||
(av_debugaccess != av_debugaccess_r) ||
(av_address != av_address_r) ||
(av_byteenable != av_byteenable_r) ||
(av_burstcount != av_burstcount_r)
) &&
(av_write_r | av_read_r) && // Check only when : previously initiated a write/read
(!USE_CHIPSELECT | av_chipselect_r) // and chipselect was asserted (or unused)
) begin
$display( "%t: %m: Error: Input controls/data changed while av_waitrequest is asserted.", $time());
$display("av_address %x --> %x", av_address_r , av_address );
$display("av_byteenable %x --> %x", av_byteenable_r , av_byteenable );
$display("av_burstcount %x --> %x", av_burstcount_r , av_burstcount );
$display("av_writedata %x --> %x", av_writedata_r , av_writedata );
$display("av_write %x --> %x", av_write_r , av_write );
$display("av_read %x --> %x", av_read_r , av_read );
$display("av_lock %x --> %x", av_lock_r , av_lock );
$display("av_chipselect %x --> %x", av_chipselect_r , av_chipselect );
$display("av_debugaccess %x --> %x", av_debugaccess_r , av_debugaccess );
end
end
// end check_1
end
// synthesis translate_on
endmodule

View file

@ -0,0 +1,622 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
// (C) 2001-2011 Altera Corporation. All rights reserved.
// Your use of Altera Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Altera Program License Subscription
// Agreement, Altera MegaCore Function License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Altera and sold by
// Altera or its authorized distributors. Please refer to the applicable
// agreement for further details.
// $Id: //acds/rel/18.1std/ip/merlin/altera_merlin_slave_agent/altera_merlin_slave_agent.sv#1 $
// $Revision: #1 $
// $Date: 2018/07/18 $
// $Author: psgswbuild $
`timescale 1 ns / 1 ns
module altera_merlin_slave_agent
#(
// Packet parameters
parameter PKT_BEGIN_BURST = 81,
parameter PKT_DATA_H = 31,
parameter PKT_DATA_L = 0,
parameter PKT_SYMBOL_W = 8,
parameter PKT_BYTEEN_H = 71,
parameter PKT_BYTEEN_L = 68,
parameter PKT_ADDR_H = 63,
parameter PKT_ADDR_L = 32,
parameter PKT_TRANS_LOCK = 87,
parameter PKT_TRANS_COMPRESSED_READ = 67,
parameter PKT_TRANS_POSTED = 66,
parameter PKT_TRANS_WRITE = 65,
parameter PKT_TRANS_READ = 64,
parameter PKT_SRC_ID_H = 74,
parameter PKT_SRC_ID_L = 72,
parameter PKT_DEST_ID_H = 77,
parameter PKT_DEST_ID_L = 75,
parameter PKT_BURSTWRAP_H = 85,
parameter PKT_BURSTWRAP_L = 82,
parameter PKT_BYTE_CNT_H = 81,
parameter PKT_BYTE_CNT_L = 78,
parameter PKT_PROTECTION_H = 86,
parameter PKT_PROTECTION_L = 86,
parameter PKT_RESPONSE_STATUS_H = 89,
parameter PKT_RESPONSE_STATUS_L = 88,
parameter PKT_BURST_SIZE_H = 92,
parameter PKT_BURST_SIZE_L = 90,
parameter PKT_ORI_BURST_SIZE_L = 93,
parameter PKT_ORI_BURST_SIZE_H = 95,
parameter ST_DATA_W = 96,
parameter ST_CHANNEL_W = 32,
// Slave parameters
parameter ADDR_W = PKT_ADDR_H - PKT_ADDR_L + 1,
parameter AVS_DATA_W = PKT_DATA_H - PKT_DATA_L + 1,
parameter AVS_BURSTCOUNT_W = 4,
parameter PKT_SYMBOLS = AVS_DATA_W / PKT_SYMBOL_W,
// Slave agent parameters
parameter PREVENT_FIFO_OVERFLOW = 0,
parameter SUPPRESS_0_BYTEEN_CMD = 1,
parameter USE_READRESPONSE = 0,
parameter USE_WRITERESPONSE = 0,
// Derived slave parameters
parameter AVS_BE_W = PKT_BYTEEN_H - PKT_BYTEEN_L + 1,
parameter BURST_SIZE_W = 3,
// Derived FIFO width
parameter FIFO_DATA_W = ST_DATA_W + 1,
// ECC parameter
parameter ECC_ENABLE = 0
) (
input clk,
input reset,
// Universal-Avalon anti-slave
output [ADDR_W-1:0] m0_address,
output [AVS_BURSTCOUNT_W-1:0] m0_burstcount,
output [AVS_BE_W-1:0] m0_byteenable,
output m0_read,
input [AVS_DATA_W-1:0] m0_readdata,
input m0_waitrequest,
output m0_write,
output [AVS_DATA_W-1:0] m0_writedata,
input m0_readdatavalid,
output m0_debugaccess,
output m0_lock,
input [1:0] m0_response,
input m0_writeresponsevalid,
// Avalon-ST FIFO interfaces.
// Note: there's no need to include the "data" field here, at least for
// reads, since readdata is filled in from slave info. To keep life
// simple, have a data field, but fill it with 0s.
// Av-st response fifo source interface
output reg [FIFO_DATA_W-1:0] rf_source_data,
output rf_source_valid,
output rf_source_startofpacket,
output rf_source_endofpacket,
input rf_source_ready,
// Av-st response fifo sink interface
input [FIFO_DATA_W-1:0] rf_sink_data,
input rf_sink_valid,
input rf_sink_startofpacket,
input rf_sink_endofpacket,
output rf_sink_ready,
// Av-st readdata fifo src interface, data and response
// extra 2 bits for storing RESPONSE STATUS
output [AVS_DATA_W+1:0] rdata_fifo_src_data,
output rdata_fifo_src_valid,
input rdata_fifo_src_ready,
// Av-st readdata fifo sink interface
input [AVS_DATA_W+1:0] rdata_fifo_sink_data,
input rdata_fifo_sink_valid,
output rdata_fifo_sink_ready,
input rdata_fifo_sink_error,
// Av-st sink command packet interface
output cp_ready,
input cp_valid,
input [ST_DATA_W-1:0] cp_data,
input [ST_CHANNEL_W-1:0] cp_channel,
input cp_startofpacket,
input cp_endofpacket,
// Av-st source response packet interface
input rp_ready,
output reg rp_valid,
output reg [ST_DATA_W-1:0] rp_data,
output rp_startofpacket,
output rp_endofpacket
);
// --------------------------------------------------
// Ceil(log2()) function log2ceil of 4 = 2
// --------------------------------------------------
function integer log2ceil;
input reg[63:0] val;
reg [63:0] i;
begin
i = 1;
log2ceil = 0;
while (i < val) begin
log2ceil = log2ceil + 1;
i = i << 1;
end
end
endfunction
// ------------------------------------------------
// Local Parameters
// ------------------------------------------------
localparam DATA_W = PKT_DATA_H - PKT_DATA_L + 1;
localparam BE_W = PKT_BYTEEN_H - PKT_BYTEEN_L + 1;
localparam MID_W = PKT_SRC_ID_H - PKT_SRC_ID_L + 1;
localparam SID_W = PKT_DEST_ID_H - PKT_DEST_ID_L + 1;
localparam BYTE_CNT_W = PKT_BYTE_CNT_H - PKT_BYTE_CNT_L + 1;
localparam BURSTWRAP_W = PKT_BURSTWRAP_H - PKT_BURSTWRAP_L + 1;
localparam BURSTSIZE_W = PKT_BURST_SIZE_H - PKT_BURST_SIZE_L + 1;
localparam BITS_TO_MASK = log2ceil(PKT_SYMBOLS);
localparam MAX_BURST = 1 << (AVS_BURSTCOUNT_W - 1);
localparam BURSTING = (MAX_BURST > PKT_SYMBOLS);
// ------------------------------------------------
// Signals
// ------------------------------------------------
wire [DATA_W-1:0] cmd_data;
wire [BE_W-1:0] cmd_byteen;
wire [ADDR_W-1:0] cmd_addr;
wire [MID_W-1:0] cmd_mid;
wire [SID_W-1:0] cmd_sid;
wire cmd_read;
wire cmd_write;
wire cmd_compressed;
wire cmd_posted;
wire [BYTE_CNT_W-1:0] cmd_byte_cnt;
wire [BURSTWRAP_W-1:0] cmd_burstwrap;
wire [BURSTSIZE_W-1:0] cmd_burstsize;
wire cmd_debugaccess;
wire suppress_cmd;
wire byteen_asserted;
wire suppress_read;
wire suppress_write;
wire needs_response_synthesis;
wire generate_response;
// Assign command fields
assign cmd_data = cp_data[PKT_DATA_H :PKT_DATA_L ];
assign cmd_byteen = cp_data[PKT_BYTEEN_H:PKT_BYTEEN_L];
assign cmd_addr = cp_data[PKT_ADDR_H :PKT_ADDR_L ];
assign cmd_compressed = cp_data[PKT_TRANS_COMPRESSED_READ];
assign cmd_posted = cp_data[PKT_TRANS_POSTED];
assign cmd_write = cp_data[PKT_TRANS_WRITE];
assign cmd_read = cp_data[PKT_TRANS_READ];
assign cmd_mid = cp_data[PKT_SRC_ID_H :PKT_SRC_ID_L];
assign cmd_sid = cp_data[PKT_DEST_ID_H:PKT_DEST_ID_L];
assign cmd_byte_cnt = cp_data[PKT_BYTE_CNT_H:PKT_BYTE_CNT_L];
assign cmd_burstwrap = cp_data[PKT_BURSTWRAP_H:PKT_BURSTWRAP_L];
assign cmd_burstsize = cp_data[PKT_BURST_SIZE_H:PKT_BURST_SIZE_L];
assign cmd_debugaccess = cp_data[PKT_PROTECTION_L];
// Local "ready_for_command" signal: deasserted when the agent is unable to accept
// another command, e.g. rdv FIFO is full, (local readdata storage is full &&
// ~rp_ready), ...
// Say, this could depend on the type of command, for example, even if the
// rdv FIFO is full, a write request can be accepted. For later.
wire ready_for_command;
wire local_lock = cp_valid & cp_data[PKT_TRANS_LOCK];
wire local_write = cp_valid & cp_data[PKT_TRANS_WRITE];
wire local_read = cp_valid & cp_data[PKT_TRANS_READ];
wire local_compressed_read = cp_valid & cp_data[PKT_TRANS_COMPRESSED_READ];
wire nonposted_write_endofpacket = ~cp_data[PKT_TRANS_POSTED] & local_write & cp_endofpacket;
// num_symbols is PKT_SYMBOLS, appropriately sized.
wire [31:0] int_num_symbols = PKT_SYMBOLS;
wire [BYTE_CNT_W-1:0] num_symbols = int_num_symbols[BYTE_CNT_W-1:0];
generate
if (PREVENT_FIFO_OVERFLOW) begin : prevent_fifo_overflow_block
// ---------------------------------------------------
// Backpressure if the slave says to, or if FIFO overflow may occur.
//
// All commands are backpressured once the FIFO is full
// even if they don't need storage. This breaks a long
// combinatorial path from the master read/write through
// this logic and back to the master via the backpressure
// path.
//
// To avoid a loss of throughput the FIFO will be parameterized
// one slot deeper. The extra slot should never be used in normal
// operation, but should a slave misbehave and accept one more
// read than it should then backpressure will kick in.
//
// An example: assume a slave with MPRT = 2. It can accept a
// command sequence RRWW without backpressuring. If the FIFO is
// only 2 deep, we'd backpressure the writes leading to loss of
// throughput. If the FIFO is 3 deep, we'll only backpressure when
// RRR... which is an illegal condition anyway.
// ---------------------------------------------------
assign ready_for_command = rf_source_ready;
assign cp_ready = (~m0_waitrequest | suppress_cmd) && ready_for_command;
end else begin : no_prevent_fifo_overflow_block
// Do not suppress the command or the slave will
// not be able to waitrequest
assign ready_for_command = 1'b1;
// Backpressure only if the slave says to.
assign cp_ready = ~m0_waitrequest | suppress_cmd;
end
endgenerate
generate if (SUPPRESS_0_BYTEEN_CMD && !BURSTING) begin : suppress_0_byteen_cmd_non_bursting
assign byteen_asserted = |cmd_byteen;
assign suppress_read = ~byteen_asserted;
assign suppress_write = ~byteen_asserted;
assign suppress_cmd = ~byteen_asserted;
end else if (SUPPRESS_0_BYTEEN_CMD && BURSTING) begin: suppress_0_byteen_cmd_bursting
assign byteen_asserted = |cmd_byteen;
assign suppress_read = ~byteen_asserted;
assign suppress_write = 1'b0;
assign suppress_cmd = ~byteen_asserted && cmd_read;
end else begin : no_suppress_0_byteen_cmd
assign suppress_read = 1'b0;
assign suppress_write = 1'b0;
assign suppress_cmd = 1'b0;
end
endgenerate
// -------------------------------------------------------------------
// Extract avalon signals from command packet.
// -------------------------------------------------------------------
// Mask off the lower bits of address.
// The burst adapter before this component will break narrow sized packets
// into sub-bursts of length 1. However, the packet addresses are preserved,
// which means this component may see size-aligned addresses.
//
// Masking ensures that the addresses seen by an Avalon slave are aligned to
// the full data width instead of the size.
//
// Example:
// output from burst adapter (datawidth=4, size=2 bytes):
// subburst1 addr=0, subburst2 addr=2, subburst3 addr=4, subburst4 addr=6
// expected output from slave agent:
// subburst1 addr=0, subburst2 addr=0, subburst3 addr=4, subburst4 addr=4
generate
if (BITS_TO_MASK > 0) begin : mask_address
assign m0_address = { cmd_addr[ADDR_W-1:BITS_TO_MASK], {BITS_TO_MASK{1'b0}} };
end else begin : no_mask_address
assign m0_address = cmd_addr;
end
endgenerate
assign m0_byteenable = cmd_byteen;
assign m0_writedata = cmd_data;
// Note: no Avalon-MM slave in existence accepts uncompressed read bursts -
// this sort of burst exists only in merlin fabric ST packets. What to do
// if we see such a burst? All beats in that burst need to be transmitted
// to the slave so we have enough space-time for byteenable expression.
//
// There can be multiple bursts in a packet, but only one beat per burst
// in <most> cases. The exception is when we've decided not to insert a
// burst adapter for efficiency reasons, in which case this agent is also
// responsible for driving burstcount to 1 on each beat of an uncompressed
// read burst.
assign m0_read = ready_for_command & !suppress_read & (local_compressed_read | local_read);
generate
// AVS_BURSTCOUNT_W and BYTE_CNT_W may not be equal. Assign m0_burstcount
// from a sub-range, or 0-pad, as appropriate.
if (AVS_BURSTCOUNT_W > BYTE_CNT_W) begin : m0_burstcount_zero_pad
wire [AVS_BURSTCOUNT_W - BYTE_CNT_W - 1 : 0] zero_pad = {(AVS_BURSTCOUNT_W - BYTE_CNT_W) {1'b0}};
assign m0_burstcount = (local_read & ~local_compressed_read) ?
{zero_pad, num_symbols} :
{zero_pad, cmd_byte_cnt};
end
else begin : m0_burstcount_no_pad
assign m0_burstcount = (local_read & ~local_compressed_read) ?
num_symbols[AVS_BURSTCOUNT_W-1:0] :
cmd_byte_cnt[AVS_BURSTCOUNT_W-1:0];
end
endgenerate
assign m0_write = ready_for_command & local_write & !suppress_write;
assign m0_lock = ready_for_command & local_lock & (m0_read | m0_write);
assign m0_debugaccess = cmd_debugaccess;
// -------------------------------------------------------------------
// Indirection layer for response packet values. Some may always wire
// directly from the slave translator; others will no doubt emerge from
// various FIFOs.
// What to put in resp_data when a write occured? Answer: it does not
// matter, because only response status is needed for non-posted writes,
// and the packet already has a field for that.
//
// We use the rdata_fifo to store write responses as well. This allows us
// to handle backpressure on the response path, and allows write response
// merging.
assign rdata_fifo_src_valid = m0_readdatavalid | m0_writeresponsevalid;
assign rdata_fifo_src_data = {m0_response, m0_readdata};
// ------------------------------------------------------------------
// Generate a token when read commands are suppressed. The token
// is stored in the response FIFO, and will be used to synthesize
// a read response. The same token is used for non-posted write
// response synthesis.
//
// Note: this token is not generated for suppressed uncompressed read cycles;
// the burst uncompression logic at the read side of the response FIFO
// generates the correct number of responses.
//
// When the slave can return the response, let it do its job. Don't
// synthesize a response in that case, unless we've suppressed the
// the last transfer in a write sub-burst.
// ------------------------------------------------------------------
wire write_end_of_subburst;
assign needs_response_synthesis = ((local_read | local_compressed_read) & suppress_read) ||
(!USE_WRITERESPONSE && nonposted_write_endofpacket) ||
(USE_WRITERESPONSE && write_end_of_subburst && suppress_write);
// Avalon-ST interfaces to external response FIFO.
//
// For efficiency, when synthesizing a write response we only store a non-posted write
// transaction at its endofpacket, even if it was split into multiple sub-bursts.
//
// When not synthesizing write responses, we store each sub-burst in the FIFO.
// Each sub-burst to the slave will return a response, which corresponds to one
// entry in the FIFO. We merge all the sub-burst responses on the final
// sub-burst and send it on the response channel.
wire internal_cp_endofburst;
wire [31:0] minimum_bytecount_wire = PKT_SYMBOLS; // to solve qis warning
wire [AVS_BURSTCOUNT_W-1:0] minimum_bytecount;
assign minimum_bytecount = minimum_bytecount_wire[AVS_BURSTCOUNT_W-1:0];
assign internal_cp_endofburst = (cmd_byte_cnt == minimum_bytecount);
assign write_end_of_subburst = local_write & internal_cp_endofburst;
assign rf_source_valid = (local_read | local_compressed_read | (nonposted_write_endofpacket && !USE_WRITERESPONSE) | (USE_WRITERESPONSE && internal_cp_endofburst && local_write))
& ready_for_command & cp_ready;
assign rf_source_startofpacket = cp_startofpacket;
assign rf_source_endofpacket = cp_endofpacket;
always @* begin
// default: assign every command packet field to the response FIFO...
rf_source_data = {1'b0, cp_data};
// ... and override select fields as needed.
rf_source_data[FIFO_DATA_W-1] = needs_response_synthesis;
rf_source_data[PKT_DATA_H :PKT_DATA_L] = {DATA_W {1'b0}};
rf_source_data[PKT_BYTEEN_H :PKT_BYTEEN_L] = cmd_byteen;
rf_source_data[PKT_ADDR_H :PKT_ADDR_L] = cmd_addr;
rf_source_data[PKT_TRANS_COMPRESSED_READ] = cmd_compressed;
rf_source_data[PKT_TRANS_POSTED] = cmd_posted;
rf_source_data[PKT_TRANS_WRITE] = cmd_write;
rf_source_data[PKT_TRANS_READ] = cmd_read;
rf_source_data[PKT_SRC_ID_H :PKT_SRC_ID_L] = cmd_mid;
rf_source_data[PKT_DEST_ID_H:PKT_DEST_ID_L] = cmd_sid;
rf_source_data[PKT_BYTE_CNT_H:PKT_BYTE_CNT_L] = cmd_byte_cnt;
rf_source_data[PKT_BURSTWRAP_H:PKT_BURSTWRAP_L] = cmd_burstwrap;
rf_source_data[PKT_BURST_SIZE_H:PKT_BURST_SIZE_L] = cmd_burstsize;
rf_source_data[PKT_PROTECTION_H:PKT_PROTECTION_L] = '0;
rf_source_data[PKT_PROTECTION_L] = cmd_debugaccess;
end
wire uncompressor_source_valid;
wire [BURSTSIZE_W-1:0] uncompressor_burstsize;
wire last_write_response;
// last_write_response indicates the last response of the broken-up write burst (sub-bursts).
// At this time, the final merged response is sent, and rp_valid is only asserted
// once for the whole burst.
generate
if (USE_WRITERESPONSE) begin
assign last_write_response = rf_sink_data[PKT_TRANS_WRITE] & rf_sink_endofpacket;
always @* begin
if (rf_sink_data[PKT_TRANS_WRITE] == 1)
rp_valid = (rdata_fifo_sink_valid | generate_response) & last_write_response & !rf_sink_data[PKT_TRANS_POSTED];
else
rp_valid = rdata_fifo_sink_valid | uncompressor_source_valid;
end
end else begin
assign last_write_response = 1'b0;
always @* begin
rp_valid = rdata_fifo_sink_valid | uncompressor_source_valid;
end
end
endgenerate
// ------------------------------------------------------------------
// Response merging
// ------------------------------------------------------------------
reg [1:0] current_response;
reg [1:0] response_merged;
generate
if (USE_WRITERESPONSE) begin : response_merging_all
reg first_write_response;
reg reset_merged_output;
reg [1:0] previous_response_in;
reg [1:0] previous_response;
always_ff @(posedge clk, posedge reset) begin
if (reset) begin
first_write_response <= 1'b1;
end
else begin // Merging work for write response, for read: previous_response_in = current_response
if (rf_sink_valid & (rdata_fifo_sink_valid | generate_response) & rf_sink_data[PKT_TRANS_WRITE]) begin
first_write_response <= 1'b0;
if (rf_sink_endofpacket)
first_write_response <= 1'b1;
end
end
end
always_comb begin
current_response = generate_response ? 2'b00 : rdata_fifo_sink_data[AVS_DATA_W+1:AVS_DATA_W] | {2{rdata_fifo_sink_error}};
reset_merged_output = first_write_response && (rdata_fifo_sink_valid || generate_response);
previous_response_in = reset_merged_output ? current_response : previous_response;
response_merged = current_response >= previous_response ? current_response: previous_response_in;
end
always_ff @(posedge clk or posedge reset) begin
if (reset) begin
previous_response <= 2'b00;
end
else begin
if (rf_sink_valid & (rdata_fifo_sink_valid || generate_response)) begin
previous_response <= response_merged;
end
end
end
end else begin : response_merging_read_only
always @* begin
current_response = generate_response ? 2'b00: rdata_fifo_sink_data[AVS_DATA_W+1:AVS_DATA_W] |
{2{rdata_fifo_sink_error}};
response_merged = current_response;
end
end
endgenerate
assign generate_response = rf_sink_data[FIFO_DATA_W-1];
wire [BYTE_CNT_W-1:0] rf_sink_byte_cnt = rf_sink_data[PKT_BYTE_CNT_H:PKT_BYTE_CNT_L];
wire rf_sink_compressed = rf_sink_data[PKT_TRANS_COMPRESSED_READ];
wire [BURSTWRAP_W-1:0] rf_sink_burstwrap = rf_sink_data[PKT_BURSTWRAP_H:PKT_BURSTWRAP_L];
wire [BURSTSIZE_W-1:0] rf_sink_burstsize = rf_sink_data[PKT_BURST_SIZE_H:PKT_BURST_SIZE_L];
wire [ADDR_W-1:0] rf_sink_addr = rf_sink_data[PKT_ADDR_H:PKT_ADDR_L];
// a non posted write response is always completed in 1 cycle. Modify the startofpacket signal to 1'b1 instead of taking whatever is in the rf_fifo
wire rf_sink_startofpacket_wire = rf_sink_data[PKT_TRANS_WRITE] ? 1'b1 : rf_sink_startofpacket;
wire [BYTE_CNT_W-1:0] burst_byte_cnt;
wire [BURSTWRAP_W-1:0] rp_burstwrap;
wire [ADDR_W-1:0] rp_address;
wire rp_is_compressed;
wire ready_for_response;
// ------------------------------------------------------------------
// We're typically ready for a response if the network is ready. There
// is one exception:
//
// If the slave issues write responses, we only issue a merged response on
// the final sub-burst. As a result, we only care about response channel
// availability on the final burst when we send out the merged response.
// ------------------------------------------------------------------
assign ready_for_response = (USE_WRITERESPONSE) ?
rp_ready || (rf_sink_data[PKT_TRANS_WRITE] && !last_write_response) || rf_sink_data[PKT_TRANS_POSTED]:
rp_ready;
// ------------------------------------------------------------------
// Backpressure the readdata fifo if we're supposed to synthesize a response.
// This may be a read response (for suppressed reads) or a write response
// (for non-posted writes).
// ------------------------------------------------------------------
assign rdata_fifo_sink_ready = rdata_fifo_sink_valid & ready_for_response & ~(rf_sink_valid & generate_response);
always @* begin
// By default, return all fields...
rp_data = rf_sink_data[ST_DATA_W - 1 : 0];
// ... and override specific fields.
rp_data[PKT_DATA_H :PKT_DATA_L] = rdata_fifo_sink_data[AVS_DATA_W-1:0];
// Assignments directly from the response fifo.
rp_data[PKT_TRANS_POSTED] = rf_sink_data[PKT_TRANS_POSTED];
rp_data[PKT_TRANS_WRITE] = rf_sink_data[PKT_TRANS_WRITE];
rp_data[PKT_SRC_ID_H :PKT_SRC_ID_L] = rf_sink_data[PKT_DEST_ID_H : PKT_DEST_ID_L];
rp_data[PKT_DEST_ID_H:PKT_DEST_ID_L] = rf_sink_data[PKT_SRC_ID_H : PKT_SRC_ID_L];
rp_data[PKT_BYTEEN_H :PKT_BYTEEN_L] = rf_sink_data[PKT_BYTEEN_H : PKT_BYTEEN_L];
rp_data[PKT_PROTECTION_H:PKT_PROTECTION_L] = rf_sink_data[PKT_PROTECTION_H:PKT_PROTECTION_L];
// Burst uncompressor assignments
rp_data[PKT_ADDR_H :PKT_ADDR_L] = rp_address;
rp_data[PKT_BURSTWRAP_H:PKT_BURSTWRAP_L] = rp_burstwrap;
rp_data[PKT_BYTE_CNT_H:PKT_BYTE_CNT_L] = burst_byte_cnt;
rp_data[PKT_TRANS_READ] = rf_sink_data[PKT_TRANS_READ] | rf_sink_data[PKT_TRANS_COMPRESSED_READ];
rp_data[PKT_TRANS_COMPRESSED_READ] = rp_is_compressed;
rp_data[PKT_RESPONSE_STATUS_H:PKT_RESPONSE_STATUS_L] = response_merged;
rp_data[PKT_BURST_SIZE_H:PKT_BURST_SIZE_L] = uncompressor_burstsize;
// bounce the original size back to the master untouched
rp_data[PKT_ORI_BURST_SIZE_H:PKT_ORI_BURST_SIZE_L] = rf_sink_data[PKT_ORI_BURST_SIZE_H:PKT_ORI_BURST_SIZE_L];
end
// ------------------------------------------------------------------
// Note: the burst uncompressor may be asked to generate responses for
// write packets; these are treated the same as single-cycle uncompressed
// reads.
// ------------------------------------------------------------------
altera_merlin_burst_uncompressor #(
.ADDR_W (ADDR_W),
.BURSTWRAP_W (BURSTWRAP_W),
.BYTE_CNT_W (BYTE_CNT_W),
.PKT_SYMBOLS (PKT_SYMBOLS),
.BURST_SIZE_W (BURSTSIZE_W)
) uncompressor (
.clk (clk),
.reset (reset),
.sink_startofpacket (rf_sink_startofpacket_wire),
.sink_endofpacket (rf_sink_endofpacket),
.sink_valid (rf_sink_valid & (rdata_fifo_sink_valid | generate_response)),
.sink_ready (rf_sink_ready),
.sink_addr (rf_sink_addr),
.sink_burstwrap (rf_sink_burstwrap),
.sink_byte_cnt (rf_sink_byte_cnt),
.sink_is_compressed (rf_sink_compressed),
.sink_burstsize (rf_sink_burstsize),
.source_startofpacket (rp_startofpacket),
.source_endofpacket (rp_endofpacket),
.source_valid (uncompressor_source_valid),
.source_ready (ready_for_response),
.source_addr (rp_address),
.source_burstwrap (rp_burstwrap),
.source_byte_cnt (burst_byte_cnt),
.source_is_compressed (rp_is_compressed),
.source_burstsize (uncompressor_burstsize)
);
//--------------------------------------
// Assertion: In case slave support response. The slave needs return response in order
// Ex: non-posted write followed by a read: write response must complete before read data
//--------------------------------------
// synthesis translate_off
ERROR_write_response_and_read_response_cannot_happen_same_time:
assert property ( @(posedge clk)
disable iff (reset) !(m0_writeresponsevalid && m0_readdatavalid)
);
// synthesis translate_on
endmodule

View file

@ -0,0 +1,482 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
// $Id: //acds/rel/18.1std/ip/merlin/altera_merlin_slave_translator/altera_merlin_slave_translator.sv#1 $
// $Revision: #1 $
// $Date: 2018/07/18 $
// $Author: psgswbuild $
// -------------------------------------
// Merlin Slave Translator
//
// Translates Universal Avalon MM Slave
// to any Avalon MM Slave
// -------------------------------------
//
//Notable Note: 0 AV_READLATENCY is not allowed and will be converted to a 1 cycle readlatency in all cases but one
//If you declare a slave with fixed read timing requirements, the readlatency of such a slave will be allowed to be zero
//The key feature here is that no same cycle turnaround data is processed through the fabric.
//import avalon_utilities_pkg::*;
`timescale 1 ns / 1 ns
module altera_merlin_slave_translator #(
parameter
//Widths
AV_ADDRESS_W = 32,
AV_DATA_W = 32,
AV_BURSTCOUNT_W = 4,
AV_BYTEENABLE_W = 4,
UAV_BYTEENABLE_W = 4,
//Read Latency
AV_READLATENCY = 1,
//Timing
AV_READ_WAIT_CYCLES = 0,
AV_WRITE_WAIT_CYCLES = 0,
AV_SETUP_WAIT_CYCLES = 0,
AV_DATA_HOLD_CYCLES = 0,
//Optional Port Declarations
USE_READDATAVALID = 1,
USE_WAITREQUEST = 1,
USE_READRESPONSE = 0,
USE_WRITERESPONSE = 0,
//Variable Addressing
AV_SYMBOLS_PER_WORD = 4,
AV_ADDRESS_SYMBOLS = 0,
AV_BURSTCOUNT_SYMBOLS = 0,
BITS_PER_WORD = clog2_plusone(AV_SYMBOLS_PER_WORD - 1),
UAV_ADDRESS_W = 38,
UAV_BURSTCOUNT_W = 10,
UAV_DATA_W = 32,
AV_CONSTANT_BURST_BEHAVIOR = 0,
UAV_CONSTANT_BURST_BEHAVIOR = 0,
CHIPSELECT_THROUGH_READLATENCY = 0,
// Tightly-Coupled Options
USE_UAV_CLKEN = 0,
AV_REQUIRE_UNALIGNED_ADDRESSES = 0
) (
// -------------------
// Clock & Reset
// -------------------
input wire clk,
input wire reset,
// -------------------
// Universal Avalon Slave
// -------------------
input wire [UAV_ADDRESS_W - 1 : 0] uav_address,
input wire [UAV_DATA_W - 1 : 0] uav_writedata,
input wire uav_write,
input wire uav_read,
input wire [UAV_BURSTCOUNT_W - 1 : 0] uav_burstcount,
input wire [UAV_BYTEENABLE_W - 1 : 0] uav_byteenable,
input wire uav_lock,
input wire uav_debugaccess,
input wire uav_clken,
output logic uav_readdatavalid,
output logic uav_waitrequest,
output logic [UAV_DATA_W - 1 : 0] uav_readdata,
output logic [1:0] uav_response,
// input wire uav_writeresponserequest,
output logic uav_writeresponsevalid,
// -------------------
// Customizable Avalon Master
// -------------------
output logic [AV_ADDRESS_W - 1 : 0] av_address,
output logic [AV_DATA_W - 1 : 0] av_writedata,
output logic av_write,
output logic av_read,
output logic [AV_BURSTCOUNT_W - 1 : 0] av_burstcount,
output logic [AV_BYTEENABLE_W - 1 : 0] av_byteenable,
output logic [AV_BYTEENABLE_W - 1 : 0] av_writebyteenable,
output logic av_begintransfer,
output wire av_chipselect,
output logic av_beginbursttransfer,
output logic av_lock,
output wire av_clken,
output wire av_debugaccess,
output wire av_outputenable,
input logic [AV_DATA_W - 1 : 0] av_readdata,
input logic av_readdatavalid,
input logic av_waitrequest,
input logic [1:0] av_response,
// output logic av_writeresponserequest,
input wire av_writeresponsevalid
);
function integer clog2_plusone;
input [31:0] Depth;
integer i;
begin
i = Depth;
for(clog2_plusone = 0; i > 0; clog2_plusone = clog2_plusone + 1)
i = i >> 1;
end
endfunction
function integer max;
//returns the larger of two passed arguments
input [31:0] one;
input [31:0] two;
if(one > two)
max=one;
else
max=two;
endfunction // int
localparam AV_READ_WAIT_INDEXED = (AV_SETUP_WAIT_CYCLES + AV_READ_WAIT_CYCLES);
localparam AV_WRITE_WAIT_INDEXED = (AV_SETUP_WAIT_CYCLES + AV_WRITE_WAIT_CYCLES);
localparam AV_DATA_HOLD_INDEXED = (AV_WRITE_WAIT_INDEXED + AV_DATA_HOLD_CYCLES);
localparam LOG2_OF_LATENCY_SUM = max(clog2_plusone(AV_READ_WAIT_INDEXED + 1),clog2_plusone(AV_DATA_HOLD_INDEXED + 1));
localparam BURSTCOUNT_SHIFT_SELECTOR = AV_BURSTCOUNT_SYMBOLS ? 0 : BITS_PER_WORD;
localparam ADDRESS_SHIFT_SELECTOR = AV_ADDRESS_SYMBOLS ? 0 : BITS_PER_WORD;
localparam ADDRESS_HIGH = ( UAV_ADDRESS_W > AV_ADDRESS_W + ADDRESS_SHIFT_SELECTOR ) ?
AV_ADDRESS_W :
UAV_ADDRESS_W - ADDRESS_SHIFT_SELECTOR;
localparam BURSTCOUNT_HIGH = ( UAV_BURSTCOUNT_W > AV_BURSTCOUNT_W + BURSTCOUNT_SHIFT_SELECTOR ) ?
AV_BURSTCOUNT_W :
UAV_BURSTCOUNT_W - BURSTCOUNT_SHIFT_SELECTOR;
localparam BYTEENABLE_ADDRESS_BITS = ( clog2_plusone(UAV_BYTEENABLE_W) - 1 ) >= 1 ? clog2_plusone(UAV_BYTEENABLE_W) - 1 : 1;
// Calculate the symbols per word as the power of 2 extended symbols per word
wire [31 : 0] symbols_per_word_int = 2**(clog2_plusone(AV_SYMBOLS_PER_WORD[UAV_BURSTCOUNT_W : 0] - 1));
wire [UAV_BURSTCOUNT_W-1 : 0] symbols_per_word = symbols_per_word_int[UAV_BURSTCOUNT_W-1 : 0];
// +--------------------------------
// |Backwards Compatibility Signals
// +--------------------------------
assign av_clken = (USE_UAV_CLKEN) ? uav_clken : 1'b1;
assign av_debugaccess = uav_debugaccess;
// +-------------------
// |Passthru Signals
// +-------------------
reg [1 : 0] av_response_delayed;
always @(posedge clk, posedge reset) begin
if (reset) begin
av_response_delayed <= 2'b0;
end else begin
av_response_delayed <= av_response;
end
end
always_comb
begin
if (!USE_READRESPONSE && !USE_WRITERESPONSE) begin
uav_response = '0;
end else begin
if (AV_READLATENCY != 0 || USE_READDATAVALID) begin
uav_response = av_response;
end else begin
uav_response = av_response_delayed;
end
end
end
// assign av_writeresponserequest = uav_writeresponserequest;
assign uav_writeresponsevalid = av_writeresponsevalid;
//-------------------------
//Writedata and Byteenable
//-------------------------
always@* begin
av_byteenable = '0;
av_byteenable = uav_byteenable[AV_BYTEENABLE_W - 1 : 0];
end
always@* begin
av_writedata = '0;
av_writedata = uav_writedata[AV_DATA_W - 1 : 0];
end
// +-------------------
// |Calculated Signals
// +-------------------
logic [UAV_ADDRESS_W - 1 : 0 ] real_uav_address;
function [BYTEENABLE_ADDRESS_BITS - 1 : 0 ] decode_byteenable;
input [UAV_BYTEENABLE_W - 1 : 0 ] byteenable;
for(int i = 0 ; i < UAV_BYTEENABLE_W; i++ ) begin
if(byteenable[i] == 1) begin
return i;
end
end
return '0;
endfunction
reg [AV_BURSTCOUNT_W - 1 : 0] burstcount_reg;
reg [AV_ADDRESS_W - 1 : 0] address_reg;
always@(posedge clk, posedge reset) begin
if(reset) begin
burstcount_reg <= '0;
address_reg <= '0;
end else begin
burstcount_reg <= burstcount_reg;
address_reg <= address_reg;
if(av_beginbursttransfer) begin
burstcount_reg <= uav_burstcount [ BURSTCOUNT_HIGH - 1 + BURSTCOUNT_SHIFT_SELECTOR : BURSTCOUNT_SHIFT_SELECTOR ];
address_reg <= real_uav_address [ ADDRESS_HIGH - 1 + ADDRESS_SHIFT_SELECTOR : ADDRESS_SHIFT_SELECTOR ];
end
end
end
logic [BYTEENABLE_ADDRESS_BITS-1:0] temp_wire;
always@* begin
if( AV_REQUIRE_UNALIGNED_ADDRESSES == 1) begin
temp_wire = decode_byteenable(uav_byteenable);
real_uav_address = { uav_address[UAV_ADDRESS_W - 1 : BYTEENABLE_ADDRESS_BITS ], temp_wire[BYTEENABLE_ADDRESS_BITS - 1 : 0 ] };
end else begin
real_uav_address = uav_address;
end
av_address = real_uav_address[ADDRESS_HIGH - 1 + ADDRESS_SHIFT_SELECTOR : ADDRESS_SHIFT_SELECTOR ];
if( AV_CONSTANT_BURST_BEHAVIOR && !UAV_CONSTANT_BURST_BEHAVIOR && ~av_beginbursttransfer )
av_address = address_reg;
end
always@* begin
av_burstcount=uav_burstcount[BURSTCOUNT_HIGH - 1 + BURSTCOUNT_SHIFT_SELECTOR : BURSTCOUNT_SHIFT_SELECTOR ];
if( AV_CONSTANT_BURST_BEHAVIOR && !UAV_CONSTANT_BURST_BEHAVIOR && ~av_beginbursttransfer )
av_burstcount = burstcount_reg;
end
always@* begin
av_lock = uav_lock;
end
// -------------------
// Writebyteenable Assignment
// -------------------
always@* begin
av_writebyteenable = { (AV_BYTEENABLE_W){uav_write} } & uav_byteenable[AV_BYTEENABLE_W - 1 : 0];
end
// -------------------
// Waitrequest Assignment
// -------------------
reg av_waitrequest_generated;
reg av_waitrequest_generated_read;
reg av_waitrequest_generated_write;
reg waitrequest_reset_override;
reg [ ( LOG2_OF_LATENCY_SUM ? LOG2_OF_LATENCY_SUM - 1 : 0 ) : 0 ] wait_latency_counter;
always@(posedge reset, posedge clk) begin
if(reset) begin
wait_latency_counter <= '0;
waitrequest_reset_override <= 1'h1;
end else begin
waitrequest_reset_override <= 1'h0;
wait_latency_counter <= '0;
if( ~uav_waitrequest | waitrequest_reset_override )
wait_latency_counter <= '0;
else if( uav_read | uav_write )
wait_latency_counter <= wait_latency_counter + 1'h1;
end
end
always @* begin
av_read = uav_read;
av_write = uav_write;
av_waitrequest_generated = 1'h1;
av_waitrequest_generated_read = 1'h1;
av_waitrequest_generated_write = 1'h1;
if(LOG2_OF_LATENCY_SUM == 1)
av_waitrequest_generated = 0;
if(LOG2_OF_LATENCY_SUM > 1 && !USE_WAITREQUEST) begin
av_read = wait_latency_counter >= AV_SETUP_WAIT_CYCLES && uav_read;
av_write = wait_latency_counter >= AV_SETUP_WAIT_CYCLES && uav_write && wait_latency_counter <= AV_WRITE_WAIT_INDEXED;
av_waitrequest_generated_read = wait_latency_counter != AV_READ_WAIT_INDEXED;
av_waitrequest_generated_write = wait_latency_counter != AV_DATA_HOLD_INDEXED;
if(uav_write)
av_waitrequest_generated = av_waitrequest_generated_write;
else
av_waitrequest_generated = av_waitrequest_generated_read;
end
if(USE_WAITREQUEST) begin
uav_waitrequest = av_waitrequest;
end else begin
uav_waitrequest = av_waitrequest_generated | waitrequest_reset_override;
end
end
// --------------
// Readdata Assignment
// --------------
reg[(AV_DATA_W ? AV_DATA_W -1 : 0 ): 0] av_readdata_pre;
always@(posedge clk, posedge reset) begin
if(reset)
av_readdata_pre <= 'b0;
else
av_readdata_pre <= av_readdata;
end
always@* begin
uav_readdata = {UAV_DATA_W{1'b0}};
if( AV_READLATENCY != 0 || USE_READDATAVALID ) begin
uav_readdata[AV_DATA_W-1:0] = av_readdata;
end else begin
uav_readdata[AV_DATA_W-1:0] = av_readdata_pre;
end
end
// -------------------
// Readdatavalid Assigment
// -------------------
reg[(AV_READLATENCY>0 ? AV_READLATENCY-1:0) :0] read_latency_shift_reg;
reg top_read_latency_shift_reg;
always@* begin
uav_readdatavalid=top_read_latency_shift_reg;
if(USE_READDATAVALID) begin
uav_readdatavalid = av_readdatavalid;
end
end
always@* begin
top_read_latency_shift_reg = uav_read & ~uav_waitrequest & ~waitrequest_reset_override;
if(AV_READLATENCY == 1 || AV_READLATENCY == 0 ) begin
top_read_latency_shift_reg=read_latency_shift_reg;
end
if (AV_READLATENCY > 1) begin
top_read_latency_shift_reg = read_latency_shift_reg[(AV_READLATENCY ? AV_READLATENCY-1 : 0)];
end
end
always@(posedge reset, posedge clk) begin
if (reset) begin
read_latency_shift_reg <= '0;
end else if (av_clken) begin
read_latency_shift_reg[0] <= uav_read && ~uav_waitrequest & ~waitrequest_reset_override;
for (int i=0; i+1 < AV_READLATENCY ; i+=1 ) begin
read_latency_shift_reg[i+1] <= read_latency_shift_reg[i];
end
end
end
// ------------
// Chipselect and OutputEnable
// ------------
reg av_chipselect_pre;
wire cs_extension;
reg av_outputenable_pre;
assign av_chipselect = (uav_read | uav_write) ? 1'b1 : av_chipselect_pre;
assign cs_extension = ( (^ read_latency_shift_reg) & ~top_read_latency_shift_reg ) | ((| read_latency_shift_reg) & ~(^ read_latency_shift_reg));
assign av_outputenable = uav_read ? 1'b1 : av_outputenable_pre;
always@(posedge reset, posedge clk) begin
if(reset)
av_outputenable_pre <= 1'b0;
else if( AV_READLATENCY == 0 && AV_READ_WAIT_INDEXED != 0 )
av_outputenable_pre <= 0;
else
av_outputenable_pre <= cs_extension | uav_read;
end
always@(posedge reset, posedge clk) begin
if(reset) begin
av_chipselect_pre <= 1'b0;
end else begin
av_chipselect_pre <= 1'b0;
if(AV_READLATENCY != 0 && CHIPSELECT_THROUGH_READLATENCY == 1) begin
//The AV_READLATENCY term is only here to prevent chipselect from remaining asserted while read and write fall.
//There is no functional impact as 0 cycle transactions are treated as 1 cycle on the other side of the translator.
if(uav_read) begin
av_chipselect_pre <= 1'b1;
end else if(cs_extension == 1) begin
av_chipselect_pre <= 1'b1;
end
end
end
end
// -------------------
// Begintransfer Assigment
// -------------------
reg end_begintransfer;
always@* begin
av_begintransfer = ( uav_write | uav_read ) & ~end_begintransfer;
end
always@ ( posedge clk or posedge reset ) begin
if(reset) begin
end_begintransfer <= 1'b0;
end else begin
if(av_begintransfer == 1 && uav_waitrequest && ~waitrequest_reset_override)
end_begintransfer <= 1'b1;
else if(uav_waitrequest)
end_begintransfer <= end_begintransfer;
else
end_begintransfer <= 1'b0;
end
end
// -------------------
// Beginbursttransfer Assigment
// -------------------
reg end_beginbursttransfer;
reg in_transfer;
always@* begin
av_beginbursttransfer = uav_read ? av_begintransfer : (av_begintransfer && ~end_beginbursttransfer && ~in_transfer);
end
always@ ( posedge clk or posedge reset ) begin
if(reset) begin
end_beginbursttransfer <= 1'b0;
in_transfer <= 1'b0;
end else begin
end_beginbursttransfer <= uav_write & ( uav_burstcount != symbols_per_word );
if(uav_write && uav_burstcount == symbols_per_word)
in_transfer <=1'b0;
else if(uav_write)
in_transfer <=1'b1;
end
end
endmodule

View file

@ -0,0 +1,30 @@
# (C) 2001-2018 Intel Corporation. All rights reserved.
# Your use of Intel Corporation's design tools, logic functions and other
# software and tools, and its AMPP partner logic functions, and any output
# files from any of the foregoing (including device programming or simulation
# files), and any associated documentation or information are expressly subject
# to the terms and conditions of the Intel Program License Subscription
# Agreement, Intel FPGA IP License Agreement, or other applicable
# license agreement, including, without limitation, that your use is for the
# sole purpose of programming logic devices manufactured by Intel and sold by
# Intel or its authorized distributors. Please refer to the applicable
# agreement for further details.
# +---------------------------------------------------
# | Cut the async clear paths
# +---------------------------------------------------
set aclr_counter 0
set clrn_counter 0
set aclr_collection [get_pins -compatibility_mode -nocase -nowarn *|alt_rst_sync_uq1|altera_reset_synchronizer_int_chain*|aclr]
set clrn_collection [get_pins -compatibility_mode -nocase -nowarn *|alt_rst_sync_uq1|altera_reset_synchronizer_int_chain*|clrn]
set aclr_counter [get_collection_size $aclr_collection]
set clrn_counter [get_collection_size $clrn_collection]
if {$aclr_counter > 0} {
set_false_path -to [get_pins -compatibility_mode -nocase *|alt_rst_sync_uq1|altera_reset_synchronizer_int_chain*|aclr]
}
if {$clrn_counter > 0} {
set_false_path -to [get_pins -compatibility_mode -nocase *|alt_rst_sync_uq1|altera_reset_synchronizer_int_chain*|clrn]
}

View file

@ -0,0 +1,319 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
// (C) 2001-2013 Altera Corporation. All rights reserved.
// Your use of Altera Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Altera Program License Subscription
// Agreement, Altera MegaCore Function License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Altera and sold by
// Altera or its authorized distributors. Please refer to the applicable
// agreement for further details.
// $Id: //acds/rel/18.1std/ip/merlin/altera_reset_controller/altera_reset_controller.v#1 $
// $Revision: #1 $
// $Date: 2018/07/18 $
// $Author: psgswbuild $
// --------------------------------------
// Reset controller
//
// Combines all the input resets and synchronizes
// the result to the clk.
// ACDS13.1 - Added reset request as part of reset sequencing
// --------------------------------------
`timescale 1 ns / 1 ns
module altera_reset_controller
#(
parameter NUM_RESET_INPUTS = 6,
parameter USE_RESET_REQUEST_IN0 = 0,
parameter USE_RESET_REQUEST_IN1 = 0,
parameter USE_RESET_REQUEST_IN2 = 0,
parameter USE_RESET_REQUEST_IN3 = 0,
parameter USE_RESET_REQUEST_IN4 = 0,
parameter USE_RESET_REQUEST_IN5 = 0,
parameter USE_RESET_REQUEST_IN6 = 0,
parameter USE_RESET_REQUEST_IN7 = 0,
parameter USE_RESET_REQUEST_IN8 = 0,
parameter USE_RESET_REQUEST_IN9 = 0,
parameter USE_RESET_REQUEST_IN10 = 0,
parameter USE_RESET_REQUEST_IN11 = 0,
parameter USE_RESET_REQUEST_IN12 = 0,
parameter USE_RESET_REQUEST_IN13 = 0,
parameter USE_RESET_REQUEST_IN14 = 0,
parameter USE_RESET_REQUEST_IN15 = 0,
parameter OUTPUT_RESET_SYNC_EDGES = "deassert",
parameter SYNC_DEPTH = 2,
parameter RESET_REQUEST_PRESENT = 0,
parameter RESET_REQ_WAIT_TIME = 3,
parameter MIN_RST_ASSERTION_TIME = 11,
parameter RESET_REQ_EARLY_DSRT_TIME = 4,
parameter ADAPT_RESET_REQUEST = 0
)
(
// --------------------------------------
// We support up to 16 reset inputs, for now
// --------------------------------------
input reset_in0,
input reset_in1,
input reset_in2,
input reset_in3,
input reset_in4,
input reset_in5,
input reset_in6,
input reset_in7,
input reset_in8,
input reset_in9,
input reset_in10,
input reset_in11,
input reset_in12,
input reset_in13,
input reset_in14,
input reset_in15,
input reset_req_in0,
input reset_req_in1,
input reset_req_in2,
input reset_req_in3,
input reset_req_in4,
input reset_req_in5,
input reset_req_in6,
input reset_req_in7,
input reset_req_in8,
input reset_req_in9,
input reset_req_in10,
input reset_req_in11,
input reset_req_in12,
input reset_req_in13,
input reset_req_in14,
input reset_req_in15,
input clk,
output reg reset_out,
output reg reset_req
);
// Always use async reset synchronizer if reset_req is used
localparam ASYNC_RESET = (OUTPUT_RESET_SYNC_EDGES == "deassert");
// --------------------------------------
// Local parameter to control the reset_req and reset_out timing when RESET_REQUEST_PRESENT==1
// --------------------------------------
localparam MIN_METASTABLE = 3;
localparam RSTREQ_ASRT_SYNC_TAP = MIN_METASTABLE + RESET_REQ_WAIT_TIME;
localparam LARGER = RESET_REQ_WAIT_TIME > RESET_REQ_EARLY_DSRT_TIME ? RESET_REQ_WAIT_TIME : RESET_REQ_EARLY_DSRT_TIME;
localparam ASSERTION_CHAIN_LENGTH = (MIN_METASTABLE > LARGER) ?
MIN_RST_ASSERTION_TIME + 1 :
(
(MIN_RST_ASSERTION_TIME > LARGER)?
MIN_RST_ASSERTION_TIME + (LARGER - MIN_METASTABLE + 1) + 1 :
MIN_RST_ASSERTION_TIME + RESET_REQ_EARLY_DSRT_TIME + RESET_REQ_WAIT_TIME - MIN_METASTABLE + 2
);
localparam RESET_REQ_DRST_TAP = RESET_REQ_EARLY_DSRT_TIME + 1;
// --------------------------------------
wire merged_reset;
wire merged_reset_req_in;
wire reset_out_pre;
wire reset_req_pre;
// Registers and Interconnect
(*preserve*) reg [RSTREQ_ASRT_SYNC_TAP: 0] altera_reset_synchronizer_int_chain;
reg [ASSERTION_CHAIN_LENGTH-1: 0] r_sync_rst_chain;
reg r_sync_rst;
reg r_early_rst;
// --------------------------------------
// "Or" all the input resets together
// --------------------------------------
assign merged_reset = (
reset_in0 |
reset_in1 |
reset_in2 |
reset_in3 |
reset_in4 |
reset_in5 |
reset_in6 |
reset_in7 |
reset_in8 |
reset_in9 |
reset_in10 |
reset_in11 |
reset_in12 |
reset_in13 |
reset_in14 |
reset_in15
);
assign merged_reset_req_in = (
( (USE_RESET_REQUEST_IN0 == 1) ? reset_req_in0 : 1'b0) |
( (USE_RESET_REQUEST_IN1 == 1) ? reset_req_in1 : 1'b0) |
( (USE_RESET_REQUEST_IN2 == 1) ? reset_req_in2 : 1'b0) |
( (USE_RESET_REQUEST_IN3 == 1) ? reset_req_in3 : 1'b0) |
( (USE_RESET_REQUEST_IN4 == 1) ? reset_req_in4 : 1'b0) |
( (USE_RESET_REQUEST_IN5 == 1) ? reset_req_in5 : 1'b0) |
( (USE_RESET_REQUEST_IN6 == 1) ? reset_req_in6 : 1'b0) |
( (USE_RESET_REQUEST_IN7 == 1) ? reset_req_in7 : 1'b0) |
( (USE_RESET_REQUEST_IN8 == 1) ? reset_req_in8 : 1'b0) |
( (USE_RESET_REQUEST_IN9 == 1) ? reset_req_in9 : 1'b0) |
( (USE_RESET_REQUEST_IN10 == 1) ? reset_req_in10 : 1'b0) |
( (USE_RESET_REQUEST_IN11 == 1) ? reset_req_in11 : 1'b0) |
( (USE_RESET_REQUEST_IN12 == 1) ? reset_req_in12 : 1'b0) |
( (USE_RESET_REQUEST_IN13 == 1) ? reset_req_in13 : 1'b0) |
( (USE_RESET_REQUEST_IN14 == 1) ? reset_req_in14 : 1'b0) |
( (USE_RESET_REQUEST_IN15 == 1) ? reset_req_in15 : 1'b0)
);
// --------------------------------------
// And if required, synchronize it to the required clock domain,
// with the correct synchronization type
// --------------------------------------
generate if (OUTPUT_RESET_SYNC_EDGES == "none" && (RESET_REQUEST_PRESENT==0)) begin
assign reset_out_pre = merged_reset;
assign reset_req_pre = merged_reset_req_in;
end else begin
altera_reset_synchronizer
#(
.DEPTH (SYNC_DEPTH),
.ASYNC_RESET(RESET_REQUEST_PRESENT? 1'b1 : ASYNC_RESET)
)
alt_rst_sync_uq1
(
.clk (clk),
.reset_in (merged_reset),
.reset_out (reset_out_pre)
);
altera_reset_synchronizer
#(
.DEPTH (SYNC_DEPTH),
.ASYNC_RESET(0)
)
alt_rst_req_sync_uq1
(
.clk (clk),
.reset_in (merged_reset_req_in),
.reset_out (reset_req_pre)
);
end
endgenerate
generate if ( ( (RESET_REQUEST_PRESENT == 0) && (ADAPT_RESET_REQUEST==0) )|
( (ADAPT_RESET_REQUEST == 1) && (OUTPUT_RESET_SYNC_EDGES != "deassert") ) ) begin
always @* begin
reset_out = reset_out_pre;
reset_req = reset_req_pre;
end
end else if ( (RESET_REQUEST_PRESENT == 0) && (ADAPT_RESET_REQUEST==1) ) begin
wire reset_out_pre2;
altera_reset_synchronizer
#(
.DEPTH (SYNC_DEPTH+1),
.ASYNC_RESET(0)
)
alt_rst_sync_uq2
(
.clk (clk),
.reset_in (reset_out_pre),
.reset_out (reset_out_pre2)
);
always @* begin
reset_out = reset_out_pre2;
reset_req = reset_req_pre;
end
end
else begin
// 3-FF Metastability Synchronizer
initial
begin
altera_reset_synchronizer_int_chain <= {RSTREQ_ASRT_SYNC_TAP{1'b1}};
end
always @(posedge clk)
begin
altera_reset_synchronizer_int_chain[RSTREQ_ASRT_SYNC_TAP:0] <=
{altera_reset_synchronizer_int_chain[RSTREQ_ASRT_SYNC_TAP-1:0], reset_out_pre};
end
// Synchronous reset pipe
initial
begin
r_sync_rst_chain <= {ASSERTION_CHAIN_LENGTH{1'b1}};
end
always @(posedge clk)
begin
if (altera_reset_synchronizer_int_chain[MIN_METASTABLE-1] == 1'b1)
begin
r_sync_rst_chain <= {ASSERTION_CHAIN_LENGTH{1'b1}};
end
else
begin
r_sync_rst_chain <= {1'b0, r_sync_rst_chain[ASSERTION_CHAIN_LENGTH-1:1]};
end
end
// Standard synchronous reset output. From 0-1, the transition lags the early output. For 1->0, the transition
// matches the early input.
always @(posedge clk)
begin
case ({altera_reset_synchronizer_int_chain[RSTREQ_ASRT_SYNC_TAP], r_sync_rst_chain[1], r_sync_rst})
3'b000: r_sync_rst <= 1'b0; // Not reset
3'b001: r_sync_rst <= 1'b0;
3'b010: r_sync_rst <= 1'b0;
3'b011: r_sync_rst <= 1'b1;
3'b100: r_sync_rst <= 1'b1;
3'b101: r_sync_rst <= 1'b1;
3'b110: r_sync_rst <= 1'b1;
3'b111: r_sync_rst <= 1'b1; // In Reset
default: r_sync_rst <= 1'b1;
endcase
case ({r_sync_rst_chain[1], r_sync_rst_chain[RESET_REQ_DRST_TAP] | reset_req_pre})
2'b00: r_early_rst <= 1'b0; // Not reset
2'b01: r_early_rst <= 1'b1; // Coming out of reset
2'b10: r_early_rst <= 1'b0; // Spurious reset - should not be possible via synchronous design.
2'b11: r_early_rst <= 1'b1; // Held in reset
default: r_early_rst <= 1'b1;
endcase
end
always @* begin
reset_out = r_sync_rst;
reset_req = r_early_rst;
end
end
endgenerate
endmodule

View file

@ -0,0 +1,87 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
// $Id: //acds/rel/18.1std/ip/merlin/altera_reset_controller/altera_reset_synchronizer.v#1 $
// $Revision: #1 $
// $Date: 2018/07/18 $
// $Author: psgswbuild $
// -----------------------------------------------
// Reset Synchronizer
// -----------------------------------------------
`timescale 1 ns / 1 ns
module altera_reset_synchronizer
#(
parameter ASYNC_RESET = 1,
parameter DEPTH = 2
)
(
input reset_in /* synthesis ALTERA_ATTRIBUTE = "SUPPRESS_DA_RULE_INTERNAL=R101" */,
input clk,
output reset_out
);
// -----------------------------------------------
// Synchronizer register chain. We cannot reuse the
// standard synchronizer in this implementation
// because our timing constraints are different.
//
// Instead of cutting the timing path to the d-input
// on the first flop we need to cut the aclr input.
//
// We omit the "preserve" attribute on the final
// output register, so that the synthesis tool can
// duplicate it where needed.
// -----------------------------------------------
(*preserve*) reg [DEPTH-1:0] altera_reset_synchronizer_int_chain;
reg altera_reset_synchronizer_int_chain_out;
generate if (ASYNC_RESET) begin
// -----------------------------------------------
// Assert asynchronously, deassert synchronously.
// -----------------------------------------------
always @(posedge clk or posedge reset_in) begin
if (reset_in) begin
altera_reset_synchronizer_int_chain <= {DEPTH{1'b1}};
altera_reset_synchronizer_int_chain_out <= 1'b1;
end
else begin
altera_reset_synchronizer_int_chain[DEPTH-2:0] <= altera_reset_synchronizer_int_chain[DEPTH-1:1];
altera_reset_synchronizer_int_chain[DEPTH-1] <= 0;
altera_reset_synchronizer_int_chain_out <= altera_reset_synchronizer_int_chain[0];
end
end
assign reset_out = altera_reset_synchronizer_int_chain_out;
end else begin
// -----------------------------------------------
// Assert synchronously, deassert synchronously.
// -----------------------------------------------
always @(posedge clk) begin
altera_reset_synchronizer_int_chain[DEPTH-2:0] <= altera_reset_synchronizer_int_chain[DEPTH-1:1];
altera_reset_synchronizer_int_chain[DEPTH-1] <= reset_in;
altera_reset_synchronizer_int_chain_out <= altera_reset_synchronizer_int_chain[0];
end
assign reset_out = altera_reset_synchronizer_int_chain_out;
end
endgenerate
endmodule

View file

@ -0,0 +1,48 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
`timescale 1 ps / 1 ps
module altera_wait_generate
//#(
//This code only works when wait_cycle =1, if need other case, you need to modify this code.
//please set wait_cycle default value as 1 to keep old design works.
// parameter wait_cycle =1
// )
(
input wire rst,
input wire clk,
input wire launch_signal,
output wire wait_req
);
reg launch_reg = 0;
reg wait_reg = 0;
always @ (posedge clk, posedge rst) begin
if(rst) launch_reg <= 1'b0;
else launch_reg <= launch_signal;
end
always @ (posedge clk, posedge rst) begin
if(rst) wait_reg <= 1'b0;
else wait_reg <= launch_signal & launch_reg & (! wait_reg & !wait_req);
end
// waitrequest should be asserted during reset - note that in the reconfig
// controller, reset is locally synchronized. If you are using this module
// outside the reconfig controller, you may want to ensure that the reset
// signal is synchronized to prevent glitches, as waitrequest is not
// necessarily a registered output.
wire reset_sync;
alt_xcvr_resync #(.INIT_VALUE (1)) rst_sync (.clk(clk),.reset(rst),.d(1'b0),.q(reset_sync));
assign wait_req = reset_sync | (launch_signal & ~launch_reg) | (wait_reg & launch_signal ) ;
endmodule

View file

@ -0,0 +1,906 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
//
// Common functions for transceiver PHY IP
//
// $Header$
//
// PACKAGE DECLARATION
package altera_xcvr_functions;
localparam integer MAX_CHARS = 86; // To accomodate LONG parameter lists.
localparam integer MAX_STRS = 16;
localparam integer MAX_XCVR_CHANNELS = 64;
// Reconfiguration bundle widths per family
localparam integer W_S5_RECONFIG_BUNDLE_TO_XCVR = 70;
localparam integer W_S5_RECONFIG_BUNDLE_FROM_XCVR = 46;
localparam integer W_A5_RECONFIG_BUNDLE_TO_XCVR = 70;
localparam integer W_A5_RECONFIG_BUNDLE_FROM_XCVR = 46;
localparam integer W_S4_RECONFIG_BUNDLE_TO_XCVR = 4;
localparam integer W_S4_RECONFIG_BUNDLE_FROM_XCVR = 17;
localparam integer W_C4_RECONFIG_BUNDLE_TO_XCVR = 4;
localparam integer W_C4_RECONFIG_BUNDLE_FROM_XCVR = 17;
// Reconfiguration bundle widths per family
localparam integer W_S5_RECONFIG_BUNDLE_TO_GXB = W_S5_RECONFIG_BUNDLE_TO_XCVR;
localparam integer W_S5_RECONFIG_BUNDLE_FROM_GXB = W_S5_RECONFIG_BUNDLE_FROM_XCVR;
localparam integer W_A5_RECONFIG_BUNDLE_TO_GXB = W_A5_RECONFIG_BUNDLE_TO_XCVR;
localparam integer W_A5_RECONFIG_BUNDLE_FROM_GXB = W_A5_RECONFIG_BUNDLE_FROM_XCVR;
localparam integer W_S4_RECONFIG_BUNDLE_TO_GXB = W_S4_RECONFIG_BUNDLE_TO_XCVR;
localparam integer W_S4_RECONFIG_BUNDLE_FROM_GXB = W_S4_RECONFIG_BUNDLE_FROM_XCVR;
localparam integer W_C4_RECONFIG_BUNDLE_TO_GXB = W_C4_RECONFIG_BUNDLE_TO_XCVR;
localparam integer W_C4_RECONFIG_BUNDLE_FROM_GXB = W_C4_RECONFIG_BUNDLE_FROM_XCVR;
// convert frequency string into integer Hz. Fractional Hz are truncated
// Must remain a constant function - can't use string.atoi().
function time str2hz (
input [8*MAX_CHARS:1] s
);
integer i;
integer c; // temp char storage for frequency conversion
integer unit_tens; // assume already Hz
integer is_numeric;
integer saw_dot;
reg [8:1] c_dot; // = ".";
reg [8:1] c_space; // = " ";
reg [8:1] c_a; // = 8'h61; //"a";
reg [8:1] c_z; // = 8'h7a; //"z";
reg [8*4:1] s_unit;
reg [8*MAX_CHARS:1] s_shift;
begin
// frequency ratio calculations
str2hz = 0;
unit_tens = 0; // assume already Hz
is_numeric = 1;
saw_dot = 0;
s_unit = "";
// Modelsim optimizer bug forces us to initialize these non-statically
c_dot = ".";
c_space = " ";
c_a = "a";
c_z = "z";
for (i=(MAX_CHARS-1); i>=0; i=i-1) begin
s_shift = (s >> (i*8));
c = s_shift[8:1] & 8'hff;
if (c > 0) begin
//$display("[%d] => '%1s',", i, c);
if (c >= 8'h30 && c <= 8'h39 && is_numeric) begin
str2hz = (str2hz * 10) + (c & 8'h0f);
if (saw_dot) unit_tens = unit_tens - 1; // count digits after decimal point
end else if (c == c_dot) saw_dot = 1;
else if (c != c_space) begin
is_numeric = 0; // stop accepting new numeric digits in value
// if it's a-z, convert to upper case A-Z
if (c >= c_a && c <= c_z) c = (c & 8'h5f); // convert a-z (lower) to A-Z (upper)
s_unit = (s_unit << 8) | c;
end
end
end
//$display("numeric = %d x 10**(%2d), unit = '%0s'", str2hz, unit_tens, s_unit);
// account for frequency unit
if (s_unit == "GHZ" || s_unit == "GBPS") unit_tens = unit_tens + 9; // 10**9
else if (s_unit == "MHZ" || s_unit == "MBPS") unit_tens = unit_tens + 6; // 10**6
else if (s_unit == "KHZ" || s_unit == "KBPS") unit_tens = unit_tens + 3; // 10**3
else if (s_unit != "HZ" && s_unit != "BPS") begin
$display("Invalid frequency unit '%0s', assuming %d x 10**(%2d) 'Hz'", s_unit, str2hz, unit_tens);
end
//$display("numeric in Hz = %d x 10**(%2d)", str2hz, unit_tens);
// align numeric to Hz
if (unit_tens < 0) begin
//str2hz = str2hz / (10**(-unit_tens));
for (i=0; i>unit_tens; i=i-1) begin
str2hz = str2hz / 10;
end
end else begin
//str2hz = str2hz * (10**unit_tens);
for (i=0; i<unit_tens; i=i+1) begin
str2hz = str2hz * 10;
end
end
//$display("%d Hz", str2hz);
end
endfunction
// convert integer Hz to a frequency string
// integer Hz as type time, and the frequency string will use MHz units
// Must remain a constant function - can't use $sformat or string.itoa().
function [MAX_CHARS*8-1:0] hz2str (
input time hz
);
integer pos;
integer f_unit; // 10**f_unit is offset from Hz for larger unit
time hz_mod_10;
begin
hz2str = "0.000000 MHz"; // minimum string value
f_unit = 6; // MHz offsets Hz value by 6 decimal digits
// convert time back to string with frequency units
// char positions 3 to 0 are used by " MHz", so start with digits at pos 4
for (pos = 4; pos < MAX_CHARS && hz > 0; pos = pos + 1) begin
if (f_unit == 0) begin
hz2str[pos*8 +: 8] = 8'h2e; // add "." character
pos = pos + 1;
end
f_unit = f_unit - 1;
hz_mod_10 = (hz % 10);
hz2str[pos*8 +: 8] = hz_mod_10[7:0] | 8'h30;
hz = hz / 10;
//$display("hz2str() => so far '%s', pos (%d), f_unit(%d) ", hz2str, pos, f_unit);
end
//$display("hz2str() returns '%s'", hz2str);
end
endfunction
// Convert a string to an integer
// Uses pre-existing str2hz function
function integer str2int(
input [MAX_CHARS*8-1:0] instring
);
time temp;
temp = str2hz(instring); // str2hz assume Hertz as default unit. Don't need to add 'Hz' to input.
str2int = temp[31:0];
endfunction
// Convert an integer to a string
function [MAX_CHARS*8-1:0] int2str(
input integer in_int
);
integer i;
integer this_char;
i = 0;
int2str = "";
do
begin
this_char = (in_int % 10) + 48;
int2str[i*8+:8] = this_char[7:0];
i=i+1;
in_int = in_int / 10;
end
while(in_int > 0);
endfunction
// function to convert at most 40-bit long string to binary
function [39 : 0] m_str_to_bin;
input [40*8 : 1] s;
reg [40*8 : 1] reg_s;
reg [40:1] res;
integer m;
begin
reg_s = s;
for (m = 40; m > 0; m = m-1 )
begin
res[m] = reg_s[313];
reg_s = reg_s << 8;
end
m_str_to_bin = res;
end
endfunction
//////////////////////////////
// Convert the argument string to a 64-bit binary value
// @hex_str The string to be converted specified as an ASCII hexadecimal string
function [63:0] m_hex_to_bin (
input [8*MAX_CHARS-1:0] hex_str
);
integer i;
reg [63:0] out; // = 64'h0000_0000_0000_0000;
reg [7:0] this_char;
begin
out = 64'h0000_0000_0000_0000;
for(i=0; i<16; i=i+1) begin
this_char = hex_str[i*8+:8];
if(this_char >= 48 && this_char <= 57)
out[i*4+:4] = this_char - 48;
else if(this_char >= 65 && this_char <= 70)
out[i*4+:4] = this_char - 55;
else if(this_char >= 97 && this_char <= 102)
out[i*4+:4] = this_char - 87;
else begin
out[i*4+:4] = 0;
end
end
end
m_hex_to_bin = out;
endfunction
////////////////////////////////////////////////////////////////////
// Verify that the string value is contained in the legal set.
//
// The 'set' can consist of a single string with no delimiters, e.g. "individual",
// or multiple values, separated by commas, and surrounded by parens, e.g. "(one,two,three,four,five)"
//
// Returns 1 if the value is in the set, and 0 otherwise
function integer is_in_legal_set(
input [MAX_CHARS*8-1:0] value,
input [MAX_STRS*MAX_CHARS*8-1:0] set
);
if (value == "<auto_any>")
is_in_legal_set = 1;
else if (value == "<auto_single>")
is_in_legal_set = (set[7:0] == 8'h29) ? 0 : 1; // 8'h29 is closing parenthesis char
else if (value == set)
is_in_legal_set = 1; // value matches single value in set
else begin
// check value against each in set
integer close_pos; // end of string marker can be comma or closing paren
integer open_pos; // open paren is start of set, if appropriate
reg [MAX_STRS*MAX_CHARS*8-1:0] legalstr;
is_in_legal_set = 0;
open_pos = MAX_STRS*MAX_CHARS-1;
// Remove closing parenthesis if exists
if(set[7:0] == 8'h29) begin
set = (set >> 8);
set[(MAX_STRS*MAX_CHARS*8-1)-:8] = 8'h00;
end
// look for first non-null and non open paren character
while (open_pos > 0 && (set[open_pos*8 +: 8] == 8'h00 || set[open_pos*8 +: 8] == 8'h28)) // look for first non-null
open_pos = open_pos - 1;
while (is_in_legal_set == 0 && open_pos >= 0) begin
close_pos = open_pos;
while (close_pos > 0
&& set[close_pos*8 +: 8] != 8'h2c) // look for comma (8'h2c)
close_pos = close_pos - 1;
if (close_pos >= 0) begin
close_pos = close_pos == 0 ? 0 : close_pos + 1;
legalstr = ((set & ((1'b1 << open_pos*8+8)-1)) >> close_pos*8);
if (value == legalstr)
is_in_legal_set = 1;
end
open_pos = close_pos-2; // prepare to look for next legal string
end
end
//$display("is_in_legal_set(): returns %d", is_in_legal_set);
endfunction
// Accepts a string list of comma seperated numbers and returns a binary
// field where each bit indicates whether the index corresponding to that bit
// was found in the legal set.
//
// @param count - The number of integer indexes to check for in the set
// or the highest integer minus 1.
// @param set - The list containing the integer values to search for
// @return - A bitfield where each bit indicates whether the corresponding
// integer was found in the legal set.
function [MAX_XCVR_CHANNELS-1:0] map_numerical_is_in_legal_set(
input integer count,
input [MAX_STRS*MAX_CHARS*8-1:0] set
);
integer index;
reg [MAX_XCVR_CHANNELS-1:0] retval;
// Validate count parameter
if(count > MAX_XCVR_CHANNELS)
$display("Error: [map_numerical_is_in_legal_set]: Invalid value for count: %0d",count);
map_numerical_is_in_legal_set = {MAX_XCVR_CHANNELS{1'b0}};
retval = {MAX_XCVR_CHANNELS{1'b0}};
for(index = 0; index < count; index = index + 1) begin
if(is_in_legal_set(int2str(index),set))
retval = retval | (({MAX_XCVR_CHANNELS{1'b0}} | 1'b1) << index);
end
map_numerical_is_in_legal_set = retval;
endfunction
// Accepts a string list of comma seperated numbers and returns a binary
// field where each byte contains the corresponding number found in the
// list.
//
// @param count - The number of elements in the list.
// @param set - The list containing the integer values.
// @return - A bitfield where each byte contains the corresponding number found
// at that location in the list.
function [MAX_XCVR_CHANNELS*8-1:0] map_numerical_legal_set(
input integer count,
input [MAX_STRS*MAX_CHARS*8-1:0] set
);
integer index;
reg [MAX_XCVR_CHANNELS-1:0] retval;
reg [MAX_CHARS*8-1:0] str_val;
reg [7:0] int_val;
// Validate count parameter
if(count > MAX_XCVR_CHANNELS || count > 256)
$display("Error: [map_numerical_legal_set]: Invalid value for count: %0d",count);
map_numerical_legal_set = {MAX_XCVR_CHANNELS{8'd0}};
retval = {MAX_XCVR_CHANNELS{8'd0}};
for(index = 0; index < count; index = index + 1) begin
str_val = get_value_at_index(index,set);
if(str_val != "NA") begin
int_val = str2int(str_val);
if(int_val > 255)
$display("Error: [map_numerical_legal_set]: Invalid string contains non-numerical item or value:%0d",int_val);
else begin
retval = retval | ( ( {MAX_XCVR_CHANNELS{8'd0}} | int_val ) << (index * 8));
end
end
end
map_numerical_legal_set = retval;
endfunction
// Accepts a comma separated list of string values and returns the element
// found at the specified index. If the index is invalid, "NA" is returned
//
// @param index - The index of the value to return within "set"
// @param set - A comma separated list of string values. The entire list may
// be surrounded by parenthesis("(item0,item1,item2)")
function [MAX_CHARS*8-1:0] get_value_at_index(
input integer index,
input [MAX_STRS*MAX_CHARS*8-1:0] set
);
// check value against each in set
integer close_pos; // end of string marker can be comma or closing paren
integer open_pos; // open paren is start of set, if appropriate
reg [MAX_STRS*MAX_CHARS*8-1:0] legalstr;
integer cur_index;
get_value_at_index = "";
legalstr = "NA";
cur_index = 0;
open_pos = MAX_STRS*MAX_CHARS-1;
// Remove closing parenthesis if exists
if(set[7:0] == 8'h29) begin
set = (set >> 8);
set[(MAX_STRS*MAX_CHARS*8-1)-:8] = 8'h00;
end
// Find the start of the string
while (open_pos >= 1 && (set[open_pos*8 +: 8] == 8'h00 || set[open_pos*8 +: 8] == 8'h28)) // look for first non-null
open_pos = open_pos - 1;
// Iterate through list until the string is found or we've reached the end of the list
while (legalstr == "NA" && open_pos >= 0 && cur_index <= index) begin
close_pos = open_pos;
// Move the close iterator to the end of the current value (or end of string)
while (close_pos > 0
&& set[close_pos*8 +: 8] != 8'h2c) // look for comma (8'h2c)
close_pos = close_pos - 1;
if (close_pos >= 0) begin
close_pos = close_pos == 0 ? 0 : close_pos + 1;
if(index == cur_index) begin
legalstr = ((set & ((1'b1 << open_pos*8+8)-1)) >> close_pos*8);
end
open_pos = close_pos-2; // prepare to look for next legal string
end
cur_index = cur_index + 1;
end
cur_index = 0;
while(legalstr[cur_index*8+:8] != 0) begin
get_value_at_index[cur_index*8+:8] = legalstr[cur_index*8+:8];
cur_index = cur_index + 1;
end
//$display("is_in_legal_set(): returns %d", is_in_legal_set);
endfunction
// The goal was to return one of the values, does not matter which one.
// ~45 times faster than get_value_at_index( 0, set );
function [MAX_CHARS*8-1:0] get_first_enum_value( input [MAX_STRS*MAX_CHARS*8-1:0] set );
int start_pos, cur_idx;
bit [7:0] cur_set_char;
// Ensure null-terminating the string.
// MODIFIED: Work around for a QuestaSim vopt bug: set[(MAX_STRS*MAX_CHARS*8-8) +: 8 ] = 8'h00;
set [ ( MAX_STRS * MAX_CHARS * 8 -1) : ( MAX_STRS * MAX_CHARS * 8 - 8) ] = 8 'h00 ;
start_pos = set[7:0] == 8'h29 ? 8 : 0;
cur_idx = 0;
get_first_enum_value = "";
forever
begin
cur_set_char = set[ cur_idx + start_pos +: 8 ];
// comma, par or 0
if ( cur_set_char == 8'h2c || cur_set_char == 8'h28 || cur_set_char == 8'h00 )
break;
get_first_enum_value[ cur_idx +: 8 ] = cur_set_char;
cur_idx = cur_idx + 8;
end
// get_first_enum_value = get_value_at_index( 0, set );
endfunction
// This functions is ~12 times faster than is_in_legal_set
function integer is_enum_in_legal_set( input [MAX_CHARS*8-1:0] value, input [MAX_STRS*MAX_CHARS*8-1:0] set );
if ( value == "<auto_any>" )
return 1;
else if (value == "<auto_single>")
return (set[7:0] == 8'h29) ? 0 : 1; // 8'h29 is closing parenthesis char
else if (value == set)
return 1; // value matches single value in set
else
begin
// ')'
int set_pos;
set_pos = 0;
if ( set[7:0] == 8'h29 )
set_pos = 8;
// Ensure null-terminating the string.
set[(MAX_STRS*MAX_CHARS*8-8) +: 8 ] = 8'h00;
forever
begin
int cur_cmp_len;
cur_cmp_len = 0;
// $display( "set_pos ", set_pos/8 );
forever
begin
int cur_val_char, cur_set_char;
cur_val_char = value[ cur_cmp_len +: 8 ];
cur_set_char = set[ set_pos +: 8 ];
// $display( "comparing ", set_pos/8, cur_cmp_len/8, " " , value[ cur_cmp_len +: 8 ], " ", set[ set_pos +: 8 ] );
if ( cur_val_char == 0 )
// The end of value reached, check whether set has comma, par or 0
if ( cur_set_char == 8'h2c || cur_set_char == 8'h28 || cur_set_char == 8'h00 )
return 1;
if ( cur_val_char != cur_set_char )
break;
cur_cmp_len = cur_cmp_len + 8;
set_pos = set_pos + 8;
end
forever
begin
int cur_set_char;
cur_set_char = set[ set_pos +: 8 ];
// $display( "skipping ", set_pos/8 );
// ','
if ( cur_set_char == 8'h2c )
begin
set_pos = set_pos + 8;
break;
end
if ( cur_set_char == 8'h00 )
return 0;
set_pos = set_pos + 8;
end
end
end
endfunction
// The first parameter is just a number, NOT a string
function integer is_numeric_in_legal_set( input [MAX_CHARS*8-1:0] value, input [MAX_STRS*MAX_CHARS*8-1:0] set );
is_numeric_in_legal_set = 1;
endfunction
// AP stubs --- end
////////////////////////////////////////////////////////////////////////
// Returns ceil_log2() value
localparam integer MAX_PRECISION = 32; // VCS requires this declaration outside the function
function integer ceil_log2;
input [MAX_PRECISION-1:0] input_num;
integer i;
reg [MAX_PRECISION-1:0] try_result;
begin
i = 0;
try_result = 1;
while ((try_result << i) < input_num && i < MAX_PRECISION)
i = i + 1;
ceil_log2 = i;
end
endfunction
////////////////////////////////////////////////////////////////////
// Return the number of bits required to represent an integer
// E.g. 0->1; 1->1; 2->2; 3->2 ... 31->5; 32->6
//
function integer clogb2;
input [MAX_PRECISION-1:0] input_num;
begin
for (clogb2=0; input_num>0 && clogb2<MAX_PRECISION; clogb2=clogb2+1)
input_num = input_num >> 1;
if(clogb2 == 0)
clogb2 = 1;
end
endfunction
////////////////////////////////////////////////////////////////////
// Return current device family string for display purposes
`ifndef XCVR_DEV_FAM
`ifdef ALTERA_RESERVED_QIS_FAMILY
`define XCVR_DEV_FAM `ALTERA_RESERVED_QIS_FAMILY // synthesis: use QIS-defined value
`else
`define XCVR_DEV_FAM device_family // simulation: use passed-in value
`endif
`endif
function [MAX_CHARS*8-1:0] current_device_family (
input [MAX_CHARS*8-1:0] device_family
);
current_device_family = `XCVR_DEV_FAM;
endfunction
////////////////////////////////////////////////////////////////////
// Match device family against standard family name strings
//
// Returns 1 if the names feature is present in the given device family
function integer has_s4_style_hssi (
input [MAX_CHARS*8-1:0] device_family
);
has_s4_style_hssi = ( (`XCVR_DEV_FAM == "Stratix IV")
|| (`XCVR_DEV_FAM == "Arria II")
|| (`XCVR_DEV_FAM == "Cyclone IV GX") // not exact, but close enough
|| (`XCVR_DEV_FAM == "Arria II GX")
|| (`XCVR_DEV_FAM == "Arria II GZ")
|| (`XCVR_DEV_FAM == "HardCopy IV")
) ? 1 : 0;
endfunction
////////////////////////////////////////////////////////////////////
// Match device family against standard family name strings
//
// Returns 1 if the names feature is present in the given device family
function integer has_s5_style_hssi (
input [MAX_CHARS*8-1:0] device_family
);
has_s5_style_hssi = ( (`XCVR_DEV_FAM == "Stratix V") || (`XCVR_DEV_FAM == "Arria V GZ")
) ? 1 : 0;
endfunction
////////////////////////////////////////////////////////////////////
// Match device family against standard family name strings
//
// Returns 1 if the names feature is present in the given device family
function integer has_a5_style_hssi (
input [MAX_CHARS*8-1:0] device_family
);
has_a5_style_hssi = ( (`XCVR_DEV_FAM == "Arria V")
) ? 1 : 0;
endfunction
////////////////////////////////////////////////////////////////////
// Match device family against standard family name strings
//
// Returns 1 if the names feature is present in the given device family
function integer has_c5_style_hssi (
input [MAX_CHARS*8-1:0] device_family
);
has_c5_style_hssi = ( (`XCVR_DEV_FAM == "Cyclone V")
) ? 1 : 0;
endfunction
////////////////////////////////////////////////////////////////////
// Match device family against standard family name strings
//
// Returns 1 if the names feature is present in the given device family
function integer has_c4_style_hssi (
input [MAX_CHARS*8-1:0] device_family
);
has_c4_style_hssi = ( (`XCVR_DEV_FAM == "Cyclone IV GX")
) ? 1 : 0;
endfunction
////////////////////////////////////////////////////////////////////
// Get reconfig_to_gxb bundle width for specified device family
//
// Returns 0 if the device_family argument is invalid, otherwise
// it returns the width of the reconfig_to_gxb bundle for that family
function integer get_reconfig_to_gxb_width (
input [MAX_CHARS*8-1:0] device_family
);
if (has_s5_style_hssi(device_family) || has_a5_style_hssi(device_family) || has_c5_style_hssi(device_family))
get_reconfig_to_gxb_width = W_S5_RECONFIG_BUNDLE_TO_XCVR;
else if (has_s4_style_hssi(device_family))
get_reconfig_to_gxb_width = W_S4_RECONFIG_BUNDLE_TO_XCVR;
else if (has_c4_style_hssi(device_family))
get_reconfig_to_gxb_width = W_C4_RECONFIG_BUNDLE_TO_XCVR;
else
get_reconfig_to_gxb_width = 0;
endfunction
////////////////////////////////////////////////////////////////////
// Get reconfig_from_gxb bundle width for specified device family
//
// Returns 0 if the device_family argument is invalid, otherwise
// it returns the width of the reconfig_from_gxb bundle for that family
function integer get_reconfig_from_gxb_width (
input [MAX_CHARS*8-1:0] device_family
);
if (has_s5_style_hssi(device_family) || has_a5_style_hssi(device_family) || has_c5_style_hssi(device_family))
get_reconfig_from_gxb_width = W_S5_RECONFIG_BUNDLE_FROM_XCVR;
else if (has_s4_style_hssi(device_family))
get_reconfig_from_gxb_width = W_S4_RECONFIG_BUNDLE_FROM_XCVR;
else if (has_c4_style_hssi(device_family))
get_reconfig_from_gxb_width = W_C4_RECONFIG_BUNDLE_FROM_XCVR;
else
get_reconfig_from_gxb_width = 0;
endfunction
////////////////////////////////////////////////////////////////////
// Get reconfig_to_xcvr total port width for specified device family
//
// Returns 0 if the device_family argument is invalid, otherwise
// it returns the width of the reconfig_to_xcvr port for that family
function integer get_reconfig_to_width (
input [MAX_CHARS*8-1:0] device_family,
input integer reconfig_interfaces
);
if (has_s5_style_hssi(device_family) || has_a5_style_hssi(device_family) || has_c5_style_hssi(device_family))
get_reconfig_to_width = get_s5_reconfig_to_width(reconfig_interfaces);
else if (has_s4_style_hssi(device_family))
get_reconfig_to_width = W_S4_RECONFIG_BUNDLE_TO_XCVR;
else if (has_c4_style_hssi(device_family))
get_reconfig_to_width = W_C4_RECONFIG_BUNDLE_TO_XCVR;
else
get_reconfig_to_width = 0;
endfunction
////////////////////////////////////////////////////////////////////
// Get reconfig_to_xcvr total port width for Stratix V device family
//
function integer get_s5_reconfig_to_width (
input integer reconfig_interfaces
);
get_s5_reconfig_to_width = reconfig_interfaces * get_reconfig_to_gxb_width("Stratix V");
endfunction
////////////////////////////////////////////////////////////////////
// Get reconfig_from_xcvr total port width for specified device family
//
// Returns 0 if the device_family argument is invalid, otherwise
// it returns the width of the reconfig_from_xcvr port for that family
function integer get_reconfig_from_width (
input [MAX_CHARS*8-1:0] device_family,
input integer reconfig_interfaces
);
if (has_s5_style_hssi(device_family) || has_a5_style_hssi(device_family) || has_c5_style_hssi(device_family))
get_reconfig_from_width = reconfig_interfaces * get_reconfig_from_gxb_width(device_family);
else if (has_s4_style_hssi(device_family))
get_reconfig_from_width = reconfig_interfaces * get_reconfig_from_gxb_width(device_family);
else if (has_c4_style_hssi(device_family))
get_reconfig_from_width = reconfig_interfaces * get_reconfig_from_gxb_width(device_family);
else
get_reconfig_from_width = 0;
endfunction
////////////////////////////////////////////////////////////////////
// Get reconfig_from_xcvr total port width for Stratix V device family
//
function integer get_s5_reconfig_from_width (
input integer reconfig_interfaces
);
get_s5_reconfig_from_width = reconfig_interfaces * get_reconfig_from_gxb_width("Stratix V");
endfunction
////////////////////////////////////////////////////////////////////
// Get number of reconfig interfaces for Custom PHY
// NOTE - !!Has since been used by other PHY IP!!
//
// @param device_family - Desired device family
// @param operation_mode - "Duplex","Rx","Tx" or "duplex", "rx_only", "tx_only" in 10gbaser
// @param lanes - Number of channels
// @param plls - Number of TX plls (per channel)
// @param bonded_group_size - Size of bonded group (1 or lanes)
// @param data_path_type - Abuse of function by overloading for ATT support
// - Carry on the abuse
//
// @return 0 if the device_family argument is invalid, otherwise
// it returns the width of the reconfig_from_xcvr port for that family
function integer get_custom_reconfig_interfaces(
input [MAX_CHARS*8-1:0] device_family,
input [MAX_CHARS*8-1:0] operation_mode,
input integer lanes,
input integer plls,
input integer bonded_group_size,
input [MAX_CHARS*8-1:0] data_path_type = "",
input [MAX_CHARS*8-1:0] bonded_mode = "xN"
);
integer reconfig_interfaces;
reconfig_interfaces = 0;
if (has_s5_style_hssi(device_family) || has_a5_style_hssi(device_family) || has_c5_style_hssi(device_family)) begin
// ATT specific calculations
if( data_path_type == "ATT" ) begin
if((operation_mode == "RX_ONLY") || (operation_mode == "rx_only") || (operation_mode == "Rx") || (operation_mode == "RX") || (operation_mode == "rx")) begin
reconfig_interfaces = lanes;
end else if((operation_mode == "TX_ONLY") || (operation_mode == "tx_only") || (operation_mode == "Tx") || (operation_mode == "TX") || (operation_mode == "tx")) begin
reconfig_interfaces = 2*lanes;
end else begin
reconfig_interfaces = 3*lanes;
end
end else begin
// Custom PHY calculations
if((operation_mode == "RX") || (operation_mode == "Rx") || (operation_mode == "rx_only"))
reconfig_interfaces = lanes;
else begin
bonded_group_size = (bonded_mode == "fb_compensation") ? 1 :
(bonded_mode == "non_bonded") ? 1 : bonded_group_size;
reconfig_interfaces = lanes+(plls*(lanes/bonded_group_size));
end
end
end
get_custom_reconfig_interfaces = reconfig_interfaces;
endfunction
////////////////////////////////////////////////////////////////////
// Get reconfig_to_xcvr total port width for Custom PHY
//
// @param device_family - Desired device family
// @param operation_mode - "Duplex","Rx","Tx" or "duplex", "rx_only", "tx_only" in 10gbaser
// @param lanes - Number of transceiver channels
// @param plls - Number of plls per bonded group
// @param bonded_group_size - Size of bonded group (1 or lanes)
// @param data_path_type - Abuse of function to support ATT
//
// @return - 0 if the device_family argument is invalid, otherwise
// it returns the width of the reconfig_from_xcvr port for that family
function integer get_custom_reconfig_to_width(
input [MAX_CHARS*8-1:0] device_family,
input [MAX_CHARS*8-1:0] operation_mode,
input integer lanes,
input integer plls,
input integer bonded_group_size,
input [MAX_CHARS*8-1:0] data_path_type = "",
input [MAX_CHARS*8-1:0] bonded_mode = "xN"
);
integer reconfig_interfaces;
reconfig_interfaces = get_custom_reconfig_interfaces(device_family,operation_mode,lanes,plls,bonded_group_size, data_path_type, bonded_mode );
get_custom_reconfig_to_width = get_s5_reconfig_to_width(reconfig_interfaces);
endfunction
////////////////////////////////////////////////////////////////////
// Get reconfig_from_xcvr total port width for Custom PHY
//
// @param device_family - Desired device family
// @param operation_mode - "Duplex","Rx","Tx" or "duplex", "rx_only", "tx_only" in 10gbaser
// @param lanes - Number of transceiver channels
// @param plls - Number of plls per bonded group
// @param bonded_group_size - Size of bonded group (1 or lanes)
// @param data_path_type - Abuse of function to support ATT
//
// @return - 0 if the device_family argument is invalid, otherwise
// it returns the width of the reconfig_from_xcvr port for that family
function integer get_custom_reconfig_from_width(
input [MAX_CHARS*8-1:0] device_family,
input [MAX_CHARS*8-1:0] operation_mode,
input integer lanes,
input integer plls,
input integer bonded_group_size,
input [MAX_CHARS*8-1:0] data_path_type = "",
input [MAX_CHARS*8-1:0] bonded_mode = "xN"
);
integer reconfig_interfaces;
reconfig_interfaces = get_custom_reconfig_interfaces(device_family,operation_mode,lanes,plls,bonded_group_size, data_path_type, bonded_mode);
get_custom_reconfig_from_width = get_s5_reconfig_from_width(reconfig_interfaces);
endfunction
////////////////////////////////////////////////////////////////////
// Start Interlaken Specific functions for calculating reconfig interfaces
// and reconfig_to_gxb, reconfig_from_gxb widths
////////////////////////////////////////////////////////////////////
// Get number of reconfig interfaces for Interlaken PHY
//
// @param device_family - Desired device family
// @param operation_mode - "Duplex","Rx","Tx" or "duplex", "rx_only", "tx_only" in 10gbaser
// Returns 0 if the device_family argument is invalid, otherwise
// it returns the width of the reconfig_from_xcvr port for that family
function integer get_interlaken_reconfig_interfaces(
input [MAX_CHARS*8-1:0] device_family,
input [MAX_CHARS*8-1:0] operation_mode,
input integer bonded_group_size,
input integer lanes
);
integer reconfig_interfaces;
integer xslices;
integer xremain;
integer totalplls;
reconfig_interfaces = 0;
if (has_s5_style_hssi(device_family) || has_a5_style_hssi(device_family) || has_c5_style_hssi(device_family)) begin
if((operation_mode == "RX") || (operation_mode == "Rx") || (operation_mode == "rx_only"))
reconfig_interfaces = lanes;
else begin
xslices = lanes/bonded_group_size;
xremain = lanes % bonded_group_size;
if (xremain >0)
totalplls = xslices +1;
else
totalplls = xslices;
reconfig_interfaces = lanes+totalplls;
end // else: !if((operation_mode == "RX") || (operation_mode == "Rx") || (operation_mode == "rx_only"))
end // if (has_s5_style_hssi(device_family))
get_interlaken_reconfig_interfaces = reconfig_interfaces;
endfunction
////////////////////////////////////////////////////////////////////
// Get reconfig_to_xcvr total port width for Interlaken PHY
//
// @param device_family - Desired device family
// @param operation_mode - "Duplex","Rx","Tx" or "duplex", "rx_only", "tx_only" in 10gbaser
// @param lanes - Number of transceiver channels
// Returns 0 if the device_family argument is invalid, otherwise
// it returns the width of the reconfig_from_xcvr port for that family
function integer get_interlaken_reconfig_to_width(
input [MAX_CHARS*8-1:0] device_family,
input [MAX_CHARS*8-1:0] operation_mode,
input integer bonded_group_size,
input integer lanes
);
integer reconfig_interfaces;
reconfig_interfaces = get_interlaken_reconfig_interfaces(device_family,operation_mode,bonded_group_size,lanes);
get_interlaken_reconfig_to_width = get_s5_reconfig_to_width(reconfig_interfaces);
endfunction
////////////////////////////////////////////////////////////////////
// Get reconfig_from_xcvr total port width for Custom PHY
//
// @param device_family - Desired device family
// @param operation_mode - "Duplex","Rx","Tx" or "duplex", "rx_only", "tx_only" in 10gbaser
// Returns 0 if the device_family argument is invalid, otherwise
// it returns the width of the reconfig_from_xcvr port for that family
function integer get_interlaken_reconfig_from_width(
input [MAX_CHARS*8-1:0] device_family,
input [MAX_CHARS*8-1:0] operation_mode,
input integer bonded_group_size,
input integer lanes
);
integer reconfig_interfaces;
reconfig_interfaces = get_interlaken_reconfig_interfaces(device_family,operation_mode,bonded_group_size,lanes);
get_interlaken_reconfig_from_width = get_s5_reconfig_from_width(reconfig_interfaces);
endfunction
// End Interlaken specific functions
////////////////////////////////////////////////////////////////////
endpackage

View file

@ -0,0 +1,95 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
//
// Transceiver native reconfig adapter for Stratix V & derivatives.
// Translates from native reconfig wire bundles to separate Av reconfig and testbus signals
//
// This direction for bundle to separate buses inside the sv_xcvr_protocol_native block
//
// $Header$
//
`timescale 1 ns / 1 ns
module av_reconfig_bundle_to_basic #(
parameter native_ifs = 1 // number of native reconfig interfaces
) (
// bundled reconfig buses
output wire [native_ifs*altera_xcvr_functions::W_S5_RECONFIG_BUNDLE_TO_XCVR -1:0] reconfig_to_xcvr, // all inputs from reconfig block to native xcvr reconfig ports
input wire [native_ifs*altera_xcvr_functions::W_S5_RECONFIG_BUNDLE_FROM_XCVR-1:0] reconfig_from_xcvr,// all input s from native xcvr reconfig ports to reconfig block
// native reconfig sources
output wire [native_ifs*16 -1:0] native_reconfig_readdata, // Avalon DPRIO readdata
output wire [native_ifs*3*8-1:0] pif_testbus, // testbus from native reconfig, for all physical interfaces
output wire pif_atbout, // Voltage comparator output for DCD (1 for each lane)
// native reconfig sinks
input wire [native_ifs*1 -1:0] native_reconfig_clk,
input wire [native_ifs*1 -1:0] native_reconfig_reset,
input wire [native_ifs*16 -1:0] native_reconfig_writedata, // Avalon DPRIO writedata
input wire [native_ifs*12 -1:0] native_reconfig_address, // Avalon DPRIO address
input wire [native_ifs*1 -1:0] native_reconfig_write, // Avalon DPRIO write
input wire [native_ifs*1 -1:0] native_reconfig_read, // Avalon DPRIO read
input wire [native_ifs*12 -1:0] pif_testbus_sel, // 4 bits per physical channel
input wire [native_ifs*1 -1:0] pif_interface_sel,
input wire [native_ifs*1 -1:0] pif_ser_shift_load,
input wire oc_cal_busy,
input wire tx_cal_busy,
input wire rx_cal_busy
);
localparam w_bundle_to_xcvr = altera_xcvr_functions::W_S5_RECONFIG_BUNDLE_TO_XCVR;
localparam w_bundle_from_xcvr= altera_xcvr_functions::W_S5_RECONFIG_BUNDLE_FROM_XCVR;
wire [native_ifs*1 -1:0] oc_cal_busy_bus;
wire [native_ifs*1 -1:0] tx_cal_busy_bus;
wire [native_ifs*1 -1:0] rx_cal_busy_bus;
tri0 [native_ifs*1 -1:0] pif_atbout_bus;
assign oc_cal_busy_bus = {native_ifs{oc_cal_busy}};
assign tx_cal_busy_bus = {native_ifs{tx_cal_busy}};
assign rx_cal_busy_bus = {native_ifs{rx_cal_busy}};
assign pif_atbout = |pif_atbout_bus;
genvar pi;
generate
for (pi=0; pi<native_ifs; ++pi) begin: pif
// !!!!!!!!!!!!!!!!!!!!!!!!!!!! NOTE !!!!!!!!!!!!!!!!!!!!!!!!
// Any changes to the bit mappings here must also be made in:
// - sv_reconfig_bundle_to_xcvr
// - sv_reconfig_bundle_to_ip
// - sv_reconfig_bundle_merger
// native reconfig sinks
assign reconfig_to_xcvr[pi*w_bundle_to_xcvr +: 1] = native_reconfig_clk [pi*1 +: 1];
assign reconfig_to_xcvr[pi*w_bundle_to_xcvr+1 +: 1] = native_reconfig_reset [pi*1 +: 1];
assign reconfig_to_xcvr[pi*w_bundle_to_xcvr+2 +: 16] = native_reconfig_writedata [pi*16 +: 16];
assign reconfig_to_xcvr[pi*w_bundle_to_xcvr+18 +: 1] = native_reconfig_write [pi*1 +: 1];
assign reconfig_to_xcvr[pi*w_bundle_to_xcvr+19 +: 1] = native_reconfig_read [pi*1 +: 1];
assign reconfig_to_xcvr[pi*w_bundle_to_xcvr+20 +: 12] = native_reconfig_address [pi*12 +: 12];
assign reconfig_to_xcvr[pi*w_bundle_to_xcvr+32 +: 12] = pif_testbus_sel [pi*12 +: 12];
assign reconfig_to_xcvr[pi*w_bundle_to_xcvr+44 +: 1] = pif_interface_sel [pi*1 +: 1];
assign reconfig_to_xcvr[pi*w_bundle_to_xcvr+45 +: 1] = pif_ser_shift_load [pi*1 +: 1];
assign reconfig_to_xcvr[pi*w_bundle_to_xcvr+46 +: 1] = oc_cal_busy_bus [pi*1 +: 1];
assign reconfig_to_xcvr[pi*w_bundle_to_xcvr+47 +: 1] = tx_cal_busy_bus [pi*1 +: 1];
assign reconfig_to_xcvr[pi*w_bundle_to_xcvr+48 +: 1] = rx_cal_busy_bus [pi*1 +: 1];
assign reconfig_to_xcvr[pi*w_bundle_to_xcvr+49 +: 21] = {21{1'b0}}; // reserved
// native reconfig sources
assign native_reconfig_readdata[pi*16 +: 16] = reconfig_from_xcvr[pi*w_bundle_from_xcvr +: 16];
assign pif_testbus [pi*24 +: 24] = reconfig_from_xcvr[pi*w_bundle_from_xcvr+16 +: 24];
assign pif_atbout_bus [pi*1 +: 1] = reconfig_from_xcvr[pi*w_bundle_from_xcvr+40 +: 1];
end
endgenerate
endmodule

View file

@ -0,0 +1,101 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
//
// Transceiver native reconfig adapter for Stratix V & derivatives.
// Translates from native reconfig wire bundles to separate Av reconfig and testbus signals
//
// This direction for bundle to separate buses inside the sv_xcvr_reconfig_basic block
//
// $Header$
//
`timescale 1 ns / 1 ns
// altera message_off 10720
// altera message_off 13024 21074
module av_reconfig_bundle_to_xcvr #(
parameter native_ifs = 1 // number of native reconfig interfaces
) (
// bundled reconfig buses
input wire [native_ifs*altera_xcvr_functions::W_S5_RECONFIG_BUNDLE_TO_XCVR -1:0] reconfig_to_xcvr, // all inputs from reconfig block to native xcvr reconfig ports
output wire [native_ifs*altera_xcvr_functions::W_S5_RECONFIG_BUNDLE_FROM_XCVR-1:0] reconfig_from_xcvr, // all outputs from native xcvr reconfig ports to reconfig block
// native reconfig sources
input wire [native_ifs*16 -1:0] native_reconfig_readdata, // Avalon DPRIO readdata
input wire [native_ifs*3*8-1:0] pif_testbus, // testbus from native reconfig, for all physical interfaces
// Voltage comparator output for DCD
input wire pif_atbcompout,
// native reconfig sinks
output wire [native_ifs*1 -1:0] native_reconfig_clk,
output wire [native_ifs*1 -1:0] native_reconfig_reset,
output wire [native_ifs*16 -1:0] native_reconfig_writedata, // Avalon DPRIO writedata
output wire [native_ifs*12 -1:0] native_reconfig_address, // Avalon DPRIO address
output wire [native_ifs*1 -1:0] native_reconfig_write, // Avalon DPRIO write
output wire [native_ifs*1 -1:0] native_reconfig_read, // Avalon DPRIO read
output wire [native_ifs*12 -1:0] pif_testbus_sel, // 4 bits per physical channel
output wire [native_ifs*1 -1:0] pif_interface_sel,
output wire [native_ifs*1 -1:0] pif_ser_shift_load,
output wire tx_cal_busy,
output wire rx_cal_busy
);
localparam w_bundle_to_xcvr = altera_xcvr_functions::W_S5_RECONFIG_BUNDLE_TO_XCVR;
localparam w_bundle_from_xcvr= altera_xcvr_functions::W_S5_RECONFIG_BUNDLE_FROM_XCVR;
// tri0 [native_ifs*1 -1:0] oc_cal_busy_bus;
tri0 [native_ifs*1 -1:0] tx_cal_busy_bus;
tri0 [native_ifs*1 -1:0] rx_cal_busy_bus;
tri0 [native_ifs*1 -1:0] pif_atbcompout_bus;
// assign oc_cal_busy = |oc_cal_busy_bus;
//NOTE: This bus is just a fanout from a single source in the Reconfig controller. This OR gate should optimize away.
assign tx_cal_busy = |tx_cal_busy_bus;
assign rx_cal_busy = |rx_cal_busy_bus;
assign pif_atbcompout_bus = {native_ifs{pif_atbcompout}};
genvar pi;
generate
for (pi=0; pi<native_ifs; ++pi) begin: pif
// !!!!!!!!!!!!!!!!!!!!!!!!!!!! NOTE !!!!!!!!!!!!!!!!!!!!!!!!
// Any changes to the bit mappings here must also be made in:
// - sv_reconfig_bundle_to_basic
// - sv_reconfig_bundle_to_ip
// - sv_reconfig_bundle_merger
// native reconfig sinks
assign native_reconfig_clk [pi*1 +: 1] = reconfig_to_xcvr[pi*w_bundle_to_xcvr +: 1];
assign native_reconfig_reset [pi*1 +: 1] = reconfig_to_xcvr[pi*w_bundle_to_xcvr+1 +: 1];
assign native_reconfig_writedata[pi*16 +: 16] = reconfig_to_xcvr[pi*w_bundle_to_xcvr+2 +: 16];
assign native_reconfig_write [pi*1 +: 1] = reconfig_to_xcvr[pi*w_bundle_to_xcvr+18 +: 1];
assign native_reconfig_read [pi*1 +: 1] = reconfig_to_xcvr[pi*w_bundle_to_xcvr+19 +: 1];
assign native_reconfig_address [pi*12 +: 12] = reconfig_to_xcvr[pi*w_bundle_to_xcvr+20 +: 12];
assign pif_testbus_sel [pi*12 +: 12] = reconfig_to_xcvr[pi*w_bundle_to_xcvr+32 +: 12];
assign pif_interface_sel [pi*1 +: 1] = reconfig_to_xcvr[pi*w_bundle_to_xcvr+44 +: 1];
assign pif_ser_shift_load [pi*1 +: 1] = reconfig_to_xcvr[pi*w_bundle_to_xcvr+45 +: 1];
// assign oc_cal_busy_bus [pi*1 +: 1] = reconfig_to_xcvr[pi*w_bundle_to_xcvr+46 +: 1];
assign tx_cal_busy_bus [pi*1 +: 1] = reconfig_to_xcvr[pi*w_bundle_to_xcvr+47 +: 1];
assign rx_cal_busy_bus [pi*1 +: 1] = reconfig_to_xcvr[pi*w_bundle_to_xcvr+48 +: 1];
// native reconfig sources
assign reconfig_from_xcvr[pi*w_bundle_from_xcvr +: 16] = native_reconfig_readdata[pi*16 +: 16];
assign reconfig_from_xcvr[pi*w_bundle_from_xcvr+16 +: 24] = pif_testbus [pi*24 +: 24];
assign reconfig_from_xcvr[pi*w_bundle_from_xcvr+40 +: 1] = pif_atbcompout_bus [pi*1 +: 1];
assign reconfig_from_xcvr[pi*w_bundle_from_xcvr+41 +: 5] = {5{1'b0}}; // reserved
end
endgenerate
endmodule

View file

@ -0,0 +1,316 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
//
// SV-generation transceiver definitions and functions
//
// $Header$
//
// PACKAGE DECLARATION
package av_xcvr_h;
// SV Reconfiguration address definitions
// PMA, PCS Base address
localparam RECONFIG_PMA_CH0_BASE = 11'h000;
localparam RECONFIG_PCSPMAIF_CH0_BASE = 11'h064;
localparam RECONFIG_PCS8G_CH0_BASE = 11'h096;
localparam RECONFIG_PCSPLDIF_CH0_BASE = 11'h0FA;
localparam RECONFIG_PMA_CH1_BASE = 11'h190;
localparam RECONFIG_PCSPMAIF_CH1_BASE = RECONFIG_PMA_CH1_BASE + RECONFIG_PCSPMAIF_CH0_BASE;
localparam RECONFIG_PCS8G_CH1_BASE = RECONFIG_PMA_CH1_BASE + RECONFIG_PCS8G_CH0_BASE;
localparam RECONFIG_PCSPLDIF_CH1_BASE = RECONFIG_PMA_CH1_BASE + RECONFIG_PCSPLDIF_CH0_BASE;
localparam RECONFIG_PMA_CH2_BASE = 11'h320;
localparam RECONFIG_PCSPMAIF_CH2_BASE = RECONFIG_PMA_CH2_BASE + RECONFIG_PCSPMAIF_CH0_BASE;
localparam RECONFIG_PCS8G_CH2_BASE = RECONFIG_PMA_CH2_BASE + RECONFIG_PCS8G_CH0_BASE;
localparam RECONFIG_PCSPLDIF_CH2_BASE = RECONFIG_PMA_CH2_BASE + RECONFIG_PCSPLDIF_CH0_BASE;
// PMA RECONFIG Address
localparam RECONFIG_PMA_CH0_VOD = RECONFIG_PMA_CH0_BASE + 11'h004;
localparam RECONFIG_PMA_CH0_PRETAP = RECONFIG_PMA_CH0_BASE + 11'h003;
localparam RECONFIG_PMA_CH0_POSTTAP1 = RECONFIG_PMA_CH0_BASE + 11'h003;
localparam RECONFIG_PMA_CH0_POSTTAP2 = RECONFIG_PMA_CH0_BASE + 11'h003;
localparam RECONFIG_PMA_CH0_RX_EQA = RECONFIG_PMA_CH0_BASE + 11'h012;
localparam RECONFIG_PMA_CH0_RX_EQB = RECONFIG_PMA_CH0_BASE + 11'h018;
localparam RECONFIG_PMA_CH0_RX_EQC = RECONFIG_PMA_CH0_BASE + 11'h018;
localparam RECONFIG_PMA_CH0_RX_EQD = RECONFIG_PMA_CH0_BASE + 11'h018;
localparam RECONFIG_PMA_CH0_RX_EQV = RECONFIG_PMA_CH0_BASE + 11'h013;
localparam RECONFIG_PMA_CH0_RX_EQDCGAIN = RECONFIG_PMA_CH0_BASE + 11'h013;
localparam RECONFIG_PMA_CH0_RCRU_RLBK = RECONFIG_PMA_CH0_BASE + 11'h010;
localparam RECONFIG_PMA_CH0_RREVLB_SW = RECONFIG_PMA_CH0_BASE + 11'h012;
localparam RECONFIG_PMA_CH0_RRX_DLPBK = RECONFIG_PMA_CH0_BASE + 11'h013;
localparam RECONFIG_PMA_CH0_RXBYPASSEQZ123 = RECONFIG_PMA_CH0_BASE + 11'h012; //chestan: cannot find this in S5, need to check with Gary
localparam RECONFIG_PMA_CH0_RXSELHALFBW = RECONFIG_PMA_CH0_BASE + 11'h012;
//DCD
localparam RECONFIG_PMA_CH0_DCD_RSER_CLK_MON = RECONFIG_PMA_CH0_BASE + 12'h001; // Forced data (test pattern)
localparam RECONFIG_PMA_CH0_DCD_RTX_LST = RECONFIG_PMA_CH0_BASE + 12'h002; // ATB
localparam RECONFIG_PMA_CH0_DCD_DC_TUNE = RECONFIG_PMA_CH0_BASE + 12'h006; // DCD calibration
// register bits offsets
localparam RSER_CLK_MON_OFST = 8; // Forced data (test pattern)
localparam RTX_LST_3_OFST = 15; // ATB to LPF mode - MSB
localparam RTX_LST_2_OFST = 14;
localparam RTX_LST_1_OFST = 13;
localparam RTX_LST_0_OFST = 12; // ATB to LPF mode - LSB
localparam RSER_DC_TUNE_2_OFST = 12; // DCD calibration -msb
localparam RSER_DC_TUNE_1_OFST = 11;
localparam RSER_DC_TUNE_0_OFST = 10; // DCD calibration -lsb
localparam REYE_ISEL_2 = 2; // ISEL msb
localparam REYE_ISEL_1 = 1;
localparam REYE_ISEL_0 = 0; // ISEL lsb
localparam REYE_PDB = 11; // power enable
//MIF RMW offsets and masks
localparam RECONFIG_PMA_CGB_REG_OFST = 12'h000; // contains rcgb_clk_sel, rcgb_x_en bits
localparam RECONFIG_PMA_CLKNET_CLKMON_REG_OFST = 12'h001; // contains XN Line select (rcgb_clknet_in_en), DCD protected bits (rser_clk_mon)
localparam RECONFIG_PMA_LST_REG_OFST = 12'h002; // contains DCD protected bits (rtx_lst)
localparam RECONFIG_PMA_BBPD_REG_OFST = 12'h00f; // contains BBPD control (rcru_pdof_*i)
localparam RECONFIG_PMA_TB_REG_OFST = 12'h010; // contains Testbus control control (rcru_pdof_test)
localparam RECONFIG_PMA_PCIEMD_RREF_REG_OFST = 12'h012; // contains (pcie_mode_sel, rrefclk_sel) bit
localparam RECONFIG_PMA_RXDATAO_REG_OFST = 12'h022; // contains rx_data_out_sel //rdynamic_sw, rint_early_eios, rint_ltr, rrxp_reserved[29], rint_tx_elec_idle, rint_txdetectrx, rint_pcie_switch, rint_cvp_mode, rint_ffclk_pdb
localparam RECONFIG_PMA_REFIQ_REG_OFST = 12'h024; // contains pma_iq_clk_sel bits
localparam RECONFIG_PCS8G_POWER_TRL_REG_OFST = RECONFIG_PCS8G_CH0_BASE + 12'h044; // contains r_pow_power_iso_ctrl bits
localparam RECONFIG_PMA_CGB_REG_MASK = 16'h1e3f;
localparam RECONFIG_PMA_CLKNET_CLKMON_REG_MASK = 16'h0300;
localparam RECONFIG_PMA_LST_REG_MASK = 16'hf000;
localparam RECONFIG_PMA_BBPD_REG_MASK = 16'hffff;
localparam RECONFIG_PMA_TB_REG_MASK = 16'h0007;
localparam RECONFIG_PMA_PCIEMD_RREF_REG_MASK = 16'h0820;
localparam RECONFIG_PMA_RXDATAO_REG_MASK = 16'h01ff; // contains rx_data_out_sel
localparam RECONFIG_PMA_REFIQ_REG_MASK = 16'h07f8; // contains pma_iq_clk_sel bits
localparam RECONFIG_PMA_DCD_DC_TUNE_REG_MASK = 16'h1c00; // contains rser_dc_tune
localparam RECONFIG_PCS8G_POWER_TRL_REG_MASK = 16'h0004; // contains r_pow_power_iso_ctrl bits
//****************************************************************************
//************************ Local channel registers ***************************
// Register address offset to gain access to the soft reconfig registers.
// This value must be added to the register addresses listed below.
localparam AV_XR_LOCAL_OFFSET = 12'h800;
//****************************
// Relative register addresses
localparam AV_XR_ADDR_DUMMY = 4'd0; // Dummy register for read/write testing
localparam AV_XR_ADDR_ADCE = 4'd1; // internal register for ADCE capture and standby
localparam AV_XR_ADDR_OC = 4'd2; // internal register for hard OC cal enable
localparam AV_XR_ADDR_PRBS = 4'd3; // internal register for PRBS control and status
localparam AV_XR_ADDR_DCD = 4'd4; // internal register for DCD control and status
localparam AV_XR_ADDR_DCD_RES = 4'd5; // internal register for DCD results
localparam AV_XR_ADDR_SLPBK = 4'd6; // internal register for serial loopback control
localparam AV_XR_ADDR_STATUS = 4'd7; // internal register for channel status
localparam AV_XR_ADDR_ID = 4'd8; // internal register for channel ID
localparam AV_XR_ADDR_REQUEST = 4'd9; // internal register for channel services request
localparam AV_XR_ADDR_RSTCTL = 4'd10; // internal register for channel reset control and override
//****************************
// Absolute register addresses
localparam AV_XR_ABS_ADDR_DUMMY = AV_XR_LOCAL_OFFSET + AV_XR_ADDR_DUMMY;
localparam AV_XR_ABS_ADDR_ADCE = AV_XR_LOCAL_OFFSET + AV_XR_ADDR_ADCE;
localparam AV_XR_ABS_ADDR_OC = AV_XR_LOCAL_OFFSET + AV_XR_ADDR_OC;
localparam AV_XR_ABS_ADDR_PRBS = AV_XR_LOCAL_OFFSET + AV_XR_ADDR_PRBS;
localparam AV_XR_ABS_ADDR_DCD = AV_XR_LOCAL_OFFSET + AV_XR_ADDR_DCD;
localparam AV_XR_ABS_ADDR_DCD_RES = AV_XR_LOCAL_OFFSET + AV_XR_ADDR_DCD_RES;
localparam AV_XR_ABS_ADDR_SLPBK = AV_XR_LOCAL_OFFSET + AV_XR_ADDR_SLPBK;
localparam AV_XR_ABS_ADDR_STATUS = AV_XR_LOCAL_OFFSET + AV_XR_ADDR_STATUS;
localparam AV_XR_ABS_ADDR_ID = AV_XR_LOCAL_OFFSET + AV_XR_ADDR_ID;
localparam AV_XR_ABS_ADDR_REQUEST = AV_XR_LOCAL_OFFSET + AV_XR_ADDR_REQUEST;
localparam AV_XR_ABS_ADDR_RSTCTL = AV_XR_LOCAL_OFFSET + AV_XR_ADDR_RSTCTL;
//*****************************
// Bit masks for DUMMY register
localparam AV_XR_DUMMY_DUMMY_OFST = 0;
localparam AV_XR_DUMMY_DUMMY_LEN = 1;
localparam AV_XR_DUMMY_DUMMY_MASK = 16'h0001;
//****************************
// Bit masks for ADCE register
localparam AV_XR_ADCE_CAPTURE_OFST = 0;
localparam AV_XR_ADCE_STANDBY_OFST = 1;
localparam AV_XR_ADCE_DONE_OFST = 2;
localparam AV_XR_ADCE_UNUSED_OFST = 3;
localparam AV_XR_ADCE_CAPTURE_LEN = 1;
localparam AV_XR_ADCE_STANDBY_LEN = 1;
localparam AV_XR_ADCE_DONE_LEN = 1;
localparam AV_XR_ADCE_UNUSED_LEN = 13;
localparam AV_XR_ADCE_CAPTURE_MASK = 16'h0001; // bitfield position of ADCE capture, within ADCE reg
localparam AV_XR_ADCE_STANDBY_MASK = 16'h0002; // bitfield position of ADCE standby, within ADCE reg
localparam AV_XR_ADCE_DONE_MASK = 16'h0004; // bitfield position of ADCE adapt done, within ADCE reg
//************************************
// Bit masks for HARDOC_CALEN register
localparam AV_XR_OC_CALEN_OFST = 0;
localparam AV_XR_OC_CALDONE_OFST = 1;
localparam AV_XR_OC_UNUSED_OFST = 2;
localparam AV_XR_OC_CALEN_LEN = 1;
localparam AV_XR_OC_CALDONE_LEN = 1;
localparam AV_XR_OC_UNUSED_LEN = 14;
localparam AV_XR_OC_CALEN_MASK = 16'h0001;
localparam AV_XR_OC_CALDONE_MASK = 16'h0002;
//****************************
// Bit masks for PRBS register
localparam AV_XR_PRBS_CLR_OFST = 0;
localparam AV_XR_PRBS_8G_ERR_OFST = 1;
localparam AV_XR_PRBS_8G_DONE_OFST = 2;
localparam AV_XR_PRBS_UNUSED_OFST = 3;
localparam AV_XR_PRBS_CLR_LEN = 1;
localparam AV_XR_PRBS_8G_ERR_LEN = 1;
localparam AV_XR_PRBS_8G_DONE_LEN = 1;
localparam AV_XR_PRBS_10G_ERR_LEN = 1;
localparam AV_XR_PRBS_10G_DONE_LEN = 1;
localparam AV_XR_PRBS_UNUSED_LEN = 13;
localparam AV_XR_PRBS_CLR_MASK = 16'h0001;
localparam AV_XR_PRBS_8G_ERR_MASK = 16'h0002;
localparam AV_XR_PRBS_8G_DONE_MASK = 16'h0004;
localparam AV_XR_PRBS_10G_ERR_MASK = 16'h0008;
localparam AV_XR_PRBS_10G_DONE_MASK = 16'h0010;
//***************************
// Bit masks for DCD register
localparam AV_XR_DCD_REQ_OFST = 0;
localparam AV_XR_DCD_ACK_OFST = 1;
localparam AV_XR_DCD_UNUSED_OFST = 2;
localparam AV_XR_DCD_REQ_LEN = 1;
localparam AV_XR_DCD_ACK_LEN = 1;
localparam AV_XR_DCD_UNUSED_LEN = 14;
localparam AV_XR_DCD_REQ_MASK = 16'h0001;
localparam AV_XR_DCD_ACK_MASK = 16'h0002;
//*******************************
// Bit masks for DCD_RES register
localparam AV_XR_DCD_RES_A_OFST = 0;
localparam AV_XR_DCD_RES_B_OFST = 8;
localparam AV_XR_DCD_RES_A_LEN = 8;
localparam AV_XR_DCD_RES_B_LEN = 8;
localparam AV_XR_DCD_RES_A_MASK = 16'h00ff;
localparam AV_XR_DCD_RES_B_MASK = 16'hff00;
//*****************************
// Bit masks for SLPBK register
localparam AV_XR_SLPBK_SLPBKEN_OFST = 0;
localparam AV_XR_SLPBK_UNUSED_OFST = 1;
localparam AV_XR_SLPBK_SLPBKEN_LEN = 1;
localparam AV_XR_SLPBK_UNUSED_LEN = 15;
localparam AV_XR_SLPBK_SLPBKEN_MASK = 16'h0001;
//******************************
// Bit masks for STATUS register
localparam AV_XR_STATUS_TX_DIGITAL_RESET_OFST = 0; // Valid only for channel interfaces
localparam AV_XR_STATUS_RX_DIGITAL_RESET_OFST = 1; // Valid only for channel interfaces
localparam AV_XR_STATUS_PLL_LOCKED_OFST = 2; // Valid only for PLL interfaces
localparam AV_XR_STATUS_PLL_LOCKED_FLAG_OFST = 3; // Valid only for PLL interfaces
localparam AV_XR_STATUS_UNUSED_OFST = 4; // Valid only for PLL interfaces
localparam AV_XR_STATUS_TX_DIGITAL_RESET_LEN = 1;
localparam AV_XR_STATUS_RX_DIGITAL_RESET_LEN = 1;
localparam AV_XR_STATUS_PLL_LOCKED_LEN = 1;
localparam AV_XR_STATUS_PLL_LOCKED_FLAG_LEN = 1;
localparam AV_XR_STATUS_UNUSED_LEN = 12;
localparam AV_XR_STATUS_TX_DIGITAL_RESET_MASK = 16'h0001;
localparam AV_XR_STATUS_RX_DIGITAL_RESET_MASK = 16'h0002;
localparam AV_XR_STATUS_PLL_LOCKED_MASK = 16'h0004;
localparam AV_XR_STATUS_PLL_LOCKED_FLAG_MASK = 16'h0008;
//**************************
// Bit masks for ID register
localparam AV_XR_ID_TX_CHANNEL_OFST = 0;
localparam AV_XR_ID_RX_CHANNEL_OFST = 1;
localparam AV_XR_ID_PLL_TYPE_OFST = 2;
localparam AV_XR_ID_UNUSED_OFST = 4;
localparam AV_XR_ID_TX_CHANNEL_LEN = 1;
localparam AV_XR_ID_RX_CHANNEL_LEN = 1;
localparam AV_XR_ID_PLL_TYPE_LEN = 2;
localparam AV_XR_ID_UNUSED_LEN = 12;
localparam AV_XR_ID_TX_CHANNEL_MASK = 16'h0001;
localparam AV_XR_ID_RX_CHANNEL_MASK = 16'h0002;
localparam AV_XR_ID_PLL_TYPE_MASK = 16'h000C;
// Parameters for PLL Type field
localparam AV_XR_ID_PLL_TYPE_NONE = 0;
localparam AV_XR_ID_PLL_TYPE_CMU = 1;
localparam AV_XR_ID_PLL_TYPE_LC = 2;
localparam AV_XR_ID_PLL_TYPE_FPLL = 3;
// Parameters for PMA bonding mode field
localparam AV_XR_ID_PMA_BONDING_X1 = 0;
localparam AV_XR_ID_PMA_BONDING_XN = 1;
localparam AV_XR_ID_PMA_BONDING_NONE = 2;
//*******************************
// Bit masks for REQUEST register
localparam AV_XR_REQUEST_DCD_OFST = 0;
localparam AV_XR_REQUEST_VRC_OFST = 1;
localparam AV_XR_REQUEST_OFFSET_OFST = 2;
localparam AV_XR_REQUEST_UNUSED_OFST = 3;
localparam AV_XR_REQUEST_DCD_LEN = 1;
localparam AV_XR_REQUEST_VRC_LEN = 1;
localparam AV_XR_REQUEST_UNUSED_LEN = 13;
localparam AV_XR_REQUEST_DCD_MASK = 16'h0001;
localparam AV_XR_REQUEST_VRC_MASK = 16'h0002;
localparam AV_XR_REQUEST_OFFSET_MASK = 16'h0004;
//********************************
// Bit masks for RSTCTL register
localparam AV_XR_RSTCTL_TX_RST_OVR_OFST = 0;
localparam AV_XR_RSTCTL_TX_DIGITAL_RST_N_VAL_OFST = 1;
localparam AV_XR_RSTCTL_RX_RST_OVR_OFST = 2;
localparam AV_XR_RSTCTL_RX_DIGITAL_RST_N_VAL_OFST = 3;
localparam AV_XR_RSTCTL_RX_ANALOG_RST_N_VAL_OFST = 4;
localparam AV_XR_RSTCTL_UNUSED_OFST = 5;
localparam AV_XR_RSTCTL_TX_RST_OVR_LEN = 1;
localparam AV_XR_RSTCTL_TX_DIGITAL_RST_N_VAL_LEN = 1;
localparam AV_XR_RSTCTL_RX_RST_OVR_LEN = 1;
localparam AV_XR_RSTCTL_RX_DIGITAL_RST_N_VAL_LEN = 1;
localparam AV_XR_RSTCTL_RX_ANALOG_RST_N_VAL_LEN = 1;
localparam AV_XR_RSTCTL_UNUSED_LEN = 11;
localparam AV_XR_RSTCTL_TX_RST_OVR_MASK = 16'h0001;
localparam AV_XR_RSTCTL_TX_DIGITAL_RST_N_MASK = 16'h0002;
localparam AV_XR_RSTCTL_RX_RST_OVR_MASK = 16'h0004;
localparam AV_XR_RSTCTL_RX_DIGITAL_RST_N_MASK = 16'h0008;
localparam AV_XR_RSTCTL_RX_ANALOG_RST_N_MASK = 16'h0010;
//********************** End local channel registers *************************
//****************************************************************************
endpackage

View file

@ -0,0 +1,60 @@
# (C) 2001-2018 Intel Corporation. All rights reserved.
# Your use of Intel Corporation's design tools, logic functions and other
# software and tools, and its AMPP partner logic functions, and any output
# files from any of the foregoing (including device programming or simulation
# files), and any associated documentation or information are expressly subject
# to the terms and conditions of the Intel Program License Subscription
# Agreement, Intel FPGA IP License Agreement, or other applicable
# license agreement, including, without limitation, that your use is for the
# sole purpose of programming logic devices manufactured by Intel and sold by
# Intel or its authorized distributors. Please refer to the applicable
# agreement for further details.
# SDC file for alt_xcvr_reconfig
# You will need to adjust the constraints based on your design
#**************************************************************
# Create Clock
# -enable and edit these two constraints to fit your design
#**************************************************************
# Note - the source for the mgmt_clk_clk should be set to whatever parent port drives the alt_xcvr_reconfig's mgmt_clk_clk port
#create_clock -period 10ns -name {mgmt_clk_clk} [get_ports {mgmt_clk_clk}]
# Note that the source clock should be the mgmt_clk_clk, or whichever parent clock is driving it
#create_generated_clock -name sv_reconfig_pma_testbus_clk -source [get_ports {mgmt_clk_clk}] -divide_by 1 [get_registers *sv_xcvr_reconfig_basic:s5|*alt_xcvr_arbiter:pif*|*grant*]
# The following constraint is a TCL loop used to generate clocks for the basic block in
# the reconfiguration controller. However, if the constraints are already in place
# then comment out this loop, as timequest will report warnings for overwriting
# clocks. An alternative is to use the commented constraint above. It needs to be
# modified to fit the design.
#
# Procedure:
# First, Report a collection of clocks to reg_init[0], which is the reconfig clk.
# Next, for each item in the collection, we report the upper hierarchy up to reg_init[0],
# and concatenate pif[0]*|*grant* to create the destination. We use the value of
# count to create unique names of the clock instince. Then increment count.
set count 0
# If the generated clocks for the pmatestbus (grant[0]) already exist, then do not regenerate them.
if { [get_collection_size [get_clocks -nowarn sv_reconfig_pma_testbus_clk_?]] eq 0 } {
set grant_clk [get_pins -compatibility_mode -no_duplicates *\|basic\|a5\|reg_init\[0\]\|clk]
foreach_in_collection reconfig_clk $grant_clk {
set reconfig_clk [get_object_info -name $reconfig_clk]
if [regexp {^(.*.)(?=reg_init)} $reconfig_clk grant_clk] {
create_generated_clock -add -name sv_reconfig_pma_testbus_clk_$count -source [get_pins -compatibility_mode -no_duplicates $reconfig_clk] -divide_by 1 [get_registers $grant_clk*pif[0]*\|*grant*]
set_clock_groups -exclusive -group [get_clocks sv_reconfig_pma_testbus_clk_$count]
incr count
}
}
}
#**************************************************************
# False paths
#**************************************************************
# testbus not an actual clock - set asynchronous to all other clocks
# Comment this back in if you are using the commented constraints above
# for creating generated clocks.
#set_clock_groups -exclusive -group [get_clocks {sv_reconfig_pma_testbus_clk}]

View file

@ -0,0 +1,273 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
//
// Transceiver reconfig 'basic' block for Stratix V & derivatives
//
// $Header$
//
`timescale 1 ns / 1 ns
import altera_xcvr_functions::*;
// -The PMA testbus ends up clocking some registers that are being used for edge detection circuitry,
// -Note that the frequency assignment is somewhat arbitrary (matching nominal reconfig_clk frequency), since the testbus is effectively asyncrhonous.
module av_xcvr_reconfig_basic #(
parameter basic_ifs = 1, // post-merge, allow multiple basic interfaces
parameter native_ifs = 1, // number of native reconfig interfaces
parameter physical_channel_mapping = ""
) (
// avalon clock interface
input wire reconfig_clk,
input wire reset,
input wire lif_is_active,
// avalon MM, "basic" interface
input wire [basic_ifs -1:0] basic_reconfig_write,
input wire [basic_ifs -1:0] basic_reconfig_read,
input wire [basic_ifs*32-1:0] basic_reconfig_writedata,
input wire [basic_ifs*3 -1:0] basic_reconfig_address, // address to MM described below
output reg [basic_ifs*32-1:0] basic_reconfig_readdata,
output wire [basic_ifs -1:0] basic_reconfig_waitrequest,
//output reg [basic_ifs-1:0] basic_reconfig_irq, // interrupt to Master
// native testbus interfaces: to logical interface:
// We only expose timing-critical signals here. Other signals accessible through the register interface
output wire [basic_ifs*8 -1:0] lch_testbus, // testbus from native reconfig, for selected channel
output wire [basic_ifs*24 -1:0] pch_testbus, // full triplet testbus
output wire atbout, // voltage comparator output from native reconfig, for selected channel
// gate soft-IPs from running by holding off logical mutex until interface select is done
output wire ifsel_notdone,
// bundled reconfig buses
//input wire reconfig_busy, // input from reconfig master blocks, to forward through the bundles
input wire oc_cal_busy,
input wire tx_cal_busy,
input wire rx_cal_busy,
output wire [native_ifs*W_S5_RECONFIG_BUNDLE_TO_XCVR -1:0] reconfig_to_xcvr, // all inputs from reconfig block to native xcvr reconfig ports
input wire [native_ifs*W_S5_RECONFIG_BUNDLE_FROM_XCVR-1:0] reconfig_from_xcvr // all input s from native xcvr reconfig ports to reconfig block
);
////////////////////////////////////////////////////////
// reconfiguration and testbus ports, in unbundled form
////////////////////////////////////////////////////////
localparam w_paddr = 12; // width of physical avalon reconfig address
// native testbus interfaces: to physical interfaces:
wire [native_ifs*12 -1:0] pif_testbus_sel; // 4 bits per physical channel
(* ALTERA_ATTRIBUTE = {"POWER_UP_LEVEL=HIGH"} *)
reg pif_interface_sel; // Shared for all interfaces
(* ALTERA_ATTRIBUTE = {"POWER_UP_LEVEL=HIGH"} *)
reg pif_ser_shift_load; // Shared for all interfaces
// native testbus signals: from physical interfaces
wire [native_ifs*3*8-1:0] pif_testbus; // testbus from native reconfig, for all physical interfaces
// avalon MM native reconfiguration interfaces
wire [native_ifs*16 -1:0] native_reconfig_readdata; // Avalon DPRIO readdata
wire [native_ifs*16 -1:0] native_reconfig_writedata;// Avalon DPRIO writedata
wire [native_ifs*w_paddr-1:0] native_reconfig_address; // Avalon DPRIO address
wire [native_ifs -1:0] native_reconfig_write; // Avalon DPRIO write
wire [native_ifs -1:0] native_reconfig_read; // Avalon DPRIO read
////////////////////////////////////////////////////////
// OR'ing logic to combine I/O from multiple logical ifs
////////////////////////////////////////////////////////
// outputs of the logical interface blocks, to drive native interfaces
wire [native_ifs*16 -1:0] native_wdata [basic_ifs-1:0];
wire [native_ifs*w_paddr-1:0] native_addr [basic_ifs-1:0];
wire [native_ifs -1:0] native_write [basic_ifs-1:0];
wire [native_ifs -1:0] native_read [basic_ifs-1:0];
wire [native_ifs*12 -1:0] tb_sel [basic_ifs-1:0];
// readdata return from native interfaces
wire [native_ifs*16-1:0] native_rdata;
// wires for OR gates that drive native interfaces
wire [native_ifs*16 -1:0] or_wdata [basic_ifs-1:0];
wire [native_ifs*w_paddr-1:0] or_addr [basic_ifs-1:0];
wire [native_ifs -1:0] or_write [basic_ifs-1:0];
wire [native_ifs -1:0] or_read [basic_ifs-1:0];
wire [native_ifs*12 -1:0] or_tb_sel [basic_ifs-1:0];
// physical interface request/grant arbitration wires, grouped for connection to lif block
wire [native_ifs-1:0] lif_grouping_req [basic_ifs-1:0];
wire [native_ifs-1:0] lif_grouping_grant [basic_ifs-1:0];
// physical interface request/grant arbitration wires, grouped for connection to pif arbiter
wire [basic_ifs-1:0] pif_arbiter_req [native_ifs-1:0];
wire [basic_ifs-1:0] pif_arbiter_grant [native_ifs-1:0];
// generate logical interface blocks, and OR-mux the native reconfig outputs
genvar i;
generate
for (i=0; i<basic_ifs; ++i) begin: lif
av_xrbasic_lif #(
.logical_interface(i), // which single logical interface is this?
.native_ifs(native_ifs), // number of native reconfig interfaces
.w_paddr(w_paddr), // width of physical channel address
.physical_channel_mapping(physical_channel_mapping) // string notation to define logical-to-physical channel mapping
) logical_if (
// avalon clock interface
.reconfig_clk(reconfig_clk),
.reset(reset),
.lif_is_active(lif_is_active),
// avalon MM, "basic" interface
.basic_reconfig_write(basic_reconfig_write[i]),
.basic_reconfig_read(basic_reconfig_read[i]),
.basic_reconfig_writedata(basic_reconfig_writedata[32*i +:32]),
.basic_reconfig_address(basic_reconfig_address[3*i +:3]), // address to MM described sv_xrbasic_lif.sv
.basic_reconfig_readdata(basic_reconfig_readdata[32*i +:32]),
.basic_reconfig_waitrequest(basic_reconfig_waitrequest[i]),
//.basic_reconfig_irq(basic_reconfig_irq[i]), // interrupt to Master
// avalon MM native reconfiguration interfaces
.native_reconfig_readdata(native_reconfig_readdata), // Avalon DPRIO readdata, concatenation of readdata from all phys ifs
.native_reconfig_writedata(native_wdata[i]), // Avalon DPRIO writedata
.native_reconfig_address(native_addr[i]), // Avalon DPRIO address
.native_reconfig_write(native_write[i]), // Avalon DPRIO write
.native_reconfig_read(native_read[i]), // Avalon DPRIO read
// testbus outputs (to physical interfaces)
.pif_testbus_sel(tb_sel[i]),
// testbus inputs (from physical interfaces)
.pif_testbus(pif_testbus),
// Logical interface outputs (to basic block clients)
.lch_testbus(lch_testbus[8*i+:8]),
.pch_testbus(pch_testbus[24*i+:24]),
// physical interface arbiter connections
.pif_arb_req(lif_grouping_req[i]),
.pif_arb_grant(lif_grouping_grant[i])
);
// OR-mux for native interface drivers
if (i == 0) begin
assign or_wdata [0] = native_wdata[0];
assign or_addr [0] = native_addr [0];
assign or_write [0] = native_write[0];
assign or_read [0] = native_read [0];
assign or_tb_sel [0] = tb_sel [0];
end else begin
assign or_wdata [i] = native_wdata [i] | or_wdata [i-1];
assign or_addr [i] = native_addr [i] | or_addr [i-1];
assign or_write [i] = native_write [i] | or_write [i-1];
assign or_read [i] = native_read [i] | or_read [i-1];
assign or_tb_sel [i] = tb_sel [i] | or_tb_sel [i-1];
end
end
endgenerate
// connect native reconfig interfaces
assign native_reconfig_write = or_write [basic_ifs-1]; // Avalon DPRIO write
assign native_reconfig_read = or_read [basic_ifs-1]; // Avalon DPRIO read
assign native_reconfig_address = or_addr [basic_ifs-1];
assign native_reconfig_writedata = or_wdata [basic_ifs-1];
assign pif_testbus_sel = or_tb_sel [basic_ifs-1];
// Logic for each physical (native) interface
genvar li;
genvar pi;
generate
for (pi=0; pi<native_ifs; ++pi) begin: pif
alt_xcvr_arbiter #(
// parameters
.width(basic_ifs) // each phys interface needs one req/grant pair per logical interface (a.k.a. basic interface)
) pif_arb (
// ports
.clock(reconfig_clk),
.req(pif_arbiter_req[pi]),
.grant(pif_arbiter_grant[pi])
);
// map wires from lif grouping to the pif grouping needed for this phys interface arbiter
for (li=0; li < basic_ifs; ++li) begin: lif2pif
assign pif_arbiter_req[pi][li] = lif_grouping_req[li][pi];
assign lif_grouping_grant[li][pi] = pif_arbiter_grant[pi][li];
end
end
endgenerate
// -for iTrack 80226 - the core is potentially active 2240ns before the periphery - we must gate the assertion of
// serial shift load for this time
// -worst case, the maximum clock frequency of reconfig_clk is 125MHz (8ns). Therefore, we must wait a maximum of
// 280 clock cycles before asserting the serial shift load.
// -also, serial shift load counter should be gated by reset, as customers may source reconfig_clk from a PLL and would
// need to gate all logic in the reconfig controller until the PLL locks
// UPDATE - increase wait time by 8x due to default SSM clock divisor being increased by 8x
localparam COUNTER_WIDTH = 12;
localparam NUM_SSL_CYCLES = 6;
localparam [COUNTER_WIDTH-1:0] SSL_WAIT_TIME = 12'd2240; // total number of cycles to wait before switching interface_sel
// register to initialize pif_interface_sel and pif_ser_shift_load
(* ALTERA_ATTRIBUTE = {"POWER_UP_LEVEL=LOW"} *)
reg [COUNTER_WIDTH-1:0] reg_init = 0;
(* ALTERA_ATTRIBUTE = {"POWER_UP_LEVEL=LOW"} *)
reg init_done = 0; // only do the serial shift load and ifsel once
assign ifsel_notdone = (reg_init < SSL_WAIT_TIME);
// -IC design also recommended that serial shift load be asserted for 4 clock cycles of the avalon clock (reconfig_clk)
always @ (posedge reconfig_clk) begin
init_done <= init_done;
reg_init <= reg_init;
pif_interface_sel <= ifsel_notdone; // active low - toggle from '1' to '0' on the last clock cycle
pif_ser_shift_load <= ~((reg_init < (SSL_WAIT_TIME - 1)) && (reg_init > (SSL_WAIT_TIME-NUM_SSL_CYCLES))); // negative pulse for 4 cycles from SSL_WAIT_TIME-NUM_SSL_CYCLES to SSL_WAIT_TIME-1
if (reset && ~init_done) begin // only reset the counter if we haven't already completed the init sequence
reg_init <= {COUNTER_WIDTH{1'b0}};
end else begin
if (ifsel_notdone) begin // count to SSL_WAIT_TIME cycles (280 + 4 cycles for serial shift load assertion, and 1 cycle for interface_sel)
reg_init <= reg_init + 1'b1;
end else begin // ifsel is done - assert init_done
init_done <= 1'b1;
end
end
end
// un/bundle reconfig signals
av_reconfig_bundle_to_basic #(
.native_ifs(native_ifs)
) bundle (
.reconfig_to_xcvr(reconfig_to_xcvr),
.reconfig_from_xcvr(reconfig_from_xcvr),
.native_reconfig_readdata(native_reconfig_readdata),
.pif_testbus(pif_testbus),
.pif_atbout(atbout),
.native_reconfig_clk({native_ifs{reconfig_clk}}),
.native_reconfig_reset({native_ifs{reset}}),
.native_reconfig_writedata(native_reconfig_writedata),
.native_reconfig_address(native_reconfig_address),
.native_reconfig_write(native_reconfig_write),
.native_reconfig_read(native_reconfig_read),
.pif_testbus_sel(pif_testbus_sel),
.pif_interface_sel({native_ifs{pif_interface_sel}}),
.pif_ser_shift_load({native_ifs{pif_ser_shift_load}}),
.oc_cal_busy(oc_cal_busy),
.tx_cal_busy(tx_cal_busy),
.rx_cal_busy(rx_cal_busy)
);
endmodule

View file

@ -0,0 +1,321 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
`timescale 1 ps / 1 ps
module av_xcvr_reconfig_mif
#(
parameter MIF_ADDR_WIDTH = 8,
parameter MIF_DATA_WIDTH = 16,
parameter enable_mif = 1
)
(
input wire reconfig_clk,
input wire reset,
////////////////////////////////
// User Avalon Slave interface
// User input MM slave
input wire [2:0] mif_reconfig_address,
input wire [31:0] mif_reconfig_writedata,
input wire mif_reconfig_write,
input wire mif_reconfig_read,
// User output MM slave
output wire [31:0] mif_reconfig_readdata,
output wire mif_reconfig_waitrequest,
output wire mif_reconfig_done,
///////////////////////////////
// PLL reconfiguration interface
// input from PLL reconfig
input wire mif_pll_busy,
input wire mif_pll_err,
// output from PLL reconfig
output wire mif_pll_go,
output wire mif_pll_type,
output wire [9:0] mif_pll_lch,
output wire [3:0] mif_pll_data,
//////////////////////////////////
// Avalon Master streaming interface
// output to MIF entity (ROM)
output wire [31:0] mif_stream_address,
output wire mif_stream_read,
// input from MIF entity (ROM)
input wire mif_stream_waitrequest,
input wire [15:0] mif_stream_readdata,
//////////////////////////////////
// Basic block interface
// output to base_reconfig
output wire [2:0] mif_base_address,
output wire [31:0] mif_base_writedata,
output wire mif_base_write,
output wire mif_base_read,
// input from base reconfig
input wire [31:0] mif_base_readdata,
input wire mif_base_waitrequest,
input wire mif_base_irq,
//////////////////////////////////
// Arbiter interface
output wire arb_req,
input wire arb_grant
);
//internal wires
wire [31:0] uif_writedata;
wire [31:0] uif_readdata;
wire [11:0] uif_addr_offset;
wire [9:0] uif_logical_ch_addr;
wire [2:0] uif_mode;
wire [1:0] uif_mif_mode;
wire uif_go;
wire uif_busy;
wire uif_error;
wire uif_illegal_pch_error;
wire uif_illegal_offset_error;
wire [31:0] ctrl_phreaddata;
wire [31:0] ctrl_writedata;
wire [31:0] ctrl_readdata;
wire [11:0] ctrl_addr_offset;
wire ctrl_illegal_phy_ch;
wire ctrl_waitrequest;
wire ctrl_go;
wire [2:0] ctrl_opcode;
wire ctrl_lock;
wire [31:0] mif_base_addr;
wire ctrl_av_go;
wire ctrl_op_done;
wire av_addr_burst;
wire [9:0] ctrl_lch;
wire [10:0] av_mif_addr;
wire [15:0] av_mif_data;
wire av_ctrl_req;
wire av_done;
wire av_opcode_err;
wire ctrl_op_err;
wire av_mif_type_err;
wire [1:0] av_mif_type;
wire av_mif_type_valid;
wire mif_addr_mode;
wire av_pll_err;
wire uif_chan_err;
wire uif_addr_err;
// MIF User interface
alt_xreconf_uif
#(
.RECONFIG_USER_ADDR_WIDTH(3),
.RECONFIG_USER_DATA_WIDTH(32),
.RECONFIG_USER_ENABLE_CTRL(1),
.RECONFIG_USER_OFFSET_WIDTH(12)
)
inst_xreconf_uif (
.reconfig_clk(reconfig_clk),
.reset(reset),
.user_reconfig_address(mif_reconfig_address),
.user_reconfig_writedata(mif_reconfig_writedata),
.user_reconfig_write(mif_reconfig_write),
.user_reconfig_read(mif_reconfig_read),
.user_reconfig_readdata(mif_reconfig_readdata),
.user_reconfig_waitrequest(mif_reconfig_waitrequest),
.user_reconfig_done(mif_reconfig_done),
// to /from data control logic
.uif_writedata(uif_writedata), // to data control logic
.uif_addr_offset(uif_addr_offset), // to data control logic/rmw block
.uif_mode(uif_mode), // to data control logic
.uif_ctrl(uif_mif_mode),
.uif_logical_ch_addr(uif_logical_ch_addr), // to data
.uif_go(uif_go), // to data control logic
.uif_readdata(uif_readdata),// from data control logic
.uif_phreaddata(ctrl_phreaddata),// from cif logic
.uif_illegal_pch_error(uif_chan_err), // from data control logic
.uif_illegal_offset_error(uif_addr_err), // from data control logic
.uif_busy(uif_busy) // from data control logic
);
// MIF control unit
av_xcvr_reconfig_mif_ctrl #(
.UIF_ADDR_WIDTH (12),
.UIF_DATA_WIDTH (32),
.CTRL_ADDR_WIDTH (12),
.CTRL_DATA_WIDTH (32),
.MIF_ADDR_WIDTH (32),
.MIF_DATA_WIDTH (16)
)
inst_mif_ctrl (
.clk (reconfig_clk),
.reset (reset),
// user interface
.uif_go (uif_go), // start user cycle
.uif_mode (uif_mode), // 0=read; 1=write;
.uif_mif_mode (uif_mif_mode),
.uif_busy (uif_busy), // transfer in process
.uif_addr (uif_addr_offset), // address offset
.uif_wdata (uif_writedata), // data in
.uif_rdata (uif_readdata), // data out
.ctrl_chan_err (ctrl_illegal_phy_ch),
.uif_chan_err (uif_chan_err), // illegal channel
.uif_addr_err (uif_addr_err), // illegal address
.uif_logical_ch_addr (uif_logical_ch_addr),
// Avalon Master interface
.mif_base_addr (mif_base_addr),
.ctrl_av_go (ctrl_av_go),
.ctrl_op_done (ctrl_op_done),
.ctrl_op_err (ctrl_op_err),
.ctrl_lch (ctrl_lch),
.mif_addr_mode (mif_addr_mode),
.av_mif_addr (av_mif_addr),
.av_mif_data (av_mif_data),
.av_ctrl_req (av_ctrl_req),
.av_addr_burst (av_addr_burst),
.av_done (av_done),
.av_opcode_err (av_opcode_err),
.av_mif_type_err (av_mif_type_err),
.av_mif_type (av_mif_type),
.av_mif_type_valid (av_mif_type_valid),
.av_pll_err (av_pll_err),
// basic block interface
.ctrl_go (ctrl_go), // start basic block cycle
.ctrl_opcode (ctrl_opcode), // 0=read; 1=write;
.ctrl_lock (ctrl_lock), // multicycle lock
.ctrl_wait (ctrl_waitrequest), // transfer in process
.ctrl_addr (ctrl_addr_offset), // address
.ctrl_rdata (ctrl_readdata[31:0]), // data in
.ctrl_wdata (ctrl_writedata[31:0]) // data out
);
generate if(enable_mif ==1) begin
//Only generate the AVMM interface if User specifies MIF streaming
av_xcvr_reconfig_mif_avmm #(
.MIF_ADDR_LEN (11),
.MIF_ADDR_WIDTH (32),
.MIF_DATA_WIDTH (16)
)
inst_mif_avmm (
.clk (reconfig_clk),
.reset (reset),
//PLL reconfig interface
.pll_busy (mif_pll_busy),
.pll_err (mif_pll_err),
.pll_go (mif_pll_go),
.pll_type (mif_pll_type),
.pll_lch (mif_pll_lch[9:0]),
.pll_data (mif_pll_data[3:0]),
// Avalon Master streaming interface
.stream_address (mif_stream_address),
.stream_read (mif_stream_read),
.stream_waitrequest (mif_stream_waitrequest),
.stream_readdata (mif_stream_readdata),
// MIF control interface
.mif_base_addr (mif_base_addr),
.ctrl_av_go (ctrl_av_go),
.ctrl_op_done (ctrl_op_done),
.ctrl_op_err (ctrl_op_err),
.ctrl_lch (ctrl_lch),
.mif_addr_mode (mif_addr_mode),
.av_mif_addr (av_mif_addr),
.av_mif_data (av_mif_data),
.av_ctrl_req (av_ctrl_req),
.av_addr_burst (av_addr_burst),
.av_opcode_err (av_opcode_err),
.av_mif_type_err (av_mif_type_err),
.av_mif_type (av_mif_type),
.av_mif_type_valid (av_mif_type_valid),
.av_pll_err (av_pll_err),
.av_done (av_done)
);
end
else begin
assign mif_pll_go = 1'd0;
assign mif_pll_type = 1'd0;
assign mif_pll_lch = 10'd0;
assign mif_pll_data = 4'd0;
assign mif_stream_address = 32'd0;
assign mif_stream_read = 1'd0;
assign av_mif_addr = 11'd0;
assign av_mif_data = 16'd0;
assign av_ctrl_req = 1'd0;
assign av_pll_err = 1'b0;
assign av_opcode_err = 1'd0;
assign av_mif_type_err = 1'b0;
assign av_mif_type = 2'd0;
assign av_mif_type_valid = 1'b0;
assign av_done = 1'b1;
assign av_addr_burst = 1'b0;
end
endgenerate
// Basic Block interface
alt_xreconf_cif #(
.CIF_RECONFIG_ADDR_WIDTH (3),
.CIF_RECONFIG_DATA_WIDTH (32),
.CIF_OFFSET_ADDR_WIDTH (12),
.CIF_MASTER_ADDR_WIDTH (3),
.CIF_RECONFIG_OFFSET_WIDTH (5) //unused parameter
)
inst_xreconf_cif (
.reconfig_clk (reconfig_clk),
.reset (reset),
// data control signals
.ctrl_go (ctrl_go),
.ctrl_opcode (ctrl_opcode),
.ctrl_lock (ctrl_lock),
.ctrl_addr_offset (ctrl_addr_offset),
.ctrl_writedata (ctrl_writedata),
.uif_logical_ch_addr (uif_logical_ch_addr),
.ctrl_readdata (ctrl_readdata),
.ctrl_phreaddata (ctrl_phreaddata),
.ctrl_illegal_phy_ch (ctrl_illegal_phy_ch),
.ctrl_waitrequest (ctrl_waitrequest),
// basic block ports
.reconfig_address_base (mif_base_address),
.reconfig_writedata_base (mif_base_writedata),
.reconfig_write_base (mif_base_write),
.reconfig_read_base (mif_base_read),
.reconfig_readdata_base (mif_base_readdata),
.reconfig_irq_from_base (mif_base_irq),
.reconfig_waitrequest_from_base (mif_base_waitrequest),
.arb_grant (arb_grant),
.arb_req (arb_req)
);
endmodule

View file

@ -0,0 +1,432 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
// MIF Avalon master IF State machine
//
//
// It receives a start indication from the MIF control block
// and will request Basic block access from control or PLL reconfig access
// $Header$
`timescale 1 ns / 1 ps
module av_xcvr_reconfig_mif_avmm #(
parameter MIF_ADDR_WIDTH = 32,
parameter MIF_ADDR_LEN = 11,
parameter MIF_DATA_WIDTH = 16
)
(
input wire clk,
input wire reset,
// PLL reconfig interface
input wire pll_busy,
input wire pll_err,
// output from PLL reconfig
output reg pll_go,
output reg pll_type,
output wire [9:0] pll_lch,
output wire [3:0] pll_data,
// Avalon Master streaming interface
// output to MIF entity (ROM)
output reg [MIF_ADDR_WIDTH - 1:0] stream_address,
output reg stream_read,
// input from MIF entity (ROM)
input wire stream_waitrequest,
input wire [MIF_DATA_WIDTH - 1:0] stream_readdata,
// MIF control interface
input wire [MIF_ADDR_WIDTH -1:0] mif_base_addr,
input wire mif_addr_mode,
input wire ctrl_av_go,
input wire ctrl_op_done,
input wire ctrl_op_err,
input wire [9:0] ctrl_lch,
output reg [MIF_ADDR_LEN-1:0] av_mif_addr,
output wire [MIF_DATA_WIDTH-1:0] av_mif_data,
output reg av_ctrl_req,
output reg av_addr_burst,
output reg av_opcode_err,
output reg av_mif_type_valid,
output reg [1:0] av_mif_type,
output wire av_mif_type_err,
output reg av_pll_err,
output reg av_done
);
// Avalon Mst IF
localparam [2:0] AV_IDLE = 3'h0;
localparam [2:0] AV_RD_HDR = 3'h1;
localparam [2:0] AV_DEC_HDR = 3'h2;
localparam [2:0] AV_RD_DATA = 3'h3;
localparam [2:0] AV_WF_DONE = 3'h4;
localparam [2:0] AV_REC_ERR = 3'h5;
// MIF Opcodes
localparam [4:0] OP_SOM = 5'h1;
localparam [4:0] OP_TYPE = 5'h2;
localparam [4:0] OP_EOM = 5'h1f;
localparam [4:0] OP_RC = 5'h3;
localparam [4:0] OP_CGB = 5'h4;
// MIF File types
localparam [1:0] DUPLEX = 2'd0;
localparam [1:0] TXPLL = 2'd1;
localparam [1:0] RX_CHN = 2'd2;
localparam [1:0] TX_CHN = 2'd3;
// register addresses
import alt_xcvr_reconfig_h::*;
import av_xcvr_h::*;
// state machine declarations
reg [2:0] av_next_state;
reg [2:0] av_state;
//local storage for MIF content
reg [4:0] mif_rec_len; // MIF length field
reg [MIF_ADDR_LEN-1:0] mif_rec_addr; // MIF address field
reg [15:0] mif_rec_data; // MIF data field
reg [3:0] mif_op_data; // MIF opode data field
reg [4:0] mif_len_cnt;
reg [MIF_ADDR_WIDTH-1:0] mif_next_offset;
reg pll_active;
reg pll_active_dly;
reg first_mif_entry;
reg mif_strm_active;
wire rec_is_opcode; // Current record is Opcode
wire rec_is_som; // Start of MIF record
wire rec_is_eom; // End of MIF record
wire rec_is_cgb; // CGB MIF record
wire rec_is_rc; // RefClk MIF record
wire rec_is_type;
wire invalid_rec;
wire rd_data_valid;
wire set_av_ctrl_req;
wire clr_av_ctrl_req;
wire som_not_first_err;
wire [1:0] mif_addr_incr;
////////////////////////////
// Avalon master state machine
////////////////////////////
// next state logic
always @ (*) begin
case(av_state)
AV_IDLE: begin
if(ctrl_av_go)
av_next_state = AV_RD_HDR;
else
av_next_state = AV_IDLE;
end
//read a new MIF header
AV_RD_HDR: begin
//wait for slave to transfer data
if(rd_data_valid)
av_next_state = AV_DEC_HDR;
else
av_next_state = AV_RD_HDR;
end
//decode the record to determine if it is an opcode or just data record
AV_DEC_HDR: begin
if(rec_is_eom)
av_next_state = AV_IDLE;
//valid start of MIF go to WF state then read the next record
else if(rec_is_som)
av_next_state = AV_RD_HDR;
//this is a PLL reconfig opcode
else if(rec_is_rc || rec_is_cgb)
av_next_state = AV_WF_DONE;
//unknown record. end streaming
else if(invalid_rec)
av_next_state = AV_REC_ERR;
//no special op, read first data word
else if(mif_rec_len > 5'd0)
av_next_state = AV_RD_DATA;
else
av_next_state = AV_RD_HDR;
end
// for data records, read a data word and invoke the Basic control interface
AV_RD_DATA: begin
// if we've read the last data entry, get the next header
if(mif_len_cnt == 5'd0)
av_next_state = AV_RD_HDR;
//keep reading data until record is complete
else if(rd_data_valid)
av_next_state = AV_WF_DONE;
else
av_next_state = AV_RD_DATA;
end
//invalid record type detected
AV_REC_ERR: av_next_state = AV_IDLE;
//invoke PLL reconfig or basic control SM, and wait for completion of operation
AV_WF_DONE: begin
//wait for PLL reconfig block to complete, then get next record header
if((!pll_busy || pll_err) && pll_active_dly)
av_next_state = AV_RD_HDR;
else if(ctrl_op_err)
av_next_state = AV_REC_ERR;
//wait for control interface to finish basic access
else if(ctrl_op_done)
av_next_state = AV_RD_DATA;
else
av_next_state = AV_WF_DONE;
end
default: av_next_state = AV_IDLE;
endcase
end
// state register
always @(posedge clk or posedge reset)
begin
if (reset) begin
av_state <= AV_IDLE;
end
else begin
av_state <= av_next_state;
end
end
// Avalon output and internal storage
always @(posedge clk or posedge reset)
begin
if (reset) begin
stream_read <= 1'b0;
stream_address <= {MIF_ADDR_WIDTH{1'b0}};
mif_rec_len <= {5{1'b0}}; // MIF length field
mif_rec_addr <= {MIF_ADDR_LEN{1'b0}}; // MIF address field
mif_rec_data <= {16{1'b0}}; // MIF data field
mif_next_offset <= {MIF_ADDR_WIDTH{1'b0}};
pll_active <= 1'b0;
pll_type <= 1'b0;
mif_strm_active <= 1'b0;
av_addr_burst <= 1'b0;
pll_go <= 1'b0;
end
else begin
//Avalon outputs
stream_read <= (av_next_state == AV_RD_HDR) | (av_next_state == AV_RD_DATA);
stream_address <= (av_next_state == AV_RD_HDR) |
(av_next_state == AV_DEC_HDR)|
(av_next_state == AV_RD_DATA) ? (mif_base_addr + mif_next_offset)
: {MIF_ADDR_WIDTH{1'b0}};
//capture Record next record length and address
mif_rec_len <= (av_state == AV_RD_HDR) & rd_data_valid ? stream_readdata[15:11] : mif_rec_len;
mif_rec_addr <= (av_state == AV_RD_HDR) & rd_data_valid ? stream_readdata[10:0] : mif_rec_addr;
//capture record DPRIO data information
mif_rec_data <= (av_state == AV_RD_DATA) & rd_data_valid ? stream_readdata[15:0] : mif_rec_data;
//track where we are in the current MIF. Look for end of MIF record
mif_next_offset <= ((av_state == AV_RD_HDR) & (av_next_state != AV_RD_HDR)) |
((av_next_state == AV_WF_DONE) & (av_state == AV_RD_DATA)) ? mif_next_offset + mif_addr_incr : //go to next MIF offset
(av_next_state == AV_IDLE) ? {MIF_ADDR_WIDTH{1'b0}} : //MIF stream is complete
mif_next_offset;
pll_active <= ((av_state == AV_DEC_HDR) & (av_next_state == AV_WF_DONE)) && (rec_is_cgb || rec_is_rc) ? 1'b1 :
(av_state == AV_WF_DONE) & (av_next_state == AV_RD_HDR) ? 1'b0:
pll_active;
pll_go <= ((av_state == AV_DEC_HDR) & (av_next_state == AV_WF_DONE)); // this arc taken for PLL reconfig
pll_type <= rec_is_cgb ? 1'b1 : 1'b0;
//set a flag to indicate that a MIF is being processed for invalid_rec qual
mif_strm_active <= (av_next_state == AV_DEC_HDR) ? 1'b1 :
(av_next_state == AV_IDLE) ? 1'b0 : mif_strm_active;
//allow Basic interface to hold lock and be more efficient if we have a multi-length record
av_addr_burst <= (mif_len_cnt > 5'd1);
end
end
//select between word/byte addressing
assign mif_addr_incr = mif_addr_mode ? 2'd1 : 2'd2; //default to byte addressing
//Pass the Logical channel info to the PLL reconfig IP
assign pll_lch = ctrl_lch;
assign pll_data = mif_rec_addr[8:5];
//pass MIF data to basic control interface
assign av_mif_data = mif_rec_data;
//Current record length tracker
always @(posedge clk or posedge reset)
begin
if (reset) begin
mif_len_cnt <= 5'd0;
end
else begin
//Reading a new header from the MIF, load the record length counter
if((av_state == AV_DEC_HDR) && (av_next_state == AV_RD_DATA)) begin
mif_len_cnt <= mif_rec_len;
end
//decrement the count for every data entry we read. We are finished when mif_len_cnt = 0
else if(((av_state == AV_RD_DATA) & (av_next_state == AV_WF_DONE)) && (mif_len_cnt > 5'd0)) begin
mif_len_cnt <= mif_len_cnt - 1'd1;
end
end
end
//DPRIO address counter
always @(posedge clk or posedge reset)
begin
if (reset) begin
av_mif_addr <= 11'd0;
end
else begin
//Reading a new header from the MIF, load the record length counter
if((av_state == AV_DEC_HDR) && (av_next_state == AV_RD_DATA)) begin
av_mif_addr <= mif_rec_addr;
end
else if((av_state == AV_RD_DATA) && (av_next_state == AV_WF_DONE) && (mif_rec_len != mif_len_cnt)) begin
av_mif_addr <= av_mif_addr + 1'd1;
end
end
end
//decode MIF file information
assign rec_is_opcode = (mif_rec_len == 5'd0); // & mif_rec_valid ???)
assign rec_is_som = rec_is_opcode & (mif_rec_addr[4:0] == OP_SOM) & (av_state != AV_IDLE); // start of MIF record
assign rec_is_eom = rec_is_opcode & (mif_rec_addr[4:0] == OP_EOM) & (av_state != AV_IDLE); // End of MIF record
assign rec_is_cgb = rec_is_opcode & (mif_rec_addr[4:0] == OP_CGB) & (av_state != AV_IDLE); // CGB MIF record
assign rec_is_rc = rec_is_opcode & (mif_rec_addr[4:0] == OP_RC) & (av_state != AV_IDLE); // RefClk MIF record
assign rec_is_type = rec_is_opcode & (mif_rec_addr[4:0] == OP_TYPE) & (av_state != AV_IDLE); // MIF Type record
assign invalid_rec = rec_is_opcode & ~(rec_is_som | rec_is_eom | rec_is_cgb | rec_is_rc | rec_is_type) & mif_strm_active;
assign rd_data_valid = ~(stream_waitrequest) & stream_read;
//assign av_done = (av_next_state == AV_IDLE) && (av_state != AV_IDLE); //Avalon access complete
always @(posedge clk or posedge reset)
begin
if (reset)
av_done <= 1'd0;
else begin
av_done <= (av_next_state == AV_IDLE) && (av_state != AV_IDLE); //Avalon access complete;
end
end
//Check for SOM as first record, flag opcode error if not in first record
always @(posedge clk or posedge reset)
begin
if (reset)
first_mif_entry <= 1'd0;
else begin
//delay one cycle to allow rec_is_som decode
if((stream_address == mif_base_addr) && rd_data_valid)
first_mif_entry <= 1'b1;
else
first_mif_entry <= 1'd0;
end
end
assign som_not_first_err = first_mif_entry & ~(rec_is_som);
//Flag error for invalid opcode
always @(posedge clk or posedge reset)
begin
if (reset)
av_opcode_err <= 1'd0;
else begin
//first MIF entry is not SOM
if(som_not_first_err)
av_opcode_err <= 1'b1;
//Opcode is decoded, but is not valid
else if(rec_is_opcode && invalid_rec)
av_opcode_err <= 1'b1;
else
av_opcode_err <= 1'b0;
end
end
//The MIF Type is only 2-bits for now, so all encodings are invalid
assign av_mif_type_err = 1'b0;
//Pass MIF Type to MIF control to check against target local channel
always @(posedge clk or posedge reset)
begin
if (reset) begin
av_mif_type <= 2'd0;
av_mif_type_valid <= 1'd0;
end
else begin
if(rec_is_type) begin
av_mif_type <= mif_rec_addr[6:5];
av_mif_type_valid <= 1'b1;
end
else begin
av_mif_type <= 2'd0;
av_mif_type_valid <= 1'b0;
end
end
end
//generate a strobe when an error is detected during MIF streaming
always @(posedge clk or posedge reset)
begin
if (reset)
av_pll_err <= 1'd0;
else begin
if(pll_err && (av_state != AV_IDLE))
av_pll_err <= 1'b1;
else
av_pll_err <= 1'b0;
end
end
//create a request flag to the Basic control SM
assign set_av_ctrl_req = (av_state == AV_RD_DATA) && (av_next_state == AV_WF_DONE);
assign clr_av_ctrl_req = ctrl_op_done;
always @(posedge clk or posedge reset)
begin
if (reset)
av_ctrl_req <= 1'd0;
else begin
if(set_av_ctrl_req)
av_ctrl_req <= 1'b1;
else if(clr_av_ctrl_req)
av_ctrl_req <= 1'b0;
end
end
////////////////////////////
// PLL reconfig interface
////////////////////////////
// delay one cycle to wait to pll_busy assertion
always @(posedge clk or posedge reset)
begin
if (reset) begin
pll_active_dly <= 1'd0;
end
else begin
pll_active_dly <= pll_active;
end
end
endmodule

View file

@ -0,0 +1,515 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
// MIF streamer control
//
//
// It receives user indirect registers from ALT_XRECONF_UIF and
// it generates write and read cycles to the ALT_XRECONF_BASIC.
// $Header$
`timescale 1 ns / 1 ps
module av_xcvr_reconfig_mif_ctrl #(
parameter UIF_ADDR_WIDTH = 12,
parameter UIF_DATA_WIDTH = 32,
parameter CTRL_ADDR_WIDTH = 12,
parameter MIF_ADDR_LEN = 11,
parameter CTRL_DATA_WIDTH = 16,
parameter MIF_ADDR_WIDTH = 32,
parameter MIF_DATA_WIDTH = 16
)
(
input wire clk,
input wire reset,
// user interface
input wire uif_go, // start user cycle
input wire [2:0] uif_mode, // operation
input wire [1:0] uif_mif_mode, // MIF control mode (00b=Auto-stream, 01b=manual reconfig, 1xb=Raw access)
output reg uif_busy, // transfer in process
input wire [UIF_ADDR_WIDTH -1:0] uif_addr, // address offset
input wire [UIF_DATA_WIDTH -1:0] uif_wdata, // data in
output reg [UIF_DATA_WIDTH -1:0] uif_rdata, // data out
input wire ctrl_chan_err, // ctrl illegal channel
output wire uif_chan_err, // illegal channel
output reg uif_addr_err, // illegal address
input wire [9:0] uif_logical_ch_addr, //logical channel
//MIF Avalon master SM interface
output reg [MIF_ADDR_WIDTH -1:0] mif_base_addr,
output reg mif_addr_mode,
output reg ctrl_av_go,
output wire ctrl_op_done,
output wire ctrl_op_err,
output wire [9:0] ctrl_lch,
input wire [MIF_ADDR_LEN-1:0] av_mif_addr,
input wire [MIF_DATA_WIDTH-1:0] av_mif_data,
input wire av_ctrl_req,
input wire av_addr_burst,
input wire av_opcode_err,
input wire av_mif_type_valid,
input wire [1:0] av_mif_type,
input wire av_mif_type_err,
input wire av_done,
input wire av_pll_err,
// basic block control interface
output reg ctrl_go, // start basic block cycle
output reg [2:0] ctrl_opcode, // 0=read; 1=write;
output reg ctrl_lock, // multicycle lock
input wire ctrl_wait, // transfer in process
output reg [CTRL_ADDR_WIDTH -1:0] ctrl_addr,
input wire [CTRL_DATA_WIDTH -1:0] ctrl_rdata, // data in
output reg [CTRL_DATA_WIDTH -1:0] ctrl_wdata // data out
);
// state assignments
localparam [2:0] CTRL_IDLE = 3'd0;
localparam [2:0] CTRL_MIF_WR = 3'd1;
localparam [2:0] CTRL_WF_B = 3'd2;
localparam [2:0] CTRL_RMW = 3'd3;
localparam [2:0] CTRL_WF_AV = 3'd4;
localparam [2:0] CTRL_MIF_RD = 3'd5;
localparam [2:0] CTRL_CHK_ADDR = 3'd6;
localparam [2:0] CTRL_CHK_CHN = 3'd7;
// user modes
localparam UIF_MODE_RD = 3'h0;
localparam UIF_MODE_WR = 3'h1;
localparam UIF_MODE_PHYS = 3'h2;
localparam MIF_ADDR_OFFSET = 3'd0;
localparam MIF_CTRL_OFFSET = 3'd1;
localparam MIF_ERR_OFFSET = 3'd2;
localparam MIF_STREAM_MODE = 2'b00; //MIF stream mode to read ROM image
localparam MIF_DIRECT_MODE = 2'b01; //MIF direct mode for parital MIF writes
localparam UIF_LDIRECT_MODE = 2'b10; //User Direct access to Basic block using logical address
localparam UIF_PDIRECT_MODE = 2'b11; //User Direct access to Basic block using physical address
// basic control commands
localparam CTRL_OP_RD = 3'h0;
localparam CTRL_OP_WR = 3'h1;
localparam CTRL_RD_PHY_CH = 3'h2;
localparam CTRL_OP_PRD = 3'h5; //Physical addressing read/write
localparam CTRL_OP_PWR = 3'h6;
localparam MIF_TYPE_DUPLEX = 2'd0;
localparam MIF_TYPE_PLL = 2'd1;
localparam MIF_TYPE_RX = 2'd2;
localparam MIF_TYPE_TX = 2'd3;
// register addresses
import alt_xcvr_reconfig_h::*;
import av_xcvr_h::*;
// declarations
reg [2:0] ctrl_next_state;
reg [2:0] ctrl_state;
//internal registers
reg mif_strm_start; // offset 1
reg av_ctrl_req_dly;
reg rmw_offset;
reg uif_ctrl_req;
reg chn_chk_active;
reg [15:0] saved_read_data;
reg [15:0] rmw_mask;
reg [4:0] channel_id; //[4:3] = pll_type, [2] = ATT, [1] = rx_en, [0] = tx_en
reg [4:0] mif_err_reg;
reg mif_clr_error;
reg av_chn_mismatch;
wire [15:0] mif_data_modify;
wire [UIF_DATA_WIDTH -1:0] uif_wdata_modify;
wire av_ctrl_req_re;
wire uif_addr_err_re;
wire uif_addr_err_d;
wire uif_wr;
wire uif_rd;
wire uif_rd_ch;
wire set_uif_ctrl_req;
wire clr_uif_ctrl_req;
wire [CTRL_ADDR_WIDTH-1:0] mux_mif_addr;
wire [15:0] masked_rdata;
wire [15:0] masked_wdata;
wire [15:0] masked_uif_wdata;
//pass logical channel info to Avalog IF for PLL reconfig
assign ctrl_lch = uif_logical_ch_addr;
assign uif_wr = uif_go & (uif_mode == UIF_MODE_WR);
assign uif_rd = uif_go & (uif_mode == UIF_MODE_RD);
assign uif_rd_ch = uif_go & (uif_mode == UIF_MODE_PHYS);
//internal register interface
always @(posedge clk or posedge reset)
begin
if (reset) begin
mif_base_addr <= {MIF_ADDR_WIDTH{1'b0}};
mif_strm_start <= 1'b0;
mif_addr_mode <= 1'b0;
mif_clr_error <= 1'b0;
end
else begin
if(uif_go && (uif_mode == UIF_MODE_WR) && (uif_mif_mode == MIF_STREAM_MODE)) begin
case(uif_addr[2:0])
MIF_ADDR_OFFSET: mif_base_addr <= uif_wdata[MIF_ADDR_WIDTH-1:0];
MIF_CTRL_OFFSET: {mif_clr_error,mif_addr_mode,mif_strm_start} <= uif_wdata[2:0];
endcase
end
else begin
mif_base_addr <= mif_base_addr;
mif_strm_start <= 1'b0; //self clear bit to create a start strobe
mif_addr_mode <= mif_addr_mode;
mif_clr_error <= 1'b0; //self clear
end
end
end
// user read data
always @(posedge clk or posedge reset)
begin
if(reset)
uif_rdata <= {CTRL_DATA_WIDTH{1'b0}};
else begin
if(uif_go && (uif_mode == UIF_MODE_RD) && (uif_mif_mode == MIF_STREAM_MODE)) begin
case(uif_addr[2:0])
MIF_ADDR_OFFSET: uif_rdata <= mif_base_addr[MIF_ADDR_WIDTH-1:0];
MIF_ERR_OFFSET: uif_rdata <= {11'd0,mif_err_reg};
default : uif_rdata <= {CTRL_DATA_WIDTH{1'b0}};
endcase
end
else if((uif_mode == UIF_MODE_RD) && (uif_mif_mode != MIF_STREAM_MODE))
uif_rdata <= ctrl_rdata;
else begin
uif_rdata <= uif_rdata;
end
end
end
//error status registers
always @(posedge clk or posedge reset)
begin
if (reset)
mif_err_reg <= 5'd0;
else begin
if(mif_clr_error)
mif_err_reg <= 5'd0;
else if(uif_addr_err_re) //strobe
mif_err_reg[0] <= 1'b1;
else if(av_opcode_err) //strobe
mif_err_reg[1] <= 1'b1;
else if(av_pll_err) //strobe
mif_err_reg[2] <= 1'b1;
else if(av_mif_type_err)
mif_err_reg[3] <= 1'b1;
else if(av_chn_mismatch) //strobe
mif_err_reg[4] <= 1'b1;
end
end
assign ctrl_op_err = |mif_err_reg;
//create strobe top set error flag
assign uif_addr_err_re = ~(uif_addr_err) & uif_addr_err_d;
assign uif_addr_err_d = (uif_mif_mode == MIF_STREAM_MODE) & (uif_addr > 12'd2);
assign uif_chan_err = ctrl_chan_err;
////////////////////////////////////////////////////////
// Main control state machine.
// Interfaces with Avalon master SM, and Basic interface
/////////////////////////////////////////////////////////
//next state
always @ (*) begin
case(ctrl_state)
CTRL_IDLE: begin
//User initiated a MIF stream operation
if(mif_strm_start && (uif_mif_mode == MIF_STREAM_MODE))
ctrl_next_state = CTRL_CHK_CHN;
// User initiated a direct read
else if(uif_rd && (uif_mif_mode != MIF_STREAM_MODE))
ctrl_next_state = CTRL_MIF_RD;
// User initiated a direct write
else if(uif_wr && (uif_mif_mode != MIF_STREAM_MODE))
ctrl_next_state = CTRL_CHK_ADDR;
else if(uif_rd_ch)
ctrl_next_state = CTRL_MIF_RD;
else
ctrl_next_state = CTRL_IDLE;
end
CTRL_WF_AV: begin
if(av_done)
ctrl_next_state = CTRL_IDLE;
//Check AVMM request address if RMW is needed
else if(av_ctrl_req)
ctrl_next_state = CTRL_CHK_ADDR;
else
ctrl_next_state = CTRL_WF_AV;
end
//Check address to see if RMW is needed
CTRL_CHK_ADDR: begin
//Determine if the MIF address requires RMW
if(rmw_offset)
ctrl_next_state = CTRL_MIF_RD;
//Need to issue read-modify-write for this DPRIO offset
else
ctrl_next_state = CTRL_MIF_WR;
end
//Issue Reconfig write
CTRL_MIF_WR: ctrl_next_state = CTRL_WF_B;
//Wait for B-Block access to finish
CTRL_WF_B: begin
//Basic access finished for either Avalon Wr request or initial Channel ID detection
if(!ctrl_wait && ((av_ctrl_req && !rmw_offset) || chn_chk_active))
ctrl_next_state = CTRL_WF_AV;
//Modify read data using appropriate mask
else if(!ctrl_wait && (av_ctrl_req || uif_ctrl_req) && rmw_offset)
ctrl_next_state = CTRL_RMW;
//Basic access finished for User Wr request
else if (!ctrl_wait && uif_ctrl_req)
ctrl_next_state = CTRL_IDLE;
else
ctrl_next_state = CTRL_WF_B;
end
//Issue Reconfig Read
CTRL_MIF_RD: ctrl_next_state = CTRL_WF_B;
//Check logical channel ID reg
CTRL_CHK_CHN: ctrl_next_state = CTRL_WF_B;
//One cycle to modify data
CTRL_RMW: ctrl_next_state = CTRL_MIF_WR;
default: ctrl_next_state = CTRL_IDLE;
endcase
end
// present state
always @(posedge clk or posedge reset)
begin
if (reset)
ctrl_state <= CTRL_IDLE;
else
ctrl_state <= ctrl_next_state;
end
// control outputs
always @(posedge clk or posedge reset)
begin
if (reset)
begin
uif_busy <= 1'b0;
ctrl_go <= 1'b0;
ctrl_lock <= 1'b0;
ctrl_opcode <= 3'd0;
uif_addr_err <= 1'b0;
ctrl_av_go <= 1'b0;
chn_chk_active <= 1'b0;
end
else begin
uif_busy <= (ctrl_state != CTRL_IDLE);
ctrl_go <= (ctrl_next_state == CTRL_MIF_WR) | (ctrl_next_state == CTRL_MIF_RD) | (ctrl_next_state == CTRL_CHK_CHN);
ctrl_lock <= (rmw_offset | av_addr_burst) ? 1'b1 :1'b0; //only needed for RMW operations
ctrl_av_go <= (ctrl_state == CTRL_WF_B) && (ctrl_next_state == CTRL_WF_AV) && chn_chk_active;
ctrl_opcode <= (uif_mif_mode == UIF_PDIRECT_MODE) & (ctrl_next_state == CTRL_MIF_WR) ? CTRL_OP_PWR :
(uif_mif_mode == UIF_PDIRECT_MODE) & (ctrl_next_state == CTRL_MIF_RD) & (uif_mode == UIF_MODE_RD) ? CTRL_OP_PRD :
(ctrl_next_state == CTRL_MIF_RD) & (uif_mode == UIF_MODE_PHYS) ? CTRL_RD_PHY_CH :
(ctrl_next_state == CTRL_MIF_WR) ? CTRL_OP_WR :
(ctrl_next_state == CTRL_MIF_RD) | (ctrl_next_state == CTRL_CHK_CHN) ? CTRL_OP_RD : ctrl_opcode;
uif_addr_err <= uif_addr_err_d; //illegal offset
chn_chk_active <= (ctrl_next_state == CTRL_CHK_CHN) ? 1'b1 :
(ctrl_state == CTRL_WF_B) & (ctrl_next_state == CTRL_WF_AV) ? 1'b0 : chn_chk_active;
end
end
assign ctrl_op_done = (ctrl_state == CTRL_WF_B) & ((ctrl_next_state == CTRL_WF_AV) | (ctrl_next_state == CTRL_IDLE));
// ctrl_address might be sourced by user or from MIF
always @(posedge clk or posedge reset)
begin
if(reset)
ctrl_addr <= {CTRL_ADDR_WIDTH{1'b0}};
else begin
if(ctrl_next_state == CTRL_CHK_CHN)
ctrl_addr <= AV_XR_ABS_ADDR_ID;
//capture MIF address from Avalon
else if(uif_mif_mode == MIF_STREAM_MODE && av_ctrl_req_re)
ctrl_addr <= {1'b0,av_mif_addr}; //MSB is used for PHY-IP soft registers
//capture User IF offset and use directly
else if(uif_mif_mode != MIF_STREAM_MODE && set_uif_ctrl_req)
ctrl_addr <= uif_addr;
end
end
//Save channel ID information
always @(posedge clk or posedge reset)
begin
if (reset) begin
channel_id <= 5'd0;
end
else begin
if(ctrl_state == CTRL_IDLE)
channel_id <= 5'd0;
else if(!ctrl_wait && (ctrl_opcode==CTRL_OP_RD) && chn_chk_active)
channel_id <= ctrl_rdata[AV_XR_ID_PLL_TYPE_OFST+AV_XR_ID_PLL_TYPE_LEN-1:AV_XR_ID_TX_CHANNEL_OFST];
end
end
always @(posedge clk or posedge reset)
begin
if (reset) begin
av_chn_mismatch <= 1'd0;
end
else begin
if(av_mif_type_valid) begin
if((av_mif_type == MIF_TYPE_DUPLEX) && ((channel_id[AV_XR_ID_RX_CHANNEL_OFST] != 1'd1) || (channel_id[AV_XR_ID_TX_CHANNEL_OFST] != 1'd1)))
av_chn_mismatch <= 1'b1;
else if((av_mif_type == MIF_TYPE_RX) && ((channel_id[AV_XR_ID_RX_CHANNEL_OFST] != 1'd1) || (channel_id[AV_XR_ID_TX_CHANNEL_OFST] != 1'd0)))
av_chn_mismatch <= 1'b1;
else if((av_mif_type == MIF_TYPE_TX) && ((channel_id[AV_XR_ID_RX_CHANNEL_OFST] != 1'd0) || (channel_id[AV_XR_ID_TX_CHANNEL_OFST] != 1'd1)))
av_chn_mismatch <= 1'b1;
//we currently only support CMU PLLs
else if((av_mif_type == MIF_TYPE_PLL) && (channel_id[AV_XR_ID_PLL_TYPE_OFST+AV_XR_ID_PLL_TYPE_LEN-1: AV_XR_ID_PLL_TYPE_OFST] != AV_XR_ID_PLL_TYPE_CMU))
av_chn_mismatch <= 1'b1;
end
else
av_chn_mismatch <= 1'b0;
end
end
//Check for special RMW offsets
assign mux_mif_addr = (uif_mif_mode == MIF_STREAM_MODE) ? {1'b0,av_mif_addr} : uif_addr[CTRL_ADDR_WIDTH-1:0];
always @(posedge clk or posedge reset)
begin
if (reset)
rmw_offset <= 1'b0;
else begin
//clear rmw flag after data has been modified
if((ctrl_state == CTRL_RMW) && (ctrl_next_state == CTRL_MIF_WR) )
rmw_offset <= 1'b0;
//Protect DPRIO with RMW if write request is STREAM or DIRECT modes
else if(av_ctrl_req_re || (uif_wr && (uif_mif_mode == MIF_DIRECT_MODE))) begin
case(mux_mif_addr)
RECONFIG_PMA_CGB_REG_OFST,
RECONFIG_PMA_CLKNET_CLKMON_REG_OFST,
RECONFIG_PMA_LST_REG_OFST,
RECONFIG_PMA_BBPD_REG_OFST,
RECONFIG_PMA_TB_REG_OFST,
RECONFIG_PMA_PCIEMD_RREF_REG_OFST,
RECONFIG_PMA_RXDATAO_REG_OFST,
RECONFIG_PMA_REFIQ_REG_OFST,
RECONFIG_PMA_CH0_DCD_DC_TUNE,
RECONFIG_PCS8G_POWER_TRL_REG_OFST : rmw_offset <= 1'b1; //CGB/RefClk bits
default : rmw_offset <= 1'b0;
endcase
end
end
end
//RMW masks
always @ (*) begin
case(mux_mif_addr)
RECONFIG_PMA_CGB_REG_OFST : rmw_mask = RECONFIG_PMA_CGB_REG_MASK; // contains rcgb_clk_sel bits
RECONFIG_PMA_CLKNET_CLKMON_REG_OFST : rmw_mask = RECONFIG_PMA_CLKNET_CLKMON_REG_MASK; // contains XN Line select (rcgb_clknet_in_en), DCD protected bits (rser_clk_mon)
RECONFIG_PMA_LST_REG_OFST : rmw_mask = RECONFIG_PMA_LST_REG_MASK; // contains DCD protected bits (rtx_lst)
RECONFIG_PMA_BBPD_REG_OFST : rmw_mask = RECONFIG_PMA_BBPD_REG_MASK; // contains BBPD control (rcru_pdof_*i)
RECONFIG_PMA_TB_REG_OFST : rmw_mask = RECONFIG_PMA_TB_REG_MASK; // contains Testbus control control (rcru_pdof_test)
RECONFIG_PMA_PCIEMD_RREF_REG_OFST : rmw_mask = RECONFIG_PMA_PCIEMD_RREF_REG_MASK; // contains (pcie_mode_sel, rrefclk_sel) bit
RECONFIG_PMA_RXDATAO_REG_OFST : rmw_mask = RECONFIG_PMA_RXDATAO_REG_MASK; // contains rx_data_out_sel //rdynamic_sw, rint_early_eios, rint_ltr, rrxp_reserved[29], rint_tx_elec_idle, rint_txdetectrx, rint_pcie_switch, rint_cvp_mode, rint_ffclk_pdb
RECONFIG_PMA_REFIQ_REG_OFST : rmw_mask = RECONFIG_PMA_REFIQ_REG_MASK; // contains pma_iq_clk_sel bits
RECONFIG_PMA_CH0_DCD_DC_TUNE : rmw_mask = RECONFIG_PMA_DCD_DC_TUNE_REG_MASK; // contains rser_dc_tune
RECONFIG_PCS8G_POWER_TRL_REG_OFST : rmw_mask = RECONFIG_PCS8G_POWER_TRL_REG_MASK; // contains r_pow_power_iso_ctrl bits
default : rmw_mask = 16'h0000; //all bits are writable
endcase
end
//Saved DPRIO data for RMW
always @(posedge clk or posedge reset)
begin
if (reset) begin
saved_read_data <= 16'd0;
end
else begin
if(!ctrl_wait && (ctrl_opcode==CTRL_OP_RD))
saved_read_data <= ctrl_rdata[15:0];
end
end
//generate RMW data
assign masked_rdata = saved_read_data & rmw_mask; //preserve existing DPRIO data
assign masked_wdata = av_mif_data & ~(rmw_mask); //Clear write bits that should be preserved
assign mif_data_modify = masked_wdata | masked_rdata; //Create a new data word //av_mif_data;
assign masked_uif_wdata = uif_wdata[15:0] & ~(rmw_mask);
assign uif_wdata_modify = masked_uif_wdata | masked_rdata;
// basic write data might be source from user or from MIF
always @(posedge clk or posedge reset)
begin
if(reset)
ctrl_wdata <= {CTRL_DATA_WIDTH{1'b0}};
else begin
if(uif_mif_mode == MIF_STREAM_MODE)
ctrl_wdata <= mif_data_modify;
else if (uif_mif_mode == MIF_DIRECT_MODE)
ctrl_wdata <= uif_wdata_modify;
else
ctrl_wdata <= uif_wdata[15:0];
end
end
//create a UIF request flag to the Basic control SM
assign set_uif_ctrl_req = (ctrl_state == CTRL_IDLE) & ((ctrl_next_state == CTRL_CHK_ADDR) | (ctrl_next_state == CTRL_MIF_RD));
assign clr_uif_ctrl_req = ctrl_op_done;
always @(posedge clk or posedge reset)
begin
if (reset)
uif_ctrl_req <= 1'd0;
else begin
if(set_uif_ctrl_req)
uif_ctrl_req <= 1'b1;
else if(clr_uif_ctrl_req)
uif_ctrl_req <= 1'b0;
end
end
//detect incoming Av request
//delay a cycle to allow Av data to get here
always @(posedge clk or posedge reset)
begin
if(reset)
av_ctrl_req_dly <= 1'b0;
else begin
av_ctrl_req_dly <= av_ctrl_req;
end
end
assign av_ctrl_req_re = ~(av_ctrl_req_dly) & av_ctrl_req;
endmodule

View file

@ -0,0 +1,201 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
`timescale 1 ps / 1 ps
module av_xcvr_reconfig_pll #(
parameter device_family = "Stratix V"
)
(
input wire reconfig_clk,
input wire reset,
////////////////////////////////
// User Avalon Slave interface
// User input MM slave
input wire [2:0] pll_reconfig_address,
input wire [31:0] pll_reconfig_writedata,
input wire pll_reconfig_write,
input wire pll_reconfig_read,
// User output MM slave
output wire [31:0] pll_reconfig_readdata,
output wire pll_reconfig_waitrequest,
output wire pll_reconfig_done,
///////////////////////////////
// PLL reconfiguration interface
// input from PLL reconfig
output wire pll_mif_busy,
output wire pll_mif_err,
// output from PLL reconfig
input wire pll_mif_go,
input wire pll_mif_type,
input wire [3:0] pll_mif_data,
input wire [9:0] pll_mif_lch,
//////////////////////////////////
// Basic block interface
// output to base_reconfig
output wire [2:0] pll_base_address,
output wire [31:0] pll_base_writedata,
output wire pll_base_write,
output wire pll_base_read,
// input from base reconfig
input wire [31:0] pll_base_readdata,
input wire pll_base_waitrequest,
//////////////////////////////////
// Arbiter interface
output wire arb_req,
input wire arb_grant
);
//internal wires
wire [31:0] uif_writedata;
wire [31:0] uif_readdata;
wire [2:0] uif_addr_offset;
wire [9:0] uif_logical_ch_addr;
wire [2:0] uif_mode;
wire uif_go;
wire uif_busy;
wire uif_error;
wire uif_illegal_pch_error;
wire uif_illegal_offset_error;
wire [31:0] ctrl_phreaddata;
wire [31:0] ctrl_writedata;
wire [31:0] ctrl_readdata;
wire [11:0] ctrl_addr_offset;
wire ctrl_illegal_phy_ch;
wire pll_base_irq;
wire ctrl_go;
wire ctrl_waitrequest;
wire [2:0] ctrl_opcode;
wire ctrl_lock;
wire [9:0] ctrl_lch;
//MIF User interface
alt_xreconf_uif
#(
.RECONFIG_USER_ADDR_WIDTH(3),
.RECONFIG_USER_DATA_WIDTH(32),
.RECONFIG_USER_OFFSET_WIDTH(3)
) inst_pll_uif (
.reconfig_clk(reconfig_clk),
.reset(reset),
.user_reconfig_address(pll_reconfig_address),
.user_reconfig_writedata(pll_reconfig_writedata),
.user_reconfig_write(pll_reconfig_write),
.user_reconfig_read(pll_reconfig_read),
.user_reconfig_readdata(pll_reconfig_readdata),
.user_reconfig_waitrequest(pll_reconfig_waitrequest),
.user_reconfig_done(pll_reconfig_done),
// to /from data control logic
.uif_writedata(uif_writedata), // to data control logic
.uif_addr_offset(uif_addr_offset), // to data control logic/rmw block
.uif_mode(uif_mode), // to data control logic
.uif_ctrl(), //unused
.uif_logical_ch_addr(uif_logical_ch_addr), // to data
.uif_go(uif_go), // to data control logic
.uif_readdata(uif_readdata),// from data control logic
.uif_phreaddata(ctrl_phreaddata),// from cif logic
.uif_illegal_pch_error(ctrl_illegal_phy_ch), // from data control logic
.uif_illegal_offset_error(uif_error), // from data control logic
.uif_busy(uif_busy) // from data control logic
);
av_xcvr_reconfig_pll_ctrl #(
.UIF_ADDR_WIDTH (3),
.UIF_DATA_WIDTH (32),
.CTRL_ADDR_WIDTH (12),
.CTRL_DATA_WIDTH (32)
) inst_pll_ctrl (
.clk (reconfig_clk),
.reset (reset),
// user interface
.uif_go (uif_go), // start user cycle
.uif_mode (uif_mode), // 0=read; 1=write;
.uif_busy (uif_busy), // transfer in process
.uif_addr (uif_addr_offset), // address offset
.uif_wdata (uif_writedata), // data in
.uif_rdata (uif_readdata), // data out
.uif_chan_err (ctrl_illegal_phy_ch), // illegal channel
.uif_addr_err (uif_error), // illegal address
.uif_logical_ch_addr (uif_logical_ch_addr),
//MIF interface
.pll_mif_busy (pll_mif_busy),
.pll_mif_err (pll_mif_err),
.pll_mif_go (pll_mif_go),
.pll_mif_type (pll_mif_type),
.pll_mif_lch (pll_mif_lch[9:0]),
.pll_mif_data (pll_mif_data[3:0]),
// basic block interface
.ctrl_go (ctrl_go), // start basic block cycle
.ctrl_opcode (ctrl_opcode), // 0=read; 1=write;
.ctrl_lock (ctrl_lock), // multicycle lock
.ctrl_wait (ctrl_waitrequest), // transfer in process
.ctrl_addr (ctrl_addr_offset), // address
.ctrl_lch (ctrl_lch),
.ctrl_rdata (ctrl_readdata[31:0]),
.ctrl_wdata (ctrl_writedata[31:0])
);
// Basic Block interface
alt_xreconf_cif #(
.CIF_RECONFIG_ADDR_WIDTH (3),
.CIF_RECONFIG_DATA_WIDTH (32),
.CIF_OFFSET_ADDR_WIDTH (12),
.CIF_MASTER_ADDR_WIDTH (3),
.CIF_RECONFIG_OFFSET_WIDTH (5) //unused parameter
)
inst_xreconf_cif (
.reconfig_clk (reconfig_clk),
.reset (reset),
// data control signals
.ctrl_go (ctrl_go),
.ctrl_opcode (ctrl_opcode),
.ctrl_lock (ctrl_lock),
.ctrl_addr_offset (ctrl_addr_offset),
.ctrl_writedata (ctrl_writedata),
.uif_logical_ch_addr (ctrl_lch),
.ctrl_readdata (ctrl_readdata),
.ctrl_phreaddata (ctrl_phreaddata),
.ctrl_illegal_phy_ch (ctrl_illegal_phy_ch),
.ctrl_waitrequest (ctrl_waitrequest),
// basic block ports
.reconfig_address_base (pll_base_address),
.reconfig_writedata_base (pll_base_writedata),
.reconfig_write_base (pll_base_write),
.reconfig_read_base (pll_base_read),
.reconfig_readdata_base (pll_base_readdata),
.reconfig_irq_from_base (pll_base_irq),
.reconfig_waitrequest_from_base (pll_base_waitrequest),
.arb_grant (arb_grant),
.arb_req (arb_req)
);
endmodule

View file

@ -0,0 +1,540 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
`timescale 1 ns / 1 ps
module av_xcvr_reconfig_pll_ctrl #(
parameter UIF_ADDR_WIDTH = 3,
parameter UIF_DATA_WIDTH = 32,
parameter CTRL_ADDR_WIDTH = 12,
parameter CTRL_DATA_WIDTH = 32
)
(
input wire clk,
input wire reset,
// user interface
input wire uif_go, // start user cycle
input wire [2:0] uif_mode, // operation
output reg uif_busy, // transfer in process
input wire [UIF_ADDR_WIDTH -1:0] uif_addr, // address offset
input wire [UIF_DATA_WIDTH -1:0] uif_wdata, // data in
output reg [UIF_DATA_WIDTH -1:0] uif_rdata, // data out
input wire uif_chan_err, // illegal channel
output reg uif_addr_err, // illegal address
input wire [9:0] uif_logical_ch_addr, //logical channel
//MIF interface
input wire pll_mif_go,
input wire pll_mif_type,
input wire [3:0] pll_mif_data,
input wire [9:0] pll_mif_lch,
output wire pll_mif_busy,
output wire pll_mif_err,
// basic block control interface
output reg ctrl_go, // start basic block cycle
output reg [2:0] ctrl_opcode, // 0=read; 1=write;
output reg ctrl_lock, // multicycle lock
input wire ctrl_wait, // transfer in process
output wire [9:0] ctrl_lch,
output reg [CTRL_ADDR_WIDTH -1:0] ctrl_addr,
input wire [CTRL_DATA_WIDTH -1:0] ctrl_rdata, // data in
output reg [CTRL_DATA_WIDTH -1:0] ctrl_wdata // data out
);
// register addresses
import alt_xcvr_reconfig_h::*;
import av_xcvr_h::*;
localparam REFCLK_WIDTH = 5;
localparam CGB_WIDTH = 4;
localparam WORD_SEL_CGB = 12'd2;
localparam WORD_SEL_RC = 12'd1;
// user modes
localparam [2:0] UIF_MODE_RD = 3'b000;
localparam [2:0] UIF_MODE_WR = 3'b001;
localparam [2:0] UIF_MODE_PHYS = 3'b010;
// basic control commands
localparam [2:0] CTRL_OP_RD = 3'b000;
localparam [2:0] CTRL_OP_WR = 3'b001;
localparam [2:0] CTRL_OP_PHYS = 3'b010;
localparam [2:0] CTRL_OP_INT_WR = 3'b011;
localparam [2:0] CTRL_OP_ROM_RD = 3'b100;
// state assignments
localparam [2:0] PLL_IDLE = 3'd0;
localparam [2:0] PLL_RD_L2P = 3'd1; // Read contents of B-Block ROM
localparam [2:0] PLL_RD = 3'd2; // Read DPRIO
localparam [2:0] PLL_WR = 3'd3; // Write DPRIO
localparam [2:0] PLL_DECIDE = 3'd4; // Wait for CIF and decide next state
localparam [2:0] PLL_WAIT = 3'd5; // wait one cycle for ctrl_wait
localparam [2:0] PLL_CHK_WORDS = 3'd6; // check if there are any additional RMW words to address
// state declarations
reg [2:0] pll_next_state;
reg [2:0] pll_state;
reg [2:0] state_event;
// local storage of logical to physical info
reg [5*REFCLK_WIDTH-1:0] phys_refclk;
reg [5*CGB_WIDTH-1:0] phys_cgb;
reg [15:0] saved_read_data;
//misc registers
reg pll_uif_go;
reg pll_uif_type;
reg uif_l2p_active;
reg mif_req;
reg [1:0] word_cnt;
reg [5:0] rcgb_clk_sel;
reg [0:0] rcgb_clknet_in_en;
reg [1:0] rcgb_x_en;
reg [CGB_WIDTH-1:0] cgb_sel;
reg [7:0] pma_iq_clk_sel;
reg [REFCLK_WIDTH-1:0] rc_sel;
reg [2:0] pll_uif_cgb_sel;
reg [2:0] pll_uif_rc_sel;
reg rrefclk_sel;
reg rcru_pcie_mode;
//internal wires for UIF based reconfiguiration
wire [2:0] pll_uif_data;
wire pll_uif_rd_l2p;
wire [15:0] modify_cgb_data;
wire [15:0] modify_cgb_data_0;
wire [15:0] modify_cgb_data_1;
wire [15:0] modify_refclk_data;
wire [15:0] modify_refclk_data_0;
wire [15:0] modify_refclk_data_1;
wire [31:0] modify_data;
wire mux_pll_type;
wire [3:0] logical_index;
wire [11:0] refclk_sel_addr;
wire [11:0] cgb_sel_addr;
wire pll_uif_go_d;
wire pll_uif_type_d;
wire uif_rc_sel_wr;
wire uif_cgb_sel_wr;
wire uif_l2p_rc_rd;
wire uif_l2p_cgb_rd;
//create go strobe and delay to allow register data to be current
assign pll_uif_go_d = uif_rc_sel_wr | uif_cgb_sel_wr;
always @(posedge clk or posedge reset)
begin
if (reset) begin
pll_uif_go <= 1'b0;
end
else begin
pll_uif_go <= pll_uif_go_d;
end
end
//determine operation depending on which register was written
always @(posedge clk or posedge reset)
begin
if (reset) begin
pll_uif_type <= 1'b0;
end
else begin
if(uif_rc_sel_wr || uif_l2p_rc_rd)
pll_uif_type <= 1'b0;
else if(uif_cgb_sel_wr || uif_l2p_cgb_rd)
pll_uif_type <= 1'b1;
end
end
//offset 0 - RefClk switch need to add a check for LC or CMU
assign uif_rc_sel_wr = uif_go & (uif_mode == UIF_MODE_WR) & (uif_addr == 3'd0);
always @(posedge clk or posedge reset)
begin
if (reset) begin
pll_uif_rc_sel <= 3'd0;
end
else begin
if(uif_rc_sel_wr)
pll_uif_rc_sel <= uif_wdata[2:0];
end
end
//offset 1 - CGB select and switch
assign uif_cgb_sel_wr = uif_go & (uif_mode == UIF_MODE_WR) & (uif_addr == 3'd1);
always @(posedge clk or posedge reset)
begin
if (reset) begin
pll_uif_cgb_sel <= 3'd0;
end
else begin
if(uif_cgb_sel_wr)
pll_uif_cgb_sel <= uif_wdata[2:0];
end
end
//select the logical index source
assign pll_uif_data = pll_uif_type ? pll_uif_cgb_sel : pll_uif_rc_sel;
assign pll_uif_rd_l2p = uif_l2p_rc_rd | uif_l2p_cgb_rd;
assign uif_l2p_rc_rd = uif_go & (uif_mode == UIF_MODE_RD) & (uif_addr == 3'd2);
assign uif_l2p_cgb_rd = uif_go & (uif_mode == UIF_MODE_RD) & (uif_addr == 3'd3);
//UIF read back
always @(posedge clk or posedge reset)
begin
if (reset) begin
uif_rdata <= {UIF_DATA_WIDTH{1'b0}};
end
else begin
if(uif_mode == UIF_MODE_RD) begin
case(uif_addr)
3'd0: uif_rdata <= {29'd0, pll_uif_rc_sel};
3'd1: uif_rdata <= {29'd0, pll_uif_cgb_sel};
3'd2: uif_rdata <= {7'd0, phys_refclk}; //Physical readback
3'd3: uif_rdata <= {12'd0, phys_cgb} ; //Physical readback
default : uif_rdata <= {UIF_DATA_WIDTH{1'd0}};
endcase
end
end
end
//set a flag that indicates User L2P read to prevent a full RMW cycle
always @(posedge clk or posedge reset)
begin
if (reset) begin
uif_l2p_active <= 1'b0;
end
else begin
if(pll_next_state == PLL_IDLE && pll_state == PLL_DECIDE)
uif_l2p_active <= 1'b0;
else if(pll_uif_rd_l2p)
uif_l2p_active <= 1'b1;
end
end
//Physical info store register
integer i;
always @(posedge clk or posedge reset)
begin
if (reset) begin
phys_refclk <= {REFCLK_WIDTH*5{1'b0}};
phys_cgb <= {CGB_WIDTH*5{1'b0}};
end
else begin
if(!ctrl_wait && (ctrl_opcode==CTRL_OP_ROM_RD) && mux_pll_type) begin
// store all five Physical words
phys_cgb <= ctrl_rdata[(CGB_WIDTH*5-1):0];
end
else if(!ctrl_wait && (ctrl_opcode==CTRL_OP_ROM_RD) && !mux_pll_type) begin
// store all five Physical words
phys_refclk <= ctrl_rdata[(REFCLK_WIDTH*5)-1:0];
end
end
end
//select target physical CGB id
always @ (*) begin
case(logical_index[2:0])
3'd0: cgb_sel = phys_cgb[3:0];
3'd1: cgb_sel = phys_cgb[7:4];
3'd2: cgb_sel = phys_cgb[11:8];
3'd3: cgb_sel = phys_cgb[15:12];
3'd4: cgb_sel = phys_cgb[19:16];
default: cgb_sel = phys_cgb[3:0];
endcase
end
//Remapping of CGB selects to rcgb_x_en[3:2], rcgb_clknet_in_en, rcgb_clk_sel[5:0] bits
always @ (*) begin
case(cgb_sel)
4'd0: {rcgb_x_en, rcgb_clknet_in_en, rcgb_clk_sel} = {2'b00, 1'b0, 6'b10_11_00}; //SAME_CH_TXPLL
4'd1: {rcgb_x_en, rcgb_clknet_in_en, rcgb_clk_sel} = {2'b00, 1'b0, 6'b01_00_11}; //CH1_TXPLL_T
4'd2: {rcgb_x_en, rcgb_clknet_in_en, rcgb_clk_sel} = {2'b00, 1'b0, 6'b10_00_00}; //CH1_TXPLL_B
4'd3: {rcgb_x_en, rcgb_clknet_in_en, rcgb_clk_sel} = {2'b00, 1'b0, 6'b01_00_10}; //FFPLL
4'd4: {rcgb_x_en, rcgb_clknet_in_en, rcgb_clk_sel} = {2'b00, 1'b0, 6'b01_00_00}; //UP_SEGMENTED
4'd5: {rcgb_x_en, rcgb_clknet_in_en, rcgb_clk_sel} = {2'b00, 1'b0, 6'b01_00_01}; //DOWN_SEGMENTED
4'd6: {rcgb_x_en, rcgb_clknet_in_en, rcgb_clk_sel} = {2'b10, 1'b1, 6'b10_10_00}; //HFCLK_CH1_X6_UP
4'd7: {rcgb_x_en, rcgb_clknet_in_en, rcgb_clk_sel} = {2'b01, 1'b1, 6'b10_01_00}; //HFCLK_CH1_X6_DN
4'd8: {rcgb_x_en, rcgb_clknet_in_en, rcgb_clk_sel} = {2'b00, 1'b1, 6'b10_01_00}; //HFCLK_XN_UP
4'd9: {rcgb_x_en, rcgb_clknet_in_en, rcgb_clk_sel} = {2'b00, 1'b1, 6'b10_10_00}; //HFCLK_XN_DN
default: {rcgb_x_en, rcgb_clknet_in_en, rcgb_clk_sel} = {2'b00, 1'b0, 6'b10_11_00}; //ERROR: set to CDR local
endcase
end
//select target physical RefClk id
always @ (*) begin
case(logical_index[2:0])
3'd0: rc_sel = phys_refclk[4:0];
3'd1: rc_sel = phys_refclk[9:5];
3'd2: rc_sel = phys_refclk[14:10];
3'd3: rc_sel = phys_refclk[19:15];
3'd4: rc_sel = phys_refclk[24:20];
default: rc_sel = phys_refclk[4:0];
endcase
end
//Remapping of RefClk selects to pma_ch_sel_iqclk[6:3] bits
//rrefclk_sel,rcru_pcie_mode = 00b (REFCLK_IQ or CALCLK)
//rrefclk_sel,rcru_pcie_mode = 01b (REFCLK_LC)
//rrefclk_sel,rcru_pcie_mode = 10b (PLDCLK)
//pma_iq_clk_sel = selects REF_IQCLK or RX_IQCLK
always @ (*) begin
case(rc_sel)
5'd0: {rrefclk_sel,rcru_pcie_mode,pma_iq_clk_sel} = {1'b0,1'b0,8'b0000_0001}; //REF_IQCLK0
5'd1: {rrefclk_sel,rcru_pcie_mode,pma_iq_clk_sel} = {1'b0,1'b0,8'b0000_0010}; //REF_IQCLK1
5'd2: {rrefclk_sel,rcru_pcie_mode,pma_iq_clk_sel} = {1'b0,1'b0,8'b0000_0011}; //REF_IQCLK2
5'd3: {rrefclk_sel,rcru_pcie_mode,pma_iq_clk_sel} = {1'b0,1'b0,8'b0000_0100}; //REF_IQCLK3
5'd4: {rrefclk_sel,rcru_pcie_mode,pma_iq_clk_sel} = {1'b0,1'b0,8'b0000_0101}; //REF_IQCLK4
5'd5: {rrefclk_sel,rcru_pcie_mode,pma_iq_clk_sel} = {1'b0,1'b0,8'b0000_0110}; //REF_IQCLK5
5'd6: {rrefclk_sel,rcru_pcie_mode,pma_iq_clk_sel} = {1'b0,1'b0,8'b0000_0111}; //REF_IQCLK6
5'd7: {rrefclk_sel,rcru_pcie_mode,pma_iq_clk_sel} = {1'b0,1'b0,8'b0000_1000}; //REF_IQCLK7
5'd8: {rrefclk_sel,rcru_pcie_mode,pma_iq_clk_sel} = {1'b0,1'b0,8'b0000_1001}; //REF_IQCLK8
5'd9: {rrefclk_sel,rcru_pcie_mode,pma_iq_clk_sel} = {1'b0,1'b0,8'b0000_1010}; //REF_IQCLK9
5'd10: {rrefclk_sel,rcru_pcie_mode,pma_iq_clk_sel} = {1'b0,1'b0,8'b0000_1011}; //REF_IQCLK10
5'd11: {rrefclk_sel,rcru_pcie_mode,pma_iq_clk_sel} = {1'b0,1'b0,8'b0001_0000}; //RX_IQCLK0
5'd12: {rrefclk_sel,rcru_pcie_mode,pma_iq_clk_sel} = {1'b0,1'b0,8'b0010_0000}; //RX_IQCLK1
5'd13: {rrefclk_sel,rcru_pcie_mode,pma_iq_clk_sel} = {1'b0,1'b0,8'b0011_0000}; //RX_IQCLK2
5'd14: {rrefclk_sel,rcru_pcie_mode,pma_iq_clk_sel} = {1'b0,1'b0,8'b0100_0000}; //RX_IQCLK3
5'd15: {rrefclk_sel,rcru_pcie_mode,pma_iq_clk_sel} = {1'b0,1'b0,8'b0101_0000}; //RX_IQCLK4
5'd16: {rrefclk_sel,rcru_pcie_mode,pma_iq_clk_sel} = {1'b0,1'b0,8'b0110_0000}; //RX_IQCLK5
5'd17: {rrefclk_sel,rcru_pcie_mode,pma_iq_clk_sel} = {1'b0,1'b0,8'b0111_0000}; //RX_IQCLK6
5'd18: {rrefclk_sel,rcru_pcie_mode,pma_iq_clk_sel} = {1'b0,1'b0,8'b1000_0000}; //RX_IQCLK7
5'd19: {rrefclk_sel,rcru_pcie_mode,pma_iq_clk_sel} = {1'b0,1'b0,8'b1001_0000}; //RX_IQCLK8
5'd20: {rrefclk_sel,rcru_pcie_mode,pma_iq_clk_sel} = {1'b0,1'b0,8'b1010_0000}; //RX_IQCLK9
5'd21: {rrefclk_sel,rcru_pcie_mode,pma_iq_clk_sel} = {1'b0,1'b0,8'b1011_0000}; //RX_IQCLK10
5'd22: {rrefclk_sel,rcru_pcie_mode,pma_iq_clk_sel} = {1'b1,1'b0,8'b0000_0000}; //PLD_CLK
5'd23: {rrefclk_sel,rcru_pcie_mode,pma_iq_clk_sel} = {1'b0,1'b0,8'b0000_0000}; //CAL_CLK - Requires oc_cal_en
5'd24: {rrefclk_sel,rcru_pcie_mode,pma_iq_clk_sel} = {1'b0,1'b0,8'b0000_1100}; //FFPLL_TOP
5'd25: {rrefclk_sel,rcru_pcie_mode,pma_iq_clk_sel} = {1'b0,1'b0,8'b0000_0000}; //FFPLL_BOT
default: {rrefclk_sel,rcru_pcie_mode,pma_iq_clk_sel} = {1'b0,1'b0,8'b0000_0001}; //REF_IQCLK0
endcase
end
//Saved DPRIO data for RMW
always @(posedge clk or posedge reset)
begin
if (reset) begin
saved_read_data <= 16'd0;
end
else begin
if(!ctrl_wait && (ctrl_opcode==CTRL_OP_RD))
saved_read_data <= ctrl_rdata[15:0];
end
end
////////////////////////////////////////
// PLL reconfiguration state machine
// ----------------------------------
// Steps to perform a CGB or Refcllk switch
// 1) Use CTRL_OP_ROM_RD to read Log-to-phys word from Basic
// 2) Use CTRL_OP_RD to access PHY-IP DPRIO data for Refclk/CGB
// 3) Modify select bits with Phys data indexed by logical data select
// 4) Use CTRL_OP_WR to write modified word bac to DPRIO space
// 5) Continue RMW as needed
////////////////////////////////////////
// state register
always @(posedge clk or posedge reset)
begin
if (reset) begin
pll_state <= PLL_IDLE;
end
else begin
pll_state <= pll_next_state;
end
end
// next state logic
always @ (*) begin
case(pll_state)
PLL_IDLE: begin
if(pll_mif_go || pll_uif_go || pll_uif_rd_l2p)
pll_next_state = PLL_RD_L2P;
else
pll_next_state = PLL_IDLE;
end
PLL_DECIDE: begin
//just read ROM
if(!ctrl_wait && uif_l2p_active)
pll_next_state = PLL_IDLE;
//read DPRIO data
else if(!ctrl_wait && (state_event == 3'd1))
pll_next_state = PLL_RD;
//write new data
else if(!ctrl_wait && (state_event == 3'd2))
pll_next_state = PLL_WR;
//check if there are more RMW words for this opertation
else if(!ctrl_wait && (state_event == 3'd3))
pll_next_state = PLL_CHK_WORDS;
else
pll_next_state = PLL_DECIDE;
end
PLL_WAIT: pll_next_state = PLL_DECIDE;
PLL_RD_L2P: pll_next_state = PLL_WAIT;
PLL_RD: pll_next_state = PLL_WAIT;
PLL_WR: pll_next_state = PLL_WAIT;
//Make sure this is the last RMW word needed
PLL_CHK_WORDS: begin
if(word_cnt == 0)
pll_next_state = PLL_IDLE;
else
pll_next_state = PLL_WAIT;
end
default : pll_next_state = PLL_IDLE;
endcase
end
//state machine event tracer to minimize states
always @(posedge clk or posedge reset)
begin
if (reset)
state_event <= 3'd0;
else begin
//reset event counter when we go back to idle
if(((pll_state == PLL_DECIDE) && (pll_next_state == PLL_CHK_WORDS)) || (pll_state == PLL_IDLE))
state_event <= 3'd0;
else if((pll_next_state == PLL_DECIDE) && (pll_state != PLL_DECIDE))
state_event <= state_event + 1'd1;
end
end
// output logic
always @(posedge clk or posedge reset)
begin
if (reset)
begin
uif_busy <= 1'b0;
ctrl_go <= 1'b0;
ctrl_lock <= 1'b0;
ctrl_opcode <= 3'd0;
uif_addr_err <= 1'b0;
end
else begin
uif_busy <= (pll_next_state != PLL_IDLE);
ctrl_go <= (pll_state == PLL_RD_L2P) | (pll_state == PLL_RD) | (pll_state == PLL_WR);
ctrl_lock <= (pll_state != PLL_IDLE) & (state_event < 3'd3) & !uif_l2p_active;
ctrl_opcode <= (pll_next_state == PLL_IDLE) ? 3'd0 :
(pll_state == PLL_RD_L2P) ? CTRL_OP_ROM_RD :
(pll_state == PLL_RD) ? CTRL_OP_RD :
(pll_state == PLL_WR) ? CTRL_OP_WR :
ctrl_opcode;
uif_addr_err <= (uif_addr > 3'd3);
end
end
//Word counter to track how many words are needed for a RefClk switch or CGB switch
//RefClk switch involves RMW to three words
//CGB switch is only one word
always @(posedge clk or posedge reset)
begin
if (reset)
word_cnt <= 2'b0;
else begin
//Load counter depending on PLL switch type
if(pll_state == PLL_RD_L2P && pll_next_state == PLL_WAIT)
word_cnt <= mux_pll_type ? 2'd1 : 2'd1; //2 words for CGB select, 2 words for RefClk
//Decrement word_cnt after each RMW operation
else if( (pll_state == PLL_CHK_WORDS) && (pll_next_state == PLL_WAIT) && (word_cnt > 0) )
word_cnt <= word_cnt - 1'd1;
end
end
//Read modify write DPRIO data
assign logical_index = mif_req ? pll_mif_data : pll_uif_data;
assign modify_cgb_data_0 = {saved_read_data[15:13], rcgb_x_en[1:0], saved_read_data[10:6], rcgb_clk_sel[5:0]}; //modify CGB select with phys info
assign modify_cgb_data_1 = {saved_read_data[15:10], rcgb_clknet_in_en, saved_read_data[8:0]};
assign modify_cgb_data = (word_cnt == 2'b01) ? modify_cgb_data_1 :
modify_cgb_data_0;
//RefClk switch invloves three DPRIO offsets
assign modify_refclk_data_0 = {saved_read_data[15:11],pma_iq_clk_sel[7:0],saved_read_data[2:0]}; // pma_iqclk_sel -> 3Ah[10:3]
assign modify_refclk_data_1 = {saved_read_data[3:0], rrefclk_sel, saved_read_data[4:0], rcru_pcie_mode, saved_read_data[4:0]}; // rrefclk_sel -> 17h[15]
assign modify_refclk_data = (word_cnt == 2'b01) ? modify_refclk_data_1 :
modify_refclk_data_0;
assign mux_pll_type = mif_req ? pll_mif_type : pll_uif_type;
assign modify_data = mux_pll_type ? {16'd0,modify_cgb_data} : {16'd0,modify_refclk_data};
//Generate control write data to Basic
always @(posedge clk or posedge reset)
begin
if (reset)
ctrl_wdata <= {CTRL_DATA_WIDTH{1'b0}};
else begin
if(pll_state == PLL_IDLE)
ctrl_wdata <= {CTRL_DATA_WIDTH{1'b0}};
else if(pll_state == PLL_WR)
ctrl_wdata <= modify_data;
end
end
assign refclk_sel_addr = (word_cnt == 2'b01) ? RECONFIG_PMA_PCIEMD_RREF_REG_OFST :
RECONFIG_PMA_REFIQ_REG_OFST;
assign cgb_sel_addr = (word_cnt == 2'b01) ? RECONFIG_PMA_CLKNET_CLKMON_REG_OFST :
RECONFIG_PMA_CGB_REG_OFST;
//Generate control address to Basic
always @(posedge clk or posedge reset)
begin
if (reset)
ctrl_addr <= {CTRL_ADDR_WIDTH{1'b0}};
else begin
if(pll_state == PLL_IDLE)
ctrl_addr <= 12'd0;
//set basic offset register to index into ROM based on Type
else if(pll_state == PLL_RD_L2P)
ctrl_addr <= mux_pll_type ? WORD_SEL_CGB : WORD_SEL_RC;
//select RefClk or CGB offset depending on Type field
else if(pll_state == PLL_RD || pll_state == PLL_WR )
ctrl_addr <= mux_pll_type ? cgb_sel_addr : refclk_sel_addr;
end
end
//set logical channel
assign ctrl_lch = mif_req ? pll_mif_lch : uif_logical_ch_addr;
/////////////////////
// MIF interface
assign pll_mif_busy = uif_busy;
assign pll_mif_err = 1'b0;
//status information to know current requester
always @(posedge clk or posedge reset)
begin
if (reset)
mif_req <= 1'd0;
else begin
if((pll_state == PLL_CHK_WORDS) && (pll_next_state == PLL_IDLE))
mif_req <= 1'd0;
else if(pll_mif_go)
mif_req <= 1'd1;
end
end
endmodule

View file

@ -0,0 +1,51 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
//
// Logical offset address to physical address mapping
//
// $Header$
//
`timescale 1 ns / 1 ns
module av_xrbasic_l2p_addr #(
parameter w_pch = 3, // bits needed to represent physical channel numbers (offsets within a physical interface)
parameter w_paddr = 11 // bits needed to represent physical addresses
) (
input wire clk,
input wire [w_paddr-1:0] offset_addr, // logical offset address
input wire [w_pch -1:0] physical_ch, // physical channel number
output reg [w_paddr-1:0] physical_addr = {w_paddr{1'b0}} // physical address
);
import av_xcvr_h::*;
reg [w_paddr-1:0] pch_start_addr = {w_paddr{1'b0}}; // physical channel start address
always @(*) begin
case (physical_ch)
// Map logical channel offsets to physical addresses
0: pch_start_addr = {w_paddr{1'b0}};
1: pch_start_addr = {w_paddr{1'b0}} + RECONFIG_PMA_CH1_BASE;
2: pch_start_addr = {w_paddr{1'b0}} + RECONFIG_PMA_CH2_BASE;
// LC PLL needs special mapping
3: pch_start_addr = {w_paddr{1'b0}}; // fill-in PLL offset addr remapping
default: pch_start_addr = {w_paddr{1'b0}};
endcase
end
// add offset, and register output for performance
always @(posedge clk) begin
physical_addr <= offset_addr + pch_start_addr;
end
endmodule

View file

@ -0,0 +1,103 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
//
// Logical-to-physical channel number translator for transceiver reconfig 'basic' block
//
// $Header$
//
`timescale 1 ns / 1 ns
//(* ALTERA_ATTRIBUTE = {"BLOCK_RAM_TO_MLAB_CELL_CONVERSION=ON"} *)
module av_xrbasic_l2p_ch #(
parameter logical_interface = 0, // which logical interface is the mapping for?
parameter native_ifs = 1, // number of native reconfig interfaces, used when no physical mapping available
parameter w_lch = 5, // bits needed to represent logical channel numbers
parameter w_pif = 5, // bits needed to represent physical interface numbers
parameter w_pch = 3, // bits needed to represent physical channel numbers (offsets within a physical interface)
parameter physical_channel_mapping = "" // string notation to define logical-to-physical channel mapping
) (
input wire clk,
input wire [w_lch-1:0] logical_ch, // logical channel input
output reg [w_pif-1:0] physical_if = 0, // physical interface output
output reg [w_pch-1:0] physical_ch = 0 // physical channel output (offset within a physical interface)
);
localparam logical_ch_max = (1<<w_lch);
localparam l2p_bits = w_pif + w_pch; // physical interface bits + physical channel bits
typedef bit [l2p_bits-1:0] t_l2p_bits;
// declare a ROM to hold the logical-to-physical channel mapping
(* romstyle = "MLAB" *) reg [l2p_bits-1:0] rom_l2p_ch[logical_ch_max-1:0];
/*
// function to extract logical-to-physical channel mapping table from string parameter
localparam MAX_CHARS = 1024;
function [logical_ch_max-1:0][l2p_bits-1:0] get_logical_to_physical_mapping (
integer interface_number,
input [MAX_CHARS*8-1:0] l2p_str
);
integer i;
begin
for (i=0; i<logical_ch_max; ++i) begin
get_logical_to_physical_mapping[i][l2p_bits-1:0] = l2p_str[i*8 +:8];
end
end
endfunction
localparam [logical_ch_max-1:0][l2p_bits-1:0] l2p_mapping =
get_logical_to_physical_mapping(logical_interface, physical_channel_mapping);
*/
// logical-to-physical channel mapping table
integer i;
initial begin
for (i=0; i<logical_ch_max; ++i) begin//: map
if (physical_channel_mapping == "") begin
// NULL mapping case when string mapping is not defined
// For this case, map every logical channel to its own phys interface, and use only phys ch 0 on each phys if
rom_l2p_ch[i] = (i < native_ifs)
? t_l2p_bits'(i << w_pch) // physical channel index always 0 when no mapping data
: t_l2p_bits'(-1); // value of -1 means logical channel does not exist
end
else begin
// infer a ROM for the logical channel to physical (interface, channel) mapping
// The following section implements a logical-to-physical translation table in the form of a large mux.
// The mux data inputs are the physical interface and channel numbers, and the select input is 'logical_channel_addr_reg'
/* wire [w_lch-1:0] l2p_pif_wire [logical_ch_max-1:0];
wire [w_pch-1:0] l2p_pch_wire [logical_ch_max-1:0];
wire [logical_ch_max-1:0] lch_decode;
for (i=0; i<logical_ch_max && l2p_mapping[i][l2p_bits-1:0] != {l2p_bits{1'b1}}; ++i) begin: l2p
assign lch_decode[i] = (logical_ch == i);
if (i > 0) begin
assign l2p_pif_wire[i]= l2p_pif_wire[i-1] | (l2p_mapping[i][l2p_bits-1:0] >> 4) & {w_lch{lch_decode[i]}};
assign l2p_pch_wire[i]= l2p_pif_wire[i-1] | (l2p_mapping[i][l2p_bits-1:0] & 32'hf) & {w_pch{lch_decode[i]}};
end else begin
assign l2p_pif_wire[i]= (l2p_mapping[i][l2p_bits-1:0] >> 4) & {w_lch{lch_decode[i]}};
assign l2p_pch_wire[i]= (l2p_mapping[i][l2p_bits-1:0] & 32'hf) & {w_pch{lch_decode[i]}};
end
// must check termination condition inside the loop to assign to outputs
if ((i+1) == logical_ch_max || l2p_mapping[i+1][l2p_bits-1:0] == {l2p_bits{1'b1}}) begin
// mux output is from last logical channel
assign physical_interface = l2p_pif_wire[i];
assign physical_channel = l2p_pch_wire[i];
end
end */
end
end
end//generate
// registered ROM outputs
always @(posedge clk) begin
{physical_if, physical_ch} <= rom_l2p_ch[logical_ch];
end
endmodule

View file

@ -0,0 +1,134 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
//
// Logical-to-physical channel number translator for transceiver reconfig 'basic' block
//
// $Header$
//
`timescale 1 ns / 1 ns
//(* ALTERA_ATTRIBUTE = {"BLOCK_RAM_TO_MLAB_CELL_CONVERSION=ON"} *)
(* ALTERA_ATTRIBUTE = {"ALLOW_ANY_ROM_SIZE_FOR_RECOGNITION=ON;AUTO_ROM_RECOGNITION=ON;ALLOW_ANY_RAM_SIZE_FOR_RECOGNITION=ON;AUTO_RAM_RECOGNITION=ON"} *)
module av_xrbasic_l2p_rom #(
parameter logical_interface = 0, // which logical interface is the mapping for?
parameter native_ifs = 1, // number of native reconfig interfaces, used when no physical mapping available
parameter w_lch = 5, // bits needed to represent logical channel numbers
parameter w_pif = 5, // bits needed to represent physical interface numbers
parameter w_pch = 3, // bits needed to represent physical channel numbers (offsets within a physical interface)
parameter w_word = 2, // bts needed to index logical channel related words
parameter w_rom = 32, // width of each ROM entry
parameter physical_channel_mapping = "" // string notation to define logical-to-physical channel mapping
) (
input wire clk,
input wire [w_lch-1:0] logical_ch, // logical channel input for indexing logical channel
input wire [w_word-1:0] l2p_word_sel, // ROM word select for indexing per-channel words
output [w_rom-1:0] l2p_rom_data,
output [w_pif-1:0] physical_if, // physical interface output
output [w_pch-1:0] physical_ch // physical channel output (offset within a physical interface)
);
localparam logical_ch_max = (1<<w_lch); // Number of logical channels stored in the ROM
localparam lch_words = (1<<w_word); // Number off words per logical channel
localparam num_rom_entries = logical_ch_max*lch_words;
localparam l2p_bits = w_pif + w_pch; // physical interface bits + physical channel bits
typedef bit [l2p_bits-1:0] t_l2p_bits;
localparam refclk_default_val = {7'd0,5'd4,5'd3,5'd2,5'd1,5'd0};
localparam cgb_default_val = {12'd0,4'd4,4'd3,4'd2,4'd1,4'd0};
//Ensure both ROM outputs are the same width to aid ROM inferrence
reg [w_rom-1:0] l2p_rom_rddata_a;
reg [w_rom-1:0] l2p_rom_rddata_b;
// declare a ROM to hold the logical-to-physical channel mapping
// (* romstyle = "MLAB" *) reg [l2p_bits-1:0] rom_l2p_ch[logical_ch_max-1:0];
(* ramstyle = "M10K" *) reg [w_rom-1:0] rom_l2p_ch[num_rom_entries-1:0];
/*
// function to extract logical-to-physical channel mapping table from string parameter
localparam MAX_CHARS = 1024;
function [logical_ch_max-1:0][l2p_bits-1:0] get_logical_to_physical_mapping (
integer interface_number,
input [MAX_CHARS*8-1:0] l2p_str
);
integer i;
begin
for (i=0; i<logical_ch_max; ++i) begin
get_logical_to_physical_mapping[i][l2p_bits-1:0] = l2p_str[i*8 +:8];
end
end
endfunction
localparam [logical_ch_max-1:0][l2p_bits-1:0] l2p_mapping =
get_logical_to_physical_mapping(logical_interface, physical_channel_mapping);
*/
// logical-to-physical channel mapping table
integer i;
initial begin
//for (i=0; i<logical_ch_max; ++i) begin//: map
for (i=0; i<num_rom_entries; i=i+4) begin//: map
if (physical_channel_mapping == "") begin
// NULL mapping case when string mapping is not defined
// For this case, map every logical channel to its own phys interface, and use only phys ch 0 on each phys if
// rom_l2p_ch[i] = (i < native_ifs)
// ? t_l2p_bits'(i << w_pch) // physical channel index always 0 when no mapping data
// : t_l2p_bits'(-1); // value of -1 means logical channel does not exist
rom_l2p_ch[i] = (i < native_ifs*4)
? {{w_rom - l2p_bits{1'b0}},t_l2p_bits'((i/4) << w_pch)} // physical channel index always 0 when no mapping data
: {{w_rom - l2p_bits{1'b0}},t_l2p_bits'(-1)}; // value of -1 means logical channel does not exist
rom_l2p_ch[i+1] = refclk_default_val; //initialize refclk maping
rom_l2p_ch[i+2] = cgb_default_val; //initialize CGB maping
rom_l2p_ch[i+3] ={w_rom{1'b0}}; //reserved word
end
else begin
// infer a ROM for the logical channel to physical (interface, channel) mapping
// The following section implements a logical-to-physical translation table in the form of a large mux.
// The mux data inputs are the physical interface and channel numbers, and the select input is 'logical_channel_addr_reg'
/* wire [w_lch-1:0] l2p_pif_wire [logical_ch_max-1:0];
wire [w_pch-1:0] l2p_pch_wire [logical_ch_max-1:0];
wire [logical_ch_max-1:0] lch_decode;
for (i=0; i<logical_ch_max && l2p_mapping[i][l2p_bits-1:0] != {l2p_bits{1'b1}}; ++i) begin: l2p
assign lch_decode[i] = (logical_ch == i);
if (i > 0) begin
assign l2p_pif_wire[i]= l2p_pif_wire[i-1] | (l2p_mapping[i][l2p_bits-1:0] >> 4) & {w_lch{lch_decode[i]}};
assign l2p_pch_wire[i]= l2p_pif_wire[i-1] | (l2p_mapping[i][l2p_bits-1:0] & 32'hf) & {w_pch{lch_decode[i]}};
end else begin
assign l2p_pif_wire[i]= (l2p_mapping[i][l2p_bits-1:0] >> 4) & {w_lch{lch_decode[i]}};
assign l2p_pch_wire[i]= (l2p_mapping[i][l2p_bits-1:0] & 32'hf) & {w_pch{lch_decode[i]}};
end
// must check termination condition inside the loop to assign to outputs
if ((i+1) == logical_ch_max || l2p_mapping[i+1][l2p_bits-1:0] == {l2p_bits{1'b1}}) begin
// mux output is from last logical channel
assign physical_interface = l2p_pif_wire[i];
assign physical_channel = l2p_pch_wire[i];
end
end */
end
end
end//generate
// registered ROM outputs
always @(posedge clk) begin
//{physical_if, physical_ch} <= rom_l2p_ch[logical_ch];
// {physical_if, physical_ch} <= rom_l2p_ch[{logical_ch,2'b00}][l2p_bits-1:0];
l2p_rom_rddata_a <= rom_l2p_ch[{logical_ch,2'b00}];
l2p_rom_rddata_b <= rom_l2p_ch[{logical_ch,l2p_word_sel}];
end
assign {physical_if, physical_ch} = l2p_rom_rddata_a[l2p_bits-1:0];
assign l2p_rom_data = l2p_rom_rddata_b;
endmodule

View file

@ -0,0 +1,245 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
//
// Logical-side interface for transceiver reconfig 'basic' block
// Before merging, each 'basic' block will have only 1 logical-side interface
//
// $Header$
//
`timescale 1 ns / 1 ns
(* ALTERA_ATTRIBUTE = {"suppress_da_rule_internal=\"C101,C103,C104\""} *) module av_xrbasic_lif #(
parameter logical_interface = 0, // which single logical interface is this?
parameter native_ifs = 1, // number of native reconfig interfaces
parameter w_paddr = 12, // width of physical avalon reconfig address (upper bit selects soft or hard dprio)
parameter physical_channel_mapping = ""
) (
// avalon clock interface
input wire reconfig_clk,
input wire reset,
input wire lif_is_active,
// avalon MM, "basic" interface
input wire basic_reconfig_write,
input wire basic_reconfig_read,
input wire [31:0] basic_reconfig_writedata,
input wire [ 2:0] basic_reconfig_address, // address to MM described below
output reg [31:0] basic_reconfig_readdata,
output wire basic_reconfig_waitrequest,
//output reg basic_reconfig_irq, // interrupt to Master
// Testbus control and data outputs (to physical interface)
output wire [native_ifs*12 -1:0] pif_testbus_sel, // 4 bits per physical channel
// Testbus inputs (from physical interface)
input wire [native_ifs*3*8-1:0] pif_testbus, // testbus from native reconfig, for all physical interfaces
// Logical interface outputs (to basic block clients)
output wire [7:0] lch_testbus, // testbus from native reconfig, for selected channel
output wire [3*8-1:0] pch_testbus, // testbus from native reconfig, for all three channels
// physical interface arbiter connections
output wire [native_ifs -1:0] pif_arb_req,
input wire [native_ifs -1:0] pif_arb_grant,
// avalon MM native reconfiguration interfaces
input wire [native_ifs*16 -1:0] native_reconfig_readdata, // Avalon DPRIO readdata
output wire [native_ifs*16 -1:0] native_reconfig_writedata, // Avalon DPRIO writedata
output wire [native_ifs*w_paddr-1:0] native_reconfig_address, // Avalon DPRIO address
output wire [native_ifs -1:0] native_reconfig_write, // Avalon DPRIO write
output wire [native_ifs -1:0] native_reconfig_read // Avalon DPRIO read
);
// Memory Map for register indirection
// word addr wr/rd description
// ------------------------------------------------------
// 0 wr/rd reserved
// 1 wr/rd logical_ch_addr (can be up to 10 bits)
// 2 rd physical_chnl_map
// 3 rd/wr status/control -- see op-code definitions
// 4 wr/rd DPRIO addr_offset
// 5 wr/rd DPRIO data
// 6 -- reserved
// 7 -- reserved
import altera_xcvr_functions::*;
localparam logical_chs = (native_ifs > 32 ? native_ifs : 32); // number of logical channels that can be supported in one basic reconfig interface
localparam w_lch = ceil_log2(logical_chs); // bits needed to represent logical channels and logical or physical interfaces
localparam w_pif = ceil_log2(native_ifs > 1 ? native_ifs : 2); // bits needed to represent physical interfaces
localparam w_pch = 3; // 8 physical channels numbers are enough to represent: 3 real channels, 1 LC PLL, and 1 virtual PLL
localparam w_ptbus = 3*8; // 8 bits per physical channel, 3 phys ch per phys interface
// ports of the logical interface CSR block
wire csr_plock;
wire [32 -1:0] csr_rwdata;
wire [16 -1:0] mux_csr_rwdata;
reg upper_16_sel /* synthesis keep */;
wire [w_lch -1:0] lif_number; // Selected logical interface number
wire [w_pif -1:0] pif_number; // physical interface number for current logical channel
wire [w_pch -1:0] pch_number; // phys channel number (within a phys interface) for the current logical channel
wire [16 -1:0] reco_rdata;
wire reco_read;
wire reco_write;
wire [w_paddr-1:0] reco_addr;
// CSR testbus controls
wire [3:0] csr_testbus_sel;
// Decode pif_number into individual pif enable signals
reg [native_ifs-1:0] pif_ena;
reg [native_ifs-1:0] lif_ena;
wire [native_ifs-1:0] pif_ena_wire;
reg [native_ifs-1:0] lif_ena_wire;
wire [native_ifs-1:0] pif_enabled_and_granted;
wire [native_ifs-1:0] lif_enabled_and_granted;
wire [native_ifs-1:0] sel_enabled_and_granted;
// logical interface CSR block, includes channel and address remapping
av_xrbasic_lif_csr #(
.logical_interface(logical_interface),
.native_ifs(native_ifs),
.w_lch(w_lch),
.w_pif(w_pif),
.w_pch(w_pch),
.w_paddr(w_paddr)
) lif_csr (
.reconfig_clk(reconfig_clk),
.reset(reset),
.lif_is_active(lif_is_active),
// basic reconfig, Avalon memory-mapped interface
.basic_reconfig_write(basic_reconfig_write),
.basic_reconfig_read(basic_reconfig_read),
.basic_reconfig_writedata(basic_reconfig_writedata),
.basic_reconfig_address(basic_reconfig_address),
.basic_reconfig_readdata(basic_reconfig_readdata),
.basic_reconfig_waitrequest(basic_reconfig_waitrequest),
// data, address, and control needed by physical interfaces
.lif_number(lif_number),
.pif_number(pif_number),
.pch_number(pch_number),
.reg_rwdata(csr_rwdata),
.plock_get(csr_plock),
.plock_granted(|pif_enabled_and_granted), // 0 or 1 bits will be '1', indicating plock grant status
// Control signals
.testbus_sel(csr_testbus_sel),
// reconfig interface signals
.reco_rdata(reco_rdata),
.reco_read(reco_read),
.reco_write(reco_write),
.reco_addr(reco_addr)
);
//Create a dummy mux to allow fitter connectivity to all 32 L2P ROM bits
always @(posedge reconfig_clk or posedge reset) begin
if(reset)
upper_16_sel <= 1'b0;
else
upper_16_sel <= 1'b0;
end
assign mux_csr_rwdata = upper_16_sel ? csr_rwdata[31:16] : csr_rwdata[15:0];
/////////////////////////////////////////////////////////
// Physical Interface Decoder
//
genvar pi;
generate
for (pi=0; pi < native_ifs; ++pi) begin: pifena
assign pif_ena_wire[pi] = (pif_number == pi);
assign lif_ena_wire[pi] = (lif_number == pi);
end
endgenerate
// register pif decoder output
initial begin
pif_ena = 0;
lif_ena = 0;
end
always @(posedge reconfig_clk) begin
pif_ena <= pif_ena_wire;
lif_ena <= lif_ena_wire;
end
// request signals for pif arbiters. Request when phys.lock set in CSR, and pif selected for current logical ch
assign pif_arb_req = (pif_ena & {native_ifs{csr_plock}});
// pif is selected for current logical ch, and grant received from pif arbiter
assign pif_enabled_and_granted = (pif_ena & pif_arb_grant);
// Grant logical interface. If the physical is granted then assume logical is as well
assign lif_enabled_and_granted = lif_ena;// & {native_ifs{|pif_enabled_and_granted}};
// Upper most address bits select logical vs. physical interface for Avalon bus
assign sel_enabled_and_granted = lif_enabled_and_granted & {native_ifs{reco_addr[w_paddr-1]}}
| pif_enabled_and_granted & {native_ifs{~reco_addr[w_paddr-1]}};
/////////////////////////////////////////////////////////
// Native (Physical) Interface controls
//
// Gate read, write, address, and data with 'pif_enabled_and_granted'
wire [15:0] reco_rdata_groups [native_ifs-1:0];
wire [w_ptbus-1:0] pif_testbus_groups [native_ifs-1:0]; // testbus from native reconfig, for all physical interfaces
// Triplet specific controls
assign native_reconfig_read = (sel_enabled_and_granted & {native_ifs{reco_read}});
assign native_reconfig_write = (sel_enabled_and_granted & {native_ifs{reco_write}});
// Native Av DPRIO address & data, and phys interface testbus muxing
generate
for (pi=0; pi < native_ifs; ++pi) begin: pifgate
// Triplet specific controls
assign native_reconfig_address[w_paddr*pi +: w_paddr] = ({w_paddr{sel_enabled_and_granted[pi]}} & reco_addr);
assign native_reconfig_writedata[16*pi +: 16] = ({16{sel_enabled_and_granted[pi]}} & mux_csr_rwdata[15:0]);
assign pif_testbus_sel [12*pi +: 12] = ({12{pif_enabled_and_granted[pi]}} & {3{csr_testbus_sel}});
// readdata gated to '0' for all pifs that are not selected and granted
// pif_testbus (all 3 pif channels) gated to '0' for all pifs that are not selected and granted
// then OR'ed together to form a decoded-select mux
if (pi == 0) begin
// Triplet specific status
assign reco_rdata_groups [0] = native_reconfig_readdata[15:0] & {16{sel_enabled_and_granted[0]}};
assign pif_testbus_groups [0] = pif_testbus[w_ptbus-1:0] & {w_ptbus{pif_enabled_and_granted[0]}};
end
else begin
// Triplet specific status
assign reco_rdata_groups [pi] = reco_rdata_groups [pi-1] | native_reconfig_readdata[pi*16 +: 16] & {16{sel_enabled_and_granted[pi]}};
assign pif_testbus_groups [pi] = pif_testbus_groups [pi-1] | pif_testbus[pi*w_ptbus +: w_ptbus] & {w_ptbus{pif_enabled_and_granted[pi]}};
end
end
endgenerate
// Multi-bit status signals (output selected logical channel)
assign reco_rdata = reco_rdata_groups [native_ifs-1]; // output of readdata mux
// instantiate mux for selection of a single-lane testbus output, out of the 3 testbus lanes per pif
csr_mux #(
.groups(3),
.grp_size(w_ptbus/3),
.sel_size(w_pch)
) pif_tbus_mux (
.in_wide(pif_testbus_groups[native_ifs-1]),
.sel(pch_number),
.out_narrow(lch_testbus) // testbus for a single channel (current logical ch)
);
// Provide the full triplet testbus based on which Physical interface is enabled
// Needed for LC and ATT calibration IPs
assign pch_testbus = pif_testbus_groups[native_ifs-1];
endmodule

View file

@ -0,0 +1,460 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
//
// Control and status register for logical-side interface of transceiver reconfig 'basic' block
//
// $Header$
//
`timescale 1 ns / 1 ns
(* ALTERA_ATTRIBUTE = {"ALLOW_ANY_ROM_SIZE_FOR_RECOGNITION=ON;AUTO_ROM_RECOGNITION=ON;ALLOW_ANY_RAM_SIZE_FOR_RECOGNITION=ON;AUTO_RAM_RECOGNITION=ON"} *)
module av_xrbasic_lif_csr #(
parameter logical_interface = 0, // which single logical interface is this?
parameter native_ifs = 1, // number of native reconfig interfaces
parameter w_lch = 5, // bits needed to represent logical channels and logical or physical interfaces
parameter w_pif = 5, // bits needed to represent physical interfaces
parameter w_pch = 3, // 8 physical channels numbers are enough to represent: 3 real channels, 1 LC PLL, and 1 virtual PLL
parameter w_paddr = 12, // width of physical avalon reconfig address
parameter w_rom = 32,
parameter four_word_rom = 1,
parameter physical_channel_mapping = ""
) (
// avalon clock interface, and arbiter activity indicator
input wire reconfig_clk,
input wire reset,
input wire lif_is_active,
// avalon MM, "basic" interface
input wire basic_reconfig_write,
input wire basic_reconfig_read,
input wire [31:0] basic_reconfig_writedata,
input wire [ 2:0] basic_reconfig_address, // address to MM described below
output reg [31:0] basic_reconfig_readdata,
output wire basic_reconfig_waitrequest,
// control outputs of CSR block
output reg [w_lch -1:0] lif_number, // current logical channel
output wire [w_pif -1:0] pif_number, // physical interface number for current logical channel
output wire [w_pch -1:0] pch_number, // phys channel number (within a phys interface) for the current logical channel
output reg [32 -1:0] reg_rwdata, // storage for indirect read/write data
output wire plock_get, // attempt to lock physical interface, persistent value (stays until cleared)
input wire plock_granted, // indicates current channel pif lock request is granted
// Testbus control outputs
output reg [ 3:0] testbus_sel,
// FSM outputs, reconfig results
output wire reco_read, // read control for physical interface
output reg reco_write, // write control for physical interface
output reg [w_paddr-1:0] reco_addr, // address for physical (reconfig) reads & writes
input wire [16 -1:0] reco_rdata // readdata from native reconfig
);
// Memory Map for register indirection
// word addr wr/rd description
// ------------------------------------------------------
// 0 wr/rd reserved
// 1 wr/rd logical_ch_addr (can be up to 10 bits)
// 2 rd physical_chnl_map
// 3 rd/wr status/control -- see op-code definitions
// 4 wr/rd DPRIO addr_offset
// 5 wr/rd DPRIO data
// 6 -- reserved
// 7 -- reserved
import alt_xcvr_reconfig_h::*;
(* ALTERA_ATTRIBUTE = {"POWER_UP_LEVEL=LOW"} *)
reg [w_lch -1:0] reg_lch; // storage for logical channel
reg [w_paddr-1:0] reg_addr; // storage for indirect address (for logical or physical reads & writes, and table lookup)
wire [1:0] loc_addr; // address for local registers
wire [3:0] opcode; // opcode from basic_reconfig_writedata
// address auto-increment mode (set via ctrl op-code)
(* ALTERA_ATTRIBUTE = {"POWER_UP_LEVEL=LOW"} *)
reg reg_write_incr; // when set, write to data register triggers a write, and increments address regs
wire w_write_incr; // indicates increment should happen on next rising edge
(* ALTERA_ATTRIBUTE = {"POWER_UP_LEVEL=LOW"} *)
reg reg_is_phys_addr; // when set, interpret RECO addr_offset as absolute address
(* ALTERA_ATTRIBUTE = {"POWER_UP_LEVEL=LOW"} *)
reg reg_plock; // attempt to lock physical interface, persistent value (stays until cleared)
reg lif_is_active_last = 0; // last state of lif_is_active input, for edge detection
// From mapping tables
wire [w_paddr-1:0] l2p_addr; // physical addr calculated as logical offset addr + phys ch start addr
wire [w_rom-1:0] l2p_rom_word;
wire [1:0] l2p_word_sel;
// waitrequest generation
reg lif_inwait; // captures state of lif_waitrequest in previous cycle, for edge detection
reg lif_wrwait; // additional waitrequest for logical ch write
wire lif_waitrequest; // waitrequest to basic interface
// native reconfig read/write FSM logic
reg [2:0] reco_read_length_cntr; // Av native reconfig reads have fixed latency of 3 cycles, and 'B' adds 2 more
localparam RECO_READ_START_COUNT = 3'd6; // assert native reconfig read when 6, 5, 4, 3
localparam RECO_READ_CAPTURE_COUNT = 3'd2; // capture native reconfig readdata when count is this value
reg [1:0] reco_addr_load_cntr; // count propagation delays through ctrl logic, to time when ready to load new reco_addr value
localparam RECO_ADDR_LOAD_LCH_CHANGE = 2'd3; // cycles needed after logical ch change
localparam RECO_ADDR_LOAD_OFFSET_CHANGE = 2'd2; // cycles needed after native addr offset change
localparam RECO_ADDR_LOAD_IS_PHYS_CHANGE = 2'd1; // cycles needed after is_phys_addr bit change
//XR_DIRECT_CONTROL_TABLE_READ ROM table lookup, especially for PLL and clock mux remapping
initial begin
// output register
basic_reconfig_readdata = 0;
reg_lch = 0; // storage for logical channel
reg_addr = 0; // storage for indirect address (for logical or physical reads & writes, and table lookup)
reg_rwdata = 0; // storage for indirect write data
// mgmt interface FSM outputs
reg_plock = 0; // phys interface lock request
reg_write_incr = 0; // auto-write-and-address-increment-on-data-write mode
reg_is_phys_addr = 0; // when set, interpret RECO addr_offset as absolute address
lif_inwait = 0; // capture last waitrequest state for edge detection
lif_wrwait = 0; // additional waitrequest for logical ch write
// native reconfig control registers
reco_addr_load_cntr = 0;
reco_addr = 0;
reco_read_length_cntr = 0;
reco_write = 0;
end
assign plock_get = reg_plock;
assign opcode = basic_reconfig_writedata[3:0]; //opcode use should always be qualified basic_reconfig_address == ADDR_XCVR_RECONFIG_BASIC_CONTROL
////////////////////////////////////////////
// Memory-mapped register write interface
////////////////////////////////////////////
// logical channel register
always @(posedge reconfig_clk or posedge reset) begin
if (reset == 1) begin
reg_lch <= 0;
end
else if (basic_reconfig_write && basic_reconfig_address == ADDR_XCVR_RECONFIG_BASIC_LOGICAL_CHANNEL) begin
// write from mgmt interface is only way to modify value
reg_lch <= basic_reconfig_writedata[w_lch-1:0];
end
end
// native reconfig address register, can be interpretted as channel offset address, or physical address
always @(posedge reconfig_clk or posedge reset) begin
if (reset == 1) begin
reg_addr <= 0;
end
else if (basic_reconfig_write && basic_reconfig_address == ADDR_XCVR_RECONFIG_BASIC_OFFSET_ADDR) begin
reg_addr <= basic_reconfig_writedata[w_paddr-1:0]; // write from mgmt interface
end
else if (w_write_incr) begin
reg_addr <= reg_addr + 1'b1; // auto-increment write in progress
end
end
// native reconfig data register, can be used to write data, or to get read data value after a read
always @(posedge reconfig_clk or posedge reset) begin
if (reset == 1) begin
reg_rwdata <= 0;
end
else if (basic_reconfig_write && (basic_reconfig_address == ADDR_XCVR_RECONFIG_BASIC_DATA )) begin
reg_rwdata <= basic_reconfig_writedata; // write from mgmt interface
end
//Look for CONTROL_TABLE_READ opcode and save L2P ROM content for a subsequent read from the Data register
//use reg_addr as pointer
else if (basic_reconfig_write && (opcode == XR_DIRECT_CONTROL_TABLE_READ) && (basic_reconfig_address == ADDR_XCVR_RECONFIG_BASIC_CONTROL)) begin
reg_rwdata <= l2p_rom_word; //capture ROM L2P information
end
else if (reco_read_length_cntr == RECO_READ_CAPTURE_COUNT) begin
reg_rwdata <= {16'd0,reco_rdata}; // output of native reconfig readdata for current phys interface
end
//else if (basic_reconfig_write & ~lif_inwait
// & (basic_reconfig_address == ADDR_XCVR_RECONFIG_BASIC_CONTROL)
// & (opcode == CONTROL_INTERNAL_READ)
// & (reg_addr[0] == XR_DIRECT_OFFSET_TESTBUS_SEL)) begin
// reg_rwdata <= 32'd0 | testbus_sel; // read testbus_sel value
//end
end
// Control modes, set/cleared via control word opcodes, set/cleared on lif_is_active arbiter activity
always @(posedge reconfig_clk or posedge reset) begin
if (reset == 1) begin
reg_plock <= 1'b0;
reg_write_incr <= 1'b0;
reg_is_phys_addr <= 1'b0;
end
else if (basic_reconfig_write && basic_reconfig_address == ADDR_XCVR_RECONFIG_BASIC_CONTROL) begin
// Request to set or clear phys interface lock
if (opcode == XR_DIRECT_CONTROL_PHYS_LOCK_CLEAR)
reg_plock <= 1'b0;
else if (opcode == XR_DIRECT_CONTROL_PHYS_LOCK_SET)
reg_plock <= 1'b1;
// Request to set or clear auto-address-increment on data write
if (opcode == XR_DIRECT_CONTROL_ADDR_AUTO_INCR_CLEAR)
reg_write_incr <= 1'b0;
else if (opcode == XR_DIRECT_CONTROL_ADDR_AUTO_INCR_SET)
reg_write_incr <= 1'b1;
// Request to set or clear physical address bit, to interpret RECO_ADDR as absolute addr
if (opcode == XR_DIRECT_CONTROL_LADDR_SET)
reg_is_phys_addr <= 1'b0;
else if (opcode == XR_DIRECT_CONTROL_PADDR_SET)
reg_is_phys_addr <= 1'b1;
end
else if (lif_is_active_last == 0) begin // reset state when B lock released
reg_plock <= lif_is_active; // auto-set pif lock bit when B is acquired, clear when released
reg_write_incr <= 1'b0;
reg_is_phys_addr <= 1'b0;
end
end
// save last state of lif_is_active, to detect changes
always @(posedge reconfig_clk)
lif_is_active_last <= lif_is_active;
// write increment: logic to detect address regs should increment
assign w_write_incr = reg_write_incr & basic_reconfig_write & ~lif_inwait
& (basic_reconfig_address == ADDR_XCVR_RECONFIG_BASIC_DATA);
////////////////////////////////////////////
// Memory-mapped register read interface
////////////////////////////////////////////
always @(posedge reconfig_clk or posedge reset) begin
if (reset == 1) begin
basic_reconfig_readdata <= 0;
// variable logical interface waitrequest generation
lif_wrwait <= 0; // extra wait states for writes that take multiple cycles for data to propagate through internal logic
lif_inwait <= 0; // capture last waitrequest state for edge detection
end
else begin
lif_inwait <= lif_waitrequest; // capture last waitrequest state for edge detection
lif_wrwait <= ~lif_inwait & basic_reconfig_write
& (basic_reconfig_address == ADDR_XCVR_RECONFIG_BASIC_LOGICAL_CHANNEL); // logical ch write needs 2 cycles to propagate through FSM
// decode readdata output for each supported address
// writes are decoded separately, since most registers can be written both
// through internal FSM paths, as well as through the mgmt interface
case (basic_reconfig_address)
// logical channel number
ADDR_XCVR_RECONFIG_BASIC_LOGICAL_CHANNEL: basic_reconfig_readdata <= (32'd0 | reg_lch);
// physical channel mapping for current logical channel
ADDR_XCVR_RECONFIG_BASIC_PHYSICAL_CHANNEL: basic_reconfig_readdata <= (32'd0 | {pif_number, 3'd0 | pch_number});
// status word
// on read, 0: phys.lock.granted - no native reconfig reads or writes get through while plock_granted is 0
ADDR_XCVR_RECONFIG_BASIC_CONTROL: basic_reconfig_readdata <= (32'd0
| {32{plock_granted}} & XR_DIRECT_STATUS_BITMASK_PHYS_LOCK_GRANTED
| {32{reg_plock}} & XR_DIRECT_STATUS_BITMASK_PHYS_LOCK_REQUESTED
| {32{reg_is_phys_addr}} & XR_DIRECT_STATUS_BITMASK_USING_PHYS_ADDR
| {32{reg_write_incr}} & XR_DIRECT_STATUS_BITMASK_USING_ADDR_AUTO_INCR);
// indirect address register
ADDR_XCVR_RECONFIG_BASIC_OFFSET_ADDR: basic_reconfig_readdata <= (32'd0 | reg_addr);
// indirect data register
ADDR_XCVR_RECONFIG_BASIC_DATA: basic_reconfig_readdata <= (32'd0 | reg_rwdata);
default: basic_reconfig_readdata <= ~ 32'd0; // use too many LEs?
endcase
end
end
// generate waitrequest for all reads, and for select writes
assign lif_waitrequest =
// 2 cycles for write to logical channel
// 2 cycles for write to native reconfig offset address
// 1 cycle for write to is_phys_addr bit
// 0 cycles for other writes
basic_reconfig_write & (~lif_inwait | lif_wrwait) & (basic_reconfig_address == ADDR_XCVR_RECONFIG_BASIC_LOGICAL_CHANNEL)
| basic_reconfig_write & ~lif_inwait & (basic_reconfig_address == ADDR_XCVR_RECONFIG_BASIC_OFFSET_ADDR)
// 1 cycle for all reads, except
// (variable) for read of native reconfig data after issuing a READ opcode
| basic_reconfig_read & ~lif_inwait
| basic_reconfig_read & (reco_read_length_cntr != 3'd0) & (basic_reconfig_address == ADDR_XCVR_RECONFIG_BASIC_DATA);
assign basic_reconfig_waitrequest = lif_waitrequest; // show wait on basic (logical) interface
////////////////////////////////////////////
// Internal register write interface,
// mainly for testbus control
////////////////////////////////////////////
// Local control registers
initial begin
// Testbus control registers
testbus_sel = 4'd0;
end
assign loc_addr = reg_addr[1:0];
// testbus_sel control
always @(posedge reconfig_clk or posedge reset) begin
if (reset == 1)
testbus_sel <= 4'd0;
else if (basic_reconfig_write & ~lif_inwait
& (basic_reconfig_address == ADDR_XCVR_RECONFIG_BASIC_CONTROL)
& (opcode == XR_DIRECT_CONTROL_INTERNAL_WRITE)
& (loc_addr == XR_DIRECT_OFFSET_TESTBUS_SEL) )
testbus_sel <= reg_rwdata[3:0]; // set testbus_sel output from data reg
end
//////////////////////////////////////////
// native reconfig read/write FSM logic
//////////////////////////////////////////
// native reconfig write control
always @(posedge reconfig_clk or posedge reset) begin
if (reset == 1)
reco_write <= 0;
else if (basic_reconfig_write & ~lif_inwait
& (basic_reconfig_address == ADDR_XCVR_RECONFIG_BASIC_CONTROL)
& (opcode == XR_DIRECT_CONTROL_RECONF_WRITE)) begin
reco_write <= 1'b1; // from control opcode for logical or physical write
end
else if (w_write_incr)
reco_write <= 1'b1; // from native reconfig data auto-write-and-increment mode
else
reco_write <= 0; // clear all other cycles
end
// native reconfig read control (sequence counter)
always @(posedge reconfig_clk or posedge reset) begin
if (reset == 1)
reco_read_length_cntr <= 0;
else if (basic_reconfig_write & ~lif_inwait
& (basic_reconfig_address == ADDR_XCVR_RECONFIG_BASIC_CONTROL)
& (opcode == XR_DIRECT_CONTROL_RECONF_READ)) begin
reco_read_length_cntr <= RECO_READ_START_COUNT; // from control opcode for logical or physical read
end
else if (reco_read_length_cntr != 0)
// decrement reco_read_length_cntr until it reaches 0, ending a read cycle
reco_read_length_cntr <= reco_read_length_cntr - 3'b1;
end
// native reconfig read control to native interface
assign reco_read = ( reco_read_length_cntr > RECO_READ_CAPTURE_COUNT); // read control for physical interface
// native reconfig address load counter, triggers update after an input change
always @(posedge reconfig_clk or posedge reset) begin
if (reset == 1)
reco_addr_load_cntr <= 0;
else if (basic_reconfig_write & ~lif_inwait
& (basic_reconfig_address == ADDR_XCVR_RECONFIG_BASIC_LOGICAL_CHANNEL)) begin
reco_addr_load_cntr <= RECO_ADDR_LOAD_LCH_CHANGE; // cycles needed after logical ch change
end
else if (basic_reconfig_write & ~lif_inwait
& (basic_reconfig_address == ADDR_XCVR_RECONFIG_BASIC_OFFSET_ADDR)) begin
reco_addr_load_cntr <= RECO_ADDR_LOAD_OFFSET_CHANGE; // cycles needed after native addr offset change
end
else if (basic_reconfig_write & ~lif_inwait
& (basic_reconfig_address == ADDR_XCVR_RECONFIG_BASIC_CONTROL)
& ( opcode == XR_DIRECT_CONTROL_LADDR_SET
|| opcode == XR_DIRECT_CONTROL_PADDR_SET)) begin
reco_addr_load_cntr <= RECO_ADDR_LOAD_IS_PHYS_CHANGE; // cycles needed after is_phys_addr bit change
end
else if (reco_addr_load_cntr != 0)
// decrement reco_addr_load_cntr until it reaches 0, ending a reco_addr refresh
reco_addr_load_cntr <= reco_addr_load_cntr - 2'b1;
end
// native reconfig address
always @(posedge reconfig_clk or posedge reset) begin
if (reset == 1)
reco_addr <= 0;
else if (reco_addr_load_cntr == 2'd1 & (reg_is_phys_addr | reg_addr[w_paddr-1]))
reco_addr <= reg_addr; // physical read or write opcode, use address reg without offset
else if (reco_addr_load_cntr == 2'd1 & ~reg_is_phys_addr)
reco_addr <= l2p_addr; // logical read or write opcode, use address with ch start offset
else if (reg_write_incr & reco_write)
reco_addr <= reco_addr + 1'b1; // from native reconfig data auto-write-and-increment mode
end
//////////////////////////////////////////////////////
// Look-up tables for channel and address translation
//////////////////////////////////////////////////////
// Logical to logical mapping
always @(posedge reconfig_clk or posedge reset)
if(reset == 1)
lif_number <= {w_lch{1'b0}};
else
lif_number <= reg_lch;
assign l2p_word_sel = reg_addr[1:0];
// Logical channel mapping to physical interface number and channel number
generate if(four_word_rom == 1) begin
//New four word/channel ROM structure
av_xrbasic_l2p_rom #(
.logical_interface(logical_interface), // which logical interface is the mapping for?
.native_ifs(native_ifs),
.w_word(2),
.w_rom(w_rom),
.w_lch(w_lch), // bits needed to represent logical channel numbers
.w_pif(w_pif), // bits needed to represent physical interface numbers
.w_pch(w_pch), // bits needed to represent physical channel numbers (within a phys interface)
.physical_channel_mapping(physical_channel_mapping) // string notation to define logical-to-physical channel mapping
) l2pch (
.clk(reconfig_clk),
.logical_ch(reg_lch), // logical channel input
.l2p_word_sel(l2p_word_sel),
.l2p_rom_data(l2p_rom_word),
.physical_if(pif_number), // physical interface output
.physical_ch(pch_number) // physical channel output (offset within a physical interface)
);
end
else begin
//old ROM stucture
av_xrbasic_l2p_ch #(
.logical_interface(logical_interface), // which logical interface is the mapping for?
.native_ifs(native_ifs),
.w_lch(w_lch), // bits needed to represent logical channel numbers
.w_pif(w_pif), // bits needed to represent physical interface numbers
.w_pch(w_pch), // bits needed to represent physical channel numbers (within a phys interface)
.physical_channel_mapping(physical_channel_mapping) // string notation to define logical-to-physical channel mapping
) l2pch (
.clk(reconfig_clk),
.logical_ch(reg_lch), // logical channel input
.physical_if(pif_number), // physical interface output
.physical_ch(pch_number) // physical channel output (offset within a physical interface)
);
assign l2p_rom_word = 32'd0;
end
endgenerate
// Logical address offset mapping to physical address
av_xrbasic_l2p_addr #(
.w_pch(w_pch), // bits needed to represent physical channel numbers (within a phys interface)
.w_paddr(w_paddr) // bits needed to represent physical addresses
) l2paddr (
.clk(reconfig_clk),
.offset_addr(reg_addr), // logical channel offset address input
.physical_ch(pch_number), // physical channel input
.physical_addr(l2p_addr) // physical address output
);
endmodule

View file

@ -0,0 +1,74 @@
./altera_xcvr_functions.sv
./av_xcvr_h.sv
./alt_xcvr_resync.sv
./alt_xcvr_reconfig_h.sv
./alt_xcvr_reconfig.sv
./alt_xcvr_reconfig_cal_seq.sv
./alt_xreconf_cif.sv
./alt_xreconf_uif.sv
./alt_xreconf_basic_acq.sv
./alt_xcvr_reconfig_analog.sv
./alt_xcvr_reconfig_analog_av.sv
./alt_xreconf_analog_datactrl_av.sv
./alt_xreconf_analog_rmw_av.sv
./alt_xreconf_analog_ctrlsm.sv
./alt_xcvr_reconfig_offset_cancellation.sv
./alt_xcvr_reconfig_offset_cancellation_av.sv
./alt_xcvr_reconfig_eyemon.sv
./alt_xcvr_reconfig_dfe.sv
./alt_xcvr_reconfig_adce.sv
./alt_xcvr_reconfig_dcd.sv
./alt_xcvr_reconfig_dcd_av.sv
./alt_xcvr_reconfig_dcd_cal_av.sv
./alt_xcvr_reconfig_dcd_control_av.sv
./alt_xcvr_reconfig_mif.sv
./av_xcvr_reconfig_mif.sv
./av_xcvr_reconfig_mif_ctrl.sv
./av_xcvr_reconfig_mif_avmm.sv
./alt_xcvr_reconfig_pll.sv
./av_xcvr_reconfig_pll.sv
./av_xcvr_reconfig_pll_ctrl.sv
./alt_xcvr_reconfig_soc.sv
./alt_xcvr_reconfig_cpu_ram.sv
./alt_xcvr_reconfig_direct.sv
./alt_arbiter_acq.sv
./alt_xcvr_reconfig_basic.sv
./av_xrbasic_l2p_addr.sv
./av_xrbasic_l2p_ch.sv
./av_xrbasic_l2p_rom.sv
./av_xrbasic_lif_csr.sv
./av_xrbasic_lif.sv
./av_xcvr_reconfig_basic.sv
./alt_xcvr_arbiter.sv
./alt_xcvr_m2s.sv
./altera_wait_generate.v
./alt_xcvr_csr_selector.sv
./sv_reconfig_bundle_to_basic.sv
./av_reconfig_bundle_to_basic.sv
./av_reconfig_bundle_to_xcvr.sv
./alt_xcvr_reconfig_cpu.v
./alt_xcvr_reconfig_cpu_reconfig_cpu.v
./alt_xcvr_reconfig_cpu_reconfig_cpu_test_bench.v
./alt_xcvr_reconfig_cpu_mm_interconnect_0.v
./alt_xcvr_reconfig_cpu_irq_mapper.sv
./altera_reset_controller.v
./altera_reset_synchronizer.v
./altera_merlin_master_translator.sv
./altera_merlin_slave_translator.sv
./altera_merlin_master_agent.sv
./altera_merlin_slave_agent.sv
./altera_merlin_burst_uncompressor.sv
./altera_avalon_sc_fifo.v
./alt_xcvr_reconfig_cpu_mm_interconnect_0_router.sv
./alt_xcvr_reconfig_cpu_mm_interconnect_0_router_001.sv
./alt_xcvr_reconfig_cpu_mm_interconnect_0_router_002.sv
./alt_xcvr_reconfig_cpu_mm_interconnect_0_router_003.sv
./alt_xcvr_reconfig_cpu_mm_interconnect_0_cmd_demux.sv
./alt_xcvr_reconfig_cpu_mm_interconnect_0_cmd_demux_001.sv
./alt_xcvr_reconfig_cpu_mm_interconnect_0_cmd_mux.sv
./altera_merlin_arbitrator.sv
./alt_xcvr_reconfig_cpu_mm_interconnect_0_cmd_mux_001.sv
./alt_xcvr_reconfig_cpu_mm_interconnect_0_rsp_mux.sv
./alt_xcvr_reconfig_cpu_mm_interconnect_0_rsp_mux_001.sv
./alt_xcvr_reconfig_cpu_mm_interconnect_0_avalon_st_adapter.v
./alt_xcvr_reconfig_cpu_mm_interconnect_0_avalon_st_adapter_error_adapter_0.sv

View file

@ -0,0 +1,74 @@
./altera_xcvr_functions.sv
./av_xcvr_h.sv
./alt_xcvr_resync.sv
./alt_xcvr_reconfig_h.sv
./alt_xcvr_reconfig.sv
./alt_xcvr_reconfig_cal_seq.sv
./alt_xreconf_cif.sv
./alt_xreconf_uif.sv
./alt_xreconf_basic_acq.sv
./alt_xcvr_reconfig_analog.sv
./alt_xcvr_reconfig_analog_av.sv
./alt_xreconf_analog_datactrl_av.sv
./alt_xreconf_analog_rmw_av.sv
./alt_xreconf_analog_ctrlsm.sv
./alt_xcvr_reconfig_offset_cancellation.sv
./alt_xcvr_reconfig_offset_cancellation_av.sv
./alt_xcvr_reconfig_eyemon.sv
./alt_xcvr_reconfig_dfe.sv
./alt_xcvr_reconfig_adce.sv
./alt_xcvr_reconfig_dcd.sv
./alt_xcvr_reconfig_dcd_av.sv
./alt_xcvr_reconfig_dcd_cal_av.sv
./alt_xcvr_reconfig_dcd_control_av.sv
./alt_xcvr_reconfig_mif.sv
./av_xcvr_reconfig_mif.sv
./av_xcvr_reconfig_mif_ctrl.sv
./av_xcvr_reconfig_mif_avmm.sv
./alt_xcvr_reconfig_pll.sv
./av_xcvr_reconfig_pll.sv
./av_xcvr_reconfig_pll_ctrl.sv
./alt_xcvr_reconfig_soc.sv
./alt_xcvr_reconfig_cpu_ram.sv
./alt_xcvr_reconfig_direct.sv
./alt_arbiter_acq.sv
./alt_xcvr_reconfig_basic.sv
./av_xrbasic_l2p_addr.sv
./av_xrbasic_l2p_ch.sv
./av_xrbasic_l2p_rom.sv
./av_xrbasic_lif_csr.sv
./av_xrbasic_lif.sv
./av_xcvr_reconfig_basic.sv
./alt_xcvr_arbiter.sv
./alt_xcvr_m2s.sv
./altera_wait_generate.v
./alt_xcvr_csr_selector.sv
./sv_reconfig_bundle_to_basic.sv
./av_reconfig_bundle_to_basic.sv
./av_reconfig_bundle_to_xcvr.sv
./alt_xcvr_reconfig_cpu.v
./alt_xcvr_reconfig_cpu_reconfig_cpu.v
./alt_xcvr_reconfig_cpu_reconfig_cpu_test_bench.v
./alt_xcvr_reconfig_cpu_mm_interconnect_0.v
./alt_xcvr_reconfig_cpu_irq_mapper.sv
./altera_reset_controller.v
./altera_reset_synchronizer.v
./altera_merlin_master_translator.sv
./altera_merlin_slave_translator.sv
./altera_merlin_master_agent.sv
./altera_merlin_slave_agent.sv
./altera_merlin_burst_uncompressor.sv
./altera_avalon_sc_fifo.v
./alt_xcvr_reconfig_cpu_mm_interconnect_0_router.sv
./alt_xcvr_reconfig_cpu_mm_interconnect_0_router_001.sv
./alt_xcvr_reconfig_cpu_mm_interconnect_0_router_002.sv
./alt_xcvr_reconfig_cpu_mm_interconnect_0_router_003.sv
./alt_xcvr_reconfig_cpu_mm_interconnect_0_cmd_demux.sv
./alt_xcvr_reconfig_cpu_mm_interconnect_0_cmd_demux_001.sv
./alt_xcvr_reconfig_cpu_mm_interconnect_0_cmd_mux.sv
./altera_merlin_arbitrator.sv
./alt_xcvr_reconfig_cpu_mm_interconnect_0_cmd_mux_001.sv
./alt_xcvr_reconfig_cpu_mm_interconnect_0_rsp_mux.sv
./alt_xcvr_reconfig_cpu_mm_interconnect_0_rsp_mux_001.sv
./alt_xcvr_reconfig_cpu_mm_interconnect_0_avalon_st_adapter.v
./alt_xcvr_reconfig_cpu_mm_interconnect_0_avalon_st_adapter_error_adapter_0.sv

View file

@ -0,0 +1,90 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
//
// Transceiver native reconfig adapter for Stratix V & derivatives.
// Translates from native reconfig wire bundles to separate Av reconfig and testbus signals
//
// This direction for bundle to separate buses inside the sv_xcvr_protocol_native block
//
// $Header$
//
`timescale 1 ns / 1 ns
module sv_reconfig_bundle_to_basic #(
parameter native_ifs = 1 // number of native reconfig interfaces
) (
// bundled reconfig buses
output wire [native_ifs*altera_xcvr_functions::W_S5_RECONFIG_BUNDLE_TO_XCVR -1:0] reconfig_to_xcvr, // all inputs from reconfig block to native xcvr reconfig ports
input wire [native_ifs*altera_xcvr_functions::W_S5_RECONFIG_BUNDLE_FROM_XCVR-1:0] reconfig_from_xcvr,// all input s from native xcvr reconfig ports to reconfig block
// native reconfig sources
output wire [native_ifs*16 -1:0] native_reconfig_readdata, // Avalon DPRIO readdata
output wire [native_ifs*3*8-1:0] pif_testbus, // testbus from native reconfig, for all physical interfaces
// native reconfig sinks
input wire [native_ifs*1 -1:0] native_reconfig_clk,
input wire [native_ifs*1 -1:0] native_reconfig_reset,
input wire [native_ifs*16 -1:0] native_reconfig_writedata, // Avalon DPRIO writedata
input wire [native_ifs*12 -1:0] native_reconfig_address, // Avalon DPRIO address
input wire [native_ifs*1 -1:0] native_reconfig_write, // Avalon DPRIO write
input wire [native_ifs*1 -1:0] native_reconfig_read, // Avalon DPRIO read
input wire [native_ifs*12 -1:0] pif_testbus_sel, // 4 bits per physical channel
input wire [native_ifs*1 -1:0] pif_interface_sel,
input wire [native_ifs*1 -1:0] pif_ser_shift_load,
input wire oc_cal_busy,
input wire tx_cal_busy,
input wire rx_cal_busy
);
localparam w_bundle_to_xcvr = altera_xcvr_functions::W_S5_RECONFIG_BUNDLE_TO_XCVR;
localparam w_bundle_from_xcvr= altera_xcvr_functions::W_S5_RECONFIG_BUNDLE_FROM_XCVR;
wire [native_ifs*1 -1:0] oc_cal_busy_bus;
wire [native_ifs*1 -1:0] tx_cal_busy_bus;
wire [native_ifs*1 -1:0] rx_cal_busy_bus;
assign oc_cal_busy_bus = {native_ifs{oc_cal_busy}};
assign tx_cal_busy_bus = {native_ifs{tx_cal_busy}};
assign rx_cal_busy_bus = {native_ifs{rx_cal_busy}};
genvar pi;
generate
for (pi=0; pi<native_ifs; ++pi) begin: pif
// !!!!!!!!!!!!!!!!!!!!!!!!!!!! NOTE !!!!!!!!!!!!!!!!!!!!!!!!
// Any changes to the bit mappings here must also be made in:
// - sv_reconfig_bundle_to_xcvr
// - sv_reconfig_bundle_to_ip
// - sv_reconfig_bundle_merger
// native reconfig sinks
assign reconfig_to_xcvr[pi*w_bundle_to_xcvr +: 1] = native_reconfig_clk [pi*1 +: 1];
assign reconfig_to_xcvr[pi*w_bundle_to_xcvr+1 +: 1] = native_reconfig_reset [pi*1 +: 1];
assign reconfig_to_xcvr[pi*w_bundle_to_xcvr+2 +: 16] = native_reconfig_writedata [pi*16 +: 16];
assign reconfig_to_xcvr[pi*w_bundle_to_xcvr+18 +: 1] = native_reconfig_write [pi*1 +: 1];
assign reconfig_to_xcvr[pi*w_bundle_to_xcvr+19 +: 1] = native_reconfig_read [pi*1 +: 1];
assign reconfig_to_xcvr[pi*w_bundle_to_xcvr+20 +: 12] = native_reconfig_address [pi*12 +: 12];
assign reconfig_to_xcvr[pi*w_bundle_to_xcvr+32 +: 12] = pif_testbus_sel [pi*12 +: 12];
assign reconfig_to_xcvr[pi*w_bundle_to_xcvr+44 +: 1] = pif_interface_sel [pi*1 +: 1];
assign reconfig_to_xcvr[pi*w_bundle_to_xcvr+45 +: 1] = pif_ser_shift_load [pi*1 +: 1];
assign reconfig_to_xcvr[pi*w_bundle_to_xcvr+46 +: 1] = oc_cal_busy_bus [pi*1 +: 1];
assign reconfig_to_xcvr[pi*w_bundle_to_xcvr+47 +: 1] = tx_cal_busy_bus [pi*1 +: 1];
assign reconfig_to_xcvr[pi*w_bundle_to_xcvr+48 +: 1] = rx_cal_busy_bus [pi*1 +: 1];
assign reconfig_to_xcvr[pi*w_bundle_to_xcvr+49 +: 21] = {21{1'b0}}; // reserved
// native reconfig sources
assign native_reconfig_readdata[pi*16 +: 16] = reconfig_from_xcvr[pi*w_bundle_from_xcvr +: 16];
assign pif_testbus [pi*24 +: 24] = reconfig_from_xcvr[pi*w_bundle_from_xcvr+16 +: 24];
end
endgenerate
endmodule

View file

@ -0,0 +1,100 @@
transconfig_sim/transconfig.vhd
transconfig_sim/alt_xcvr_reconfig/altera_xcvr_functions.sv
transconfig_sim/alt_xcvr_reconfig/mentor/altera_xcvr_functions.sv
transconfig_sim/alt_xcvr_reconfig/av_xcvr_h.sv
transconfig_sim/alt_xcvr_reconfig/mentor/av_xcvr_h.sv
transconfig_sim/alt_xcvr_reconfig/alt_xcvr_resync.sv
transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_resync.sv
transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_h.sv
transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig_h.sv
transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig.sv
transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig.sv
transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_cal_seq.sv
transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig_cal_seq.sv
transconfig_sim/alt_xcvr_reconfig/alt_xreconf_cif.sv
transconfig_sim/alt_xcvr_reconfig/mentor/alt_xreconf_cif.sv
transconfig_sim/alt_xcvr_reconfig/alt_xreconf_uif.sv
transconfig_sim/alt_xcvr_reconfig/mentor/alt_xreconf_uif.sv
transconfig_sim/alt_xcvr_reconfig/alt_xreconf_basic_acq.sv
transconfig_sim/alt_xcvr_reconfig/mentor/alt_xreconf_basic_acq.sv
transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_analog.sv
transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig_analog.sv
transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_analog_av.sv
transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig_analog_av.sv
transconfig_sim/alt_xcvr_reconfig/alt_xreconf_analog_datactrl_av.sv
transconfig_sim/alt_xcvr_reconfig/mentor/alt_xreconf_analog_datactrl_av.sv
transconfig_sim/alt_xcvr_reconfig/alt_xreconf_analog_rmw_av.sv
transconfig_sim/alt_xcvr_reconfig/mentor/alt_xreconf_analog_rmw_av.sv
transconfig_sim/alt_xcvr_reconfig/alt_xreconf_analog_ctrlsm.sv
transconfig_sim/alt_xcvr_reconfig/mentor/alt_xreconf_analog_ctrlsm.sv
transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_offset_cancellation.sv
transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig_offset_cancellation.sv
transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_offset_cancellation_av.sv
transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig_offset_cancellation_av.sv
transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_eyemon.sv
transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig_eyemon.sv
transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_dfe.sv
transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig_dfe.sv
transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_adce.sv
transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig_adce.sv
transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_dcd.sv
transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig_dcd.sv
transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_dcd_av.sv
transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_dcd_cal_av.sv
transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_dcd_control_av.sv
transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig_dcd_av.sv
transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig_dcd_cal_av.sv
transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig_dcd_control_av.sv
transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_mif.sv
transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig_mif.sv
transconfig_sim/alt_xcvr_reconfig/av_xcvr_reconfig_mif.sv
transconfig_sim/alt_xcvr_reconfig/av_xcvr_reconfig_mif_ctrl.sv
transconfig_sim/alt_xcvr_reconfig/av_xcvr_reconfig_mif_avmm.sv
transconfig_sim/alt_xcvr_reconfig/mentor/av_xcvr_reconfig_mif.sv
transconfig_sim/alt_xcvr_reconfig/mentor/av_xcvr_reconfig_mif_ctrl.sv
transconfig_sim/alt_xcvr_reconfig/mentor/av_xcvr_reconfig_mif_avmm.sv
transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_pll.sv
transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig_pll.sv
transconfig_sim/alt_xcvr_reconfig/av_xcvr_reconfig_pll.sv
transconfig_sim/alt_xcvr_reconfig/av_xcvr_reconfig_pll_ctrl.sv
transconfig_sim/alt_xcvr_reconfig/mentor/av_xcvr_reconfig_pll.sv
transconfig_sim/alt_xcvr_reconfig/mentor/av_xcvr_reconfig_pll_ctrl.sv
transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_soc.sv
transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_cpu_ram.sv
transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_cpu_ram.hex
transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_direct.sv
transconfig_sim/alt_xcvr_reconfig/alt_arbiter_acq.sv
transconfig_sim/alt_xcvr_reconfig/alt_xcvr_reconfig_basic.sv
transconfig_sim/alt_xcvr_reconfig/mentor/alt_arbiter_acq.sv
transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_reconfig_basic.sv
transconfig_sim/alt_xcvr_reconfig/av_xrbasic_l2p_addr.sv
transconfig_sim/alt_xcvr_reconfig/av_xrbasic_l2p_ch.sv
transconfig_sim/alt_xcvr_reconfig/av_xrbasic_l2p_rom.sv
transconfig_sim/alt_xcvr_reconfig/av_xrbasic_lif_csr.sv
transconfig_sim/alt_xcvr_reconfig/av_xrbasic_lif.sv
transconfig_sim/alt_xcvr_reconfig/av_xcvr_reconfig_basic.sv
transconfig_sim/alt_xcvr_reconfig/mentor/av_xrbasic_l2p_addr.sv
transconfig_sim/alt_xcvr_reconfig/mentor/av_xrbasic_l2p_ch.sv
transconfig_sim/alt_xcvr_reconfig/mentor/av_xrbasic_l2p_rom.sv
transconfig_sim/alt_xcvr_reconfig/mentor/av_xrbasic_lif_csr.sv
transconfig_sim/alt_xcvr_reconfig/mentor/av_xrbasic_lif.sv
transconfig_sim/alt_xcvr_reconfig/mentor/av_xcvr_reconfig_basic.sv
transconfig_sim/alt_xcvr_reconfig/alt_xcvr_arbiter.sv
transconfig_sim/alt_xcvr_reconfig/alt_xcvr_m2s.sv
transconfig_sim/alt_xcvr_reconfig/altera_wait_generate.v
transconfig_sim/alt_xcvr_reconfig/alt_xcvr_csr_selector.sv
transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_arbiter.sv
transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_m2s.sv
transconfig_sim/alt_xcvr_reconfig/mentor/altera_wait_generate.v
transconfig_sim/alt_xcvr_reconfig/mentor/alt_xcvr_csr_selector.sv
transconfig_sim/alt_xcvr_reconfig/sv_reconfig_bundle_to_basic.sv
transconfig_sim/alt_xcvr_reconfig/mentor/sv_reconfig_bundle_to_basic.sv
transconfig_sim/alt_xcvr_reconfig/av_reconfig_bundle_to_basic.sv
transconfig_sim/alt_xcvr_reconfig/av_reconfig_bundle_to_xcvr.sv
transconfig_sim/alt_xcvr_reconfig/mentor/av_reconfig_bundle_to_basic.sv
transconfig_sim/alt_xcvr_reconfig/mentor/av_reconfig_bundle_to_xcvr.sv
transconfig_sim/alt_xcvr_reconfig/plain_files.txt
transconfig_sim/alt_xcvr_reconfig/mentor_files.txt
transconfig_sim/alt_xcvr_reconfig/cadence_files.txt
transconfig_sim/alt_xcvr_reconfig/synopsys_files.txt
transconfig_sim/alt_xcvr_reconfig/aldec_files.txt

View file

@ -0,0 +1,48 @@
./altera_xcvr_functions.sv
./av_xcvr_h.sv
./alt_xcvr_resync.sv
./alt_xcvr_reconfig_h.sv
./alt_xcvr_reconfig.sv
./alt_xcvr_reconfig_cal_seq.sv
./alt_xreconf_cif.sv
./alt_xreconf_uif.sv
./alt_xreconf_basic_acq.sv
./alt_xcvr_reconfig_analog.sv
./alt_xcvr_reconfig_analog_av.sv
./alt_xreconf_analog_datactrl_av.sv
./alt_xreconf_analog_rmw_av.sv
./alt_xreconf_analog_ctrlsm.sv
./alt_xcvr_reconfig_offset_cancellation.sv
./alt_xcvr_reconfig_offset_cancellation_av.sv
./alt_xcvr_reconfig_eyemon.sv
./alt_xcvr_reconfig_dfe.sv
./alt_xcvr_reconfig_adce.sv
./alt_xcvr_reconfig_dcd.sv
./alt_xcvr_reconfig_dcd_av.sv
./alt_xcvr_reconfig_dcd_cal_av.sv
./alt_xcvr_reconfig_dcd_control_av.sv
./alt_xcvr_reconfig_mif.sv
./av_xcvr_reconfig_mif.sv
./av_xcvr_reconfig_mif_ctrl.sv
./av_xcvr_reconfig_mif_avmm.sv
./alt_xcvr_reconfig_pll.sv
./av_xcvr_reconfig_pll.sv
./av_xcvr_reconfig_pll_ctrl.sv
./alt_xcvr_reconfig_soc.sv
./alt_xcvr_reconfig_cpu_ram.sv
./alt_xcvr_reconfig_direct.sv
./alt_arbiter_acq.sv
./alt_xcvr_reconfig_basic.sv
./av_xrbasic_l2p_addr.sv
./av_xrbasic_l2p_ch.sv
./av_xrbasic_l2p_rom.sv
./av_xrbasic_lif_csr.sv
./av_xrbasic_lif.sv
./av_xcvr_reconfig_basic.sv
./alt_xcvr_arbiter.sv
./alt_xcvr_m2s.sv
./altera_wait_generate.v
./alt_xcvr_csr_selector.sv
./sv_reconfig_bundle_to_basic.sv
./av_reconfig_bundle_to_basic.sv
./av_reconfig_bundle_to_xcvr.sv

View file

@ -0,0 +1,71 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
// Transceiver Reconfiguration Basic Arbiter Acquisition
//
// Client must make request to see grant. While not granted,
// all outputs to basic reconfig block will be gated to '0'
// $Header$
`timescale 1 ps / 1 ps
module alt_arbiter_acq #(
parameter addr_width = 3,
parameter data_width = 32
)
(
input wire clk, // this will be the reconfig clk
input wire reset,
// Internal interface for the bigger controlling module, like analog reconfig
input wire [addr_width-1:0] address, // MM address
input wire [data_width-1:0] writedata,
input wire write,
input wire read,
output reg waitrequest, // can use to tell internal master to wait when auto-request+release
output wire [data_width-1:0] readdata,
// MM master external interface, that connects to mutex-slave, like the reconfig_basic block
output wire [addr_width-1:0] master_address, // MM address
output wire [data_width-1:0] master_writedata,
output wire master_write,
output wire master_read,
input wire master_waitrequest, // needed for a valid master interface
input wire [data_width-1:0] master_readdata, // from mutex-slave
// external connect to switch fabric: request basic access from arbiter
output wire arb_req,
input wire arb_grant,
// internal request from local client: request mutex access and should be held high as long as mutex is used
input wire mutex_req,
output wire mutex_grant
);
wire granted; // true when request is active, and grant is active
assign arb_req = mutex_req; // forward client request to arbiter
assign granted = mutex_req & arb_grant; // only tell client they're granted access to basic is they are requesting
assign mutex_grant = granted;
// basic-block facing: master Avalon interface
assign master_address = address & {addr_width{granted}};
assign master_writedata = writedata & {data_width{granted}};
assign master_write = write & granted;
assign master_read = read & granted;
// internal client facing: slave Avalon interface
assign waitrequest = master_waitrequest | ~granted; // always in wait request if not granted access
assign readdata = master_readdata;
endmodule

View file

@ -0,0 +1,68 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
// Clocked priority encoder with state
//
// On each clock cycle, updates state to show which request is granted.
// Most recent grant holder is always the highest priority.
// If current grant holder is not making a request, while others are,
// then new grant holder is always the requester with lowest bit number.
// If no requests, current grant holder retains grant state
// $Header$
`timescale 1 ns / 1 ns
module alt_xcvr_arbiter #(
parameter width = 2
) (
input wire clock,
input wire [width-1:0] req, // req[n] requests for this cycle
output reg [width-1:0] grant // grant[n] means requester n is grantee in this cycle
);
wire idle; // idle when no requests
wire [width-1:0] keep; // keep[n] means requester n is requesting, and already has the grant
// Note: current grantee is always highest priority for next grant
wire [width-1:0] take; // take[n] means requester n is requesting, and there are no higher-priority requests
assign keep = req & grant; // current grantee is always highest priority for next grant
assign idle = ~| req; // idle when no requests
initial begin
grant = 0;
end
// grant next state depends on current grant and take priority
always @(posedge clock) begin
grant <=
// synthesis translate_off
(grant === {width{1'bx}})? {width{1'b0}} :
// synthesis translate_on
keep // if current grantee is requesting, gets to keep grant
| ({width{idle}} & grant) // if no requests, grant state remains unchanged
| take; // take applies only if current grantee is not requesting
end
// 'take' bus encodes priority. Request with lowest bit number wins when current grantee not requesting
assign take[0] = req[0]
& (~| (keep & ({width{1'b1}} << 1))); // no 'keep' from lower-priority inputs
genvar i;
generate
for (i=1; i < width; i = i + 1) begin : arb
assign take[i] = req[i]
& (~| (keep & ({width{1'b1}} << (i+1)))) // no 'keep' from lower-priority inputs
& (~| (req & {i{1'b1}})); // no 'req' from higher-priority inputs
end
endgenerate
endmodule

View file

@ -0,0 +1,122 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
//
// Select a sub-group from a wide register
// Useful for indirection indexing
//
// $Header$
//
`timescale 1 ns / 1 ns
module csr_mux #(
parameter groups = 2,
parameter grp_size = 1,
parameter sel_size = 1
)
(
input wire [groups*grp_size-1:0] in_wide,
input tri0 [sel_size-1:0] sel,
output wire [grp_size-1:0] out_narrow
);
// lpm_mux #(.lpm_size(groups), .lpm_width(grp_size), .lpm_widths(sel_size))
// mux (.data(in_wide), .sel(sel), .result(out_narrow));
wire [grp_size-1:0] in_groups [groups-1:0];
// a synthesizable mux, with a parameterized number of inputs
genvar i;
assign in_groups[0] = in_wide[grp_size-1:0] & {grp_size{sel == 0}};
generate for (i=1; i<groups; i = i+1) begin: mux
assign in_groups[i] = in_groups[i-1] | in_wide[i*grp_size +: grp_size] & {grp_size{sel == i}};
end
endgenerate
assign out_narrow = in_groups[groups-1];
endmodule
//
// write to a sub-group of a wide register
// Useful for indirection indexing on write
//
module csr_indexed_write_mux #(
parameter groups = 2,
parameter grp_size = 1,
parameter sel_size = 1,
parameter init_value = 0
)
(
input wire [grp_size-1:0] in_narrow,
input tri0 [sel_size-1:0] sel,
output wire [grp_size-1:0] out_narrow, // for read back to mgmt interface
input wire [groups*grp_size-1:0] in_wide, // full-width control reg state
output wire [groups*grp_size-1:0] out_wide // to write to full-width control reg
);
wire [groups*grp_size-1:0] wire_wide [groups-1:0];
// in_narrow is output in the group position indicated by .sel() input
genvar i;
assign wire_wide[0] = (in_wide & {grp_size{sel != 0}}) | (in_narrow & {grp_size{sel == 0}});
generate for (i=1; i<groups; i = i+1) begin: mux
assign wire_wide[i] = wire_wide[i-1]
| (in_wide & {{grp_size{sel != i}}, {(grp_size*i){1'b0}}})
| ({in_narrow & {grp_size{sel == i}}, {(grp_size*i){1'b0}}});
end
endgenerate
assign out_wide = wire_wide[groups-1];
// generate out_narrow as ordinary mux of in_wide
csr_mux #(.groups(groups), .grp_size(grp_size), .sel_size(sel_size))
o_narrow(.in_wide(in_wide), .sel(sel), .out_narrow(out_narrow));
endmodule
//
// read from a sub-group of a wide, async status input
// Creates synchronization logic to sample in local clock domain
// Useful for indirection indexing on read-only status bits
//
module csr_indexed_read_only_reg #(
parameter groups = 2,
parameter grp_size = 1,
parameter sel_size = 1,
parameter sync_stages = 2
)
(
input wire clk,
input tri0 [sel_size-1:0] sel,
output wire [grp_size-1:0] out_narrow, // for read back to mgmt interface
input wire [groups*grp_size-1:0] async_in_wide // full-width async status inputs
);
localparam sync_stages_str = sync_stages[7:0] + 8'd48; // number of sync stages specified as string (for timing constraints)
localparam SYNC_SREG_CONSTRAINT = {"-name SDC_STATEMENT \"set regs [get_registers -nowarn *csr_indexed_read_only_reg*sreg[",sync_stages_str,"]*]; if {[llength [query_collection -report -all $regs]] > 0} {set_false_path -to $regs}\""};
localparam SDC_CONSTRAINTS = {SYNC_SREG_CONSTRAINT};
// read-only status registers are synchronized forms of async status signals
// async inputs go to sreg [sync_stages], and come out synchronized at sreg [1]
// Apply false path timing constraints to synchronization registers.
(* altera_attribute = SDC_CONSTRAINTS *)
reg [groups*grp_size-1:0] sreg [sync_stages:1];
integer stage;
always @(posedge clk) begin
sreg[sync_stages] <= async_in_wide;
for (stage=2; stage <= sync_stages; stage = stage + 1) begin
// additional sync stages
sreg[stage-1] <= sreg[stage];
end
end
// generate out_narrow as ordinary mux of out_wide
csr_mux #(.groups(groups), .grp_size(grp_size), .sel_size(sel_size))
o_narrow(.in_wide(sreg[1]), .sel(sel), .out_narrow(out_narrow));
endmodule

View file

@ -0,0 +1,61 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
// Master-to-slave access fabric
//
// Combined with external multi-master arbitration, this block gates
// master read, write, address, and writedata outputs, and generates
// a waitrequest when arbiter indicates access is not granted
// $Header$
`timescale 1 ns / 1 ns
module alt_xcvr_m2s #(
parameter width_addr = 3,
parameter width_data = 32
) (
input wire clock,
output wire req, // request to arbiter for slave access
input wire grant,
// signals from/to master
input wire m_read,
input wire m_write,
input wire [width_addr-1:0] m_address,
input wire [width_data-1:0] m_writedata,
output wire [width_data-1:0] m_readdata,
output wire m_waitrequest,
// signals from/to slave
output wire s_read,
output wire s_write,
output wire [width_addr-1:0] s_address,
output wire [width_data-1:0] s_writedata,
input wire [width_data-1:0] s_readdata,
input wire s_waitrequest
);
// If master is requesting access, generate waitreq until granted
assign req = m_read | m_write; // master access requests
assign m_waitrequest = grant ? s_waitrequest : req;
// gate outputs to slave with grant signal
assign s_read = m_read & grant;
assign s_write = m_write & grant;
assign s_address = m_address & {width_addr{grant}};
assign s_writedata = m_writedata & {width_data{grant}};
// slave data outputs pass through directly
assign m_readdata = s_readdata;
endmodule

View file

@ -0,0 +1,994 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
// Transceiver Reconfiguration Module
//
// Includes many function-specific sub-modules, such as:
// - analog reconfig (alt_xcvr_reconfig_analog)
// - offset cancellation (alt_xcvr_reconfig_offset_cancellation)
// - ...
// TODO - Add support to read configuration (enabled options)
// $Header$
`timescale 1 ns / 1 ns
module alt_xcvr_reconfig #(
parameter device_family = "Stratix V",
// reconfig blocks to enable or disable
parameter enable_offset = 1, // always need offset cancellation to calibrate buffers
parameter enable_lc = 1, // LC Tuning
parameter enable_dcd = 0, // DCD
parameter enable_dcd_power_up = 1, // 0: manual trigger; 1: manual trigger + auto run upon power up
parameter enable_analog = 0, // manual tuning of buffer analog parameters
parameter enable_eyemon = 0, // EyeQ
parameter enable_ber = 0, //Enables the BER Counter
parameter enable_dfe = 0, // DFE
parameter enable_adce = 0, // ADCE
parameter enable_mif = 0, // MIF streaming
parameter enable_pll = 0, // PLL reconfig
parameter enable_direct = 1, // Direct Basic access
// number of physical reconfig interfaces
parameter number_of_reconfig_interfaces = 1
) (
input wire mgmt_clk_clk,
input wire mgmt_rst_reset,
// user reconfiguration management interface
input wire [6:0] reconfig_mgmt_address,
output wire reconfig_mgmt_waitrequest,
input wire reconfig_mgmt_read,
output wire [31:0] reconfig_mgmt_readdata,
input wire reconfig_mgmt_write,
input wire [31:0] reconfig_mgmt_writedata,
output wire reconfig_busy,
// calibration port
input wire cal_busy_in,
output wire tx_cal_busy,
output wire rx_cal_busy,
//MIF storage interface
output wire [31:0] reconfig_mif_address,
output wire reconfig_mif_read,
input wire reconfig_mif_waitrequest,
input wire [15:0] reconfig_mif_readdata,
// bundled reconfig buses
output wire [altera_xcvr_functions::get_reconfig_to_width(device_family,number_of_reconfig_interfaces) -1:0] reconfig_to_xcvr, // all native xcvr reconfig sinks
input wire [altera_xcvr_functions::get_reconfig_from_width(device_family,number_of_reconfig_interfaces)-1:0] reconfig_from_xcvr // all native xcvr reconfig sources
);
// Enable CMU kickstart IP for Arria V and Cyclone V ES.
localparam l_enable_lc =
`ifdef ALTERA_RESERVED_QIS_ES
`ifndef ALTERA_RESERVED_XCVR_DISABLE_CMU_KICKSTART
(altera_xcvr_functions::has_a5_style_hssi(device_family) || altera_xcvr_functions::has_c5_style_hssi(device_family)) ? 1 :
`endif
`endif
enable_lc;
import alt_xcvr_reconfig_h::*;
// count of the total number of sub-components that can act
// as slaves to the mgmt interface, and masters to the 'basic' block
localparam arb_count = INDEX_XR_END;
// Use CPU for various features
localparam enable_soc_offset = enable_offset ? ((altera_xcvr_functions::has_s5_style_hssi(device_family)) ? 1 : 0) : 0; // use SOC for OC, but only for Stratix V
localparam enable_soc_dcd = enable_dcd ? 0 : 0; // use SOC for DCD
localparam enable_soc_lc = l_enable_lc ? 1 : 0; // use SOC for LC Tuning and CMU kickstart
localparam enable_soc_analog = enable_analog ? 0 : 0; // use SOC for manual tuning of buffer analog parameters
localparam enable_soc_eyemon = enable_eyemon ? 0 : 0; // use SOC for EyeQ
localparam enable_soc_dfe = enable_dfe ? 0 : 0; // use SOC for DFE
localparam enable_soc_adce = enable_adce ? 0 : 0; // use SOC for ADCE
localparam enable_soc_mif = enable_mif ? 0 : 0; // use SOC for MIF streaming
localparam enable_soc_pll = enable_pll ? 0 : 0; // use SOC for PLL reconfig
localparam enable_soc_direct = enable_direct ? 0 : 0; // use SOC for Direct Basic access
// Conditions for enabling the reconfig CPU
localparam [arb_count-1:0] enable_soc_mask
= (enable_soc_offset[arb_count-1:0] << INDEX_XR_OFFSET )
| (enable_soc_dcd [arb_count-1:0] << INDEX_XR_DCD )
| (enable_soc_lc [arb_count-1:0] << INDEX_XR_LC )
| (enable_soc_analog[arb_count-1:0] << INDEX_XR_ANALOG )
| (enable_soc_eyemon[arb_count-1:0] << INDEX_XR_EYEMON )
| (enable_soc_dfe [arb_count-1:0] << INDEX_XR_DFE )
| (enable_soc_adce [arb_count-1:0] << INDEX_XR_ADCE )
| (enable_soc_mif [arb_count-1:0] << INDEX_XR_MIF )
| (enable_soc_pll [arb_count-1:0] << INDEX_XR_PLL )
| (enable_soc_direct[arb_count-1:0] << INDEX_XR_DIRECT );
localparam width_awa = W_XR_FEATURE_LADDR; // word address width of interface to analog reconfig block
localparam width_bwa = W_XR_FEATURE_LADDR; // word address width of interface to basic reconfig block
// decoder block index, for 8-word address blocks
localparam arb_offset = INDEX_XR_OFFSET;
localparam arb_analog = INDEX_XR_ANALOG;
localparam arb_eyemon = INDEX_XR_EYEMON;
localparam arb_dfe = INDEX_XR_DFE;
localparam arb_direct = INDEX_XR_DIRECT;
localparam arb_adce = INDEX_XR_ADCE;
localparam arb_lc = INDEX_XR_LC;
localparam arb_mif = INDEX_XR_MIF;
localparam arb_dcd = INDEX_XR_DCD;
localparam arb_pll = INDEX_XR_PLL;
///////////////////////////////////////////////////////////////////////
// Connections between sub-components and the basic interface (switch)
///////////////////////////////////////////////////////////////////////
// Decoded slave block output ports, mgmt facing
wire [31:0] blk2mgmt_readdata [arb_count-1:0];
wire blk2mgmt_waitrequest [arb_count-1:0];
// CPU -> MGMT connections
wire [31:0] cpu_mgmt_readdata;
wire cpu_mgmt_waitrequest;
wire [arb_count-1:0] cpu_busy;
// Decoded slave block output ports, basic facing (from CPU)
wire cpu_basic_read;
wire cpu_basic_write;
wire [width_bwa-1:0] cpu_basic_address;
wire [31:0] cpu_basic_writedata;
wire [arb_count-1:0] cpu_basic_req;
// Decoded slave block output ports, basic facing
wire blk2basic_read [arb_count-1:0];
wire blk2basic_write [arb_count-1:0];
wire [width_bwa-1:0] blk2basic_address [arb_count-1:0];
wire [31:0] blk2basic_writedata [arb_count-1:0];
// master interface to basic reconfiguration block that interfaces to the transceiver channel
wire [width_bwa-1:0] basic_address;
wire basic_waitrequest;
wire basic_irq;
wire basic_read;
wire [31:0] basic_readdata;
wire basic_write;
wire [31:0] basic_writedata;
// native testbus interfaces: to logical interface:
wire [7:0] lch_testbus; // testbus from native reconfig, for selected channel, from basic block
wire [23:0] pch_testbus; // triplet testbus
wire lch_atbout;
// gate soft-IPs from running by holding off logical mutex until interface select is done
wire ifsel_notdone;
reg ifsel_notdone_resync;
wire reconfig_subblock_reset;
///////////////////////////////////////////////////////////////////////
// Decoder for multiple slaves of reconfig_mgmt interface
///////////////////////////////////////////////////////////////////////
wire [arb_count-1:0] r_decode;
// intermediate wires for mgmt readdata and waitrequest muxes
wire [31:0] wmgmt_readdata [arb_count-1:0];
wire wmgmt_waitrequest [arb_count-1:0];
// intermediate wires for basic read, write, address, and writedata OR's
wire [width_bwa-1:0] wbasic_address [arb_count-1:0]; // basic.address
wire wbasic_read [arb_count-1:0]; // .read
wire wbasic_write [arb_count-1:0]; // .write
wire [31:0] wbasic_writedata [arb_count-1:0]; // .writedata
// interconnection between PLL and MIF IP
wire pll_mif_busy;
wire pll_mif_err;
wire mif_pll_go;
wire mif_pll_type;
wire [9:0] mif_pll_lch;
wire [3:0] mif_pll_data;
wire mif_pll_pll_type;
// Busy and done signals for each feature IP
wire [arb_count-1:0] busy;
wire [arb_count-1:0] done;
wire [arb_count-1:0] hold;
wire oc_cal_busy;
wire cpu_unused; //dummy wire for warning reduction
// prevent warnings
assign cpu_unused = & {1'b0,cpu_basic_address,cpu_mgmt_readdata,cpu_mgmt_waitrequest,cpu_basic_read,
cpu_basic_writedata,cpu_basic_write,cpu_busy,cpu_basic_req};
wire r_mgmt_rst_reset;
//////////////////////////////////////////////////////////////////////////////////////
// Synchronize the reset
// This is a data synchronizer; ensures synchronous assertion and deassertion
// NOTE: This is different from reset synchronizer; reset synchronizer only ensures
// synchronous deassertion.
//////////////////////////////////////////////////////////////////////////////////////
alt_xcvr_resync #(
.INIT_VALUE (1)
) inst_reconfig_reset_sync (
.clk (mgmt_clk_clk ),
.reset (1'd0 ),
.d (mgmt_rst_reset ),
.q (r_mgmt_rst_reset )
);
genvar i;
generate for (i=0; i<arb_count; i = i+1) begin: dec
// a synthesizable decoder, with a parameterized number of outputs
assign r_decode[i] = (reconfig_mgmt_address[6:width_awa] == i);
// reconfig_mgmt output generation is muxing of decoded slave output
// basic block input generation is OR-ing of blk2basic outputs
if (i == 0) begin
assign wmgmt_readdata[0] = blk2mgmt_readdata[0] & {32{r_decode[0]}};
assign wmgmt_waitrequest[0] = blk2mgmt_waitrequest[0] & r_decode[0];
assign wbasic_address[i] = blk2basic_address[i];
assign wbasic_read[i] = blk2basic_read[i];
assign wbasic_write[i] = blk2basic_write[i];
assign wbasic_writedata[i] = blk2basic_writedata[i];
end
else begin
assign wmgmt_readdata[i] = wmgmt_readdata[i-1] | blk2mgmt_readdata[i] & {32{r_decode[i]}};
assign wmgmt_waitrequest[i] = wmgmt_waitrequest[i-1] | blk2mgmt_waitrequest[i] & r_decode[i];
assign wbasic_address[i] = wbasic_address[i-1] | blk2basic_address[i];
assign wbasic_read[i] = wbasic_read[i-1] | blk2basic_read[i];
assign wbasic_write[i] = wbasic_write[i-1] | blk2basic_write[i];
assign wbasic_writedata[i] = wbasic_writedata[i-1] | blk2basic_writedata[i];
end
end
endgenerate
//use bit 8 as the combined busy bit for the user
assign reconfig_mgmt_readdata = (reconfig_mgmt_address[width_awa-1:0] == XR_STATUS_OFST) ?
wmgmt_readdata[arb_count-1] | (reconfig_busy << XR_STATUS_OFST_COMB_BUSY) :
wmgmt_readdata[arb_count-1];
//assign reconfig_mgmt_readdata = wmgmt_readdata[arb_count-1];
assign reconfig_mgmt_waitrequest = wmgmt_waitrequest[arb_count-1];
assign basic_address = wbasic_address[arb_count-1];
assign basic_read = wbasic_read[arb_count-1];
assign basic_write = wbasic_write[arb_count-1];
assign basic_writedata = wbasic_writedata[arb_count-1];
///////////////////////////////////////////////////////////////////////
// Arbiter for multiple masters accessing 'basic' reconfig slave port
///////////////////////////////////////////////////////////////////////
wire [arb_count-1:0] req; // req[0] is highest priority when current grantee is done
wire [arb_count-1:0] temp_grant;
wire [arb_count-1:0] grant;
reg [arb_count-1:0] reg_grant_last;
wire lif_is_active; // indicates at least 1 request & grant pair present. Must go low 1 cycle on grant change
// -ifsel_done indicates that serial shift load is completed and interface_select has be switched over to enable DPRIO access
// -if serial shift load is not done, then grant should remain '0'
assign grant = temp_grant;
// generate lif_is_active low when no request, or in cycle after grant change
assign lif_is_active = ( | req) & (grant == reg_grant_last);
alt_xcvr_arbiter #(
.width(arb_count) // count total number of sub-components that act as masters to 'basic'
) arbiter (
.clock(mgmt_clk_clk),
.req(req),
.grant(temp_grant)
);
// grant last state, for change detection
always @(posedge mgmt_clk_clk or posedge r_mgmt_rst_reset) begin
if (r_mgmt_rst_reset == 1)
reg_grant_last <= {arb_count{1'b0}};
else
reg_grant_last <= grant | cpu_unused; // cpu_unused is always 1'b0, but is used as warning reduction
end
///////////////////////////////////////////
// Sub-component: offset cancellation
// word address offset: +0 (0x00 in bytes)
///////////////////////////////////////////
generate if (enable_offset && !enable_soc_offset) begin:offset
assign busy[arb_offset] = ~done[arb_offset];
alt_xcvr_reconfig_offset_cancellation #(
.number_of_reconfig_interfaces(number_of_reconfig_interfaces),
.device_family(device_family)
) sc_offset (
.reconfig_clk(mgmt_clk_clk),
.reset(reconfig_subblock_reset),
// external mgmt interface facing
.offset_cancellation_address (reconfig_mgmt_address[2:0]),
.offset_cancellation_writedata (reconfig_mgmt_writedata),
.offset_cancellation_write (reconfig_mgmt_write & r_decode[arb_offset]),
.offset_cancellation_read (reconfig_mgmt_read & r_decode[arb_offset]),
.offset_cancellation_readdata (blk2mgmt_readdata[arb_offset]),
.offset_cancellation_waitrequest(blk2mgmt_waitrequest[arb_offset]),
.offset_cancellation_done (done[arb_offset]),
.testbus_data ({number_of_reconfig_interfaces{16'd0}} | lch_testbus[7:0]),
// master-to-slave fabric facing, to basic reconfig
.offset_cancellation_irq_from_base(),
.offset_cancellation_waitrequest_from_base(basic_waitrequest),
.offset_cancellation_readdata_base (basic_readdata),
.offset_cancellation_address_base (blk2basic_address [arb_offset]),
.offset_cancellation_writedata_base (blk2basic_writedata[arb_offset]),
.offset_cancellation_write_base (blk2basic_write [arb_offset]),
.offset_cancellation_read_base (blk2basic_read [arb_offset]),
// fabric acquisition for basic block access
.arb_req (req[arb_offset]),
.arb_grant(grant[arb_offset])
);
end else if (enable_offset && enable_soc_offset) begin:soc_offset
// Use soft offset cancellation block
// CPU <-> MGMT connections
assign blk2mgmt_readdata [arb_offset] = cpu_mgmt_readdata;
assign blk2mgmt_waitrequest[arb_offset] = cpu_mgmt_waitrequest;
// CPU <-> Basic connections
assign blk2basic_address [arb_offset] = cpu_basic_address;
assign blk2basic_writedata [arb_offset] = cpu_basic_writedata;
assign blk2basic_write [arb_offset] = cpu_basic_write;
assign blk2basic_read [arb_offset] = cpu_basic_read;
assign req [arb_offset] = cpu_basic_req[arb_offset];
assign busy [arb_offset] = cpu_busy[arb_offset];
assign done [arb_offset] = ~busy[arb_offset];
end else begin:no_offset
// plceholders for missing block
assign blk2mgmt_readdata [arb_offset] = 32'd0;
assign blk2mgmt_waitrequest [arb_offset] = 1'b0;
assign blk2basic_address [arb_offset] = {width_bwa{1'b0}};
assign blk2basic_writedata [arb_offset] = 32'd0;
assign blk2basic_write [arb_offset] = 1'b0;
assign blk2basic_read [arb_offset] = 1'b0;
assign req [arb_offset] = 1'b0;
assign busy [arb_offset] = 1'b0;
assign done [arb_offset] = ~busy[arb_offset];
end
endgenerate
////////////////////////////////////
// Sub-component: analog controls
// word address offset: +8
////////////////////////////////////
generate if (enable_analog && !enable_soc_analog) begin:analog
// Use hard analog block
assign busy[arb_analog] = ~done[arb_analog];
alt_xcvr_reconfig_analog #(
.device_family(device_family)
) sc_analog (
.reconfig_clk(mgmt_clk_clk),
.reset(reconfig_subblock_reset),
// external mgmt interface facing
.analog_reconfig_address (reconfig_mgmt_address[width_awa-1:0]),
.analog_reconfig_writedata (reconfig_mgmt_writedata),
.analog_reconfig_write (reconfig_mgmt_write & r_decode[arb_analog]),
.analog_reconfig_read (reconfig_mgmt_read & r_decode[arb_analog]),
.analog_reconfig_readdata (blk2mgmt_readdata[arb_analog]),
.analog_reconfig_waitrequest(blk2mgmt_waitrequest[arb_analog]),
.analog_reconfig_done (done[arb_analog]),
// master-to-slave fabric facing, to basic reconfig
.analog_reconfig_irq_from_base(),
.analog_reconfig_waitrequest_from_base(basic_waitrequest),
.analog_reconfig_readdata_base (basic_readdata),
.analog_reconfig_address_base (blk2basic_address [arb_analog]),
.analog_reconfig_writedata_base (blk2basic_writedata[arb_analog]),
.analog_reconfig_write_base (blk2basic_write [arb_analog]),
.analog_reconfig_read_base (blk2basic_read [arb_analog]),
// fabric acquisition for basic block access
.arb_req (req[arb_analog]),
.arb_grant(grant[arb_analog])
);
end else if(enable_analog && enable_soc_analog) begin:soc_analog
// Use soft analog block
// CPU <-> MGMT connections
assign blk2mgmt_readdata [arb_analog] = cpu_mgmt_readdata;
assign blk2mgmt_waitrequest[arb_analog] = cpu_mgmt_waitrequest;
// CPU <-> Basic connections
assign blk2basic_address [arb_analog] = cpu_basic_address;
assign blk2basic_writedata [arb_analog] = cpu_basic_writedata;
assign blk2basic_write [arb_analog] = cpu_basic_write;
assign blk2basic_read [arb_analog] = cpu_basic_read;
assign req [arb_analog] = cpu_basic_req[arb_analog];
assign busy [arb_analog] = cpu_busy[arb_analog];
assign done [arb_analog] = ~busy[arb_analog];
end else begin:no_analog
// Disable analog block
assign blk2mgmt_readdata [arb_analog] = 32'd0;
assign blk2mgmt_waitrequest [arb_analog] = 1'b0;
assign blk2basic_address [arb_analog] = {width_bwa{1'b0}};
assign blk2basic_writedata [arb_analog] = 32'd0;
assign blk2basic_write [arb_analog] = 1'b0;
assign blk2basic_read [arb_analog] = 1'b0;
assign req [arb_analog] = 1'b0;
assign busy [arb_analog] = 1'b0;
assign done [arb_analog] = ~busy[arb_analog];
end
endgenerate
///////////////////////////////////////////
// Sub-component: "EyeQ" eye monitor
// word address offset: +16
///////////////////////////////////////////
generate if (enable_eyemon) begin:eyemon
assign busy[arb_eyemon] = ~done[arb_eyemon];
alt_xcvr_reconfig_eyemon #(
.number_of_reconfig_interfaces (number_of_reconfig_interfaces),
.enable_ber_counter (enable_ber),
.device_family (device_family)
) sc_eyemon (
.reconfig_clk (mgmt_clk_clk),
.reset (reconfig_subblock_reset),
// external mgmt interface facing
.eyemon_address (reconfig_mgmt_address[2:0]),
.eyemon_writedata (reconfig_mgmt_writedata),
.eyemon_write (reconfig_mgmt_write & r_decode[arb_eyemon]),
.eyemon_read (reconfig_mgmt_read & r_decode[arb_eyemon]),
.eyemon_readdata (blk2mgmt_readdata[arb_eyemon]),
.eyemon_waitrequest (blk2mgmt_waitrequest[arb_eyemon]),
.eyemon_done (done[arb_eyemon]),
// master-to-slave fabric facing, to basic reconfig
.eyemon_waitrequest_from_base (basic_waitrequest),
.eyemon_readdata_base (basic_readdata),
.eyemon_address_base (blk2basic_address [arb_eyemon]),
.eyemon_writedata_base (blk2basic_writedata[arb_eyemon]),
.eyemon_write_base (blk2basic_write [arb_eyemon]),
.eyemon_read_base (blk2basic_read [arb_eyemon]),
.eyemon_irq_from_base (),
// fabric acquisition for basic block access
.arb_req (req[arb_eyemon]),
.arb_grant (grant[arb_eyemon]),
//testbus
.eyemon_testbus (lch_testbus)
);
end
else begin:no_eyemon
// placeholders for missing block
assign blk2mgmt_readdata [arb_eyemon] = 32'd0;
assign blk2mgmt_waitrequest[arb_eyemon] = 1'b0;
assign blk2basic_address [arb_eyemon] = {width_bwa{1'b0}};
assign blk2basic_writedata[arb_eyemon] = 32'd0;
assign blk2basic_write [arb_eyemon] = 1'b0;
assign blk2basic_read [arb_eyemon] = 1'b0;
assign req [arb_eyemon] = 1'b0;
assign busy [arb_eyemon] = 1'b0;
assign done [arb_eyemon] = ~busy[arb_eyemon];
end
endgenerate
///////////////////////////////////////////
// Sub-component: DFE
// word address offset: +24
///////////////////////////////////////////
// DFE controls 'done' signal, mainly for S4 legacy
generate if (enable_dfe) begin:dfe
assign busy[arb_dfe] = ~done[arb_dfe];
alt_xcvr_reconfig_dfe #(
.number_of_reconfig_interfaces (number_of_reconfig_interfaces),
.device_family (device_family)
) sc_dfe (
.reconfig_clk (mgmt_clk_clk),
.reset (reconfig_subblock_reset),
.hold (hold[arb_dfe]),
// external mgmt interface facing
.dfe_address (reconfig_mgmt_address[2:0]),
.dfe_writedata (reconfig_mgmt_writedata),
.dfe_write (reconfig_mgmt_write & r_decode[arb_dfe]),
.dfe_read (reconfig_mgmt_read & r_decode[arb_dfe]),
.dfe_readdata (blk2mgmt_readdata[arb_dfe]),
.dfe_waitrequest (blk2mgmt_waitrequest[arb_dfe]),
.dfe_done (done[arb_dfe]),
// master-to-slave fabric facing, to basic reconfig
.dfe_waitrequest_from_base (basic_waitrequest),
.dfe_readdata_base (basic_readdata),
.dfe_address_base (blk2basic_address [arb_dfe]),
.dfe_writedata_base (blk2basic_writedata[arb_dfe]),
.dfe_write_base (blk2basic_write [arb_dfe]),
.dfe_read_base (blk2basic_read [arb_dfe]),
.dfe_irq_from_base(),
// fabric acquisition for basic block access
.arb_req (req[arb_dfe]),
.arb_grant (grant[arb_dfe]),
// testbus
.dfe_testbus (lch_testbus)
);
end
else begin:no_dfe
// placeholders for missing block
assign blk2mgmt_readdata [arb_dfe] = 32'd0;
assign blk2mgmt_waitrequest[arb_dfe] = 1'b0;
assign blk2basic_address [arb_dfe] = {width_bwa{1'b0}};
assign blk2basic_writedata[arb_dfe] = 32'd0;
assign blk2basic_write [arb_dfe] = 1'b0;
assign blk2basic_read [arb_dfe] = 1'b0;
assign req [arb_dfe] = 1'b0;
assign busy [arb_dfe] = 1'b0;
assign done [arb_dfe] = ~busy[arb_dfe];
end
endgenerate
///////////////////////////////////////////
// Sub-component: direct access
// word address offset: +32
///////////////////////////////////////////
assign busy[arb_direct] = 1'b0;
assign done[arb_direct] = ~busy[arb_direct];
generate
if (enable_direct) begin:direct
alt_xcvr_reconfig_direct #(
.device_family(device_family)
) sc_direct (
.clk(mgmt_clk_clk),
.reset(reconfig_subblock_reset),
// external mgmt interface facing
.address (reconfig_mgmt_address[2:0]),
.writedata (reconfig_mgmt_writedata),
.write (reconfig_mgmt_write & r_decode[arb_direct]),
.read (reconfig_mgmt_read & r_decode[arb_direct]),
.readdata (blk2mgmt_readdata[arb_direct]),
.waitrequest(blk2mgmt_waitrequest[arb_direct]),
// master-to-slave fabric facing, to basic reconfig
.basic_waitrequest(basic_waitrequest),
.basic_readdata (basic_readdata),
.basic_address (blk2basic_address [arb_direct]),
.basic_writedata (blk2basic_writedata[arb_direct]),
.basic_write (blk2basic_write [arb_direct]),
.basic_read (blk2basic_read [arb_direct]),
// fabric acquisition for basic block access
.arb_req (req[arb_direct]),
.arb_grant(grant[arb_direct])
);
end
else begin:no_direct
// placeholders for missing block
assign req[arb_direct] = 1'b0;
assign blk2mgmt_readdata [arb_direct] = 32'd0;
assign blk2mgmt_waitrequest[arb_direct] = 1'b0;
assign blk2basic_address [arb_direct] = {width_bwa{1'b0}};
assign blk2basic_writedata[arb_direct] = 32'd0;
assign blk2basic_write [arb_direct] = 1'b0;
assign blk2basic_read [arb_direct] = 1'b0;
end
endgenerate
///////////////////////////////////////////
// Sub-component: ADCE
// word address offset: +40 (0x28)
///////////////////////////////////////////
generate
if (enable_adce) begin:adce
assign busy[arb_adce]= ~done[arb_adce];
alt_xcvr_reconfig_adce
#(
.number_of_reconfig_interfaces ( number_of_reconfig_interfaces ),
.device_family ( device_family )
) sc_adce
(
.reconfig_clk ( mgmt_clk_clk ),
.reset ( reconfig_subblock_reset ),
.hold ( hold[arb_adce] ),
// external mgmt interface facing
.adce_address ( reconfig_mgmt_address[ 2:0 ] ),
.adce_writedata ( reconfig_mgmt_writedata),
.adce_write ( reconfig_mgmt_write & r_decode[ arb_adce ] ),
.adce_read ( reconfig_mgmt_read & r_decode[ arb_adce ] ),
.adce_readdata ( blk2mgmt_readdata [ arb_adce ] ),
.adce_waitrequest ( blk2mgmt_waitrequest[ arb_adce ] ),
.adce_done ( done[arb_adce] ),
// master-to-slave fabric facing, to basic reconfig
.adce_b_waitrequest ( basic_waitrequest ),
.adce_b_readdata ( basic_readdata ),
.adce_b_address ( blk2basic_address [ arb_adce ] ),
.adce_b_writedata ( blk2basic_writedata[ arb_adce ] ),
.adce_b_write ( blk2basic_write [ arb_adce ] ),
.adce_b_read ( blk2basic_read [ arb_adce ] ),
.adce_b_irq ( ),
// fabric acquisition for basic block access
.adce_b_arb_req ( req[ arb_adce ] ),
.adce_b_arb_grant ( grant[ arb_adce ] ),
// testbus
.adce_testbus ( lch_testbus )
);
end else begin:no_adce
// placeholders for missing block
assign blk2mgmt_readdata [arb_adce] = 32'd0;
assign blk2mgmt_waitrequest [arb_adce] = 1'b0;
assign blk2basic_address [arb_adce] = {width_bwa{1'b0}};
assign blk2basic_writedata [arb_adce] = 32'd0;
assign blk2basic_write [arb_adce] = 1'b0;
assign blk2basic_read [arb_adce] = 1'b0;
assign req [arb_adce] = 1'b0;
assign busy [arb_adce] = 1'b0;
assign done [arb_adce] = ~busy[arb_adce];
end
endgenerate
///////////////////////////////////////////
// Sub-component: DCD
// word address offset: +72
///////////////////////////////////////////
generate if (enable_dcd) begin:dcd
assign busy[arb_dcd] = ~done[arb_dcd];
alt_xcvr_reconfig_dcd #(
.number_of_reconfig_interfaces (number_of_reconfig_interfaces),
.enable_dcd_power_up(enable_dcd_power_up),
.device_family (device_family)
) sc_dcd (
.reconfig_clk (mgmt_clk_clk),
.reset (reconfig_subblock_reset),
.hold (hold[arb_dcd]),
// ATB comparator output for Arria V
.lch_atbout (lch_atbout),
// external mgmt interface facing
.dcd_address (reconfig_mgmt_address[2:0]),
.dcd_writedata (reconfig_mgmt_writedata),
.dcd_write (reconfig_mgmt_write & r_decode[arb_dcd]),
.dcd_read (reconfig_mgmt_read & r_decode[arb_dcd]),
.dcd_readdata (blk2mgmt_readdata[arb_dcd]),
.dcd_waitrequest (blk2mgmt_waitrequest[arb_dcd]),
.dcd_done (done[arb_dcd]),
// master-to-slave fabric facing, to basic reconfig
.dcd_waitrequest_from_base (basic_waitrequest),
.dcd_readdata_base (basic_readdata),
.dcd_address_base (blk2basic_address [arb_dcd]),
.dcd_writedata_base (blk2basic_writedata[arb_dcd]),
.dcd_write_base (blk2basic_write [arb_dcd]),
.dcd_read_base (blk2basic_read [arb_dcd]),
.dcd_irq_from_base(),
// fabric acquisition for basic block access
.arb_req (req[arb_dcd]),
.arb_grant (grant[arb_dcd])
);
end
else begin:no_dcd
// placeholders for missing block
assign blk2mgmt_readdata [arb_dcd] = 32'd0;
assign blk2mgmt_waitrequest[arb_dcd] = 1'b0;
assign blk2basic_address [arb_dcd] = {width_bwa{1'b0}};
assign blk2basic_writedata[arb_dcd] = 32'd0;
assign blk2basic_write [arb_dcd] = 1'b0;
assign blk2basic_read [arb_dcd] = 1'b0;
assign req [arb_dcd] = 1'b0;
assign busy [arb_dcd] = 1'b0;
assign done [arb_dcd] = ~busy[arb_dcd];
end
endgenerate
//*************************************************************************
//***************************** LC PLL Tuning *****************************
assign done[arb_lc] = ~busy[arb_lc];
generate if(l_enable_lc == 1) begin:lc
// CPU <-> MGMT connections
assign blk2mgmt_readdata [arb_lc] = cpu_mgmt_readdata;
assign blk2mgmt_waitrequest[arb_lc] = cpu_mgmt_waitrequest;
// CPU <-> Basic connections
assign blk2basic_address [arb_lc] = cpu_basic_address;
assign blk2basic_writedata [arb_lc] = cpu_basic_writedata;
assign blk2basic_write [arb_lc] = cpu_basic_write;
assign blk2basic_read [arb_lc] = cpu_basic_read;
assign req [arb_lc] = cpu_basic_req[arb_lc];
assign busy [arb_lc] = cpu_busy[arb_lc];
end else begin:no_lc
assign blk2mgmt_readdata [arb_lc] = 32'd0;
assign blk2mgmt_waitrequest [arb_lc] = 1'b0;
assign blk2basic_address [arb_lc] = {width_bwa{1'b0}};
assign blk2basic_writedata [arb_lc] = 32'd0;
assign blk2basic_write [arb_lc] = 1'b0;
assign blk2basic_read [arb_lc] = 1'b0;
assign req [arb_lc] = 1'b0;
assign busy [arb_lc] = 1'b0;
end
endgenerate
//*************************** End LC PLL Tuning ***************************
//*************************************************************************
//*************************************************************************
//***************************** MIF Streamer ******************************
generate if(enable_mif == 1) begin:mif
assign busy[arb_mif] = ~done[arb_mif];
alt_xcvr_reconfig_mif #(
.device_family ( device_family ),
.enable_mif ( enable_mif )
) sc_mif (
//User interface
.reconfig_clk ( mgmt_clk_clk ),
.reset ( reconfig_subblock_reset ),
.mif_reconfig_address ( reconfig_mgmt_address[2:0] ),
.mif_reconfig_writedata ( reconfig_mgmt_writedata ),
.mif_reconfig_write ( reconfig_mgmt_write & r_decode[arb_mif] ),
.mif_reconfig_read ( reconfig_mgmt_read & r_decode[arb_mif] ),
.mif_reconfig_readdata ( blk2mgmt_readdata[arb_mif] ),
.mif_reconfig_waitrequest ( blk2mgmt_waitrequest[arb_mif] ),
.mif_reconfig_done ( done[arb_mif] ),
//PLL reconfig interface
.mif_pll_busy ( pll_mif_busy ),
.mif_pll_err ( pll_mif_err ),
.mif_pll_go ( mif_pll_go ),
.mif_pll_type ( mif_pll_type ),
.mif_pll_lch ( mif_pll_lch ),
.mif_pll_data ( mif_pll_data ),
.mif_pll_pll_type ( mif_pll_pll_type),
//MIF storage interface
.mif_stream_address ( reconfig_mif_address ),
.mif_stream_read ( reconfig_mif_read ),
.mif_stream_waitrequest ( reconfig_mif_waitrequest ),
.mif_stream_readdata ( reconfig_mif_readdata ),
//Basic interface
.mif_base_address ( blk2basic_address[arb_mif] ),
.mif_base_writedata ( blk2basic_writedata[arb_mif] ),
.mif_base_write ( blk2basic_write[arb_mif] ),
.mif_base_read ( blk2basic_read[arb_mif] ),
.mif_base_readdata ( basic_readdata ),
.mif_base_waitrequest ( basic_waitrequest ),
.mif_base_irq ( 1'd0 ), //unused
//arbiter
.arb_req (req[arb_mif] ),
.arb_grant (grant[arb_mif] )
);
end else begin:no_mif
wire mif_unused;
assign blk2mgmt_readdata [arb_mif] = 32'd0;
assign blk2mgmt_waitrequest [arb_mif] = 1'b0;
assign blk2basic_address [arb_mif] = {width_bwa{1'b0}};
assign blk2basic_writedata [arb_mif] = 32'd0;
assign blk2basic_write [arb_mif] = 1'b0;
assign blk2basic_read [arb_mif] = 1'b0;
assign req [arb_mif] = 1'b0;
assign busy [arb_mif] = 1'b0 | mif_unused;
assign done [arb_mif] = ~busy[arb_mif];
assign reconfig_mif_read = 1'b0;
assign reconfig_mif_address = 32'd0;
assign mif_pll_go = 1'b0;
assign mif_pll_type = 1'b0;
assign mif_pll_lch = 10'd0;
assign mif_pll_data = 4'd0;
assign mif_pll_pll_type = 1'b0;
// prevent warnings
assign mif_unused = & {1'b0,mif_pll_pll_type,mif_pll_data,mif_pll_lch,mif_pll_type,mif_pll_go};
end
endgenerate
//*************************** End MIF Streamer ****************************
//*************************************************************************
//*************************************************************************
//***************************** PLL Reconfig ******************************
generate if(enable_pll == 1 || enable_mif == 1) begin:pll
assign busy[arb_pll] = ~done[arb_pll];
alt_xcvr_reconfig_pll #(
.device_family ( device_family )
) sc_pll (
//User interface
.reconfig_clk ( mgmt_clk_clk ),
.reset ( reconfig_subblock_reset ),
.pll_reconfig_address ( reconfig_mgmt_address[2:0] ),
.pll_reconfig_writedata ( reconfig_mgmt_writedata ),
.pll_reconfig_write ( reconfig_mgmt_write & r_decode[arb_pll] ),
.pll_reconfig_read ( reconfig_mgmt_read & r_decode[arb_pll] ),
.pll_reconfig_readdata ( blk2mgmt_readdata[arb_pll] ),
.pll_reconfig_waitrequest ( blk2mgmt_waitrequest[arb_pll] ),
.pll_reconfig_done ( done[arb_pll] ),
//MIF interface
.pll_mif_busy ( pll_mif_busy ),
.pll_mif_err ( pll_mif_err ),
.pll_mif_go ( mif_pll_go ),
.pll_mif_type ( mif_pll_type ),
.pll_mif_lch ( mif_pll_lch ),
.pll_mif_data ( mif_pll_data ),
.pll_mif_pll_type ( mif_pll_pll_type),
//Basic interface
.pll_base_address ( blk2basic_address[arb_pll] ),
.pll_base_writedata ( blk2basic_writedata[arb_pll] ),
.pll_base_write ( blk2basic_write[arb_pll] ),
.pll_base_read ( blk2basic_read[arb_pll] ),
.pll_base_readdata ( basic_readdata ),
.pll_base_waitrequest ( basic_waitrequest ),
// .pll_base_irq ( 1'd0 ), //unused
//arbiter
.arb_req (req[arb_pll] ),
.arb_grant (grant[arb_pll] )
);
end else begin:no_pll
wire pll_unused;
assign blk2mgmt_readdata [arb_pll] = 32'd0;
assign blk2mgmt_waitrequest [arb_pll] = 1'b0;
assign blk2basic_address [arb_pll] = {width_bwa{1'b0}};
assign blk2basic_writedata [arb_pll] = 32'd0;
assign blk2basic_write [arb_pll] = 1'b0;
assign blk2basic_read [arb_pll] = 1'b0;
assign req [arb_pll] = 1'b0;
assign busy [arb_pll] = 1'b0 | pll_unused;
assign done [arb_pll] = ~busy[arb_pll];
assign pll_mif_busy = 1'b0;
assign pll_mif_err = 1'b0;
// prevent warnings
assign pll_unused = & {1'b0,pll_mif_err,pll_mif_busy};
end
endgenerate
//*************************** End PLL Reconfig ****************************
//*************************************************************************
//*************************************************************************
//**************************** Reconfig CPU *******************************
generate if(enable_soc_mask != 0) begin:soc
wire [arb_count-1:0] cpu_decode;
assign cpu_decode = r_decode & enable_soc_mask;
alt_xcvr_reconfig_soc #(
.device_family (device_family),
.arb_count (arb_count ),
.width_awa (width_awa ),
.width_bwa (width_bwa ),
.number_of_reconfig_interfaces(number_of_reconfig_interfaces),
.enable_soc_mask(enable_soc_mask)
) sc_soc(
// user reconfiguration management interface
.mgmt_clk (mgmt_clk_clk ),
.mgmt_rst (reconfig_subblock_reset),
.mgmt_address (reconfig_mgmt_address ),
.mgmt_read (reconfig_mgmt_read ),
.mgmt_write (reconfig_mgmt_write ),
.mgmt_writedata (reconfig_mgmt_writedata),
.mgmt_readdata (cpu_mgmt_readdata ),
.mgmt_waitrequest (cpu_mgmt_waitrequest ),
.mgmt_decode (cpu_decode ),
.hold (hold ),
.busy (cpu_busy ),
.hard_busy (busy ),
// CPU <-> Basic interface
.basic_address (cpu_basic_address ),
.basic_writedata (cpu_basic_writedata ),
.basic_write (cpu_basic_write ),
.basic_read (cpu_basic_read ),
.basic_readdata (basic_readdata ),
.basic_waitrequest(basic_waitrequest ),
.basic_req (cpu_basic_req ), // request access to B block
.basic_grant (grant ), // granted access to B block
// Testbus
.lch_testbus (lch_testbus ),
.pch_testbus (pch_testbus )
);
end else begin:no_soc // No CPU
assign cpu_mgmt_readdata = 32'd0;
assign cpu_mgmt_waitrequest = 1'b0;
assign cpu_basic_read = 1'b0;
assign cpu_basic_write = 1'b0;
assign cpu_basic_address = {width_bwa{1'b0}};
assign cpu_basic_writedata = 32'd0;
assign cpu_basic_req = {arb_count{1'b0}};
assign cpu_busy = {arb_count{1'b0}};
end
endgenerate
//**************************** Reconfig CPU *******************************
//*************************************************************************
////////////////////////////////////////////////////////////////////
// Calibration Start-up sequencing control and coordination
////////////////////////////////////////////////////////////////////
alt_xcvr_reconfig_cal_seq #(
.arb_count(arb_count)
)
cal_seq (
.reconfig_clk (mgmt_clk_clk),
.reset (reconfig_subblock_reset),
.busy (busy ),
.cal_busy_in (cal_busy_in),
// user reconfiguration management interface
.hold (hold ),
.reconfig_busy (reconfig_busy ),
.tx_cal_busy (tx_cal_busy ),
.rx_cal_busy (rx_cal_busy ),
.oc_cal_busy (oc_cal_busy )
);
////////////////////////////////////////////////////////////////////
// The basic block is a switch and interface to the native reconfig
////////////////////////////////////////////////////////////////////
alt_xcvr_reconfig_basic #(
.basic_ifs(1),
.native_ifs(number_of_reconfig_interfaces),
.device_family(device_family)
) basic (
.reconfig_clk(mgmt_clk_clk),
.reset(r_mgmt_rst_reset),
.lif_is_active(lif_is_active),
.oc_cal_busy(oc_cal_busy),
.tx_cal_busy(tx_cal_busy),
.rx_cal_busy(rx_cal_busy),
.reconfig_to_xcvr(reconfig_to_xcvr),
.reconfig_from_xcvr(reconfig_from_xcvr),
.basic_reconfig_write(basic_write),
.basic_reconfig_read(basic_read),
.basic_reconfig_writedata(basic_writedata),
.basic_reconfig_address(basic_address),
.basic_reconfig_readdata(basic_readdata),
.basic_reconfig_waitrequest(basic_waitrequest),
.ifsel_notdone(ifsel_notdone),
.lch_testbus(lch_testbus),
.pch_testbus(pch_testbus),
.lch_atbout(lch_atbout)
//.basic_reconfig_irq(basic_reconfig_irq)
);
///////////////////////////////////////////
// Status to external mgmt interface
///////////////////////////////////////////
// assign reconfig_busy = |busy;
//////////////////////////////////////////////////////////////////////////////////////
// Synchronize the ifsel_notdone into each Reconfig IP block
//////////////////////////////////////////////////////////////////////////////////////
always @(posedge mgmt_clk_clk or posedge r_mgmt_rst_reset) begin
if (r_mgmt_rst_reset == 1)
ifsel_notdone_resync <= 1'b1;
else
ifsel_notdone_resync <= ifsel_notdone;
end
assign reconfig_subblock_reset = ifsel_notdone_resync;
endmodule

View file

@ -0,0 +1,111 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
// $Header: //acds/rel/18.1std/ip/alt_xcvr_reconfig/alt_xcvr_reconfig_adce/alt_xcvr_reconfig_adce.sv#1 $
`timescale 1 ps / 1 ps
module alt_xcvr_reconfig_adce
#(
parameter device_family = "Stratix V",
parameter number_of_reconfig_interfaces = 1,
parameter logic [number_of_reconfig_interfaces-1:0] AUTO_START = { number_of_reconfig_interfaces { 1'b0 } }
)
(
input wire reconfig_clk,
input wire reset,
input wire hold,
// user Avalon-MM interface
input wire [2:0] adce_address,
input wire [31:0] adce_writedata,
input wire adce_write,
input wire adce_read,
output wire [31:0] adce_readdata,
output wire adce_waitrequest,
output wire adce_done, // AA What is this for? It's tied to an irq line.
// Avalon-MM interface to the basic block
input wire adce_b_waitrequest,
output wire [2:0] adce_b_address,
output wire [31:0] adce_b_writedata,
output wire adce_b_write,
output wire adce_b_read,
input wire [31:0] adce_b_readdata,
input wire adce_b_irq, // AA Is this really used?
// Basic block arbitration
output wire adce_b_arb_req,
input wire adce_b_arb_grant,
// Digital test bus
input wire [7:0] adce_testbus
);
import altera_xcvr_functions::*;
localparam is_s5 = has_s5_style_hssi(device_family);
generate
if ( is_s5 ) begin:stratixv
alt_xcvr_reconfig_adce_sv
#(
.number_of_reconfig_interfaces( number_of_reconfig_interfaces ),
.AUTO_START ( AUTO_START )
)
adce_sv
(
.clk ( reconfig_clk ),
.reset ( reset ),
.hold ( hold ),
.adce_address ( adce_address ),
.adce_writedata ( adce_writedata ),
.adce_write ( adce_write ),
.adce_read ( adce_read ),
.adce_readdata ( adce_readdata ),
.adce_waitrequest ( adce_waitrequest ),
.adce_done ( adce_done ),
.adce_b_waitrequest ( adce_b_waitrequest ),
.adce_b_address ( adce_b_address ),
.adce_b_writedata ( adce_b_writedata ),
.adce_b_write ( adce_b_write ),
.adce_b_read ( adce_b_read ),
.adce_b_readdata ( adce_b_readdata ),
.adce_b_irq ( adce_b_irq ),
.adce_b_arb_req ( adce_b_arb_req ),
.adce_b_arb_grant ( adce_b_arb_grant ),
.adce_testbus ( adce_testbus )
);
end else begin
// Default case for unsupported families, just tie off outputs to idle states.
assign adce_readdata = 32'b0;
assign adce_waitrequest = 1'b0;
assign adce_done = 1'b1;
assign adce_b_address = 3'b0;
assign adce_b_writedata = 32'b0;
assign adce_b_write = 1'b0;
assign adce_b_read = 1'b0;
assign adce_b_arb_req = 1'b0;
end
endgenerate
endmodule : alt_xcvr_reconfig_adce

View file

@ -0,0 +1,170 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
`timescale 1 ps / 1 ps
module alt_xcvr_reconfig_analog #(
parameter device_family = "Stratix V"
)
(
input wire reconfig_clk, // this will be the reconfig clk
input wire reset,
//avalon MM slave
input wire [2:0] analog_reconfig_address, // MM address
input wire [31:0] analog_reconfig_writedata,
input wire analog_reconfig_write,
input wire analog_reconfig_read,
//output MM slave
output wire [31:0] analog_reconfig_readdata, // from MM
output wire analog_reconfig_waitrequest,
//output wire analog_reconfig_error,
output wire analog_reconfig_done,
// input from base_reconfig
input wire analog_reconfig_irq_from_base,
input wire analog_reconfig_waitrequest_from_base,
// output to base_reconfig
// Avalon MM Master
output wire [2:0] analog_reconfig_address_base, // 3 bit MM
output wire [31:0] analog_reconfig_writedata_base,
output wire analog_reconfig_write_base, // start write to GXB
output wire analog_reconfig_read_base, // start read from GXB
// input from base reconfig
input wire [31:0] analog_reconfig_readdata_base, // data from read command
output wire arb_req,
input wire arb_grant
);
//parameter device_family = "StratixIV"; // or ArriaII
generate
//Deepak - added namespace support for CIVGX and AII GX
if((device_family == "Stratix IV") || (device_family == "Arria II") || (device_family == "Cyclone IV GX") || (device_family == "Arria II GX") || (device_family == "Arria II GZ") || (device_family == "HardCopy IV"))
begin
wire [4:0] w_tgx_analog_reconfig_address_base;
alt_xcvr_reconfig_analog_tgx reconfig_analog_tgx(
.reconfig_clk(reconfig_clk),
.reset(reset),
.analog_reconfig_address(analog_reconfig_address),
.analog_reconfig_writedata(analog_reconfig_writedata),
.analog_reconfig_write(analog_reconfig_write),
.analog_reconfig_read(analog_reconfig_read),
.analog_reconfig_readdata(analog_reconfig_readdata),
.analog_reconfig_waitrequest(analog_reconfig_waitrequest),
.analog_reconfig_done(analog_reconfig_done),
.analog_reconfig_irq_from_base(analog_reconfig_irq_from_base),
.analog_reconfig_waitrequest_from_base(analog_reconfig_waitrequest_from_base),
.analog_reconfig_address_base(analog_reconfig_address_base),
.analog_reconfig_writedata_base(analog_reconfig_writedata_base),
.analog_reconfig_write_base(analog_reconfig_write_base),
.analog_reconfig_read_base(analog_reconfig_read_base),
.analog_reconfig_readdata_base(analog_reconfig_readdata_base)
);
assign analog_reconfig_address_base = w_tgx_analog_reconfig_address_base[4:2];
assign arb_req = 1'b0 & arb_grant; // not currently used in S4 architecture
end
else if((device_family == "Stratix V") || (device_family == "Arria V GZ"))
begin
alt_xcvr_reconfig_analog_sv reconfig_analog_sv(
.reconfig_clk(reconfig_clk),
.reset(reset),
.analog_reconfig_address(analog_reconfig_address),
.analog_reconfig_writedata(analog_reconfig_writedata),
.analog_reconfig_write(analog_reconfig_write),
.analog_reconfig_read(analog_reconfig_read),
.analog_reconfig_readdata(analog_reconfig_readdata),
.analog_reconfig_waitrequest(analog_reconfig_waitrequest),
.analog_reconfig_done(analog_reconfig_done),
.analog_reconfig_irq_from_base(analog_reconfig_irq_from_base),
.analog_reconfig_waitrequest_from_base(analog_reconfig_waitrequest_from_base),
.analog_reconfig_address_base(analog_reconfig_address_base),
.analog_reconfig_writedata_base(analog_reconfig_writedata_base),
.analog_reconfig_write_base(analog_reconfig_write_base),
.analog_reconfig_read_base(analog_reconfig_read_base),
.analog_reconfig_readdata_base(analog_reconfig_readdata_base),
.arb_req(arb_req),
.arb_grant(arb_grant)
);
end
else if(device_family == "Arria V")
begin
alt_xcvr_reconfig_analog_av reconfig_analog_av(
.reconfig_clk(reconfig_clk),
.reset(reset),
.analog_reconfig_address(analog_reconfig_address),
.analog_reconfig_writedata(analog_reconfig_writedata),
.analog_reconfig_write(analog_reconfig_write),
.analog_reconfig_read(analog_reconfig_read),
.analog_reconfig_readdata(analog_reconfig_readdata),
.analog_reconfig_waitrequest(analog_reconfig_waitrequest),
.analog_reconfig_done(analog_reconfig_done),
.analog_reconfig_irq_from_base(analog_reconfig_irq_from_base),
.analog_reconfig_waitrequest_from_base(analog_reconfig_waitrequest_from_base),
.analog_reconfig_address_base(analog_reconfig_address_base),
.analog_reconfig_writedata_base(analog_reconfig_writedata_base),
.analog_reconfig_write_base(analog_reconfig_write_base),
.analog_reconfig_read_base(analog_reconfig_read_base),
.analog_reconfig_readdata_base(analog_reconfig_readdata_base),
.arb_req(arb_req),
.arb_grant(arb_grant)
);
end
else if(device_family == "Cyclone V")
begin
alt_xcvr_reconfig_analog_av reconfig_analog_cv(
.reconfig_clk(reconfig_clk),
.reset(reset),
.analog_reconfig_address(analog_reconfig_address),
.analog_reconfig_writedata(analog_reconfig_writedata),
.analog_reconfig_write(analog_reconfig_write),
.analog_reconfig_read(analog_reconfig_read),
.analog_reconfig_readdata(analog_reconfig_readdata),
.analog_reconfig_waitrequest(analog_reconfig_waitrequest),
.analog_reconfig_done(analog_reconfig_done),
.analog_reconfig_irq_from_base(analog_reconfig_irq_from_base),
.analog_reconfig_waitrequest_from_base(analog_reconfig_waitrequest_from_base),
.analog_reconfig_address_base(analog_reconfig_address_base),
.analog_reconfig_writedata_base(analog_reconfig_writedata_base),
.analog_reconfig_write_base(analog_reconfig_write_base),
.analog_reconfig_read_base(analog_reconfig_read_base),
.analog_reconfig_readdata_base(analog_reconfig_readdata_base),
.arb_req(arb_req),
.arb_grant(arb_grant)
);
end
else
begin
assign analog_reconfig_readdata = 32'd0;
assign analog_reconfig_waitrequest = 1'd0;
assign analog_reconfig_done = 1'd1;
assign analog_reconfig_address_base = 3'd0;
assign analog_reconfig_writedata_base = 32'd0;
assign analog_reconfig_write_base = 1'd0;
assign analog_reconfig_read_base = 1'd0;
assign arb_req = 1'd0;
end
endgenerate
endmodule

View file

@ -0,0 +1,226 @@
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated documentation or information are expressly subject
// to the terms and conditions of the Intel Program License Subscription
// Agreement, Intel FPGA IP License Agreement, or other applicable
// license agreement, including, without limitation, that your use is for the
// sole purpose of programming logic devices manufactured by Intel and sold by
// Intel or its authorized distributors. Please refer to the applicable
// agreement for further details.
// Top level Analog reconfig file for SV
// data will flow like
// UIF => DATA_CTRL => CIF => RECONFIG BASIC
//
// $Header$
`timescale 1 ns / 1 ps
module alt_xcvr_reconfig_analog_av
#(
parameter number_of_reconfig_interfaces = 1
) (
input wire reconfig_clk, // this will be the reconfig clk
input wire reset,
//avalon MM slave
input wire [2:0] analog_reconfig_address, // MM address
input wire [31:0] analog_reconfig_writedata,
input wire analog_reconfig_write,
input wire analog_reconfig_read,
//output MM slave
output reg [31:0] analog_reconfig_readdata, // from MM
output reg analog_reconfig_waitrequest,
output wire analog_reconfig_done,
// input from base_reconfig
input wire analog_reconfig_irq_from_base,
input wire analog_reconfig_waitrequest_from_base,
// output to base_reconfig
// Avalon MM Master
output wire [2:0] analog_reconfig_address_base, // 3 bit MM
output wire [31:0] analog_reconfig_writedata_base,
output wire analog_reconfig_write_base, // start write to GXB
output wire analog_reconfig_read_base, // start read from GXB
// input from base reconfig
input wire [31:0] analog_reconfig_readdata_base, // data from read command
input arb_grant,
output arb_req
);
localparam device_family = "StratixV";
//------------------------------------------------------------------
// address | type | data
//---------|---------|----------------------------------------------
// 0 | wr/rd | logical channel address
// 1 | rd | physical channel address
// 2 | wr/rd | control (write, read) / status (error, busy), status[1:0] = error, busy
// 3 | wr/rd | address offset
// 4 | wr/rd | avalon data
//------------------------------------------------------------------
//------------------------------------------------------------------
// addr_offset | data
//-------------|--------------------------------------------------------
// 0 | VOD
// 1 | Preemp_0t (not supported in AV)
// 2 | Preemp_1t
// 3 | Preemp_2t (not supported in AV)
// 4-15 | Reserved for TX Analog reconfig
// 16 | Eq_ctrl
// 17 | Eq_dcgain
// 18 - 31 | Reserved for RX Analog reconfig
// 32 | Pre-CDR reverse serial loopback
// 33 | Post-CDR reverse serial loopback
//------------------------------------------------------------------
import alt_xcvr_reconfig_h::*; //alt_xcvr_reconfig/alt_xcvr_reconfig/alt_xcvr_reconfig_h.sv
// import sv_xcvr_h::*; //altera_xcvr_generic/sv/sv_xcvr_h.sv
wire [31:0] uif_writedata;
wire [5:0] uif_addr_offset;
wire [2:0] uif_mode;
wire [9:0] uif_logical_ch_addr;
wire uif_go;
wire [31:0] uif_readdata;
wire uif_illegal_pch_error;
wire uif_illegal_offset_error;
wire ctrl_go;
wire [2:0] ctrl_opcode;
wire ctrl_lock;
wire [10:0] ctrl_addr_offset;
wire [31:0] ctrl_writedata;
wire [31:0] ctrl_readdata;
wire [31:0] ctrl_phreaddata;
wire ctrl_illegal_phy_ch;
wire ctrl_waitrequest;
wire uif_busy;
// Common user interface block, this block talks with user
alt_xreconf_uif
#(
.RECONFIG_USER_ADDR_WIDTH(3),
.RECONFIG_USER_DATA_WIDTH(32),
.RECONFIG_USER_OFFSET_WIDTH(6)
) inst_xreconf_uif (
.reconfig_clk(reconfig_clk),
.reset(reset),
.user_reconfig_address(analog_reconfig_address),
.user_reconfig_writedata(analog_reconfig_writedata),
.user_reconfig_write(analog_reconfig_write),
.user_reconfig_read(analog_reconfig_read),
.user_reconfig_readdata(analog_reconfig_readdata),
.user_reconfig_waitrequest(analog_reconfig_waitrequest),
.user_reconfig_done(analog_reconfig_done),
// to /from data control logic
.uif_writedata(uif_writedata), // to data control logic
.uif_addr_offset(uif_addr_offset), // to data control logic/rmw block
.uif_mode(uif_mode), // to data control logic
.uif_logical_ch_addr(uif_logical_ch_addr), // to data
.uif_go(uif_go), // to data control logic
.uif_ctrl(), //unused
.uif_readdata(uif_readdata),// from data control logic
.uif_phreaddata(ctrl_phreaddata),// from cif logic
.uif_illegal_pch_error(uif_illegal_pch_error), // from data control logic
.uif_illegal_offset_error(uif_illegal_offset_error), // from data control logic
.uif_busy(uif_busy) // from data control logic
);
// Analog Reconfig data control block, this block sits between uif and cif block
alt_xreconf_analog_datactrl_av
#(
.RECONFIG_USER_ADDR_WIDTH(3),
.RECONFIG_USER_DATA_WIDTH(32),
.RECONFIG_USER_OFFSET_WIDTH(6),
.RECONFIG_BASIC_OFFSET_ADDR_WIDTH(11)
) inst_analog_datactrl (
.clk(reconfig_clk),
.reset(reset),
// to/from uif block
.uif_addr_offset(uif_addr_offset),
.uif_go(uif_go),
.uif_mode(uif_mode),
.uif_writedata(uif_writedata),
.uif_busy(uif_busy),
.uif_illegal_pch_error(uif_illegal_pch_error), // from data control logic
.uif_illegal_offset_error(uif_illegal_offset_error), // from data control logic
.uif_readdata(uif_readdata),
// to/from control block
.ctrl_go(ctrl_go),
.ctrl_opcode(ctrl_opcode),
.ctrl_lock(ctrl_lock),
.ctrl_wait(ctrl_waitrequest),
.ctrl_illegal_phy_ch(ctrl_illegal_phy_ch),
.ctrl_readdata(ctrl_readdata), // this is i/p data coming from cif for read modify writes
.ctrl_writedata(ctrl_writedata),
.ctrl_addr_offset(ctrl_addr_offset),
.waitrequest_from_base(analog_reconfig_waitrequest_from_base)
);
//Common interface block which talks with reconfig basic B Block
alt_xreconf_cif
#(
.CIF_RECONFIG_ADDR_WIDTH (3),
.CIF_RECONFIG_DATA_WIDTH(32),
.CIF_OFFSET_ADDR_WIDTH(11),
.CIF_MASTER_ADDR_WIDTH(3),
.CIF_RECONFIG_OFFSET_WIDTH(6)
) inst_xreconf_cif (
// user Interface
.reconfig_clk(reconfig_clk),
.reset(reset),
.ctrl_go(ctrl_go), // from data control
.ctrl_opcode(ctrl_opcode), // from data control
.ctrl_lock(ctrl_lock), // from data control
.ctrl_addr_offset(ctrl_addr_offset), // from data control block
.ctrl_writedata(ctrl_writedata), // from data control, read modified write writedata block
.uif_logical_ch_addr(uif_logical_ch_addr), // from uif block
.ctrl_readdata(ctrl_readdata), // readdata to data control for read modify writes
.ctrl_phreaddata(ctrl_phreaddata), // this is i/p data coming from cif for read modify writes
.ctrl_illegal_phy_ch(ctrl_illegal_phy_ch), // illegal phy ch for data control logic
.ctrl_waitrequest(ctrl_waitrequest), // waitrequest from fsm to data control logic
// base reconfig interface
.reconfig_address_base(analog_reconfig_address_base),
.reconfig_writedata_base(analog_reconfig_writedata_base),
.reconfig_write_base(analog_reconfig_write_base),
.reconfig_read_base(analog_reconfig_read_base),
.reconfig_readdata_base(analog_reconfig_readdata_base),
.reconfig_irq_from_base(analog_reconfig_irq_from_base),
.reconfig_waitrequest_from_base(analog_reconfig_waitrequest_from_base),
.arb_grant(arb_grant),
.arb_req(arb_req)
);
endmodule

Some files were not shown because too many files have changed in this diff Show more