Merge remote-tracking branch 'remotes/origin/1.10004.SMB-147_importing_g-ip_into_smb'
This commit is contained in:
commit
7aa12b2db0
46 changed files with 6598 additions and 260 deletions
70
generic_ip/common/0/src/stretch_pulse.vhd
Normal file
70
generic_ip/common/0/src/stretch_pulse.vhd
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
-------------------------------------------------------------------------------
|
||||
-- Title : stretch pulse
|
||||
-- Project : EMB-1
|
||||
-------------------------------------------------------------------------------
|
||||
-- File : stretch_pulse.vhd
|
||||
-- Author : Gianmarco Girau
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2016-05-27
|
||||
-- Last update: 2018-05-18
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'93
|
||||
-------------------------------------------------------------------------------
|
||||
-- Description:
|
||||
-- Stretch pulse to a programmable width
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
library work;
|
||||
use work.common_pkg.all;
|
||||
|
||||
entity stretch_pulse is
|
||||
generic(
|
||||
pulse_polarity : natural := 0; -- 0 => strecth on rising edge, 1 => strecth on falling edge
|
||||
ext_pulse_width : natural := 100);
|
||||
port(
|
||||
rstN : in std_logic;
|
||||
clk : in std_logic;
|
||||
pulse_in : in std_logic;
|
||||
pulse_out : out std_logic);
|
||||
end stretch_pulse;
|
||||
|
||||
architecture RTL of stretch_pulse is
|
||||
|
||||
signal pulse, pulse_d : std_logic;
|
||||
signal not_zero_cnt_flag : std_logic;
|
||||
signal pulse_cnt : std_logic_vector(log2(ext_pulse_width)-1 downto 0);
|
||||
|
||||
begin -- RTL
|
||||
|
||||
gDetect_Pos_Pulse: if pulse_polarity = 0 generate
|
||||
pulse <= pulse_in and not pulse_d;
|
||||
end generate gDetect_Pos_Pulse;
|
||||
|
||||
gDetect_Neg_Pulse: if pulse_polarity = 1 generate
|
||||
pulse <= not pulse_in and pulse_d;
|
||||
end generate gDetect_Neg_Pulse;
|
||||
|
||||
pStretchPulse : process(rstN, clk)
|
||||
begin
|
||||
if(rstN = '0') then
|
||||
pulse_d <= '0';
|
||||
pulse_out <= '0';
|
||||
pulse_cnt <= (others => '0');
|
||||
elsif(clk = '1' and clk'event) then
|
||||
pulse_d <= pulse_in;
|
||||
pulse_out <= not_zero_cnt_flag;
|
||||
if(pulse = '1') then
|
||||
pulse_cnt <= std_logic_vector(to_unsigned(ext_pulse_width, log2(ext_pulse_width)));
|
||||
elsif(not_zero_cnt_flag = '1') then
|
||||
pulse_cnt <= std_logic_vector(unsigned(pulse_cnt)-1);
|
||||
end if;
|
||||
end if;
|
||||
end process pStretchPulse;
|
||||
|
||||
not_zero_cnt_flag <= '1' when unsigned(pulse_cnt) /= 0 else '0';
|
||||
|
||||
end RTL;
|
||||
|
|
@ -1,16 +1,18 @@
|
|||
[{
|
||||
"ip_name": "emul_1",
|
||||
"ip_name": "enc_pd_emul_1",
|
||||
"bus": "csr",
|
||||
"description": "Encoder/PD emulator",
|
||||
"addr_hi_bit" : "6",
|
||||
"addr_lo_bit" : "5",
|
||||
"sub_blocks": {
|
||||
"local": {
|
||||
"instance": "",
|
||||
"process": "cpp, htm",
|
||||
"process": "cpp, txt",
|
||||
"offset": "0x0"
|
||||
},
|
||||
"generic_sequencer_15": {
|
||||
"instance": "seq",
|
||||
"process": "cpp, htm",
|
||||
"process": "cpp, txt",
|
||||
"offset": "0x20"
|
||||
}
|
||||
},
|
||||
|
|
@ -48,13 +50,13 @@
|
|||
"minor_number" : {
|
||||
"type" : "c",
|
||||
"bit_len" : "8",
|
||||
"reset" : "0x01",
|
||||
"reset" : "0x00",
|
||||
"description" : "Minor number"
|
||||
},
|
||||
"major_number" : {
|
||||
"type" : "c",
|
||||
"bit_len" : "8",
|
||||
"reset" : "0x00",
|
||||
"reset" : "0x01",
|
||||
"description" : "Major number"
|
||||
|
||||
},
|
||||
|
|
@ -225,7 +227,7 @@
|
|||
},
|
||||
"enc_ctrl": {
|
||||
"address": "4",
|
||||
"width": "7",
|
||||
"width": "32",
|
||||
"description": "Control the emulation of encoder signals",
|
||||
"fields": {
|
||||
"nco_en": {
|
||||
|
|
@ -269,6 +271,17 @@
|
|||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "signals the completion of the encoder/absolute position increments"
|
||||
},
|
||||
"reserved": {
|
||||
"type": "rsv",
|
||||
"bit_len": "24",
|
||||
"description": "Reserved"
|
||||
},
|
||||
"seq_present": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "Set to 1 when the Sequencer is instantiated, 0 otherwise"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -359,6 +372,36 @@
|
|||
"reset": "0x0",
|
||||
"width": "24",
|
||||
"description": "PD pulse counter"
|
||||
}
|
||||
},
|
||||
"seq_ctrl": {
|
||||
"address": "15",
|
||||
"description": "sequencer control",
|
||||
"width": "25",
|
||||
"fields": {
|
||||
"seq_start_req": {
|
||||
"type": "w0",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "sequencer start request"
|
||||
},
|
||||
"seq_ext_trig": {
|
||||
"type": "w0",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "sequencer external trigger"
|
||||
},
|
||||
"reserved" : {
|
||||
"type" : "rsv",
|
||||
"bit_len" : "14",
|
||||
"description" : "Reserved bits"
|
||||
},
|
||||
"seq_start_addr": {
|
||||
"type": "w",
|
||||
"bit_len": "9",
|
||||
"reset": "0x0",
|
||||
"description": "sequencer start address"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}]
|
||||
|
|
@ -2,8 +2,15 @@
|
|||
|
||||
#.main clear
|
||||
|
||||
set OSVVM_PATH ../../common/0/src/test/OSVVM
|
||||
set COMMON_PATH ../../common/0/src
|
||||
# Cleanup libraries
|
||||
foreach lib [list work OSVVM] {
|
||||
file delete -force -- $lib
|
||||
vlib $lib
|
||||
}
|
||||
|
||||
set OSVVM_PATH ../../../common/0/src/test/OSVVM
|
||||
set COMMON_PATH ../../../common/0/src
|
||||
set SEQUENCER_PATH ../../../generic_sequencer/15/src
|
||||
|
||||
set WORKLIB work
|
||||
|
||||
|
|
@ -11,7 +18,12 @@ vlib ./work
|
|||
vmap work ./work
|
||||
|
||||
# Compile the UUT
|
||||
do com_smb.do
|
||||
vcom -2008 -work $WORKLIB $COMMON_PATH/common_pkg.vhd
|
||||
vcom -2008 -work $WORKLIB $SEQUENCER_PATH/dpram_sclk_15.vhd
|
||||
vcom -2008 -work $WORKLIB $SEQUENCER_PATH/generic_sequencer_15_pkg.vhd
|
||||
vcom -2008 -work $WORKLIB $SEQUENCER_PATH/generic_sequencer_15.vhd
|
||||
vcom -2008 -work $WORKLIB ./../src/enc_pd_emul_1_pkg.vhd
|
||||
vcom -2008 -work $WORKLIB ./../src/enc_pd_emul_1.vhd
|
||||
|
||||
# Compile the constrained random related packages
|
||||
vlib OSVVM
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
-- Author : Gianmarco Girau
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2018-05-30
|
||||
-- Last update: 2018-08-28
|
||||
-- Last update: 2018-12-21
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'2008
|
||||
-------------------------------------------------------------------------------
|
||||
|
|
@ -58,7 +58,7 @@ end entity enc_pd_emul_1;
|
|||
architecture rtl of enc_pd_emul_1 is
|
||||
|
||||
constant CSR_IP_ID : std_logic_vector(31 downto 0) := x"0000FF12";
|
||||
constant CSR_IP_VER : std_logic_vector(31 downto 0) := x"00000001";
|
||||
constant CSR_IP_VER : std_logic_vector(31 downto 0) := x"00000100";
|
||||
|
||||
constant ENC_NCO_INIT_1 : std_logic_vector(31 downto 0) := X"48000000";
|
||||
constant ENC_NCO_INIT_2 : std_logic_vector(31 downto 0) := X"08000000";
|
||||
|
|
@ -209,7 +209,7 @@ begin
|
|||
|
||||
seq_present <= '1';
|
||||
|
||||
iSEQ: entity work.generic_seq_core_15
|
||||
iSEQ: entity work.generic_sequencer_15
|
||||
generic map (
|
||||
TRIGGER_WIDTH => 8,
|
||||
VECTOR_WIDTH => 2,
|
||||
|
|
|
|||
310
generic_ip/fire_pulse_manager/1/doc/fpm_ctrl_1.json
Normal file
310
generic_ip/fire_pulse_manager/1/doc/fpm_ctrl_1.json
Normal file
|
|
@ -0,0 +1,310 @@
|
|||
[{
|
||||
"ip_name": "fpm_ctrl_1",
|
||||
"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" : "0x01",
|
||||
"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/1/doc/fpm_diags_1.json
Normal file
169
generic_ip/fire_pulse_manager/1/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/1/doc/fpm_event_log_1.json
Normal file
57
generic_ip/fire_pulse_manager/1/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/1/doc/fpm_net_sync_1.json
Normal file
57
generic_ip/fire_pulse_manager/1/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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}]
|
||||
88
generic_ip/fire_pulse_manager/1/sim/sim_fpm.do
Normal file
88
generic_ip/fire_pulse_manager/1/sim/sim_fpm.do
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
# 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 VHDL packages that support bus protocols, memory mapped registers and functional procedures
|
||||
vcom -2008 -work $WORKLIB $COMMON_PATH/test/avalon_verify_pkg.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/common_pkg.vhd
|
||||
vcom -2008 -work $WORKLIB $COMMON_PATH/test/common_test_pkg.vhd
|
||||
vcom -2008 -work $WORKLIB $COMMON_PATH/test/log_pkg.vhd
|
||||
|
||||
# Generic Sequencer
|
||||
vcom -2008 -work $WORKLIB $GENERIC_PATH/generic_sequencer/15/src/dpram_sclk_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/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/altera/sync_fifo_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_1_pkg.vhd
|
||||
vcom -2008 -work $WORKLIB $SRC_PATH/uart_rx_1.vhd
|
||||
vcom -2008 -work $WORKLIB $SRC_PATH/uart_regen_1.vhd
|
||||
vcom -2008 -work $WORKLIB $SRC_PATH/fire_pulse_ctrl_1.vhd
|
||||
vcom -2008 -work $WORKLIB $SRC_PATH/sync_wire_1.vhd
|
||||
vcom -2008 -work $WORKLIB $SRC_PATH/sync_wire_rEdge_1.vhd
|
||||
vcom -2008 -work $WORKLIB $SRC_PATH/pof_rx_1.vhd
|
||||
vcom -2008 -work $WORKLIB $SRC_PATH/cs_bus_itf_1.vhd
|
||||
vcom -2008 -work $WORKLIB $SRC_PATH/fire_pulse_ext_1.vhd
|
||||
vcom -2008 -work $WORKLIB $SRC_PATH/fire_pulse_manager_1.vhd
|
||||
|
||||
# POF TX
|
||||
vcom -2008 -work $WORKLIB $TB_PATH/fifo_16x8_1.vhd
|
||||
vcom -2008 -work $WORKLIB $TB_PATH/uart_tx_1.vhd
|
||||
vcom -2008 -work $WORKLIB $TB_PATH/pof_tx_1.vhd
|
||||
|
||||
# Testbench
|
||||
vcom -2008 -work $WORKLIB $TB_PATH/fire_pulse_manager_1_tb.vhd
|
||||
|
||||
# Load design
|
||||
vsim -t ps work.fire_pulse_manager_1_tb
|
||||
|
||||
# Add waves
|
||||
add wave -r sim:/fire_pulse_manager_1_tb/*
|
||||
|
||||
# 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
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
116
generic_ip/fire_pulse_manager/1/src/cs_bus_itf_1.vhd
Normal file
116
generic_ip/fire_pulse_manager/1/src/cs_bus_itf_1.vhd
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
-------------------------------------------------------------------------------
|
||||
-- Title : cs_bus_ift
|
||||
-------------------------------------------------------------------------------
|
||||
-- File : cs_bus_ift.vhd
|
||||
-- Author : Gianmarco Girau
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Target : Altera Nios/HPS based systems
|
||||
-- Dependency : none
|
||||
-------------------------------------------------------------------------------
|
||||
-- Description: Split the memory space from the Avalon-MM I/F and drive the C&S
|
||||
-- bus for a programmable number of FW processing blocks
|
||||
-------------------------------------------------------------------------------
|
||||
-- Last update: 2016-10-28
|
||||
-------------------------------------------------------------------------------
|
||||
-- Revisions :
|
||||
-- Date Version Author Description
|
||||
-- 2015-10-19 1.0 gmg Created
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
entity cs_bus_ift_1 is
|
||||
generic(blk_num : integer range 1 to 16 := 1);
|
||||
port(
|
||||
rstN : in std_logic;
|
||||
clk : in std_logic;
|
||||
-- Avalon-MM itf
|
||||
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_readdatavalid : out std_logic;
|
||||
avs_readdata : out std_logic_vector(31 downto 0);
|
||||
-- C&S bus
|
||||
cs_addr : out std_logic_vector(10 downto 0);
|
||||
cs_we : out std_logic_vector(blk_num-1 downto 0);
|
||||
cs_wr_data : out std_logic_vector(31 downto 0);
|
||||
cs_re : out std_logic_vector(blk_num-1 downto 0);
|
||||
cs_rv : in std_logic_vector(blk_num-1 downto 0);
|
||||
cs_rd_data : in std_logic_vector(32*blk_num-1 downto 0));
|
||||
end cs_bus_ift_1;
|
||||
|
||||
architecture RTL of cs_bus_ift_1 is
|
||||
|
||||
-- limit to 16 the maximum number of user blocks
|
||||
type rd_bus_t is array (0 to blk_num-1) of std_logic_vector(31 downto 0);
|
||||
|
||||
signal cs_rd_data_i : rd_bus_t;
|
||||
signal avs_read_d : std_logic;
|
||||
signal avs_rd_en : std_logic;
|
||||
signal dummy_rv : std_logic; -- Dummy Read valid: asserted when
|
||||
-- trying to read from not allocated addresses
|
||||
signal avs_address_i : std_logic_vector(14 downto 0);
|
||||
|
||||
begin
|
||||
|
||||
BUS_REMAP: for i in 0 to blk_num-1 generate
|
||||
cs_rd_data_i(i) <= cs_rd_data((i+1)*32-1 downto i*32);
|
||||
end generate BUS_REMAP;
|
||||
|
||||
pLatchIO : process(rstN, clk)
|
||||
begin
|
||||
if(rstN = '0') then
|
||||
avs_address_i <= (others => '0');
|
||||
cs_we <= (others => '0');
|
||||
cs_wr_data <= (others => '0');
|
||||
cs_re <= (others => '0');
|
||||
avs_readdatavalid <= '0';
|
||||
avs_readdata <= (others => '0');
|
||||
avs_read_d <= '0';
|
||||
dummy_rv <= '0';
|
||||
elsif(clk = '1' and clk'event) then
|
||||
if(avs_write = '1' or avs_read = '1') then
|
||||
avs_address_i <= avs_address;
|
||||
end if;
|
||||
avs_read_d <= avs_read;
|
||||
for i in 0 to blk_num-1 loop
|
||||
-- limit to 16 the maximum number of user blocks
|
||||
if(avs_write = '1' and to_integer(unsigned(avs_address(avs_address'high downto avs_address'high-3))) = i) then
|
||||
cs_we(i) <= '1';
|
||||
else
|
||||
cs_we(i) <= '0';
|
||||
end if;
|
||||
end loop; -- i
|
||||
cs_wr_data <= avs_writedata;
|
||||
for i in 0 to blk_num-1 loop
|
||||
if(avs_rd_en = '1' and to_integer(unsigned(avs_address(avs_address'high downto avs_address'high-3))) = i) then
|
||||
cs_re(i) <= '1';
|
||||
else
|
||||
cs_re(i) <= '0';
|
||||
end if;
|
||||
end loop; -- i
|
||||
if(avs_rd_en = '1' and (to_integer(unsigned(avs_address(avs_address'high downto avs_address'high-3))) >= blk_num)) then
|
||||
dummy_rv <= '1';
|
||||
else
|
||||
dummy_rv <= '0';
|
||||
end if;
|
||||
avs_readdatavalid <= dummy_rv or cs_rv(to_integer(unsigned(avs_address_i(avs_address'high downto avs_address'high-3))));
|
||||
if(dummy_rv = '0') then
|
||||
avs_readdata <= cs_rd_data_i(to_integer(unsigned(avs_address_i(avs_address'high downto avs_address'high-3))));
|
||||
else
|
||||
avs_readdata <= X"DEAD_BEEF";
|
||||
end if;
|
||||
end if;
|
||||
end process pLatchIO;
|
||||
|
||||
avs_rd_en <= avs_read and not avs_read_d;
|
||||
|
||||
cs_addr <= avs_address_i(10 downto 0);
|
||||
|
||||
end RTL;
|
||||
|
||||
|
||||
|
||||
37
generic_ip/fire_pulse_manager/1/src/fire_pulse_1_pkg.vhd
Normal file
37
generic_ip/fire_pulse_manager/1/src/fire_pulse_1_pkg.vhd
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
-------------------------------------------------------------------------------
|
||||
-- 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: 2017-09-08
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'08
|
||||
-------------------------------------------------------------------------------
|
||||
-- Description:
|
||||
-- Package for fire_pulse_manager block
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
package fire_pulse_1_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_1_pkg;
|
||||
275
generic_ip/fire_pulse_manager/1/src/fire_pulse_ctrl_1.vhd
Normal file
275
generic_ip/fire_pulse_manager/1/src/fire_pulse_ctrl_1.vhd
Normal file
|
|
@ -0,0 +1,275 @@
|
|||
-------------------------------------------------------------------------------
|
||||
-- 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: 2017-11-27
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'08
|
||||
-------------------------------------------------------------------------------
|
||||
-- Description:
|
||||
-- Control service logic for the Fire-Controller-Manager
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
entity fire_pulse_ctrl_1 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_1;
|
||||
|
||||
architecture rtl of fire_pulse_ctrl_1 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"00000100";
|
||||
|
||||
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;
|
||||
107
generic_ip/fire_pulse_manager/1/src/fire_pulse_ext_1.vhd
Normal file
107
generic_ip/fire_pulse_manager/1/src/fire_pulse_ext_1.vhd
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
-------------------------------------------------------------------------------
|
||||
-- Title : fire_pulse_manager
|
||||
-- Project : GMA
|
||||
-------------------------------------------------------------------------------
|
||||
-- File : fire_pulse_ext.vhd
|
||||
-- Author : Christos Spirotis
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2017-10-03
|
||||
-- Last update: 2018-10-03
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'08
|
||||
-------------------------------------------------------------------------------
|
||||
-- Description:
|
||||
-- Detects external fire pulse and regenerates it
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
library work;
|
||||
|
||||
entity fire_pulse_ext_1 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_1;
|
||||
|
||||
architecture rtl of fire_pulse_ext_1 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;
|
||||
408
generic_ip/fire_pulse_manager/1/src/fire_pulse_manager_1.vhd
Normal file
408
generic_ip/fire_pulse_manager/1/src/fire_pulse_manager_1.vhd
Normal file
|
|
@ -0,0 +1,408 @@
|
|||
-------------------------------------------------------------------------------
|
||||
-- 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: 2018-06-28
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'08
|
||||
-------------------------------------------------------------------------------
|
||||
-- Description:
|
||||
-- Generates fire request from the EMS output data, transferred either via POF
|
||||
-- or through NetSync
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
library work;
|
||||
use work.fire_pulse_1_pkg.all;
|
||||
|
||||
entity fire_pulse_manager_1 is
|
||||
port(
|
||||
reset_n : in std_logic;
|
||||
clk : in std_logic; -- 100MHz
|
||||
rx_clk : in std_logic; -- 200MHz
|
||||
-- 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;
|
||||
ins_fpm_irq_2 : out std_logic;
|
||||
ins_fpm_irq_3 : out std_logic;
|
||||
-- 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_readdatavalid : out std_logic;
|
||||
avs_readdata : out std_logic_vector(31 downto 0));
|
||||
end entity fire_pulse_manager_1;
|
||||
|
||||
architecture rtl of fire_pulse_manager_1 is
|
||||
|
||||
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_1
|
||||
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_readdatavalid => avs_readdatavalid,
|
||||
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_1
|
||||
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);
|
||||
|
||||
-- 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(
|
||||
out_pulse_condition => true)
|
||||
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_1
|
||||
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_1
|
||||
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_1
|
||||
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;
|
||||
357
generic_ip/fire_pulse_manager/1/src/pof_rx_1.vhd
Normal file
357
generic_ip/fire_pulse_manager/1/src/pof_rx_1.vhd
Normal file
|
|
@ -0,0 +1,357 @@
|
|||
-------------------------------------------------------------------------------
|
||||
-- Title : pof_rx
|
||||
-- Project : SMB
|
||||
-------------------------------------------------------------------------------
|
||||
-- File : pof_rx.vhd
|
||||
-- Author : Gianmarco Girau
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2017-08-23
|
||||
-- Last update: 2018-06-28
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'08
|
||||
-------------------------------------------------------------------------------
|
||||
-- Description:
|
||||
-- Deserializes and decodes the EMS (SMB) output, received from the POF.
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
entity pof_rx_1 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_1;
|
||||
|
||||
architecture rtl of pof_rx_1 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 200 MHz)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
iRX_SYMBOL : entity work.uart_rx_1
|
||||
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_1
|
||||
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_1
|
||||
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_1
|
||||
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;
|
||||
61
generic_ip/fire_pulse_manager/1/src/sync_wire_1.vhd
Normal file
61
generic_ip/fire_pulse_manager/1/src/sync_wire_1.vhd
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
-------------------------------------------------------------------------------
|
||||
-- Title : sync_wire
|
||||
-------------------------------------------------------------------------------
|
||||
-- File : sync_wire.vhd
|
||||
-- Author : Gianmarco Girau <ggianmarco.girau@gmail.com>
|
||||
-- Company : On my own
|
||||
-- Target : Generic (simulation), Generic (synthesis)
|
||||
-- Dependency : none
|
||||
-------------------------------------------------------------------------------
|
||||
-- Description: synchronize a std_logic signal to a clock domain
|
||||
-------------------------------------------------------------------------------
|
||||
-- Last update: 2015-08-17
|
||||
-------------------------------------------------------------------------------
|
||||
-- Revisions :
|
||||
-- Date Version Author Description
|
||||
-- 2010-10-25 1.0 gmg Created
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
|
||||
entity sync_wire_1 is
|
||||
generic(
|
||||
rst_val : std_logic := '0';
|
||||
sync_stages : positive := 2);
|
||||
port(
|
||||
rstN : in std_logic;
|
||||
clk : in std_logic;
|
||||
async_in : in std_logic;
|
||||
sync_out : out std_logic);
|
||||
end sync_wire_1;
|
||||
|
||||
architecture RTL of sync_wire_1 is
|
||||
|
||||
signal sync_sig : std_logic_vector(sync_stages-1 downto 0);
|
||||
|
||||
begin
|
||||
|
||||
pSYNC : process(rstN, clk)
|
||||
begin
|
||||
if(rstN = '0') then
|
||||
for n in 0 to sync_stages-1 loop
|
||||
sync_sig(n) <= rst_val;
|
||||
end loop; -- n
|
||||
elsif(clk = '1' and clk'event) then
|
||||
for n in 0 to sync_stages-1 loop
|
||||
if(n = 0) then
|
||||
sync_sig(0) <= async_in;
|
||||
else
|
||||
sync_sig(n) <= sync_sig(n-1);
|
||||
end if;
|
||||
end loop; -- n
|
||||
end if;
|
||||
end process pSYNC;
|
||||
|
||||
sync_out <= sync_sig(sync_stages-1);
|
||||
|
||||
end RTL;
|
||||
|
||||
|
||||
|
||||
66
generic_ip/fire_pulse_manager/1/src/sync_wire_rEdge_1.vhd
Normal file
66
generic_ip/fire_pulse_manager/1/src/sync_wire_rEdge_1.vhd
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
-------------------------------------------------------------------------------
|
||||
-- Title : sync_wire_rEdge
|
||||
-------------------------------------------------------------------------------
|
||||
-- File : sync_wire_rEdge.vhd
|
||||
-- Author : Gianmarco Girau <ggianmarco.girau@gmail.com>
|
||||
-- Company : On my own
|
||||
-- Target : Generic (simulation), Generic (synthesis)
|
||||
-- Dependency : none
|
||||
-------------------------------------------------------------------------------
|
||||
-- Description: synchronize a std_logic signal to a clock domain with rising edge
|
||||
-------------------------------------------------------------------------------
|
||||
-- Last update: 2015-08-17
|
||||
-------------------------------------------------------------------------------
|
||||
-- Revisions :
|
||||
-- Date Version Author Description
|
||||
-- 2010-12-03 1.0 gmg Created
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
|
||||
entity sync_wire_rEdge_1 is
|
||||
generic(
|
||||
rst_val : std_logic := '0';
|
||||
sync_stages : positive := 2);
|
||||
port(
|
||||
rstN : in std_logic;
|
||||
clk : in std_logic;
|
||||
async_in : in std_logic;
|
||||
sync_out : out std_logic);
|
||||
end sync_wire_rEdge_1;
|
||||
|
||||
architecture RTL of sync_wire_rEdge_1 is
|
||||
|
||||
signal sync_out_i, sync_out_d : std_logic;
|
||||
signal sync_sig : std_logic_vector(sync_stages-1 downto 0);
|
||||
|
||||
begin
|
||||
|
||||
pSYNC : process(rstN, clk)
|
||||
begin
|
||||
if(rstN = '0') then
|
||||
sync_out_d <= rst_val;
|
||||
for n in 0 to sync_stages-1 loop
|
||||
sync_sig(n) <= rst_val;
|
||||
end loop; -- n
|
||||
elsif(clk = '1' and clk'event) then
|
||||
sync_out_d <= sync_out_i;
|
||||
for n in 0 to sync_stages-1 loop
|
||||
if(n = 0) then
|
||||
sync_sig(0) <= async_in;
|
||||
else
|
||||
sync_sig(n) <= sync_sig(n-1);
|
||||
end if;
|
||||
end loop; -- n
|
||||
end if;
|
||||
end process pSYNC;
|
||||
|
||||
sync_out_i <= sync_sig(sync_stages-1);
|
||||
-- rising edge detect
|
||||
sync_out <= sync_out_i and not sync_out_d;
|
||||
|
||||
end RTL;
|
||||
|
||||
|
||||
|
||||
201
generic_ip/fire_pulse_manager/1/src/test/fifo_16x8_1.vhd
Normal file
201
generic_ip/fire_pulse_manager/1/src/test/fifo_16x8_1.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_1 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_1;
|
||||
|
||||
|
||||
ARCHITECTURE SYN OF fifo_16x8_1 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,697 @@
|
|||
-------------------------------------------------------------------------------
|
||||
-- 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: 2018-08-10
|
||||
-- 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_1_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_1_tb is
|
||||
end fire_pulse_manager_1_tb;
|
||||
|
||||
architecture behav of fire_pulse_manager_1_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;
|
||||
|
||||
constant RX_CLK_PERIOD : time := 5.0 ns; -- 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_readdatavalid : 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 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_1
|
||||
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_readdatavalid => avs_readdatavalid(0),
|
||||
avs_readdata => avs_readdata(0)
|
||||
);
|
||||
|
||||
pof_rx <= transport tx_data after POF_DELAY;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- POF Tx
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
iPOF_TX : entity work.pof_tx_1
|
||||
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 => avs_readdatavalid(1),
|
||||
avs_readdata => avs_readdata(1)
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- 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 (pd_cnt(i) /= (NUM_ITERATIONS)*2) then
|
||||
detected_error <= true;
|
||||
end if;
|
||||
if (fp_cnt(i) /= (NUM_ITERATIONS)*2*100) then
|
||||
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);
|
||||
|
||||
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_8041";
|
||||
-- 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 <= avs_readdatavalid(0) when sel_slave_0 = '1' else
|
||||
avs_readdatavalid(1) when sel_slave_1 = '1' else '0';
|
||||
|
||||
avs_s.mm_waitrequest <= '0';
|
||||
avs_s.use_readvalid <= true;
|
||||
|
||||
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/1/src/test/pof_tx_1.vhd
Normal file
245
generic_ip/fire_pulse_manager/1/src/test/pof_tx_1.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: 2018-06-28
|
||||
-- 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_1 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_1;
|
||||
|
||||
architecture rtl of pof_tx_1 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_1
|
||||
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_1
|
||||
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;
|
||||
163
generic_ip/fire_pulse_manager/1/src/test/uart_tx_1.vhd
Normal file
163
generic_ip/fire_pulse_manager/1/src/test/uart_tx_1.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: 2017-10-19
|
||||
-- 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_1 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_1;
|
||||
|
||||
architecture rtl of uart_tx_1 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;
|
||||
169
generic_ip/fire_pulse_manager/1/src/uart_regen_1.vhd
Normal file
169
generic_ip/fire_pulse_manager/1/src/uart_regen_1.vhd
Normal file
|
|
@ -0,0 +1,169 @@
|
|||
-------------------------------------------------------------------------------
|
||||
-- Title : uart_regen
|
||||
-- Project : EMB-1
|
||||
-------------------------------------------------------------------------------
|
||||
-- File : uart_regen.vhd
|
||||
-- Author : Gianmarco Girau
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2017-10-31
|
||||
-- Last update: 2017-10-31
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'08
|
||||
-------------------------------------------------------------------------------
|
||||
-- Description:
|
||||
-- Regenerate the UART signal
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
entity uart_regen_1 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_1;
|
||||
|
||||
architecture rtl of uart_regen_1 is
|
||||
|
||||
component sync_wire_1
|
||||
generic (
|
||||
rst_val : std_logic;
|
||||
sync_stages : positive);
|
||||
port (
|
||||
rstN : in std_logic;
|
||||
clk : in std_logic;
|
||||
async_in : in std_logic;
|
||||
sync_out : out std_logic);
|
||||
end component;
|
||||
|
||||
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 : sync_wire_1
|
||||
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;
|
||||
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(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) = (unsigned(bit_div)-1) 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';
|
||||
ld_data <= '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(unsigned(clk_cnt) = (unsigned(bit_div(bit_div'high downto 1))-1)) then
|
||||
ld_data <= '1';
|
||||
end if;
|
||||
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;
|
||||
|
||||
when others => null;
|
||||
end case;
|
||||
end process pFSM_CL;
|
||||
|
||||
|
||||
end architecture rtl;
|
||||
188
generic_ip/fire_pulse_manager/1/src/uart_rx_1.vhd
Normal file
188
generic_ip/fire_pulse_manager/1/src/uart_rx_1.vhd
Normal file
|
|
@ -0,0 +1,188 @@
|
|||
-------------------------------------------------------------------------------
|
||||
-- Title : uart_rx
|
||||
-- Project : EMB-1
|
||||
-------------------------------------------------------------------------------
|
||||
-- File : uart_rx.vhd
|
||||
-- Author : Gianmarco Girau
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2016-10-24
|
||||
-- Last update: 2018-09-12
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'08
|
||||
-------------------------------------------------------------------------------
|
||||
-- Description:
|
||||
-- Simple UART receiver, used to receive 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_rx_1 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_1;
|
||||
|
||||
architecture rtl of uart_rx_1 is
|
||||
|
||||
component sync_wire_1
|
||||
generic (
|
||||
rst_val : std_logic;
|
||||
sync_stages : positive);
|
||||
port (
|
||||
rstN : in std_logic;
|
||||
clk : in std_logic;
|
||||
async_in : in std_logic;
|
||||
sync_out : out std_logic);
|
||||
end component;
|
||||
|
||||
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, shf_data, rst_bit_cnt, inc_bit_cnt : std_logic;
|
||||
signal rst_clk_cnt, end_of_bit, 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 clk_cnt : std_logic_vector(3 downto 0);
|
||||
signal bit_cnt : std_logic_vector(5 downto 0);
|
||||
|
||||
begin
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Input Synchronization
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
iSYNC_IN : sync_wire_1
|
||||
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
|
||||
clk_cnt <= (others => '0');
|
||||
else
|
||||
clk_cnt <= std_logic_vector(unsigned(clk_cnt)+1);
|
||||
end if;
|
||||
if(rst_clk_cnt = '1') then
|
||||
data <= (others => '0');
|
||||
elsif(shf_data = '1') then
|
||||
data <= rx_data_i & data(data'high downto 1);
|
||||
end if;
|
||||
data_out_valid <= data_valid;
|
||||
if(init = '1') then
|
||||
data_out <= (others => '0');
|
||||
elsif(data_valid = '1') then
|
||||
data_out <= data;
|
||||
end if;
|
||||
rx_error <= rx_error_i;
|
||||
end if;
|
||||
end process pREGs;
|
||||
|
||||
end_of_bit <= '1' when unsigned(clk_cnt) = (unsigned(bit_div)-1) else '0';
|
||||
end_of_rx <= '1' when unsigned(bit_cnt) = data_width else '0';
|
||||
|
||||
--shf_data <= '1' when unsigned(clk_cnt) = 1 and stop_bit = '0' else '0';
|
||||
shf_data <= '1' when unsigned(clk_cnt) = (unsigned(bit_div(bit_div'high downto 1))-1) and stop_bit = '0' 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(fsm_state_curr, rx_data_i, end_of_bit, end_of_rx)
|
||||
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;
|
||||
|
||||
when others => null;
|
||||
end case;
|
||||
end process pFSM_CL;
|
||||
|
||||
|
||||
end architecture rtl;
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
[{
|
||||
"ip_name" : "generic_sequencer_15",
|
||||
"ip_name" : "generic_sequencer",
|
||||
"bus" : "csr",
|
||||
"addr_width" : "4",
|
||||
"description" : "Generic Sequencer core",
|
||||
|
|
@ -37,13 +37,13 @@
|
|||
"minor_number" : {
|
||||
"type" : "c",
|
||||
"bit_len" : "8",
|
||||
"reset" : "0x0F",
|
||||
"reset" : "0x10",
|
||||
"description" : "Minor number"
|
||||
},
|
||||
"major_number" : {
|
||||
"type" : "c",
|
||||
"bit_len" : "8",
|
||||
"reset" : "0x00",
|
||||
"reset" : "0x0F",
|
||||
"description" : "Major number"
|
||||
|
||||
},
|
||||
|
|
@ -93,7 +93,7 @@
|
|||
},
|
||||
"ctrl" : {
|
||||
"address" : "3",
|
||||
"width" : "5",
|
||||
"width" : "11",
|
||||
"description" : "Control register",
|
||||
"fields": {
|
||||
"seq_enable" : {
|
||||
|
|
@ -102,13 +102,13 @@
|
|||
"reset" : "0",
|
||||
"description" : "Master enable for the sequencer"
|
||||
},
|
||||
"reserved" : {
|
||||
"reserved_0" : {
|
||||
"type" : "rsv",
|
||||
"bit_len" : "1",
|
||||
"description" : "Reserved bits"
|
||||
},
|
||||
"busy" : {
|
||||
"type" : "wp",
|
||||
"type" : "r",
|
||||
"bit_len" : "1",
|
||||
"reset" : "0",
|
||||
"description" : "Busy status (writing has no effect---in this register for backwards compatibility)"
|
||||
|
|
@ -124,6 +124,29 @@
|
|||
"bit_len" : "1",
|
||||
"reset" : "0",
|
||||
"description" : "Reset vector_out when start_req is asserted"
|
||||
},
|
||||
"reserved_1" : {
|
||||
"type" : "rsv",
|
||||
"bit_len" : "3",
|
||||
"description" : "Reserved bits"
|
||||
},
|
||||
"clr_seq_queue" : {
|
||||
"type" : "w0",
|
||||
"bit_len" : "1",
|
||||
"reset" : "0",
|
||||
"description" : "Clear the sequencer queue"
|
||||
},
|
||||
"clr_seq_queue_exe" : {
|
||||
"type" : "w0",
|
||||
"bit_len" : "1",
|
||||
"reset" : "0",
|
||||
"description" : "Clear the executed sequences counter"
|
||||
},
|
||||
"seq_queue_empty" : {
|
||||
"type" : "r",
|
||||
"bit_len" : "1",
|
||||
"reset" : "0",
|
||||
"description" : "asserted when End-and-Queue is executed with queue_left = 0. Cleared upon reading"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -176,7 +199,7 @@
|
|||
},
|
||||
"aux_config" : {
|
||||
"address" : "9",
|
||||
"width" : "5",
|
||||
"width" : "6",
|
||||
"description" : "Aux Configuration values for sequencer",
|
||||
"fields": {
|
||||
"ADD_VEC_PIPE" : {
|
||||
|
|
@ -208,8 +231,46 @@
|
|||
"bit_len" : "1",
|
||||
"reset" : "0",
|
||||
"description" : "Enable support for ALU instruction"
|
||||
},
|
||||
"QUEUE_EN" : {
|
||||
"type" : "r",
|
||||
"bit_len" : "1",
|
||||
"reset" : "0",
|
||||
"description" : "Enable support for End-and-Queue instruction"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pos_store" : {
|
||||
"address" : "10",
|
||||
"type" : "r",
|
||||
"width" : "24",
|
||||
"reset" : "0",
|
||||
"description" : "value of pos_store"
|
||||
},
|
||||
"seq_queue" : {
|
||||
"address" : "11",
|
||||
"width" : "32",
|
||||
"description" : "Sequence Execution Queue",
|
||||
"fields": {
|
||||
"queue_add" : {
|
||||
"type" : "w0",
|
||||
"bit_len" : "8",
|
||||
"reset" : "0",
|
||||
"description" : "Add Sequences to the queue (signed)"
|
||||
},
|
||||
"queue_left" : {
|
||||
"type" : "r",
|
||||
"bit_len" : "8",
|
||||
"reset" : "0",
|
||||
"description" : "Number of sequences currently in the queue"
|
||||
},
|
||||
"queue_exec" : {
|
||||
"type" : "r",
|
||||
"bit_len" : "16",
|
||||
"reset" : "0",
|
||||
"description" : "Number of sequences executed"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}]
|
||||
|
|
@ -2,7 +2,13 @@
|
|||
|
||||
.main clear
|
||||
|
||||
set GEN_IP_PATH ../../
|
||||
# Cleanup libraries
|
||||
foreach lib [list work OSVVM] {
|
||||
file delete -force -- $lib
|
||||
vlib $lib
|
||||
}
|
||||
|
||||
set GEN_IP_PATH ../../../
|
||||
set COMMON_PATH $GEN_IP_PATH/common/0
|
||||
set OSVVM_PATH $COMMON_PATH/src/test/OSVVM
|
||||
|
||||
|
|
@ -12,10 +18,10 @@ vlib ./work
|
|||
vmap work ./work
|
||||
|
||||
# Compile the UUT
|
||||
#vcom -2008 -work $WORKLIB $COMMON_PATH/src/pkg_functions.vhd
|
||||
vcom -2008 -work $WORKLIB $COMMON_PATH/src/common_pkg.vhd
|
||||
vcom -2008 -work $WORKLIB ../src/dpram_sclk.vhd
|
||||
vcom -2008 -work $WORKLIB ../src/generic_seq_core.vhd
|
||||
vcom -2008 -work $WORKLIB ../src/dpram_sclk_15.vhd
|
||||
vcom -2008 -work $WORKLIB ../src/generic_sequencer_15_pkg.vhd
|
||||
vcom -2008 -work $WORKLIB ../src/generic_sequencer_15.vhd
|
||||
|
||||
# Compile the constrained random related packages
|
||||
vlib OSVVM
|
||||
|
|
@ -33,13 +39,13 @@ vcom -2008 -work $WORKLIB $COMMON_PATH/src/test/log_pkg.vhd
|
|||
vcom -2008 -work $WORKLIB $COMMON_PATH/src/test/avalon_verify_pkg.vhd
|
||||
|
||||
# Compile the testbench
|
||||
vcom -2008 -work $WORKLIB ./../src/test/generic_seq_core_tb.vhd
|
||||
vcom -2008 -work $WORKLIB ./../src/test/generic_sequencer_15_tb.vhd
|
||||
|
||||
vsim -t ps work.generic_seq_core_tb
|
||||
vsim -t ps work.generic_sequencer_15_tb
|
||||
|
||||
|
||||
#add wave /generic_seq_core_tb/*
|
||||
#add wave /generic_seq_core_tb/iUUT/*
|
||||
#add wave /generic_sequencer_15_tb/*
|
||||
#add wave /generic_sequencer_15_tb/iUUT/*
|
||||
|
||||
# remove warnings from standard numeric/arithmetic packages (speed-up simulation)
|
||||
set StdArithNoWarnings 1
|
||||
|
|
|
|||
|
|
@ -1,124 +1,139 @@
|
|||
onerror {resume}
|
||||
quietly WaveActivateNextPane {} 0
|
||||
add wave -noupdate /generic_seq_core_tb/clk
|
||||
add wave -noupdate /generic_seq_core_tb/reset_n
|
||||
add wave -noupdate /generic_seq_core_tb/avs_csr_address
|
||||
add wave -noupdate /generic_seq_core_tb/avs_csr_write
|
||||
add wave -noupdate -radix hexadecimal /generic_seq_core_tb/avs_csr_writedata
|
||||
add wave -noupdate /generic_seq_core_tb/avs_csr_read
|
||||
add wave -noupdate -radix hexadecimal /generic_seq_core_tb/avs_csr_readdata
|
||||
add wave -noupdate /generic_seq_core_tb/avs_seq_address
|
||||
add wave -noupdate /generic_seq_core_tb/avs_seq_write
|
||||
add wave -noupdate -radix hexadecimal /generic_seq_core_tb/avs_seq_writedata
|
||||
add wave -noupdate /generic_seq_core_tb/avs_seq_read
|
||||
add wave -noupdate -radix hexadecimal /generic_seq_core_tb/avs_seq_readdata
|
||||
add wave -noupdate /generic_seq_core_tb/start_req
|
||||
add wave -noupdate -radix hexadecimal /generic_seq_core_tb/start_addr
|
||||
add wave -noupdate -radix hexadecimal /generic_seq_core_tb/trigger_in
|
||||
add wave -noupdate -radix hexadecimal /generic_seq_core_tb/pos_in
|
||||
add wave -noupdate /generic_seq_core_tb/busy
|
||||
add wave -noupdate -radix hexadecimal /generic_seq_core_tb/vector_out
|
||||
add wave -noupdate -radix hexadecimal /generic_seq_core_tb/bus_data
|
||||
add wave -noupdate /generic_seq_core_tb/bus_valid
|
||||
add wave -noupdate /generic_seq_core_tb/bus_ack
|
||||
add wave -noupdate /generic_seq_core_tb/setup
|
||||
add wave -noupdate /generic_seq_core_tb/running
|
||||
add wave -noupdate /generic_seq_core_tb/passed
|
||||
add wave -noupdate /generic_seq_core_tb/failed
|
||||
add wave -noupdate -radix hexadecimal /generic_seq_core_tb/csr_mm_s_rec
|
||||
add wave -noupdate -radix hexadecimal /generic_seq_core_tb/csr_mm_m_rec
|
||||
add wave -noupdate -radix hexadecimal /generic_seq_core_tb/seq_mm_s_rec
|
||||
add wave -noupdate -radix hexadecimal /generic_seq_core_tb/seq_mm_m_rec
|
||||
add wave -noupdate /generic_sequencer_15_tb/clk
|
||||
add wave -noupdate /generic_sequencer_15_tb/reset_n
|
||||
add wave -noupdate /generic_sequencer_15_tb/avs_csr_address
|
||||
add wave -noupdate /generic_sequencer_15_tb/avs_csr_write
|
||||
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/avs_csr_writedata
|
||||
add wave -noupdate /generic_sequencer_15_tb/avs_csr_read
|
||||
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/avs_csr_readdata
|
||||
add wave -noupdate /generic_sequencer_15_tb/avs_seq_address
|
||||
add wave -noupdate /generic_sequencer_15_tb/avs_seq_write
|
||||
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/avs_seq_writedata
|
||||
add wave -noupdate /generic_sequencer_15_tb/avs_seq_read
|
||||
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/avs_seq_readdata
|
||||
add wave -noupdate /generic_sequencer_15_tb/start_req
|
||||
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/start_addr
|
||||
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/trigger_in
|
||||
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/pos_in
|
||||
add wave -noupdate /generic_sequencer_15_tb/busy
|
||||
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/vector_out
|
||||
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/bus_data
|
||||
add wave -noupdate /generic_sequencer_15_tb/bus_valid
|
||||
add wave -noupdate /generic_sequencer_15_tb/bus_ack
|
||||
add wave -noupdate /generic_sequencer_15_tb/setup
|
||||
add wave -noupdate /generic_sequencer_15_tb/running
|
||||
add wave -noupdate /generic_sequencer_15_tb/passed
|
||||
add wave -noupdate /generic_sequencer_15_tb/failed
|
||||
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/csr_mm_s_rec
|
||||
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/csr_mm_m_rec
|
||||
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/seq_mm_s_rec
|
||||
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/seq_mm_m_rec
|
||||
add wave -noupdate -divider UUT
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/clk
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/reset_n
|
||||
add wave -noupdate -radix unsigned /generic_seq_core_tb/iUUT/avs_csr_address
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/avs_csr_write
|
||||
add wave -noupdate -radix hexadecimal /generic_seq_core_tb/iUUT/avs_csr_writedata
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/avs_csr_read
|
||||
add wave -noupdate -radix hexadecimal /generic_seq_core_tb/iUUT/avs_csr_readdata
|
||||
add wave -noupdate -radix decimal /generic_seq_core_tb/iUUT/avs_seq_address
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/avs_seq_write
|
||||
add wave -noupdate -radix hexadecimal /generic_seq_core_tb/iUUT/avs_seq_writedata
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/avs_seq_read
|
||||
add wave -noupdate -radix hexadecimal /generic_seq_core_tb/iUUT/avs_seq_readdata
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/start_req
|
||||
add wave -noupdate -radix hexadecimal /generic_seq_core_tb/iUUT/start_addr
|
||||
add wave -noupdate -radix hexadecimal /generic_seq_core_tb/iUUT/trigger_in
|
||||
add wave -noupdate -radix hexadecimal /generic_seq_core_tb/iUUT/pos_in
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/busy
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/opcode
|
||||
add wave -noupdate -radix hexadecimal /generic_seq_core_tb/iUUT/vector_out
|
||||
add wave -noupdate -radix hexadecimal /generic_seq_core_tb/iUUT/bus_data
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/bus_valid
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/bus_ack
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/seq_enable
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/debug_mode
|
||||
add wave -noupdate -radix hexadecimal /generic_seq_core_tb/iUUT/return_addr
|
||||
add wave -noupdate -radix hexadecimal /generic_seq_core_tb/iUUT/ram_rd_addr
|
||||
add wave -noupdate -radix hexadecimal /generic_seq_core_tb/iUUT/ram_rd_data
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/fsm
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/fsm_nxt
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/fetch_enable
|
||||
add wave -noupdate -radix hexadecimal /generic_seq_core_tb/iUUT/operand_1
|
||||
add wave -noupdate -radix hexadecimal /generic_seq_core_tb/iUUT/operand_2
|
||||
add wave -noupdate -radix hexadecimal /generic_seq_core_tb/iUUT/operand_comp
|
||||
add wave -noupdate -radix hexadecimal /generic_seq_core_tb/iUUT/subcode
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/inc_ram_addr
|
||||
add wave -noupdate -radix hexadecimal /generic_seq_core_tb/iUUT/jump_addr_ext
|
||||
add wave -noupdate -radix hexadecimal /generic_seq_core_tb/iUUT/jump_addr
|
||||
add wave -noupdate -radix hexadecimal /generic_seq_core_tb/iUUT/pc_value
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/ld_jmp_addr
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/jump_abs
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/jump_rel
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/alu_upd
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/jump_r1
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/loop_active
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/loop_upd
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/loop_done
|
||||
add wave -noupdate -radix unsigned /generic_seq_core_tb/iUUT/loop_cnt
|
||||
add wave -noupdate -radix hexadecimal /generic_seq_core_tb/iUUT/r1
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/flag
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/ld_trig_mask
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/ld_trig_sel
|
||||
add wave -noupdate -radix hexadecimal /generic_seq_core_tb/iUUT/trig_mask
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/trig_sel
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/trig_int
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/ld_vec
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/clr_vec_i
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/clr_vec
|
||||
add wave -noupdate -radix hexadecimal /generic_seq_core_tb/iUUT/vector_out_i
|
||||
add wave -noupdate -radix hexadecimal /generic_seq_core_tb/iUUT/vector_out
|
||||
add wave -noupdate -radix hexadecimal /generic_seq_core_tb/iUUT/ramp_val
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/ramp_up
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/fetch_op
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/clr_vec_ii
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/op_cnt
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/op_cnt_done
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/inc_op_cnt
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/bus_ack
|
||||
add wave -noupdate -radix hexadecimal /generic_seq_core_tb/iUUT/bus_data
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/bus_valid
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/bus_valid_i
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/bus_pause
|
||||
add wave -noupdate -radix hexadecimal /generic_seq_core_tb/iUUT/pos_store
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/loop_active
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/vector_val_cpu
|
||||
add wave -noupdate -radix hexadecimal /generic_seq_core_tb/iUUT/vector_cpu
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/step_req
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/rst_vector_out
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/pos_target
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/ld_ret_addr
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/save_ret_addr
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/r1_data
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/r1_data_valid
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/decode
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/busy_i
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/ld_start_addr
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/ld_pos
|
||||
add wave -noupdate /generic_seq_core_tb/iUUT/flag
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/clk
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/reset_n
|
||||
add wave -noupdate -radix unsigned /generic_sequencer_15_tb/iUUT/avs_csr_address
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/avs_csr_write
|
||||
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/iUUT/avs_csr_writedata
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/avs_csr_read
|
||||
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/iUUT/avs_csr_readdata
|
||||
add wave -noupdate -radix decimal /generic_sequencer_15_tb/iUUT/avs_seq_address
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/avs_seq_write
|
||||
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/iUUT/avs_seq_writedata
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/avs_seq_read
|
||||
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/iUUT/avs_seq_readdata
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/start_req
|
||||
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/iUUT/start_addr
|
||||
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/iUUT/trigger_in
|
||||
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/iUUT/pos_in
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/busy
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/opcode
|
||||
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/iUUT/vector_out
|
||||
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/iUUT/bus_data
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/bus_valid
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/bus_ack
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/seq_enable
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/debug_mode
|
||||
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/iUUT/return_addr
|
||||
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/iUUT/ram_rd_addr
|
||||
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/iUUT/ram_rd_data
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/fsm
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/fsm_nxt
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/fetch_enable
|
||||
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/iUUT/operand_1
|
||||
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/iUUT/operand_2
|
||||
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/iUUT/operand_comp
|
||||
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/iUUT/subcode
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/inc_ram_addr
|
||||
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/iUUT/jump_addr_ext
|
||||
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/iUUT/jump_addr
|
||||
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/iUUT/pc_value
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/ld_jmp_addr
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/jump_abs
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/jump_rel
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/clr_seq_queue
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/clr_seq_queue_i
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/clr_seq_queue_exe
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/queue_add_flag
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/queue_add_flag_d
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/queue_add_flag_i
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/queue_inc
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/queue_dec
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/seq_completed
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/seq_queue_empty
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/set_queue_empty
|
||||
add wave -noupdate -radix decimal /generic_sequencer_15_tb/iUUT/queue_add
|
||||
add wave -noupdate -radix decimal /generic_sequencer_15_tb/iUUT/queue_add_i
|
||||
add wave -noupdate -radix unsigned /generic_sequencer_15_tb/iUUT/queue_left
|
||||
add wave -noupdate -radix unsigned /generic_sequencer_15_tb/iUUT/queue_exec
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/alu_upd
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/jump_r1
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/loop_active
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/loop_upd
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/loop_done
|
||||
add wave -noupdate -radix unsigned /generic_sequencer_15_tb/iUUT/loop_cnt
|
||||
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/iUUT/r1
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/flag
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/ld_trig_mask
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/ld_trig_sel
|
||||
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/iUUT/trig_mask
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/trig_sel
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/trig_int
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/ld_vec
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/clr_vec_i
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/clr_vec
|
||||
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/iUUT/vector_out_i
|
||||
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/iUUT/vector_out
|
||||
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/iUUT/ramp_val
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/ramp_up
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/fetch_op
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/clr_vec_ii
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/op_cnt
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/op_cnt_done
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/inc_op_cnt
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/bus_ack
|
||||
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/iUUT/bus_data
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/bus_valid
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/bus_valid_i
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/bus_pause
|
||||
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/iUUT/pos_store
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/loop_active
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/vector_val_cpu
|
||||
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/iUUT/vector_cpu
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/step_req
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/rst_vector_out
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/pos_target
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/ld_ret_addr
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/save_ret_addr
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/r1_data
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/r1_data_valid
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/decode
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/busy_i
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/ld_start_addr
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/ld_pos
|
||||
add wave -noupdate /generic_sequencer_15_tb/iUUT/flag
|
||||
TreeUpdate [SetDefaultTree]
|
||||
WaveRestoreCursors {{Cursor 1} {25065000 ps} 0}
|
||||
WaveRestoreCursors {{Cursor 1} {27385000 ps} 0}
|
||||
quietly wave cursor active 1
|
||||
configure wave -namecolwidth 283
|
||||
configure wave -valuecolwidth 194
|
||||
|
|
@ -134,4 +149,4 @@ configure wave -griddelta 40
|
|||
configure wave -timeline 0
|
||||
configure wave -timelineunits ps
|
||||
update
|
||||
WaveRestoreZoom {19215784 ps} {26657064 ps}
|
||||
WaveRestoreZoom {0 ps} {29765120 ps}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
-------------------------------------------------------------------------------
|
||||
-- Title : generic_seq_core
|
||||
-- Title : generic_sequencer
|
||||
-- Project : Generic Components
|
||||
-------------------------------------------------------------------------------
|
||||
-- File : generic_seq_core.vhd
|
||||
-- File : generic_sequencer.vhd
|
||||
-- Author : Robbie Temple (original)
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2016-05-12
|
||||
-- Last update: 2018-08-06
|
||||
-- Last update: 2018-12-20
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'2008
|
||||
-------------------------------------------------------------------------------
|
||||
|
|
@ -20,8 +20,9 @@ use ieee.std_logic_1164.all;
|
|||
use ieee.numeric_std.all;
|
||||
|
||||
use work.common_pkg.all;
|
||||
use work.generic_sequencer_15_pkg.all;
|
||||
|
||||
entity generic_seq_core_15 is
|
||||
entity generic_sequencer_15 is
|
||||
generic(
|
||||
TRIGGER_WIDTH : natural range 1 to 16 := 16;
|
||||
VECTOR_WIDTH : natural range 1 to 24 := 12;
|
||||
|
|
@ -32,7 +33,8 @@ entity generic_seq_core_15 is
|
|||
VECT_RAMP_EN : boolean := false;
|
||||
BUS_BURST_EN : boolean := false;
|
||||
POS_BUS_EN : boolean := false;
|
||||
ALU_EN : boolean := false);
|
||||
ALU_EN : boolean := false;
|
||||
QUEUE_EN : boolean := false);
|
||||
port(
|
||||
--
|
||||
clk : in std_logic;
|
||||
|
|
@ -63,45 +65,16 @@ entity generic_seq_core_15 is
|
|||
bus_data : out std_logic_vector(BUS_WIDTH-1 downto 0);
|
||||
bus_valid : out std_logic;
|
||||
bus_ack : in std_logic);
|
||||
end entity generic_seq_core_15;
|
||||
end entity generic_sequencer_15;
|
||||
|
||||
architecture rtl of generic_seq_core_15 is
|
||||
architecture rtl of generic_sequencer_15 is
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Constant and types
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
constant CSR_IP_ID : std_logic_vector(31 downto 0) := x"0000FF01";
|
||||
constant CSR_IP_VER : std_logic_vector(31 downto 0) := x"0000000F";
|
||||
|
||||
constant CSR_IP_ID_ADDR : std_logic_vector(3 downto 0) := x"0";
|
||||
constant CSR_IP_VER_ADDR : std_logic_vector(3 downto 0) := x"1";
|
||||
constant CSR_CONFIG_ADDR : std_logic_vector(3 downto 0) := x"2";
|
||||
constant CSR_CTRL_ADDR : std_logic_vector(3 downto 0) := x"3";
|
||||
constant CSR_PC_ADDR : std_logic_vector(3 downto 0) := x"4";
|
||||
constant CSR_TRIGGER_ADDR : std_logic_vector(3 downto 0) := x"5";
|
||||
constant CSR_VECTOR_ADDR : std_logic_vector(3 downto 0) := x"6";
|
||||
constant CSR_R1_ADDR : std_logic_vector(3 downto 0) := x"7"; -- write only works when sequencer idle
|
||||
constant CSR_STEP_ADDR : std_logic_vector(3 downto 0) := x"8";
|
||||
constant CSR_AUX_CONFIG_ADDR : std_logic_vector(3 downto 0) := x"9";
|
||||
|
||||
constant CMD_NOP : std_logic_vector(3 downto 0) := x"0";
|
||||
constant CMD_TRIG_MASK : std_logic_vector(3 downto 0) := x"1";
|
||||
constant CMD_TRIG_WAIT : std_logic_vector(3 downto 0) := x"2";
|
||||
constant CMD_VEC_SET : std_logic_vector(3 downto 0) := x"3";
|
||||
constant CMD_VEC_RAMP_UP : std_logic_vector(3 downto 0) := x"4";
|
||||
constant CMD_VEC_RAMP_DN : std_logic_vector(3 downto 0) := x"5";
|
||||
constant CMD_BUS_BURST : std_logic_vector(3 downto 0) := x"6";
|
||||
constant CMD_POS_STORE : std_logic_vector(3 downto 0) := x"7";
|
||||
constant CMD_POS_WAIT : std_logic_vector(3 downto 0) := x"8";
|
||||
--
|
||||
constant CMD_ALU : std_logic_vector(3 downto 0) := x"A";
|
||||
--
|
||||
constant CMD_LOOP : std_logic_vector(3 downto 0) := x"B";
|
||||
constant CMD_JUMP : std_logic_vector(3 downto 0) := x"C";
|
||||
constant CMD_BRANCH : std_logic_vector(3 downto 0) := x"D";
|
||||
constant CMD_RETURN : std_logic_vector(3 downto 0) := x"E";
|
||||
constant CMD_END : std_logic_vector(3 downto 0) := x"F";
|
||||
constant CSR_IP_VER : std_logic_vector(31 downto 0) := x"00000F10";
|
||||
|
||||
type fsm_t is (s_idle, s_init, s_fetch, s_decode,
|
||||
--
|
||||
|
|
@ -179,6 +152,24 @@ architecture rtl of generic_seq_core_15 is
|
|||
|
||||
signal step_req : std_logic;
|
||||
signal fetch_enable : std_logic;
|
||||
|
||||
signal clr_seq_queue : std_logic;
|
||||
signal clr_seq_queue_i : std_logic;
|
||||
signal clr_seq_queue_exe : std_logic;
|
||||
signal queue_add_flag : std_logic;
|
||||
signal queue_add_flag_d : std_logic;
|
||||
signal queue_add_flag_i : std_logic;
|
||||
signal queue_inc : std_logic;
|
||||
signal queue_dec : std_logic;
|
||||
signal seq_completed : std_logic;
|
||||
signal seq_queue_empty : std_logic;
|
||||
signal set_queue_empty : std_logic;
|
||||
signal queue_add : std_logic_vector( 7 downto 0);
|
||||
signal queue_add_i : std_logic_vector( 7 downto 0);
|
||||
signal queue_left : std_logic_vector( 7 downto 0);
|
||||
signal queue_exec : std_logic_vector(15 downto 0);
|
||||
|
||||
|
||||
begin
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
|
|
@ -192,28 +183,43 @@ begin
|
|||
begin
|
||||
if reset_n = '0' then
|
||||
avs_csr_readdata <= (others => '0');
|
||||
seq_enable <= '0';
|
||||
rst_vector_out <= '0';
|
||||
debug_mode <= '0';
|
||||
vector_val_cpu <= '0';
|
||||
vector_cpu <= (others => '0');
|
||||
step_req <= '0';
|
||||
seq_enable <= '0';
|
||||
rst_vector_out <= '0';
|
||||
debug_mode <= '0';
|
||||
vector_val_cpu <= '0';
|
||||
vector_cpu <= (others => '0');
|
||||
step_req <= '0';
|
||||
clr_seq_queue <= '0';
|
||||
clr_seq_queue_exe <= '0';
|
||||
seq_queue_empty <= '0';
|
||||
elsif clk'event and clk = '1' then
|
||||
--
|
||||
avs_csr_readdata <= (others => '0');
|
||||
vector_val_cpu <= '0';
|
||||
step_req <= '0';
|
||||
vector_val_cpu <= '0';
|
||||
step_req <= '0';
|
||||
clr_seq_queue <= '0';
|
||||
clr_seq_queue_exe <= '0';
|
||||
queue_add_flag <= '0';
|
||||
|
||||
if(ALU_EN = true) then
|
||||
if(busy_i = '0') then
|
||||
r1_data_valid <= '0';
|
||||
end if;
|
||||
end if;
|
||||
|
||||
if(QUEUE_EN = true and set_queue_empty = '1') then
|
||||
seq_queue_empty <= '1';
|
||||
end if;
|
||||
|
||||
if avs_csr_write = '1' then
|
||||
case avs_csr_address is
|
||||
when CSR_CTRL_ADDR =>
|
||||
seq_enable <= avs_csr_writedata(0);
|
||||
rst_vector_out <= avs_csr_writedata(4);
|
||||
seq_enable <= avs_csr_writedata(0);
|
||||
rst_vector_out <= avs_csr_writedata(4);
|
||||
if(QUEUE_EN = true) then
|
||||
clr_seq_queue <= avs_csr_writedata(8);
|
||||
clr_seq_queue_exe <= avs_csr_writedata(9);
|
||||
end if;
|
||||
if fsm = s_idle then
|
||||
debug_mode <= avs_csr_writedata(3);
|
||||
end if;
|
||||
|
|
@ -229,6 +235,11 @@ begin
|
|||
r1_data <= avs_csr_writedata(R1_data'range);
|
||||
r1_data_valid <= '1';
|
||||
end if;
|
||||
when CSR_SEQ_QUEUE_ADDR =>
|
||||
if(QUEUE_EN = true) then
|
||||
queue_add_flag <= '1';
|
||||
queue_add <= avs_csr_writedata( 7 downto 0);
|
||||
end if;
|
||||
when others => null;
|
||||
end case;
|
||||
elsif avs_csr_read = '1' then
|
||||
|
|
@ -240,7 +251,8 @@ begin
|
|||
when CSR_CONFIG_ADDR =>
|
||||
avs_csr_readdata <= "00" & std_logic_vector(to_unsigned(TRIGGER_WIDTH, 6)) & std_logic_vector(to_unsigned(VECTOR_WIDTH, 6)) & std_logic_vector(to_unsigned(BUS_WIDTH, 6)) & std_logic_vector(to_unsigned(POS_WIDTH, 6)) & std_logic_vector(to_unsigned(log2(SEQ_DEPTH), 6));
|
||||
when CSR_CTRL_ADDR =>
|
||||
avs_csr_readdata <= 27x"0" & rst_vector_out & debug_mode & busy & '0' & seq_enable;
|
||||
avs_csr_readdata <= 21x"0" & seq_queue_empty & 5x"0" & rst_vector_out & debug_mode & busy & '0' & seq_enable;
|
||||
seq_queue_empty <= '0';
|
||||
when CSR_PC_ADDR =>
|
||||
avs_csr_readdata(log2(SEQ_DEPTH)-1+ 16 downto 16) <= return_addr;
|
||||
avs_csr_readdata(log2(SEQ_DEPTH)-1 downto 0) <= pc_value;
|
||||
|
|
@ -251,7 +263,13 @@ begin
|
|||
when CSR_R1_ADDR =>
|
||||
avs_csr_readdata(11 downto 0) <= r1;
|
||||
when CSR_AUX_CONFIG_ADDR =>
|
||||
avs_csr_readdata <= seq_cfg_aux;
|
||||
avs_csr_readdata <= seq_cfg_aux;
|
||||
when CSR_POS_STORE_ADDR =>
|
||||
avs_csr_readdata(POS_WIDTH - 1 downto 0) <= pos_store;
|
||||
when CSR_SEQ_QUEUE_ADDR =>
|
||||
if(QUEUE_EN = true) then
|
||||
avs_csr_readdata <= queue_exec & queue_left & x"00";
|
||||
end if;
|
||||
when others => null;
|
||||
end case;
|
||||
end if;
|
||||
|
|
@ -263,6 +281,7 @@ begin
|
|||
seq_cfg_aux(2) <= '1' when BUS_BURST_EN = true else '0';
|
||||
seq_cfg_aux(3) <= '1' when POS_BUS_EN = true else '0';
|
||||
seq_cfg_aux(4) <= '1' when ALU_EN = true else '0';
|
||||
seq_cfg_aux(5) <= '1' when QUEUE_EN = true else '0';
|
||||
|
||||
trig_int <= trigger_in(to_integer(unsigned(trig_sel))) and trig_mask(to_integer(unsigned(trig_sel)));
|
||||
|
||||
|
|
@ -309,16 +328,18 @@ begin
|
|||
-- Default assignments
|
||||
fsm_nxt <= fsm;
|
||||
--
|
||||
decode <= '0';
|
||||
clr_vec_i <= '0';
|
||||
ld_vec <= '0';
|
||||
busy_i <= '1';
|
||||
ld_start_addr <= '0';
|
||||
inc_ram_addr <= '0';
|
||||
fetch_op <= '0';
|
||||
ld_trig_mask <= '0';
|
||||
inc_op_cnt <= '0';
|
||||
loop_upd <= '0';
|
||||
decode <= '0';
|
||||
clr_vec_i <= '0';
|
||||
ld_vec <= '0';
|
||||
busy_i <= '1';
|
||||
ld_start_addr <= '0';
|
||||
inc_ram_addr <= '0';
|
||||
fetch_op <= '0';
|
||||
ld_trig_mask <= '0';
|
||||
inc_op_cnt <= '0';
|
||||
loop_upd <= '0';
|
||||
seq_completed <= '0';
|
||||
set_queue_empty <= '0';
|
||||
if(BUS_BURST_EN = true) then
|
||||
bus_valid_i <= '0';
|
||||
end if;
|
||||
|
|
@ -455,7 +476,19 @@ begin
|
|||
fsm_nxt <= s_fetch;
|
||||
|
||||
when s_end =>
|
||||
fsm_nxt <= s_idle;
|
||||
if(subcode = x"0") then
|
||||
fsm_nxt <= s_idle;
|
||||
elsif(QUEUE_EN = true and (subcode = x"1" or subcode = x"2")) then
|
||||
if(unsigned(queue_left) > 0) then
|
||||
seq_completed <= '1';
|
||||
fsm_nxt <= s_fetch;
|
||||
else
|
||||
set_queue_empty <= '1';
|
||||
fsm_nxt <= s_end;
|
||||
end if;
|
||||
else
|
||||
fsm_nxt <= s_idle;
|
||||
end if;
|
||||
|
||||
when others => null;
|
||||
end case;
|
||||
|
|
@ -553,12 +586,12 @@ begin
|
|||
|
||||
ld_jmp_addr <= '1' when decode = '1' and (jump_abs = '1' or jump_rel = '1' or jump_r1 = '1') else '0';
|
||||
|
||||
jump_abs <= '1' when opcode = CMD_JUMP and (subcode = X"0" or (subcode = X"1" and flag = '0') or (subcode = X"2" and flag = '1')) else '0';
|
||||
jump_rel <= '1' when (opcode = CMD_BRANCH and (subcode = X"0" or (subcode = X"1" and flag = '0') or (subcode = X"2" and flag = '1'))) or (opcode = CMD_LOOP and loop_done = '0') else '0';
|
||||
jump_abs <= '1' when (opcode = CMD_JUMP and (subcode = X"0" or (subcode = X"1" and flag = '0') or (subcode = X"2" and flag = '1'))) or (opcode = CMD_END and subcode = X"1") else '0';
|
||||
jump_rel <= '1' when (opcode = CMD_BRANCH and (subcode = X"0" or (subcode = X"1" and flag = '0') or (subcode = X"2" and flag = '1'))) or (opcode = CMD_LOOP and loop_done = '0') or (opcode = CMD_END and subcode = X"2") else '0';
|
||||
jump_r1 <= '1' when opcode = CMD_JUMP and subcode = X"F" else '0';
|
||||
|
||||
save_ret_addr <= ld_jmp_addr;
|
||||
ld_ret_addr <= '1' when decode = '1' and (opcode = CMD_RETURN) else '0';
|
||||
ld_ret_addr <= '1' when decode = '1' and (opcode = CMD_RETURN) else '0';
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Others - Generics dependent
|
||||
|
|
@ -706,4 +739,49 @@ begin
|
|||
|
||||
end generate gALU_NOGEN;
|
||||
|
||||
gQUEUE_GEN : if QUEUE_EN = true generate
|
||||
|
||||
pQUEUE_REGs : process(clk)
|
||||
Begin
|
||||
if(clk = '1' and clk'event) then
|
||||
queue_add_flag_d <= queue_add_flag and seq_completed;
|
||||
queue_inc <= queue_add_flag_i and (not queue_add(queue_add'left));
|
||||
queue_dec <= queue_add_flag_i and queue_add(queue_add'left);
|
||||
if(queue_add_flag = '1' and queue_add(queue_add'left) = '1') then
|
||||
queue_add_i <= std_logic_vector(unsigned(not(queue_add)) + 1);
|
||||
else
|
||||
queue_add_i <= queue_add;
|
||||
end if;
|
||||
if(seq_enable = '0' or clr_seq_queue_i = '1') then
|
||||
queue_left <= (others => '0');
|
||||
elsif(seq_completed = '1') then
|
||||
queue_left <= std_logic_vector(unsigned(queue_left)-1);
|
||||
elsif(queue_inc = '1') then
|
||||
queue_left <= std_logic_vector(unsigned(queue_left)+unsigned(queue_add_i));
|
||||
elsif(queue_dec = '1') then
|
||||
queue_left <= std_logic_vector(unsigned(queue_left)-unsigned(queue_add_i));
|
||||
end if;
|
||||
if(seq_enable = '0' or clr_seq_queue_exe = '1') then
|
||||
queue_exec <= (others => '0');
|
||||
elsif(seq_completed = '1') then
|
||||
queue_exec <= std_logic_vector(unsigned(queue_exec)+1);
|
||||
end if;
|
||||
end if;
|
||||
end process pQUEUE_REGs;
|
||||
|
||||
clr_seq_queue_i <= '1' when clr_seq_queue = '1' or (queue_dec = '1' and unsigned(queue_left) < unsigned(queue_add_i)) else '0';
|
||||
|
||||
-- if seq_completed is asserted together with queue_add_flag, delay
|
||||
-- queue_add_flag of 1 clock cycle
|
||||
queue_add_flag_i <= queue_add_flag or queue_add_flag_d;
|
||||
|
||||
end generate gQUEUE_GEN;
|
||||
|
||||
gQUEUE_NOGEN : if QUEUE_EN = false generate
|
||||
|
||||
queue_left <= (others => '0');
|
||||
queue_exec <= (others => '0');
|
||||
|
||||
end generate gQUEUE_NOGEN;
|
||||
|
||||
end rtl;
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
-------------------------------------------------------------------------------
|
||||
-- Title : generic_sequencer_15_pkg
|
||||
-- Project : Generic IPs
|
||||
-------------------------------------------------------------------------------
|
||||
-- File : generic_sequencer_15_pkg.vhd
|
||||
-- Author : GMG
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2018-01-17
|
||||
-- Last update: 2018-12-10
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'2008
|
||||
-------------------------------------------------------------------------------
|
||||
-- Description:
|
||||
-- Package defining common constants for generic_sequencer_15 core, such as
|
||||
-- Control & Status registers offset etc.
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
use work.common_pkg.all;
|
||||
|
||||
|
||||
package generic_sequencer_15_pkg is
|
||||
|
||||
constant CSR_IP_ID_ADDR : std_logic_vector(3 downto 0) := x"0";
|
||||
constant CSR_IP_VER_ADDR : std_logic_vector(3 downto 0) := x"1";
|
||||
constant CSR_CONFIG_ADDR : std_logic_vector(3 downto 0) := x"2";
|
||||
constant CSR_CTRL_ADDR : std_logic_vector(3 downto 0) := x"3";
|
||||
constant CSR_PC_ADDR : std_logic_vector(3 downto 0) := x"4";
|
||||
constant CSR_TRIGGER_ADDR : std_logic_vector(3 downto 0) := x"5";
|
||||
constant CSR_VECTOR_ADDR : std_logic_vector(3 downto 0) := x"6";
|
||||
constant CSR_R1_ADDR : std_logic_vector(3 downto 0) := x"7"; -- write only works when sequencer idle
|
||||
constant CSR_STEP_ADDR : std_logic_vector(3 downto 0) := x"8";
|
||||
constant CSR_AUX_CONFIG_ADDR : std_logic_vector(3 downto 0) := x"9";
|
||||
constant CSR_POS_STORE_ADDR : std_logic_vector(3 downto 0) := x"A";
|
||||
constant CSR_SEQ_QUEUE_ADDR : std_logic_vector(3 downto 0) := x"B";
|
||||
|
||||
constant CMD_NOP : std_logic_vector(3 downto 0) := x"0";
|
||||
constant CMD_TRIG_MASK : std_logic_vector(3 downto 0) := x"1";
|
||||
constant CMD_TRIG_WAIT : std_logic_vector(3 downto 0) := x"2";
|
||||
constant CMD_VEC_SET : std_logic_vector(3 downto 0) := x"3";
|
||||
constant CMD_VEC_RAMP_UP : std_logic_vector(3 downto 0) := x"4";
|
||||
constant CMD_VEC_RAMP_DN : std_logic_vector(3 downto 0) := x"5";
|
||||
constant CMD_BUS_BURST : std_logic_vector(3 downto 0) := x"6";
|
||||
constant CMD_POS_STORE : std_logic_vector(3 downto 0) := x"7";
|
||||
constant CMD_POS_WAIT : std_logic_vector(3 downto 0) := x"8";
|
||||
--
|
||||
constant CMD_ALU : std_logic_vector(3 downto 0) := x"A";
|
||||
--
|
||||
constant CMD_LOOP : std_logic_vector(3 downto 0) := x"B";
|
||||
constant CMD_JUMP : std_logic_vector(3 downto 0) := x"C";
|
||||
constant CMD_BRANCH : std_logic_vector(3 downto 0) := x"D";
|
||||
constant CMD_RETURN : std_logic_vector(3 downto 0) := x"E";
|
||||
constant CMD_END : std_logic_vector(3 downto 0) := x"F";
|
||||
|
||||
end package generic_sequencer_15_pkg;
|
||||
|
|
@ -3,15 +3,16 @@ use ieee.std_logic_1164.all;
|
|||
use ieee.numeric_std.all;
|
||||
|
||||
use work.common_pkg.all;
|
||||
use work.generic_sequencer_15_pkg.all;
|
||||
|
||||
use work.log_pkg.all;
|
||||
use work.avalon_verify_pkg.all;
|
||||
|
||||
entity generic_seq_core_tb is
|
||||
entity generic_sequencer_15_tb is
|
||||
-- ..
|
||||
end entity generic_seq_core_tb;
|
||||
end entity generic_sequencer_15_tb;
|
||||
|
||||
architecture behav of generic_seq_core_tb is
|
||||
architecture behav of generic_sequencer_15_tb is
|
||||
|
||||
constant TRIGGER_WIDTH : natural range 1 to 12 := 12;
|
||||
constant VECTOR_WIDTH : natural range 1 to 24 := 24;
|
||||
|
|
@ -23,20 +24,10 @@ architecture behav of generic_seq_core_tb is
|
|||
constant BUS_BURST_EN : boolean := true;
|
||||
constant POS_BUS_EN : boolean := true;
|
||||
constant ALU_EN : boolean := true;
|
||||
constant QUEUE_EN : boolean := true;
|
||||
|
||||
constant CSR_IP_ID : std_logic_vector(31 downto 0) := x"0000FF01";
|
||||
constant CSR_IP_VER : std_logic_vector(31 downto 0) := x"0000000F";
|
||||
|
||||
constant CSR_IP_ID_ADDR : std_logic_vector(3 downto 0) := x"0";
|
||||
constant CSR_IP_VER_ADDR : std_logic_vector(3 downto 0) := x"1";
|
||||
constant CSR_CONFIG_ADDR : std_logic_vector(3 downto 0) := x"2";
|
||||
constant CSR_CTRL_ADDR : std_logic_vector(3 downto 0) := x"3";
|
||||
constant CSR_PC_ADDR : std_logic_vector(3 downto 0) := x"4";
|
||||
constant CSR_TRIGGER_ADDR : std_logic_vector(3 downto 0) := x"5";
|
||||
constant CSR_VECTOR_ADDR : std_logic_vector(3 downto 0) := x"6";
|
||||
constant CSR_R1_ADDR : std_logic_vector(3 downto 0) := x"7"; -- write only works when sequencer idle
|
||||
constant CSR_STEP_ADDR : std_logic_vector(3 downto 0) := x"8";
|
||||
constant CSR_CONFIG2_ADDR : std_logic_vector(3 downto 0) := x"9";
|
||||
constant CSR_IP_VER : std_logic_vector(31 downto 0) := x"00000010";
|
||||
|
||||
constant CLK_PERIOD : time := 10 ns;
|
||||
|
||||
|
|
@ -91,6 +82,8 @@ architecture behav of generic_seq_core_tb is
|
|||
signal seq_mm_s_rec : mm_s_rec_t;
|
||||
signal seq_mm_m_rec : mm_m_rec_t;
|
||||
|
||||
signal update_cfg : boolean;
|
||||
|
||||
begin
|
||||
|
||||
clk <= not clk after 0.5*CLK_PERIOD;
|
||||
|
|
@ -103,7 +96,7 @@ begin
|
|||
-- UUT
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
iUUT : entity work.generic_seq_core_15
|
||||
iUUT : entity work.generic_sequencer_15
|
||||
generic map(
|
||||
TRIGGER_WIDTH => TRIGGER_WIDTH,
|
||||
VECTOR_WIDTH => VECTOR_WIDTH,
|
||||
|
|
@ -114,7 +107,8 @@ begin
|
|||
VECT_RAMP_EN => VECT_RAMP_EN,
|
||||
BUS_BURST_EN => BUS_BURST_EN,
|
||||
POS_BUS_EN => POS_BUS_EN,
|
||||
ALU_EN => ALU_EN)
|
||||
ALU_EN => ALU_EN,
|
||||
QUEUE_EN => QUEUE_EN)
|
||||
port map(
|
||||
--
|
||||
clk => clk,
|
||||
|
|
@ -344,6 +338,29 @@ begin
|
|||
mm_32b_write(x"00000121", x"1000000F", seq_mm_s_rec, seq_mm_m_rec); -- TRIG_MASK
|
||||
mm_32b_write(x"00000122", x"C0000122", seq_mm_s_rec, seq_mm_m_rec); -- JUMP
|
||||
mm_32b_write(x"00000123", x"00000000", seq_mm_s_rec, seq_mm_m_rec); -- NOP
|
||||
|
||||
-- END_AND_QUEUE instruction
|
||||
mm_32b_write(x"00000130", x"10000001", seq_mm_s_rec, seq_mm_m_rec); -- TRIG_MASK
|
||||
mm_32b_write(x"00000131", x"20000001", seq_mm_s_rec, seq_mm_m_rec); -- TRIG_WAIT
|
||||
mm_32b_write(x"00000132", x"30000A11", seq_mm_s_rec, seq_mm_m_rec); -- VEC_SET
|
||||
mm_32b_write(x"00000133", x"F2000001", seq_mm_s_rec, seq_mm_m_rec); -- END_AND_QUEUE (JUMP +1)
|
||||
mm_32b_write(x"00000134", x"20000001", seq_mm_s_rec, seq_mm_m_rec); -- TRIG_WAIT
|
||||
mm_32b_write(x"00000135", x"30000A22", seq_mm_s_rec, seq_mm_m_rec); -- VEC_SET
|
||||
mm_32b_write(x"00000136", x"F2000004", seq_mm_s_rec, seq_mm_m_rec); -- END_AND_QUEUE (JUMP +4)
|
||||
mm_32b_write(x"00000137", x"20000001", seq_mm_s_rec, seq_mm_m_rec); -- TRIG_WAIT
|
||||
mm_32b_write(x"00000138", x"30000A44", seq_mm_s_rec, seq_mm_m_rec); -- VEC_SET
|
||||
mm_32b_write(x"00000139", x"F2000004", seq_mm_s_rec, seq_mm_m_rec); -- END_AND_QUEUE (JUMP +4)
|
||||
mm_32b_write(x"0000013A", x"20000001", seq_mm_s_rec, seq_mm_m_rec); -- TRIG_WAIT
|
||||
mm_32b_write(x"0000013B", x"30000A33", seq_mm_s_rec, seq_mm_m_rec); -- VEC_SET
|
||||
mm_32b_write(x"0000013C", x"F2000FFB", seq_mm_s_rec, seq_mm_m_rec); -- END_AND_QUEUE (JUMP -5)
|
||||
mm_32b_write(x"0000013D", x"20000001", seq_mm_s_rec, seq_mm_m_rec); -- TRIG_WAIT
|
||||
mm_32b_write(x"0000013E", x"30000A55", seq_mm_s_rec, seq_mm_m_rec); -- VEC_SET
|
||||
mm_32b_write(x"0000013F", x"F1000140", seq_mm_s_rec, seq_mm_m_rec); -- END_AND_QUEUE-(JUMP to ox140)
|
||||
mm_32b_write(x"00000140", x"20000001", seq_mm_s_rec, seq_mm_m_rec); -- TRIG_WAIT
|
||||
mm_32b_write(x"00000141", x"30000B00", seq_mm_s_rec, seq_mm_m_rec); -- VEC_SET
|
||||
mm_32b_write(x"00000142", x"F1000131", seq_mm_s_rec, seq_mm_m_rec); -- END_AND_QUEUE-(JUMP to ox131)
|
||||
|
||||
--
|
||||
|
||||
end procedure send_seq_table;
|
||||
|
||||
|
|
@ -354,6 +371,9 @@ begin
|
|||
wait for 300 ns;
|
||||
send_seq_table;
|
||||
setup <= true;
|
||||
--
|
||||
wait until update_cfg = true;
|
||||
mm_32b_write(x"00000142", x"F0000000", seq_mm_s_rec, seq_mm_m_rec); -- END --
|
||||
wait;
|
||||
end process pCFG_SEQ;
|
||||
|
||||
|
|
@ -422,6 +442,8 @@ begin
|
|||
|
||||
mm_m_init(csr_mm_m_rec);
|
||||
--
|
||||
update_cfg <= false;
|
||||
--
|
||||
start_req <= '0';
|
||||
start_addr <= (others => '0');
|
||||
--
|
||||
|
|
@ -475,7 +497,7 @@ begin
|
|||
log("Bus width = " & to_string(to_integer(unsigned(data(17 downto 12)))), VMEDIUM);
|
||||
log("Position width = " & to_string(to_integer(unsigned(data(11 downto 6)))), VMEDIUM);
|
||||
log("Seq Depth [log2] = " & to_string(to_integer(unsigned(data( 5 downto 0)))), VMEDIUM);
|
||||
csr_read(CSR_CONFIG2_ADDR, data);
|
||||
csr_read(CSR_AUX_CONFIG_ADDR, data);
|
||||
log("Aux Config = " & to_string(data(4 downto 0)), VMEDIUM);
|
||||
--
|
||||
if(setup /= true) then
|
||||
|
|
@ -766,6 +788,14 @@ begin
|
|||
wait until busy = '0';
|
||||
end if;
|
||||
wait_clk_cycles(10);
|
||||
|
||||
-- check the value of pos_store
|
||||
csr_read(CSR_POS_STORE_ADDR, data);
|
||||
if(data(23 downto 0) /= std_logic_vector(to_unsigned(100, POS_WIDTH))) then
|
||||
log("ERROR: Read pos_stored = 0x" & to_hstring(data(23 downto 0)) & ", expected = 0x" & to_hstring(std_logic_vector(to_unsigned(100, POS_WIDTH))) & ".", VLOW);
|
||||
error_flag <= true;
|
||||
wait;
|
||||
end if;
|
||||
|
||||
log("Completed.", VLOW);
|
||||
|
||||
|
|
@ -1032,7 +1062,7 @@ begin
|
|||
|
||||
log_separator_line(VLOW);
|
||||
log("Verifying Quick Test ...", VLOW);
|
||||
|
||||
|
||||
-- Issue a start request
|
||||
trigger_in <= 12x"0";
|
||||
wait until clk = '1' and clk'event;
|
||||
|
|
@ -1052,6 +1082,145 @@ begin
|
|||
|
||||
wait_clk_cycles(10);
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
-- End-and-Queue Test
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
wait_clk_cycles(20);
|
||||
|
||||
log_separator_line(VLOW);
|
||||
log("Verifying End-and-Queue ...", VLOW);
|
||||
|
||||
-- Queue up 11 sequences (5 + 1 + 5)
|
||||
csr_write(CSR_SEQ_QUEUE_ADDR, 32x"B");
|
||||
-- Verify QUEUE_LEFT is equal to 11
|
||||
wait_clk_cycles(2);
|
||||
csr_read(CSR_SEQ_QUEUE_ADDR, data);
|
||||
if(unsigned(data(15 downto 8)) /= 11) then
|
||||
log("ERROR: detected " & to_string(to_integer(unsigned(data(15 downto 8)))) & " sequences in the queue, expecting 11.", VLOW);
|
||||
error_flag <= true;
|
||||
wait;
|
||||
end if;
|
||||
|
||||
-- Issue a start request
|
||||
trigger_in <= 12x"0";
|
||||
wait until clk = '1' and clk'event;
|
||||
start_addr <= std_logic_vector(to_unsigned(19*16, log2(SEQ_DEPTH)));
|
||||
start_req <= '1';
|
||||
wait until clk = '1' and clk'event;
|
||||
start_req <= '0';
|
||||
|
||||
wait_clk_cycles(5);
|
||||
trigger_in <= 12x"1";
|
||||
|
||||
wait_clk_cycles(1);
|
||||
check_vector(6, 24x"A11");
|
||||
check_vector(10, 24x"A22");
|
||||
check_vector(10, 24x"A33");
|
||||
check_vector(10, 24x"A44");
|
||||
check_vector(10, 24x"A55");
|
||||
check_vector(10, 24x"B00");
|
||||
|
||||
-- block the execution by de-asserting the trigger
|
||||
trigger_in <= 12x"0";
|
||||
-- check that seq_queue_empty is de-asserted
|
||||
csr_read(CSR_CTRL_ADDR, data);
|
||||
if(data(10) = '1') then
|
||||
log("ERROR: detected SEQ_QUEUE_EMPTY", VLOW);
|
||||
error_flag <= true;
|
||||
wait;
|
||||
end if;
|
||||
-- restart the execution
|
||||
trigger_in <= 12x"1";
|
||||
wait_clk_cycles(5);
|
||||
check_vector(10, 24x"A11");
|
||||
check_vector(10, 24x"A22");
|
||||
check_vector(10, 24x"A33");
|
||||
check_vector(10, 24x"A44");
|
||||
check_vector(10, 24x"A55");
|
||||
check_vector(10, 24x"B00");
|
||||
-- check that seq_queue_empty is now asserted
|
||||
wait_clk_cycles(10);
|
||||
csr_read(CSR_CTRL_ADDR, data);
|
||||
if(data(10) /= '1') then
|
||||
log("ERROR: SEQ_QUEUE_EMPTY is not asserted: CSR_CTRL = 0x" & to_hstring(data) & ".", VLOW);
|
||||
error_flag <= true;
|
||||
wait;
|
||||
end if;
|
||||
-- check the number of executed sequences
|
||||
csr_read(CSR_SEQ_QUEUE_ADDR, data);
|
||||
if(unsigned(data(31 downto 16)) /= 11) then
|
||||
log("ERROR: detected " & to_string(to_integer(unsigned(data(31 downto 16)))) & " executed sequences, expecting 11.", VLOW);
|
||||
error_flag <= true;
|
||||
wait;
|
||||
end if;
|
||||
|
||||
-- Add and remove, add again some sequences to the queue
|
||||
trigger_in <= 12x"0";
|
||||
-- Queue up 5 sequences
|
||||
csr_write(CSR_SEQ_QUEUE_ADDR, 32x"5");
|
||||
-- Verify QUEUE_LEFT is equal to 5
|
||||
wait_clk_cycles(2);
|
||||
csr_read(CSR_SEQ_QUEUE_ADDR, data);
|
||||
if(unsigned(data(15 downto 8)) /= 5) then
|
||||
log("ERROR: detected " & to_string(to_integer(unsigned(data(15 downto 8)))) & " sequences in the queue, expecting 5.", VLOW);
|
||||
error_flag <= true;
|
||||
wait;
|
||||
end if;
|
||||
-- remove 2 sequences from the queue
|
||||
csr_write(CSR_SEQ_QUEUE_ADDR, 24x"0" & X"FE");
|
||||
-- Verify QUEUE_LEFT is equal to 2
|
||||
wait_clk_cycles(2);
|
||||
csr_read(CSR_SEQ_QUEUE_ADDR, data);
|
||||
-- Note: only 2 sequences left in the queue because the first one starts the
|
||||
-- execution as soon as you add to the queue
|
||||
if(unsigned(data(15 downto 8)) /= 2) then
|
||||
log("ERROR: detected " & to_string(to_integer(unsigned(data(15 downto 8)))) & " sequences in the queue, expecting 2.", VLOW);
|
||||
error_flag <= true;
|
||||
wait;
|
||||
end if;
|
||||
|
||||
-- try to remove 4 sequences from the queue, and see that the queue goes to
|
||||
-- zero
|
||||
csr_write(CSR_SEQ_QUEUE_ADDR, 24x"0" & X"FC");
|
||||
-- Verify QUEUE_LEFT is equal to 0
|
||||
wait_clk_cycles(2);
|
||||
csr_read(CSR_SEQ_QUEUE_ADDR, data);
|
||||
-- Note: only 2 sequences left in the queue because the first one starts the
|
||||
-- execution as soon as you add to the queue
|
||||
if(unsigned(data(15 downto 8)) /= 0) then
|
||||
log("ERROR: detected " & to_string(to_integer(unsigned(data(15 downto 8)))) & " sequences in the queue, expecting 0.", VLOW);
|
||||
error_flag <= true;
|
||||
wait;
|
||||
end if;
|
||||
|
||||
-- update the sequencer RAM: change the last End-and-Queue instruction with
|
||||
-- a normal End instruction : this is done by process pCFG_SEQ when
|
||||
-- update_cfg is asserted
|
||||
update_cfg <= true;
|
||||
-- Queue up 5 sequences
|
||||
csr_write(CSR_SEQ_QUEUE_ADDR, 32x"5");
|
||||
-- restart the execution
|
||||
trigger_in <= 12x"1";
|
||||
wait_clk_cycles(5);
|
||||
check_vector(10, 24x"A11");
|
||||
check_vector(10, 24x"A22");
|
||||
check_vector(10, 24x"A33");
|
||||
check_vector(10, 24x"A44");
|
||||
check_vector(10, 24x"A55");
|
||||
check_vector(10, 24x"B00");
|
||||
|
||||
wait_clk_cycles(5);
|
||||
if(busy /= '0') then
|
||||
log("ERROR: busy flag is still asserted.", VLOW);
|
||||
error_flag <= true;
|
||||
wait;
|
||||
end if;
|
||||
|
||||
log("Completed.", VLOW);
|
||||
|
||||
wait_clk_cycles(10);
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
-- End
|
||||
---------------------------------------------------------------------------
|
||||
|
|
@ -1,16 +1,18 @@
|
|||
[{
|
||||
"ip_name": "pulse_gen_1",
|
||||
"ip_name": "pulse_generator_1",
|
||||
"bus": "csr",
|
||||
"description": "Generate Fire-Requests, based on the absolute position and PD inputs",
|
||||
"description": "Generate Fire-Requests, based on the absolute position and PD inputs",
|
||||
"addr_hi_bit" : "9",
|
||||
"addr_lo_bit" : "5",
|
||||
"sub_blocks": {
|
||||
"local": {
|
||||
"instance": "",
|
||||
"process": "cpp, htm",
|
||||
"process": "cpp, txt",
|
||||
"offset": "0x0"
|
||||
},
|
||||
"generic_sequencer_15": {
|
||||
"instance": "channel",
|
||||
"process": "cpp, htm",
|
||||
"process": "cpp, txt",
|
||||
"offset": "0x20"
|
||||
}
|
||||
},
|
||||
|
|
@ -54,7 +56,7 @@
|
|||
"major_number" : {
|
||||
"type" : "c",
|
||||
"bit_len" : "8",
|
||||
"reset" : "0x00",
|
||||
"reset" : "0x01",
|
||||
"description" : "Major number"
|
||||
|
||||
},
|
||||
|
|
@ -82,7 +84,7 @@
|
|||
"reset": "0x0",
|
||||
"description": "By-Pass Ch-Ctrl (=> Fractional Divider only)"
|
||||
},
|
||||
"reserved-0": {
|
||||
"reserved_0": {
|
||||
"type": "rsv",
|
||||
"bit_len": "1",
|
||||
"description": ""
|
||||
|
|
@ -111,7 +113,7 @@
|
|||
"reset": "0x0",
|
||||
"description": "Delay Equalizer Overflow Error"
|
||||
},
|
||||
"reserved-1": {
|
||||
"reserved_1": {
|
||||
"type": "rsv",
|
||||
"bit_len": "1",
|
||||
"description": ""
|
||||
|
|
@ -134,7 +136,7 @@
|
|||
"reset": "0x0",
|
||||
"description": "Dual-Phase Direction status"
|
||||
},
|
||||
"reserved-2": {
|
||||
"reserved_2": {
|
||||
"type": "rsv",
|
||||
"bit_len": "5",
|
||||
"description": ""
|
||||
|
|
@ -157,7 +159,7 @@
|
|||
"reset": "0x0",
|
||||
"description": "Reset the local PD and Fire-Request counters"
|
||||
},
|
||||
"reserved-3" : {
|
||||
"reserved_3" : {
|
||||
"type": "rsv",
|
||||
"bit_len": "13",
|
||||
"description": ""
|
||||
|
|
@ -217,7 +219,7 @@
|
|||
},
|
||||
"fractional_divider_control": {
|
||||
"address": "7",
|
||||
"width": "8",
|
||||
"width": "3",
|
||||
"description": "Fractional Divider Control Register",
|
||||
"fields": {
|
||||
"enable": {
|
||||
|
|
@ -234,7 +236,7 @@
|
|||
},
|
||||
"udp_min_pos": {
|
||||
"type": "r",
|
||||
"bit_len": "6",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "Clear the encoder jitter for DIR-1"
|
||||
}
|
||||
|
|
@ -292,7 +294,7 @@
|
|||
"type": "w",
|
||||
"address": "10",
|
||||
"reset": "0x00",
|
||||
"width": "32",
|
||||
"width": "16",
|
||||
"description": "Overdrive event counter"
|
||||
},
|
||||
"divider_ratio_int": {
|
||||
|
|
@ -313,7 +315,7 @@
|
|||
"type": "w",
|
||||
"address": "13",
|
||||
"reset": "0x00",
|
||||
"width": "32",
|
||||
"width": "10",
|
||||
"description": "Integer part of the Sub-pixel Offset"
|
||||
},
|
||||
"subpixel_offset_fraction": {
|
||||
|
|
|
|||
79
generic_ip/pulse_generator/1/sim/sim_pd_jitter.do
Normal file
79
generic_ip/pulse_generator/1/sim/sim_pd_jitter.do
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
# Simulation macro Net-Sync testbench
|
||||
|
||||
.main clear
|
||||
|
||||
# Cleanup libraries
|
||||
foreach lib [list work OSVVM] {
|
||||
file delete -force -- $lib
|
||||
vlib $lib
|
||||
}
|
||||
|
||||
set COMP_ONLY 0
|
||||
|
||||
set TB_PATH ./../src/test
|
||||
set SRC_PATH ../src
|
||||
set COMMON_PATH ../../../common/0/src
|
||||
set SEQUENCER_PATH ../../../generic_sequencer/15
|
||||
set OSVVM_PATH ../../../common/0/src/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 work $COMMON_PATH/common_pkg.vhd
|
||||
vcom -2008 -work $WORKLIB $SRC_PATH/altera/sync_fifo_1.vhd
|
||||
vcom -2008 -work $WORKLIB $SRC_PATH/queue_and_delay_1.vhd
|
||||
vcom -2008 -work $WORKLIB $SRC_PATH/pulse_conditioning_1.vhd
|
||||
vcom -2008 -work $WORKLIB $SEQUENCER_PATH/src/dpram_sclk_15.vhd
|
||||
vcom -2008 -work $WORKLIB $SEQUENCER_PATH/src/generic_sequencer_15_pkg.vhd
|
||||
vcom -2008 -work $WORKLIB $SEQUENCER_PATH/src/generic_sequencer_15.vhd
|
||||
vcom -2008 -work $WORKLIB $SRC_PATH/simple_frac_div_1.vhd
|
||||
vcom -2008 -work $WORKLIB $SRC_PATH/pulse_generator_1_pkg.vhd
|
||||
vcom -2008 -work $WORKLIB $SRC_PATH/pulse_generator_1.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
|
||||
vcom -2008 -work $WORKLIB $TB_PATH/pd_jitter_verify_tb.vhd
|
||||
|
||||
vsim -t ps work.pd_jitter_verify_tb
|
||||
|
||||
|
||||
#add wave /pd_jitter_verify_tb/*
|
||||
#add wave /pd_jitter_verify_tb/iUUT/*
|
||||
|
||||
# remove warnings from standard numeric/arithmetic packages (speed-up simulation)
|
||||
set StdArithNoWarnings 1
|
||||
set NumericStdNoWarnings 1
|
||||
|
||||
do wave_pd_jitter.do
|
||||
|
||||
when -label end_of_simulation {test_completed == true} {echo "Simulation Completed"; stop ;}
|
||||
run -all
|
||||
|
||||
#run 1 ms;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
67
generic_ip/pulse_generator/1/sim/sim_simple_frac_div.do
Normal file
67
generic_ip/pulse_generator/1/sim/sim_simple_frac_div.do
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
# Simulation macro
|
||||
|
||||
.main clear
|
||||
|
||||
# Cleanup libraries
|
||||
foreach lib [list work OSVVM] {
|
||||
file delete -force -- $lib
|
||||
vlib $lib
|
||||
}
|
||||
|
||||
set COMP_ONLY 0
|
||||
|
||||
set TB_PATH ./../src/test
|
||||
set OSVVM_PATH ../../../common/0/src/test/OSVVM
|
||||
set COMMON_PATH ../../../common/0/src
|
||||
|
||||
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 ../src/simple_frac_div_1.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
|
||||
|
||||
# Testbench
|
||||
vcom -2008 -work $WORKLIB $TB_PATH/simple_frac_div_tb.vhd
|
||||
|
||||
vsim -t ps work.simple_frac_div_tb
|
||||
|
||||
|
||||
#add wave /simple_frac_div_tb/*
|
||||
#add wave /simple_frac_div_tb/iUUT/*
|
||||
|
||||
# remove warnings from standard numeric/arithmetic packages (speed-up simulation)
|
||||
set StdArithNoWarnings 1
|
||||
set NumericStdNoWarnings 1
|
||||
|
||||
do wave_simple_frac_div.do
|
||||
|
||||
when -label end_of_simulation {test_completed == true} {echo "Simulation Completed"; stop ;}
|
||||
run -all
|
||||
|
||||
#run 1 ms;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
179
generic_ip/pulse_generator/1/sim/wave_pd_jitter.do
Normal file
179
generic_ip/pulse_generator/1/sim/wave_pd_jitter.do
Normal file
|
|
@ -0,0 +1,179 @@
|
|||
onerror {resume}
|
||||
quietly WaveActivateNextPane {} 0
|
||||
add wave -noupdate /pd_jitter_verify_tb/reset_n
|
||||
add wave -noupdate /pd_jitter_verify_tb/clk
|
||||
add wave -noupdate /pd_jitter_verify_tb/init
|
||||
add wave -noupdate /pd_jitter_verify_tb/enc_in
|
||||
add wave -noupdate /pd_jitter_verify_tb/pd_in
|
||||
add wave -noupdate -radix decimal /pd_jitter_verify_tb/abs_position
|
||||
add wave -noupdate /pd_jitter_verify_tb/dp_dir
|
||||
add wave -noupdate /pd_jitter_verify_tb/pulse_out
|
||||
add wave -noupdate /pd_jitter_verify_tb/filtered_pd
|
||||
add wave -noupdate /pd_jitter_verify_tb/ch_pd
|
||||
add wave -noupdate /pd_jitter_verify_tb/pd_in_cnt
|
||||
add wave -noupdate /pd_jitter_verify_tb/pd_out_cnt
|
||||
add wave -noupdate /pd_jitter_verify_tb/ch_mask
|
||||
add wave -noupdate /pd_jitter_verify_tb/raw_pulse_out
|
||||
add wave -noupdate -radix hexadecimal /pd_jitter_verify_tb/avs_address
|
||||
add wave -noupdate /pd_jitter_verify_tb/avs_write
|
||||
add wave -noupdate -radix hexadecimal /pd_jitter_verify_tb/avs_writedata
|
||||
add wave -noupdate /pd_jitter_verify_tb/avs_read
|
||||
add wave -noupdate /pd_jitter_verify_tb/avs_readdatavalid
|
||||
add wave -noupdate -radix hexadecimal /pd_jitter_verify_tb/avs_readdata
|
||||
add wave -noupdate /pd_jitter_verify_tb/avs_m
|
||||
add wave -noupdate /pd_jitter_verify_tb/avs_s
|
||||
add wave -noupdate /pd_jitter_verify_tb/test_completed
|
||||
add wave -noupdate /pd_jitter_verify_tb/setup
|
||||
add wave -noupdate /pd_jitter_verify_tb/running
|
||||
add wave -noupdate /pd_jitter_verify_tb/error_flag
|
||||
add wave -noupdate /pd_jitter_verify_tb/passed
|
||||
add wave -noupdate /pd_jitter_verify_tb/failed
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/clk
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/reset_n
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/init
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/enc_in
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/pd_in
|
||||
add wave -noupdate -radix decimal /pd_jitter_verify_tb/iUUT/abs_position
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/dp_dir
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/pulse_out
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/gen_filt_pd
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/filtered_pd
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/pd_pulse
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/first_pd
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/filt_pd
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_pd
|
||||
add wave -noupdate -radix decimal /pd_jitter_verify_tb/iUUT/last_pd_pos
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/close_to_zero
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/close_to_mid
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/mid_cross
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/mid_crossed
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/zero_cross
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/abs_pos_msb_old
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_mask
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/raw_pulse_out
|
||||
add wave -noupdate -radix hexadecimal /pd_jitter_verify_tb/iUUT/avs_address
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/avs_write
|
||||
add wave -noupdate -radix hexadecimal /pd_jitter_verify_tb/iUUT/avs_writedata
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/avs_read
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/avs_readdatavalid
|
||||
add wave -noupdate -radix hexadecimal /pd_jitter_verify_tb/iUUT/avs_readdata
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/init_de
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/init_qd
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/enable
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/loc_pd
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/pd_queue_error
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_ctrl_start_req
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/filt_pd_d
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_ctrl_write
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_ctrl_read
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_ctrl_busy
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/enable_i
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_mask_i
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/bypass_ch_ctrl
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/bypass_delay_equal
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/div_pulse
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/gated_pulse
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/retimed_pulse
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/pulse_out_i
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/avs_write_i
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/avs_read_d
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/avs_read_i
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/de_queue_error
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/cnt_dir
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/dp_dir_i
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_mask_d
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_ctrl_start_req_i
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/bypass_pulse_div
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/set_first_pd
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/loc_pulse_out_d
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/loc_pulse
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/first_pulse
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/dp_dir_d
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/overdrive_rst
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/overdrv_event
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/pulse_scale_out
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/start_img_req
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/start_img_req_d
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/start_img
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/start_img_d
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/start_img_dd
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/fire_enable
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/img_completed
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/sw_ctrl_dp_dir
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/enable_out
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_ctrl_start_req_d
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/add_img_size
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/add_img_size_d
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/abort_fire
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_ctrl_csr_write
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_ctrl_csr_read
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/frac_div_en_i
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/upd_max_pos
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/upd_min_pos
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/frac_div_en
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/upd_max_pos_i
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/upd_min_pos_i
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/dir_change
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/pd_in_d
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/filt_pd_i
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/abs_pos_lsb
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_ctrl_start_req_ii
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/prevent_div_restart
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/rst_jitter
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_ctrl_csr_addr
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_ctrl_trigger_in
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/avs_addr
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/pulse_width
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/pulse_width_ext
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/init_v
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_ctrl_start_addr
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_ctrl_address
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/avs_address_i
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/overdrive_events
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/overdrive_thres
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/pulse_interval
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/img_size
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/pixel_cnt
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_ctrl_vector_out
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_offset
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_delay
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/avs_readdata_i
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_ctrl_writedata
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_ctrl_readdata
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_ctrl_csr_writedata
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_ctrl_csr_readdata
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_offset_dir0
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_offset_dir1
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/abs_pos_max
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/abs_pos_min
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/div_offset
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/div_ratio
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/rst_dbg_cnt
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/div_pulse_d
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/div_pulse_p
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/retimed_pulse_d
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/retimed_pulse_p
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/pulse_out_ii
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/pulse_out_d
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/pulse_out_p
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/div_pulse_cnt
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/retimed_pulse_cnt
|
||||
add wave -noupdate /pd_jitter_verify_tb/iUUT/pulse_out_cnt
|
||||
TreeUpdate [SetDefaultTree]
|
||||
WaveRestoreCursors {{Cursor 1} {35005000 ps} 0}
|
||||
quietly wave cursor active 1
|
||||
configure wave -namecolwidth 281
|
||||
configure wave -valuecolwidth 146
|
||||
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 {21553836 ps} {37018220 ps}
|
||||
76
generic_ip/pulse_generator/1/sim/wave_simple_frac_div.do
Normal file
76
generic_ip/pulse_generator/1/sim/wave_simple_frac_div.do
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
onerror {resume}
|
||||
quietly WaveActivateNextPane {} 0
|
||||
add wave -noupdate /simple_frac_div_tb/reset_n
|
||||
add wave -noupdate /simple_frac_div_tb/clk
|
||||
add wave -noupdate /simple_frac_div_tb/enable
|
||||
add wave -noupdate /simple_frac_div_tb/dir
|
||||
add wave -noupdate -radix hexadecimal /simple_frac_div_tb/offset
|
||||
add wave -noupdate -radix hexadecimal /simple_frac_div_tb/ratio
|
||||
add wave -noupdate -radix decimal /simple_frac_div_tb/abs_pos
|
||||
add wave -noupdate /simple_frac_div_tb/fire
|
||||
add wave -noupdate -radix unsigned /simple_frac_div_tb/fire_cnt
|
||||
add wave -noupdate /simple_frac_div_tb/div_ratio
|
||||
add wave -noupdate /simple_frac_div_tb/pixel_offset
|
||||
add wave -noupdate /simple_frac_div_tb/pos
|
||||
add wave -noupdate /simple_frac_div_tb/test_completed
|
||||
add wave -noupdate /simple_frac_div_tb/configuring
|
||||
add wave -noupdate /simple_frac_div_tb/running
|
||||
add wave -noupdate /simple_frac_div_tb/passed
|
||||
add wave -noupdate /simple_frac_div_tb/failed
|
||||
add wave -noupdate /simple_frac_div_tb/pTB_CTRL/delta_pos
|
||||
add wave -noupdate /simple_frac_div_tb/pTB_CTRL/init_pos
|
||||
add wave -noupdate /simple_frac_div_tb/pTB_CTRL/dir_m
|
||||
add wave -noupdate /simple_frac_div_tb/pTB_CTRL/tot_steps
|
||||
add wave -noupdate /simple_frac_div_tb/pTB_CTRL/result
|
||||
add wave -noupdate /simple_frac_div_tb/pTB_CTRL/test_idx
|
||||
add wave -noupdate /simple_frac_div_tb/iUUT/clk
|
||||
add wave -noupdate /simple_frac_div_tb/iUUT/enable
|
||||
add wave -noupdate /simple_frac_div_tb/iUUT/upd_max_pos
|
||||
add wave -noupdate /simple_frac_div_tb/iUUT/upd_min_pos
|
||||
add wave -noupdate -radix decimal /simple_frac_div_tb/iUUT/abs_pos_max
|
||||
add wave -noupdate -radix decimal /simple_frac_div_tb/iUUT/abs_pos_min
|
||||
add wave -noupdate /simple_frac_div_tb/iUUT/dir
|
||||
add wave -noupdate -radix hexadecimal /simple_frac_div_tb/iUUT/offset
|
||||
add wave -noupdate -radix hexadecimal /simple_frac_div_tb/iUUT/ratio
|
||||
add wave -noupdate -radix decimal /simple_frac_div_tb/iUUT/abs_pos
|
||||
add wave -noupdate /simple_frac_div_tb/iUUT/fire
|
||||
add wave -noupdate -radix unsigned /simple_frac_div_tb/iUUT/fire_cnt
|
||||
add wave -noupdate /simple_frac_div_tb/iUUT/enable_d
|
||||
add wave -noupdate /simple_frac_div_tb/iUUT/start
|
||||
add wave -noupdate /simple_frac_div_tb/iUUT/inc_pos
|
||||
add wave -noupdate /simple_frac_div_tb/iUUT/dec_pos
|
||||
add wave -noupdate /simple_frac_div_tb/iUUT/new_max
|
||||
add wave -noupdate /simple_frac_div_tb/iUUT/new_min
|
||||
add wave -noupdate /simple_frac_div_tb/iUUT/delta_wrap
|
||||
add wave -noupdate -radix decimal /simple_frac_div_tb/iUUT/pos_diff
|
||||
add wave -noupdate -radix decimal /simple_frac_div_tb/iUUT/pos_max
|
||||
add wave -noupdate -radix decimal /simple_frac_div_tb/iUUT/pos_min
|
||||
add wave -noupdate -radix decimal /simple_frac_div_tb/iUUT/dist_pos
|
||||
add wave -noupdate -radix decimal /simple_frac_div_tb/iUUT/dist_neg
|
||||
add wave -noupdate /simple_frac_div_tb/iUUT/update
|
||||
add wave -noupdate -radix unsigned /simple_frac_div_tb/iUUT/fire_cnt_i
|
||||
add wave -noupdate /simple_frac_div_tb/iUUT/zeros
|
||||
add wave -noupdate -radix unsigned /simple_frac_div_tb/iUUT/delta_pos
|
||||
add wave -noupdate -radix decimal /simple_frac_div_tb/iUUT/pos_diff
|
||||
add wave -noupdate -radix unsigned /simple_frac_div_tb/iUUT/abs_pos_d
|
||||
add wave -noupdate -radix unsigned /simple_frac_div_tb/iUUT/delta_pos_ext
|
||||
add wave -noupdate -radix decimal /simple_frac_div_tb/iUUT/ideal_fire
|
||||
add wave -noupdate -radix decimal /simple_frac_div_tb/iUUT/firing_error
|
||||
TreeUpdate [SetDefaultTree]
|
||||
WaveRestoreCursors {{Cursor 1} {212441 ps} 0}
|
||||
quietly wave cursor active 1
|
||||
configure wave -namecolwidth 266
|
||||
configure wave -valuecolwidth 182
|
||||
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 {333726927 ps} {334251215 ps}
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
-- Author : Gianmarco Girau
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2016-10-24
|
||||
-- Last update: 2018-08-23
|
||||
-- Last update: 2018-12-20
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'93
|
||||
-------------------------------------------------------------------------------
|
||||
|
|
@ -31,8 +31,9 @@ use work.pulse_generator_1_pkg.all;
|
|||
|
||||
entity pulse_generator_1 is
|
||||
generic(
|
||||
pulse_delay_equal_en : boolean := true;
|
||||
out_pulse_condition : boolean := true);
|
||||
PD_QUEUE_SIZE : natural range 32 to 1024 := 64;
|
||||
PULSE_DELAY_EQUAL_EN : boolean := true;
|
||||
OUT_PULSE_CONDITION : boolean := true);
|
||||
port(
|
||||
clk : in std_logic;
|
||||
reset_n : in std_logic := '1';
|
||||
|
|
@ -65,7 +66,7 @@ architecture rtl of pulse_generator_1 is
|
|||
-- constants
|
||||
|
||||
constant CSR_IP_ID : std_logic_vector(31 downto 0) := x"0000FF13";
|
||||
constant CSR_IP_VER : std_logic_vector(31 downto 0) := x"00000001";
|
||||
constant CSR_IP_VER : std_logic_vector(31 downto 0) := x"00000101";
|
||||
|
||||
|
||||
signal init_de, init_qd, enable, loc_pd, pd_queue_error : std_logic;
|
||||
|
|
@ -88,7 +89,10 @@ architecture rtl of pulse_generator_1 is
|
|||
signal pd_in_d, filt_pd_i, abs_pos_lsb, ch_ctrl_start_req_ii : std_logic := '0';
|
||||
signal prevent_div_restart, rst_jitter, rst_diag_regs : std_logic;
|
||||
signal fire_req, fire_req_d, fire_req_p : std_logic;
|
||||
signal mid_cross, mid_crossed, zero_cross : std_logic;
|
||||
signal close_to_zero, close_to_mid : std_logic;
|
||||
--
|
||||
signal abs_pos_msb_old : std_logic_vector( 1 downto 0);
|
||||
signal ch_ctrl_csr_addr, ch_ctrl_trigger_in : std_logic_vector( 3 downto 0);
|
||||
signal avs_addr : std_logic_vector( 4 downto 0);
|
||||
signal pulse_width, pulse_width_ext, init_v : std_logic_vector( 7 downto 0);
|
||||
|
|
@ -121,9 +125,16 @@ begin
|
|||
|
||||
pd_pulse <= pd_in and not pd_in_d;
|
||||
|
||||
gen_filt_pd <= '1' when pd_pulse = '1' and (first_pd = '1' or (dp_dir_i = '0' and signed(abs_position) > signed(last_pd_pos)) or (dp_dir_i = '1' and signed(abs_position) < signed(last_pd_pos))) else '0';
|
||||
gen_filt_pd <= '1' when pd_pulse = '1' and (first_pd = '1' or
|
||||
(dp_dir_i = '0' and close_to_zero = '1' and signed(abs_position) > signed(last_pd_pos)) or
|
||||
(dp_dir_i = '0' and close_to_mid = '1' and unsigned(abs_position) > unsigned(last_pd_pos)) or
|
||||
(dp_dir_i = '1' and close_to_zero = '1' and signed(abs_position) < signed(last_pd_pos)) or
|
||||
(dp_dir_i = '1' and close_to_mid = '1' and unsigned(abs_position) < unsigned(last_pd_pos))) else '0';
|
||||
|
||||
set_first_pd <= '1' when init_qd = '1' or (dp_dir_i = '0' and upd_max_pos_i = '1') or (dp_dir_i = '1' and upd_min_pos_i = '1') or rst_jitter = '1' else '0';
|
||||
close_to_zero <= '1' when abs_position(31 downto 30) = "00" or abs_position(31 downto 30) = "11" else '0';
|
||||
close_to_mid <= '1' when abs_position(31 downto 30) = "01" or abs_position(31 downto 30) = "10" else '0';
|
||||
|
||||
set_first_pd <= '1' when init_qd = '1' or (dp_dir_i = '0' and upd_max_pos_i = '1') or (dp_dir_i = '1' and upd_min_pos_i = '1') or rst_jitter = '1' or (mid_cross = '1' and mid_crossed = '0') else '0';
|
||||
|
||||
pPD_JITTER_MNG : process(clk)
|
||||
begin
|
||||
|
|
@ -139,8 +150,17 @@ begin
|
|||
if(set_first_pd = '1' or gen_filt_pd = '1') then
|
||||
last_pd_pos <= abs_position;
|
||||
end if;
|
||||
abs_pos_msb_old <= abs_position(31 downto 30);
|
||||
if(init_qd = '1' or zero_cross = '1') then
|
||||
mid_crossed <= '0';
|
||||
elsif(mid_cross = '1') then
|
||||
mid_crossed <= '1';
|
||||
end if;
|
||||
end if;
|
||||
end process pPD_JITTER_MNG;
|
||||
|
||||
mid_cross <= '1' when (dp_dir_i = '0' and abs_position(31 downto 30) = "10" and abs_pos_msb_old = "01") or (dp_dir_i = '1' and abs_position(31 downto 30) = "01" and abs_pos_msb_old = "10") else '0';
|
||||
zero_cross <= '1' when (dp_dir_i = '0' and abs_position(31 downto 30) = "00" and abs_pos_msb_old = "11") or (dp_dir_i = '1' and abs_position(31 downto 30) = "11" and abs_pos_msb_old = "00") else '0';
|
||||
|
||||
filtered_pd <= filt_pd;
|
||||
|
||||
|
|
@ -169,7 +189,7 @@ begin
|
|||
iPD_queue: entity work.queue_and_delay_1
|
||||
generic map (
|
||||
use_ext_time => true,
|
||||
queue_size => 128)
|
||||
queue_size => 2*PD_QUEUE_SIZE)
|
||||
port map (
|
||||
rstN => reset_n,
|
||||
clk => clk,
|
||||
|
|
@ -229,8 +249,7 @@ begin
|
|||
-- Sequencer outputs
|
||||
-- - Gating signal (ch_mask)
|
||||
|
||||
--i_channel_control : entity work.emb_generic_seq_core
|
||||
i_channel_control : entity work.generic_seq_core_15
|
||||
i_channel_control : entity work.generic_sequencer_15
|
||||
generic map (
|
||||
TRIGGER_WIDTH => 4,
|
||||
VECTOR_WIDTH => 24,
|
||||
|
|
@ -241,7 +260,8 @@ begin
|
|||
VECT_RAMP_EN => false,
|
||||
BUS_BURST_EN => false,
|
||||
POS_BUS_EN => true,
|
||||
ALU_EN => false)
|
||||
ALU_EN => false,
|
||||
QUEUE_EN => true)
|
||||
port map (
|
||||
clk => clk,
|
||||
reset_n => reset_n,
|
||||
|
|
@ -370,7 +390,7 @@ begin
|
|||
|
||||
-- compendate for variation in the channel delay when daisy-chaining multiple
|
||||
-- EMBs/HMBs:
|
||||
gPULSE_DELAY_EQUAL: if pulse_delay_equal_en = true generate
|
||||
gPULSE_DELAY_EQUAL: if PULSE_DELAY_EQUAL_EN = true generate
|
||||
iDE: entity work.queue_and_delay_1
|
||||
generic map (
|
||||
use_ext_time => false,
|
||||
|
|
@ -390,7 +410,7 @@ begin
|
|||
|
||||
end generate gPULSE_DELAY_EQUAL;
|
||||
|
||||
gNOT_PULSE_DELAY_EQUAL: if pulse_delay_equal_en = false generate
|
||||
gNOT_PULSE_DELAY_EQUAL: if PULSE_DELAY_EQUAL_EN = false generate
|
||||
|
||||
retimed_pulse <= gated_pulse;
|
||||
|
||||
|
|
@ -444,7 +464,7 @@ begin
|
|||
-- Pulse Width Conditioning
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
gOUT_COND: if out_pulse_condition = true generate
|
||||
gOUT_COND: if OUT_PULSE_CONDITION = true generate
|
||||
|
||||
iPC: entity work.pulse_conditioning_1
|
||||
port map (
|
||||
|
|
@ -462,7 +482,7 @@ begin
|
|||
|
||||
end generate gOUT_COND;
|
||||
|
||||
gOUT_BYPASS : if out_pulse_condition = false generate
|
||||
gOUT_BYPASS : if OUT_PULSE_CONDITION = false generate
|
||||
|
||||
pulse_out <= pulse_out_i;
|
||||
fire_req <= pulse_out_ii;
|
||||
|
|
|
|||
592
generic_ip/pulse_generator/1/src/test/pd_jitter_verify_tb.vhd
Normal file
592
generic_ip/pulse_generator/1/src/test/pd_jitter_verify_tb.vhd
Normal file
|
|
@ -0,0 +1,592 @@
|
|||
-------------------------------------------------------------------------------
|
||||
-- Title : pd_jitter_verify_tb
|
||||
-- Project : EMB/SMB
|
||||
-------------------------------------------------------------------------------
|
||||
-- File : pd_jitter_verify_tb.vhd
|
||||
-- Author : GMG
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2018-09-11
|
||||
-- Last update: 2018-12-19
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'2008
|
||||
-------------------------------------------------------------------------------
|
||||
-- Description:
|
||||
-- Verify the PD jitter mechanism on the Pulse-Generator
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
use ieee.math_real.all;
|
||||
|
||||
use work.log_pkg.all;
|
||||
use work.avalon_verify_pkg.all;
|
||||
|
||||
use work.pulse_generator_1_pkg.all;
|
||||
|
||||
entity pd_jitter_verify_tb is
|
||||
-- ..
|
||||
end entity pd_jitter_verify_tb;
|
||||
|
||||
architecture behav of pd_jitter_verify_tb is
|
||||
|
||||
constant CLK_PERIOD : time := 10 ns;
|
||||
|
||||
-- Logging Verbosity Level
|
||||
constant VERBOSITY_LEVEL : verb_level_t := VMEDIUM;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- TB Functions / Procedures
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
procedure wait_latency(
|
||||
signal clk : in std_logic;
|
||||
cycles : in natural) is
|
||||
begin
|
||||
for i in 1 to cycles loop
|
||||
wait until clk = '1' and clk'event;
|
||||
end loop; -- i
|
||||
end procedure wait_latency;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Signal declarations
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
signal reset_n : std_logic := '0';
|
||||
signal clk : std_logic := '0';
|
||||
signal init : std_logic;
|
||||
signal pd_in : std_logic;
|
||||
signal abs_position : std_logic_vector(31 downto 0);
|
||||
signal dp_dir : std_logic;
|
||||
signal pulse_out : std_logic;
|
||||
signal filtered_pd : std_logic;
|
||||
signal ch_pd : std_logic;
|
||||
signal ch_mask : std_logic;
|
||||
signal raw_pulse_out : std_logic;
|
||||
signal avs_address : std_logic_vector(9 downto 0);
|
||||
signal avs_write : std_logic;
|
||||
signal avs_writedata : std_logic_vector(31 downto 0);
|
||||
signal avs_read : std_logic;
|
||||
signal avs_readdatavalid : std_logic;
|
||||
signal avs_readdata : std_logic_vector(31 downto 0);
|
||||
--
|
||||
signal avs_m : mm_m_rec_t;
|
||||
signal avs_s : mm_s_rec_t;
|
||||
--
|
||||
signal pd_in_cnt : integer;
|
||||
signal pd_out_cnt : integer;
|
||||
--
|
||||
signal test_completed : boolean;
|
||||
signal setup : boolean;
|
||||
signal running : boolean;
|
||||
signal error_flag : boolean;
|
||||
signal passed : boolean;
|
||||
signal failed : boolean;
|
||||
|
||||
begin -- architecture behav
|
||||
|
||||
clk <= not clk after 0.5*CLK_PERIOD;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- UUT
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
iUUT: entity work.pulse_generator_1
|
||||
generic map (
|
||||
pulse_delay_equal_en => true,
|
||||
out_pulse_condition => true)
|
||||
port map (
|
||||
clk => clk,
|
||||
reset_n => reset_n,
|
||||
init => init,
|
||||
pd_in => pd_in,
|
||||
abs_position => abs_position,
|
||||
dp_dir => dp_dir,
|
||||
pulse_out => pulse_out,
|
||||
filtered_pd => filtered_pd,
|
||||
ch_pd => ch_pd,
|
||||
ch_mask => ch_mask,
|
||||
raw_pulse_out => raw_pulse_out,
|
||||
avs_address => avs_address,
|
||||
avs_write => avs_write,
|
||||
avs_writedata => avs_writedata,
|
||||
avs_read => avs_read,
|
||||
avs_readdatavalid => avs_readdatavalid,
|
||||
avs_readdata => avs_readdata);
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Avalon interface
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
clk_clk <= clk;
|
||||
reset_reset_n <= reset_n;
|
||||
|
||||
avs_s.mm_readdata <= avs_readdata;
|
||||
|
||||
avs_s.mm_readdatavalid <= avs_readdatavalid;
|
||||
|
||||
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;
|
||||
|
||||
pCNT_CH_PD : process(reset_n, clk)
|
||||
begin
|
||||
if(reset_n = '0') then
|
||||
pd_out_cnt <= 0;
|
||||
elsif(clk = '1' and clk'event) then
|
||||
if(ch_pd = '1') then
|
||||
pd_out_cnt <= pd_out_cnt + 1;
|
||||
end if;
|
||||
end if;
|
||||
end process pCNT_CH_PD;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Testbench Logic
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
pTB_CTRL : process
|
||||
|
||||
alias dp_dir is <<signal iUUT.dp_dir_i : std_logic>>;
|
||||
|
||||
procedure issue_pd(valid_pd : boolean := true) is
|
||||
begin
|
||||
|
||||
wait until clk = '1' and clk'event;
|
||||
pd_in <= '1';
|
||||
wait until clk = '1' and clk'event;
|
||||
pd_in <= '0';
|
||||
if(valid_pd = true) then
|
||||
pd_in_cnt <= pd_in_cnt + 1;
|
||||
end if;
|
||||
|
||||
end procedure issue_pd;
|
||||
|
||||
procedure check_pd is
|
||||
begin
|
||||
for i in 1 to 12 loop
|
||||
wait until clk = '1' and clk'event;
|
||||
end loop; -- i
|
||||
if(pd_out_cnt /= pd_in_cnt) then
|
||||
if(pd_out_cnt > pd_in_cnt) then
|
||||
log("ERROR: Detected faulty Channel PD.", VLOW);
|
||||
else
|
||||
log("ERROR: Missing Channel PD.", VLOW);
|
||||
end if;
|
||||
error_flag <= true;
|
||||
end if;
|
||||
|
||||
end procedure check_pd;
|
||||
|
||||
variable addr : std_logic_vector(31 downto 0) := (others => '0');
|
||||
variable data : std_logic_vector(31 downto 0) := (others => '0');
|
||||
|
||||
begin
|
||||
|
||||
-- Set the verbosity level for logging
|
||||
set_log_verbosity(VERBOSITY_LEVEL);
|
||||
--set_log_verbosity(VHIGH);
|
||||
|
||||
-- initilialize the Avalon master-bus
|
||||
mm_m_init(avs_m);
|
||||
|
||||
log_header("PD Jitter verification:", VLOW);
|
||||
|
||||
setup <= false;
|
||||
running <= false;
|
||||
passed <= false;
|
||||
error_flag <= false;
|
||||
|
||||
init <= '0';
|
||||
pd_in <= '0';
|
||||
pd_in_cnt <= 0;
|
||||
abs_position <= (others => '0');
|
||||
|
||||
-- Reset
|
||||
reset_n <= '0';
|
||||
wait for 100 ns;
|
||||
wait until clk = '1' and clk'event;
|
||||
reset_n <= '1';
|
||||
|
||||
wait for 200 ns;
|
||||
-- enable the pulse generator
|
||||
addr := std_logic_vector(resize(unsigned(PULSE_GEN_CTRL_REG), 32));
|
||||
data := X"0000_0001";
|
||||
mm_32b_write(addr, data, avs_s, avs_m);
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
-- DP-DIR = '0'
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
log("DP-DIR = '0'", VLOW);
|
||||
log_separator_line(VLOW);
|
||||
|
||||
|
||||
dp_dir <= force '0';
|
||||
|
||||
wait for 200 ns;
|
||||
wait until clk = '1' and clk'event;
|
||||
init <= '1';
|
||||
wait until clk = '1' and clk'event;
|
||||
wait until clk = '1' and clk'event;
|
||||
wait until clk = '1' and clk'event;
|
||||
init <= '0';
|
||||
wait for 200 ns;
|
||||
wait until clk = '1' and clk'event;
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
-- DIR-0, Init Pos = 0
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
log("Issueing PD on ABS_POS = 0", VLOW);
|
||||
|
||||
for n in 0 to 9 loop
|
||||
issue_pd;
|
||||
check_pd;
|
||||
wait_latency(clk, 10);
|
||||
abs_position <= std_logic_vector(signed(abs_position)+ 1);
|
||||
end loop; -- n
|
||||
|
||||
log("Go back to ABS_POS = 0", VLOW);
|
||||
for n in 0 to 9 loop
|
||||
wait_latency(clk, 10);
|
||||
abs_position <= std_logic_vector(signed(abs_position)- 1);
|
||||
end loop; -- n
|
||||
|
||||
log("Issueing again PD on ABS_POS = 0", VLOW);
|
||||
for n in 0 to 9 loop
|
||||
issue_pd(false);
|
||||
check_pd;
|
||||
wait_latency(clk, 10);
|
||||
abs_position <= std_logic_vector(signed(abs_position)+ 1);
|
||||
end loop; -- n
|
||||
|
||||
for n in 0 to 9 loop
|
||||
issue_pd;
|
||||
check_pd;
|
||||
wait_latency(clk, 10);
|
||||
abs_position <= std_logic_vector(signed(abs_position)+ 1);
|
||||
end loop; -- n
|
||||
|
||||
wait for 1 us;
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
-- DIR-0, Init Pos = -10
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
|
||||
log("Issueing PD DIR-0, on ABS_POS = -10", VLOW);
|
||||
|
||||
abs_position <= std_logic_vector(to_signed(-10,32));
|
||||
wait_latency(clk, 3);
|
||||
init <= '1';
|
||||
wait_latency(clk, 2);
|
||||
init <= '0';
|
||||
wait_latency(clk, 10);
|
||||
|
||||
log("Issueing PD on ABS_POS = -10", VLOW);
|
||||
|
||||
for n in 0 to 9 loop
|
||||
issue_pd;
|
||||
check_pd;
|
||||
wait_latency(clk, 10);
|
||||
abs_position <= std_logic_vector(signed(abs_position)+ 1);
|
||||
end loop; -- n
|
||||
|
||||
log("Go back to ABS_POS = -10", VLOW);
|
||||
for n in 0 to 9 loop
|
||||
wait_latency(clk, 10);
|
||||
abs_position <= std_logic_vector(signed(abs_position)- 1);
|
||||
end loop; -- n
|
||||
|
||||
log("Issueing again PD on ABS_POS = -10", VLOW);
|
||||
for n in 0 to 9 loop
|
||||
issue_pd(false);
|
||||
check_pd;
|
||||
wait_latency(clk, 10);
|
||||
abs_position <= std_logic_vector(signed(abs_position)+ 1);
|
||||
end loop; -- n
|
||||
|
||||
for n in 0 to 9 loop
|
||||
issue_pd;
|
||||
check_pd;
|
||||
wait_latency(clk, 10);
|
||||
abs_position <= std_logic_vector(signed(abs_position)+ 1);
|
||||
end loop; -- n
|
||||
|
||||
wait for 1 us;
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
-- DIR-0, Mid-crossing
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
log_separator_line(VLOW);
|
||||
log("DP-DIR = '0', Mid-Crossing", VLOW);
|
||||
log_separator_line(VLOW);
|
||||
|
||||
abs_position <= X"7FFFFFF8";
|
||||
wait_latency(clk, 3);
|
||||
init <= '1';
|
||||
wait_latency(clk, 2);
|
||||
init <= '0';
|
||||
wait_latency(clk, 10);
|
||||
|
||||
log("Issueing PD on ABS_POS = 0x7FFFFFF8", VLOW);
|
||||
|
||||
for n in 0 to 15 loop
|
||||
issue_pd;
|
||||
check_pd;
|
||||
wait_latency(clk, 10);
|
||||
abs_position <= std_logic_vector(signed(abs_position)+ 1);
|
||||
end loop; -- n
|
||||
|
||||
log("Go back to ABS_POS = 0x7FFFFFF8", VLOW);
|
||||
for n in 0 to 15 loop
|
||||
wait_latency(clk, 10);
|
||||
abs_position <= std_logic_vector(signed(abs_position)- 1);
|
||||
end loop; -- n
|
||||
|
||||
log("Issueing again PD on ABS_POS = 0x7FFFFFF8", VLOW);
|
||||
for n in 0 to 15 loop
|
||||
issue_pd(false);
|
||||
check_pd;
|
||||
wait_latency(clk, 10);
|
||||
abs_position <= std_logic_vector(signed(abs_position)+ 1);
|
||||
end loop; -- n
|
||||
|
||||
for n in 0 to 15 loop
|
||||
issue_pd;
|
||||
check_pd;
|
||||
wait_latency(clk, 10);
|
||||
abs_position <= std_logic_vector(signed(abs_position)+ 1);
|
||||
end loop; -- n
|
||||
|
||||
log("Performing a zero-crossing", VLOW);
|
||||
wait_latency(clk, 10);
|
||||
|
||||
abs_position <= std_logic_vector(to_signed(-10,32));
|
||||
wait_latency(clk, 10);
|
||||
issue_pd;
|
||||
for n in 0 to 19 loop
|
||||
abs_position <= std_logic_vector(signed(abs_position)+ 1);
|
||||
wait_latency(clk, 10);
|
||||
end loop; -- n
|
||||
issue_pd;
|
||||
wait_latency(clk, 10);
|
||||
abs_position <= std_logic_vector(signed(abs_position)+ 1);
|
||||
wait_latency(clk, 10);
|
||||
|
||||
abs_position <= X"7FFFFFF8";
|
||||
log("Issueing a second set of PDs at ABS_POS = 0x7FFFFFF8", VLOW);
|
||||
wait_latency(clk, 10);
|
||||
|
||||
for n in 0 to 15 loop
|
||||
issue_pd;
|
||||
check_pd;
|
||||
wait_latency(clk, 10);
|
||||
abs_position <= std_logic_vector(signed(abs_position)+ 1);
|
||||
end loop; -- n
|
||||
|
||||
wait for 1 us;
|
||||
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
-- DP-DIR = '1'
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
log_separator_line(VLOW);
|
||||
log("DP-DIR = '1'", VLOW);
|
||||
log_separator_line(VLOW);
|
||||
|
||||
dp_dir <= force '1';
|
||||
|
||||
abs_position <= std_logic_vector(to_signed(0,32));
|
||||
wait for 200 ns;
|
||||
wait until clk = '1' and clk'event;
|
||||
init <= '1';
|
||||
wait until clk = '1' and clk'event;
|
||||
wait until clk = '1' and clk'event;
|
||||
wait until clk = '1' and clk'event;
|
||||
init <= '0';
|
||||
wait for 200 ns;
|
||||
wait until clk = '1' and clk'event;
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
-- DIR-1, Init Pos = 0
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
log("Issueing PD on ABS_POS = 0", VLOW);
|
||||
|
||||
for n in 0 to 9 loop
|
||||
issue_pd;
|
||||
check_pd;
|
||||
wait_latency(clk, 10);
|
||||
abs_position <= std_logic_vector(signed(abs_position)- 1);
|
||||
end loop; -- n
|
||||
|
||||
log("Go back to ABS_POS = 0", VLOW);
|
||||
for n in 0 to 9 loop
|
||||
wait_latency(clk, 10);
|
||||
abs_position <= std_logic_vector(signed(abs_position)+ 1);
|
||||
end loop; -- n
|
||||
|
||||
log("Issueing again PD on ABS_POS = 0", VLOW);
|
||||
for n in 0 to 9 loop
|
||||
issue_pd(false);
|
||||
check_pd;
|
||||
wait_latency(clk, 10);
|
||||
abs_position <= std_logic_vector(signed(abs_position)- 1);
|
||||
end loop; -- n
|
||||
|
||||
for n in 0 to 9 loop
|
||||
issue_pd;
|
||||
check_pd;
|
||||
wait_latency(clk, 10);
|
||||
abs_position <= std_logic_vector(signed(abs_position)- 1);
|
||||
end loop; -- n
|
||||
|
||||
wait for 1 us;
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
-- DIR-1, Init Pos = +10
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
abs_position <= std_logic_vector(to_signed(+10,32));
|
||||
wait_latency(clk, 3);
|
||||
init <= '1';
|
||||
wait_latency(clk, 2);
|
||||
init <= '0';
|
||||
wait_latency(clk, 10);
|
||||
|
||||
log("Issueing PD on ABS_POS = +10", VLOW);
|
||||
|
||||
for n in 0 to 9 loop
|
||||
issue_pd;
|
||||
check_pd;
|
||||
wait_latency(clk, 10);
|
||||
abs_position <= std_logic_vector(signed(abs_position)- 1);
|
||||
end loop; -- n
|
||||
|
||||
log("Go back to ABS_POS = +10", VLOW);
|
||||
for n in 0 to 9 loop
|
||||
wait_latency(clk, 10);
|
||||
abs_position <= std_logic_vector(signed(abs_position)+ 1);
|
||||
end loop; -- n
|
||||
|
||||
log("Issueing again PD on ABS_POS = +10", VLOW);
|
||||
for n in 0 to 9 loop
|
||||
issue_pd(false);
|
||||
check_pd;
|
||||
wait_latency(clk, 10);
|
||||
abs_position <= std_logic_vector(signed(abs_position)- 1);
|
||||
end loop; -- n
|
||||
|
||||
for n in 0 to 9 loop
|
||||
issue_pd;
|
||||
check_pd;
|
||||
wait_latency(clk, 10);
|
||||
abs_position <= std_logic_vector(signed(abs_position)- 1);
|
||||
end loop; -- n
|
||||
|
||||
wait for 1 us;
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
-- DIR-1, Mid-crossing
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
log_separator_line(VLOW);
|
||||
log("DP-DIR = '1', Mid-Crossing", VLOW);
|
||||
log_separator_line(VLOW);
|
||||
|
||||
abs_position <= X"80000008";
|
||||
wait_latency(clk, 3);
|
||||
init <= '1';
|
||||
wait_latency(clk, 2);
|
||||
init <= '0';
|
||||
wait_latency(clk, 10);
|
||||
|
||||
log("Issueing PD on ABS_POS = 0x80000008", VLOW);
|
||||
|
||||
for n in 0 to 15 loop
|
||||
issue_pd;
|
||||
check_pd;
|
||||
wait_latency(clk, 10);
|
||||
abs_position <= std_logic_vector(signed(abs_position)- 1);
|
||||
end loop; -- n
|
||||
|
||||
log("Go back to ABS_POS = 0x80000008", VLOW);
|
||||
for n in 0 to 15 loop
|
||||
wait_latency(clk, 10);
|
||||
abs_position <= std_logic_vector(signed(abs_position)+ 1);
|
||||
end loop; -- n
|
||||
|
||||
log("Issueing again PD on ABS_POS = 0x80000008", VLOW);
|
||||
for n in 0 to 15 loop
|
||||
issue_pd(false);
|
||||
check_pd;
|
||||
wait_latency(clk, 10);
|
||||
abs_position <= std_logic_vector(signed(abs_position)- 1);
|
||||
end loop; -- n
|
||||
|
||||
for n in 0 to 15 loop
|
||||
issue_pd;
|
||||
check_pd;
|
||||
wait_latency(clk, 10);
|
||||
abs_position <= std_logic_vector(signed(abs_position)- 1);
|
||||
end loop; -- n
|
||||
|
||||
log("Performing a zero-crossing", VLOW);
|
||||
wait_latency(clk, 10);
|
||||
|
||||
abs_position <= std_logic_vector(to_signed(+10,32));
|
||||
wait_latency(clk, 10);
|
||||
issue_pd;
|
||||
for n in 0 to 19 loop
|
||||
abs_position <= std_logic_vector(signed(abs_position)- 1);
|
||||
wait_latency(clk, 10);
|
||||
end loop; -- n
|
||||
issue_pd;
|
||||
wait_latency(clk, 10);
|
||||
abs_position <= std_logic_vector(signed(abs_position)- 1);
|
||||
wait_latency(clk, 10);
|
||||
|
||||
abs_position <= X"80000008";
|
||||
log("Issueing a second set of PDs at ABS_POS = 0x80000008", VLOW);
|
||||
wait_latency(clk, 10);
|
||||
|
||||
for n in 0 to 15 loop
|
||||
issue_pd;
|
||||
check_pd;
|
||||
wait_latency(clk, 10);
|
||||
abs_position <= std_logic_vector(signed(abs_position)- 1);
|
||||
end loop; -- n
|
||||
|
||||
wait for 20 us;
|
||||
|
||||
running <= false;
|
||||
passed <= true after 100 ns;
|
||||
wait;
|
||||
|
||||
end process pTB_CTRL;
|
||||
|
||||
failed <= error_flag after 100 ns;
|
||||
|
||||
pREPORT_RESULT : process
|
||||
begin
|
||||
wait until failed = true or passed = true;
|
||||
wait for 1 us;
|
||||
log_separator_line(VLOW);
|
||||
if(failed = true) then
|
||||
log("FAILURE: test completed with errors.", VLOW);
|
||||
elsif(passed = true) then
|
||||
log("SUCCESS: test successfully completed.", VLOW);
|
||||
end if;
|
||||
log_separator_line(VLOW);
|
||||
test_completed <= true;
|
||||
end process pREPORT_RESULT;
|
||||
|
||||
|
||||
end architecture behav;
|
||||
501
generic_ip/pulse_generator/1/src/test/simple_frac_div_tb.vhd
Normal file
501
generic_ip/pulse_generator/1/src/test/simple_frac_div_tb.vhd
Normal file
|
|
@ -0,0 +1,501 @@
|
|||
-------------------------------------------------------------------------------
|
||||
-- Title : simple_frac_div_tb
|
||||
-- Project : EMB/SMB
|
||||
-------------------------------------------------------------------------------
|
||||
-- File : simple_frac_div_tb.vhd
|
||||
-- Author : GMG
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2017-12-06
|
||||
-- Last update: 2018-12-19
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'2008
|
||||
-------------------------------------------------------------------------------
|
||||
-- Description:
|
||||
-- Testbench for the simple_frac_div.vhd
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
use ieee.math_real.all;
|
||||
|
||||
library OSVVM;
|
||||
use OSVVM.RandomBasePkg.all;
|
||||
use OSVVM.RandomPkg.all;
|
||||
|
||||
use work.log_pkg.all;
|
||||
|
||||
entity simple_frac_div_tb is
|
||||
-- ..
|
||||
end entity simple_frac_div_tb;
|
||||
|
||||
architecture behav of simple_frac_div_tb is
|
||||
|
||||
constant CLK_PERIOD : time := 10 ns;
|
||||
|
||||
-- Logging Verbosity Level
|
||||
constant VERBOSITY_LEVEL : verb_level_t := VMEDIUM;
|
||||
|
||||
constant MAX_DIST : natural := 10000;
|
||||
|
||||
-- define the percentage of reverse steps, with respect to the intended
|
||||
-- direction, while advancing the position:
|
||||
-- 0 => no reverse movement at all
|
||||
-- 20 => 20% of position increments are in the opposite dirtection
|
||||
-- 49 => Essentially this is an oscillation around the centre position with a
|
||||
-- tiny bias in the intended direction!
|
||||
constant POS_RANDOM_PERC : natural range 0 to 49 := 0; -- define
|
||||
|
||||
constant INTRA_POS_LATENCY : natural := 3; -- number of clock cycles between position increments
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- TB Functions / Procedures
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
procedure wait_latency(
|
||||
signal clk : in std_logic;
|
||||
cycles : in natural) is
|
||||
begin
|
||||
for i in 1 to cycles loop
|
||||
wait until clk = '1' and clk'event;
|
||||
end loop; -- i
|
||||
end procedure wait_latency;
|
||||
|
||||
-- convert the div_ratio to a fixed point integer with a 24 bits fractional part
|
||||
function ratio_to_fixed_point (ratio : real) return std_logic_vector is
|
||||
variable ratio_int : natural;
|
||||
begin
|
||||
ratio_int := integer(ratio*real(2**24));
|
||||
return std_logic_vector(to_unsigned(ratio_int, 34));
|
||||
end function ratio_to_fixed_point;
|
||||
|
||||
-- convert the sub-pixel offset to a fixed point integer with a 24 bits fractional part
|
||||
function offset_to_fixed_point (off : real; ratio: real) return std_logic_vector is
|
||||
variable offset_int : natural;
|
||||
begin
|
||||
offset_int := integer(off*ratio*real(2**24));
|
||||
return std_logic_vector(to_unsigned(offset_int, 34));
|
||||
end function offset_to_fixed_point;
|
||||
|
||||
|
||||
function check_result(ratio : real; offset : real; delta_pos : integer; fire_cnt : integer; silent_mode : boolean := false) return boolean is
|
||||
variable res : boolean;
|
||||
variable exp_fire : integer;
|
||||
begin
|
||||
if(real(delta_pos) < ratio*offset) then
|
||||
exp_fire := 0;
|
||||
else
|
||||
--exp_fire := integer(real(delta_pos)/ratio - offset+0.5);
|
||||
exp_fire := integer((1.0 + real(delta_pos)/ratio - offset));
|
||||
end if;
|
||||
if(silent_mode = false) then
|
||||
log("Check Result:",VMEDIUM);
|
||||
log("ratio = " & to_string(ratio) & ", offset = " & to_string(offset) & ", delta_pos = " & to_string(delta_pos),VMEDIUM);
|
||||
end if;
|
||||
if(abs(exp_fire-fire_cnt) <= 1) then
|
||||
res := true;
|
||||
if(silent_mode = false) then
|
||||
log("Check Result:",VMEDIUM);
|
||||
log("ratio = " & to_string(ratio) & ", offset = " & to_string(offset) & ", delta_pos = " & to_string(delta_pos),VMEDIUM);
|
||||
log("Expected Fire-Pulses = " & to_string(exp_fire) & ", detected = " & to_string(fire_cnt),VMEDIUM);
|
||||
end if;
|
||||
else
|
||||
res := false;
|
||||
log("Check Result:",VMEDIUM);
|
||||
log("ratio = " & to_string(ratio) & ", offset = " & to_string(offset) & ", delta_pos = " & to_string(delta_pos),VMEDIUM);
|
||||
log("ERROR: Expected Fire-Pulses = " & to_string(exp_fire) & ", detected = " & to_string(fire_cnt),VMEDIUM);
|
||||
end if;
|
||||
return res;
|
||||
end function check_result;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Signal declarations
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
signal reset_n : std_logic := '0';
|
||||
signal clk : std_logic := '0';
|
||||
signal enable : std_logic;
|
||||
signal upd_max_pos : std_logic;
|
||||
signal upd_min_pos : std_logic;
|
||||
signal abs_pos_max : std_logic_vector(31 downto 0);
|
||||
signal abs_pos_min : std_logic_vector(31 downto 0);
|
||||
signal dir : std_logic;
|
||||
signal offset : std_logic_vector(33 downto 0);
|
||||
signal ratio : std_logic_vector(33 downto 0);
|
||||
signal abs_pos : std_logic_vector(31 downto 0);
|
||||
signal fire : std_logic;
|
||||
signal fire_cnt : std_logic_vector(31 downto 0);
|
||||
--
|
||||
signal div_ratio : real := 1.0;
|
||||
signal pixel_offset : real := 0.0;
|
||||
signal pos : integer := 0;
|
||||
signal tot_fire_num : integer := 0;
|
||||
--
|
||||
signal test_completed : boolean;
|
||||
signal configuring : boolean;
|
||||
signal running : boolean;
|
||||
signal passed : boolean;
|
||||
signal failed : boolean;
|
||||
|
||||
begin -- architecture behav
|
||||
|
||||
clk <= not clk after 0.5*CLK_PERIOD;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- UUTs
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
iUUT : entity work.simple_frac_div_1
|
||||
port map (
|
||||
clk => clk,
|
||||
enable => enable,
|
||||
dir => dir,
|
||||
upd_max_pos => upd_max_pos,
|
||||
upd_min_pos => upd_min_pos,
|
||||
abs_pos_max => abs_pos_max,
|
||||
abs_pos_min => abs_pos_min,
|
||||
offset => offset,
|
||||
ratio => ratio,
|
||||
abs_pos => abs_pos,
|
||||
fire => fire,
|
||||
fire_cnt => fire_cnt);
|
||||
|
||||
ratio <= ratio_to_fixed_point(div_ratio);
|
||||
offset <= offset_to_fixed_point(pixel_offset, div_ratio);
|
||||
abs_pos <= std_logic_vector(to_signed(pos,32));
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Support Logic
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
pSupport : process(clk)
|
||||
begin
|
||||
if(clk = '1' and clk'event) then
|
||||
if(enable = '0') then
|
||||
tot_fire_num <= 0;
|
||||
elsif(fire = '1') then
|
||||
tot_fire_num <= tot_fire_num +1;
|
||||
end if;
|
||||
end if;
|
||||
end process pSupport;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Testbench Logic
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
pTB_CTRL : process
|
||||
variable delta_pos : integer := 0;
|
||||
variable init_pos : integer;
|
||||
variable dir_m : integer;
|
||||
variable tot_steps : integer;
|
||||
variable result : boolean;
|
||||
variable test_idx : natural;
|
||||
variable rv : RandomPType;
|
||||
|
||||
procedure run_test is
|
||||
variable steps : integer;
|
||||
variable sel_dir : integer;
|
||||
begin
|
||||
log_header("Test-case " & to_string(test_idx), VMEDIUM);
|
||||
wait_latency(clk, 1);
|
||||
if dir = '0' then
|
||||
dir_m := 1;
|
||||
else
|
||||
dir_m := -1;
|
||||
end if;
|
||||
init_pos := pos;
|
||||
-- reset the absolute position memory
|
||||
enable <= '0';
|
||||
upd_max_pos <= '0';
|
||||
upd_min_pos <= '0';
|
||||
wait_latency(clk, 1);
|
||||
upd_max_pos <= '1';
|
||||
upd_min_pos <= '1';
|
||||
wait_latency(clk, 1);
|
||||
upd_max_pos <= '0';
|
||||
upd_min_pos <= '0';
|
||||
-- restart the divider
|
||||
wait_latency(clk, 1);
|
||||
enable <= '1';
|
||||
wait_latency(clk, INTRA_POS_LATENCY);
|
||||
-- run the steps
|
||||
steps := 0;
|
||||
loop_pos: while steps < tot_steps loop
|
||||
wait_latency(clk, INTRA_POS_LATENCY);
|
||||
/*
|
||||
-- check the result and report
|
||||
delta_pos := dir_m * (pos - init_pos);
|
||||
result := check_result(div_ratio, pixel_offset, delta_pos, tot_fire_num, true);
|
||||
exit loop_pos when result = false;
|
||||
*/
|
||||
sel_dir := rv.RandInt(1, 100);
|
||||
if(sel_dir > POS_RANDOM_PERC) then
|
||||
-- move in the intended direction
|
||||
pos <= pos + dir_m;
|
||||
steps := steps + 1;
|
||||
else
|
||||
-- move in the opposite direction
|
||||
pos <= pos - dir_m;
|
||||
steps := steps - 1;
|
||||
end if;
|
||||
end loop loop_pos;
|
||||
-- wait the propagation of the latency
|
||||
wait_latency(clk, INTRA_POS_LATENCY);
|
||||
-- check the result and report
|
||||
delta_pos := dir_m * (pos - init_pos);
|
||||
if(result /= false) then
|
||||
result := check_result(div_ratio, pixel_offset, delta_pos, tot_fire_num);
|
||||
end if;
|
||||
|
||||
log("div_ratio = " & to_string(div_ratio), VMEDIUM);
|
||||
|
||||
end procedure run_test;
|
||||
|
||||
begin
|
||||
|
||||
-- Set the verbosity level for logging
|
||||
set_log_verbosity(VERBOSITY_LEVEL);
|
||||
--set_log_verbosity(VHIGH);
|
||||
|
||||
log_header("Fractional Divider verification:", VLOW);
|
||||
|
||||
test_completed <= false;
|
||||
configuring <= false;
|
||||
running <= false;
|
||||
passed <= false;
|
||||
failed <= false;
|
||||
|
||||
enable <= '0';
|
||||
dir <= '1';
|
||||
|
||||
-- Reset
|
||||
reset_n <= '0';
|
||||
wait for 100 ns;
|
||||
wait until clk = '1' and clk'event;
|
||||
reset_n <= '1';
|
||||
|
||||
result := true;
|
||||
|
||||
test_idx := 0;
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
-- Test-00
|
||||
---------------------------------------------------------------------------
|
||||
if(result /= false) then
|
||||
test_idx := test_idx+1;
|
||||
div_ratio <= 4.000;
|
||||
pixel_offset <= 0.0;
|
||||
dir <= '0';
|
||||
tot_steps := 100000;
|
||||
run_test;
|
||||
end if;
|
||||
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
-- Test-01
|
||||
---------------------------------------------------------------------------
|
||||
if(result /= false) then
|
||||
test_idx := test_idx+1;
|
||||
div_ratio <= 1.001;
|
||||
pixel_offset <= 0.0;
|
||||
dir <= '0';
|
||||
tot_steps := 10000;
|
||||
run_test;
|
||||
end if;
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
-- Test-02
|
||||
---------------------------------------------------------------------------
|
||||
if(result /= false) then
|
||||
test_idx := test_idx+1;
|
||||
div_ratio <= 1.002;
|
||||
pixel_offset <= 0.9;
|
||||
dir <= '1';
|
||||
tot_steps := 10000;
|
||||
run_test;
|
||||
end if;
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
-- Test-03
|
||||
---------------------------------------------------------------------------
|
||||
if(result /= false) then
|
||||
test_idx := test_idx+1;
|
||||
div_ratio <= 1.333;
|
||||
pixel_offset <= 1.5;
|
||||
dir <= '0';
|
||||
tot_steps := 10000;
|
||||
run_test;
|
||||
end if;
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
-- Test-04
|
||||
---------------------------------------------------------------------------
|
||||
if(result /= false) then
|
||||
test_idx := test_idx+1;
|
||||
div_ratio <= 4.008;
|
||||
pixel_offset <= 0.25;
|
||||
dir <= '0';
|
||||
tot_steps := 10000;
|
||||
run_test;
|
||||
end if;
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
-- Test-05
|
||||
---------------------------------------------------------------------------
|
||||
if(result /= false) then
|
||||
test_idx := test_idx+1;
|
||||
div_ratio <= 4.000;
|
||||
pixel_offset <= 0.0;
|
||||
dir <= '0';
|
||||
tot_steps := 10000;
|
||||
run_test;
|
||||
end if;
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
-- Test-06
|
||||
---------------------------------------------------------------------------
|
||||
if(result /= false) then
|
||||
test_idx := test_idx+1;
|
||||
div_ratio <= 4.000;
|
||||
pixel_offset <= 0.25;
|
||||
dir <= '0';
|
||||
tot_steps := 10000;
|
||||
run_test;
|
||||
end if;
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
-- Test-07
|
||||
---------------------------------------------------------------------------
|
||||
if(result /= false) then
|
||||
test_idx := test_idx+1;
|
||||
div_ratio <= 4.000;
|
||||
pixel_offset <= 0.5;
|
||||
dir <= '0';
|
||||
tot_steps := 10000;
|
||||
run_test;
|
||||
end if;
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
-- Test-08
|
||||
---------------------------------------------------------------------------
|
||||
if(result /= false) then
|
||||
test_idx := test_idx+1;
|
||||
div_ratio <= 4.000;
|
||||
pixel_offset <= 0.75;
|
||||
dir <= '0';
|
||||
tot_steps := 10000;
|
||||
run_test;
|
||||
end if;
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
-- Test-09
|
||||
---------------------------------------------------------------------------
|
||||
if(result /= false) then
|
||||
test_idx := test_idx+1;
|
||||
div_ratio <= 4.000;
|
||||
pixel_offset <= 1.0;
|
||||
dir <= '0';
|
||||
tot_steps := 10000;
|
||||
run_test;
|
||||
end if;
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
-- Test-10
|
||||
---------------------------------------------------------------------------
|
||||
if(result /= false) then
|
||||
test_idx := test_idx+1;
|
||||
div_ratio <= 4.000;
|
||||
pixel_offset <= 0.12;
|
||||
dir <= '0';
|
||||
tot_steps := 10000;
|
||||
run_test;
|
||||
end if;
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
-- Test-11
|
||||
---------------------------------------------------------------------------
|
||||
if(result /= false) then
|
||||
test_idx := test_idx+1;
|
||||
div_ratio <= 4.000;
|
||||
pixel_offset <= 0.13;
|
||||
dir <= '0';
|
||||
tot_steps := 10000;
|
||||
run_test;
|
||||
end if;
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
-- Test-12
|
||||
---------------------------------------------------------------------------
|
||||
if(result /= false) then
|
||||
test_idx := test_idx+1;
|
||||
div_ratio <= 126.0;
|
||||
pixel_offset <= 0.99;
|
||||
dir <= '0';
|
||||
tot_steps := 10000;
|
||||
run_test;
|
||||
end if;
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
-- Test-13
|
||||
---------------------------------------------------------------------------
|
||||
if(result /= false) then
|
||||
test_idx := test_idx+1;
|
||||
div_ratio <= 126.0;
|
||||
pixel_offset <= 0.0;
|
||||
dir <= '0';
|
||||
tot_steps := 10000;
|
||||
run_test;
|
||||
end if;
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
-- Test-14 - Very long test to check internal-reg-saturation
|
||||
---------------------------------------------------------------------------
|
||||
if(result /= false) then
|
||||
test_idx := test_idx+1;
|
||||
div_ratio <= 4.000;
|
||||
pixel_offset <= 0.0;
|
||||
dir <= '0';
|
||||
tot_steps := 100000;
|
||||
run_test;
|
||||
end if;
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
-- Random Tests
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
for n in 1 to 20 loop
|
||||
if(result /= false) then
|
||||
test_idx := test_idx+1;
|
||||
-- the div_ratio fractional part must be a multiple of 0.001
|
||||
div_ratio <= 0.001*real(rv.RandInt(1000, 50000));
|
||||
if((rv.RandInt(1,10) mod 2) = 0) then
|
||||
dir <= '0';
|
||||
else
|
||||
dir <= '1';
|
||||
end if;
|
||||
tot_steps := rv.RandInt(5000, 20000);
|
||||
run_test;
|
||||
end if;
|
||||
end loop; -- n
|
||||
|
||||
wait for 200 ns;
|
||||
|
||||
log_separator_line(VLOW);
|
||||
if(result = false) 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;
|
||||
|
|
@ -42,7 +42,7 @@ set_fileset_property QUARTUS_SYNTH ENABLE_FILE_OVERWRITE_MODE false
|
|||
add_fileset_file pkg_functions.vhd VHDL PATH ../../../common/0/src/pkg_functions.vhd
|
||||
add_fileset_file markov_edges.vhd VHDL PATH ../../../common/0/src/markov_edges.vhd
|
||||
add_fileset_file generic_seq_ram.vhd VHDL PATH ../../../generic_sequencer/15/src/dpram_sclk_15.vhd
|
||||
add_fileset_file generic_seq_core.vhd VHDL PATH ../../../generic_sequencer/15/src/generic_seq_core_15.vhd
|
||||
add_fileset_file generic_sequencer.vhd VHDL PATH ../../../generic_sequencer/15/src/generic_sequencer_15.vhd
|
||||
add_fileset_file signal_sequencer.vhd VHDL PATH ../src/signal_sequencer.vhd
|
||||
|
||||
add_fileset SIM_VHDL SIM_VHDL "" ""
|
||||
|
|
@ -52,7 +52,7 @@ set_fileset_property SIM_VHDL ENABLE_FILE_OVERWRITE_MODE false
|
|||
add_fileset_file pkg_functions.vhd VHDL PATH ../../../common/0/src/pkg_functions.vhd
|
||||
add_fileset_file markov_edges.vhd VHDL PATH ../../../common/0/src/markov_edges.vhd
|
||||
add_fileset_file generic_seq_ram.vhd VHDL PATH ../../../generic_sequencer/15/src/dpram_sclk_15.vhd
|
||||
add_fileset_file generic_seq_core.vhd VHDL PATH ../../../generic_sequencer/15/src/generic_seq_core_15.vhd
|
||||
add_fileset_file generic_sequencer.vhd VHDL PATH ../../../generic_sequencer/15/src/generic_sequencer_15.vhd
|
||||
add_fileset_file signal_sequencer.vhd VHDL PATH ../src/signal_sequencer.vhd
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ vcom -2008 -work work \
|
|||
../../../common/0/src/pkg_functions.vhd \
|
||||
../../../common/0/src/markov_edges.vhd \
|
||||
../../../generic_sequencer/15/src/dpram_sclk_15.vhd \
|
||||
../../../generic_sequencer/15/src/generic_seq_core_15.vhd \
|
||||
../../../generic_sequencer/15/src/generic_sequencer_15.vhd \
|
||||
../src/signal_sequencer_10.vhd \
|
||||
../src/test/signal_sequencer_10_tb.vhd
|
||||
|
||||
|
|
|
|||
|
|
@ -742,7 +742,7 @@ begin
|
|||
|
||||
GEN_SEQ_TRIG_0: if STATUS_WIDTH <= 13 generate
|
||||
|
||||
iSEQ : entity work.generic_seq_core_15
|
||||
iSEQ : entity work.generic_sequencer_15
|
||||
generic map (
|
||||
TRIGGER_WIDTH => STATUS_WIDTH+3,
|
||||
BUS_WIDTH => 1,
|
||||
|
|
@ -789,7 +789,7 @@ begin
|
|||
|
||||
GEN_SEQ_TRIG_1: if STATUS_WIDTH > 13 generate
|
||||
|
||||
iSEQ : entity work.generic_seq_core_15
|
||||
iSEQ : entity work.generic_sequencer_15
|
||||
generic map (
|
||||
TRIGGER_WIDTH => 16,
|
||||
BUS_WIDTH => 1,
|
||||
|
|
|
|||
231
generic_ip/som_ctrl/1/doc/som_ctrl_1.json
Normal file
231
generic_ip/som_ctrl/1/doc/som_ctrl_1.json
Normal file
|
|
@ -0,0 +1,231 @@
|
|||
[{
|
||||
"ip_name": "som_ctrl_1",
|
||||
"bus": "csr",
|
||||
"description": "SOM Controller IP",
|
||||
"addr_hi_bit" : "6",
|
||||
"addr_lo_bit" : "5",
|
||||
"sub_blocks": {
|
||||
"local": {
|
||||
"instance": "",
|
||||
"process": "enabled",
|
||||
"offset": "0x0"
|
||||
},
|
||||
"swim_2": {
|
||||
"instance": "iSWIM_MNG",
|
||||
"process": "enabled",
|
||||
"offset": "0x20"
|
||||
}
|
||||
},
|
||||
"registers": {
|
||||
"ip_id" : {
|
||||
"address" : "0",
|
||||
"width" : "32",
|
||||
"description" : "Unique ID for this IP block",
|
||||
"fields": {
|
||||
"ip_number" : {
|
||||
"type" : "c",
|
||||
"bit_len" : "8",
|
||||
"reset" : "0x0F",
|
||||
"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" : "Bits[7:0] = Minor version number, Bits[15:8] = Major version number, etc.",
|
||||
"fields": {
|
||||
"minor_number" : {
|
||||
"type" : "c",
|
||||
"bit_len" : "8",
|
||||
"reset" : "0x00",
|
||||
"description" : "Minor number"
|
||||
},
|
||||
"major_number" : {
|
||||
"type" : "c",
|
||||
"bit_len" : "8",
|
||||
"reset" : "0x01",
|
||||
"description" : "Major number"
|
||||
|
||||
},
|
||||
"reserved" : {
|
||||
"type" : "rsv",
|
||||
"bit_len" : "16",
|
||||
"description" : "Reserved bits"
|
||||
}
|
||||
}
|
||||
},
|
||||
"power_good_status": {
|
||||
"address": "2",
|
||||
"width": "3",
|
||||
"description": "",
|
||||
"fields": {
|
||||
"p_good": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "U",
|
||||
"description": "p_good pin status"
|
||||
},
|
||||
"p_in_good": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "U",
|
||||
"description": "p_in_good pin status"
|
||||
},
|
||||
"p_host_good": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "U",
|
||||
"description": "p_host_good pin status"
|
||||
}
|
||||
}
|
||||
},
|
||||
"host_power_control": {
|
||||
"address": "3",
|
||||
"width": "7",
|
||||
"description": "",
|
||||
"fields": {
|
||||
"host_pwr_en": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "drives host_pwr_en pin"
|
||||
},
|
||||
"host_5v_en": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "drives host_5v_en pin"
|
||||
},
|
||||
"host_3v3_en": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "drives host_3v3_en pin"
|
||||
},
|
||||
"host_2v5_en": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "drives host_2v5_en pin"
|
||||
},
|
||||
"host_1v5_en": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "drives host_1v5_en pin"
|
||||
},
|
||||
"host_1v2_en": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "drives host_1v2_en pin"
|
||||
},
|
||||
"host_1v1_en": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "drives host_1v1_en pin"
|
||||
}
|
||||
}
|
||||
},
|
||||
"mon_pt_sel": {
|
||||
"address": "4",
|
||||
"width": "32",
|
||||
"description": "Monitoring Points selection",
|
||||
"fields": {
|
||||
"mp_0_sel": {
|
||||
"type": "w",
|
||||
"bit_len": "7",
|
||||
"reset": "0x0",
|
||||
"description": "source selection for MP-0"
|
||||
},
|
||||
"mp_0_drive_n": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x1",
|
||||
"description": "0 => Driving MP-0, 1 => MP-0 output three-stated"
|
||||
},
|
||||
"mp_1_sel": {
|
||||
"type": "w",
|
||||
"bit_len": "7",
|
||||
"reset": "0x0",
|
||||
"description": "source selection for MP-1"
|
||||
},
|
||||
"mp_1_drive_n": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x1",
|
||||
"description": "0 => Driving MP-1, 1 => MP-1 output three-stated"
|
||||
},
|
||||
"mp_2_sel": {
|
||||
"type": "w",
|
||||
"bit_len": "7",
|
||||
"reset": "0x0",
|
||||
"description": "source selection for MP-2"
|
||||
},
|
||||
"mp_2_drive_n": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x1",
|
||||
"description": "0 => Driving MP-2, 1 => MP-2 output three-stated"
|
||||
},
|
||||
"mp_3_sel": {
|
||||
"type": "w",
|
||||
"bit_len": "7",
|
||||
"reset": "0x0",
|
||||
"description": "source selection for MP-3"
|
||||
},
|
||||
"mp_3_drive_n": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x1",
|
||||
"description": "0 => Driving MP-3, 1 => MP-3 output three-stated"
|
||||
}
|
||||
}
|
||||
},
|
||||
"som_led": {
|
||||
"type": "w",
|
||||
"address": "5",
|
||||
"reset": "0x00",
|
||||
"width": "5",
|
||||
"description": "SOM LEDs value"
|
||||
},
|
||||
"stm8_ift": {
|
||||
"address": "6",
|
||||
"width": "9",
|
||||
"description": "STM8 interface",
|
||||
"fields": {
|
||||
"stm8_trigger_rx": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "stm8_trigger_rx"
|
||||
},
|
||||
"reserved": {
|
||||
"type": "rsv",
|
||||
"bit_len": "7",
|
||||
"description": "Reserved bits"
|
||||
},
|
||||
"stm8_alert_tx": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "stm8_alert_tx"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}]
|
||||
32
generic_ip/som_ctrl/1/sim/comp.do
Normal file
32
generic_ip/som_ctrl/1/sim/comp.do
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
# Modelsim compilation macro
|
||||
|
||||
#.main clear
|
||||
|
||||
# Cleanup libraries
|
||||
foreach lib [list work OSVVM] {
|
||||
file delete -force -- $lib
|
||||
vlib $lib
|
||||
}
|
||||
|
||||
vlib ./work
|
||||
vmap work ./work
|
||||
|
||||
set COMMON_PATH ../../../common/0/src
|
||||
set SWIM_PATH ../../../swim/2/src
|
||||
set SRC_PATH ../src
|
||||
|
||||
set WORKLIB work
|
||||
|
||||
# Compile the design files
|
||||
|
||||
vcom -2008 -work $WORKLIB $COMMON_PATH/common_pkg.vhd
|
||||
vcom -2008 -work $WORKLIB $COMMON_PATH/stretch_pulse.vhd
|
||||
vcom -2008 -work $WORKLIB $SWIM_PATH/swim_2_pkg_auto.vhd
|
||||
vcom -2008 -work $WORKLIB $SWIM_PATH/swim_2_csr_regs_auto.vhd
|
||||
vcom -2008 -work $WORKLIB $SWIM_PATH/swim_2.vhd
|
||||
vcom -2008 -work $WORKLIB $SRC_PATH/som_ctrl_1_pkg.vhd
|
||||
vcom -2008 -work $WORKLIB $SRC_PATH/som_ctrl_1.vhd
|
||||
|
||||
|
||||
|
||||
|
||||
240
generic_ip/som_ctrl/1/src/som_ctrl_1.vhd
Normal file
240
generic_ip/som_ctrl/1/src/som_ctrl_1.vhd
Normal file
|
|
@ -0,0 +1,240 @@
|
|||
-------------------------------------------------------------------------------
|
||||
-- Title : som ctrl_1
|
||||
-- Project : SMB
|
||||
-------------------------------------------------------------------------------
|
||||
-- File : som_ctrl.vhd
|
||||
-- Author : Gianmarco Girau
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2018-05-15
|
||||
-- Last update: 2018-12-20
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL 2008
|
||||
-------------------------------------------------------------------------------
|
||||
-- Description:
|
||||
-- som_ctrl block: this block gathers together SOM specific functionalies, such
|
||||
-- as the SWIM interface, power-good input signals, host-power enable signals etc.
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
library work;
|
||||
use work.som_ctrl_1_pkg.all;
|
||||
|
||||
|
||||
entity som_ctrl_1 is
|
||||
port (
|
||||
clk : in std_logic;
|
||||
reset_n : in std_logic := '1';
|
||||
-- Avalon-MM I/F
|
||||
avs_address : in std_logic_vector( 5 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);
|
||||
-- SOM Specific I/Fs:
|
||||
som_mon_pt_en : out std_logic_vector( 3 downto 0); -- SOM Timing Output enable
|
||||
som_mon_pt : out std_logic_vector( 3 downto 0); -- SOM Timing I/Os
|
||||
mon_pt_src : in std_logic_vector(31 downto 0); -- Source signals for the SOM monitoring points
|
||||
-- STM8 & swim
|
||||
stm8_alert_tx : in std_logic;
|
||||
stm8_trigger_rx : out std_logic;
|
||||
swim_tx : out std_logic;
|
||||
swim_rx : in std_logic;
|
||||
-- SOM Miscellaneous I/Os
|
||||
p_good : in std_logic;
|
||||
p_in_good : in std_logic;
|
||||
p_host_good : in std_logic;
|
||||
host_pwr_en : out std_logic;
|
||||
host_5v_en : out std_logic;
|
||||
host_3v3_en : out std_logic;
|
||||
host_2v5_en : out std_logic;
|
||||
host_1v5_en : out std_logic;
|
||||
host_1v2_en : out std_logic;
|
||||
host_1v1_en : out std_logic;
|
||||
-- SOM LEDs
|
||||
som_led : out std_logic_vector(5 downto 1));
|
||||
|
||||
end entity som_ctrl_1;
|
||||
|
||||
architecture rtl of som_ctrl_1 is
|
||||
|
||||
constant CSR_IP_ID : std_logic_vector(31 downto 0) := x"0000FF0F";
|
||||
constant CSR_IP_VER : std_logic_vector(31 downto 0) := x"00000100";
|
||||
|
||||
signal swim_write, swim_read, swim_read_d : std_logic;
|
||||
signal avs_read_d : std_logic;
|
||||
signal avs_addr : std_logic_vector( 2 downto 0);
|
||||
signal swim_addr, mp_stretch_en : std_logic_vector( 3 downto 0);
|
||||
signal mon_pt_i, mon_pt_ii : std_logic_vector( 3 downto 0);
|
||||
signal mon_pt_sel_0, mon_pt_sel_1 : std_logic_vector( 7 downto 0);
|
||||
signal mon_pt_sel_2, mon_pt_sel_3 : std_logic_vector( 7 downto 0);
|
||||
signal swim_writedata, swim_readdata : std_logic_vector(31 downto 0);
|
||||
signal avs_readdata_i : std_logic_vector(31 downto 0);
|
||||
|
||||
begin
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- SWIM I/F
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
iSWIM_MNG: entity work.swim_2
|
||||
generic map (
|
||||
CLK_FREQ_MHZ => 100)
|
||||
port map (
|
||||
clk => clk,
|
||||
reset_n => reset_n,
|
||||
avs_address => swim_addr,
|
||||
avs_write => swim_write,
|
||||
avs_writedata => swim_writedata,
|
||||
avs_read => swim_read,
|
||||
avs_readdata => swim_readdata,
|
||||
swim_out => swim_tx,
|
||||
swim_in => swim_rx,
|
||||
dbg_port => open);
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- MOnitoring Points
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
--
|
||||
som_mon_pt_en(0) <= not mon_pt_sel_0(7);
|
||||
som_mon_pt_en(1) <= not mon_pt_sel_1(7);
|
||||
som_mon_pt_en(2) <= not mon_pt_sel_2(7);
|
||||
som_mon_pt_en(3) <= not mon_pt_sel_3(7);
|
||||
|
||||
-- Monitoring Point selection
|
||||
mon_pt_ii(0) <= mon_pt_src(to_integer(unsigned(mon_pt_sel_0(4 downto 0))));
|
||||
mon_pt_ii(1) <= mon_pt_src(to_integer(unsigned(mon_pt_sel_1(4 downto 0))));
|
||||
mon_pt_ii(2) <= mon_pt_src(to_integer(unsigned(mon_pt_sel_2(4 downto 0))));
|
||||
mon_pt_ii(3) <= mon_pt_src(to_integer(unsigned(mon_pt_sel_3(4 downto 0))));
|
||||
|
||||
-- Pulse stretching
|
||||
gMP_STRETCH : for n in 0 to 3 generate
|
||||
|
||||
iSTRETCH: entity work.stretch_pulse
|
||||
generic map (
|
||||
pulse_polarity => 0,
|
||||
ext_pulse_width => 25)
|
||||
port map (
|
||||
rstN => reset_n,
|
||||
clk => clk,
|
||||
pulse_in => mon_pt_ii(n),
|
||||
pulse_out => mon_pt_i(n));
|
||||
|
||||
end generate gMP_STRETCH;
|
||||
|
||||
som_mon_pt(0) <= mon_pt_ii(0) when mp_stretch_en(0) = '0' else mon_pt_i(0);
|
||||
som_mon_pt(1) <= mon_pt_ii(1) when mp_stretch_en(1) = '0' else mon_pt_i(1);
|
||||
som_mon_pt(2) <= mon_pt_ii(2) when mp_stretch_en(2) = '0' else mon_pt_i(2);
|
||||
som_mon_pt(3) <= mon_pt_ii(3) when mp_stretch_en(3) = '0' else mon_pt_i(3);
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- C&S registers (Avalon-MM I/F)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
swim_addr <= avs_address(swim_addr'range);
|
||||
|
||||
swim_writedata <= avs_writedata;
|
||||
|
||||
swim_write <= '1' when avs_write = '1' and avs_address(5) = '1' else '0';
|
||||
swim_read <= '1' when avs_read = '1' and avs_address(5) = '1' else '0';
|
||||
|
||||
avs_addr <= avs_address(2 downto 0);
|
||||
|
||||
pCTRL_STATUS : process(reset_n, clk)
|
||||
begin
|
||||
if(reset_n = '0') then
|
||||
avs_readdatavalid <= '0';
|
||||
--
|
||||
host_pwr_en <= '0';
|
||||
host_5v_en <= '0';
|
||||
host_3v3_en <= '0';
|
||||
host_2v5_en <= '0';
|
||||
host_1v5_en <= '0';
|
||||
host_1v2_en <= '0';
|
||||
host_1v1_en <= '0';
|
||||
--
|
||||
stm8_trigger_rx <= '0';
|
||||
--
|
||||
mon_pt_sel_0 <= (7 => '1', others => '0');
|
||||
mon_pt_sel_1 <= (7 => '1', others => '0');
|
||||
mon_pt_sel_2 <= (7 => '1', others => '0');
|
||||
mon_pt_sel_3 <= (7 => '1', others => '0');
|
||||
mp_stretch_en <= (others => '0');
|
||||
--
|
||||
som_led <= (others => '0');
|
||||
elsif(clk = '1' and clk'event) then
|
||||
-- CTRL registers
|
||||
if(avs_write = '1') then
|
||||
case avs_addr is
|
||||
when CSR_HOST_PWR_ADDR =>
|
||||
host_pwr_en <= avs_writedata(0);
|
||||
host_5v_en <= avs_writedata(1);
|
||||
host_3v3_en <= avs_writedata(2);
|
||||
host_2v5_en <= avs_writedata(3);
|
||||
host_1v5_en <= avs_writedata(4);
|
||||
host_1v2_en <= avs_writedata(5);
|
||||
host_1v1_en <= avs_writedata(6);
|
||||
when CSR_MON_PT_SEL_ADDR =>
|
||||
mon_pt_sel_0 <= avs_writedata( 7 downto 0);
|
||||
mon_pt_sel_1 <= avs_writedata(15 downto 8);
|
||||
mon_pt_sel_2 <= avs_writedata(23 downto 16);
|
||||
mon_pt_sel_3 <= avs_writedata(31 downto 24);
|
||||
when CSR_MON_PT_STRETCH_ADDR =>
|
||||
mp_stretch_en <= avs_writedata( 3 downto 0);
|
||||
when CSR_SOM_LED_ADDR =>
|
||||
som_led <= avs_writedata( 4 downto 0);
|
||||
when CSR_STM8_ADDR =>
|
||||
stm8_trigger_rx <= avs_writedata(0);
|
||||
when others => null;
|
||||
end case;
|
||||
end if;
|
||||
|
||||
-- Read Ctrl & Status registers
|
||||
if(avs_read = '1') then
|
||||
case avs_addr is
|
||||
when CSR_IP_ID_ADDR =>
|
||||
avs_readdata_i <= CSR_IP_ID;
|
||||
when CSR_IP_VER_ADDR =>
|
||||
avs_readdata_i <= CSR_IP_VER;
|
||||
when CSR_PWR_GOOD_ADDR =>
|
||||
avs_readdata_i <= (0 => p_good, 1 => p_in_good, 2 => p_host_good, others => '0');
|
||||
when CSR_HOST_PWR_ADDR =>
|
||||
avs_readdata_i(0) <= host_pwr_en;
|
||||
avs_readdata_i(1) <= host_5v_en;
|
||||
avs_readdata_i(2) <= host_3v3_en;
|
||||
avs_readdata_i(3) <= host_2v5_en;
|
||||
avs_readdata_i(4) <= host_1v5_en;
|
||||
avs_readdata_i(5) <= host_1v2_en;
|
||||
avs_readdata_i(6) <= host_1v1_en;
|
||||
avs_readdata_i(31 downto 7) <= (others => '0');
|
||||
when CSR_MON_PT_SEL_ADDR =>
|
||||
avs_readdata_i <= mon_pt_sel_3 & mon_pt_sel_2 & mon_pt_sel_1 & mon_pt_sel_0;
|
||||
when CSR_MON_PT_STRETCH_ADDR =>
|
||||
avs_readdata_i <= 28x"0" & mp_stretch_en;
|
||||
when CSR_SOM_LED_ADDR =>
|
||||
avs_readdata_i <= 27x"0" & som_led;
|
||||
when CSR_STM8_ADDR =>
|
||||
avs_readdata_i <= (0 => stm8_trigger_rx, 8 => stm8_alert_tx, others => '0');
|
||||
when others =>
|
||||
avs_readdata <= X"BAD1BAD0";
|
||||
end case;
|
||||
end if;
|
||||
-- Output mux between local status registers and the swim if. Adjust
|
||||
-- latency for the read-valid.
|
||||
swim_read_d <= swim_read;
|
||||
if(swim_read_d = '1') then
|
||||
avs_readdata <= swim_readdata;
|
||||
else
|
||||
avs_readdata <= avs_readdata_i;
|
||||
end if;
|
||||
avs_read_d <= avs_read;
|
||||
avs_readdatavalid <= avs_read_d;
|
||||
end if;
|
||||
end process pCTRL_STATUS;
|
||||
|
||||
end architecture rtl;
|
||||
|
||||
35
generic_ip/som_ctrl/1/src/som_ctrl_1_pkg.vhd
Normal file
35
generic_ip/som_ctrl/1/src/som_ctrl_1_pkg.vhd
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
-------------------------------------------------------------------------------
|
||||
-- Title : som_ctrl_1_pkg
|
||||
-- Project : SOM/SMB
|
||||
-------------------------------------------------------------------------------
|
||||
-- File : som_ctrl_1_pkg.vhd
|
||||
-- Author : GMG
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2018-05-21
|
||||
-- Last update: 2018-12-20
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'2008
|
||||
-------------------------------------------------------------------------------
|
||||
-- Description:
|
||||
-- Package defining common constants for the som_ctrl, block
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
package som_ctrl_1_pkg is
|
||||
|
||||
constant CSR_IP_ID_ADDR : std_logic_vector(2 downto 0) := 3x"0";
|
||||
constant CSR_IP_VER_ADDR : std_logic_vector(2 downto 0) := 3x"1";
|
||||
constant CSR_PWR_GOOD_ADDR : std_logic_vector(2 downto 0) := 3x"2";
|
||||
constant CSR_HOST_PWR_ADDR : std_logic_vector(2 downto 0) := 3x"3";
|
||||
constant CSR_MON_PT_SEL_ADDR : std_logic_vector(2 downto 0) := 3x"4";
|
||||
constant CSR_MON_PT_STRETCH_ADDR : std_logic_vector(2 downto 0) := 3x"5";
|
||||
constant CSR_SOM_LED_ADDR : std_logic_vector(2 downto 0) := 3x"6";
|
||||
constant CSR_STM8_ADDR : std_logic_vector(2 downto 0) := 3x"7";
|
||||
|
||||
-- offset for the SWIM interface subblock
|
||||
constant CSR_SWIM_IF_OFFSET : std_logic_vector(5 downto 0) := 6x"20";
|
||||
|
||||
end package som_ctrl_1_pkg;
|
||||
Loading…
Add table
Add a link
Reference in a new issue