ELGIP-73 - Created Major version 3 of the FPM, to reflect the change in cs_bus_itf.vhd
This commit is contained in:
parent
fd0c0bb711
commit
77d2808fd7
22 changed files with 4656 additions and 0 deletions
3
generic_ip/fire_pulse_manager/3/Readme.txt
Normal file
3
generic_ip/fire_pulse_manager/3/Readme.txt
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
FPM Major version 3: Multi-Channel FPM. The initial version differs from major version 1
|
||||
only in the cs_bus_itf block, which uses Avalon waitrequest instead of readdatavalid to
|
||||
achieve a variable read latency
|
||||
310
generic_ip/fire_pulse_manager/3/doc/fpm_ctrl_3.json
Normal file
310
generic_ip/fire_pulse_manager/3/doc/fpm_ctrl_3.json
Normal file
|
|
@ -0,0 +1,310 @@
|
|||
[{
|
||||
"ip_name": "fpm_ctrl_3",
|
||||
"bus": "csr",
|
||||
"description": "This block is the fire pulse manager control",
|
||||
"registers": {
|
||||
"ip_id" : {
|
||||
"address" : "0",
|
||||
"width" : "32",
|
||||
"description" : "Unique ID for this IP block",
|
||||
"fields": {
|
||||
"ip_number" : {
|
||||
"type" : "c",
|
||||
"bit_len" : "8",
|
||||
"reset" : "0x14",
|
||||
"description" : "IP identifier number"
|
||||
},
|
||||
"mfr_number" : {
|
||||
"type" : "c",
|
||||
"bit_len" : "8",
|
||||
"reset" : "0xFF",
|
||||
"description" : "Manufacturer number"
|
||||
|
||||
},
|
||||
"reserved" : {
|
||||
"type" : "rsv",
|
||||
"bit_len" : "16",
|
||||
"description" : "Reserved bits"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ip_ver" : {
|
||||
"address" : "1",
|
||||
"width" : "32",
|
||||
"description" : "IP Version",
|
||||
"fields": {
|
||||
"minor_number" : {
|
||||
"type" : "c",
|
||||
"bit_len" : "8",
|
||||
"reset" : "0x00",
|
||||
"description" : "Minor number"
|
||||
},
|
||||
"major_number" : {
|
||||
"type" : "c",
|
||||
"bit_len" : "8",
|
||||
"reset" : "0x03",
|
||||
"description" : "Major number"
|
||||
|
||||
},
|
||||
"reserved" : {
|
||||
"type" : "rsv",
|
||||
"bit_len" : "16",
|
||||
"description" : "Reserved bits"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Signal selection": {
|
||||
"address": "2",
|
||||
"width": "2",
|
||||
"description": "Controls signal selection",
|
||||
"fields": {
|
||||
"fire_pulse_sel": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "0 => Use External fire pulses, 1 => Use FPM fire pulses"
|
||||
},
|
||||
"enc_pd_emul_en": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "0 => Use POF RX, 1 => Use internal enc/PD emulator"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pof_receiver_control": {
|
||||
"address": "3",
|
||||
"width": "8",
|
||||
"description": "Controls POF receiver",
|
||||
"fields": {
|
||||
"pof_rx_enable": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "0 => Disable POF RX, 1 => Enable POF RX"
|
||||
},
|
||||
"uart_regeneration_bypass": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "0 => Use UART Regeneration, 1 => Bypass UART Regeneration"
|
||||
},
|
||||
"clear_max": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "0 => Disabled, 1 => Load the current value of Absolute Position as new maximum"
|
||||
},
|
||||
"clear_min": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "0 => Disabled, 1 => Load the current value of Absolute Position as new miniumum"
|
||||
},
|
||||
"uart_rx_div": {
|
||||
"type": "w",
|
||||
"bit_len": "4",
|
||||
"reset": "0x4",
|
||||
"description": "Defines the number of 200 MHz clock cycles per UART data bit"
|
||||
}
|
||||
}
|
||||
},
|
||||
"monitoring_point_selection": {
|
||||
"address": "4",
|
||||
"width": "16",
|
||||
"description": "Selects monitoring points for external header",
|
||||
"fields": {
|
||||
"mp0": {
|
||||
"type": "w",
|
||||
"bit_len": "4",
|
||||
"reset": "0x0",
|
||||
"description": "Selects first monitoring point"
|
||||
},
|
||||
"mp1": {
|
||||
"type": "w",
|
||||
"bit_len": "4",
|
||||
"reset": "0x0",
|
||||
"description": "Selects second monitoring point"
|
||||
},
|
||||
"mp2": {
|
||||
"type": "w",
|
||||
"bit_len": "4",
|
||||
"reset": "0x0",
|
||||
"description": "Selects third monitoring point"
|
||||
},
|
||||
"mp3": {
|
||||
"type": "w",
|
||||
"bit_len": "4",
|
||||
"reset": "0x0",
|
||||
"description": "Selects fourth monitoring point"
|
||||
}
|
||||
}
|
||||
},
|
||||
"coarse_time_init": {
|
||||
"type": "w",
|
||||
"address": "5",
|
||||
"reset": "0x00000000",
|
||||
"width": "32",
|
||||
"description": "Defines coarse time counter value"
|
||||
},
|
||||
"fine_time_init": {
|
||||
"address": "6",
|
||||
"width": "29",
|
||||
"description": "Fine time counter value/Load counter enable",
|
||||
"fields": {
|
||||
"fine_time_init": {
|
||||
"type" :"w",
|
||||
"bit_len": "28",
|
||||
"reset": "0x0000000",
|
||||
"description": "Defines fine time counter value"
|
||||
},
|
||||
"time_load_en": {
|
||||
"type" :"w",
|
||||
"bit_len" : "1",
|
||||
"reset": "0x0",
|
||||
"description" : "Writting 1 loads the coarse and fine time counters"
|
||||
}
|
||||
}
|
||||
},
|
||||
"fine_time_status": {
|
||||
"type": "r",
|
||||
"address": "7",
|
||||
"reset": "0x0000000",
|
||||
"width": "28",
|
||||
"description": "Current fine time counter value"
|
||||
},
|
||||
"coarse_time_status": {
|
||||
"type": "r",
|
||||
"address": "8",
|
||||
"reset": "0x00000000",
|
||||
"width": "32",
|
||||
"description": "Current coarse time counter value"
|
||||
},
|
||||
"pof_rx_status": {
|
||||
"address": "9",
|
||||
"width": "32",
|
||||
"description": "Status of POF receiver",
|
||||
"fields": {
|
||||
"parity_bit_error_count": {
|
||||
"type": "r",
|
||||
"bit_len": "16",
|
||||
"reset": "0x0000",
|
||||
"description": "Counts number of parity errors"
|
||||
},
|
||||
"skipped_position_error_count": {
|
||||
"type": "r",
|
||||
"bit_len": "16",
|
||||
"reset": "0x0000",
|
||||
"description": "Counts position skipped type errors"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pof_rx_control": {
|
||||
"address": "10",
|
||||
"width": "12",
|
||||
"description": "POF receiver error control",
|
||||
"fields": {
|
||||
"error_rate_thres": {
|
||||
"type" : "w",
|
||||
"bit_len": "8",
|
||||
"reset": "0x0A",
|
||||
"description": "Defines RX error rate threshold"
|
||||
},
|
||||
"rx_watchdog_en": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x1",
|
||||
"description": "0 => Disable RX watchdog, 1 => Enable RX Watchdog"
|
||||
},
|
||||
"rx_watchdog_clr": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "0 => RX watchdog counter running, 1 => Clear RX watchdog counter"
|
||||
},
|
||||
"rx_watchdog": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "0 => RX watchdog not triggered, 1 => RX watchdog triggered"
|
||||
},
|
||||
"rx_error_flag": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "0 => Error rate below threshold, 1 => Error rate above threshold"
|
||||
}
|
||||
}
|
||||
},
|
||||
"fpm_interrupt": {
|
||||
"address": "11",
|
||||
"width": "16",
|
||||
"description": "Interrupt control",
|
||||
"fields": {
|
||||
"irq_en": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "0 => Disable IRQ, 1 => Enable IRQ"
|
||||
},
|
||||
"reserved1": {
|
||||
"type": "rsv",
|
||||
"bit_len": "3",
|
||||
"description": "Reserved"
|
||||
},
|
||||
"irq_clr": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "0 => Don't clear pending IRQ, 1 => Clear pending IRQ"
|
||||
},
|
||||
"reserved2": {
|
||||
"type": "rsv",
|
||||
"bit_len": "3",
|
||||
"description": "Reserved"
|
||||
},
|
||||
"irq_mask": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "0 => IRQ not masked, 1 => IRQ masked"
|
||||
},
|
||||
"reserved3": {
|
||||
"type": "rsv",
|
||||
"bit_len": "3",
|
||||
"description": "Reserved"
|
||||
},
|
||||
"irq_status": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "0 => IRQ not active, 1 => IRQ active"
|
||||
},
|
||||
"reserved4": {
|
||||
"type": "rsv",
|
||||
"bit_len": "3",
|
||||
"description": "Reserved"
|
||||
}
|
||||
}
|
||||
},
|
||||
"fpm_ext_ctrl": {
|
||||
"address": "12",
|
||||
"width": "32",
|
||||
"description": "Controls regeneration of external fire pulses",
|
||||
"fields": {
|
||||
"ext_fp_det": {
|
||||
"type": "w",
|
||||
"bit_len": "16",
|
||||
"reset": "0x0010",
|
||||
"description": "Minimum width of external fire pulses"
|
||||
},
|
||||
"ext_fp_gen": {
|
||||
"type": "w",
|
||||
"bit_len": "16",
|
||||
"reset": "0x0020",
|
||||
"description": "Width of regenerated external fire pulses"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}]
|
||||
169
generic_ip/fire_pulse_manager/3/doc/fpm_diags_1.json
Normal file
169
generic_ip/fire_pulse_manager/3/doc/fpm_diags_1.json
Normal file
|
|
@ -0,0 +1,169 @@
|
|||
[{
|
||||
"ip_name": "fpm_diags_1",
|
||||
"bus": "csr",
|
||||
"description": "This block is the fire pulse manager diagnostics",
|
||||
"registers": {
|
||||
"init": {
|
||||
"type": "w",
|
||||
"address": "0",
|
||||
"reset": "0x00",
|
||||
"width": "32",
|
||||
"description": "Write 1 then 0 to initialize the diagnostics block"
|
||||
},
|
||||
"input_status": {
|
||||
"address": "1",
|
||||
"width": "13",
|
||||
"description": "Instantaneous status of input signals",
|
||||
"fields": {
|
||||
"Rs422Phase0Input": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "0x00",
|
||||
"description": ""
|
||||
},
|
||||
"Rs422Phase1Input": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "0x00",
|
||||
"description": ""
|
||||
},
|
||||
"Rs422ZeroPhase": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "0x00",
|
||||
"description": ""
|
||||
},
|
||||
"Rs422ProductDetect": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "0x00",
|
||||
"description": ""
|
||||
},
|
||||
"TtlPhase0Input": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "0x00",
|
||||
"description": ""
|
||||
},
|
||||
"TtlPhase1Input": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "0x00",
|
||||
"description": ""
|
||||
},
|
||||
"TtlProductDetect": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "0x00",
|
||||
"description": ""
|
||||
},
|
||||
"FilteredPhase0Input": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "0x00",
|
||||
"description": ""
|
||||
},
|
||||
"FilteredPhase1Input": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "0x00",
|
||||
"description": ""
|
||||
},
|
||||
"FilteredZeroPhase": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "0x00",
|
||||
"description": ""
|
||||
},
|
||||
"FilteredProductDetect": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "0x00",
|
||||
"description": ""
|
||||
},
|
||||
"EmsEncoderOutput": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "0x00",
|
||||
"description": ""
|
||||
},
|
||||
"EmsProductDetectOutput": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "0x00",
|
||||
"description": ""
|
||||
}
|
||||
}
|
||||
},
|
||||
"phase0_counter": {
|
||||
"type": "r",
|
||||
"address": "2",
|
||||
"reset": "0x0",
|
||||
"width": "32",
|
||||
"description": ""
|
||||
},
|
||||
"phase1_counter": {
|
||||
"type": "r",
|
||||
"address": "3",
|
||||
"reset": "0x0",
|
||||
"width": "32",
|
||||
"description": ""
|
||||
},
|
||||
"ems_encoder_output_counter": {
|
||||
"type": "r",
|
||||
"address": "6",
|
||||
"reset": "0x0",
|
||||
"width": "32",
|
||||
"description": ""
|
||||
},
|
||||
"ems_pd_output_counter": {
|
||||
"type": "r",
|
||||
"address": "7",
|
||||
"reset": "0x0",
|
||||
"width": "32",
|
||||
"description": ""
|
||||
},
|
||||
"fire_request_channel_counter": {
|
||||
"type": "r",
|
||||
"address": "8",
|
||||
"reset": "0x0",
|
||||
"width": "32",
|
||||
"description": ""
|
||||
},
|
||||
"delta_time_measurement_interval": {
|
||||
"type": "w",
|
||||
"address": "16",
|
||||
"reset": "0x0",
|
||||
"width": "32",
|
||||
"description": ""
|
||||
},
|
||||
"position": {
|
||||
"type": "r",
|
||||
"address": "17",
|
||||
"reset": "0x0",
|
||||
"width": "32",
|
||||
"description": ""
|
||||
},
|
||||
"delta_position_measurement_interval": {
|
||||
"type": "w",
|
||||
"address": "20",
|
||||
"reset": "0x0",
|
||||
"width": "32",
|
||||
"description": ""
|
||||
},
|
||||
"delta_position_fifo_control": {
|
||||
"type": "w",
|
||||
"address": "21",
|
||||
"reset": "0x0",
|
||||
"width": "32",
|
||||
"description": ""
|
||||
},
|
||||
"irq_management": {
|
||||
"type": "w",
|
||||
"address": "27",
|
||||
"reset": "0x0",
|
||||
"width": "32",
|
||||
"description": ""
|
||||
}
|
||||
}
|
||||
}]
|
||||
57
generic_ip/fire_pulse_manager/3/doc/fpm_event_log_1.json
Normal file
57
generic_ip/fire_pulse_manager/3/doc/fpm_event_log_1.json
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
[{
|
||||
"ip_name" : "fpm_event_log_1",
|
||||
"bus" : "csr",
|
||||
"description" : "This block is the fire pulse manager diags",
|
||||
"registers" : {
|
||||
"ip_id" : {
|
||||
"address" : "0",
|
||||
"width" : "32",
|
||||
"description" : "Unique ID for this IP block",
|
||||
"fields": {
|
||||
"ip_number" : {
|
||||
"type" : "c",
|
||||
"bit_len" : "8",
|
||||
"reset" : "0xFF",
|
||||
"description" : "IP identifier number (unknown)"
|
||||
},
|
||||
"mfr_number" : {
|
||||
"type" : "c",
|
||||
"bit_len" : "8",
|
||||
"reset" : "0xFF",
|
||||
"description" : "Manufacturer number"
|
||||
|
||||
},
|
||||
"reserved" : {
|
||||
"type" : "rsv",
|
||||
"bit_len" : "16",
|
||||
"description" : "Reserved bits"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ip_ver" : {
|
||||
"address" : "1",
|
||||
"width" : "32",
|
||||
"description" : "Bits[7:0] = Minor version number, Bits[15:8] = Major version number, etc.",
|
||||
"fields": {
|
||||
"minor_number" : {
|
||||
"type" : "c",
|
||||
"bit_len" : "8",
|
||||
"reset" : "0x01",
|
||||
"description" : "Minor number"
|
||||
},
|
||||
"major_number" : {
|
||||
"type" : "c",
|
||||
"bit_len" : "8",
|
||||
"reset" : "0x00",
|
||||
"description" : "Major number"
|
||||
|
||||
},
|
||||
"reserved" : {
|
||||
"type" : "rsv",
|
||||
"bit_len" : "16",
|
||||
"description" : "Reserved bits"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}]
|
||||
|
|
@ -0,0 +1 @@
|
|||
### REPLACED BY THE ENC/PD EMULATOR BLOCK ###
|
||||
57
generic_ip/fire_pulse_manager/3/doc/fpm_net_sync_1.json
Normal file
57
generic_ip/fire_pulse_manager/3/doc/fpm_net_sync_1.json
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
[{
|
||||
"ip_name" : "fpm_net_sync_1",
|
||||
"bus" : "csr",
|
||||
"description" : "This block is the fire pulse manager net sync",
|
||||
"registers" : {
|
||||
"ip_id" : {
|
||||
"address" : "0",
|
||||
"width" : "32",
|
||||
"description" : "Unique ID for this IP block",
|
||||
"fields": {
|
||||
"ip_number" : {
|
||||
"type" : "c",
|
||||
"bit_len" : "8",
|
||||
"reset" : "0xFF",
|
||||
"description" : "IP identifier number (unknown)"
|
||||
},
|
||||
"mfr_number" : {
|
||||
"type" : "c",
|
||||
"bit_len" : "8",
|
||||
"reset" : "0xFF",
|
||||
"description" : "Manufacturer number"
|
||||
|
||||
},
|
||||
"reserved" : {
|
||||
"type" : "rsv",
|
||||
"bit_len" : "16",
|
||||
"description" : "Reserved bits"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ip_ver" : {
|
||||
"address" : "1",
|
||||
"width" : "32",
|
||||
"description" : "Bits[7:0] = Minor version number, Bits[15:8] = Major version number, etc.",
|
||||
"fields": {
|
||||
"minor_number" : {
|
||||
"type" : "c",
|
||||
"bit_len" : "8",
|
||||
"reset" : "0x01",
|
||||
"description" : "Minor number"
|
||||
},
|
||||
"major_number" : {
|
||||
"type" : "c",
|
||||
"bit_len" : "8",
|
||||
"reset" : "0x00",
|
||||
"description" : "Major number"
|
||||
|
||||
},
|
||||
"reserved" : {
|
||||
"type" : "rsv",
|
||||
"bit_len" : "16",
|
||||
"description" : "Reserved bits"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}]
|
||||
89
generic_ip/fire_pulse_manager/3/sim/sim_fpm.do
Normal file
89
generic_ip/fire_pulse_manager/3/sim/sim_fpm.do
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
# Multi-channel FPM Simulation macro
|
||||
|
||||
.main clear
|
||||
|
||||
# Path variables
|
||||
set COMMON_PATH ../../../common/0/src
|
||||
set GENERIC_PATH ../../../
|
||||
set OSVVM_PATH ../../../common/0/src/test/OSVVM
|
||||
set SRC_PATH ../src
|
||||
set TB_PATH ../src/test
|
||||
|
||||
set WORKLIB work
|
||||
|
||||
vlib ./work
|
||||
vmap work ./work
|
||||
|
||||
# Compile OSVVM lib
|
||||
vlib OSVVM
|
||||
vcom -2008 -work OSVVM $OSVVM_PATH/RandomBasePkg.vhd
|
||||
vcom -2008 -work OSVVM $OSVVM_PATH/SortListPkg_int.vhd
|
||||
vcom -2008 -work OSVVM $OSVVM_PATH/RandomPkg.vhd
|
||||
|
||||
# Compile the testbench support files:
|
||||
|
||||
# Log package and common
|
||||
vcom -2008 -work $WORKLIB $COMMON_PATH/sync_reset.vhd
|
||||
vcom -2008 -work $WORKLIB $COMMON_PATH/sync_wire.vhd
|
||||
vcom -2008 -work $WORKLIB $COMMON_PATH/sync_wire_redge.vhd
|
||||
vcom -2008 -work $WORKLIB $COMMON_PATH/cs_bus_itf.vhd
|
||||
vcom -2008 -work $WORKLIB $COMMON_PATH/common_pkg.vhd
|
||||
vcom -2008 -work $WORKLIB $COMMON_PATH/test/common_test_pkg.vhd
|
||||
vcom -2008 -work $WORKLIB $COMMON_PATH/test/log_pkg.vhd
|
||||
|
||||
# Compile the VHDL packages that support bus protocols, memory mapped registers and functional procedures
|
||||
vcom -2008 -work $WORKLIB $COMMON_PATH/test/avalon_verify_pkg.vhd
|
||||
|
||||
# Generic Sequencer
|
||||
vcom -2008 -work $WORKLIB $GENERIC_PATH/generic_sequencer/15/src/altera/generic_seq_ram_15.vhd
|
||||
vcom -2008 -work $WORKLIB $GENERIC_PATH/generic_sequencer/15/src/generic_sequencer_15_pkg.vhd
|
||||
vcom -2008 -work $WORKLIB $GENERIC_PATH/generic_sequencer/15/src/generic_sequencer_15.vhd
|
||||
|
||||
# Pulse Generator
|
||||
vcom -2008 -work $WORKLIB $GENERIC_PATH/pulse_generator/1/src/altera/sync_fifo_1.vhd
|
||||
vcom -2008 -work $WORKLIB $GENERIC_PATH/pulse_generator/1/src/pulse_generator_1_pkg.vhd
|
||||
vcom -2008 -work $WORKLIB $GENERIC_PATH/pulse_generator/1/src/pulse_conditioning_1.vhd
|
||||
vcom -2008 -work $WORKLIB $GENERIC_PATH/pulse_generator/1/src/queue_and_delay_1.vhd
|
||||
vcom -2008 -work $WORKLIB $GENERIC_PATH/pulse_generator/1/src/simple_frac_div_1.vhd
|
||||
vcom -2008 -work $WORKLIB $GENERIC_PATH/pulse_generator/1/src/pulse_generator_1.vhd
|
||||
|
||||
# Enc PD Emul
|
||||
vcom -2008 -work $WORKLIB $GENERIC_PATH/enc_pd_emul/1/src/enc_pd_emul_1_pkg.vhd
|
||||
vcom -2008 -work $WORKLIB $GENERIC_PATH/enc_pd_emul/1/src/enc_pd_emul_1.vhd
|
||||
|
||||
# Fire-Pulse-Manager
|
||||
vcom -2008 -work $WORKLIB $SRC_PATH/fire_pulse_3_pkg.vhd
|
||||
vcom -2008 -work $WORKLIB $SRC_PATH/uart_rx_3.vhd
|
||||
vcom -2008 -work $WORKLIB $SRC_PATH/uart_regen_3.vhd
|
||||
vcom -2008 -work $WORKLIB $SRC_PATH/fire_pulse_ctrl_3.vhd
|
||||
vcom -2008 -work $WORKLIB $SRC_PATH/pof_rx_3.vhd
|
||||
vcom -2008 -work $WORKLIB $SRC_PATH/fire_pulse_ext_3.vhd
|
||||
vcom -2008 -work $WORKLIB $SRC_PATH/fire_pulse_manager_3.vhd
|
||||
|
||||
# POF TX
|
||||
vcom -2008 -work $WORKLIB $TB_PATH/fifo_16x8_3.vhd
|
||||
vcom -2008 -work $WORKLIB $TB_PATH/uart_tx_3.vhd
|
||||
vcom -2008 -work $WORKLIB $TB_PATH/pof_tx_3.vhd
|
||||
|
||||
# Testbench
|
||||
vcom -2008 -work $WORKLIB $TB_PATH/fire_pulse_manager_3_tb.vhd
|
||||
|
||||
# Load design
|
||||
vsim -t ps work.fire_pulse_manager_3_tb
|
||||
|
||||
# Add waves
|
||||
#add wave -r sim:/fire_pulse_manager_1_tb/*
|
||||
do wave_fpm.do
|
||||
|
||||
# remove warnings from standard numeric/arithmetic packages (speed-up simulation)
|
||||
set StdArithNoWarnings 1
|
||||
set NumericStdNoWarnings 1
|
||||
|
||||
when -label end_of_simulation {test_completed == true} {echo "Simulation Completed"; stop ;}
|
||||
run -all
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
70
generic_ip/fire_pulse_manager/3/sim/sim_pof_txrx.do
Normal file
70
generic_ip/fire_pulse_manager/3/sim/sim_pof_txrx.do
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
# Simulation macro
|
||||
|
||||
.main clear
|
||||
|
||||
set COMP_ONLY 0
|
||||
|
||||
set TB_PATH ./../src/test
|
||||
set COMMON_PATH ../../../common/0/src
|
||||
set OSVVM_PATH $COMMON_PATH/test/OSVVM
|
||||
|
||||
set WORKLIB work
|
||||
|
||||
vlib ./work
|
||||
vmap work ./work
|
||||
|
||||
if {$COMP_ONLY == 0} {
|
||||
# Compile the constrained random related packages
|
||||
vlib OSVVM
|
||||
vcom -2008 -work OSVVM \
|
||||
$OSVVM_PATH/RandomBasePkg.vhd \
|
||||
$OSVVM_PATH/SortListPkg_int.vhd \
|
||||
$OSVVM_PATH/RandomPkg.vhd \
|
||||
$OSVVM_PATH/NamePkg.vhd \
|
||||
$OSVVM_PATH/MessagePkg.vhd \
|
||||
$OSVVM_PATH/CoveragePkg.vhd
|
||||
}
|
||||
|
||||
# compile the UUTs:
|
||||
#vcom -2008 -work $WORKLIB $COMMON_PATH/pkg_functions.vhd
|
||||
vcom -2008 -work $WORKLIB $COMMON_PATH/sync_wire.vhd
|
||||
vcom -2008 -work $WORKLIB $COMMON_PATH/sync_wire_redge.vhd
|
||||
vcom -2008 -work $WORKLIB ../src/uart_rx_3.vhd
|
||||
vcom -2008 -work $WORKLIB ../src/pof_rx_3.vhd
|
||||
|
||||
|
||||
# Compile the testbench and the other components supporting the test
|
||||
if {$COMP_ONLY == 0} {
|
||||
# Test support packages
|
||||
vcom -2008 -work $WORKLIB $COMMON_PATH/test/common_test_pkg.vhd
|
||||
vcom -2008 -work $WORKLIB $COMMON_PATH/test/log_pkg.vhd
|
||||
vcom -2008 -work $WORKLIB $COMMON_PATH/test/avalon_verify_pkg.vhd
|
||||
|
||||
# Testbench
|
||||
# in fire pulse manager, the tx components are part of the testbench
|
||||
vcom -2008 -work $WORKLIB $TB_PATH/fifo_16x8_3.vhd
|
||||
vcom -2008 -work $WORKLIB $TB_PATH/uart_tx_3.vhd
|
||||
vcom -2008 -work $WORKLIB $TB_PATH/pof_tx_3.vhd
|
||||
vcom -2008 -work $WORKLIB $TB_PATH/pof_tx_rx_3_tb.vhd
|
||||
|
||||
vsim -t ps work.pof_tx_rx_3_tb
|
||||
|
||||
#add wave /pof_tx_rx_tb/*
|
||||
#add wave /pof_tx_rx_tb/iPOF_TX/*
|
||||
#add wave /pof_tx_rx_tb/iPOF_RX/*
|
||||
|
||||
# remove warnings from standard numeric/arithmetic packages (speed-up simulation)
|
||||
set StdArithNoWarnings 1
|
||||
set NumericStdNoWarnings 1
|
||||
|
||||
do wave_pof_txrx.do
|
||||
|
||||
when -label end_of_simulation {test_completed == true} {echo "Simulation Completed"; stop ;}
|
||||
run -all
|
||||
|
||||
#run 1 ms;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
171
generic_ip/fire_pulse_manager/3/sim/wave_fpm.do
Normal file
171
generic_ip/fire_pulse_manager/3/sim/wave_fpm.do
Normal file
|
|
@ -0,0 +1,171 @@
|
|||
onerror {resume}
|
||||
quietly WaveActivateNextPane {} 0
|
||||
add wave -noupdate -group TB /fire_pulse_manager_3_tb/ch_offset
|
||||
add wave -noupdate -group TB /fire_pulse_manager_3_tb/reset_n
|
||||
add wave -noupdate -group TB /fire_pulse_manager_3_tb/clk
|
||||
add wave -noupdate -group TB /fire_pulse_manager_3_tb/rx_clk
|
||||
add wave -noupdate -group TB /fire_pulse_manager_3_tb/pof_tx
|
||||
add wave -noupdate -group TB /fire_pulse_manager_3_tb/pof_rx
|
||||
add wave -noupdate -group TB /fire_pulse_manager_3_tb/ch_pulse_out
|
||||
add wave -noupdate -group TB /fire_pulse_manager_3_tb/avs_address
|
||||
add wave -noupdate -group TB /fire_pulse_manager_3_tb/avs_write
|
||||
add wave -noupdate -group TB /fire_pulse_manager_3_tb/avs_writedata
|
||||
add wave -noupdate -group TB /fire_pulse_manager_3_tb/avs_read
|
||||
add wave -noupdate -group TB /fire_pulse_manager_3_tb/avs_waitrequest
|
||||
add wave -noupdate -group TB /fire_pulse_manager_3_tb/avs_readdata
|
||||
add wave -noupdate -group TB /fire_pulse_manager_3_tb/init_tx
|
||||
add wave -noupdate -group TB /fire_pulse_manager_3_tb/pd_in
|
||||
add wave -noupdate -group TB /fire_pulse_manager_3_tb/pd_spy
|
||||
add wave -noupdate -group TB /fire_pulse_manager_3_tb/inc_pos
|
||||
add wave -noupdate -group TB /fire_pulse_manager_3_tb/dec_pos
|
||||
add wave -noupdate -group TB /fire_pulse_manager_3_tb/abs_position
|
||||
add wave -noupdate -group TB /fire_pulse_manager_3_tb/abs_spy
|
||||
add wave -noupdate -group TB /fire_pulse_manager_3_tb/tx_data
|
||||
add wave -noupdate -group TB /fire_pulse_manager_3_tb/abs_position_d
|
||||
add wave -noupdate -group TB /fire_pulse_manager_3_tb/dir_in
|
||||
add wave -noupdate -group TB /fire_pulse_manager_3_tb/swathe_cnt
|
||||
add wave -noupdate -group TB /fire_pulse_manager_3_tb/swathe_pos
|
||||
add wave -noupdate -group TB /fire_pulse_manager_3_tb/end_of_swathe
|
||||
add wave -noupdate -group TB /fire_pulse_manager_3_tb/test_completed
|
||||
add wave -noupdate -group TB /fire_pulse_manager_3_tb/running
|
||||
add wave -noupdate -group TB /fire_pulse_manager_3_tb/configuring
|
||||
add wave -noupdate -group TB /fire_pulse_manager_3_tb/passed
|
||||
add wave -noupdate -group TB /fire_pulse_manager_3_tb/failed
|
||||
add wave -noupdate -group TB /fire_pulse_manager_3_tb/stimuli_completed
|
||||
add wave -noupdate -group TB /fire_pulse_manager_3_tb/detected_error
|
||||
add wave -noupdate -group TB /fire_pulse_manager_3_tb/registers_read
|
||||
add wave -noupdate -group TB /fire_pulse_manager_3_tb/reprogram_offset
|
||||
add wave -noupdate -group TB /fire_pulse_manager_3_tb/avs_m
|
||||
add wave -noupdate -group TB /fire_pulse_manager_3_tb/avs_s
|
||||
add wave -noupdate -group TB /fire_pulse_manager_3_tb/sel_slave_0
|
||||
add wave -noupdate -group TB /fire_pulse_manager_3_tb/sel_slave_1
|
||||
add wave -noupdate -group TB /fire_pulse_manager_3_tb/pd_cnt
|
||||
add wave -noupdate -group TB /fire_pulse_manager_3_tb/fp_cnt
|
||||
add wave -noupdate -group TB /fire_pulse_manager_3_tb/tx_clk
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/reset_n
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/clk
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/init
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/rx_clk
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/rx_data
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/init_out
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/dp_dir
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/enc_out
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/pd_out
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/inc_pos
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/dec_pos
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/abs_pos
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/enable
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/bit_div
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/error_rate_thres
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/one_pps
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/upd_max_pos
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/upd_min_pos
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/max_error_flag
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/rx_watchdog
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/rx_watchdog_en
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/rx_watchdog_clr
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/parity_err_cnt
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/skip_pos_cnt
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/clear
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/symbol_ok
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/inc_pos_i
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/dec_pos_i
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/sync_gen
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/pd_gen
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/symbol_error
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/sync_d
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/symbol_valid
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/symbol_valid_i
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/symbol_valid_d
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/toggle_sync
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/sync_confirmed
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/sync_toggle_test
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/sync
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/toggle_pd
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/pd_confirmed
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/pd_toggle_test
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/pd
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/valid_pos
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/upd_pos
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/corr_done
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/corr_sign
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/skip_pos
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/apply_corr
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/inc_pos_ii
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/dec_pos_ii
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/new_max
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/new_min
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/rx_error
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/rx_error_i
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/rx_symbol_val
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/clear_i
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/skip_pos_d
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/pos_recovery
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/dp_dir_d
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/dp_dir_change
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/max_error_flag_i
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/clk_cnt
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/dist
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/abs_dist
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/skip_cnt
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/next_pos_lsb
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/curr_pos_lsb
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/pos_corr
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/max_dist
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/rx_error_v
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/gray_pos
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/rx_symbol_val_v
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/symbol
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/symbol_i
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/rx_symbol
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/rx_wd_cnt
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/parity_err_cnt_i
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/skip_pos_cnt_i
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/error_rate_cnt
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/error_rate
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/abs_pos_i
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/pos_max
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/pos_min
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/dist_pos
|
||||
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/dist_neg
|
||||
add wave -noupdate -group UART_RX /fire_pulse_manager_3_tb/iDUT/iPOF_RX/iRX_SYMBOL/reset_n
|
||||
add wave -noupdate -group UART_RX /fire_pulse_manager_3_tb/iDUT/iPOF_RX/iRX_SYMBOL/clk
|
||||
add wave -noupdate -group UART_RX /fire_pulse_manager_3_tb/iDUT/iPOF_RX/iRX_SYMBOL/bit_div
|
||||
add wave -noupdate -group UART_RX /fire_pulse_manager_3_tb/iDUT/iPOF_RX/iRX_SYMBOL/init
|
||||
add wave -noupdate -group UART_RX /fire_pulse_manager_3_tb/iDUT/iPOF_RX/iRX_SYMBOL/data_out
|
||||
add wave -noupdate -group UART_RX /fire_pulse_manager_3_tb/iDUT/iPOF_RX/iRX_SYMBOL/data_out_valid
|
||||
add wave -noupdate -group UART_RX /fire_pulse_manager_3_tb/iDUT/iPOF_RX/iRX_SYMBOL/rx_error
|
||||
add wave -noupdate -group UART_RX /fire_pulse_manager_3_tb/iDUT/iPOF_RX/iRX_SYMBOL/rx_data
|
||||
add wave -noupdate -group UART_RX /fire_pulse_manager_3_tb/iDUT/iPOF_RX/iRX_SYMBOL/fsm_state_curr
|
||||
add wave -noupdate -group UART_RX /fire_pulse_manager_3_tb/iDUT/iPOF_RX/iRX_SYMBOL/fsm_state_next
|
||||
add wave -noupdate -group UART_RX /fire_pulse_manager_3_tb/iDUT/iPOF_RX/iRX_SYMBOL/rx_data_i
|
||||
add wave -noupdate -group UART_RX /fire_pulse_manager_3_tb/iDUT/iPOF_RX/iRX_SYMBOL/shf_data
|
||||
add wave -noupdate -group UART_RX /fire_pulse_manager_3_tb/iDUT/iPOF_RX/iRX_SYMBOL/rst_bit_cnt
|
||||
add wave -noupdate -group UART_RX /fire_pulse_manager_3_tb/iDUT/iPOF_RX/iRX_SYMBOL/inc_bit_cnt
|
||||
add wave -noupdate -group UART_RX /fire_pulse_manager_3_tb/iDUT/iPOF_RX/iRX_SYMBOL/rst_clk_cnt
|
||||
add wave -noupdate -group UART_RX /fire_pulse_manager_3_tb/iDUT/iPOF_RX/iRX_SYMBOL/end_of_bit
|
||||
add wave -noupdate -group UART_RX /fire_pulse_manager_3_tb/iDUT/iPOF_RX/iRX_SYMBOL/end_of_rx
|
||||
add wave -noupdate -group UART_RX /fire_pulse_manager_3_tb/iDUT/iPOF_RX/iRX_SYMBOL/data_valid
|
||||
add wave -noupdate -group UART_RX /fire_pulse_manager_3_tb/iDUT/iPOF_RX/iRX_SYMBOL/stop_bit
|
||||
add wave -noupdate -group UART_RX /fire_pulse_manager_3_tb/iDUT/iPOF_RX/iRX_SYMBOL/rx_error_i
|
||||
add wave -noupdate -group UART_RX /fire_pulse_manager_3_tb/iDUT/iPOF_RX/iRX_SYMBOL/data
|
||||
add wave -noupdate -group UART_RX /fire_pulse_manager_3_tb/iDUT/iPOF_RX/iRX_SYMBOL/clk_cnt
|
||||
add wave -noupdate -group UART_RX /fire_pulse_manager_3_tb/iDUT/iPOF_RX/iRX_SYMBOL/bit_cnt
|
||||
TreeUpdate [SetDefaultTree]
|
||||
WaveRestoreCursors {{Cursor 1} {0 ps} 0}
|
||||
quietly wave cursor active 0
|
||||
configure wave -namecolwidth 150
|
||||
configure wave -valuecolwidth 100
|
||||
configure wave -justifyvalue left
|
||||
configure wave -signalnamewidth 1
|
||||
configure wave -snapdistance 10
|
||||
configure wave -datasetprefix 0
|
||||
configure wave -rowmargin 4
|
||||
configure wave -childrowmargin 2
|
||||
configure wave -gridoffset 0
|
||||
configure wave -gridperiod 1
|
||||
configure wave -griddelta 40
|
||||
configure wave -timeline 0
|
||||
configure wave -timelineunits ps
|
||||
update
|
||||
WaveRestoreZoom {64332055 ps} {64335156 ps}
|
||||
235
generic_ip/fire_pulse_manager/3/sim/wave_pof_txrx.do
Normal file
235
generic_ip/fire_pulse_manager/3/sim/wave_pof_txrx.do
Normal file
|
|
@ -0,0 +1,235 @@
|
|||
onerror {resume}
|
||||
quietly WaveActivateNextPane {} 0
|
||||
add wave -noupdate /pof_tx_rx_3_tb/reset_n
|
||||
add wave -noupdate /pof_tx_rx_3_tb/hmb_clk
|
||||
add wave -noupdate /pof_tx_rx_3_tb/sm_clk
|
||||
add wave -noupdate /pof_tx_rx_3_tb/avs_read
|
||||
add wave -noupdate /pof_tx_rx_3_tb/avs_write
|
||||
add wave -noupdate /pof_tx_rx_3_tb/sel_slave_0
|
||||
add wave -noupdate /pof_tx_rx_3_tb/sel_slave_1
|
||||
add wave -noupdate /pof_tx_rx_3_tb/avs_write_sl0
|
||||
add wave -noupdate /pof_tx_rx_3_tb/avs_read_sl0
|
||||
add wave -noupdate /pof_tx_rx_3_tb/avs_readdatavalid_sl0
|
||||
add wave -noupdate /pof_tx_rx_3_tb/avs_write_sl1
|
||||
add wave -noupdate /pof_tx_rx_3_tb/avs_read_sl1
|
||||
add wave -noupdate /pof_tx_rx_3_tb/avs_readdatavalid_sl1
|
||||
add wave -noupdate /pof_tx_rx_3_tb/init_tx
|
||||
add wave -noupdate /pof_tx_rx_3_tb/init_rx
|
||||
add wave -noupdate /pof_tx_rx_3_tb/dir_in
|
||||
add wave -noupdate /pof_tx_rx_3_tb/pd_in
|
||||
add wave -noupdate /pof_tx_rx_3_tb/inc_pos
|
||||
add wave -noupdate /pof_tx_rx_3_tb/dec_pos
|
||||
add wave -noupdate -radix decimal /pof_tx_rx_3_tb/abs_position
|
||||
add wave -noupdate /pof_tx_rx_3_tb/tx_data
|
||||
add wave -noupdate /pof_tx_rx_3_tb/rx_data
|
||||
add wave -noupdate /pof_tx_rx_3_tb/init_out
|
||||
add wave -noupdate /pof_tx_rx_3_tb/dir_out
|
||||
add wave -noupdate /pof_tx_rx_3_tb/enc_out
|
||||
add wave -noupdate /pof_tx_rx_3_tb/pd_out
|
||||
add wave -noupdate /pof_tx_rx_3_tb/inc_pos_out
|
||||
add wave -noupdate /pof_tx_rx_3_tb/dec_pos_out
|
||||
add wave -noupdate -radix decimal /pof_tx_rx_3_tb/abs_pos_out
|
||||
add wave -noupdate /pof_tx_rx_3_tb/test_completed
|
||||
add wave -noupdate /pof_tx_rx_3_tb/running
|
||||
add wave -noupdate /pof_tx_rx_3_tb/configuring
|
||||
add wave -noupdate /pof_tx_rx_3_tb/passed
|
||||
add wave -noupdate /pof_tx_rx_3_tb/failed
|
||||
add wave -noupdate /pof_tx_rx_3_tb/stimuli_completed
|
||||
add wave -noupdate /pof_tx_rx_3_tb/avs_address
|
||||
add wave -noupdate -radix hexadecimal /pof_tx_rx_3_tb/avs_writedata
|
||||
add wave -noupdate -radix hexadecimal /pof_tx_rx_3_tb/avs_readdata_sl0
|
||||
add wave -noupdate -radix hexadecimal /pof_tx_rx_3_tb/avs_readdata_sl1
|
||||
add wave -noupdate -radix decimal /pof_tx_rx_3_tb/abs_position_d
|
||||
add wave -noupdate -radix decimal /pof_tx_rx_3_tb/swathe_pos
|
||||
add wave -noupdate /pof_tx_rx_3_tb/swathe_cnt
|
||||
add wave -noupdate -radix hexadecimal /pof_tx_rx_3_tb/avs_m
|
||||
add wave -noupdate -radix hexadecimal /pof_tx_rx_3_tb/avs_s
|
||||
add wave -noupdate /pof_tx_rx_3_tb/detected_error
|
||||
add wave -noupdate /pof_tx_rx_3_tb/dir_discr_cnt
|
||||
add wave -noupdate /pof_tx_rx_3_tb/pd_discr_cnt
|
||||
add wave -noupdate /pof_tx_rx_3_tb/pd_in_cnt
|
||||
add wave -noupdate /pof_tx_rx_3_tb/pd_out_cnt
|
||||
add wave -noupdate -radix decimal /pof_tx_rx_3_tb/abs_position
|
||||
add wave -noupdate -radix decimal /pof_tx_rx_3_tb/abs_pos_out
|
||||
add wave -noupdate /pof_tx_rx_3_tb/pos_discr_cnt
|
||||
add wave -noupdate /pof_tx_rx_3_tb/end_of_swathe
|
||||
add wave -noupdate /pof_tx_rx_3_tb/enc_pulse_cnt
|
||||
add wave -noupdate /pof_tx_rx_3_tb/dir_err
|
||||
add wave -noupdate /pof_tx_rx_3_tb/pd_err
|
||||
add wave -noupdate /pof_tx_rx_3_tb/pos_err
|
||||
add wave -noupdate /pof_tx_rx_3_tb/enc_err
|
||||
add wave -noupdate /pof_tx_rx_3_tb/ovfl_err
|
||||
add wave -noupdate /pof_tx_rx_3_tb/injected_errors
|
||||
add wave -noupdate /pof_tx_rx_3_tb/max_pos
|
||||
add wave -noupdate /pof_tx_rx_3_tb/min_pos
|
||||
add wave -noupdate /pof_tx_rx_3_tb/exp_enc_pulse
|
||||
add wave -noupdate /pof_tx_rx_3_tb/enc_discr
|
||||
add wave -noupdate /pof_tx_rx_3_tb/exp_enc_cnt
|
||||
add wave -noupdate /pof_tx_rx_3_tb/error_rate_thres
|
||||
add wave -noupdate /pof_tx_rx_3_tb/one_pps
|
||||
add wave -noupdate /pof_tx_rx_3_tb/max_error_flag
|
||||
add wave -noupdate /pof_tx_rx_3_tb/rx_watchdog
|
||||
add wave -noupdate /pof_tx_rx_3_tb/rx_watchdog_en
|
||||
add wave -noupdate /pof_tx_rx_3_tb/rx_watchdog_clr
|
||||
add wave -noupdate -divider EMB2POF
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/reset_n
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/clk
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/init
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/pd_in
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/inc_pos
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/dec_pos
|
||||
add wave -noupdate -radix decimal /pof_tx_rx_3_tb/iPOF_TX/abs_position
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/tx_data
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/avs_address
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/avs_write
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/avs_writedata
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/avs_read
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/avs_readdatavalid
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/avs_readdata
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/rd_event
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/wr_event
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/empty
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/full
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/tx_ready
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/rd_event_d
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/wr_event_i
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/enable
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/toggle_sync
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/toggle_pd
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/add_keepalive
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/ovfl_err
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/init_d
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/init_gen
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/init_v
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/init_blocked
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/init_blk_cnt
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/parity_bit
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/inject_error
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/inject_error_req
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/pd_event
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/pd_event_d
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/pd_event_dd
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/gray
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/clear
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/pd_in_d
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/pd_gen
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/clk
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/symbol_valid
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/symbol
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/tx_data
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/event_in_i
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/event_in
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/event_out
|
||||
add wave -noupdate -radix decimal /pof_tx_rx_3_tb/iPOF_TX/keepalive_cnt
|
||||
add wave -noupdate -divider POF2HMB
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/reset_n
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/clk
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/init
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/rx_clk
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/rx_data
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/init_out
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/enc_out
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/pd_out
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/inc_pos
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/dec_pos
|
||||
add wave -noupdate -radix decimal /pof_tx_rx_3_tb/iPOF_RX/abs_pos
|
||||
add wave -noupdate -radix unsigned /pof_tx_rx_3_tb/iPOF_RX/error_rate_thres
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/one_pps
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/max_error_flag
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/rx_watchdog
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/rx_watchdog_en
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/rx_watchdog_clr
|
||||
add wave -noupdate -radix unsigned /pof_tx_rx_3_tb/iPOF_RX/rx_wd_cnt
|
||||
add wave -noupdate -radix unsigned /pof_tx_rx_3_tb/iPOF_RX/error_rate_cnt
|
||||
add wave -noupdate -radix unsigned /pof_tx_rx_3_tb/iPOF_RX/error_rate
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/clear
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/clear_i
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/inc_pos_i
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/dec_pos_i
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/enable
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/sync_gen
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/pd_gen
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/symbol_error
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/rx_symbol_val
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/rx_symbol
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/rx_symbol_val_v
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/symbol_valid_i
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/symbol_valid_d
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/toggle_sync
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/sync_confirmed
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/sync_toggle_test
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/sync
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/toggle_pd
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/pd_confirmed
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/pd_toggle_test
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/pd
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/valid_pos
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/upd_pos
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/corr_done
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/corr_sign
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/skip_cnt
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/skip_pos
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/symbol_valid
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/symbol
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/apply_corr
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/clk_cnt
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/dist
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/abs_dist
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/next_pos_lsb
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/curr_pos_lsb
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/pos_corr
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/max_dist
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/gray_pos
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/symbol_i
|
||||
add wave -noupdate -radix unsigned /pof_tx_rx_3_tb/iPOF_RX/parity_err_cnt
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/enc_out
|
||||
add wave -noupdate -radix decimal /pof_tx_rx_3_tb/iPOF_RX/abs_pos_i
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/inc_pos_ii
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/dec_pos_ii
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/new_max
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/new_min
|
||||
add wave -noupdate -radix decimal /pof_tx_rx_3_tb/iPOF_RX/pos_max
|
||||
add wave -noupdate -radix decimal /pof_tx_rx_3_tb/iPOF_RX/pos_min
|
||||
add wave -noupdate -radix decimal /pof_tx_rx_3_tb/iPOF_RX/dist_pos
|
||||
add wave -noupdate -radix decimal /pof_tx_rx_3_tb/iPOF_RX/dist_neg
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/iRX_SYMBOL/data_width
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/iRX_SYMBOL/reset_n
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/iRX_SYMBOL/clk
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/iRX_SYMBOL/bit_div
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/iRX_SYMBOL/init
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/iRX_SYMBOL/data_out
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/iRX_SYMBOL/data_out_valid
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/iRX_SYMBOL/rx_data
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/iRX_SYMBOL/fsm_state_curr
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/iRX_SYMBOL/fsm_state_next
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/iRX_SYMBOL/rx_data_i
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/iRX_SYMBOL/shf_data
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/iRX_SYMBOL/rst_bit_cnt
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/iRX_SYMBOL/inc_bit_cnt
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/iRX_SYMBOL/rst_clk_cnt
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/iRX_SYMBOL/end_of_bit
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/iRX_SYMBOL/end_of_rx
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/iRX_SYMBOL/data_valid
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/iRX_SYMBOL/stop_bit
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/iRX_SYMBOL/data
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/iRX_SYMBOL/clk_cnt
|
||||
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/iRX_SYMBOL/bit_cnt
|
||||
TreeUpdate [SetDefaultTree]
|
||||
WaveRestoreCursors {{Cursor 2} {28538165210 ps} 0} {{Cursor 3} {28538185210 ps} 0} {{Cursor 4} {28538205210 ps} 0} {{Cursor 5} {28538225210 ps} 0}
|
||||
WaveRestoreCursorLinks {1 {2 {20000 ps} 3 {40000 ps} 4 {60000 ps}}} {2 {1 {-20000 ps}}} {3 {1 {-40000 ps}}} {4 {1 {-60000 ps}}}
|
||||
quietly wave cursor active 1
|
||||
configure wave -namecolwidth 365
|
||||
configure wave -valuecolwidth 100
|
||||
configure wave -justifyvalue left
|
||||
configure wave -signalnamewidth 0
|
||||
configure wave -snapdistance 10
|
||||
configure wave -datasetprefix 0
|
||||
configure wave -rowmargin 4
|
||||
configure wave -childrowmargin 2
|
||||
configure wave -gridoffset 0
|
||||
configure wave -gridperiod 1
|
||||
configure wave -griddelta 40
|
||||
configure wave -timeline 0
|
||||
configure wave -timelineunits ps
|
||||
update
|
||||
WaveRestoreZoom {28537732626 ps} {28538723476 ps}
|
||||
38
generic_ip/fire_pulse_manager/3/src/fire_pulse_3_pkg.vhd
Normal file
38
generic_ip/fire_pulse_manager/3/src/fire_pulse_3_pkg.vhd
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
-------------------------------------------------------------------------------
|
||||
-- Title : fire_pulse_pkg
|
||||
-- Project : HMB/EMB/SMB
|
||||
-------------------------------------------------------------------------------
|
||||
-- File : fire_pulse_pkg.vhd
|
||||
-- Author : Gianmarco Girau
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2017-09-08
|
||||
-- Last update: 2019-07-15
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'08
|
||||
-------------------------------------------------------------------------------
|
||||
-- Description:
|
||||
-- Package for fire_pulse_manager block
|
||||
-------------------------------------------------------------------------------
|
||||
-- altera vhdl_input_version vhdl_2008
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
package fire_pulse_3_pkg is
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Inner block mapping
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
constant blk_num : integer := 8; -- number of sub-blocks with dedicated
|
||||
-- C&S registers
|
||||
constant ch_num : integer := 4; -- number of Pulse-Generator blocks
|
||||
|
||||
constant fp_ctrl_id : natural := 0; -- Block ID for the Fire-Pulse-Mang Controller
|
||||
constant net_snk_id : natural := 1; -- Block ID for Net-Sync Sink
|
||||
constant log_blk_id : natural := 2; -- Block ID for the Event Logger
|
||||
constant int_enc_id : natural := 3; -- Block ID for the Internal Encoder Block
|
||||
constant pg_ch_id : natural := 4; -- Block ID for Pulse-Generator
|
||||
|
||||
end package fire_pulse_3_pkg;
|
||||
276
generic_ip/fire_pulse_manager/3/src/fire_pulse_ctrl_3.vhd
Normal file
276
generic_ip/fire_pulse_manager/3/src/fire_pulse_ctrl_3.vhd
Normal file
|
|
@ -0,0 +1,276 @@
|
|||
-------------------------------------------------------------------------------
|
||||
-- Title : fire_pulse_ctrl
|
||||
-- Project : HMB/EMB/SMB
|
||||
-------------------------------------------------------------------------------
|
||||
-- File : fire_pulse_ctrl.vhd
|
||||
-- Author : Gianmarco Girau
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2017-09-06
|
||||
-- Last update: 2019-07-15
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'08
|
||||
-------------------------------------------------------------------------------
|
||||
-- Description:
|
||||
-- Control service logic for the Fire-Controller-Manager
|
||||
-------------------------------------------------------------------------------
|
||||
-- altera vhdl_input_version vhdl_2008
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
entity fire_pulse_ctrl_3 is
|
||||
port(
|
||||
reset_n : in std_logic;
|
||||
clk : in std_logic;
|
||||
src_sel : out std_logic_vector(1 downto 0);
|
||||
uart_regen_bypass : out std_logic;
|
||||
upd_max_pos : out std_logic;
|
||||
upd_min_pos : out std_logic;
|
||||
enable_rx : out std_logic;
|
||||
uart_bit_div : out std_logic_vector(3 downto 0);
|
||||
error_rate_thres : out std_logic_vector(7 downto 0);
|
||||
max_error_flag : in std_logic;
|
||||
rx_watchdog : in std_logic;
|
||||
rx_watchdog_en : out std_logic;
|
||||
rx_watchdog_clr : out std_logic;
|
||||
parity_err_cnt : in std_logic_vector(15 downto 0);
|
||||
skip_pos_cnt : in std_logic_vector(15 downto 0);
|
||||
mon_point_src : in std_logic_vector(15 downto 0);
|
||||
mon_points : out std_logic_vector(3 downto 0);
|
||||
coarse_time : out std_logic_vector(31 downto 0);
|
||||
fine_time : out std_logic_vector(27 downto 0);
|
||||
one_pps : out std_logic;
|
||||
ext_fp_det : out std_logic_vector(15 downto 0);
|
||||
ext_fp_gen : out std_logic_vector(15 downto 0);
|
||||
-- Interrupt Senders
|
||||
ins_fpm_irq_0 : out std_logic;
|
||||
-- Avalon MM Interface
|
||||
avs_address : in std_logic_vector(3 downto 0);
|
||||
avs_write : in std_logic;
|
||||
avs_writedata : in std_logic_vector(31 downto 0);
|
||||
avs_read : in std_logic;
|
||||
avs_readdatavalid : out std_logic;
|
||||
avs_readdata : out std_logic_vector(31 downto 0));
|
||||
end entity fire_pulse_ctrl_3;
|
||||
|
||||
architecture rtl of fire_pulse_ctrl_3 is
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Control & Status Registers Map
|
||||
-----------------------------------------------------------------------------
|
||||
constant CSR_IP_ID : std_logic_vector(31 downto 0) := x"0000FF14";
|
||||
constant CSR_IP_VER : std_logic_vector(31 downto 0) := x"00000300";
|
||||
|
||||
constant CSR_IP_ID_REG : std_logic_vector(3 downto 0) := b"0000";
|
||||
constant CSR_IP_VER_REG : std_logic_vector(3 downto 0) := b"0001";
|
||||
constant SRC_SEL_REG : std_logic_vector(3 downto 0) := b"0010";
|
||||
constant POF_RX_CTRL : std_logic_vector(3 downto 0) := b"0011";
|
||||
constant MON_PT_CTRL_REG : std_logic_vector(3 downto 0) := b"0100";
|
||||
constant COARSE_TIME_INIT_REG : std_logic_vector(3 downto 0) := b"0101";
|
||||
constant FINE_TIME_INIT_REG : std_logic_vector(3 downto 0) := b"0110";
|
||||
constant FINE_TIME_REG : std_logic_vector(3 downto 0) := b"0111";
|
||||
constant COARSE_TIME_REG : std_logic_vector(3 downto 0) := b"1000";
|
||||
constant RX_ERROR_STATUS : std_logic_vector(3 downto 0) := b"1001";
|
||||
constant RX_ERROR_CSR : std_logic_vector(3 downto 0) := b"1010";
|
||||
constant IRQ_MNG_REG : std_logic_vector(3 downto 0) := b"1011";
|
||||
constant EXT_FP_CTRL_REG : std_logic_vector(3 downto 0) := b"1100";
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Constants, Signals
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
constant FINE_TIME_TC : integer := 100000000 - 1; -- clk must be 100MHz to
|
||||
-- make it right
|
||||
|
||||
signal enable_rx_i : std_logic;
|
||||
signal fine_time_wrap, time_ld_en : std_logic;
|
||||
signal rx_watchdog_en_i, rx_watchdog_clr_i : std_logic;
|
||||
signal uart_regen_bypass_i : std_logic;
|
||||
signal upd_min_pos_i, upd_max_pos_i : std_logic;
|
||||
signal irq, irq_src, irq_src_d : std_logic_vector(0 downto 0);
|
||||
signal irq_en, irq_mask, irq_val, irq_clr : std_logic_vector(0 downto 0);
|
||||
signal src_sel_i : std_logic_vector(1 downto 0);
|
||||
signal mp_sel0, mp_sel1, mp_sel2, mp_sel3 : std_logic_vector(3 downto 0);
|
||||
signal bit_div : std_logic_vector(3 downto 0);
|
||||
signal error_rate_thres_i : std_logic_vector(7 downto 0);
|
||||
signal fine_time_init, fine_time_i : std_logic_vector(27 downto 0);
|
||||
signal coarse_time_init, coarse_time_i : std_logic_vector(31 downto 0);
|
||||
signal ext_fp_det_i, ext_fp_gen_i : std_logic_vector(15 downto 0);
|
||||
|
||||
begin
|
||||
|
||||
pCTRL_REGs : process(reset_n, clk)
|
||||
begin -- process
|
||||
if (reset_n = '0') then
|
||||
fine_time_i <= (others => '0');
|
||||
coarse_time_i <= (others => '0');
|
||||
elsif (clk = '1' and clk'event) then
|
||||
if (time_ld_en = '1') then
|
||||
fine_time_i <= fine_time_init;
|
||||
elsif (fine_time_wrap = '1') then
|
||||
fine_time_i <= (others => '0');
|
||||
else
|
||||
fine_time_i <= std_logic_vector(unsigned(fine_time_i) + 1);
|
||||
end if;
|
||||
if (time_ld_en = '1') then
|
||||
coarse_time_i <= coarse_time_init;
|
||||
elsif (fine_time_wrap = '1') then
|
||||
coarse_time_i <= std_logic_vector(unsigned(coarse_time_i) + 1);
|
||||
end if;
|
||||
one_pps <= fine_time_wrap;
|
||||
end if;
|
||||
end process pCTRL_REGs;
|
||||
|
||||
fine_time_wrap <= '1' when unsigned(fine_time_i) = FINE_TIME_TC else '0';
|
||||
|
||||
coarse_time <= coarse_time_i;
|
||||
fine_time <= fine_time_i;
|
||||
|
||||
-- MOnitoring Point selection
|
||||
mon_points(0) <= mon_point_src(to_integer(unsigned(mp_sel0)));
|
||||
mon_points(1) <= mon_point_src(to_integer(unsigned(mp_sel1)));
|
||||
mon_points(2) <= mon_point_src(to_integer(unsigned(mp_sel2)));
|
||||
mon_points(3) <= mon_point_src(to_integer(unsigned(mp_sel3)));
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- IRQ generation and management
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
pIRQ : process(reset_n, clk)
|
||||
begin
|
||||
if (reset_n = '0') then
|
||||
ins_fpm_irq_0 <= '0';
|
||||
irq <= "0";
|
||||
irq_src_d <= "0";
|
||||
elsif (clk = '1' and clk'event) then
|
||||
irq_src_d <= irq_src;
|
||||
for n in 0 to irq'left loop
|
||||
if (irq_clr(n) = '1') then
|
||||
irq(n) <= '0';
|
||||
elsif (irq_en(n) = '1' and irq_src(n) = '1' and irq_src_d(n) = '0') then
|
||||
irq(n) <= '1';
|
||||
end if;
|
||||
end loop; -- n
|
||||
ins_fpm_irq_0 <= irq_val(0);
|
||||
end if;
|
||||
end process pIRQ;
|
||||
|
||||
irq_val <= irq and not irq_mask;
|
||||
irq_src <= "1" when max_error_flag = '1' or rx_watchdog = '1' else "0";
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- C&S registers
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
src_sel <= src_sel_i;
|
||||
enable_rx <= enable_rx_i;
|
||||
uart_regen_bypass <= uart_regen_bypass_i;
|
||||
|
||||
uart_bit_div <= bit_div;
|
||||
upd_max_pos <= upd_max_pos_i;
|
||||
upd_min_pos <= upd_min_pos_i;
|
||||
|
||||
error_rate_thres <= error_rate_thres_i;
|
||||
rx_watchdog_en <= rx_watchdog_en_i;
|
||||
rx_watchdog_clr <= rx_watchdog_clr_i;
|
||||
|
||||
ext_fp_det <= ext_fp_det_i;
|
||||
ext_fp_gen <= ext_fp_gen_i;
|
||||
|
||||
pCTRL_STATUS : process(reset_n, clk)
|
||||
begin
|
||||
if (reset_n = '0') then
|
||||
avs_readdatavalid <= '0';
|
||||
src_sel_i <= "00";
|
||||
enable_rx_i <= '0';
|
||||
uart_regen_bypass_i <= '0';
|
||||
upd_max_pos_i <= '0';
|
||||
upd_min_pos_i <= '0';
|
||||
bit_div <= "0100";
|
||||
error_rate_thres_i <= X"0A";
|
||||
rx_watchdog_en_i <= '1';
|
||||
rx_watchdog_clr_i <= '0';
|
||||
mp_sel0 <= X"0";
|
||||
mp_sel1 <= X"0";
|
||||
mp_sel2 <= X"0";
|
||||
mp_sel3 <= X"0";
|
||||
coarse_time_init <= (others => '0');
|
||||
fine_time_init <= (others => '0');
|
||||
time_ld_en <= '0';
|
||||
ext_fp_det_i <= X"0010";
|
||||
ext_fp_gen_i <= X"0020";
|
||||
elsif (clk = '1' and clk'event) then
|
||||
-- CTRL registers
|
||||
if (avs_write = '1') then
|
||||
case avs_address is
|
||||
when SRC_SEL_REG =>
|
||||
src_sel_i <= avs_writedata(1 downto 0);
|
||||
when POF_RX_CTRL =>
|
||||
enable_rx_i <= avs_writedata(0);
|
||||
uart_regen_bypass_i <= avs_writedata(1);
|
||||
upd_max_pos_i <= avs_writedata(2);
|
||||
upd_min_pos_i <= avs_writedata(3);
|
||||
bit_div <= avs_writedata(7 downto 4);
|
||||
when MON_PT_CTRL_REG =>
|
||||
mp_sel0 <= avs_writedata(3 downto 0);
|
||||
mp_sel1 <= avs_writedata(7 downto 4);
|
||||
mp_sel2 <= avs_writedata(11 downto 8);
|
||||
mp_sel3 <= avs_writedata(15 downto 12);
|
||||
when COARSE_TIME_INIT_REG =>
|
||||
coarse_time_init <= avs_writedata;
|
||||
when FINE_TIME_INIT_REG =>
|
||||
time_ld_en <= avs_writedata(28);
|
||||
fine_time_init <= avs_writedata(27 downto 0);
|
||||
when RX_ERROR_CSR =>
|
||||
error_rate_thres_i <= avs_writedata(7 downto 0);
|
||||
rx_watchdog_en_i <= avs_writedata(8);
|
||||
rx_watchdog_clr_i <= avs_writedata(9);
|
||||
when IRQ_MNG_REG =>
|
||||
irq_en <= avs_writedata(0 downto 0);
|
||||
irq_clr <= avs_writedata(4 downto 4);
|
||||
irq_mask <= avs_writedata(8 downto 8);
|
||||
when EXT_FP_CTRL_REG =>
|
||||
ext_fp_det_i <= avs_writedata(15 downto 0);
|
||||
ext_fp_gen_i <= avs_writedata(31 downto 16);
|
||||
when others => null;
|
||||
end case;
|
||||
end if;
|
||||
-- Read Ctrl & Status registers
|
||||
avs_readdatavalid <= avs_read;
|
||||
if (avs_read = '1') then
|
||||
case avs_address is
|
||||
when CSR_IP_ID_REG =>
|
||||
avs_readdata <= CSR_IP_ID;
|
||||
when CSR_IP_VER_REG =>
|
||||
avs_readdata <= CSR_IP_VER;
|
||||
when SRC_SEL_REG =>
|
||||
avs_readdata <= (0 => src_sel_i(0), 1 => src_sel_i(1), others => '0');
|
||||
when POF_RX_CTRL =>
|
||||
avs_readdata <= X"000000" & bit_div & upd_min_pos_i & upd_max_pos_i & uart_regen_bypass_i & enable_rx_i;
|
||||
when MON_PT_CTRL_REG =>
|
||||
avs_readdata <= X"0000" & mp_sel3 & mp_sel2 & mp_sel1 & mp_sel0;
|
||||
when COARSE_TIME_INIT_REG =>
|
||||
avs_readdata <= coarse_time_init;
|
||||
when FINE_TIME_INIT_REG =>
|
||||
avs_readdata <= b"000" & time_ld_en & fine_time_init;
|
||||
when RX_ERROR_STATUS =>
|
||||
avs_readdata <= skip_pos_cnt & parity_err_cnt;
|
||||
when FINE_TIME_REG =>
|
||||
avs_readdata <= X"0" & fine_time_i;
|
||||
when COARSE_TIME_REG =>
|
||||
avs_readdata <= coarse_time_i;
|
||||
when RX_ERROR_CSR =>
|
||||
avs_readdata <= X"00000" & max_error_flag & rx_watchdog & rx_watchdog_clr_i & rx_watchdog_en_i & error_rate_thres_i;
|
||||
when IRQ_MNG_REG =>
|
||||
avs_readdata <= X"0000" & "000" & irq_val & "000" & irq_mask & "000" & irq_clr & "000" & irq_en;
|
||||
when EXT_FP_CTRL_REG =>
|
||||
avs_readdata <= ext_fp_gen_i & ext_fp_det_i;
|
||||
when others =>
|
||||
avs_readdata <= X"BAD1BAD0";
|
||||
end case;
|
||||
end if;
|
||||
end if;
|
||||
end process pCTRL_STATUS;
|
||||
|
||||
end architecture rtl;
|
||||
108
generic_ip/fire_pulse_manager/3/src/fire_pulse_ext_3.vhd
Normal file
108
generic_ip/fire_pulse_manager/3/src/fire_pulse_ext_3.vhd
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
-------------------------------------------------------------------------------
|
||||
-- Title : fire_pulse_manager
|
||||
-- Project : GMA
|
||||
-------------------------------------------------------------------------------
|
||||
-- File : fire_pulse_ext.vhd
|
||||
-- Author : Christos Spirotis
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2017-10-03
|
||||
-- Last update: 2019-07-15
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'08
|
||||
-------------------------------------------------------------------------------
|
||||
-- Description:
|
||||
-- Detects external fire pulse and regenerates it
|
||||
-------------------------------------------------------------------------------
|
||||
-- altera vhdl_input_version vhdl_2008
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
library work;
|
||||
|
||||
entity fire_pulse_ext_3 is
|
||||
port(
|
||||
reset_n : in std_logic;
|
||||
clk : in std_logic; -- 100MHz
|
||||
|
||||
ext_fp_det : in std_logic_vector(15 downto 0);
|
||||
ext_fp_gen : in std_logic_vector(15 downto 0);
|
||||
|
||||
ext_in : in std_logic;
|
||||
ext_out : out std_logic
|
||||
);
|
||||
end entity fire_pulse_ext_3;
|
||||
|
||||
architecture rtl of fire_pulse_ext_3 is
|
||||
|
||||
signal ext_in_cnt : unsigned(15 downto 0);
|
||||
signal ext_out_cnt : unsigned(15 downto 0);
|
||||
signal ext_in_det : std_logic_vector( 2 downto 0);
|
||||
signal fp_gen : std_logic;
|
||||
|
||||
begin
|
||||
|
||||
-- Detect pulse
|
||||
pulse_det : process (clk, reset_n)
|
||||
begin
|
||||
if (reset_n = '0') then
|
||||
ext_in_cnt <= (others => '0');
|
||||
ext_in_det <= (others => '0');
|
||||
fp_gen <= '0';
|
||||
elsif rising_edge(clk) then
|
||||
fp_gen <= '0';
|
||||
ext_in_det <= ext_in_det(1 downto 0) & ext_in;
|
||||
|
||||
-- Detect rising edge while idle
|
||||
if (ext_in_det(2 downto 1) = "01" and ext_in_cnt = 0) then
|
||||
-- Start width counter
|
||||
ext_in_cnt <= X"0001";
|
||||
-- Measure width while signal high
|
||||
elsif ext_in_cnt /= 0 and ext_in_det(1) = '1' then
|
||||
-- Counter++
|
||||
ext_in_cnt <= ext_in_cnt + 1;
|
||||
-- If reached minimum width
|
||||
if ext_in_cnt >= unsigned(ext_fp_det) then
|
||||
-- Regenerate pulse
|
||||
fp_gen <= '1';
|
||||
-- Reset width counter
|
||||
ext_in_cnt <= (others => '0');
|
||||
end if;
|
||||
-- If signal drops before detection
|
||||
elsif ext_in_cnt /= 0 and ext_in_det(1) = '0' then
|
||||
-- Reset width counter
|
||||
ext_in_cnt <= (others => '0');
|
||||
end if;
|
||||
end if;
|
||||
end process pulse_det;
|
||||
|
||||
-- Regenerate pulse
|
||||
pulse_regen : process (clk, reset_n)
|
||||
begin
|
||||
if (reset_n = '0') then
|
||||
ext_out_cnt <= (others => '0');
|
||||
ext_out <= '0';
|
||||
elsif rising_edge(clk) then
|
||||
-- Look for pulse detected
|
||||
if fp_gen = '1' and ext_out_cnt = 0 then
|
||||
-- Start width counter
|
||||
ext_out_cnt <= X"0001";
|
||||
-- Generate pulse
|
||||
ext_out <= '1';
|
||||
-- If counting
|
||||
elsif ext_out_cnt /= 0 then
|
||||
-- Increment width
|
||||
ext_out_cnt <= ext_out_cnt + 1;
|
||||
-- If width reached programmed value
|
||||
if ext_out_cnt >= unsigned(ext_fp_gen) then
|
||||
-- Reset pulse
|
||||
ext_out <= '0';
|
||||
-- Reset width counter
|
||||
ext_out_cnt <= (others => '0');
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end process pulse_regen;
|
||||
|
||||
end architecture rtl;
|
||||
421
generic_ip/fire_pulse_manager/3/src/fire_pulse_manager_3.vhd
Normal file
421
generic_ip/fire_pulse_manager/3/src/fire_pulse_manager_3.vhd
Normal file
|
|
@ -0,0 +1,421 @@
|
|||
-------------------------------------------------------------------------------
|
||||
-- Title : fire_pulse_manager
|
||||
-- Project : HMB/EMB/SMB
|
||||
-------------------------------------------------------------------------------
|
||||
-- File : fire_pulse_manager.vhd
|
||||
-- Author : Gianmarco Girau
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2017-09-06
|
||||
-- Last update: 2019-07-15
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'08
|
||||
-------------------------------------------------------------------------------
|
||||
-- Description:
|
||||
-- Generates fire request from the EMS output data, transferred either via POF
|
||||
-- or through NetSync
|
||||
-------------------------------------------------------------------------------
|
||||
-- altera vhdl_input_version vhdl_2008
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
use work.fire_pulse_3_pkg.all;
|
||||
|
||||
entity fire_pulse_manager_3 is
|
||||
port(
|
||||
reset_n : in std_logic;
|
||||
clk : in std_logic; -- 100MHz
|
||||
rx_clk : in std_logic; -- 300MHz (typical)
|
||||
-- Datapath I/Os
|
||||
pof_rx : in std_logic;
|
||||
pof_tx : out std_logic;
|
||||
pof_iso_en : out std_logic;
|
||||
fire_pulse : out std_logic_vector(ch_num - 1 downto 0);
|
||||
mon_pt : out std_logic_vector(3 downto 0); -- Monitoring Points
|
||||
-- on header J7
|
||||
-- Interrupt Senders
|
||||
ins_fpm_irq_0 : out std_logic;
|
||||
ins_fpm_irq_1 : out std_logic; -- @suppress "Unused port: ins_fpm_irq_1 is not used in work.fire_pulse_manager_1(rtl)"
|
||||
ins_fpm_irq_2 : out std_logic; -- @suppress "Unused port: ins_fpm_irq_2 is not used in work.fire_pulse_manager_1(rtl)"
|
||||
ins_fpm_irq_3 : out std_logic; -- @suppress "Unused port: ins_fpm_irq_3 is not used in work.fire_pulse_manager_1(rtl)"
|
||||
-- Avalon MM (Slave) Interface
|
||||
avs_address : in std_logic_vector(14 downto 0);
|
||||
avs_write : in std_logic;
|
||||
avs_writedata : in std_logic_vector(31 downto 0);
|
||||
avs_read : in std_logic;
|
||||
avs_waitrequest : out std_logic;
|
||||
avs_readdata : out std_logic_vector(31 downto 0));
|
||||
end entity fire_pulse_manager_3;
|
||||
|
||||
architecture rtl of fire_pulse_manager_3 is
|
||||
|
||||
constant PD_QUEUE_SIZE : natural := 512;
|
||||
|
||||
type diag_cnt_en_t is array (1 to ch_num) of boolean;
|
||||
constant DIAG_COUNTER_EN : diag_cnt_en_t := (1 => true, others => false);
|
||||
|
||||
signal reset_n_i : std_logic;
|
||||
--
|
||||
signal cs_addr : std_logic_vector(10 downto 0);
|
||||
signal cs_write_en : std_logic_vector(blk_num - 1 downto 0);
|
||||
signal cs_write_data : std_logic_vector(31 downto 0);
|
||||
signal cs_read_en : std_logic_vector(blk_num - 1 downto 0);
|
||||
signal cs_read_valid : std_logic_vector(blk_num - 1 downto 0);
|
||||
signal cs_read_data : std_logic_vector(32 * blk_num - 1 downto 0);
|
||||
--
|
||||
signal cs_ctrl_write_en : std_logic;
|
||||
signal cs_ctrl_read_en : std_logic;
|
||||
signal cs_ctrl_read_valid : std_logic;
|
||||
signal cs_ctrl_read_data : std_logic_vector(31 downto 0);
|
||||
--
|
||||
signal cs_pg_write_en : std_logic_vector(ch_num - 1 downto 0);
|
||||
signal cs_pg_read_en : std_logic_vector(ch_num - 1 downto 0);
|
||||
signal cs_pg_read_valid : std_logic_vector(ch_num - 1 downto 0);
|
||||
signal cs_pg_read_data : std_logic_vector(32 * ch_num - 1 downto 0);
|
||||
--
|
||||
signal cs_nsnk_write_en : std_logic;
|
||||
signal cs_nsnk_read_en : std_logic;
|
||||
signal cs_nsnk_read_valid : std_logic;
|
||||
signal cs_nsnk_read_data : std_logic_vector(31 downto 0);
|
||||
--
|
||||
signal cs_log_write_en : std_logic;
|
||||
signal cs_log_read_en : std_logic;
|
||||
signal cs_log_read_valid : std_logic;
|
||||
signal cs_log_read_data : std_logic_vector(31 downto 0);
|
||||
--
|
||||
signal cs_ie_write_en : std_logic;
|
||||
signal cs_ie_read_en : std_logic;
|
||||
signal cs_ie_read_valid : std_logic;
|
||||
signal cs_ie_read_data : std_logic_vector(31 downto 0);
|
||||
--
|
||||
signal enable_rx : std_logic;
|
||||
signal uart_regen_bypass : std_logic;
|
||||
signal upd_max_pos : std_logic;
|
||||
signal upd_min_pos : std_logic;
|
||||
signal max_error_flag : std_logic;
|
||||
signal rx_watchdog : std_logic;
|
||||
signal rx_watchdog_en : std_logic;
|
||||
signal rx_watchdog_clr : std_logic;
|
||||
signal bit_div : std_logic_vector(3 downto 0);
|
||||
signal error_rate_thres : std_logic_vector(7 downto 0);
|
||||
signal parity_err_cnt : std_logic_vector(15 downto 0);
|
||||
signal skip_pos_cnt : std_logic_vector(15 downto 0);
|
||||
signal mon_point_src : std_logic_vector(15 downto 0);
|
||||
signal fine_time : std_logic_vector(27 downto 0);
|
||||
signal coarse_time : std_logic_vector(31 downto 0);
|
||||
--
|
||||
signal remote_init : std_logic;
|
||||
signal dp_dir : std_logic_vector(ch_num - 1 downto 0);
|
||||
signal set_pos_ie : std_logic;
|
||||
signal enc_pulse : std_logic;
|
||||
signal enc_pulse_ie : std_logic;
|
||||
signal enc_pulse_pof : std_logic;
|
||||
signal pd_pulse : std_logic;
|
||||
signal pd_pulse_ie : std_logic;
|
||||
signal pd_pulse_pof : std_logic;
|
||||
signal inc_pos : std_logic;
|
||||
signal inc_pos_pof : std_logic;
|
||||
signal inc_pos_ie : std_logic;
|
||||
signal dec_pos : std_logic;
|
||||
signal dec_pos_pof : std_logic;
|
||||
signal dec_pos_ie : std_logic;
|
||||
signal abs_pos : std_logic_vector(31 downto 0);
|
||||
signal abs_pos_pof : std_logic_vector(31 downto 0);
|
||||
signal abs_pos_ie : std_logic_vector(39 downto 0);
|
||||
--
|
||||
signal ch_pd, ch_pulse_out : std_logic_vector(ch_num - 1 downto 0);
|
||||
signal ch_raw_pulse, ch_mask : std_logic_vector(ch_num - 1 downto 0);
|
||||
signal fire_pulse_i : std_logic_vector(ch_num - 1 downto 0);
|
||||
signal src_sel : std_logic_vector(1 downto 0);
|
||||
--
|
||||
signal one_pps : std_logic;
|
||||
signal ext_fp_det : std_logic_vector(15 downto 0);
|
||||
signal ext_fp_gen : std_logic_vector(15 downto 0);
|
||||
signal pof_rx_regen : std_logic;
|
||||
|
||||
begin
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Synchronize the input reset (h2f_reset) to the clock (from PLL)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
iSyncReset : entity work.sync_reset
|
||||
port map(
|
||||
async_rstN => reset_n,
|
||||
clk => clk,
|
||||
sync_rstN => reset_n_i);
|
||||
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- C&S Register Interface Splitting
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
iCS_BUS_ITF : entity work.cs_bus_ift
|
||||
generic map(
|
||||
blk_num => blk_num)
|
||||
port map(
|
||||
rstN => reset_n_i,
|
||||
clk => clk,
|
||||
avs_address => avs_address(14 downto 0),
|
||||
avs_write => avs_write,
|
||||
avs_writedata => avs_writedata,
|
||||
avs_read => avs_read,
|
||||
avs_waitrequest => avs_waitrequest,
|
||||
avs_readdata => avs_readdata,
|
||||
cs_addr => cs_addr,
|
||||
cs_we => cs_write_en,
|
||||
cs_wr_data => cs_write_data,
|
||||
cs_re => cs_read_en,
|
||||
cs_rv => cs_read_valid,
|
||||
cs_rd_data => cs_read_data);
|
||||
|
||||
cs_ctrl_write_en <= cs_write_en(fp_ctrl_id);
|
||||
cs_pg_write_en_g : for i in 1 to ch_num generate
|
||||
cs_pg_write_en(i - 1) <= cs_write_en(pg_ch_id + i - 1);
|
||||
end generate;
|
||||
cs_nsnk_write_en <= cs_write_en(net_snk_id);
|
||||
cs_log_write_en <= cs_write_en(log_blk_id);
|
||||
cs_ie_write_en <= cs_write_en(int_enc_id);
|
||||
|
||||
cs_ctrl_read_en <= cs_read_en(fp_ctrl_id);
|
||||
cs_pg_read_en_g : for i in 1 to ch_num generate
|
||||
cs_pg_read_en(i - 1) <= cs_read_en(pg_ch_id + i - 1);
|
||||
end generate;
|
||||
cs_nsnk_read_en <= cs_read_en(net_snk_id);
|
||||
cs_log_read_en <= cs_read_en(log_blk_id);
|
||||
cs_ie_read_en <= cs_read_en(int_enc_id);
|
||||
|
||||
cs_read_valid(fp_ctrl_id) <= cs_ctrl_read_valid;
|
||||
cs_read_valid_pg_g : for i in 1 to ch_num generate
|
||||
cs_read_valid(pg_ch_id + i - 1) <= cs_pg_read_valid(i - 1);
|
||||
end generate;
|
||||
cs_read_valid(net_snk_id) <= cs_nsnk_read_valid;
|
||||
cs_read_valid(log_blk_id) <= cs_log_read_valid;
|
||||
cs_read_valid(int_enc_id) <= cs_ie_read_valid;
|
||||
|
||||
cs_read_data(31 + 32 * fp_ctrl_id downto 32 * fp_ctrl_id) <= cs_ctrl_read_data;
|
||||
cs_read_data_pg_g : for i in 1 to ch_num generate
|
||||
cs_read_data(31 + 32 * (pg_ch_id + i - 1) downto 32 * (pg_ch_id + i - 1)) <= cs_pg_read_data(31 + 32 * (i - 1) downto 32 * (i - 1));
|
||||
end generate;
|
||||
cs_read_data(31 + 32 * net_snk_id downto 32 * net_snk_id) <= cs_nsnk_read_data;
|
||||
cs_read_data(31 + 32 * log_blk_id downto 32 * log_blk_id) <= cs_log_read_data;
|
||||
cs_read_data(31 + 32 * int_enc_id downto 32 * int_enc_id) <= cs_ie_read_data;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Fire-Pulse-Manager Controller
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
iCTRL : entity work.fire_pulse_ctrl_3
|
||||
port map(
|
||||
reset_n => reset_n_i,
|
||||
clk => clk,
|
||||
src_sel => src_sel,
|
||||
uart_regen_bypass => uart_regen_bypass,
|
||||
upd_max_pos => upd_max_pos,
|
||||
upd_min_pos => upd_min_pos,
|
||||
enable_rx => enable_rx,
|
||||
uart_bit_div => bit_div,
|
||||
error_rate_thres => error_rate_thres,
|
||||
max_error_flag => max_error_flag,
|
||||
rx_watchdog => rx_watchdog,
|
||||
rx_watchdog_en => rx_watchdog_en,
|
||||
rx_watchdog_clr => rx_watchdog_clr,
|
||||
parity_err_cnt => parity_err_cnt,
|
||||
skip_pos_cnt => skip_pos_cnt,
|
||||
mon_point_src => mon_point_src,
|
||||
mon_points => mon_pt,
|
||||
coarse_time => coarse_time,
|
||||
fine_time => fine_time,
|
||||
one_pps => one_pps,
|
||||
ext_fp_det => ext_fp_det,
|
||||
ext_fp_gen => ext_fp_gen,
|
||||
ins_fpm_irq_0 => ins_fpm_irq_0,
|
||||
avs_address => cs_addr(3 downto 0),
|
||||
avs_write => cs_ctrl_write_en,
|
||||
avs_writedata => cs_write_data,
|
||||
avs_read => cs_ctrl_read_en,
|
||||
avs_readdatavalid => cs_ctrl_read_valid,
|
||||
avs_readdata => cs_ctrl_read_data);
|
||||
|
||||
ins_fpm_irq_1 <= '0';
|
||||
ins_fpm_irq_2 <= '0';
|
||||
ins_fpm_irq_3 <= '0';
|
||||
|
||||
-- Output multiplexer
|
||||
fire_pulse_i <= ch_pulse_out when src_sel(0) = '1' else (others => pof_rx_regen);
|
||||
fire_pulse <= fire_pulse_i;
|
||||
|
||||
pd_pulse <= pd_pulse_pof when src_sel(1) = '0' else pd_pulse_ie;
|
||||
enc_pulse <= enc_pulse_pof when src_sel(1) = '0' else enc_pulse_ie;
|
||||
abs_pos <= abs_pos_pof when src_sel(1) = '0' else abs_pos_ie(31 downto 0);
|
||||
inc_pos <= inc_pos_pof when src_sel(1) = '0' else inc_pos_ie;
|
||||
dec_pos <= dec_pos_pof when src_sel(1) = '0' else dec_pos_ie;
|
||||
|
||||
mon_point_src(0) <= remote_init;
|
||||
mon_point_src(1) <= dp_dir(0);
|
||||
mon_point_src(2) <= pd_pulse;
|
||||
mon_point_src(3) <= enc_pulse;
|
||||
mon_point_src(4) <= ch_pd(0);
|
||||
mon_point_src(5) <= ch_pulse_out(0);
|
||||
mon_point_src(6) <= ch_raw_pulse(0);
|
||||
mon_point_src(7) <= ch_mask(0);
|
||||
mon_point_src(8) <= pof_rx;
|
||||
mon_point_src(9) <= fire_pulse_i(0);
|
||||
--
|
||||
mon_point_src(15 downto 10) <= (others => '0');
|
||||
|
||||
pof_iso_en <= enable_rx;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Pulse Generator
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
pulse_generator_g : for i in 1 to ch_num generate
|
||||
iCH_PG : entity work.pulse_generator_1
|
||||
generic map(
|
||||
PD_QUEUE_SIZE => PD_QUEUE_SIZE,
|
||||
PULSE_DELAY_EQUAL_EN => false,
|
||||
OUT_PULSE_CONDITION => true,
|
||||
OVERDRIVE_CHECK => false,
|
||||
DIAG_COUNTERS => DIAG_COUNTER_EN(i))
|
||||
port map(
|
||||
clk => clk,
|
||||
reset_n => reset_n_i,
|
||||
init => remote_init,
|
||||
pd_in => pd_pulse,
|
||||
abs_position => abs_pos,
|
||||
dp_dir => dp_dir(i - 1),
|
||||
pulse_out => ch_pulse_out(i - 1),
|
||||
ch_pd => ch_pd(i - 1),
|
||||
ch_mask => ch_mask(i - 1),
|
||||
raw_pulse_out => ch_raw_pulse(i - 1),
|
||||
enc_pulse => open,
|
||||
avs_address => cs_addr(9 downto 0),
|
||||
avs_write => cs_pg_write_en(i - 1),
|
||||
avs_writedata => cs_write_data,
|
||||
avs_read => cs_pg_read_en(i - 1),
|
||||
avs_readdatavalid => cs_pg_read_valid(i - 1),
|
||||
avs_readdata => cs_pg_read_data(31 + 32 * (i - 1) downto 32 * (i - 1)));
|
||||
end generate;
|
||||
-----------------------------------------------------------------------------
|
||||
-- POF Interface
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
-- POF Receiver
|
||||
iPOF_RX : entity work.pof_rx_3
|
||||
port map(
|
||||
reset_n => reset_n_i,
|
||||
clk => clk,
|
||||
init => '0',
|
||||
rx_clk => rx_clk,
|
||||
rx_data => pof_rx,
|
||||
init_out => remote_init,
|
||||
dp_dir => dp_dir(0),
|
||||
enc_out => enc_pulse_pof,
|
||||
pd_out => pd_pulse_pof,
|
||||
inc_pos => inc_pos_pof,
|
||||
dec_pos => dec_pos_pof,
|
||||
abs_pos => abs_pos_pof,
|
||||
enable => enable_rx,
|
||||
bit_div => bit_div,
|
||||
error_rate_thres => error_rate_thres,
|
||||
one_pps => one_pps,
|
||||
upd_max_pos => upd_max_pos,
|
||||
upd_min_pos => upd_min_pos,
|
||||
max_error_flag => max_error_flag,
|
||||
rx_watchdog => rx_watchdog,
|
||||
rx_watchdog_en => rx_watchdog_en,
|
||||
rx_watchdog_clr => rx_watchdog_clr,
|
||||
parity_err_cnt => parity_err_cnt,
|
||||
skip_pos_cnt => skip_pos_cnt);
|
||||
|
||||
-- UART signal regeneration
|
||||
iUART_REGEN : entity work.uart_regen_3
|
||||
generic map(
|
||||
data_width => 8)
|
||||
port map(
|
||||
reset_n => reset_n,
|
||||
clk => rx_clk,
|
||||
bit_div => bit_div,
|
||||
enable => enable_rx,
|
||||
bypass_en => uart_regen_bypass,
|
||||
uart_rx => pof_rx,
|
||||
uart_tx => pof_tx);
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Ext fire pulse regen
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
fire_pulse_ext_i : entity work.fire_pulse_ext_3
|
||||
port map(
|
||||
reset_n => reset_n_i,
|
||||
clk => clk,
|
||||
|
||||
ext_fp_det => ext_fp_det,
|
||||
ext_fp_gen => ext_fp_gen,
|
||||
|
||||
ext_in => pof_rx,
|
||||
ext_out => pof_rx_regen
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Internal encoder generator
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
iEMUL : entity work.enc_pd_emul_1
|
||||
generic map(
|
||||
SEQ_ENABLE => false)
|
||||
port map(
|
||||
clk => clk,
|
||||
reset_n => reset_n_i,
|
||||
ttl_pd => open,
|
||||
ttl_enc_p1 => open,
|
||||
ttl_enc_p2 => open,
|
||||
ttl_enc_zp => open,
|
||||
rs422_pd => pd_pulse_ie,
|
||||
rs422_enc_p1 => open,
|
||||
rs422_enc_p2 => open,
|
||||
rs422_enc_zp => open,
|
||||
abs_pos_out => abs_pos_ie,
|
||||
set_pos_out => set_pos_ie,
|
||||
inc_pos_out => inc_pos_ie,
|
||||
dec_pos_out => dec_pos_ie,
|
||||
avs_address => cs_addr(9 downto 0),
|
||||
avs_write => cs_ie_write_en,
|
||||
avs_writedata => cs_write_data,
|
||||
avs_read => cs_ie_read_en,
|
||||
avs_readdatavalid => cs_ie_read_valid,
|
||||
avs_readdata => cs_ie_read_data);
|
||||
|
||||
enc_pulse_ie <= inc_pos_ie when dp_dir(0) = '0' else dec_pos_ie;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- NetSync Sink
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
-- Not instantiated yet
|
||||
pNSNK_RD_VALID : process(clk)
|
||||
begin
|
||||
if (clk = '1' and clk'event) then
|
||||
cs_nsnk_read_valid <= cs_nsnk_read_en;
|
||||
end if;
|
||||
end process pNSNK_RD_VALID;
|
||||
|
||||
cs_nsnk_read_data <= X"DEAD_BEEF";
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Event Logger
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
-- Not instantiated yet
|
||||
pLOG_RD_VALID : process(clk)
|
||||
begin
|
||||
if (clk = '1' and clk'event) then
|
||||
cs_log_read_valid <= cs_log_read_en;
|
||||
end if;
|
||||
end process pLOG_RD_VALID;
|
||||
|
||||
cs_log_read_data <= X"DEAD_BEEF";
|
||||
|
||||
end architecture rtl;
|
||||
358
generic_ip/fire_pulse_manager/3/src/pof_rx_3.vhd
Normal file
358
generic_ip/fire_pulse_manager/3/src/pof_rx_3.vhd
Normal file
|
|
@ -0,0 +1,358 @@
|
|||
-------------------------------------------------------------------------------
|
||||
-- Title : pof_rx
|
||||
-- Project : SMB
|
||||
-------------------------------------------------------------------------------
|
||||
-- File : pof_rx.vhd
|
||||
-- Author : Gianmarco Girau
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2017-08-23
|
||||
-- Last update: 2019-07-15
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'08
|
||||
-------------------------------------------------------------------------------
|
||||
-- Description:
|
||||
-- Deserializes and decodes the EMS (SMB) output, received from the POF.
|
||||
-------------------------------------------------------------------------------
|
||||
-- altera vhdl_input_version vhdl_2008
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
entity pof_rx_3 is
|
||||
port(
|
||||
reset_n : in std_logic;
|
||||
clk : in std_logic;
|
||||
--
|
||||
init : in std_logic;
|
||||
rx_clk : in std_logic;
|
||||
rx_data : in std_logic;
|
||||
init_out : out std_logic;
|
||||
dp_dir : in std_logic;
|
||||
enc_out : out std_logic;
|
||||
pd_out : out std_logic;
|
||||
inc_pos : out std_logic;
|
||||
dec_pos : out std_logic;
|
||||
abs_pos : out std_logic_vector(31 downto 0);
|
||||
-- C&S
|
||||
enable : in std_logic;
|
||||
bit_div : in std_logic_vector(3 downto 0);
|
||||
error_rate_thres : in std_logic_vector(7 downto 0);
|
||||
one_pps : in std_logic;
|
||||
upd_max_pos : in std_logic;
|
||||
upd_min_pos : in std_logic;
|
||||
max_error_flag : out std_logic;
|
||||
rx_watchdog : out std_logic;
|
||||
rx_watchdog_en : in std_logic;
|
||||
rx_watchdog_clr : in std_logic;
|
||||
parity_err_cnt : out std_logic_vector(15 downto 0);
|
||||
skip_pos_cnt : out std_logic_vector(15 downto 0));
|
||||
end entity pof_rx_3;
|
||||
|
||||
architecture rtl of pof_rx_3 is
|
||||
|
||||
-- check the parity bit (odd parity)
|
||||
function odd_parity_check(data : std_logic_vector) return std_logic is
|
||||
variable parity_bit : std_logic := '0';
|
||||
begin
|
||||
for n in 0 to data'length - 1 loop
|
||||
parity_bit := parity_bit xor data(n);
|
||||
end loop; -- n
|
||||
return parity_bit;
|
||||
end function odd_parity_check;
|
||||
|
||||
-- Gray-to-Binary coding
|
||||
function gray2bin(gray : std_logic_vector) return std_logic_vector is
|
||||
variable bin : std_logic_vector(gray'range);
|
||||
begin
|
||||
bin(gray'length - 1) := gray(gray'length - 1);
|
||||
for i in gray'length - 2 downto 0 loop
|
||||
bin(i) := bin(i + 1) xor gray(i);
|
||||
end loop; -- n
|
||||
return bin;
|
||||
end function gray2bin;
|
||||
|
||||
signal clear, symbol_ok, inc_pos_i, dec_pos_i : std_logic;
|
||||
signal sync_gen, pd_gen, symbol_error, sync_d : std_logic;
|
||||
signal symbol_valid, symbol_valid_i, symbol_valid_d : std_logic;
|
||||
signal toggle_sync, sync_confirmed, sync_toggle_test, sync : std_logic;
|
||||
signal toggle_pd, pd_confirmed, pd_toggle_test, pd : std_logic;
|
||||
signal valid_pos, upd_pos, corr_done, corr_sign : std_logic;
|
||||
signal skip_pos, apply_corr, inc_pos_ii, dec_pos_ii : std_logic;
|
||||
signal new_max, new_min, rx_error, rx_error_i : std_logic;
|
||||
signal rx_symbol_val, clear_i, skip_pos_d, pos_recovery : std_logic;
|
||||
signal dp_dir_d, dp_dir_change, max_error_flag_i : std_logic;
|
||||
--
|
||||
signal clk_cnt : std_logic_vector(1 downto 0);
|
||||
signal dist, abs_dist, skip_cnt : std_logic_vector(3 downto 0);
|
||||
signal next_pos_lsb, curr_pos_lsb : std_logic_vector(3 downto 0);
|
||||
signal pos_corr, max_dist, rx_error_v : std_logic_vector(3 downto 0);
|
||||
signal gray_pos, rx_symbol_val_v : std_logic_vector(3 downto 0);
|
||||
signal symbol, symbol_i, rx_symbol : std_logic_vector(7 downto 0);
|
||||
signal rx_wd_cnt : std_logic_vector(9 downto 0);
|
||||
signal parity_err_cnt_i, skip_pos_cnt_i : std_logic_vector(15 downto 0);
|
||||
signal error_rate_cnt, error_rate : std_logic_vector(15 downto 0);
|
||||
signal abs_pos_i, pos_max, pos_min : std_logic_vector(31 downto 0);
|
||||
signal dist_pos, dist_neg : std_logic_vector(31 downto 0);
|
||||
|
||||
begin
|
||||
|
||||
clear <= not enable or init;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- De-serialize symbols (Serial clock at 300 MHz - typical)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
iRX_SYMBOL : entity work.uart_rx_3
|
||||
generic map(
|
||||
data_width => 8)
|
||||
port map(
|
||||
reset_n => reset_n,
|
||||
clk => rx_clk,
|
||||
bit_div => bit_div,
|
||||
init => clear_i,
|
||||
data_out => rx_symbol,
|
||||
data_out_valid => rx_symbol_val,
|
||||
rx_error => rx_error,
|
||||
rx_data => rx_data);
|
||||
|
||||
-- Synchronize to the local clock
|
||||
pLATCH_RX_DATA : process(rx_clk)
|
||||
begin
|
||||
if (rx_clk = '1' and rx_clk'event) then
|
||||
if (rx_symbol_val = '1') then
|
||||
symbol <= rx_symbol;
|
||||
end if;
|
||||
if (rx_symbol_val = '1') then
|
||||
rx_symbol_val_v <= "1111";
|
||||
else
|
||||
rx_symbol_val_v <= '0' & rx_symbol_val_v(3 downto 1);
|
||||
end if;
|
||||
if (rx_error = '1') then
|
||||
rx_error_v <= "1111";
|
||||
else
|
||||
rx_error_v <= '0' & rx_error_v(3 downto 1);
|
||||
end if;
|
||||
end if;
|
||||
end process pLATCH_RX_DATA;
|
||||
|
||||
iSYNC_SYMBOL_VAL : entity work.sync_wire_rEdge
|
||||
generic map(rst_val => '0', sync_stages => 3)
|
||||
port map(rstN => reset_n, clk => clk, async_in => rx_symbol_val_v(0), sync_out => symbol_valid);
|
||||
|
||||
iSYNC_RX_ERROR : entity work.sync_wire_rEdge
|
||||
generic map(rst_val => '0', sync_stages => 3)
|
||||
port map(rstN => reset_n, clk => clk, async_in => rx_error_v(0), sync_out => rx_error_i);
|
||||
-- synchronize clear to tx_clk
|
||||
iSYNC_CLEAR : entity work.sync_wire
|
||||
generic map(rst_val => '1', sync_stages => 2)
|
||||
port map(
|
||||
rstN => reset_n, clk => rx_clk, async_in => clear, sync_out => clear_i);
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Toggle-Bits Decoding
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
pTOGGLE_DEC : process(clk)
|
||||
begin
|
||||
if (clk = '1' and clk'event) then
|
||||
-- Toggle Bits
|
||||
if (clear = '1') then
|
||||
toggle_sync <= '0';
|
||||
elsif (sync_confirmed = '1') then
|
||||
toggle_sync <= not toggle_sync;
|
||||
end if;
|
||||
if (clear = '1' or sync_confirmed = '1' or (symbol_valid_i = '1' and symbol_i(0) = toggle_sync)) then
|
||||
sync_toggle_test <= '0';
|
||||
elsif (sync_gen = '1') then
|
||||
sync_toggle_test <= '1';
|
||||
end if;
|
||||
sync <= sync_confirmed;
|
||||
sync_d <= sync;
|
||||
if (clear = '1') then
|
||||
toggle_pd <= '0';
|
||||
elsif (pd_confirmed = '1') then
|
||||
toggle_pd <= not toggle_pd;
|
||||
end if;
|
||||
if (clear = '1' or pd_confirmed = '1' or (symbol_valid_i = '1' and symbol_i(2) = toggle_pd)) then
|
||||
pd_toggle_test <= '0';
|
||||
elsif (pd_gen = '1') then
|
||||
pd_toggle_test <= '1';
|
||||
end if;
|
||||
pd <= pd_confirmed;
|
||||
--
|
||||
symbol_valid_i <= symbol_valid and symbol_ok;
|
||||
symbol_error <= symbol_valid and not symbol_ok;
|
||||
if (clear = '1') then
|
||||
parity_err_cnt_i <= (others => '0');
|
||||
elsif (symbol_error = '1') then
|
||||
parity_err_cnt_i <= std_logic_vector(unsigned(parity_err_cnt_i) + 1);
|
||||
end if;
|
||||
end if;
|
||||
end process pTOGGLE_DEC;
|
||||
|
||||
symbol_i <= symbol;
|
||||
|
||||
-- The received symbol is assumed to be vaild when there is not parity error
|
||||
-- and when the two bits with the PD-toggle bit are equal
|
||||
symbol_ok <= '1' when odd_parity_check(symbol) = '1' and (symbol(1) = symbol(2)) else '0';
|
||||
|
||||
sync_gen <= '1' when symbol_valid_i = '1' and symbol_i(0) /= toggle_sync else '0';
|
||||
pd_gen <= '1' when symbol_valid_i = '1' and symbol_i(2) /= toggle_pd else '0';
|
||||
--
|
||||
sync_confirmed <= sync_gen and sync_toggle_test;
|
||||
pd_confirmed <= pd_gen and pd_toggle_test;
|
||||
--
|
||||
init_out <= sync;
|
||||
pd_out <= pd;
|
||||
|
||||
parity_err_cnt <= parity_err_cnt_i;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Position management & Error Recovery
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
gray_pos <= symbol_i(6 downto 3);
|
||||
next_pos_lsb <= gray2bin(gray_pos);
|
||||
curr_pos_lsb <= abs_pos_i(3 downto 0);
|
||||
|
||||
--dist <= std_logic_vector(signed(next_pos_lsb)-signed(curr_pos_lsb));
|
||||
abs_dist <= dist when dist(3) = '0' else std_logic_vector(unsigned(not dist) + 1);
|
||||
|
||||
pPOS_MNG : process(clk)
|
||||
begin
|
||||
if (clk = '1' and clk'event) then
|
||||
dist <= std_logic_vector(signed(next_pos_lsb) - signed(curr_pos_lsb));
|
||||
symbol_valid_d <= symbol_valid_i;
|
||||
if (clear = '1' or (symbol_valid_d = '1' and signed(dist) = 0) or pos_recovery = '1') then
|
||||
max_dist <= "0001";
|
||||
elsif (skip_pos = '1' or rx_error_i = '1') then
|
||||
max_dist <= std_logic_vector(unsigned(max_dist) + 1);
|
||||
end if;
|
||||
if (symbol_valid_d = '1' and valid_pos = '1') then
|
||||
pos_corr <= abs_dist;
|
||||
elsif (apply_corr = '1') then
|
||||
pos_corr <= std_logic_vector(unsigned(pos_corr) - 1);
|
||||
end if;
|
||||
if (clear = '1' or corr_done = '1') then
|
||||
upd_pos <= '0';
|
||||
elsif (symbol_valid_d = '1' and valid_pos = '1') then
|
||||
upd_pos <= '1';
|
||||
end if;
|
||||
if (upd_pos = '0' or unsigned(clk_cnt) = 2) then
|
||||
clk_cnt <= (others => '0');
|
||||
else
|
||||
clk_cnt <= std_logic_vector(unsigned(clk_cnt) + 1);
|
||||
end if;
|
||||
if (symbol_valid_d = '1' and valid_pos = '1') then
|
||||
corr_sign <= dist(3);
|
||||
end if;
|
||||
inc_pos_i <= inc_pos_ii;
|
||||
dec_pos_i <= dec_pos_ii;
|
||||
inc_pos <= inc_pos_i;
|
||||
dec_pos <= dec_pos_i;
|
||||
if (clear = '1' or sync = '1') then
|
||||
abs_pos_i <= (others => '0');
|
||||
elsif (inc_pos_ii = '1') then
|
||||
abs_pos_i <= std_logic_vector(signed(abs_pos_i) + 1);
|
||||
elsif (dec_pos_ii = '1') then
|
||||
abs_pos_i <= std_logic_vector(signed(abs_pos_i) - 1);
|
||||
end if;
|
||||
abs_pos <= abs_pos_i;
|
||||
skip_pos_d <= skip_pos;
|
||||
if (clear = '1' or (symbol_valid_d = '1' and valid_pos = '1')) then
|
||||
skip_cnt <= (others => '0');
|
||||
elsif (skip_pos = '1' and skip_pos_d = '0') then
|
||||
skip_cnt <= std_logic_vector(unsigned(skip_cnt) + 1);
|
||||
end if;
|
||||
if (clear = '1') then
|
||||
skip_pos_cnt_i <= (others => '0');
|
||||
elsif (skip_pos_d = '1') then
|
||||
skip_pos_cnt_i <= std_logic_vector(unsigned(skip_pos_cnt_i) + 1);
|
||||
end if;
|
||||
end if;
|
||||
end process pPOS_MNG;
|
||||
|
||||
skip_pos <= '1' when (symbol_valid = '1' and symbol_ok = '0') or (symbol_valid_d = '1' and valid_pos = '0') else '0';
|
||||
|
||||
pos_recovery <= '1' when unsigned(skip_cnt) >= 3 else '0';
|
||||
valid_pos <= '1' when unsigned(abs_dist) <= unsigned(max_dist) or pos_recovery = '1' else '0';
|
||||
|
||||
apply_corr <= '1' when upd_pos = '1' and clk_cnt = "01" else '0';
|
||||
corr_done <= '1' when signed(dist) = 0 else '0';
|
||||
|
||||
inc_pos_ii <= '1' when apply_corr = '1' and corr_sign = '0' else '0';
|
||||
dec_pos_ii <= '1' when apply_corr = '1' and corr_sign = '1' else '0';
|
||||
|
||||
skip_pos_cnt <= skip_pos_cnt_i;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Additional logic for error reporting
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
pERROR_REPORTING : process(clk)
|
||||
begin
|
||||
if (clk = '1' and clk'event) then
|
||||
if (clear = '1' or one_pps = '1') then
|
||||
error_rate_cnt <= (others => '0');
|
||||
elsif (symbol_error = '1') then
|
||||
error_rate_cnt <= std_logic_vector(unsigned(error_rate_cnt) + 1);
|
||||
end if;
|
||||
if (clear = '1') then
|
||||
error_rate <= (others => '0');
|
||||
elsif (one_pps = '1') then
|
||||
error_rate <= error_rate_cnt;
|
||||
end if;
|
||||
max_error_flag <= not clear and max_error_flag_i;
|
||||
if (clear = '1' or symbol_valid_i = '1' or rx_watchdog_clr = '1') then
|
||||
rx_wd_cnt <= (others => '0');
|
||||
else
|
||||
rx_wd_cnt <= std_logic_vector(unsigned(rx_wd_cnt) + 1);
|
||||
end if;
|
||||
if (clear = '1' or rx_watchdog_clr = '1' or rx_watchdog_en = '0' or sync = '1') then
|
||||
rx_watchdog <= '0';
|
||||
elsif (unsigned(rx_wd_cnt) > 1000) then
|
||||
rx_watchdog <= '1';
|
||||
end if;
|
||||
end if;
|
||||
end process pERROR_REPORTING;
|
||||
|
||||
max_error_flag_i <= '1' when unsigned(error_rate) > unsigned(error_rate_thres) else '0';
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Encoder Pulse management
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
-- Encoder pulses are generated only when there is an increment of the
|
||||
-- position in the intended direction, which exceeds the previous maximum.
|
||||
-- The value of the maximum is reset in the following situations:
|
||||
-- 1. After a Init/Sync pulse
|
||||
-- 2. After a direction change
|
||||
-- 3. When the distance between the current position and the previous maximum
|
||||
-- exceeds a programmable threshold, where the threshold is a 32 bit signed
|
||||
-- number. Only the 16 MSBs of this threshold can be configured. The threshold
|
||||
-- is set to the maximum value by default (e.g.: (2^23 = 8388608)
|
||||
|
||||
pENC_MNG : process(clk)
|
||||
begin
|
||||
if (clk = '1' and clk'event) then
|
||||
dp_dir_d <= dp_dir;
|
||||
if (sync_d = '1' or dp_dir_change = '1' or new_max = '1' or upd_max_pos = '1') then
|
||||
pos_max <= abs_pos_i;
|
||||
end if;
|
||||
if (sync_d = '1' or dp_dir_change = '1' or new_min = '1' or upd_min_pos = '1') then
|
||||
pos_min <= abs_pos_i;
|
||||
end if;
|
||||
enc_out <= new_min or new_max;
|
||||
end if;
|
||||
end process pENC_MNG;
|
||||
|
||||
dp_dir_change <= dp_dir xor dp_dir_d;
|
||||
|
||||
dist_pos <= std_logic_vector(signed(abs_pos_i) - signed(pos_max));
|
||||
dist_neg <= std_logic_vector(signed(pos_min) - signed(abs_pos_i));
|
||||
|
||||
new_max <= '1' when inc_pos_i = '1' and dp_dir = '0' and dist_pos(31) = '0' and unsigned(dist_pos(3 downto 0)) /= 0 else '0';
|
||||
new_min <= '1' when dec_pos_i = '1' and dp_dir = '1' and dist_neg(31) = '0' and unsigned(dist_neg(3 downto 0)) /= 0 else '0';
|
||||
|
||||
end architecture rtl;
|
||||
201
generic_ip/fire_pulse_manager/3/src/test/fifo_16x8_3.vhd
Normal file
201
generic_ip/fire_pulse_manager/3/src/test/fifo_16x8_3.vhd
Normal file
|
|
@ -0,0 +1,201 @@
|
|||
-- megafunction wizard: %FIFO%
|
||||
-- GENERATION: STANDARD
|
||||
-- VERSION: WM1.0
|
||||
-- MODULE: scfifo
|
||||
|
||||
-- ============================================================
|
||||
-- File Name: fifo_16x8.vhd
|
||||
-- Megafunction Name(s):
|
||||
-- scfifo
|
||||
--
|
||||
-- Simulation Library Files(s):
|
||||
-- altera_mf
|
||||
-- ============================================================
|
||||
-- ************************************************************
|
||||
-- THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE!
|
||||
--
|
||||
-- 16.0.2 Build 222 07/20/2016 SJ Lite Edition
|
||||
-- ************************************************************
|
||||
|
||||
|
||||
--Copyright (C) 1991-2016 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 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 Altera Program License
|
||||
--Subscription Agreement, the Altera Quartus Prime License Agreement,
|
||||
--the 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.
|
||||
|
||||
|
||||
LIBRARY ieee;
|
||||
USE ieee.std_logic_1164.all;
|
||||
|
||||
LIBRARY altera_mf;
|
||||
USE altera_mf.all;
|
||||
|
||||
ENTITY fifo_16x8_3 IS
|
||||
PORT
|
||||
(
|
||||
clock : IN STD_LOGIC ;
|
||||
data : IN STD_LOGIC_VECTOR (7 DOWNTO 0);
|
||||
rdreq : IN STD_LOGIC ;
|
||||
sclr : IN STD_LOGIC ;
|
||||
wrreq : IN STD_LOGIC ;
|
||||
empty : OUT STD_LOGIC ;
|
||||
full : OUT STD_LOGIC ;
|
||||
q : OUT STD_LOGIC_VECTOR (7 DOWNTO 0);
|
||||
usedw : OUT STD_LOGIC_VECTOR (3 DOWNTO 0)
|
||||
);
|
||||
END fifo_16x8_3;
|
||||
|
||||
|
||||
ARCHITECTURE SYN OF fifo_16x8_3 IS
|
||||
|
||||
SIGNAL sub_wire0 : STD_LOGIC ;
|
||||
SIGNAL sub_wire1 : STD_LOGIC ;
|
||||
SIGNAL sub_wire2 : STD_LOGIC_VECTOR (7 DOWNTO 0);
|
||||
SIGNAL sub_wire3 : STD_LOGIC_VECTOR (3 DOWNTO 0);
|
||||
|
||||
|
||||
|
||||
COMPONENT scfifo
|
||||
GENERIC (
|
||||
add_ram_output_register : STRING;
|
||||
intended_device_family : STRING;
|
||||
lpm_hint : STRING;
|
||||
lpm_numwords : NATURAL;
|
||||
lpm_showahead : STRING;
|
||||
lpm_type : STRING;
|
||||
lpm_width : NATURAL;
|
||||
lpm_widthu : NATURAL;
|
||||
overflow_checking : STRING;
|
||||
underflow_checking : STRING;
|
||||
use_eab : STRING
|
||||
);
|
||||
PORT (
|
||||
clock : IN STD_LOGIC ;
|
||||
data : IN STD_LOGIC_VECTOR (7 DOWNTO 0);
|
||||
rdreq : IN STD_LOGIC ;
|
||||
sclr : IN STD_LOGIC ;
|
||||
wrreq : IN STD_LOGIC ;
|
||||
empty : OUT STD_LOGIC ;
|
||||
full : OUT STD_LOGIC ;
|
||||
q : OUT STD_LOGIC_VECTOR (7 DOWNTO 0);
|
||||
usedw : OUT STD_LOGIC_VECTOR (3 DOWNTO 0)
|
||||
);
|
||||
END COMPONENT;
|
||||
|
||||
BEGIN
|
||||
empty <= sub_wire0;
|
||||
full <= sub_wire1;
|
||||
q <= sub_wire2(7 DOWNTO 0);
|
||||
usedw <= sub_wire3(3 DOWNTO 0);
|
||||
|
||||
scfifo_component : scfifo
|
||||
GENERIC MAP (
|
||||
add_ram_output_register => "ON",
|
||||
intended_device_family => "Cyclone V",
|
||||
lpm_hint => "RAM_BLOCK_TYPE=MLAB",
|
||||
lpm_numwords => 16,
|
||||
lpm_showahead => "OFF",
|
||||
lpm_type => "scfifo",
|
||||
lpm_width => 8,
|
||||
lpm_widthu => 4,
|
||||
overflow_checking => "ON",
|
||||
underflow_checking => "ON",
|
||||
use_eab => "ON"
|
||||
)
|
||||
PORT MAP (
|
||||
clock => clock,
|
||||
data => data,
|
||||
rdreq => rdreq,
|
||||
sclr => sclr,
|
||||
wrreq => wrreq,
|
||||
empty => sub_wire0,
|
||||
full => sub_wire1,
|
||||
q => sub_wire2,
|
||||
usedw => sub_wire3
|
||||
);
|
||||
|
||||
|
||||
|
||||
END SYN;
|
||||
|
||||
-- ============================================================
|
||||
-- CNX file retrieval info
|
||||
-- ============================================================
|
||||
-- Retrieval info: PRIVATE: AlmostEmpty NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: AlmostEmptyThr NUMERIC "-1"
|
||||
-- Retrieval info: PRIVATE: AlmostFull NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: AlmostFullThr NUMERIC "-1"
|
||||
-- Retrieval info: PRIVATE: CLOCKS_ARE_SYNCHRONIZED NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: Clock NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: Depth NUMERIC "16"
|
||||
-- Retrieval info: PRIVATE: Empty NUMERIC "1"
|
||||
-- Retrieval info: PRIVATE: Full NUMERIC "1"
|
||||
-- Retrieval info: PRIVATE: INTENDED_DEVICE_FAMILY STRING "Cyclone V"
|
||||
-- Retrieval info: PRIVATE: LE_BasedFIFO NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: LegacyRREQ NUMERIC "1"
|
||||
-- Retrieval info: PRIVATE: MAX_DEPTH_BY_9 NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: OVERFLOW_CHECKING NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: Optimize NUMERIC "1"
|
||||
-- Retrieval info: PRIVATE: RAM_BLOCK_TYPE NUMERIC "1"
|
||||
-- Retrieval info: PRIVATE: SYNTH_WRAPPER_GEN_POSTFIX STRING "0"
|
||||
-- Retrieval info: PRIVATE: UNDERFLOW_CHECKING NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: UsedW NUMERIC "1"
|
||||
-- Retrieval info: PRIVATE: Width NUMERIC "8"
|
||||
-- Retrieval info: PRIVATE: dc_aclr NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: diff_widths NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: msb_usedw NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: output_width NUMERIC "8"
|
||||
-- Retrieval info: PRIVATE: rsEmpty NUMERIC "1"
|
||||
-- Retrieval info: PRIVATE: rsFull NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: rsUsedW NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: sc_aclr NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: sc_sclr NUMERIC "1"
|
||||
-- Retrieval info: PRIVATE: wsEmpty NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: wsFull NUMERIC "1"
|
||||
-- Retrieval info: PRIVATE: wsUsedW NUMERIC "0"
|
||||
-- Retrieval info: LIBRARY: altera_mf altera_mf.altera_mf_components.all
|
||||
-- Retrieval info: CONSTANT: ADD_RAM_OUTPUT_REGISTER STRING "ON"
|
||||
-- Retrieval info: CONSTANT: INTENDED_DEVICE_FAMILY STRING "Cyclone V"
|
||||
-- Retrieval info: CONSTANT: LPM_HINT STRING "RAM_BLOCK_TYPE=MLAB"
|
||||
-- Retrieval info: CONSTANT: LPM_NUMWORDS NUMERIC "16"
|
||||
-- Retrieval info: CONSTANT: LPM_SHOWAHEAD STRING "OFF"
|
||||
-- Retrieval info: CONSTANT: LPM_TYPE STRING "scfifo"
|
||||
-- Retrieval info: CONSTANT: LPM_WIDTH NUMERIC "8"
|
||||
-- Retrieval info: CONSTANT: LPM_WIDTHU NUMERIC "4"
|
||||
-- Retrieval info: CONSTANT: OVERFLOW_CHECKING STRING "ON"
|
||||
-- Retrieval info: CONSTANT: UNDERFLOW_CHECKING STRING "ON"
|
||||
-- Retrieval info: CONSTANT: USE_EAB STRING "ON"
|
||||
-- Retrieval info: USED_PORT: clock 0 0 0 0 INPUT NODEFVAL "clock"
|
||||
-- Retrieval info: USED_PORT: data 0 0 8 0 INPUT NODEFVAL "data[7..0]"
|
||||
-- Retrieval info: USED_PORT: empty 0 0 0 0 OUTPUT NODEFVAL "empty"
|
||||
-- Retrieval info: USED_PORT: full 0 0 0 0 OUTPUT NODEFVAL "full"
|
||||
-- Retrieval info: USED_PORT: q 0 0 8 0 OUTPUT NODEFVAL "q[7..0]"
|
||||
-- Retrieval info: USED_PORT: rdreq 0 0 0 0 INPUT NODEFVAL "rdreq"
|
||||
-- Retrieval info: USED_PORT: sclr 0 0 0 0 INPUT NODEFVAL "sclr"
|
||||
-- Retrieval info: USED_PORT: usedw 0 0 4 0 OUTPUT NODEFVAL "usedw[3..0]"
|
||||
-- Retrieval info: USED_PORT: wrreq 0 0 0 0 INPUT NODEFVAL "wrreq"
|
||||
-- Retrieval info: CONNECT: @clock 0 0 0 0 clock 0 0 0 0
|
||||
-- Retrieval info: CONNECT: @data 0 0 8 0 data 0 0 8 0
|
||||
-- Retrieval info: CONNECT: @rdreq 0 0 0 0 rdreq 0 0 0 0
|
||||
-- Retrieval info: CONNECT: @sclr 0 0 0 0 sclr 0 0 0 0
|
||||
-- Retrieval info: CONNECT: @wrreq 0 0 0 0 wrreq 0 0 0 0
|
||||
-- Retrieval info: CONNECT: empty 0 0 0 0 @empty 0 0 0 0
|
||||
-- Retrieval info: CONNECT: full 0 0 0 0 @full 0 0 0 0
|
||||
-- Retrieval info: CONNECT: q 0 0 8 0 @q 0 0 8 0
|
||||
-- Retrieval info: CONNECT: usedw 0 0 4 0 @usedw 0 0 4 0
|
||||
-- Retrieval info: GEN_FILE: TYPE_NORMAL fifo_16x8.vhd TRUE
|
||||
-- Retrieval info: GEN_FILE: TYPE_NORMAL fifo_16x8.inc FALSE
|
||||
-- Retrieval info: GEN_FILE: TYPE_NORMAL fifo_16x8.cmp FALSE
|
||||
-- Retrieval info: GEN_FILE: TYPE_NORMAL fifo_16x8.bsf FALSE
|
||||
-- Retrieval info: GEN_FILE: TYPE_NORMAL fifo_16x8_inst.vhd FALSE
|
||||
-- Retrieval info: LIB_FILE: altera_mf
|
||||
|
|
@ -0,0 +1,715 @@
|
|||
-------------------------------------------------------------------------------
|
||||
-- Title : fire_pulse_manager_tb
|
||||
-- Project : fire_pulse_manager
|
||||
-------------------------------------------------------------------------------
|
||||
-- File : fire_pulse_manager_tb.vhd
|
||||
-- Author : Christos Spirotis
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2018-08-10
|
||||
-- Last update: 2019-07-15
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'08
|
||||
-------------------------------------------------------------------------------
|
||||
-- Description:
|
||||
-- Testbench for fire pulse manager block
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
library modelsim_lib;
|
||||
use modelsim_lib.util.all;
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
use ieee.math_real.all;
|
||||
use std.textio.all;
|
||||
library work;
|
||||
use work.fire_pulse_3_pkg.all;
|
||||
use work.log_pkg.all;
|
||||
use work.avalon_verify_pkg.all;
|
||||
use work.pulse_generator_1_pkg.all;
|
||||
use work.enc_pd_emul_1_pkg.CSR_ENC_NCO_INC_ADDR;
|
||||
use work.enc_pd_emul_1_pkg.CSR_ENC_CTRL_ADDR;
|
||||
use work.enc_pd_emul_1_pkg.CSR_PD_CTRL_ADDR;
|
||||
use work.enc_pd_emul_1_pkg.CSR_OUT_ENABLE_ADDR;
|
||||
use work.enc_pd_emul_1_pkg.CSR_PULSE_NUM_ADDR;
|
||||
|
||||
library osvvm;
|
||||
use osvvm.RandomPkg.all;
|
||||
|
||||
entity fire_pulse_manager_3_tb is
|
||||
end fire_pulse_manager_3_tb;
|
||||
|
||||
architecture behav of fire_pulse_manager_3_tb is
|
||||
|
||||
constant CH_NUM : integer := 4;
|
||||
constant DEV_NUM : integer := 2;
|
||||
|
||||
|
||||
constant CLK_PERIOD : time := 10.0 ns;
|
||||
constant CLK_FREQ : real := 100.0e6;
|
||||
|
||||
-- TODO Try different receive oversampling ratios - 300MHz is in the real system
|
||||
constant RX_CLK_PERIOD : time := CLK_PERIOD / 3; -- clock period for used by the
|
||||
-- UART-Rx on the POF
|
||||
|
||||
constant POF_DELAY : time := 30 ns; -- Total delay from POF-Tx input to POF-Rx output
|
||||
|
||||
constant NUM_ITERATIONS : natural := 5;
|
||||
constant SWATHE_LEN : integer := 600;
|
||||
constant START_DIR : std_logic := '0';
|
||||
constant TIME_INT : time := 5000 ns;
|
||||
constant VERBOSITY_LEVEL : verb_level_t := VMEDIUM;
|
||||
|
||||
type ch_offset_t is array (0 to CH_NUM - 1) of integer;
|
||||
signal ch_offset : ch_offset_t := (100, 308, 316, 324);
|
||||
|
||||
type avs_read_bus_t is array (0 to DEV_NUM - 1) of std_logic_vector(31 downto 0);
|
||||
|
||||
signal reset_n : std_logic := '0';
|
||||
signal clk : std_logic := '0';
|
||||
signal rx_clk : std_logic := '0';
|
||||
signal pof_tx, pof_rx : std_logic;
|
||||
signal ch_pulse_out : std_logic_vector(3 downto 0);
|
||||
signal avs_address : std_logic_vector(14 downto 0);
|
||||
signal avs_write : std_logic_vector(DEV_NUM - 1 downto 0);
|
||||
signal avs_writedata : std_logic_vector(31 downto 0);
|
||||
signal avs_read : std_logic_vector(DEV_NUM - 1 downto 0);
|
||||
signal avs_waitrequest : std_logic_vector(DEV_NUM - 1 downto 0);
|
||||
signal avs_readdata : avs_read_bus_t;
|
||||
--
|
||||
signal init_tx : std_logic;
|
||||
signal pd_in : std_logic;
|
||||
signal pd_spy : std_logic;
|
||||
signal inc_pos : std_logic;
|
||||
signal dec_pos : std_logic;
|
||||
signal abs_position : std_logic_vector(31 downto 0);
|
||||
signal abs_spy : std_logic_vector(31 downto 0);
|
||||
signal tx_data : std_logic;
|
||||
signal pof_tx_avs_rv : std_logic;
|
||||
signal pof_tx_avs_we_d : std_logic;
|
||||
--
|
||||
signal abs_position_d : std_logic_vector(31 downto 0);
|
||||
signal dir_in : std_logic;
|
||||
signal swathe_cnt : integer;
|
||||
signal swathe_pos : integer;
|
||||
signal end_of_swathe : std_logic;
|
||||
signal test_completed : boolean;
|
||||
signal running : boolean;
|
||||
signal configuring : boolean;
|
||||
signal passed : boolean;
|
||||
signal failed : boolean;
|
||||
signal stimuli_completed : boolean;
|
||||
signal detected_error : boolean := false;
|
||||
signal registers_read : boolean := false;
|
||||
signal reprogram_offset : boolean := false;
|
||||
|
||||
--
|
||||
signal avs_m : mm_m_rec_t;
|
||||
signal avs_s : mm_s_rec_t;
|
||||
signal sel_slave_0 : std_logic;
|
||||
signal sel_slave_1 : std_logic;
|
||||
--
|
||||
type pd_cnt_t is array (0 to CH_NUM - 1) of integer;
|
||||
signal pd_cnt : pd_cnt_t;
|
||||
type fp_cnt_t is array (0 to CH_NUM - 1) of integer;
|
||||
signal fp_cnt : fp_cnt_t;
|
||||
|
||||
-- generate the NCO increment corresponding to a given output frequency
|
||||
function freq2NCO_inc(
|
||||
f_out : real; f_clk : real) return std_logic_vector is
|
||||
variable nco_inc : std_logic_vector(31 downto 0);
|
||||
|
||||
begin
|
||||
nco_inc := std_logic_vector(to_unsigned(integer((f_out / f_clk) * (2.0**32)), 32));
|
||||
return nco_inc;
|
||||
|
||||
end function freq2NCO_inc;
|
||||
|
||||
begin -- behav
|
||||
|
||||
clk_pr : process
|
||||
begin
|
||||
clk <= '0';
|
||||
wait for 0.5 * CLK_PERIOD;
|
||||
clk <= '1';
|
||||
wait for 0.5 * CLK_PERIOD;
|
||||
end process clk_pr;
|
||||
|
||||
rx_clk_pr : process
|
||||
begin
|
||||
rx_clk <= '0';
|
||||
wait for 0.5 * RX_CLK_PERIOD;
|
||||
rx_clk <= '1';
|
||||
wait for 0.5 * RX_CLK_PERIOD;
|
||||
end process rx_clk_pr;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- DUTs : Fire Pulse Manager
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
iDUT : entity work.fire_pulse_manager_3
|
||||
port map(
|
||||
reset_n => reset_n,
|
||||
clk => clk,
|
||||
rx_clk => rx_clk,
|
||||
pof_rx => pof_rx,
|
||||
pof_tx => pof_tx,
|
||||
fire_pulse => ch_pulse_out,
|
||||
mon_pt => open,
|
||||
ins_fpm_irq_0 => open,
|
||||
ins_fpm_irq_1 => open,
|
||||
ins_fpm_irq_2 => open,
|
||||
ins_fpm_irq_3 => open,
|
||||
avs_address => avs_address,
|
||||
avs_write => avs_write(0),
|
||||
avs_writedata => avs_writedata,
|
||||
avs_read => avs_read(0),
|
||||
avs_waitrequest => avs_waitrequest(0),
|
||||
avs_readdata => avs_readdata(0)
|
||||
);
|
||||
|
||||
pof_rx <= transport tx_data after POF_DELAY;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- POF Tx
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
iPOF_TX : entity work.pof_tx_3
|
||||
port map(
|
||||
reset_n => reset_n,
|
||||
clk => clk,
|
||||
init => init_tx,
|
||||
pd_in => pd_in,
|
||||
inc_pos => inc_pos,
|
||||
dec_pos => dec_pos,
|
||||
abs_position => abs_position,
|
||||
tx_data => tx_data,
|
||||
avs_address => avs_address(2 downto 0),
|
||||
avs_write => avs_write(1),
|
||||
avs_writedata => avs_writedata,
|
||||
avs_read => avs_read(1),
|
||||
avs_readdatavalid => pof_tx_avs_rv,
|
||||
avs_readdata => avs_readdata(1));
|
||||
|
||||
-- Generate a dummy waitrequest for the POF-tx
|
||||
pPOF_TX_DUMMY_WR : process(clk)
|
||||
begin
|
||||
if(clk = '1' and clk'event) then
|
||||
pof_tx_avs_we_d <= avs_write(1);
|
||||
end if;
|
||||
end process pPOF_TX_DUMMY_WR;
|
||||
|
||||
avs_waitrequest(1) <= '0' when pof_tx_avs_we_d = '1' or pof_tx_avs_rv = '1' else '0';
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Stimuli Generation
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
pSTIMULI_REGs : process(clk)
|
||||
begin
|
||||
if (clk = '1' and clk'event) then
|
||||
abs_position_d <= abs_position;
|
||||
end if;
|
||||
end process pSTIMULI_REGs;
|
||||
|
||||
inc_pos <= '1' when signed(abs_position) = signed(abs_position_d) + 1 else '0';
|
||||
dec_pos <= '1' when signed(abs_position) = signed(abs_position_d) - 1 else '0';
|
||||
|
||||
pSTIMULI : process
|
||||
variable end_of_stimuli : boolean;
|
||||
variable rv : RandomPType;
|
||||
|
||||
begin
|
||||
|
||||
-- initialization
|
||||
init_tx <= '0';
|
||||
dir_in <= START_DIR;
|
||||
pd_in <= '0';
|
||||
abs_position <= (others => '0');
|
||||
swathe_pos <= 0;
|
||||
--
|
||||
swathe_cnt <= 0;
|
||||
stimuli_completed <= false;
|
||||
end_of_swathe <= '0';
|
||||
|
||||
-- generating the stimulus
|
||||
wait until running = true;
|
||||
wait for 200 ns;
|
||||
-- Send a Init/Sync pulse
|
||||
wait until clk = '1' and clk'event;
|
||||
init_tx <= '1';
|
||||
wait until clk = '1' and clk'event;
|
||||
init_tx <= '0';
|
||||
wait for 500 ns;
|
||||
--
|
||||
-- generate the forward swathe
|
||||
end_of_stimuli := false;
|
||||
while end_of_stimuli = false loop
|
||||
swathe_pos <= 0;
|
||||
|
||||
for i in 0 to CH_NUM - 1 loop
|
||||
ch_offset(i) <= rv.RandInt(0, 379);
|
||||
end loop;
|
||||
reprogram_offset <= true;
|
||||
wait until configuring = true;
|
||||
reprogram_offset <= false;
|
||||
wait until configuring = false;
|
||||
|
||||
wait until clk = '1' and clk'event;
|
||||
while swathe_pos /= SWATHE_LEN loop
|
||||
--generate a position increment
|
||||
swathe_pos <= swathe_pos + 1;
|
||||
if (dir_in = '0') then
|
||||
abs_position <= std_logic_vector(signed(abs_position) + 1);
|
||||
else
|
||||
abs_position <= std_logic_vector(signed(abs_position) - 1);
|
||||
end if;
|
||||
--
|
||||
if (swathe_pos = 16) then
|
||||
-- generate a PD increment: the PD might be either concurren or not
|
||||
-- to the position increment
|
||||
wait for 0.5 * CLK_PERIOD;
|
||||
pd_in <= '1';
|
||||
wait for 100 ns;
|
||||
wait until clk = '1' and clk'event;
|
||||
pd_in <= '0';
|
||||
end if;
|
||||
wait for TIME_INT;
|
||||
end loop; -- swathe_pos /= SWATHE_LEN
|
||||
|
||||
wait for 25 us;
|
||||
end_of_swathe <= '1';
|
||||
wait until clk = '1' and clk'event;
|
||||
end_of_swathe <= '0';
|
||||
-- reverse direction
|
||||
if (dir_in /= START_DIR) then
|
||||
if (swathe_cnt = NUM_ITERATIONS - 1) then
|
||||
end_of_stimuli := true;
|
||||
else
|
||||
swathe_cnt <= swathe_cnt + 1;
|
||||
end if;
|
||||
end if;
|
||||
if (end_of_stimuli = false) then
|
||||
wait until clk = '1' and clk'event;
|
||||
dir_in <= not dir_in;
|
||||
-- Wait some time to make sure the change of direction is transmitted.
|
||||
-- Note: if the position starts changing before the receiver was able to
|
||||
-- confirm the change of direction, then some encoder pulses may not be
|
||||
-- generated
|
||||
wait for 1 us;
|
||||
wait until clk = '1' and clk'event;
|
||||
end if;
|
||||
end loop; -- end_of_stimuli = false
|
||||
|
||||
stimuli_completed <= true;
|
||||
wait;
|
||||
|
||||
end process pSTIMULI;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Testbench Control
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
pTB_CTRL : process
|
||||
type fp_arrived_t is array (0 to CH_NUM - 1) of boolean;
|
||||
variable fp_arrived : fp_arrived_t;
|
||||
type fp_arrived_time_t is array (0 to CH_NUM - 1) of integer;
|
||||
variable fp_arrived_time : fp_arrived_time_t;
|
||||
variable fp_arrived_agg : integer;
|
||||
variable pd_arrived_time : integer;
|
||||
|
||||
begin
|
||||
-- init_signal_spy("/iDUT/abs_pos","abs_spy",0);
|
||||
-- init_signal_spy("/iDUT/pd_pulse","pd_spy",0);
|
||||
init_signal_spy("abs_position", "abs_spy", 0);
|
||||
init_signal_spy("pd_in", "pd_spy", 0);
|
||||
|
||||
-- Set the verbosity level for logging
|
||||
set_log_verbosity(VERBOSITY_LEVEL);
|
||||
set_log_verbosity(VHIGH);
|
||||
|
||||
log_header("Multi-channel FPM verification:", VLOW);
|
||||
|
||||
test_completed <= false;
|
||||
running <= false;
|
||||
passed <= false;
|
||||
failed <= false;
|
||||
|
||||
-- Reset
|
||||
reset_n <= '0';
|
||||
wait for 100 ns;
|
||||
wait until clk = '1' and clk'event;
|
||||
reset_n <= '1';
|
||||
|
||||
if (configuring /= true) then
|
||||
wait until configuring = true;
|
||||
end if;
|
||||
wait until configuring = false;
|
||||
running <= true;
|
||||
log("Running test ... ", VLOW, true);
|
||||
|
||||
while stimuli_completed = false loop
|
||||
wait until ((pd_spy = '1' and pd_spy'event) or stimuli_completed);
|
||||
|
||||
if (stimuli_completed) then
|
||||
exit;
|
||||
end if;
|
||||
|
||||
pd_arrived_time := to_integer(signed(abs_spy));
|
||||
for i in 0 to CH_NUM - 1 loop
|
||||
fp_arrived(i) := false;
|
||||
fp_arrived_time(i) := 0;
|
||||
end loop;
|
||||
log("Product detect fired @ " & integer'image(pd_arrived_time) & " ... ", VLOW, true);
|
||||
fp_arrived_agg := 0;
|
||||
while fp_arrived_agg < CH_NUM loop
|
||||
fp_arrived_agg := 0;
|
||||
for i in 0 to CH_NUM - 1 loop
|
||||
if fp_arrived(i) = true then
|
||||
fp_arrived_agg := fp_arrived_agg + 1;
|
||||
end if;
|
||||
end loop;
|
||||
|
||||
wait until (unsigned(ch_pulse_out) /= 0 or stimuli_completed);
|
||||
if (stimuli_completed) then
|
||||
exit;
|
||||
end if;
|
||||
|
||||
for i in 0 to CH_NUM - 1 loop
|
||||
if ch_pulse_out(i) = '1' and fp_arrived(i) = false then
|
||||
fp_arrived(i) := true;
|
||||
fp_arrived_time(i) := to_integer(signed(abs_spy));
|
||||
log("Channel CH" & integer'image(i) & " Fire pulse logged @ " & integer'image(fp_arrived_time(i)) & " ... ", VLOW, true);
|
||||
if (abs (pd_arrived_time - fp_arrived_time(i)) /= ch_offset(i)) then
|
||||
log("Channel CH" & integer'image(i) & " OFFSET INCORRECT !!! ", VLOW, true);
|
||||
detected_error <= true;
|
||||
end if;
|
||||
end if;
|
||||
end loop;
|
||||
end loop;
|
||||
end loop;
|
||||
|
||||
if (stimuli_completed = true) then
|
||||
-- wait enough time to make sure that a max length package can be propagated
|
||||
wait for 20 us;
|
||||
end if;
|
||||
|
||||
if (registers_read = false) then
|
||||
wait until registers_read = true;
|
||||
end if;
|
||||
|
||||
-- Report PD and FP counter from pulse generator
|
||||
for i in 0 to CH_NUM - 1 loop
|
||||
log("Channel CH" & integer'image(i) & " PDin counter value : " & integer'image(pd_cnt(i)) & " ... ", VLOW, true);
|
||||
log("Channel CH" & integer'image(i) & " FPout counter value : " & integer'image(fp_cnt(i)) & " ... ", VLOW, true);
|
||||
if (i = 0 and (pd_cnt(i) /= (NUM_ITERATIONS) * 2)) or
|
||||
(i /= 0 and pd_cnt(i) /= 0) then -- fire_pulse_manager now has no registers beyond channel 0
|
||||
log("Channel CH" & integer'image(i) & " PD_cnt counter value Incorrect: ", VLOW, true);
|
||||
detected_error <= true;
|
||||
end if;
|
||||
if (i = 0 and (fp_cnt(i) /= (NUM_ITERATIONS) * 2 * 100)) or
|
||||
(i /= 0 and fp_cnt(i) /= 0) then
|
||||
log("Channel CH" & integer'image(i) & " FP_cnt counter value Incorrect: ", VLOW, true);
|
||||
detected_error <= true;
|
||||
end if;
|
||||
end loop;
|
||||
|
||||
wait until clk = '1' and clk'event;
|
||||
|
||||
if (detected_error = true) then
|
||||
failed <= true;
|
||||
log("FAILURE: test completed with errors.", VLOW);
|
||||
else
|
||||
passed <= true;
|
||||
log("SUCCESS: test successfully completed.", VLOW);
|
||||
end if;
|
||||
log_separator_line(VLOW);
|
||||
test_completed <= true;
|
||||
running <= false;
|
||||
wait;
|
||||
|
||||
end process pTB_CTRL;
|
||||
|
||||
pUUT_CTRL : process
|
||||
variable addr : std_logic_vector(31 downto 0) := (others => '0');
|
||||
variable data : std_logic_vector(31 downto 0) := (others => '0');
|
||||
variable ratio_int : integer;
|
||||
variable ratio_slv : std_logic_vector(33 downto 0);
|
||||
|
||||
begin
|
||||
sel_slave_0 <= '0';
|
||||
sel_slave_1 <= '0';
|
||||
configuring <= true;
|
||||
|
||||
-- initilialize the Avalon master-bus
|
||||
mm_m_init(avs_m, use_waitrequest => true);
|
||||
|
||||
if (reset_n = '0') then
|
||||
wait until reset_n = '1';
|
||||
wait for 100 ns;
|
||||
wait until clk = '1' and clk'event;
|
||||
end if;
|
||||
|
||||
log("Configuring POFTX ... ", VLOW, true);
|
||||
sel_slave_1 <= '1';
|
||||
-- Config netfork_tx control registers:
|
||||
-- enable the block
|
||||
addr := std_logic_vector(to_unsigned(0, 32));
|
||||
data := X"0000_0021";
|
||||
mm_32b_write(addr, data, avs_s, avs_m);
|
||||
|
||||
sel_slave_1 <= '0';
|
||||
sel_slave_0 <= '1';
|
||||
wait until clk = '1' and clk'event;
|
||||
|
||||
log("Configuring EMUL ... ", VLOW, true);
|
||||
-- Configure Encoder NCO freq
|
||||
addr := std_logic_vector(to_unsigned(6144 + to_integer(unsigned(CSR_ENC_NCO_INC_ADDR)), 32));
|
||||
data := freq2NCO_inc(200.0e3, CLK_FREQ);
|
||||
-- Write the data to the register
|
||||
mm_32b_write(addr, data, avs_s, avs_m);
|
||||
-- Enable outputs
|
||||
addr := std_logic_vector(to_unsigned(6144 + to_integer(unsigned(CSR_OUT_ENABLE_ADDR)), 32));
|
||||
data := X"000000FF";
|
||||
-- Write the data to the register
|
||||
mm_32b_write(addr, data, avs_s, avs_m);
|
||||
|
||||
log("Configuring FPM ... ", VLOW, true);
|
||||
-- Config fire_pulse_manager control registers:
|
||||
-- Enable the POF-Rx
|
||||
addr := std_logic_vector(to_unsigned(3, 32));
|
||||
data := X"0000_8061"; -- set bit_div to 6 to match the 50MBd TX signal to the 300MHz RX_CLK
|
||||
-- Write the data to the register
|
||||
mm_32b_write(addr, data, avs_s, avs_m);
|
||||
-- Select pulse generator
|
||||
addr := std_logic_vector(to_unsigned(2, 32));
|
||||
data := X"0000_0001";
|
||||
-- Write the data to the register
|
||||
mm_32b_write(addr, data, avs_s, avs_m);
|
||||
-- Config external fire pulses
|
||||
addr := std_logic_vector(to_unsigned(12, 32));
|
||||
data := X"0008_0004";
|
||||
-- Write the data to the register
|
||||
mm_32b_write(addr, data, avs_s, avs_m);
|
||||
|
||||
config_pg_l : for i in 0 to CH_NUM - 1 loop
|
||||
-- Disable/Re-enable first the whole pulse_generator
|
||||
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(PULSE_GEN_CTRL_REG)), 32));
|
||||
data := (others => '0');
|
||||
mm_32b_write(addr, data, avs_s, avs_m);
|
||||
data := (0 => '1', 16 => '1', others => '0');
|
||||
mm_32b_write(addr, data, avs_s, avs_m);
|
||||
-- Disable/Re-enable the Channel Controller sequencer
|
||||
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(CH_CTRL_CTRL_REG)), 32));
|
||||
data := (others => '0');
|
||||
mm_32b_write(addr, data, avs_s, avs_m);
|
||||
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(CH_CTRL_CTRL_REG)), 32));
|
||||
data := (0 => '1', others => '0');
|
||||
mm_32b_write(addr, data, avs_s, avs_m);
|
||||
-- set the sub-pixel offset
|
||||
data := std_logic_vector(to_unsigned(0, 32));
|
||||
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(SP_OFFSET_INT)), 32));
|
||||
mm_32b_write(addr, data, avs_s, avs_m);
|
||||
data := std_logic_vector(to_unsigned(0, 32));
|
||||
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(SP_OFFSET_FRAC)), 32));
|
||||
mm_32b_write(addr, data, avs_s, avs_m);
|
||||
-- set the division ratio
|
||||
ratio_int := integer(2.0 * real(2**24));
|
||||
ratio_slv := std_logic_vector(to_unsigned(ratio_int, 34));
|
||||
-- Set the integer part of the div-ratio
|
||||
data(31 downto 10) := (others => '0');
|
||||
data(9 downto 0) := ratio_slv(33 downto 24);
|
||||
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(DIV_RATIO_INT)), 32));
|
||||
mm_32b_write(addr, data, avs_s, avs_m);
|
||||
-- Set the fractional part of the div-ratio
|
||||
data(31 downto 24) := (others => '0');
|
||||
data(23 downto 0) := ratio_slv(23 downto 0);
|
||||
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(DIV_RATIO_FRAC)), 32));
|
||||
mm_32b_write(addr, data, avs_s, avs_m);
|
||||
-- Disable/Enable the fractional divider
|
||||
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(FRAC_DIV_CTRL_REG)), 32));
|
||||
data := (others => '0');
|
||||
mm_32b_write(addr, data, avs_s, avs_m);
|
||||
data := (0 => '1', others => '0');
|
||||
mm_32b_write(addr, data, avs_s, avs_m);
|
||||
-- Configure the Channel Offset (Both DIR_0 and DIR_1):
|
||||
-- DIR_0
|
||||
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(CH_OFFSET_D0_REG)), 32));
|
||||
data := std_logic_vector(to_unsigned(ch_offset(i), 32));
|
||||
mm_32b_write(addr, data, avs_s, avs_m);
|
||||
-- DIR_1
|
||||
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(CH_OFFSET_D1_REG)), 32));
|
||||
data := std_logic_vector(to_unsigned(ch_offset(i), 32));
|
||||
mm_32b_write(addr, data, avs_s, avs_m);
|
||||
-- Configure the Channel Delay
|
||||
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(CH_DELAY_REG)), 32));
|
||||
data := std_logic_vector(to_unsigned(0, 32));
|
||||
mm_32b_write(addr, data, avs_s, avs_m);
|
||||
|
||||
-- Fill Sequencer RAM with simple swathe DIR-0
|
||||
-- 0x00, 0x30000000 – Reset the vector output value
|
||||
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(SEQ_RAM_OFFSET)), 32));
|
||||
data := X"30000000";
|
||||
mm_32b_write(addr, data, avs_s, avs_m);
|
||||
-- 0x01, 0x10000001 – Trigger Mask (PD trigger enabled)
|
||||
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(SEQ_RAM_OFFSET) + 1), 32));
|
||||
data := X"10000001";
|
||||
mm_32b_write(addr, data, avs_s, avs_m);
|
||||
-- 0x02, 0x20000001 – Wait for a single PD event
|
||||
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(SEQ_RAM_OFFSET) + 2), 32));
|
||||
data := X"20000001";
|
||||
mm_32b_write(addr, data, avs_s, avs_m);
|
||||
-- 0x03, 0x30006404 – Issue a request for starting the generation of 100 fire pulses (DIR-0)
|
||||
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(SEQ_RAM_OFFSET) + 3), 32));
|
||||
data := X"30006404";
|
||||
mm_32b_write(addr, data, avs_s, avs_m);
|
||||
-- 0x04, 0x30006400 – De-assert the request bit (start_image_req)
|
||||
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(SEQ_RAM_OFFSET) + 4), 32));
|
||||
data := X"30006400";
|
||||
mm_32b_write(addr, data, avs_s, avs_m);
|
||||
-- 0x05, 0x80000258 – Wait till POS END
|
||||
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(SEQ_RAM_OFFSET) + 5), 32));
|
||||
data := X"80000258";
|
||||
mm_32b_write(addr, data, avs_s, avs_m);
|
||||
-- 0x06, 0xC0000000 – Jump to DIR-1
|
||||
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(SEQ_RAM_OFFSET) + 6), 32));
|
||||
data := X"C0000010";
|
||||
mm_32b_write(addr, data, avs_s, avs_m);
|
||||
|
||||
-- Fill Sequencer RAM with simple swathe DIR-1
|
||||
-- 0x10, 0x30000000 – Reset the vector output value
|
||||
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(SEQ_RAM_OFFSET) + 16), 32));
|
||||
data := X"30000001";
|
||||
mm_32b_write(addr, data, avs_s, avs_m);
|
||||
-- 0x11, 0x10000001 – Trigger Mask (PD trigger enabled)
|
||||
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(SEQ_RAM_OFFSET) + 17), 32));
|
||||
data := X"10000001";
|
||||
mm_32b_write(addr, data, avs_s, avs_m);
|
||||
-- 0x12, 0x20000001 – Wait for a single PD event
|
||||
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(SEQ_RAM_OFFSET) + 18), 32));
|
||||
data := X"20000001";
|
||||
mm_32b_write(addr, data, avs_s, avs_m);
|
||||
-- 0x13, 0x30006405 – Issue a request for starting the generation of 100 fire pulses (DIR-1)
|
||||
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(SEQ_RAM_OFFSET) + 19), 32));
|
||||
data := X"30006405";
|
||||
mm_32b_write(addr, data, avs_s, avs_m);
|
||||
-- 0x14, 0x30006401 – De-assert the request bit (start_image_req)
|
||||
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(SEQ_RAM_OFFSET) + 20), 32));
|
||||
data := X"30006401";
|
||||
mm_32b_write(addr, data, avs_s, avs_m);
|
||||
-- 0x15, 0x80000000 – Wait till POS START
|
||||
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(SEQ_RAM_OFFSET) + 21), 32));
|
||||
data := X"80000000";
|
||||
mm_32b_write(addr, data, avs_s, avs_m);
|
||||
-- 0x16, 0xC0000000 – Jump to DIR-0
|
||||
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(SEQ_RAM_OFFSET) + 22), 32));
|
||||
data := X"C0000000";
|
||||
mm_32b_write(addr, data, avs_s, avs_m);
|
||||
|
||||
-- Start Sequencer
|
||||
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(SEQ_CSR_OFFSET) + 3), 32));
|
||||
data := (0 => '1', others => '0');
|
||||
mm_32b_write(addr, data, avs_s, avs_m);
|
||||
end loop config_pg_l;
|
||||
|
||||
-- Init the encoder NCO - Preset Abs-Pos
|
||||
addr := std_logic_vector(to_unsigned(6144 + to_integer(unsigned(CSR_ENC_CTRL_ADDR)), 32));
|
||||
data := 32X"B";
|
||||
-- Write the data to the register
|
||||
mm_32b_write(addr, data, avs_s, avs_m);
|
||||
|
||||
log("Configuration completed.", VLOW, true);
|
||||
configuring <= false;
|
||||
|
||||
while stimuli_completed = false loop
|
||||
wait until reprogram_offset = true or stimuli_completed = true;
|
||||
if (stimuli_completed) then
|
||||
exit;
|
||||
end if;
|
||||
|
||||
configuring <= true;
|
||||
log("Reprogramming offset ... ", VLOW, true);
|
||||
config_of_l : for i in 0 to CH_NUM - 1 loop
|
||||
-- Configure the Channel Offset (Both DIR_0 and DIR_1):
|
||||
-- DIR_0
|
||||
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(CH_OFFSET_D0_REG)), 32));
|
||||
data := std_logic_vector(to_unsigned(ch_offset(i), 32));
|
||||
mm_32b_write(addr, data, avs_s, avs_m);
|
||||
-- DIR_1
|
||||
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(CH_OFFSET_D1_REG)), 32));
|
||||
data := std_logic_vector(to_unsigned(ch_offset(i), 32));
|
||||
mm_32b_write(addr, data, avs_s, avs_m);
|
||||
end loop;
|
||||
configuring <= false;
|
||||
-- issue PD
|
||||
addr := std_logic_vector(to_unsigned(6144 + to_integer(unsigned(CSR_PD_CTRL_ADDR)), 32));
|
||||
data := 32X"3";
|
||||
-- Write the data to the register
|
||||
mm_32b_write(addr, data, avs_s, avs_m);
|
||||
if dir_in = '0' then
|
||||
log("Running 600 steps in DIR-0 ...", VLOW);
|
||||
addr := std_logic_vector(to_unsigned(6144 + to_integer(unsigned(CSR_PULSE_NUM_ADDR)), 32));
|
||||
data := 32X"258";
|
||||
-- Write the data to the register
|
||||
mm_32b_write(addr, data, avs_s, avs_m);
|
||||
addr := std_logic_vector(to_unsigned(6144 + to_integer(unsigned(CSR_ENC_CTRL_ADDR)), 32));
|
||||
data := 32X"11";
|
||||
-- Write the data to the register
|
||||
mm_32b_write(addr, data, avs_s, avs_m);
|
||||
addr := std_logic_vector(to_unsigned(6144 + to_integer(unsigned(CSR_ENC_CTRL_ADDR)), 32));
|
||||
data := 32X"31";
|
||||
-- Write the data to the register
|
||||
mm_32b_write(addr, data, avs_s, avs_m);
|
||||
else
|
||||
log("Running 600 steps in DIR-1 ...", VLOW);
|
||||
addr := std_logic_vector(to_unsigned(6144 + to_integer(unsigned(CSR_PULSE_NUM_ADDR)), 32));
|
||||
data := 32X"258";
|
||||
-- Write the data to the register
|
||||
mm_32b_write(addr, data, avs_s, avs_m);
|
||||
addr := std_logic_vector(to_unsigned(6144 + to_integer(unsigned(CSR_ENC_CTRL_ADDR)), 32));
|
||||
data := 32X"15";
|
||||
-- Write the data to the register
|
||||
mm_32b_write(addr, data, avs_s, avs_m);
|
||||
addr := std_logic_vector(to_unsigned(6144 + to_integer(unsigned(CSR_ENC_CTRL_ADDR)), 32));
|
||||
data := 32X"35";
|
||||
-- Write the data to the register
|
||||
mm_32b_write(addr, data, avs_s, avs_m);
|
||||
end if;
|
||||
end loop;
|
||||
|
||||
-- Read PD and FP counter from pulse generator
|
||||
for i in 0 to CH_NUM - 1 loop
|
||||
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(PD_IN_CNT_REG)), 32));
|
||||
mm_32b_read(addr, data, avs_s, avs_m);
|
||||
pd_cnt(i) <= to_integer(unsigned(data));
|
||||
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(FIRE_REQ_CNT_REG)), 32));
|
||||
mm_32b_read(addr, data, avs_s, avs_m);
|
||||
fp_cnt(i) <= to_integer(unsigned(data));
|
||||
end loop;
|
||||
|
||||
registers_read <= true;
|
||||
|
||||
wait;
|
||||
end process pUUT_CTRL;
|
||||
|
||||
clk_clk <= clk;
|
||||
reset_reset_n <= reset_n;
|
||||
|
||||
avs_s.mm_readdata <= avs_readdata(0) when sel_slave_0 = '1' else
|
||||
avs_readdata(1) when sel_slave_1 = '1' else (others => '0');
|
||||
|
||||
avs_s.mm_readdatavalid <= '0';
|
||||
|
||||
avs_s.mm_waitrequest <= avs_waitrequest(0) when sel_slave_0 = '1' else
|
||||
avs_waitrequest(1) when sel_slave_1 = '1' else '0';
|
||||
|
||||
avs_s.use_readvalid <= false;
|
||||
|
||||
avs_address <= avs_m.mm_address(avs_address'range);
|
||||
avs_write(0) <= avs_m.mm_write and sel_slave_0;
|
||||
avs_write(1) <= avs_m.mm_write and sel_slave_1;
|
||||
avs_writedata <= avs_m.mm_writedata;
|
||||
avs_read(0) <= avs_m.mm_read and sel_slave_0;
|
||||
avs_read(1) <= avs_m.mm_read and sel_slave_1;
|
||||
|
||||
end behav;
|
||||
|
||||
245
generic_ip/fire_pulse_manager/3/src/test/pof_tx_3.vhd
Normal file
245
generic_ip/fire_pulse_manager/3/src/test/pof_tx_3.vhd
Normal file
|
|
@ -0,0 +1,245 @@
|
|||
-------------------------------------------------------------------------------
|
||||
-- Title : pof_tx
|
||||
-- Project : SMB
|
||||
-------------------------------------------------------------------------------
|
||||
-- File : pof_tx.vhd
|
||||
-- Author : Gianmarco Girau
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2017-08-22
|
||||
-- Last update: 2019-07-15
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'08
|
||||
-------------------------------------------------------------------------------
|
||||
-- Description:
|
||||
-- Encodes the EMS output into a serial format to be distributed over the POF
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
entity pof_tx_3 is
|
||||
port(
|
||||
reset_n : in std_logic;
|
||||
clk : in std_logic;
|
||||
init : in std_logic;
|
||||
pd_in : in std_logic;
|
||||
inc_pos : in std_logic;
|
||||
dec_pos : in std_logic;
|
||||
abs_position : in std_logic_vector(31 downto 0);
|
||||
tx_data : out std_logic;
|
||||
-- Avalon MM Interface
|
||||
avs_address : in std_logic_vector( 2 downto 0);
|
||||
avs_write : in std_logic;
|
||||
avs_writedata : in std_logic_vector(31 downto 0);
|
||||
avs_read : in std_logic;
|
||||
avs_readdatavalid : out std_logic;
|
||||
avs_readdata : out std_logic_vector(31 downto 0));
|
||||
end entity pof_tx_3;
|
||||
|
||||
architecture rtl of pof_tx_3 is
|
||||
|
||||
constant CSR : std_logic_vector( 2 downto 0) := b"000";
|
||||
constant ERROR_INJ_REG : std_logic_vector( 2 downto 0) := b"001";
|
||||
|
||||
constant KEEPALIVE_PERIOD : integer := 100;
|
||||
constant INIT_BLOCKED_PERIOD : integer := 200;
|
||||
|
||||
function odd_parity(data : std_logic_vector) return std_logic is
|
||||
variable parity_bit : std_logic := '1';
|
||||
begin
|
||||
for n in 0 to data'length-1 loop
|
||||
parity_bit := parity_bit xor data(n);
|
||||
end loop; -- n
|
||||
return parity_bit;
|
||||
end function odd_parity;
|
||||
|
||||
function bin2gray(bin : std_logic_vector) return std_logic_vector is
|
||||
variable gray : std_logic_vector(bin'range);
|
||||
begin
|
||||
gray := bin xor ('0' & bin(bin'length-1 downto 1));
|
||||
return gray;
|
||||
end function bin2gray;
|
||||
|
||||
signal rd_event, wr_event, empty, full, tx_ready : std_logic;
|
||||
signal rd_event_d, wr_event_i, symbol_valid : std_logic;
|
||||
signal enable, toggle_sync, toggle_pd : std_logic;
|
||||
signal add_keepalive, ovfl_err, init_d, init_gen : std_logic;
|
||||
signal clear, pd_in_d, pd_gen, parity_bit : std_logic;
|
||||
signal inject_error, inject_error_req : std_logic;
|
||||
signal pd_event, pd_event_d, pd_event_dd : std_logic;
|
||||
signal init_blocked, pd_event_ddd, delayed_pos : std_logic;
|
||||
--
|
||||
signal delayed_pos_v : std_logic_vector( 2 downto 0);
|
||||
signal init_v, gray, bit_div : std_logic_vector( 3 downto 0);
|
||||
signal latched_pos : std_logic_vector( 3 downto 0);
|
||||
signal event_in_i : std_logic_vector( 6 downto 0);
|
||||
signal keepalive_cnt : std_logic_vector( 7 downto 0);
|
||||
signal event_in, event_out : std_logic_vector( 7 downto 0);
|
||||
signal symbol : std_logic_vector( 7 downto 0);
|
||||
signal init_blk_cnt : std_logic_vector( 9 downto 0) := (others => '0');
|
||||
|
||||
|
||||
begin
|
||||
|
||||
clear <= not enable;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Encode events and queue these in a FIFO
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
pEVENT_GEN : process(clk)
|
||||
begin
|
||||
if(clk = '1' and clk'event) then
|
||||
init_d <= init;
|
||||
if(init = '1' and init_d = '0' and init_blocked = '0') then
|
||||
init_v <= "1100";
|
||||
else
|
||||
init_v <= '0' & init_v(3 downto 1);
|
||||
end if;
|
||||
if(enable = '0') then
|
||||
toggle_sync <= '0';
|
||||
elsif(init_d = '1' and init_blocked = '0') then
|
||||
toggle_sync <= not toggle_sync;
|
||||
end if;
|
||||
if(init_gen = '1') then
|
||||
init_blk_cnt <= std_logic_vector(to_unsigned(INIT_BLOCKED_PERIOD, 10));
|
||||
elsif(init_blocked = '1') then
|
||||
init_blk_cnt <= std_logic_vector(unsigned(init_blk_cnt)-1);
|
||||
end if;
|
||||
pd_in_d <= pd_in;
|
||||
pd_event_d <= pd_event;
|
||||
pd_event_dd <= pd_event_d;
|
||||
pd_event_ddd <= pd_event_dd;
|
||||
if(pd_event = '1') then
|
||||
latched_pos <= abs_position(3 downto 0);
|
||||
end if;
|
||||
if((dec_pos = '1' or inc_pos = '1') and pd_gen = '1') then
|
||||
delayed_pos_v <= "111";
|
||||
else
|
||||
delayed_pos_v <= '0' & delayed_pos_v(2 downto 1);
|
||||
end if;
|
||||
if(enable = '0') then
|
||||
toggle_pd <= '0';
|
||||
elsif(pd_event = '1') then
|
||||
toggle_pd <= not toggle_pd;
|
||||
end if;
|
||||
wr_event <= wr_event_i or add_keepalive;
|
||||
event_in <= parity_bit & event_in_i;
|
||||
if(enable = '0' or wr_event_i = '1') then
|
||||
keepalive_cnt <= std_logic_vector(to_unsigned(KEEPALIVE_PERIOD, 8));
|
||||
else
|
||||
keepalive_cnt <= std_logic_vector(unsigned(keepalive_cnt)-1);
|
||||
end if;
|
||||
if(enable = '0') then
|
||||
ovfl_err <= '0';
|
||||
elsif(wr_event = '1' and full = '1') then
|
||||
ovfl_err <= '1';
|
||||
end if;
|
||||
if(clear = '1' or wr_event = '1') then
|
||||
inject_error <= '0';
|
||||
elsif(inject_error_req = '1') then
|
||||
inject_error <= '1';
|
||||
end if;
|
||||
end if;
|
||||
end process pEVENT_GEN;
|
||||
|
||||
init_gen <= init_v(0);
|
||||
|
||||
init_blocked <= '1' when unsigned(init_blk_cnt) /= 0 else '0';
|
||||
|
||||
pd_event <= pd_in and not pd_in_d;
|
||||
pd_gen <= pd_event or pd_event_d or pd_event_dd;
|
||||
|
||||
delayed_pos <= delayed_pos_v(0) and pd_event_ddd;
|
||||
|
||||
wr_event_i <= enable and (init_gen or pd_gen or dec_pos or inc_pos or delayed_pos);
|
||||
|
||||
add_keepalive <= '1' when wr_event_i = '0' and unsigned(keepalive_cnt) = 0 else '0';
|
||||
|
||||
gray <= bin2gray(latched_pos) when (pd_event_d = '1' or pd_event_dd = '1') else bin2gray(abs_position(3 downto 0));
|
||||
|
||||
-- toggle_pd is repeated twice in the tx word, to improve resiliance against
|
||||
-- double bit-flips errors
|
||||
event_in_i <= gray & toggle_pd & toggle_pd & toggle_sync;
|
||||
|
||||
parity_bit <= odd_parity(event_in_i) xor inject_error;
|
||||
|
||||
iQUEUE_EVENT : entity work.fifo_16x8_3
|
||||
port map (
|
||||
clock => clk,
|
||||
data => event_in,
|
||||
rdreq => rd_event,
|
||||
sclr => clear,
|
||||
wrreq => wr_event,
|
||||
empty => empty,
|
||||
full => full,
|
||||
q => event_out,
|
||||
usedw => open);
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Transmit symbols over serial link
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
pGET_EVENT : process(clk)
|
||||
begin
|
||||
if(clk = '1' and clk'event) then
|
||||
rd_event_d <= rd_event;
|
||||
symbol_valid <= rd_event_d;
|
||||
end if;
|
||||
end process pGET_EVENT;
|
||||
|
||||
rd_event <= '1' when tx_ready = '1' and empty = '0' and rd_event_d = '0' and symbol_valid = '0' else '0';
|
||||
|
||||
symbol <= event_out;
|
||||
|
||||
iTX_SYMBOL : entity work.uart_tx_3
|
||||
generic map (
|
||||
data_width => 8)
|
||||
port map (
|
||||
reset_n => reset_n,
|
||||
clk => clk,
|
||||
bit_div => bit_div,
|
||||
init => clear,
|
||||
ready => tx_ready,
|
||||
data_in => symbol,
|
||||
data_valid => symbol_valid,
|
||||
tx_data => tx_data);
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- C&S registers
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
pCTRL_STATUS : process(reset_n, clk)
|
||||
begin
|
||||
if(reset_n = '0') then
|
||||
avs_readdatavalid <= '0';
|
||||
enable <= '0';
|
||||
bit_div <= "0010";
|
||||
elsif(clk = '1' and clk'event) then
|
||||
inject_error_req <= '0';
|
||||
-- CTRL registers
|
||||
if(avs_write = '1') then
|
||||
case avs_address is
|
||||
when CSR =>
|
||||
enable <= avs_writedata(0);
|
||||
bit_div <= avs_writedata(7 downto 4);
|
||||
when ERROR_INJ_REG =>
|
||||
inject_error_req <= avs_writedata(0);
|
||||
when others => null;
|
||||
end case;
|
||||
end if;
|
||||
-- Read Ctrl & Status registers
|
||||
avs_readdatavalid <= avs_read;
|
||||
if(avs_read = '1') then
|
||||
case avs_address is
|
||||
when CSR =>
|
||||
avs_readdata <= X"000000" & bit_div & b"00" & ovfl_err & enable;
|
||||
when others =>
|
||||
avs_readdata <= X"BAD1BAD0";
|
||||
end case;
|
||||
end if;
|
||||
end if;
|
||||
end process pCTRL_STATUS;
|
||||
|
||||
end architecture rtl;
|
||||
623
generic_ip/fire_pulse_manager/3/src/test/pof_tx_rx_3_tb.vhd
Normal file
623
generic_ip/fire_pulse_manager/3/src/test/pof_tx_rx_3_tb.vhd
Normal file
|
|
@ -0,0 +1,623 @@
|
|||
-------------------------------------------------------------------------------
|
||||
-- Title : pof_tx_rx_tb
|
||||
-- Project : HMB daisy-chaining
|
||||
-------------------------------------------------------------------------------
|
||||
-- File : pof_tx_rx_tb.vhd
|
||||
-- Author : GMG
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2017-08-29
|
||||
-- Last update: 2019-07-15
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'2008
|
||||
-------------------------------------------------------------------------------
|
||||
-- Description:
|
||||
-- Testbench for verifying the transmission over the POF with emb2poftx and
|
||||
-- pofrx2hmb blocks
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
library OSVVM;
|
||||
use OSVVM.RandomBasePkg.all;
|
||||
use OSVVM.RandomPkg.all;
|
||||
|
||||
use work.log_pkg.all;
|
||||
use work.avalon_verify_pkg.all;
|
||||
|
||||
use work.log_pkg.all;
|
||||
|
||||
entity pof_tx_rx_3_tb is
|
||||
-- ..
|
||||
end entity pof_tx_rx_3_tb;
|
||||
|
||||
architecture behav of pof_tx_rx_3_tb is
|
||||
|
||||
constant CLK_PERIOD : time := 10 ns; -- 100MHz
|
||||
constant RX_CLK_PERIOD : time := 3.333 ns; -- 300MHz
|
||||
|
||||
constant NUM_ITERATIONS : natural := 10;
|
||||
constant SWATHE_LEN : integer := 1000;
|
||||
constant START_DIR : std_logic := '0';
|
||||
constant INJECT_ERROR_PERC : natural := 4; -- percentage of injected errors
|
||||
constant DISCR_THRES : natural := 1000;
|
||||
constant TIME_INT : time := 800 ns;
|
||||
|
||||
constant UART_BIT_DIV : std_logic_vector(3 downto 0) := "0110"; -- divide by 6
|
||||
|
||||
-- Logging Verbosity Level
|
||||
constant VERBOSITY_LEVEL : verb_level_t := VMEDIUM;
|
||||
|
||||
signal clk, rx_clk, rx_clk_i, reset_n : std_logic := '0';
|
||||
signal avs_read, avs_write, sel_slave_0, sel_slave_1 : std_logic;
|
||||
signal avs_write_sl0, avs_read_sl0, avs_readdatavalid_sl0 : std_logic;
|
||||
signal avs_write_sl1, avs_read_sl1, avs_readdatavalid_sl1 : std_logic;
|
||||
signal init_tx, init_rx, dir_in, pd_in, inc_pos, dec_pos : std_logic;
|
||||
signal tx_data, rx_data, init_out, dir_out, enc_out : std_logic;
|
||||
signal pd_out, inc_pos_out, dec_pos_out, end_of_swathe : std_logic;
|
||||
--
|
||||
signal test_completed, running, configuring : boolean;
|
||||
signal passed, failed, stimuli_completed : boolean;
|
||||
signal detected_error : boolean := false;
|
||||
--
|
||||
signal avs_address : std_logic_vector(2 downto 0);
|
||||
signal avs_writedata : std_logic_vector(31 downto 0);
|
||||
signal avs_readdata_sl0, avs_readdata_sl1 : std_logic_vector(31 downto 0);
|
||||
signal abs_position, abs_position_d : std_logic_vector(31 downto 0);
|
||||
signal abs_pos_out : std_logic_vector(31 downto 0);
|
||||
--
|
||||
signal swathe_cnt, swathe_pos : integer;
|
||||
signal dir_discr_cnt, pd_discr_cnt : integer;
|
||||
signal pos_discr_cnt : integer;
|
||||
signal pd_in_cnt, pd_out_cnt : integer;
|
||||
signal enc_pulse_cnt : integer;
|
||||
signal dir_err, pd_err, ovfl_err : std_logic;
|
||||
signal pos_err, enc_err, dir_in_d : std_logic;
|
||||
signal injected_errors : integer;
|
||||
signal max_pos, min_pos : integer;
|
||||
signal max_pos_d, min_pos_d : integer;
|
||||
signal exp_enc_cnt : integer;
|
||||
signal exp_enc_pulse, enc_discr : std_logic;
|
||||
signal enc_out_d : std_logic;
|
||||
signal error_rate_thres : std_logic_vector(7 downto 0);
|
||||
signal one_pps : std_logic;
|
||||
signal max_error_flag : std_logic;
|
||||
signal rx_watchdog : std_logic;
|
||||
signal rx_watchdog_en : std_logic;
|
||||
signal rx_watchdog_clr : std_logic;
|
||||
--
|
||||
signal enable_rx : std_logic;
|
||||
signal parity_err_cnt : std_logic_vector(15 downto 0);
|
||||
signal skip_pos_cnt : std_logic_vector(15 downto 0);
|
||||
--
|
||||
signal avs_m : mm_m_rec_t;
|
||||
signal avs_s : mm_s_rec_t;
|
||||
|
||||
|
||||
begin -- architecture behav
|
||||
|
||||
clk <= not clk after 0.5 * CLK_PERIOD;
|
||||
|
||||
rx_clk_i <= not rx_clk_i after 0.5 * RX_CLK_PERIOD;
|
||||
rx_clk <= rx_clk_i after 1 ns;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- UUTs
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
iPOF_TX : entity work.pof_tx_3
|
||||
port map(
|
||||
reset_n => reset_n,
|
||||
clk => clk,
|
||||
init => init_tx,
|
||||
pd_in => pd_in,
|
||||
inc_pos => inc_pos,
|
||||
dec_pos => dec_pos,
|
||||
abs_position => abs_position,
|
||||
tx_data => tx_data,
|
||||
avs_address => avs_address,
|
||||
avs_write => avs_write_sl0,
|
||||
avs_writedata => avs_writedata,
|
||||
avs_read => avs_read_sl0,
|
||||
avs_readdatavalid => avs_readdatavalid_sl0,
|
||||
avs_readdata => avs_readdata_sl0);
|
||||
|
||||
iPOF_RX : entity work.pof_rx_3
|
||||
port map(
|
||||
reset_n => reset_n,
|
||||
clk => clk,
|
||||
init => init_rx,
|
||||
rx_clk => rx_clk,
|
||||
rx_data => rx_data,
|
||||
init_out => init_out,
|
||||
dp_dir => dir_in,
|
||||
enc_out => enc_out,
|
||||
pd_out => pd_out,
|
||||
inc_pos => inc_pos_out,
|
||||
dec_pos => dec_pos_out,
|
||||
abs_pos => abs_pos_out,
|
||||
enable => enable_rx,
|
||||
bit_div => UART_BIT_DIV,
|
||||
error_rate_thres => error_rate_thres,
|
||||
one_pps => one_pps,
|
||||
upd_max_pos => '0',
|
||||
upd_min_pos => '0',
|
||||
max_error_flag => max_error_flag,
|
||||
rx_watchdog => rx_watchdog,
|
||||
rx_watchdog_en => rx_watchdog_en,
|
||||
rx_watchdog_clr => rx_watchdog_clr,
|
||||
parity_err_cnt => parity_err_cnt,
|
||||
skip_pos_cnt => skip_pos_cnt);
|
||||
|
||||
--rx_data <= tx_data after 40 ns;
|
||||
rx_data <= transport tx_data after 40 ns;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- UUT configuration and control
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
clk_clk <= clk;
|
||||
reset_reset_n <= reset_n;
|
||||
|
||||
avs_s.mm_readdata <= avs_readdata_sl0 when sel_slave_0 = '1' else
|
||||
avs_readdata_sl1 when sel_slave_1 = '1' else (others => '0');
|
||||
|
||||
avs_readdata_sl1 <= (others => '0');
|
||||
|
||||
avs_s.mm_readdatavalid <= avs_readdatavalid_sl0 when sel_slave_0 = '1' else
|
||||
avs_readdatavalid_sl1 when sel_slave_1 = '1' else '0';
|
||||
|
||||
avs_readdatavalid_sl1 <= '0';
|
||||
|
||||
avs_s.mm_waitrequest <= '0';
|
||||
avs_s.use_readvalid <= true;
|
||||
|
||||
avs_address <= avs_m.mm_address(avs_address'range);
|
||||
avs_write <= avs_m.mm_write;
|
||||
avs_writedata <= avs_m.mm_writedata;
|
||||
avs_read <= avs_m.mm_read;
|
||||
--
|
||||
avs_write_sl0 <= avs_write and sel_slave_0;
|
||||
--avs_write_sl1 <= avs_write and sel_slave_1;
|
||||
avs_write_sl1 <= '0';
|
||||
--
|
||||
avs_read_sl0 <= avs_read and sel_slave_0;
|
||||
--avs_read_sl1 <= avs_read and sel_slave_1;
|
||||
avs_read_sl1 <= '0';
|
||||
|
||||
-- 1-PPS generation: make it faster than 1-PPS for simulation reasons
|
||||
pEMULATE_1PPS : process
|
||||
begin
|
||||
one_pps <= '0';
|
||||
for n in 1 to 99999 loop
|
||||
wait until clk = '1' and clk'event;
|
||||
end loop; -- 1 to 9999
|
||||
one_pps <= '1';
|
||||
wait until clk = '1' and clk'event;
|
||||
end process pEMULATE_1PPS;
|
||||
|
||||
pUUT_CTRL : process
|
||||
variable addr : std_logic_vector(31 downto 0) := (others => '0');
|
||||
variable data : std_logic_vector(31 downto 0) := (others => '0');
|
||||
variable init_done : boolean := false;
|
||||
variable fifo_level : integer;
|
||||
begin
|
||||
|
||||
enable_rx <= '0';
|
||||
--
|
||||
rx_watchdog_en <= '0';
|
||||
rx_watchdog_clr <= '0';
|
||||
error_rate_thres <= X"0A";
|
||||
|
||||
sel_slave_0 <= '0';
|
||||
sel_slave_1 <= '0';
|
||||
|
||||
configuring <= true;
|
||||
|
||||
-- initilialize the Avalon master-bus
|
||||
mm_m_init(avs_m);
|
||||
|
||||
if (reset_n = '0') then
|
||||
wait until reset_n = '1';
|
||||
wait for 100 ns;
|
||||
wait until clk = '1' and clk'event;
|
||||
end if;
|
||||
|
||||
log("Configuring EMB2POFTX ... ", VLOW, true);
|
||||
sel_slave_0 <= '1';
|
||||
-- Config netfork_rx control registers:
|
||||
-- disable the block
|
||||
addr := std_logic_vector(to_unsigned(0, 32));
|
||||
data := X"0000_0021";
|
||||
mm_32b_write(addr, data, avs_s, avs_m);
|
||||
|
||||
sel_slave_0 <= '0';
|
||||
sel_slave_1 <= '1';
|
||||
wait until clk = '1' and clk'event;
|
||||
|
||||
log("Configuring POFRX2HMB ... ", VLOW, true);
|
||||
-- Config netfork_rx control registers:
|
||||
-- disable the block
|
||||
addr := std_logic_vector(to_unsigned(0, 32));
|
||||
data := X"0000_0001";
|
||||
--mm_32b_write(addr, data, avs_s, avs_m);
|
||||
enable_rx <= '1';
|
||||
rx_watchdog_en <= '1';
|
||||
|
||||
log("Configuration completed.", VLOW, true);
|
||||
configuring <= false;
|
||||
|
||||
wait;
|
||||
|
||||
end process pUUT_CTRL;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Stimuli Generation
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
pSTIMULI_REGs : process(clk)
|
||||
begin
|
||||
if (clk = '1' and clk'event) then
|
||||
abs_position_d <= abs_position;
|
||||
end if;
|
||||
end process pSTIMULI_REGs;
|
||||
|
||||
inc_pos <= '1' when signed(abs_position) = signed(abs_position_d) + 1 else '0';
|
||||
dec_pos <= '1' when signed(abs_position) = signed(abs_position_d) - 1 else '0';
|
||||
|
||||
pSTIMULI : process
|
||||
variable rv : RandomPType;
|
||||
variable tmp_int : integer;
|
||||
variable rand_time : time;
|
||||
variable end_of_stimuli : boolean;
|
||||
variable pd_dist : integer;
|
||||
begin
|
||||
|
||||
-- initialization
|
||||
init_rx <= '0';
|
||||
--
|
||||
init_tx <= '0';
|
||||
dir_in <= START_DIR;
|
||||
pd_in <= '0';
|
||||
abs_position <= (others => '0');
|
||||
swathe_pos <= 0;
|
||||
pd_dist := 0;
|
||||
--
|
||||
swathe_cnt <= 0;
|
||||
stimuli_completed <= false;
|
||||
end_of_swathe <= '0';
|
||||
|
||||
-- generating the stimulus
|
||||
wait until running = true;
|
||||
wait for 200 ns;
|
||||
-- Send a Init/Sync pulse
|
||||
wait until clk = '1' and clk'event;
|
||||
init_tx <= '1';
|
||||
wait until clk = '1' and clk'event;
|
||||
init_tx <= '0';
|
||||
wait for 500 ns;
|
||||
-- Send a second init pulse and verify that it is ignored (because too
|
||||
-- close to the previous)
|
||||
wait until clk = '1' and clk'event;
|
||||
init_tx <= '1';
|
||||
wait until clk = '1' and clk'event;
|
||||
init_tx <= '0';
|
||||
wait for 2500 ns;
|
||||
-- Send a third pulse (after a bigger interval from the previous).
|
||||
-- Verify that this time the pulse is accepted
|
||||
wait until clk = '1' and clk'event;
|
||||
init_tx <= '1';
|
||||
wait until clk = '1' and clk'event;
|
||||
init_tx <= '0';
|
||||
wait for 500 ns;
|
||||
wait until clk = '1' and clk'event;
|
||||
--
|
||||
-- generate the forward swathe
|
||||
end_of_stimuli := false;
|
||||
while end_of_stimuli = false loop
|
||||
swathe_pos <= 0;
|
||||
wait until clk = '1' and clk'event;
|
||||
while swathe_pos /= SWATHE_LEN loop
|
||||
-- generate a position increment
|
||||
tmp_int := rv.RandInt(1, 100);
|
||||
--tmp_int := 100;
|
||||
if (tmp_int < 20) then
|
||||
-- generate a position increment opposite to the swathe direction
|
||||
swathe_pos <= swathe_pos - 1;
|
||||
if (dir_in = '0') then
|
||||
abs_position <= std_logic_vector(signed(abs_position) - 1);
|
||||
else
|
||||
abs_position <= std_logic_vector(signed(abs_position) + 1);
|
||||
end if;
|
||||
else
|
||||
swathe_pos <= swathe_pos + 1;
|
||||
if (dir_in = '0') then
|
||||
abs_position <= std_logic_vector(signed(abs_position) + 1);
|
||||
else
|
||||
abs_position <= std_logic_vector(signed(abs_position) - 1);
|
||||
end if;
|
||||
end if;
|
||||
--
|
||||
tmp_int := rv.RandInt(1, 100);
|
||||
if (tmp_int <= 5 and pd_dist >= 10) then
|
||||
pd_dist := 0;
|
||||
-- generate a PD increment: the PD might be either concurren or not
|
||||
-- to the position increment
|
||||
tmp_int := rv.RandInt(1, 3);
|
||||
case tmp_int is
|
||||
when 2 =>
|
||||
-- wait less than the transmission time
|
||||
wait for 90 ns;
|
||||
wait until clk = '1' and clk'event;
|
||||
when 3 =>
|
||||
-- wait more than the transmission time
|
||||
wait for 290 ns;
|
||||
wait until clk = '1' and clk'event;
|
||||
when others => null;
|
||||
end case;
|
||||
pd_in <= '1';
|
||||
wait until clk = '1' and clk'event;
|
||||
pd_in <= '0';
|
||||
end if;
|
||||
pd_dist := pd_dist + 1;
|
||||
rand_time := rv.RandInt(-25, 25) * (10 ns);
|
||||
wait for TIME_INT + rand_time;
|
||||
end loop; -- swathe_pos /= SWATHE_LEN
|
||||
|
||||
wait for 25 us;
|
||||
end_of_swathe <= '1';
|
||||
wait until clk = '1' and clk'event;
|
||||
end_of_swathe <= '0';
|
||||
-- reverse direction
|
||||
if (dir_in /= START_DIR) then
|
||||
if (swathe_cnt = NUM_ITERATIONS) then
|
||||
end_of_stimuli := true;
|
||||
else
|
||||
swathe_cnt <= swathe_cnt + 1;
|
||||
end if;
|
||||
end if;
|
||||
if (end_of_stimuli = false) then
|
||||
wait until clk = '1' and clk'event;
|
||||
dir_in <= not dir_in;
|
||||
-- Wait some time to make sure the change of direction is transmitted.
|
||||
-- Note: if the position starts changing before the receiver was able to
|
||||
-- confirm the change of direction, then some encoder pulses may not be
|
||||
-- generated
|
||||
wait for 1 us;
|
||||
wait until clk = '1' and clk'event;
|
||||
end if;
|
||||
end loop; -- end_of_stimuli = false
|
||||
|
||||
stimuli_completed <= true;
|
||||
wait;
|
||||
|
||||
end process pSTIMULI;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Error injection
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
-- Randomly change the payload of the data transmitted over the UART.
|
||||
-- Insert 1, 2 or 3 errors per data word
|
||||
-- Note: an error on the start bit of the UART will can cause more than 3
|
||||
-- errors per data word, therefore this error injection method does not cover
|
||||
-- all the possible cases
|
||||
|
||||
pERROR_INJECTION : process
|
||||
--
|
||||
alias symbol_valid is <<signal iPOF_TX.symbol_valid : std_logic>>;
|
||||
alias symbol is <<signal iPOF_TX.symbol : std_logic_vector>>;
|
||||
--
|
||||
variable rv : RandomPType;
|
||||
variable flip_vect : std_logic_vector(7 downto 0);
|
||||
variable last_flip : std_logic_vector(7 downto 0);
|
||||
variable bit_flips : integer range 0 to 3;
|
||||
variable b0, b1, b2 : integer range 0 to 9;
|
||||
variable exclude_1 : integer_vector(0 downto 0);
|
||||
variable exclude_2 : integer_vector(1 downto 0);
|
||||
variable test : std_logic_vector(5 downto 0);
|
||||
begin
|
||||
|
||||
injected_errors <= 0;
|
||||
if (running /= true) then
|
||||
wait until running = true;
|
||||
end if;
|
||||
|
||||
while running loop
|
||||
wait until symbol_valid = '1' and symbol_valid'event;
|
||||
if (rv.RandInt(1, 100) < INJECT_ERROR_PERC) then
|
||||
-- Inject an error:
|
||||
-- Number of bits to flip in the tx word
|
||||
bit_flips := rv.RandInt(1, 3);
|
||||
--bit_flips := 2;
|
||||
b0 := rv.RandInt(0, 7);
|
||||
exclude_1(0) := b0;
|
||||
b1 := rv.RandInt(min => 0, max => 7, exclude => exclude_1);
|
||||
exclude_2 := (0 => b0, 1 => b1);
|
||||
b2 := rv.RandInt(min => 0, max => 7, exclude => exclude_2);
|
||||
flip_vect := (others => '0');
|
||||
flip_vect(b0) := '1';
|
||||
if (bit_flips >= 2) then
|
||||
flip_vect(b1) := '1';
|
||||
end if;
|
||||
if (bit_flips = 3) then
|
||||
flip_vect(b2) := '1';
|
||||
end if;
|
||||
-- Prevent situations with two consecutive bit flips on bit 0,1 and 2
|
||||
if ((flip_vect(0) = '1' and last_flip(0) = '1') or (flip_vect(1) = '1' and last_flip(1) = '1') or (flip_vect(2) = '1' and last_flip(2) = '1')) then
|
||||
flip_vect := (others => '0');
|
||||
end if;
|
||||
log("bit-flip = " & to_string(bit_flips) & ", flip_vect = " & to_string(flip_vect) & ".", VLOW);
|
||||
symbol <= force symbol xor flip_vect;
|
||||
injected_errors <= injected_errors + 1;
|
||||
wait until clk = '1' and clk'event;
|
||||
wait until clk = '1' and clk'event;
|
||||
symbol <= release;
|
||||
last_flip := flip_vect;
|
||||
else
|
||||
last_flip := (others => '0');
|
||||
end if;
|
||||
end loop;
|
||||
|
||||
end process pERROR_INJECTION;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Output Checking
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
-- No more check on dir_out!!!
|
||||
dir_out <= dir_in;
|
||||
|
||||
pEVENT_MONITOR : process(clk)
|
||||
begin
|
||||
if (clk = '1' and clk'event) then
|
||||
if (reset_n = '0' or init_tx = '1' or running = false or dir_in = dir_out) then
|
||||
dir_discr_cnt <= 0;
|
||||
elsif (dir_in /= dir_out) then
|
||||
dir_discr_cnt <= dir_discr_cnt + 1;
|
||||
end if;
|
||||
if (reset_n = '0' or init_tx = '1' or running = false) then
|
||||
dir_err <= '0';
|
||||
elsif (dir_discr_cnt > DISCR_THRES) then
|
||||
dir_err <= '1';
|
||||
end if;
|
||||
if (reset_n = '0' or init_tx = '1' or running = false) then
|
||||
pd_in_cnt <= 0;
|
||||
elsif (pd_in = '1') then
|
||||
pd_in_cnt <= pd_in_cnt + 1;
|
||||
end if;
|
||||
if (reset_n = '0' or init_tx = '1' or running = false) then
|
||||
pd_out_cnt <= 0;
|
||||
elsif (pd_out = '1') then
|
||||
pd_out_cnt <= pd_out_cnt + 1;
|
||||
end if;
|
||||
if (reset_n = '0' or init_tx = '1' or running = false or pd_in_cnt = pd_out_cnt) then
|
||||
pd_discr_cnt <= 0;
|
||||
elsif (pd_in_cnt /= pd_out_cnt) then
|
||||
pd_discr_cnt <= pd_discr_cnt + 1;
|
||||
end if;
|
||||
if (reset_n = '0' or init_tx = '1' or running = false) then
|
||||
pd_err <= '0';
|
||||
elsif (pd_discr_cnt > DISCR_THRES) then
|
||||
pd_err <= '1';
|
||||
end if;
|
||||
if (reset_n = '0' or init_tx = '1' or running = false or signed(abs_position) = signed(abs_pos_out)) then
|
||||
pos_discr_cnt <= 0;
|
||||
elsif (signed(abs_position) /= signed(abs_pos_out)) then
|
||||
pos_discr_cnt <= pos_discr_cnt + 1;
|
||||
end if;
|
||||
if (reset_n = '0' or init_tx = '1' or running = false) then
|
||||
pos_err <= '0';
|
||||
elsif (pos_discr_cnt > DISCR_THRES) then
|
||||
pos_err <= '1';
|
||||
end if;
|
||||
dir_in_d <= dir_in;
|
||||
if (reset_n = '0' or init_tx = '1' or running = false or dir_in /= dir_in_d) then
|
||||
enc_pulse_cnt <= 0;
|
||||
elsif (enc_out = '1') then
|
||||
enc_pulse_cnt <= enc_pulse_cnt + 1;
|
||||
end if;
|
||||
if (reset_n = '0' or init_tx = '1' or running = false) then
|
||||
enc_err <= '0';
|
||||
elsif (end_of_swathe = '1' and enc_pulse_cnt /= SWATHE_LEN) then
|
||||
enc_err <= '1';
|
||||
end if;
|
||||
max_pos_d <= max_pos;
|
||||
min_pos_d <= min_pos;
|
||||
if ((dir_in = '0' and max_pos /= max_pos_d) or (dir_in = '1' and min_pos /= min_pos_d)) then
|
||||
exp_enc_pulse <= '1';
|
||||
else
|
||||
exp_enc_pulse <= '0';
|
||||
end if;
|
||||
enc_out_d <= enc_out;
|
||||
end if;
|
||||
end process pEVENT_MONITOR;
|
||||
|
||||
enc_discr <= enc_out_d xor exp_enc_pulse;
|
||||
|
||||
pMIN_MAX_POS : process(reset_n, end_of_swathe, abs_pos_out)
|
||||
begin
|
||||
if (reset_n = '0' or end_of_swathe = '1') then
|
||||
max_pos <= -SWATHE_LEN;
|
||||
elsif (signed(abs_pos_out) > max_pos) then
|
||||
max_pos <= to_integer(signed(abs_pos_out));
|
||||
end if;
|
||||
if (reset_n = '0' or end_of_swathe = '1') then
|
||||
min_pos <= SWATHE_LEN;
|
||||
elsif (signed(abs_pos_out) < min_pos) then
|
||||
min_pos <= to_integer(signed(abs_pos_out));
|
||||
end if;
|
||||
end process pMIN_MAX_POS;
|
||||
|
||||
exp_enc_cnt <= max_pos - min_pos;
|
||||
|
||||
ovfl_err <= <<signal iPOF_TX.ovfl_err : std_logic>>;
|
||||
|
||||
pERR_DETECT : process(reset_n, clk)
|
||||
begin
|
||||
if (reset_n = '0') then
|
||||
detected_error <= false;
|
||||
elsif (clk = '1' and clk'event) then
|
||||
--if(ovfl_err = '1' or dir_err = '1' or pd_err = '1' or pos_err = '1' or enc_err = '1') then
|
||||
if (ovfl_err = '1' or dir_err = '1' or pd_err = '1' or pos_err = '1') then
|
||||
detected_error <= true;
|
||||
end if;
|
||||
end if;
|
||||
end process pERR_DETECT;
|
||||
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Testbench Control
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
pTB_CTRL : process
|
||||
begin
|
||||
|
||||
-- Set the verbosity level for logging
|
||||
set_log_verbosity(VERBOSITY_LEVEL);
|
||||
set_log_verbosity(VHIGH);
|
||||
|
||||
log_header("POF Transfer Tx/Rx verification:", VLOW);
|
||||
|
||||
test_completed <= false;
|
||||
running <= false;
|
||||
passed <= false;
|
||||
failed <= false;
|
||||
|
||||
-- Reset
|
||||
reset_n <= '0';
|
||||
wait for 100 ns;
|
||||
wait until clk = '1' and clk'event;
|
||||
reset_n <= '1';
|
||||
|
||||
if (configuring /= true) then
|
||||
wait until configuring = true;
|
||||
end if;
|
||||
wait until configuring = false;
|
||||
running <= true;
|
||||
|
||||
wait until stimuli_completed = true or detected_error = true;
|
||||
|
||||
if (stimuli_completed = true) then
|
||||
-- wait enough time to make sure that a max length package can be propagated
|
||||
wait for 20 us;
|
||||
end if;
|
||||
|
||||
if (detected_error = true) then
|
||||
failed <= true;
|
||||
log("FAILURE: test completed with errors.", VLOW);
|
||||
else
|
||||
passed <= true;
|
||||
log("SUCCESS: test successfully completed.", VLOW);
|
||||
end if;
|
||||
log_separator_line(VLOW);
|
||||
test_completed <= true;
|
||||
running <= false;
|
||||
|
||||
wait;
|
||||
|
||||
end process pTB_CTRL;
|
||||
|
||||
|
||||
end architecture behav;
|
||||
163
generic_ip/fire_pulse_manager/3/src/test/uart_tx_3.vhd
Normal file
163
generic_ip/fire_pulse_manager/3/src/test/uart_tx_3.vhd
Normal file
|
|
@ -0,0 +1,163 @@
|
|||
-------------------------------------------------------------------------------
|
||||
-- Title : uart_tx
|
||||
-- Project : EMB-1
|
||||
-------------------------------------------------------------------------------
|
||||
-- File : uart_tx.vhd
|
||||
-- Author : Gianmarco Girau
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2016-10-24
|
||||
-- Last update: 2019-07-15
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'08
|
||||
-------------------------------------------------------------------------------
|
||||
-- Description:
|
||||
-- Simple UART trasmitter, used to trasmit data over the POF, 1 start, 1 stop
|
||||
-- bit, no parity
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
entity uart_tx_3 is
|
||||
generic(
|
||||
data_width : natural range 1 to 31);
|
||||
port(
|
||||
reset_n : in std_logic;
|
||||
clk : in std_logic;
|
||||
bit_div : in std_logic_vector(3 downto 0); -- number of clock cycles per tx bit
|
||||
init : in std_logic;
|
||||
ready : out std_logic;
|
||||
data_in : in std_logic_vector(data_width-1 downto 0);
|
||||
data_valid : in std_logic;
|
||||
tx_data : out std_logic);
|
||||
end entity uart_tx_3;
|
||||
|
||||
architecture rtl of uart_tx_3 is
|
||||
|
||||
type fsm_state_t is (idle, send_start_bit, send_data, send_stop_bit);
|
||||
|
||||
signal fsm_state_curr, fsm_state_next : fsm_state_t;
|
||||
--
|
||||
signal ld_data, shf_data, rst_bit_cnt, inc_bit_cnt : std_logic;
|
||||
signal rst_clk_cnt, end_of_bit, end_of_tx : std_logic;
|
||||
signal rst_tx_data, set_tx_data, ld_tx_data : std_logic;
|
||||
signal ready_i : std_logic;
|
||||
--
|
||||
signal data : std_logic_vector(data_width-1 downto 0);
|
||||
signal clk_cnt : std_logic_vector(3 downto 0);
|
||||
signal bit_cnt : std_logic_vector(5 downto 0);
|
||||
|
||||
begin
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- UART registers and sequential logic
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
pREGs : process(clk)
|
||||
begin
|
||||
if(clk ='1' and clk'event) then
|
||||
if(ld_data = '1') then
|
||||
data <= data_in;
|
||||
elsif(shf_data = '1') then
|
||||
data <= '0' & data(data'high downto 1);
|
||||
end if;
|
||||
if(rst_bit_cnt = '1') then
|
||||
bit_cnt <= (others => '0');
|
||||
elsif(inc_bit_cnt = '1') then
|
||||
bit_cnt <= std_logic_vector(unsigned(bit_cnt)+1);
|
||||
end if;
|
||||
if(rst_clk_cnt = '1' or end_of_bit = '1') then
|
||||
clk_cnt <= (others => '0');
|
||||
else
|
||||
clk_cnt <= std_logic_vector(unsigned(clk_cnt)+1);
|
||||
end if;
|
||||
if(rst_tx_data = '1') then
|
||||
tx_data <= '0';
|
||||
elsif(set_tx_data = '1') then
|
||||
tx_data <= '1';
|
||||
elsif(ld_tx_data = '1') then
|
||||
tx_data <= data(0);
|
||||
end if;
|
||||
end if;
|
||||
end process pREGs;
|
||||
|
||||
end_of_bit <= '1' when unsigned(clk_cnt) = (unsigned(bit_div)-1) else '0';
|
||||
end_of_tx <= '1' when unsigned(bit_cnt) = data_width else '0';
|
||||
|
||||
--shf_data <= inc_bit_cnt;
|
||||
shf_data <= ld_tx_data;
|
||||
inc_bit_cnt <= ld_tx_data;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- FSM
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
-- FSM state register
|
||||
pFSM_SR : process(reset_n, clk)
|
||||
begin
|
||||
if(reset_n = '0') then
|
||||
fsm_state_curr <= idle;
|
||||
elsif(clk = '1' and clk'event) then
|
||||
fsm_state_curr <= fsm_state_next;
|
||||
end if;
|
||||
end process pFSM_SR;
|
||||
|
||||
-- FSM Combinational Logic
|
||||
pFSM_CL : process(fsm_state_curr, init, data_valid, end_of_bit, end_of_tx)
|
||||
begin
|
||||
--default assignments
|
||||
ready_i <= '0';
|
||||
rst_clk_cnt <= '0';
|
||||
rst_tx_data <= '0';
|
||||
set_tx_data <= '0';
|
||||
ld_tx_data <= '0';
|
||||
rst_bit_cnt <= '0';
|
||||
ld_data <= '0';
|
||||
--
|
||||
fsm_state_next <= fsm_state_curr;
|
||||
|
||||
if(init = '1') then
|
||||
set_tx_data <= '1';
|
||||
fsm_state_next <= idle;
|
||||
else
|
||||
case fsm_state_curr is
|
||||
when idle =>
|
||||
ready_i <= '1';
|
||||
ld_data <= '1';
|
||||
rst_clk_cnt <= '1';
|
||||
rst_bit_cnt <= '1';
|
||||
set_tx_data <= '1';
|
||||
if(data_valid = '1') then
|
||||
rst_tx_data <= '1';
|
||||
fsm_state_next <= send_start_bit;
|
||||
end if;
|
||||
|
||||
when send_start_bit =>
|
||||
if(end_of_bit = '1') then
|
||||
ld_tx_data <= '1';
|
||||
fsm_state_next <= send_data;
|
||||
end if;
|
||||
|
||||
when send_data =>
|
||||
if(end_of_bit = '1') then
|
||||
ld_tx_data <= '1';
|
||||
if(end_of_tx = '1') then
|
||||
set_tx_data <= '1';
|
||||
fsm_state_next <= send_stop_bit;
|
||||
end if;
|
||||
end if;
|
||||
|
||||
when send_stop_bit =>
|
||||
if(end_of_bit = '1') then
|
||||
fsm_state_next <= idle;
|
||||
end if;
|
||||
|
||||
when others => null;
|
||||
end case;
|
||||
end if;
|
||||
end process pFSM_CL;
|
||||
|
||||
ready <= ready_i;
|
||||
|
||||
end architecture rtl;
|
||||
160
generic_ip/fire_pulse_manager/3/src/uart_regen_3.vhd
Normal file
160
generic_ip/fire_pulse_manager/3/src/uart_regen_3.vhd
Normal file
|
|
@ -0,0 +1,160 @@
|
|||
-------------------------------------------------------------------------------
|
||||
-- Title : uart_regen
|
||||
-- Project : EMB-1
|
||||
-------------------------------------------------------------------------------
|
||||
-- File : uart_regen.vhd
|
||||
-- Author : Gianmarco Girau
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2017-10-31
|
||||
-- Last update: 2019-07-15
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'08
|
||||
-------------------------------------------------------------------------------
|
||||
-- Description:
|
||||
-- Regenerate the UART signal
|
||||
-------------------------------------------------------------------------------
|
||||
-- altera vhdl_input_version vhdl_2008
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
entity uart_regen_3 is
|
||||
generic(
|
||||
data_width : natural range 1 to 31);
|
||||
port(
|
||||
reset_n : in std_logic;
|
||||
clk : in std_logic;
|
||||
bit_div : in std_logic_vector(3 downto 0); -- number of clock cycles per tx bit
|
||||
enable : in std_logic;
|
||||
bypass_en : in std_logic;
|
||||
uart_rx : in std_logic;
|
||||
uart_tx : out std_logic);
|
||||
end entity uart_regen_3;
|
||||
|
||||
architecture rtl of uart_regen_3 is
|
||||
|
||||
type fsm_state_t is (s_init, s_idle, s_regen);
|
||||
|
||||
signal fsm_state_curr, fsm_state_next : fsm_state_t;
|
||||
--
|
||||
signal uart_rx_i, ld_data, rst_bit_cnt, inc_bit_cnt : std_logic;
|
||||
signal rst_clk_cnt, end_of_bit, end_of_rx : std_logic;
|
||||
signal uart_regen, uart_regen_i : std_logic;
|
||||
--
|
||||
signal clk_cnt : std_logic_vector(3 downto 0);
|
||||
signal bit_cnt : std_logic_vector(5 downto 0);
|
||||
|
||||
begin
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Input Synchronization
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
iSYNC_IN : entity work.sync_wire
|
||||
generic map(
|
||||
rst_val => '1',
|
||||
sync_stages => 3)
|
||||
port map(
|
||||
rstN => reset_n,
|
||||
clk => clk,
|
||||
async_in => uart_rx,
|
||||
sync_out => uart_rx_i);
|
||||
|
||||
-- NOTE : No NEED TO SYNCHRONIZE TO THE LOCAL CLOCK inputs enable, bypass_en
|
||||
-- and bit_biv BECAUSE THOSE SIGNALS ARE PREDOMINANTLY STATIC
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- UART registers and sequential logic
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
pREGs : process(clk)
|
||||
begin
|
||||
if (clk = '1' and clk'event) then
|
||||
if (rst_bit_cnt = '1') then
|
||||
bit_cnt <= (others => '0');
|
||||
elsif (inc_bit_cnt = '1') then
|
||||
bit_cnt <= std_logic_vector(unsigned(bit_cnt) + 1);
|
||||
end if;
|
||||
ld_data <= '0';
|
||||
if clk_cnt = ('0' & std_logic_vector(unsigned(bit_div(bit_div'high downto 1)) + 1)) then
|
||||
ld_data <= '1';
|
||||
end if;
|
||||
|
||||
if (rst_clk_cnt = '1' or end_of_bit = '1') then
|
||||
clk_cnt <= std_logic_vector(unsigned(bit_div) - 1);
|
||||
else
|
||||
clk_cnt <= std_logic_vector(unsigned(clk_cnt) - 1);
|
||||
end if;
|
||||
if (enable = '0') then
|
||||
uart_regen_i <= '1';
|
||||
elsif (ld_data = '1') then
|
||||
uart_regen_i <= uart_rx_i;
|
||||
end if;
|
||||
uart_regen <= uart_regen_i;
|
||||
end if;
|
||||
end process pREGs;
|
||||
|
||||
end_of_bit <= '1' when unsigned(clk_cnt) = 0 else '0';
|
||||
end_of_rx <= '1' when unsigned(bit_cnt) = data_width + 1 else '0';
|
||||
|
||||
-- output mux
|
||||
uart_tx <= uart_rx when bypass_en = '1' else uart_regen;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- FSM
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
-- FSM state register
|
||||
pFSM_SR : process(clk)
|
||||
begin
|
||||
if (clk = '1' and clk'event) then
|
||||
if (enable = '0' or bypass_en = '1') then
|
||||
fsm_state_curr <= s_init;
|
||||
else
|
||||
fsm_state_curr <= fsm_state_next;
|
||||
end if;
|
||||
end if;
|
||||
end process pFSM_SR;
|
||||
|
||||
-- FSM Combinational Logic
|
||||
pFSM_CL : process(fsm_state_curr, uart_rx_i, end_of_bit, end_of_rx, clk_cnt, bit_div)
|
||||
begin
|
||||
--default assignments
|
||||
rst_clk_cnt <= '0';
|
||||
rst_bit_cnt <= '0';
|
||||
inc_bit_cnt <= '0';
|
||||
--
|
||||
fsm_state_next <= fsm_state_curr;
|
||||
|
||||
case fsm_state_curr is
|
||||
when s_init =>
|
||||
if (uart_rx_i = '1') then
|
||||
fsm_state_next <= s_idle;
|
||||
end if;
|
||||
|
||||
when s_idle =>
|
||||
if (uart_rx_i = '0') then
|
||||
rst_clk_cnt <= '1';
|
||||
rst_bit_cnt <= '1';
|
||||
fsm_state_next <= s_regen;
|
||||
end if;
|
||||
|
||||
when s_regen =>
|
||||
|
||||
if (end_of_bit = '1') then
|
||||
inc_bit_cnt <= '1';
|
||||
if (end_of_rx = '1') then
|
||||
if (uart_rx_i = '1') then
|
||||
fsm_state_next <= s_idle;
|
||||
else
|
||||
fsm_state_next <= s_init;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
|
||||
end case;
|
||||
end process pFSM_CL;
|
||||
|
||||
|
||||
end architecture rtl;
|
||||
186
generic_ip/fire_pulse_manager/3/src/uart_rx_3.vhd
Normal file
186
generic_ip/fire_pulse_manager/3/src/uart_rx_3.vhd
Normal file
|
|
@ -0,0 +1,186 @@
|
|||
-------------------------------------------------------------------------------
|
||||
-- Title : uart_rx
|
||||
-- Project : EMB-1
|
||||
-------------------------------------------------------------------------------
|
||||
-- File : uart_rx.vhd
|
||||
-- Author : Gianmarco Girau
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2016-10-24
|
||||
-- Last update: 2019-07-15
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'08
|
||||
-------------------------------------------------------------------------------
|
||||
-- Description:
|
||||
-- Simple UART receiver, used to receive data over the POF, 1 start, 1 stop
|
||||
-- bit, no parity
|
||||
-------------------------------------------------------------------------------
|
||||
-- altera vhdl_input_version vhdl_2008
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
entity uart_rx_3 is
|
||||
generic(
|
||||
data_width : natural range 1 to 31);
|
||||
port(
|
||||
reset_n : in std_logic;
|
||||
clk : in std_logic;
|
||||
bit_div : in std_logic_vector(3 downto 0); -- number of clock cycles per tx bit
|
||||
init : in std_logic;
|
||||
data_out : out std_logic_vector(data_width - 1 downto 0);
|
||||
data_out_valid : out std_logic;
|
||||
rx_error : out std_logic;
|
||||
rx_data : in std_logic);
|
||||
end entity uart_rx_3;
|
||||
|
||||
architecture rtl of uart_rx_3 is
|
||||
|
||||
type fsm_state_t is (s_init, s_idle, s_get_start_bit, s_get_data, s_get_stop_bit);
|
||||
|
||||
signal fsm_state_curr, fsm_state_next : fsm_state_t;
|
||||
--
|
||||
signal rx_data_i, rst_bit_cnt, inc_bit_cnt : std_logic;
|
||||
signal rst_clk_cnt, end_of_rx, data_valid : std_logic;
|
||||
signal stop_bit, rx_error_i : std_logic;
|
||||
--
|
||||
signal data : std_logic_vector(data_width - 1 downto 0);
|
||||
signal bit_cnt : std_logic_vector(5 downto 0);
|
||||
|
||||
-- avoid maths with loadable shift registers
|
||||
-- bit_div will be used to set an indexed bit of the timer shift register
|
||||
-- the timers will shift down towards zeroth bit which will indicate timer has completed.
|
||||
-- this should be faster than using a decrementer and comparators
|
||||
signal uart_bit_timer, uart_bit_sample_timer : std_logic_vector(2**bit_div'length - 1 downto 0);
|
||||
signal uart_bit_timer_load_value, uart_bit_sample_timer_load_value : std_logic_vector(2**bit_div'length - 1 downto 0);
|
||||
|
||||
signal end_of_bit : std_logic;
|
||||
signal shf_data : std_logic;
|
||||
|
||||
begin
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Input Synchronization
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
iSYNC_IN : entity work.sync_wire
|
||||
generic map(
|
||||
rst_val => '1',
|
||||
sync_stages => 3)
|
||||
port map(
|
||||
rstN => reset_n,
|
||||
clk => clk,
|
||||
async_in => rx_data,
|
||||
sync_out => rx_data_i);
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- UART registers and sequential logic
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
pREGs : process(clk)
|
||||
begin
|
||||
if (clk = '1' and clk'event) then
|
||||
if (rst_bit_cnt = '1') then
|
||||
bit_cnt <= (others => '0');
|
||||
elsif (inc_bit_cnt = '1') then
|
||||
bit_cnt <= std_logic_vector(unsigned(bit_cnt) + 1);
|
||||
end if;
|
||||
if (rst_clk_cnt = '1' or end_of_bit = '1') then
|
||||
uart_bit_timer <= uart_bit_timer_load_value;
|
||||
uart_bit_sample_timer <= uart_bit_sample_timer_load_value;
|
||||
else
|
||||
uart_bit_timer <= '0' & uart_bit_timer(uart_bit_timer'high downto 1);
|
||||
uart_bit_sample_timer <= '0' & uart_bit_sample_timer(uart_bit_sample_timer'high downto 1);
|
||||
end if;
|
||||
if (shf_data = '1') then
|
||||
data <= rx_data_i & data(data'high downto 1);
|
||||
end if;
|
||||
data_out_valid <= data_valid;
|
||||
if (data_valid = '1') then
|
||||
data_out <= data;
|
||||
end if;
|
||||
rx_error <= rx_error_i;
|
||||
uart_bit_timer_load_value <= (others => '0');
|
||||
uart_bit_timer_load_value(to_integer(unsigned(bit_div) -1 )) <= '1';
|
||||
uart_bit_sample_timer_load_value <= (others => '0');
|
||||
uart_bit_sample_timer_load_value(to_integer( unsigned(bit_div(bit_div'high downto 1)) -1)) <= '1';
|
||||
end if;
|
||||
end process pREGs;
|
||||
|
||||
shf_data <= uart_bit_sample_timer(0) and not stop_bit;
|
||||
end_of_bit <= uart_bit_timer(0);
|
||||
end_of_rx <= '1' when unsigned(bit_cnt) = data_width else '0';
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- FSM
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
-- FSM state register
|
||||
pFSM_SR : process(clk)
|
||||
begin
|
||||
if (clk = '1' and clk'event) then
|
||||
if (init = '1') then
|
||||
fsm_state_curr <= s_init;
|
||||
else
|
||||
fsm_state_curr <= fsm_state_next;
|
||||
end if;
|
||||
end if;
|
||||
end process pFSM_SR;
|
||||
|
||||
-- FSM Combinational Logic
|
||||
pFSM_CL : process(all)
|
||||
begin
|
||||
--default assignments
|
||||
rst_clk_cnt <= '0';
|
||||
rst_bit_cnt <= '0';
|
||||
inc_bit_cnt <= '0';
|
||||
data_valid <= '0';
|
||||
stop_bit <= '0';
|
||||
rx_error_i <= '0';
|
||||
--
|
||||
fsm_state_next <= fsm_state_curr;
|
||||
|
||||
case fsm_state_curr is
|
||||
when s_init =>
|
||||
if (rx_data_i = '1') then
|
||||
fsm_state_next <= s_idle;
|
||||
end if;
|
||||
|
||||
when s_idle =>
|
||||
if (rx_data_i = '0') then
|
||||
rst_clk_cnt <= '1';
|
||||
rst_bit_cnt <= '1';
|
||||
fsm_state_next <= s_get_start_bit;
|
||||
end if;
|
||||
|
||||
when s_get_start_bit =>
|
||||
if (end_of_bit = '1') then
|
||||
inc_bit_cnt <= '1';
|
||||
fsm_state_next <= s_get_data;
|
||||
end if;
|
||||
|
||||
when s_get_data =>
|
||||
if (end_of_bit = '1') then
|
||||
inc_bit_cnt <= '1';
|
||||
if (end_of_rx = '1') then
|
||||
fsm_state_next <= s_get_stop_bit;
|
||||
end if;
|
||||
end if;
|
||||
|
||||
when s_get_stop_bit =>
|
||||
stop_bit <= '1';
|
||||
if (end_of_bit = '1') then
|
||||
if (rx_data_i = '1') then
|
||||
data_valid <= '1';
|
||||
fsm_state_next <= s_idle;
|
||||
else
|
||||
rx_error_i <= '1';
|
||||
fsm_state_next <= s_init;
|
||||
end if;
|
||||
end if;
|
||||
|
||||
end case;
|
||||
end process pFSM_CL;
|
||||
|
||||
|
||||
end architecture rtl;
|
||||
Loading…
Add table
Add a link
Reference in a new issue