Merge branch 'master' of hydra:GIS_Embedded_Logic/EL-GENERIC-IP

This commit is contained in:
Damian Smith 2021-08-03 09:22:05 +01:00
commit 5a43ade42e
134 changed files with 32898 additions and 2146 deletions

View file

@ -1,7 +1,7 @@
-- megafunction wizard: %FIFO%
-- GENERATION: STANDARD
-- VERSION: WM1.0
-- MODULE: dcfifo
-- MODULE: dcfifo
-- ============================================================
-- File Name: alt_async_fifo.vhd
@ -19,12 +19,12 @@
--Copyright (C) 2018 Intel Corporation. All rights reserved.
--Your use of Intel Corporation's design tools, logic functions
--and other software and tools, and its AMPP partner logic
--functions, and any output files from any of the foregoing
--(including device programming or simulation files), and any
--associated documentation or information are expressly subject
--to the terms and conditions of the Intel Program License
--Your use of Intel Corporation's design tools, logic functions
--and other software and tools, and its AMPP partner logic
--functions, and any output files from any of the foregoing
--(including device programming or simulation files), and any
--associated documentation or information are expressly subject
--to the terms and conditions of the Intel Program License
--Subscription Agreement, the Intel Quartus Prime License Agreement,
--the Intel FPGA IP License Agreement, or other applicable license
--agreement, including, without limitation, that your use is for
@ -46,19 +46,23 @@ entity alt_async_fifo is
DEPTH : natural range 2 to 131072 := 64;
DEVICE_FAMILY : string := "Cyclone V" ; -- "Cyclone 10 LP"
SHOWAHEAD : string := "ON"; -- "OFF"
CHECKING : string := "ON" -- "OFF"
CHECKING : string := "ON"; -- "OFF"
SYNC_CLR : string := "OFF" -- "ON"
);
port
(
clr : in std_logic := '0';
wrclk : in std_logic ;
wrreq : in std_logic ;
wrdata : in std_logic_vector (DATA_WIDTH-1 downto 0);
wrfull : out std_logic ;
wrusedw : out std_logic_vector (log2(DEPTH)-1 downto 0);
rdclk : in std_logic ;
rdreq : in std_logic ;
rddata : out std_logic_vector (DATA_WIDTH-1 downto 0);
rdempty : out std_logic
rdempty : out std_logic ;
rdusedw : out std_logic_vector (log2(DEPTH)-1 downto 0)
);
end alt_async_fifo;
@ -68,6 +72,8 @@ architecture syn of alt_async_fifo is
signal sub_wire0 : std_logic_vector (DATA_WIDTH-1 downto 0);
signal sub_wire1 : std_logic ;
signal sub_wire2 : std_logic ;
signal sub_wire3 : std_logic_vector (log2(DEPTH)-1 downto 0);
signal sub_wire4 : std_logic_vector (log2(DEPTH)-1 downto 0);
component dcfifo
generic (
@ -81,9 +87,12 @@ architecture syn of alt_async_fifo is
rdsync_delaypipe : natural;
underflow_checking : string;
use_eab : string;
read_aclr_synch : string;
write_aclr_synch : string;
wrsync_delaypipe : natural
);
port (
aclr : in std_logic ;
data : in std_logic_vector (DATA_WIDTH-1 downto 0);
rdclk : in std_logic ;
rdreq : in std_logic ;
@ -91,14 +100,18 @@ architecture syn of alt_async_fifo is
wrreq : in std_logic ;
q : out std_logic_vector (DATA_WIDTH-1 downto 0);
rdempty : out std_logic ;
wrfull : out std_logic
wrfull : out std_logic ;
wrusedw : out std_logic_vector(log2(DEPTH)-1 downto 0);
rdusedw : out std_logic_vector(log2(DEPTH)-1 downto 0)
);
end component;
begin
rddata <= sub_wire0(DATA_WIDTH-1 downto 0);
rddata <= sub_wire0;
rdempty <= sub_wire1;
wrfull <= sub_wire2;
wrusedw <= sub_wire3;
rdusedw <= sub_wire4;
dcfifo_component : dcfifo
generic map (
@ -110,11 +123,14 @@ begin
lpm_widthu => log2(DEPTH),
overflow_checking => CHECKING,
underflow_checking => CHECKING,
read_aclr_synch => SYNC_CLR,
write_aclr_synch => SYNC_CLR,
use_eab => "ON",
rdsync_delaypipe => 4,
wrsync_delaypipe => 4
)
port map (
aclr => clr,
data => wrdata,
rdclk => rdclk,
rdreq => rdreq,
@ -122,7 +138,9 @@ begin
wrreq => wrreq,
q => sub_wire0,
rdempty => sub_wire1,
wrfull => sub_wire2
wrfull => sub_wire2,
wrusedw => sub_wire3,
rdusedw => sub_wire4
);
end syn;

View file

@ -0,0 +1,207 @@
-- megafunction wizard: %RAM: 2-PORT%
-- GENERATION: STANDARD
-- VERSION: WM1.0
-- MODULE: altsyncram
-- ============================================================
-- File Name: alt_dp_ram_mixed_width.vhd
-- Megafunction Name(s):
-- altsyncram
--
-- Simulation Library Files(s):
-- altera_mf
-- ============================================================
-- ************************************************************
-- THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE!
--
-- 18.1.0 Build 625 09/12/2018 SJ Standard Edition
-- ************************************************************
--Copyright (C) 2018 Intel Corporation. All rights reserved.
--Your use of Intel Corporation's design tools, logic functions
--and other software and tools, and its AMPP partner logic
--functions, and any output files from any of the foregoing
--(including device programming or simulation files), and any
--associated documentation or information are expressly subject
--to the terms and conditions of the Intel Program License
--Subscription Agreement, the Intel Quartus Prime License Agreement,
--the Intel FPGA IP License Agreement, or other applicable license
--agreement, including, without limitation, that your use is for
--the sole purpose of programming logic devices manufactured by
--Intel and sold by Intel or its authorized distributors. Please
--refer to the applicable agreement for further details.
library ieee;
use ieee.std_logic_1164.all;
library altera_mf;
use altera_mf.altera_mf_components.all;
use work.common_pkg.all;
entity alt_dp_ram_mixed_width is
generic (
WDATA_WIDTH : natural range 1 to 256 := 32;
RDATA_WIDTH : natural range 1 to 256 := 32;
WDEPTH : natural range 2 to 131072 := 128;
RDEPTH : natural range 2 to 131072 := 128;
REGISTER_OUTPUT : string := "CLOCK0"; -- "UNREGISTERED"
READ_WRITE_MODE : string := "OLD_DATA"; -- "DONT_CARE"
INIT_FILE : string := ""; -- e.g "ram.mif" or "ram.hex"
INIT_FILE_LAYOUT : string := "PORT_A"; -- "PORT_A", "PORT_B"
DEVICE_FAMILY : string := "Cyclone V" -- "Cyclone 10 LP"
);
port
(
clk : in std_logic := '1';
wrdata : in std_logic_vector (WDATA_WIDTH-1 downto 0);
wraddr : in std_logic_vector (log2(WDEPTH)-1 downto 0);
wren : in std_logic := '0';
rdaddr : in std_logic_vector (log2(RDEPTH)-1 downto 0);
rddata : out std_logic_vector (RDATA_WIDTH-1 downto 0)
);
end alt_dp_ram_mixed_width;
architecture syn of alt_dp_ram_mixed_width is
signal sub_wire0 : std_logic_vector (RDATA_WIDTH-1 downto 0);
begin
rddata <= sub_wire0;
altsyncram_component : altsyncram
generic map (
address_aclr_b => "NONE",
address_reg_b => "CLOCK0",
clock_enable_input_a => "BYPASS",
clock_enable_input_b => "BYPASS",
clock_enable_output_b => "BYPASS",
init_file => INIT_FILE,
init_file_layout => INIT_FILE_LAYOUT,
intended_device_family => DEVICE_FAMILY,
lpm_type => "altsyncram",
numwords_a => WDEPTH,
numwords_b => RDEPTH,
operation_mode => "DUAL_PORT",
outdata_aclr_b => "NONE",
outdata_reg_b => REGISTER_OUTPUT,
power_up_uninitialized => "FALSE",
read_during_write_mode_mixed_ports => READ_WRITE_MODE,
widthad_a => LOG2(WDEPTH),
widthad_b => LOG2(RDEPTH),
width_a => WDATA_WIDTH,
width_b => RDATA_WIDTH,
width_byteena_a => 1
)
port map (
address_a => wraddr,
address_b => rdaddr,
clock0 => clk,
data_a => wrdata,
wren_a => wren,
q_b => sub_wire0
);
end syn;
-- ============================================================
-- CNX file retrieval info
-- ============================================================
-- Retrieval info: PRIVATE: ADDRESSSTALL_A NUMERIC "0"
-- Retrieval info: PRIVATE: ADDRESSSTALL_B NUMERIC "0"
-- Retrieval info: PRIVATE: BYTEENA_ACLR_A NUMERIC "0"
-- Retrieval info: PRIVATE: BYTEENA_ACLR_B NUMERIC "0"
-- Retrieval info: PRIVATE: BYTE_ENABLE_A NUMERIC "0"
-- Retrieval info: PRIVATE: BYTE_ENABLE_B NUMERIC "0"
-- Retrieval info: PRIVATE: BYTE_SIZE NUMERIC "8"
-- Retrieval info: PRIVATE: BlankMemory NUMERIC "1"
-- Retrieval info: PRIVATE: CLOCK_ENABLE_INPUT_A NUMERIC "0"
-- Retrieval info: PRIVATE: CLOCK_ENABLE_INPUT_B NUMERIC "0"
-- Retrieval info: PRIVATE: CLOCK_ENABLE_OUTPUT_A NUMERIC "0"
-- Retrieval info: PRIVATE: CLOCK_ENABLE_OUTPUT_B NUMERIC "0"
-- Retrieval info: PRIVATE: CLRdata NUMERIC "0"
-- Retrieval info: PRIVATE: CLRq NUMERIC "0"
-- Retrieval info: PRIVATE: CLRrdaddress NUMERIC "0"
-- Retrieval info: PRIVATE: CLRrren NUMERIC "0"
-- Retrieval info: PRIVATE: CLRwraddress NUMERIC "0"
-- Retrieval info: PRIVATE: CLRwren NUMERIC "0"
-- Retrieval info: PRIVATE: clk NUMERIC "0"
-- Retrieval info: PRIVATE: Clock_A NUMERIC "0"
-- Retrieval info: PRIVATE: Clock_B NUMERIC "0"
-- Retrieval info: PRIVATE: IMPLEMENT_IN_LES NUMERIC "0"
-- Retrieval info: PRIVATE: INDATA_ACLR_B NUMERIC "0"
-- Retrieval info: PRIVATE: INDATA_REG_B NUMERIC "0"
-- Retrieval info: PRIVATE: INIT_FILE_LAYOUT STRING "PORT_B"
-- Retrieval info: PRIVATE: INIT_TO_SIM_X NUMERIC "0"
-- Retrieval info: PRIVATE: INTENDED_DEVICE_FAMILY STRING "Cyclone 10 LP"
-- Retrieval info: PRIVATE: JTAG_ENABLED NUMERIC "0"
-- Retrieval info: PRIVATE: JTAG_ID STRING "NONE"
-- Retrieval info: PRIVATE: MAXIMUM_DEPTH NUMERIC "0"
-- Retrieval info: PRIVATE: MEMSIZE NUMERIC "4096"
-- Retrieval info: PRIVATE: MEM_IN_BITS NUMERIC "0"
-- Retrieval info: PRIVATE: MIFfilename STRING ""
-- Retrieval info: PRIVATE: OPERATION_MODE NUMERIC "2"
-- Retrieval info: PRIVATE: OUTDATA_ACLR_B NUMERIC "0"
-- Retrieval info: PRIVATE: OUTDATA_REG_B NUMERIC "1"
-- Retrieval info: PRIVATE: RAM_BLOCK_TYPE NUMERIC "0"
-- Retrieval info: PRIVATE: READ_DURING_WRITE_MODE_MIXED_PORTS NUMERIC "1"
-- Retrieval info: PRIVATE: READ_DURING_WRITE_MODE_PORT_A NUMERIC "3"
-- Retrieval info: PRIVATE: READ_DURING_WRITE_MODE_PORT_B NUMERIC "3"
-- Retrieval info: PRIVATE: REGdata NUMERIC "1"
-- Retrieval info: PRIVATE: REGq NUMERIC "0"
-- Retrieval info: PRIVATE: REGrdaddress NUMERIC "1"
-- Retrieval info: PRIVATE: REGrren NUMERIC "1"
-- Retrieval info: PRIVATE: REGwraddress NUMERIC "1"
-- Retrieval info: PRIVATE: REGwren NUMERIC "1"
-- Retrieval info: PRIVATE: SYNTH_WRAPPER_GEN_POSTFIX STRING "0"
-- Retrieval info: PRIVATE: USE_DIFF_CLKEN NUMERIC "0"
-- Retrieval info: PRIVATE: UseDPRAM NUMERIC "1"
-- Retrieval info: PRIVATE: VarWidth NUMERIC "0"
-- Retrieval info: PRIVATE: WIDTH_READ_A NUMERIC "32"
-- Retrieval info: PRIVATE: WIDTH_READ_B NUMERIC "32"
-- Retrieval info: PRIVATE: WIDTH_WRITE_A NUMERIC "32"
-- Retrieval info: PRIVATE: WIDTH_WRITE_B NUMERIC "32"
-- Retrieval info: PRIVATE: WRADDR_ACLR_B NUMERIC "0"
-- Retrieval info: PRIVATE: WRADDR_REG_B NUMERIC "0"
-- Retrieval info: PRIVATE: WRCTRL_ACLR_B NUMERIC "0"
-- Retrieval info: PRIVATE: enable NUMERIC "0"
-- Retrieval info: PRIVATE: rden NUMERIC "0"
-- Retrieval info: LIBRARY: altera_mf altera_mf.altera_mf_components.all
-- Retrieval info: CONSTANT: ADDRESS_ACLR_B STRING "NONE"
-- Retrieval info: CONSTANT: ADDRESS_REG_B STRING "CLOCK0"
-- Retrieval info: CONSTANT: CLOCK_ENABLE_INPUT_A STRING "BYPASS"
-- Retrieval info: CONSTANT: CLOCK_ENABLE_INPUT_B STRING "BYPASS"
-- Retrieval info: CONSTANT: CLOCK_ENABLE_OUTPUT_B STRING "BYPASS"
-- Retrieval info: CONSTANT: INTENDED_DEVICE_FAMILY STRING "Cyclone 10 LP"
-- Retrieval info: CONSTANT: LPM_TYPE STRING "altsyncram"
-- Retrieval info: CONSTANT: NUMWORDS_A NUMERIC "128"
-- Retrieval info: CONSTANT: NUMWORDS_B NUMERIC "128"
-- Retrieval info: CONSTANT: OPERATION_MODE STRING "DUAL_PORT"
-- Retrieval info: CONSTANT: OUTDATA_ACLR_B STRING "NONE"
-- Retrieval info: CONSTANT: OUTDATA_REG_B STRING "CLOCK0"
-- Retrieval info: CONSTANT: POWER_UP_UNINITIALIZED STRING "FALSE"
-- Retrieval info: CONSTANT: READ_DURING_WRITE_MODE_MIXED_PORTS STRING "OLD_DATA"
-- Retrieval info: CONSTANT: WIDTHAD_A NUMERIC "7"
-- Retrieval info: CONSTANT: WIDTHAD_B NUMERIC "7"
-- Retrieval info: CONSTANT: WIDTH_A NUMERIC "32"
-- Retrieval info: CONSTANT: WIDTH_B NUMERIC "32"
-- Retrieval info: CONSTANT: WIDTH_BYTEENA_A NUMERIC "1"
-- Retrieval info: USED_PORT: clk 0 0 0 0 INPUT VCC "clk"
-- Retrieval info: USED_PORT: wrdata 0 0 32 0 INPUT NODEFVAL "wrdata[31..0]"
-- Retrieval info: USED_PORT: rddata 0 0 32 0 OUTPUT NODEFVAL "rddata[31..0]"
-- Retrieval info: USED_PORT: rdaddr 0 0 7 0 INPUT NODEFVAL "rdaddr[6..0]"
-- Retrieval info: USED_PORT: wraddr 0 0 7 0 INPUT NODEFVAL "wraddr[6..0]"
-- Retrieval info: USED_PORT: wren 0 0 0 0 INPUT GND "wren"
-- Retrieval info: CONNECT: @address_a 0 0 7 0 wraddr 0 0 7 0
-- Retrieval info: CONNECT: @address_b 0 0 7 0 rdaddr 0 0 7 0
-- Retrieval info: CONNECT: @clock0 0 0 0 0 clk 0 0 0 0
-- Retrieval info: CONNECT: @data_a 0 0 32 0 wrdata 0 0 32 0
-- Retrieval info: CONNECT: @wren_a 0 0 0 0 wren 0 0 0 0
-- Retrieval info: CONNECT: rddata 0 0 32 0 @q_b 0 0 32 0
-- Retrieval info: GEN_FILE: TYPE_NORMAL alt_dp_ram_mixed_width.vhd TRUE
-- Retrieval info: GEN_FILE: TYPE_NORMAL alt_dp_ram_mixed_width.inc FALSE
-- Retrieval info: GEN_FILE: TYPE_NORMAL alt_dp_ram_mixed_width.cmp FALSE
-- Retrieval info: GEN_FILE: TYPE_NORMAL alt_dp_ram_mixed_width.bsf FALSE
-- Retrieval info: GEN_FILE: TYPE_NORMAL dp_ram_inst.vhd FALSE
-- Retrieval info: LIB_FILE: altera_mf

View file

@ -0,0 +1,97 @@
-------------------------------------------------------------------------------
-- Title : cs_bus_ift_no_wait
-------------------------------------------------------------------------------
-- File : cs_bus_ift_no_wait.vhd
-- Author : Christos Spirotis
-- 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: 2021-05-12
-------------------------------------------------------------------------------
-- Revisions :
-- Date Version Author Description
-- 2021-05-12 1.0 cs Created
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity cs_bus_ift_no_wait 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_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_rd_data : in std_logic_vector(32*BLK_NUM-1 downto 0));
end cs_bus_ift_no_wait;
architecture RTL of cs_bus_ift_no_wait 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_address_i : std_logic_vector(14 downto 0);
signal cs_re_l : std_logic;
signal cs_re_i : std_logic_vector(BLK_NUM-1 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;
GEN_CS_WE: for i in 0 to BLK_NUM-1 generate
cs_we(i) <= '1' when (avs_write = '1' and to_integer(unsigned(avs_address(avs_address'high downto avs_address'high-3))) = i) else '0';
end generate GEN_CS_WE;
GEN_CS_RE: for i in 0 to BLK_NUM-1 generate
cs_re_i(i) <= '1' when (avs_read = '1' and to_integer(unsigned(avs_address(avs_address'high downto avs_address'high-3))) = i) else '0';
end generate GEN_CS_RE;
pLatchAddr : process(rstN, clk)
begin
if(rstN = '0') then
avs_address_i <= (others => '0');
cs_re_l <= '0';
elsif(clk = '1' and clk'event) then
if(avs_read = '1') then
avs_address_i <= avs_address;
end if;
if (to_integer(unsigned(cs_re_i)) /= 0) then
cs_re_l <= '1';
else
cs_re_l <= '0';
end if;
end if;
end process pLatchAddr;
cs_re <= cs_re_i;
cs_addr <= avs_address(10 downto 0);
cs_wr_data <= avs_writedata;
avs_readdata <= cs_rd_data_i(to_integer(unsigned(avs_address_i(avs_address'high downto avs_address'high-3)))) when cs_re_l = '1' else (others => '0');
end RTL;

View file

@ -0,0 +1,88 @@
-------------------------------------------------------------------------------
-- Title : sync_pulse
-------------------------------------------------------------------------------
-- File : sync_pulse.vhd
-- Author : Simon Southwell
-- Company : GIS
-- Target : Generic (simulation), Generic (synthesis)
-- Dependency : none
-------------------------------------------------------------------------------
-- Description: synchronise single cycle pulse between two async clk domains
-------------------------------------------------------------------------------
-- Last update: 2021-01-19
-------------------------------------------------------------------------------
-- Revisions :
-- Date Version Author Description
-- 2021-01-19 1.0 SDS Created
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;
entity sync_pulse is
generic(
SYNC_STAGES : positive := 2
);
port
(
clk_in : in std_logic;
rst_n : in std_logic;
pulse_in : in std_logic;
clk_out : in std_logic;
pulse_out : out std_logic
);
end sync_pulse;
architecture rtl of sync_pulse is
signal pulse_in_hold : std_logic;
signal pulse_in_sync : std_logic_vector(SYNC_STAGES-1 downto 0);
signal pulse_out_sync : std_logic_vector(SYNC_STAGES-1 downto 0);
signal pulse_out_hold : std_logic;
signal pulse_out_hold_dly : std_logic := '0';
begin
--Synchronised pulse hold
pulse_out_hold <= pulse_in_sync(0);
-- Pulse output on rising edge of output pulse held
pulse_out <= pulse_out_hold and not pulse_out_hold_dly;
P_SYNC_IN : process (clk_in, rst_n)
begin
if rst_n = '0' then
pulse_in_hold <= '0';
pulse_out_sync <= (others => '0');
elsif clk_in'event and clk_in = '1' then
-- Hold input pulse until cleared by return path
pulse_in_hold <= (pulse_in_hold or pulse_in) and not pulse_out_sync(0);
-- Synchronise output held pulse
pulse_out_sync <= pulse_out_hold & pulse_out_sync(pulse_in_sync'left downto 1);
end if;
end process;
P_SYNC_OUT : process (clk_out)
begin
if clk_out'event and clk_out = '1' then
-- Synchronise held input pulse
pulse_in_sync <= pulse_in_hold & pulse_in_sync(pulse_in_sync'left downto 1);
-- Generate delayed version of held pulse for rising edge detection.
pulse_out_hold_dly <= pulse_out_hold;
end if;
end process;
end;

View file

@ -0,0 +1,87 @@
-------------------------------------------------------------------------------
-- Title : sync_pulse
-------------------------------------------------------------------------------
-- File : sync_pulse.vhd
-- Author : Simon Southwell
-- Company : GIS
-- Target : Generic (simulation), Generic (synthesis)
-- Dependency : none
-------------------------------------------------------------------------------
-- Description: samples vector in clock domain b and presents in clock domain a
-- with busy status
-------------------------------------------------------------------------------
-- Last update: 2020-12-14
-------------------------------------------------------------------------------
-- Revisions :
-- Date Version Author Description
-- 2020-12-14 1.0 SDS Created
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;
entity sync_pulse_vec is
generic(
SYNC_STAGES : positive := 2;
VEC_WIDTH : positive := 32
);
port
(
clk_a : in std_logic;
rst_n_a : in std_logic;
pulse_a : in std_logic;
busy_a : out std_logic;
vec_a : out std_logic_vector(VEC_WIDTH-1 downto 0);
clk_b : in std_logic;
rst_n_b : in std_logic;
vec_b : in std_logic_vector(VEC_WIDTH-1 downto 0)
);
end sync_pulse_vec;
architecture rtl of sync_pulse_vec is
signal pulse_b : std_logic;
signal pulse_b_rtn : std_logic;
signal vec_smpl : std_logic_vector(VEC_WIDTH-1 downto 0);
begin
P_CLK_A : process(clk_a, rst_n_a)
begin
if rst_n_a = '0' then
busy_a <= '0';
elsif clk_a'event and clk_a = '1' then
if pulse_a = '1' then
busy_a <= '1';
end if;
if pulse_b_rtn = '1' then
vec_a <= vec_smpl;
busy_a <= '0';
end if;
end if;
end process;
P_CLK_B : process(clk_b)
begin
if clk_b'event and clk_b = '1' then
if pulse_b = '1' then
vec_smpl <= vec_b;
end if;
end if;
end process;
sync_pulse_0 : entity work.sync_pulse
generic map (SYNC_STAGES => SYNC_STAGES)
port map(clk_in => clk_a, rst_n=> rst_n_a, pulse_in => pulse_a and not busy_a, clk_out => clk_b, pulse_out => pulse_b);
sync_pulse_1 : entity work.sync_pulse
generic map (SYNC_STAGES => SYNC_STAGES)
port map(clk_in => clk_b, rst_n=> rst_n_b, pulse_in => pulse_b, clk_out => clk_a, pulse_out => pulse_b_rtn);
end rtl;

View file

@ -24,7 +24,7 @@ vmap work ./work
vcom -2008 -work $WORKLIB $COMMON_PATH/common_pkg.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/digital_lpf.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/dpram_sclk.vhd
#vcom -2008 -work $WORKLIB $COMMON_PATH/altera/alt_rw_dp_ram.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/altera/alt_rw_dp_ram.vhd
vcom -2008 -work $WORKLIB $ENC_MULT/lut_divider_0.vhd
vcom -2008 -work $WORKLIB $ENC_MULT/encoder_speed_detect_0.vhd
vcom -2008 -work $WORKLIB $ENC_MULT/encoder_multiply_0.vhd

View file

@ -0,0 +1,371 @@
[{
"ip_name": "ems_1",
"bus": "csr",
"addr_width" : "4",
"description": "Encoder Management System",
"registers": {
"ip_id" : {
"address" : "0",
"width" : "32",
"description" : "Unique ID for this IP block",
"fields": {
"ip_number" : {
"type" : "c",
"bit_len" : "8",
"reset" : "0x1F",
"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" : "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"
}
}
},
"ems_enable" : {
"address" : "2",
"width" : "4",
"description" : "EMS Enable",
"fields": {
"init" : {
"type" : "w",
"bit_len" : "1",
"reset" : "0x0",
"description" : "EMS init"
},
"ems_enable" : {
"type" : "w",
"bit_len" : "1",
"reset" : "0x0",
"description" : "EMS enable"
},
"enc_enable" : {
"type" : "w",
"bit_len" : "1",
"reset" : "0x0",
"description" : "Encoder enable"
},
"pd_enable" : {
"type" : "w",
"bit_len" : "1",
"reset" : "0x0",
"description" : "PD enable"
}
}
},
"ems_config" : {
"address" : "3",
"width" : "13",
"description" : "EMS configuration",
"fields": {
"enc_sel" : {
"type" : "w",
"bit_len" : "2",
"reset" : "0x0",
"description" : "Encoder source selection"
},
"pd_sel" : {
"type" : "w",
"bit_len" : "3",
"reset" : "0x0",
"description" : "PD source selection: Bit-0: 0 => RS422, 1 => Single-Ended. Bit-1: 1 => Exclude Harware PDs. Bit-2: 0 => In single-ended mode use PNP, 1 => In single-ended mode use NPN"
},
"enc_ph1_en" : {
"type" : "w",
"bit_len" : "1",
"reset" : "0x0",
"description" : "Encoder phase-1 enable"
},
"enc_ph2_en" : {
"type" : "w",
"bit_len" : "1",
"reset" : "0x0",
"description" : "Encoder phase-2 enable"
},
"enc_rising_en" : {
"type" : "w",
"bit_len" : "1",
"reset" : "0x0",
"description" : "Enables encoder events on rising edges"
},
"enc_falling_en" : {
"type" : "w",
"bit_len" : "1",
"reset" : "0x0",
"description" : "Enables encoder events on falling edges"
},
"pd_rising_en" : {
"type" : "w",
"bit_len" : "1",
"reset" : "0x0",
"description" : "Enables PD events on rising edges"
},
"pd_falling_en" : {
"type" : "w",
"bit_len" : "1",
"reset" : "0x0",
"description" : "Enables PD events on falling edges"
},
"set_abs_pos" : {
"type" : "w0",
"bit_len" : "1",
"reset" : "0x0",
"description" : "Preset the value of the absolute position"
},
"switch_pos_neg_inc" : {
"type" : "w",
"bit_len" : "1",
"reset" : "0x0",
"description" : "When enabled, positive and negative increments of the absolute position are switched, achieving the same effect of switching encoder phase-1 and phase-2. "
}
}
},
"pd_hyst" : {
"address" : "4",
"width" : "17",
"description" : "PD hysteresis control",
"fields": {
"pd_hyst_val" : {
"type" : "w",
"bit_len" : "16",
"reset" : "0x20",
"description" : "Enable rising-edge events on source 0"
},
"clr_pd_hyst" : {
"type" : "w",
"bit_len" : "1",
"reset" : "0x0",
"description" : "clears the PD hysteresis filter"
}
}
},
"sw_ctrl": {
"address": "5",
"width": "6",
"description": "software controls",
"fields": {
"sw_pd": {
"type": "w0",
"bit_len": "1",
"reset": "0x0",
"description": "Generates a SW PD event"
},
"kickstart_pd" : {
"type": "w0",
"bit_len": "1",
"reset": "0x0",
"description": "Generates a kickstart PD event"
},
"reserved" : {
"type" : "rsv",
"bit_len" : "2",
"description" : "Reserved bits"
},
"sw_pos_step": {
"type": "w0",
"bit_len": "1",
"reset": "0x0",
"description": "single SW increment for the absolute position"
},
"sw_neg_step": {
"type": "w0",
"bit_len": "1",
"reset": "0x0",
"description": "single SW decrement for the absolute position"
}
}
},
"enc_divide": {
"type": "w",
"address": "6",
"reset": "0x0",
"width": "4",
"description": "division factor for the encoder increments/decrements"
},
"abs_pos_preset": {
"type": "w",
"address": "7",
"reset": "0x0",
"width": "32",
"subtype": "signed",
"description": "value fetched into the absolute-position when the preset ctrl bit is asserted"
},
"abs_pos_val": {
"type": "r",
"address": "8",
"reset": "0x0",
"width": "32",
"subtype": "signed",
"description": "Current value of the absolute-position (With/Without Encoder Multiplier)"
},
"pd_cnt": {
"address": "9",
"width": "32",
"description": "PD counters",
"fields": {
"total_pd_cnt": {
"type": "r",
"bit_len": "16",
"reset": "0x0",
"description": "Total number of PD events"
},
"hw_pd_cnt": {
"type": "r",
"bit_len": "16",
"reset": "0x0",
"description": "Number of hardware PD events"
}
}
},
"filt_cfg": {
"address": "10",
"width": "20",
"description": "input filters configuration",
"fields": {
"filter_order": {
"type": "w",
"bit_len": "5",
"reset": "0x0",
"description": "filter order"
},
"Reserved-0" : {
"type" : "rsv",
"bit_len" : "3",
"description" : "Reserved bits"
},
"filter_hyst": {
"type": "w",
"bit_len": "5",
"reset": "0x0",
"description": "filter hysteresis"
},
"Reserved-1" : {
"type" : "rsv",
"bit_len" : "3",
"description" : "Reserved bits"
},
"ld_filt_cfg_pd": {
"type": "w0",
"bit_len": "1",
"reset": "0x0",
"description": "applies the specified configuration to the PD filter"
},
"ld_filt_cfg_p1": {
"type": "w0",
"bit_len": "1",
"reset": "0x0",
"description": "applies the specified configuration to the Encoder-Phase-1 filter"
},
"ld_filt_cfg_p2": {
"type": "w0",
"bit_len": "1",
"reset": "0x0",
"description": "applies the specified configuration to the Encoder-Phase-2 filter"
},
"ld_filt_cfg_zp": {
"type": "w0",
"bit_len": "1",
"reset": "0x0",
"description": "applies the specified configuration to the Encoder-Zero-Phase filter"
}
}
},
"mult_cfg": {
"address": "11",
"width": "15",
"description": "Encoder Multiplier Configuration",
"fields": {
"use_multiplier": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "Use Encoder Multiplier"
},
"Reserved-1" : {
"type" : "rsv",
"bit_len" : "3",
"description" : "Reserved bits"
},
"mult_sel": {
"type": "w",
"bit_len": "3",
"reset": "0x0",
"description": "Encoder Multiplication selection {0-7}: log2(Mult-Value), 0 => Mult=1, 1 => Mult=2, 7 => Mult=128"
},
"Reserved-2" : {
"type" : "rsv",
"bit_len" : "1",
"description" : "Reserved bits"
},
"vel_avg_steps": {
"type": "w",
"bit_len": "7",
"reset": "0x10",
"description": "Number of consecutive encoder steps used for generating the average velocity (must be an even number, max is 64)"
}
}
},
"delta_t_init": {
"type": "w",
"address": "12",
"reset": "0x19",
"width": "28",
"description": "Set this constant to 25 for Encoder Mult values less or equal than 8, otherwise set to 2*Mult-Value"
},
"vel_timeout": {
"type": "w",
"address": "13",
"reset": "0x7A120",
"width": "28",
"description": "Velocity estimation time-out period"
},
"abs_pos_in_stat": {
"type": "r",
"address": "14",
"reset": "0x0",
"width": "32",
"subtype": "signed",
"description": "Debug - Current value of the Absolute Position, without Encoder Multiplier"
},
"abs_pos_vel_stat": {
"type": "r",
"address": "15",
"reset": "0x0",
"width": "32",
"subtype": "signed",
"description": "Debug - Current value of the Absolute Position, after the encoder velocity estimation block"
}
}
}]

View file

@ -0,0 +1,77 @@
# Simulation macro
# Cleanup libraries
foreach lib [list work OSVVM] {
file delete -force -- $lib
vlib $lib
}
#.main clear
set COMMON_PATH ../../../common/0/src
set ENC_MULT ../../../encoder_multiply/0/src
set EMS_SRC ../src
set GEN_SEQ ../../../generic_sequencer/15/src
set EMUL ../../../enc_pd_emul/1/src
set OSVVM_PATH $COMMON_PATH/test/OSVVM
set WORKLIB work
vlib ./work
vmap work ./work
# Compile the UUT
vcom -2008 -work $WORKLIB $COMMON_PATH/common_pkg.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/digital_lpf.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/dpram_sclk.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/altera/alt_rw_dp_ram.vhd
vcom -2008 -work $WORKLIB $ENC_MULT/lut_divider_0.vhd
vcom -2008 -work $WORKLIB $ENC_MULT/encoder_speed_detect_0.vhd
vcom -2008 -work $WORKLIB $ENC_MULT/encoder_multiply_0.vhd
vcom -2008 -work $WORKLIB $EMS_SRC/ems_1_pkg_auto.vhd
vcom -2008 -work $WORKLIB $EMS_SRC/ems_1_csr_regs_auto.vhd
vcom -2008 -work $WORKLIB $EMS_SRC/ems_1.vhd
# 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 support files
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
# Add the encoder/PD emulator
vcom -2008 -work $WORKLIB $GEN_SEQ/altera/generic_seq_ram_15.vhd
vcom -2008 -work $WORKLIB $GEN_SEQ/generic_sequencer_15_pkg.vhd
vcom -2008 -work $WORKLIB $GEN_SEQ/generic_sequencer_15.vhd
vcom -2008 -work $WORKLIB $EMUL/enc_pd_emul_1_pkg.vhd
vcom -2008 -work $WORKLIB $EMUL/enc_pd_emul_1.vhd
# Compile the testbench
vcom -2008 -work $WORKLIB ./../src/test/ems_1_tb.vhd
vsim -t ps work.ems_1_tb
#add wave /ems_1_tb/*
#add wave /ems_1_tb/iEMS/*
#add wave /ems_1_tb/iEMUL/*
# remove warnings from standard numeric/arithmetic packages (speed-up simulation)
set StdArithNoWarnings 1
set NumericStdNoWarnings 1
do wave_ems.do
when -label end_of_simulation {test_completed == true} {echo "Simulation Completed"; stop ;}
run -all
#run 200 us;

View file

@ -0,0 +1,376 @@
onerror {resume}
quietly WaveActivateNextPane {} 0
add wave -noupdate /ems_1_tb/reset_n
add wave -noupdate /ems_1_tb/clk
add wave -noupdate /ems_1_tb/mask_npn
add wave -noupdate /ems_1_tb/mask_pnp
add wave -noupdate /ems_1_tb/ttl_pd
add wave -noupdate /ems_1_tb/ttl_pd_npn
add wave -noupdate /ems_1_tb/ttl_pd_pnp
add wave -noupdate /ems_1_tb/ttl_enc_p1
add wave -noupdate /ems_1_tb/ttl_enc_p2
add wave -noupdate /ems_1_tb/ttl_enc_zp
add wave -noupdate /ems_1_tb/rs422_pd
add wave -noupdate /ems_1_tb/rs422_enc_p1
add wave -noupdate /ems_1_tb/rs422_enc_p2
add wave -noupdate /ems_1_tb/rs422_enc_zp
add wave -noupdate /ems_1_tb/pd_out
add wave -noupdate /ems_1_tb/set_pos
add wave -noupdate /ems_1_tb/inc_pos
add wave -noupdate /ems_1_tb/dec_pos
add wave -noupdate /ems_1_tb/filt_p1
add wave -noupdate /ems_1_tb/filt_p2
add wave -noupdate /ems_1_tb/filt_zp
add wave -noupdate /ems_1_tb/filt_pd
add wave -noupdate -radix decimal /ems_1_tb/abs_position
add wave -noupdate -radix decimal /ems_1_tb/avs_address
add wave -noupdate /ems_1_tb/avs_write
add wave -noupdate -radix hexadecimal /ems_1_tb/avs_writedata
add wave -noupdate /ems_1_tb/avs_read
add wave -noupdate -radix hexadecimal /ems_1_tb/avs_readdata
add wave -noupdate /ems_1_tb/ems_address
add wave -noupdate /ems_1_tb/ems_write
add wave -noupdate -radix hexadecimal /ems_1_tb/ems_writedata
add wave -noupdate /ems_1_tb/ems_read
add wave -noupdate -radix hexadecimal /ems_1_tb/ems_readdata
add wave -noupdate /ems_1_tb/init
add wave -noupdate /ems_1_tb/setup
add wave -noupdate /ems_1_tb/running
add wave -noupdate /ems_1_tb/passed
add wave -noupdate /ems_1_tb/failed
add wave -noupdate /ems_1_tb/test_timeout
add wave -noupdate /ems_1_tb/test_completed
add wave -noupdate /ems_1_tb/error_flag
add wave -noupdate /ems_1_tb/avs_mm_s_rec
add wave -noupdate /ems_1_tb/avs_mm_m_rec
add wave -noupdate /ems_1_tb/ems_mm_s_rec
add wave -noupdate /ems_1_tb/ems_mm_m_rec
add wave -noupdate -divider EMS
add wave -noupdate /ems_1_tb/iEMS/clk
add wave -noupdate /ems_1_tb/iEMS/reset_n
add wave -noupdate /ems_1_tb/iEMS/init
add wave -noupdate /ems_1_tb/iEMS/avs_address
add wave -noupdate /ems_1_tb/iEMS/avs_write
add wave -noupdate -radix hexadecimal /ems_1_tb/iEMS/avs_writedata
add wave -noupdate /ems_1_tb/iEMS/avs_read
add wave -noupdate /ems_1_tb/iEMS/avs_readdata
add wave -noupdate /ems_1_tb/iEMS/rs422_pd
add wave -noupdate /ems_1_tb/iEMS/rs422_p1
add wave -noupdate /ems_1_tb/iEMS/rs422_p2
add wave -noupdate /ems_1_tb/iEMS/rs422_zp
add wave -noupdate /ems_1_tb/iEMS/ttl_pd
add wave -noupdate /ems_1_tb/iEMS/ttl_pd_npn
add wave -noupdate /ems_1_tb/iEMS/ttl_p1
add wave -noupdate /ems_1_tb/iEMS/ttl_p2
add wave -noupdate /ems_1_tb/iEMS/ttl_zp
add wave -noupdate -radix decimal /ems_1_tb/iEMS/abs_position
add wave -noupdate /ems_1_tb/iEMS/pd_out
add wave -noupdate /ems_1_tb/iEMS/set_pos
add wave -noupdate /ems_1_tb/iEMS/inc_pos
add wave -noupdate /ems_1_tb/iEMS/dec_pos
add wave -noupdate /ems_1_tb/iEMS/filt_p1
add wave -noupdate /ems_1_tb/iEMS/filt_p2
add wave -noupdate /ems_1_tb/iEMS/filt_zp
add wave -noupdate /ems_1_tb/iEMS/filt_pd
add wave -noupdate /ems_1_tb/iEMS/init_i
add wave -noupdate /ems_1_tb/iEMS/ttl_pd_i
add wave -noupdate /ems_1_tb/iEMS/sel_ttl_npn
add wave -noupdate /ems_1_tb/iEMS/pd_mux
add wave -noupdate /ems_1_tb/iEMS/p1_mux
add wave -noupdate /ems_1_tb/iEMS/p2_mux
add wave -noupdate /ems_1_tb/iEMS/zp_mux
add wave -noupdate /ems_1_tb/iEMS/ems_init
add wave -noupdate /ems_1_tb/iEMS/pd_i
add wave -noupdate /ems_1_tb/iEMS/pd_re
add wave -noupdate /ems_1_tb/iEMS/pd_fe
add wave -noupdate /ems_1_tb/iEMS/p1_i
add wave -noupdate /ems_1_tb/iEMS/p1_re
add wave -noupdate /ems_1_tb/iEMS/p1_fe
add wave -noupdate /ems_1_tb/iEMS/p2_i
add wave -noupdate /ems_1_tb/iEMS/p2_re
add wave -noupdate /ems_1_tb/iEMS/p2_fe
add wave -noupdate /ems_1_tb/iEMS/zp_i
add wave -noupdate /ems_1_tb/iEMS/p1_re_i
add wave -noupdate /ems_1_tb/iEMS/p1_fe_i
add wave -noupdate /ems_1_tb/iEMS/p2_re_i
add wave -noupdate /ems_1_tb/iEMS/p2_fe_i
add wave -noupdate /ems_1_tb/iEMS/enc_ph1_en
add wave -noupdate /ems_1_tb/iEMS/enc_ph2_en
add wave -noupdate /ems_1_tb/iEMS/enc_rising_en
add wave -noupdate /ems_1_tb/iEMS/enc_falling_en
add wave -noupdate /ems_1_tb/iEMS/step_pos_i
add wave -noupdate /ems_1_tb/iEMS/step_neg_i
add wave -noupdate /ems_1_tb/iEMS/step_pos
add wave -noupdate /ems_1_tb/iEMS/step_neg
add wave -noupdate /ems_1_tb/iEMS/wrap_pos_i
add wave -noupdate /ems_1_tb/iEMS/wrap_neg_i
add wave -noupdate /ems_1_tb/iEMS/set_pos_i
add wave -noupdate /ems_1_tb/iEMS/set_abs_pos
add wave -noupdate /ems_1_tb/iEMS/wrap_pos
add wave -noupdate /ems_1_tb/iEMS/wrap_neg
add wave -noupdate -radix unsigned /ems_1_tb/iEMS/enc_cnt
add wave -noupdate -radix unsigned /ems_1_tb/iEMS/enc_divide
add wave -noupdate /ems_1_tb/iEMS/inc_pos_i
add wave -noupdate /ems_1_tb/iEMS/dec_pos_i
add wave -noupdate /ems_1_tb/iEMS/step_pos_ii
add wave -noupdate /ems_1_tb/iEMS/step_neg_ii
add wave -noupdate /ems_1_tb/iEMS/use_multiplier
add wave -noupdate /ems_1_tb/iEMS/m_step_pos
add wave -noupdate /ems_1_tb/iEMS/m_step_neg
add wave -noupdate /ems_1_tb/iEMS/step_pos_retimed
add wave -noupdate /ems_1_tb/iEMS/step_neg_retimed
add wave -noupdate /ems_1_tb/iEMS/init_mult
add wave -noupdate /ems_1_tb/iEMS/enable_mult
add wave -noupdate /ems_1_tb/iEMS/mult_sel
add wave -noupdate /ems_1_tb/iEMS/avg_steps
add wave -noupdate /ems_1_tb/iEMS/delta_init
add wave -noupdate /ems_1_tb/iEMS/time_out
add wave -noupdate /ems_1_tb/iEMS/delta_t
add wave -noupdate /ems_1_tb/iEMS/ems_enable
add wave -noupdate /ems_1_tb/iEMS/pd_hyst_filt
add wave -noupdate /ems_1_tb/iEMS/set_pd_hyst_filt
add wave -noupdate /ems_1_tb/iEMS/pd_event
add wave -noupdate /ems_1_tb/iEMS/clr_pd_hyst_filt
add wave -noupdate /ems_1_tb/iEMS/sw_pos_step
add wave -noupdate /ems_1_tb/iEMS/sw_neg_step
add wave -noupdate /ems_1_tb/iEMS/pd_rising_en
add wave -noupdate /ems_1_tb/iEMS/pd_falling_en
add wave -noupdate /ems_1_tb/iEMS/sw_pd
add wave -noupdate /ems_1_tb/iEMS/pd
add wave -noupdate /ems_1_tb/iEMS/kickstart_pd
add wave -noupdate /ems_1_tb/iEMS/enc_sel
add wave -noupdate /ems_1_tb/iEMS/pd_sel
add wave -noupdate /ems_1_tb/iEMS/pd_hyst_val
add wave -noupdate /ems_1_tb/iEMS/pd_hyst_pos_cnt
add wave -noupdate /ems_1_tb/iEMS/pd_hyst_neg_cnt
add wave -noupdate /ems_1_tb/iEMS/hw_pd_cnt
add wave -noupdate /ems_1_tb/iEMS/total_pd_cnt
add wave -noupdate /ems_1_tb/iEMS/abs_pos_i
add wave -noupdate /ems_1_tb/iEMS/abs_pos_init
add wave -noupdate /ems_1_tb/iEMS/iP1_FILT/clk
add wave -noupdate /ems_1_tb/iEMS/iP1_FILT/reset_n
add wave -noupdate /ems_1_tb/iEMS/iP1_FILT/ld_cfg
add wave -noupdate /ems_1_tb/iEMS/iP1_FILT/filt_order
add wave -noupdate /ems_1_tb/iEMS/iP1_FILT/hyst
add wave -noupdate /ems_1_tb/iEMS/iP1_FILT/filt_in
add wave -noupdate /ems_1_tb/iEMS/iP1_FILT/filt_out
add wave -noupdate /ems_1_tb/iEMS/iP1_FILT/rEdge
add wave -noupdate /ems_1_tb/iEMS/iP1_FILT/fEdge
add wave -noupdate /ems_1_tb/iEMS/iP1_FILT/sig_ii
add wave -noupdate /ems_1_tb/iEMS/iP1_FILT/sig_i
add wave -noupdate /ems_1_tb/iEMS/iP1_FILT/sig
add wave -noupdate -radix unsigned /ems_1_tb/iEMS/iP1_FILT/filt_order_i
add wave -noupdate -radix unsigned /ems_1_tb/iEMS/iP1_FILT/cnt_ones
add wave -noupdate /ems_1_tb/iEMS/iP1_FILT/hyst_i
add wave -noupdate /ems_1_tb/iEMS/iP1_FILT/delay_line
add wave -noupdate -divider EMUL
add wave -noupdate /ems_1_tb/iEMUL/clk
add wave -noupdate /ems_1_tb/iEMUL/reset_n
add wave -noupdate /ems_1_tb/iEMUL/ttl_pd
add wave -noupdate /ems_1_tb/iEMUL/ttl_enc_p1
add wave -noupdate /ems_1_tb/iEMUL/ttl_enc_p2
add wave -noupdate /ems_1_tb/iEMUL/ttl_enc_zp
add wave -noupdate /ems_1_tb/iEMUL/rs422_pd
add wave -noupdate /ems_1_tb/iEMUL/rs422_enc_p1
add wave -noupdate /ems_1_tb/iEMUL/rs422_enc_p2
add wave -noupdate /ems_1_tb/iEMUL/rs422_enc_zp
add wave -noupdate -radix decimal /ems_1_tb/iEMUL/abs_pos_out
add wave -noupdate /ems_1_tb/iEMUL/set_pos_out
add wave -noupdate /ems_1_tb/iEMUL/inc_pos_out
add wave -noupdate /ems_1_tb/iEMUL/dec_pos_out
add wave -noupdate /ems_1_tb/iEMUL/avs_address
add wave -noupdate /ems_1_tb/iEMUL/avs_write
add wave -noupdate /ems_1_tb/iEMUL/avs_writedata
add wave -noupdate /ems_1_tb/iEMUL/avs_read
add wave -noupdate /ems_1_tb/iEMUL/avs_readdata
add wave -noupdate /ems_1_tb/iEMUL/enc_init
add wave -noupdate /ems_1_tb/iEMUL/nco_inc_en
add wave -noupdate /ems_1_tb/iEMUL/enc_dir
add wave -noupdate /ems_1_tb/iEMUL/enc_p1
add wave -noupdate /ems_1_tb/iEMUL/enc_p2
add wave -noupdate /ems_1_tb/iEMUL/enc_p1_d
add wave -noupdate /ems_1_tb/iEMUL/enc_p2_d
add wave -noupdate /ems_1_tb/iEMUL/pulse_cnt_inc
add wave -noupdate /ems_1_tb/iEMUL/pulse_cnt_inc_d
add wave -noupdate /ems_1_tb/iEMUL/max_pulses_start
add wave -noupdate /ems_1_tb/iEMUL/avs_read_d
add wave -noupdate /ems_1_tb/iEMUL/max_pulses_en
add wave -noupdate /ems_1_tb/iEMUL/pulse_cnt_start
add wave -noupdate /ems_1_tb/iEMUL/pulse_cnt_stop
add wave -noupdate /ems_1_tb/iEMUL/max_pulses_done
add wave -noupdate /ems_1_tb/iEMUL/zero_phase
add wave -noupdate /ems_1_tb/iEMUL/pulse_cnt_running
add wave -noupdate /ems_1_tb/iEMUL/ttl_pd_en
add wave -noupdate /ems_1_tb/iEMUL/ttl_enc_p1_en
add wave -noupdate /ems_1_tb/iEMUL/ttl_enc_p2_en
add wave -noupdate /ems_1_tb/iEMUL/ttl_enc_zp_en
add wave -noupdate /ems_1_tb/iEMUL/rs422_pd_en
add wave -noupdate /ems_1_tb/iEMUL/enc_zp
add wave -noupdate /ems_1_tb/iEMUL/ttl_pd_fh
add wave -noupdate /ems_1_tb/iEMUL/ttl_enc_p1_fh
add wave -noupdate /ems_1_tb/iEMUL/ttl_enc_p2_fh
add wave -noupdate /ems_1_tb/iEMUL/ttl_enc_zp_fh
add wave -noupdate /ems_1_tb/iEMUL/rs422_pd_fh
add wave -noupdate /ems_1_tb/iEMUL/rs422_enc_p1_fh
add wave -noupdate /ems_1_tb/iEMUL/rs422_enc_p2_fh
add wave -noupdate /ems_1_tb/iEMUL/rs422_enc_zp_fh
add wave -noupdate /ems_1_tb/iEMUL/rs422_enc_p1_en
add wave -noupdate /ems_1_tb/iEMUL/rs422_enc_p2_en
add wave -noupdate /ems_1_tb/iEMUL/rs422_enc_zp_en
add wave -noupdate /ems_1_tb/iEMUL/enc_emul_en
add wave -noupdate /ems_1_tb/iEMUL/inc_pos
add wave -noupdate /ems_1_tb/iEMUL/dec_pos
add wave -noupdate /ems_1_tb/iEMUL/set_abs_pos
add wave -noupdate /ems_1_tb/iEMUL/avs_write_i
add wave -noupdate /ems_1_tb/iEMUL/seq_ram_write
add wave -noupdate /ems_1_tb/iEMUL/seq_csr_write
add wave -noupdate /ems_1_tb/iEMUL/avs_read_i
add wave -noupdate /ems_1_tb/iEMUL/seq_ram_read
add wave -noupdate /ems_1_tb/iEMUL/seq_csr_read
add wave -noupdate /ems_1_tb/iEMUL/seq_start_req
add wave -noupdate /ems_1_tb/iEMUL/seq_busy
add wave -noupdate /ems_1_tb/iEMUL/ext_trigger
add wave -noupdate /ems_1_tb/iEMUL/us_pulse
add wave -noupdate /ems_1_tb/iEMUL/ms_pulse
add wave -noupdate /ems_1_tb/iEMUL/sec_pulse
add wave -noupdate /ems_1_tb/iEMUL/pd
add wave -noupdate /ems_1_tb/iEMUL/pd_d
add wave -noupdate /ems_1_tb/iEMUL/pd_pulse
add wave -noupdate /ems_1_tb/iEMUL/clr_pd_cnt
add wave -noupdate /ems_1_tb/iEMUL/pd_gen
add wave -noupdate /ems_1_tb/iEMUL/pd_seq
add wave -noupdate /ems_1_tb/iEMUL/pd_emul_en
add wave -noupdate /ems_1_tb/iEMUL/pd_i
add wave -noupdate /ems_1_tb/iEMUL/max_pulses_start_i
add wave -noupdate /ems_1_tb/iEMUL/seq_pulses_start
add wave -noupdate /ems_1_tb/iEMUL/enc_dir_i
add wave -noupdate /ems_1_tb/iEMUL/pulse_dir
add wave -noupdate /ems_1_tb/iEMUL/seq_vec_out
add wave -noupdate /ems_1_tb/iEMUL/seq_csr_addr
add wave -noupdate /ems_1_tb/iEMUL/clk_cnt
add wave -noupdate /ems_1_tb/iEMUL/seq_trigger_in
add wave -noupdate /ems_1_tb/iEMUL/seq_ram_addr
add wave -noupdate /ems_1_tb/iEMUL/seq_start_addr
add wave -noupdate /ems_1_tb/iEMUL/avs_addr_i
add wave -noupdate /ems_1_tb/iEMUL/us_cnt
add wave -noupdate /ems_1_tb/iEMUL/ms_cnt
add wave -noupdate /ems_1_tb/iEMUL/zero_phase_ppr
add wave -noupdate /ems_1_tb/iEMUL/zero_phase_cnt
add wave -noupdate /ems_1_tb/iEMUL/pd_pulse_width
add wave -noupdate /ems_1_tb/iEMUL/pd_pulse_cnt
add wave -noupdate /ems_1_tb/iEMUL/pd_cnt
add wave -noupdate /ems_1_tb/iEMUL/enc_nco_1
add wave -noupdate /ems_1_tb/iEMUL/enc_nco_2
add wave -noupdate /ems_1_tb/iEMUL/nco_inc
add wave -noupdate /ems_1_tb/iEMUL/avs_readdata_i
add wave -noupdate -radix unsigned /ems_1_tb/iEMUL/seq_pulses
add wave -noupdate /ems_1_tb/iEMUL/seq_ram_writedata
add wave -noupdate /ems_1_tb/iEMUL/seq_csr_writedata
add wave -noupdate /ems_1_tb/iEMUL/seq_ram_readdata
add wave -noupdate /ems_1_tb/iEMUL/seq_csr_readdata
add wave -noupdate /ems_1_tb/iEMUL/max_pulses
add wave -noupdate /ems_1_tb/iEMUL/max_pulses_i
add wave -noupdate /ems_1_tb/iEMUL/pulse_cnt
add wave -noupdate /ems_1_tb/iEMUL/abs_pos
add wave -noupdate /ems_1_tb/iEMUL/abs_pos_init
add wave -noupdate -divider {Encoder Multiply}
add wave -noupdate /ems_1_tb/iEMS/iMULT/reset_n
add wave -noupdate /ems_1_tb/iEMS/iMULT/clk
add wave -noupdate /ems_1_tb/iEMS/iMULT/init
add wave -noupdate /ems_1_tb/iEMS/iMULT/enable
add wave -noupdate /ems_1_tb/iEMS/iMULT/mult_sel
add wave -noupdate /ems_1_tb/iEMS/iMULT/delta_t
add wave -noupdate /ems_1_tb/iEMS/iMULT/step_pos_in
add wave -noupdate /ems_1_tb/iEMS/iMULT/step_neg_in
add wave -noupdate /ems_1_tb/iEMS/iMULT/step_pos_out
add wave -noupdate /ems_1_tb/iEMS/iMULT/step_neg_out
add wave -noupdate /ems_1_tb/iEMS/iMULT/init_d
add wave -noupdate /ems_1_tb/iEMS/iMULT/step_pos
add wave -noupdate /ems_1_tb/iEMS/iMULT/step_neg
add wave -noupdate /ems_1_tb/iEMS/iMULT/m_step_pos
add wave -noupdate /ems_1_tb/iEMS/iMULT/m_step_neg
add wave -noupdate /ems_1_tb/iEMS/iMULT/sign
add wave -noupdate /ems_1_tb/iEMS/iMULT/sign_i
add wave -noupdate /ems_1_tb/iEMS/iMULT/time_cnt_tc
add wave -noupdate /ems_1_tb/iEMS/iMULT/norm_pos
add wave -noupdate /ems_1_tb/iEMS/iMULT/norm_neg
add wave -noupdate /ems_1_tb/iEMS/iMULT/kickoff
add wave -noupdate /ems_1_tb/iEMS/iMULT/pending_kickoff
add wave -noupdate /ems_1_tb/iEMS/iMULT/realign_pos
add wave -noupdate /ems_1_tb/iEMS/iMULT/realign_neg
add wave -noupdate /ems_1_tb/iEMS/iMULT/realign_pos_d
add wave -noupdate /ems_1_tb/iEMS/iMULT/realign_neg_d
add wave -noupdate /ems_1_tb/iEMS/iMULT/realign_pos_i
add wave -noupdate /ems_1_tb/iEMS/iMULT/realign_neg_i
add wave -noupdate /ems_1_tb/iEMS/iMULT/delay_vect
add wave -noupdate /ems_1_tb/iEMS/iMULT/pulse_cnt
add wave -noupdate /ems_1_tb/iEMS/iMULT/m_pulse_cnt
add wave -noupdate /ems_1_tb/iEMS/iMULT/m_norm_value
add wave -noupdate /ems_1_tb/iEMS/iMULT/delta_m
add wave -noupdate /ems_1_tb/iEMS/iMULT/time_cnt
add wave -noupdate /ems_1_tb/iEMS/iMULT/m_delta_t
add wave -noupdate /ems_1_tb/iEMS/iMULT/delta_t_i
add wave -noupdate -divider {Velocity Estimation}
add wave -noupdate /ems_1_tb/iEMS/iVEL_MEAS/reset_n
add wave -noupdate /ems_1_tb/iEMS/iVEL_MEAS/clk
add wave -noupdate /ems_1_tb/iEMS/iVEL_MEAS/init
add wave -noupdate /ems_1_tb/iEMS/iVEL_MEAS/enable
add wave -noupdate /ems_1_tb/iEMS/iVEL_MEAS/avg_steps
add wave -noupdate /ems_1_tb/iEMS/iVEL_MEAS/delta_init
add wave -noupdate /ems_1_tb/iEMS/iVEL_MEAS/time_out
add wave -noupdate /ems_1_tb/iEMS/iVEL_MEAS/step_pos
add wave -noupdate /ems_1_tb/iEMS/iVEL_MEAS/step_neg
add wave -noupdate /ems_1_tb/iEMS/iVEL_MEAS/delta_t
add wave -noupdate /ems_1_tb/iEMS/iVEL_MEAS/step_pos_out
add wave -noupdate /ems_1_tb/iEMS/iVEL_MEAS/step_neg_out
add wave -noupdate /ems_1_tb/iEMS/iVEL_MEAS/time_out_flag
add wave -noupdate /ems_1_tb/iEMS/iVEL_MEAS/step_type
add wave -noupdate /ems_1_tb/iEMS/iVEL_MEAS/step_pos_i
add wave -noupdate /ems_1_tb/iEMS/iVEL_MEAS/step_neg_i
add wave -noupdate /ems_1_tb/iEMS/iVEL_MEAS/inc_last
add wave -noupdate /ems_1_tb/iEMS/iVEL_MEAS/inc_first
add wave -noupdate /ems_1_tb/iEMS/iVEL_MEAS/avg_transient_on
add wave -noupdate /ems_1_tb/iEMS/iVEL_MEAS/init_i
add wave -noupdate /ems_1_tb/iEMS/iVEL_MEAS/time_out_flag_i
add wave -noupdate /ems_1_tb/iEMS/iVEL_MEAS/new_step
add wave -noupdate /ems_1_tb/iEMS/iVEL_MEAS/inc_step_balance
add wave -noupdate /ems_1_tb/iEMS/iVEL_MEAS/dec_step_balance
add wave -noupdate /ems_1_tb/iEMS/iVEL_MEAS/inc_step_cnt
add wave -noupdate /ems_1_tb/iEMS/iVEL_MEAS/write_last
add wave -noupdate /ems_1_tb/iEMS/iVEL_MEAS/first_step
add wave -noupdate /ems_1_tb/iEMS/iVEL_MEAS/time_out_flag_d
add wave -noupdate /ems_1_tb/iEMS/iVEL_MEAS/last_step_type
add wave -noupdate /ems_1_tb/iEMS/iVEL_MEAS/enforce_delta_min
add wave -noupdate /ems_1_tb/iEMS/iVEL_MEAS/data_valid
add wave -noupdate /ems_1_tb/iEMS/iVEL_MEAS/step_cnt
add wave -noupdate /ems_1_tb/iEMS/iVEL_MEAS/step_bal_m1
add wave -noupdate /ems_1_tb/iEMS/iVEL_MEAS/step_balance
add wave -noupdate /ems_1_tb/iEMS/iVEL_MEAS/first_addr
add wave -noupdate /ems_1_tb/iEMS/iVEL_MEAS/last_addr
add wave -noupdate /ems_1_tb/iEMS/iVEL_MEAS/loc_time
add wave -noupdate /ems_1_tb/iEMS/iVEL_MEAS/time_out_cnt
add wave -noupdate /ems_1_tb/iEMS/iVEL_MEAS/time_diff
add wave -noupdate /ems_1_tb/iEMS/iVEL_MEAS/time_diff_i
add wave -noupdate /ems_1_tb/iEMS/iVEL_MEAS/delta_t_i
add wave -noupdate /ems_1_tb/iEMS/iVEL_MEAS/new_tag
add wave -noupdate /ems_1_tb/iEMS/iVEL_MEAS/tag_last_i
add wave -noupdate /ems_1_tb/iEMS/iVEL_MEAS/tag_first
add wave -noupdate /ems_1_tb/iEMS/iVEL_MEAS/tag_last
TreeUpdate [SetDefaultTree]
WaveRestoreCursors {{Cursor 1} {693702850 ps} 0}
quietly wave cursor active 1
configure wave -namecolwidth 301
configure wave -valuecolwidth 116
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 {683284264 ps} {714445736 ps}

View file

@ -0,0 +1,538 @@
-------------------------------------------------------------------------------
-- Title : ems
-- Project : SMB
-------------------------------------------------------------------------------
-- File : ems.vhd
-- Author : Gianmarco Girau
-- Company : Global Inkjet Systems
-- Created : 2018-05-24
-- Last update: 2021-06-09
-- SVN ID : Git
-- Standard : VHDL 2008
-------------------------------------------------------------------------------
-- Description:
-- EMS: Encoder (and Product Detect) Management System.
-- This version of the EMS is completely different from the one
-- implemented on the PMB, and natively uses the concept of absolute
-- position.
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity ems_1 is
generic(
ADD_ENC_ZP_LOGIC : boolean := true;
ADD_MULT_DEBUG_REG : boolean := true;
GEN_PRINT_START : boolean := false);
port (
clk : in std_logic;
reset_n : in std_logic := '1';
init : in std_logic;
-- Avalon-MM I/F
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_readdata : out std_logic_vector(31 downto 0);
-- EMS inputs
rs422_pd : in std_logic;
rs422_p1 : in std_logic;
rs422_p2 : in std_logic;
rs422_zp : in std_logic;
ttl_pd : in std_logic;
ttl_pd_npn : in std_logic;
ttl_p1 : in std_logic;
ttl_p2 : in std_logic;
ttl_zp : in std_logic;
--
abs_position : out std_logic_vector(31 downto 0);
pd_out : out std_logic;
print_start : out std_logic := '1';
-- diagnostics
set_pos : out std_logic; -- to the diagnostic block
inc_pos : out std_logic; -- to the diagnostic block
dec_pos : out std_logic; -- to the diagnostic block
filt_p1 : out std_logic;
filt_p2 : out std_logic;
filt_zp : out std_logic;
filt_pd : out std_logic);
end entity ems_1;
architecture rtl of ems_1 is
constant DEFAULT_FILT_ORDER : positive := 14;
constant DEFAULT_FILT_HYST : positive := 2;
signal init_i, ttl_pd_i, sel_ttl_npn, pd_mux : std_logic;
signal p1_mux, p2_mux, zp_mux, ems_init : std_logic;
signal pd_i, pd_re, pd_fe, p1_i, p1_re, p1_fe : std_logic;
signal p2_i, p2_re, p2_fe, zp_i, p1_re_i : std_logic;
signal p1_fe_i, p2_re_i, p2_fe_i, enc_ph1_en : std_logic;
signal enc_ph2_en, enc_rising_en, enc_falling_en : std_logic;
signal step_pos_i, step_neg_i, step_pos, step_neg : std_logic;
signal set_pos_i, set_abs_pos, wrap_pos, wrap_neg : std_logic;
signal inc_pos_i, dec_pos_i, ems_enable : std_logic;
signal pd_hyst_filt, set_pd_hyst_filt, pd_event : std_logic;
signal clr_pd_hyst_filt, sw_pos_step, sw_neg_step : std_logic;
signal pd_rising_en, pd_falling_en, sw_pd : std_logic;
signal pd, kickstart_pd, sw_clr_pd_hyst_filt : std_logic;
signal ld_filt_cfg_pd, ld_filt_cfg_zp : std_logic;
signal ld_filt_cfg_p1, ld_filt_cfg_p2 : std_logic;
signal switch_pos_neg_inc, step_pos_ii, step_neg_ii : std_logic;
signal enc_enable, enc_enable_i : std_logic;
signal pd_enable, pd_enable_i : std_logic;
signal wrap_pos_i, wrap_neg_i, use_multiplier : std_logic;
signal m_step_pos, m_step_neg : std_logic;
signal step_pos_retimed, step_neg_retimed : std_logic;
signal init_mult, enable_mult : std_logic;
signal add_enc_zp, add_mult_dbg_regs : std_logic;
--
signal enc_sel : std_logic_vector( 1 downto 0);
signal pd_sel, mult_sel, pd_delay_line : std_logic_vector( 2 downto 0);
signal enc_cnt, enc_divide : std_logic_vector( 3 downto 0);
signal filt_order, filt_hyst : std_logic_vector( 4 downto 0);
signal avg_steps : std_logic_vector( 6 downto 0);
signal pd_hyst_val : std_logic_vector(15 downto 0);
signal pd_hyst_pos_cnt, pd_hyst_neg_cnt : std_logic_vector(15 downto 0);
signal hw_pd_cnt, total_pd_cnt : std_logic_vector(15 downto 0);
signal delta_init, time_out : std_logic_vector(27 downto 0);
signal abs_pos_i, abs_pos_init : std_logic_vector(31 downto 0);
signal abs_pos_in, abs_pos_vel : std_logic_vector(31 downto 0);
signal delta_t : std_logic_vector(31 downto 0);
begin
pINIT : process(clk)
begin
if(clk = '1' and clk'event) then
init_i <= init or ems_init;
end if;
end process pINIT;
-----------------------------------------------------------------------------
-- Input selection and conditioning
-----------------------------------------------------------------------------
-- NOTE: on the SMB none of the TTL input are inverted
ttl_pd_i <= ttl_pd when sel_ttl_npn = '0' else ttl_pd_npn;
-- Input multiplexers
pd_mux <= rs422_pd when pd_sel(0) = '0' else ttl_pd_i;
p1_mux <= rs422_p1 when enc_sel(0) = '0' else ttl_p1;
p2_mux <= rs422_p2 when enc_sel(0) = '0' else ttl_p2;
-- Filters
iPD_FILT: entity work.digital_lpf
generic map (
MAX_ORDER => 32,
DEFAULT_ORDER => DEFAULT_FILT_ORDER,
DEFAULT_HYST => DEFAULT_FILT_HYST)
port map (
clk => clk,
reset_n => reset_n,
ld_cfg => ld_filt_cfg_pd,
filt_order => filt_order,
hyst => filt_hyst,
filt_in => pd_mux,
filt_out => pd_i,
rEdge => pd_re,
fEdge => pd_fe);
iP1_FILT: entity work.digital_lpf
generic map (
MAX_ORDER => 32,
DEFAULT_ORDER => DEFAULT_FILT_ORDER,
DEFAULT_HYST => DEFAULT_FILT_HYST)
port map (
clk => clk,
reset_n => reset_n,
ld_cfg => ld_filt_cfg_p1,
filt_order => filt_order,
hyst => filt_hyst,
filt_in => p1_mux,
filt_out => p1_i,
rEdge => p1_re,
fEdge => p1_fe);
iP2_FILT: entity work.digital_lpf
generic map (
MAX_ORDER => 32,
DEFAULT_ORDER => DEFAULT_FILT_ORDER,
DEFAULT_HYST => DEFAULT_FILT_HYST)
port map (
clk => clk,
reset_n => reset_n,
ld_cfg => ld_filt_cfg_p2,
filt_order => filt_order,
hyst => filt_hyst,
filt_in => p2_mux,
filt_out => p2_i,
rEdge => p2_re,
fEdge => p2_fe);
gENC_ZP_FILT: if ADD_ENC_ZP_LOGIC = true generate
add_enc_zp <= '1';
zp_mux <= rs422_zp when enc_sel(0) = '0' else ttl_zp;
iZP_FILT: entity work.digital_lpf
generic map (
MAX_ORDER => 32,
DEFAULT_ORDER => DEFAULT_FILT_ORDER,
DEFAULT_HYST => DEFAULT_FILT_HYST)
port map (
clk => clk,
reset_n => reset_n,
ld_cfg => ld_filt_cfg_zp,
filt_order => filt_order,
hyst => filt_hyst,
filt_in => zp_mux,
filt_out => zp_i);
-- Buffer the filtered signals
pZP_FiltOut_Buf : process(clk)
begin
if(clk = '1' and clk'event) then
filt_zp <= zp_i;
end if;
end process pZP_FiltOut_Buf;
else generate
add_enc_zp <= '0';
filt_zp <= '0';
end generate gENC_ZP_FILT;
-- Buffer the filtered signals
pFiltOut_Buf : process(clk)
begin
if(clk = '1' and clk'event) then
filt_pd <= pd_i;
filt_p1 <= p1_i;
filt_p2 <= p2_i;
end if;
end process pFiltOut_Buf;
-- W&H Print-Start digital filter
gPS: if GEN_PRINT_START = true generate
iPS_FILT: entity work.digital_lpf
generic map (
MAX_ORDER => 32,
DEFAULT_ORDER => DEFAULT_FILT_ORDER,
DEFAULT_HYST => DEFAULT_FILT_HYST)
port map (
clk => clk,
reset_n => reset_n,
ld_cfg => ld_filt_cfg_pd,
filt_order => filt_order,
hyst => filt_hyst,
filt_in => ttl_pd_npn,
filt_out => print_start,
rEdge => open,
fEdge => open);
end generate gPS;
-----------------------------------------------------------------------------
-- Encoder Detection
-----------------------------------------------------------------------------
p1_re_i <= p1_re and enc_ph1_en and enc_rising_en;
p1_fe_i <= p1_fe and enc_ph1_en and enc_falling_en;
p2_re_i <= p2_re and enc_ph2_en and enc_rising_en;
p2_fe_i <= p2_fe and enc_ph2_en and enc_falling_en;
pENC_DET: process(all)
variable det_array : std_logic_vector(3 downto 0);
begin
det_array := p1_re_i & p1_fe_i & p2_re_i & p2_fe_i;
step_pos_i <= '0';
step_neg_i <= '0';
case det_array is
when b"1000" => -- phase-1 rising edge
if enc_ph2_en = '0' or p2_i = '0' then
step_pos_i <= '1';
else
step_neg_i <= '1';
end if;
when b"0100" => -- phase-1 falling edge
if enc_ph2_en = '0' or p2_i = '1' then
step_pos_i <= '1';
else
step_neg_i <= '1';
end if;
when b"0010" => -- phase-2 rising edge
if enc_ph1_en = '0' or p1_i = '1' then
step_pos_i <= '1';
else
step_neg_i <= '1';
end if;
when b"0001" => -- phase-2 falling edge
if enc_ph1_en = '0' or p1_i = '0' then
step_pos_i <= '1';
else
step_neg_i <= '1';
end if;
when others =>
null;
end case;
end process pENC_DET;
-- NOTE: ~The encoder jitter and the dual-phase directionality management are
-- performed in the pulse generator block.
pENC_REGs : process(clk)
begin
if(clk = '1' and clk'event) then
-- Encoder division: to be used ONLY when the maximum encoder rate
-- exceeds the transmission bandwidth over the POF (~4Mbps)
if(set_pos_i = '1' or wrap_pos_i = '1') then
enc_cnt <= (others => '0');
elsif(wrap_neg_i = '1') then
enc_cnt <= enc_divide;
elsif(step_pos = '1') then
enc_cnt <= std_logic_vector(unsigned(enc_cnt)+1);
elsif(step_neg = '1') then
enc_cnt <= std_logic_vector(unsigned(enc_cnt)-1);
end if;
-- latch wrap_pos and wrap_neg to prevent a long combinational path
inc_pos_i <= wrap_pos;
dec_pos_i <= wrap_neg;
if(set_pos_i = '1') then
abs_pos_i <= abs_pos_init;
elsif(inc_pos_i = '1') then
abs_pos_i <= std_logic_vector(signed(abs_pos_i)+1);
elsif(dec_pos_i = '1') then
abs_pos_i <= std_logic_vector(signed(abs_pos_i)-1);
end if;
set_pos <= set_pos_i;
inc_pos <= inc_pos_i;
dec_pos <= dec_pos_i;
init_mult <= set_pos_i;
enable_mult <= enc_enable_i;
end if;
end process pENC_REGs;
enc_enable_i <= enc_enable and ems_enable;
set_pos_i <= init_i or set_abs_pos;
step_pos_ii <= enc_enable_i and ((step_pos_i and not enc_sel(1)) or (sw_pos_step and enc_sel(1)));
step_neg_ii <= enc_enable_i and ((step_neg_i and not enc_sel(1)) or (sw_neg_step and enc_sel(1)));
step_pos <= step_pos_ii when switch_pos_neg_inc = '0' else step_neg_ii;
step_neg <= step_neg_ii when switch_pos_neg_inc = '0' else step_pos_ii;
wrap_pos_i <= '1' when step_pos = '1' and unsigned(enc_cnt) = unsigned(enc_divide) else '0';
wrap_neg_i <= '1' when step_neg = '1' and unsigned(enc_cnt) = 0 else '0';
wrap_pos <= wrap_pos_i when use_multiplier = '0' else m_step_pos;
wrap_neg <= wrap_neg_i when use_multiplier = '0' else m_step_neg;
abs_position <= abs_pos_i;
gMULT_DBG_REGs: if ADD_MULT_DEBUG_REG = true generate
add_mult_dbg_regs <= '1';
pMULT_DBG_REGs : process(clk)
begin
if(clk = '1' and clk'event) then
if(set_pos_i = '1') then
abs_pos_in <= abs_pos_init;
elsif(step_pos = '1') then
abs_pos_in <= std_logic_vector(signed(abs_pos_in)+1);
elsif(step_neg = '1') then
abs_pos_in <= std_logic_vector(signed(abs_pos_in)-1);
end if;
if(set_pos_i = '1') then
abs_pos_vel <= abs_pos_init;
elsif(step_pos_retimed = '1') then
abs_pos_vel <= std_logic_vector(signed(abs_pos_vel)+1);
elsif(step_neg_retimed = '1') then
abs_pos_vel <= std_logic_vector(signed(abs_pos_vel)-1);
end if;
end if;
end process pMULT_DBG_REGs;
else generate
add_mult_dbg_regs <= '0';
end generate gMULT_DBG_REGs;
-----------------------------------------------------------------------------
-- Product Detect management
-----------------------------------------------------------------------------
pPD_MNG : process(clk)
begin
if(clk = '1' and clk'event) then
if(init_i = '1' or clr_pd_hyst_filt = '1' or sw_clr_pd_hyst_filt = '1') then
pd_hyst_filt <= '0';
elsif(set_pd_hyst_filt = '1') then
pd_hyst_filt <= '1';
end if;
if(set_pd_hyst_filt = '1') then
pd_hyst_pos_cnt <= pd_hyst_val;
elsif(step_pos = '1') then
pd_hyst_pos_cnt <= std_logic_vector(unsigned(pd_hyst_pos_cnt)-1);
end if;
if(set_pd_hyst_filt = '1') then
pd_hyst_neg_cnt <= pd_hyst_val;
elsif(step_neg = '1') then
pd_hyst_neg_cnt <= std_logic_vector(unsigned(pd_hyst_neg_cnt)-1);
end if;
pd <= kickstart_pd or (not pd_hyst_filt and pd_enable_i and (pd_event or sw_pd));
if(init_i = '1') then
pd_delay_line <= (others => '0');
else
pd_delay_line <= pd_delay_line(pd_delay_line'left-1 downto 0) & pd;
end if;
if(init_i = '1') then
hw_pd_cnt <= (others => '0');
elsif(pd_event = '1' and pd_hyst_filt = '0' and pd_enable_i = '1') then
hw_pd_cnt <= std_logic_vector(unsigned(hw_pd_cnt)+1);
end if;
if(init_i = '1') then
total_pd_cnt <= (others => '0');
elsif((pd_event = '1' or sw_pd = '1') and pd_hyst_filt = '0' and pd_enable_i = '1') then
total_pd_cnt <= std_logic_vector(unsigned(total_pd_cnt)+1);
end if;
end if;
end process pPD_MNG;
pd_enable_i <= pd_enable and ems_enable;
-- hardware pd event:
pd_event <= not pd_sel(1) and ((pd_re and pd_rising_en) or (pd_fe and pd_falling_en));
-- Note: the hysteresis mechanism is not triggered in case of a kickstart-pd
-- (a PD event added when ems_enable = '0' and used for initial
-- synchronization only)
set_pd_hyst_filt <= '1' when pd_enable_i = '1' and (pd_event = '1' or sw_pd = '1') else '0';
clr_pd_hyst_filt <= '1' when pd_hyst_filt = '1' and (pd_enable_i = '0' or unsigned(pd_hyst_pos_cnt) = 0 or unsigned(pd_hyst_neg_cnt) = 0) else '0';
-- when the multiplier is enabled, compensate for the latency in the absolute
-- position introduced by the multiplier
pd_out <= pd when enable_mult = '0' else pd_delay_line(pd_delay_line'left);
-----------------------------------------------------------------------------
-- Velocity Estimation & Encoder Multiplication
-----------------------------------------------------------------------------
-- Encoder Multiplier
iMULT : entity work.encoder_multiply_0
port map (
reset_n => reset_n,
clk => clk,
init => init_mult,
enable => enable_mult,
mult_sel => mult_sel,
delta_t => delta_t,
step_pos_in => step_pos_retimed,
step_neg_in => step_neg_retimed,
step_pos_out => m_step_pos,
step_neg_out => m_step_neg);
-- Average Velocity Estimation
iVEL_MEAS: entity work.encoder_speed_detect_0
port map (
reset_n => reset_n,
clk => clk,
init => init_mult,
enable => enable_mult,
avg_steps => avg_steps,
delta_init => delta_init,
time_out => time_out,
--step_pos => step_pos,
--step_neg => step_neg,
step_pos => wrap_pos_i,
step_neg => wrap_neg_i,
delta_t => delta_t,
step_pos_out => step_pos_retimed,
step_neg_out => step_neg_retimed,
time_out_flag => open);
-----------------------------------------------------------------------------
-- C&S registers (Avalon-MM I/F)
-----------------------------------------------------------------------------
sel_ttl_npn <= pd_sel(2);
ems_1_csr_regs_inst : entity work.ems_1_csr_regs
generic map (
ADDR_DECODE_WIDTH => 4
)
port map (
-- Clock and reset
clk => clk,
rst_n => reset_n,
-- auto-generated
-- Internal signal ports
ems_enable_init => ems_init,
ems_enable_ems_enable => ems_enable,
ems_enable_enc_enable => enc_enable,
ems_enable_pd_enable => pd_enable,
ems_config_enc_sel => enc_sel,
ems_config_pd_sel => pd_sel,
ems_config_enc_ph1_en => enc_ph1_en,
ems_config_enc_ph2_en => enc_ph2_en,
ems_config_enc_rising_en => enc_rising_en,
ems_config_enc_falling_en => enc_falling_en,
ems_config_pd_rising_en => pd_rising_en,
ems_config_pd_falling_en => pd_falling_en,
ems_config_switch_pos_neg_inc => switch_pos_neg_inc,
pd_hyst_pd_hyst_val => pd_hyst_val,
pd_hyst_clr_pd_hyst => sw_clr_pd_hyst_filt,
enc_divide => enc_divide,
abs_pos_preset => abs_pos_init,
filt_cfg_filter_order => filt_order,
filt_cfg_filter_hyst => filt_hyst,
mult_cfg_use_multiplier => use_multiplier,
mult_cfg_mult_sel => mult_sel,
mult_cfg_vel_avg_steps => avg_steps,
delta_t_init => delta_init,
vel_timeout => time_out,
ems_config_set_abs_pos => set_abs_pos,
sw_ctrl_sw_pd => sw_pd,
sw_ctrl_kickstart_pd => kickstart_pd,
sw_ctrl_sw_pos_step => sw_pos_step,
sw_ctrl_sw_neg_step => sw_neg_step,
filt_cfg_ld_filt_cfg_pd => ld_filt_cfg_pd,
filt_cfg_ld_filt_cfg_p1 => ld_filt_cfg_p1,
filt_cfg_ld_filt_cfg_p2 => ld_filt_cfg_p2,
filt_cfg_ld_filt_cfg_zp => ld_filt_cfg_zp,
abs_pos_val => abs_pos_i,
pd_cnt_total_pd_cnt => total_pd_cnt,
pd_cnt_hw_pd_cnt => hw_pd_cnt,
abs_pos_in_stat => abs_pos_in,
abs_pos_vel_stat => abs_pos_vel,
-- end auto-generated
-- Slave bus port
avs_address => avs_address(3 downto 0),
avs_write => avs_write,
avs_writedata => avs_writedata,
avs_read => avs_read,
avs_readdata => avs_readdata
);
end architecture rtl;

File diff suppressed because it is too large Load diff

View file

@ -11,9 +11,9 @@
"process": "cpp, txt",
"offset": "0x0"
},
"generic_sequencer_15": {
"instance": "seq",
"process": "cpp, txt",
"generic_sequencer_17": {
"instance": "",
"process": "enabled",
"offset": "0x20"
}
},

View file

@ -0,0 +1,439 @@
[{
"ip_name": "enc_pd_emul_2",
"bus": "csr",
"addr_width" : "5",
"description": "Encoder/PD emulator",
"addr_hi_bit" : "6",
"addr_lo_bit" : "5",
"sub_blocks": {
"local": {
"instance": "",
"process": "cpp, txt",
"offset": "0x0"
},
"generic_sequencer_17": {
"instance": "",
"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" : "0x12",
"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"
}
}
},
"out_enable": {
"address": "2",
"width": "16",
"description": "TTL/RS422 Output Enable/Force output",
"fields": {
"ttl_pd_en": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "TTL PD output enable"
},
"ttl_ph1_en": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "TTL enc-phase-1 output enable"
},
"ttl_ph2_en": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "TTL enc-phase-2 output enable"
},
"ttl_zp_en": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "TTL enc-zero-phase output enable"
},
"rs422_pd_en": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "RS422 PD output enable"
},
"rs422_ph1_en": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "RS422 enc-phase-1 output enable"
},
"rs422_ph2_en": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "RS422 enc-phase-2 output enable"
},
"rs422_zp_en": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "RS422 enc-zero-phase output enable"
},
"ttl_pd_fh": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "TTL PD output force high"
},
"ttl_ph1_fh": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "TTL enc-phase-1 output force high"
},
"ttl_ph2_fh": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "TTL enc-phase-2 output force high"
},
"ttl_zp_fh": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "TTL enc-zero-phase output force high"
},
"rs422_pd_fh": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "RS422 PD output force high"
},
"rs422_ph1_fh": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "RS422 enc-phase-1 output force high"
},
"rs422_ph2_fh": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "RS422 enc-phase-2 output force high"
},
"rs422_zp_fh": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "RS422 enc-zero-phase output force high"
}
}
},
"out_status": {
"address": "3",
"width": "8",
"description": "Reports the status of TTL and RS422 outputs",
"fields": {
"ttl_pd": {
"type": "r",
"bit_len": "1",
"reset": "U",
"description": "TTL PD status"
},
"ttl_ph1": {
"type": "r",
"bit_len": "1",
"reset": "U",
"description": "TTL enc-phase-1 status"
},
"ttl_ph2": {
"type": "r",
"bit_len": "1",
"reset": "U",
"description": "TTL enc-phase-2 status"
},
"ttl_zp": {
"type": "r",
"bit_len": "1",
"reset": "U",
"description": "TTL enc-zp status"
},
"rs422_pd": {
"type": "r",
"bit_len": "1",
"reset": "U",
"description": "RS422 PD status"
},
"rs422_ph1": {
"type": "r",
"bit_len": "1",
"reset": "U",
"description": "RS422 enc-phase-1 status"
},
"rs422_ph2": {
"type": "r",
"bit_len": "1",
"reset": "U",
"description": "RS422 enc-phase-2 status"
},
"rs422_zp": {
"type": "r",
"bit_len": "1",
"reset": "U",
"description": "RS422 enc-zp status"
}
}
},
"enc_ctrl_w": {
"address": "4",
"width": "6",
"description": "Control the emulation of encoder signals",
"fields": {
"nco_en": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "enable the NCO increment"
},
"nco_init": {
"type": "w0",
"bit_len": "1",
"reset": "0x0",
"description": "force the NCO to the initial value"
},
"enc_dir": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "encoder/absolute position direction: 0 => positive, 1 => negative"
},
"set_abs_pos": {
"type": "w0",
"bit_len": "1",
"reset": "0x0",
"description": "force the absolute position to the (programmable) initial value"
},
"max_pulses_en": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "0 => NCO free running, 1 => the NCO automatically stops after a specified number of absolute position increments"
},
"max_pulses_start": {
"type": "w0",
"bit_len": "1",
"reset": "0x0",
"description": "start the generation of a fixed number of absolute position increments "
}
}
},
"enc_ctrl_r": {
"address": "5",
"width": "32",
"description": "Status",
"fields": {
"reserved0": {
"type": "rsv",
"bit_len": "6",
"description": "Reserved"
},
"max_pulses_done": {
"type": "r",
"bit_len": "1",
"reset": "0x0",
"description": "signals the completion of the encoder/absolute position increments"
},
"reserved1": {
"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"
}
}
},
"enc_nco_inc": {
"type": "w",
"address": "6",
"reset": "0x0",
"width": "32",
"description": "Encoder NCO increment"
},
"enc_pulse_num": {
"type": "w",
"address": "7",
"reset": "0x0",
"width": "32",
"description": "number of encoder/absolute position increments to be generated"
},
"enc_zp_ppr": {
"type": "w",
"address": "8",
"reset": "0x0",
"width": "16",
"description": "Zero-Phase PPR (Pulse-Per-Revolution)"
},
"pos_init_lsb": {
"type": "w",
"address": "9",
"reset": "0x0",
"width": "32",
"subtype": "signed",
"description": "Absolute Position Initial value, bits 31:0"
},
"pos_init_msb": {
"type": "w",
"address": "10",
"reset": "0x0",
"width": "8",
"subtype": "signed",
"description": "Absolute Position Initial value, bits 39:32"
},
"pos_stat_lsb": {
"type": "r",
"address": "11",
"reset": "0x0",
"width": "32",
"subtype": "signed",
"description": "Absolute Position value, bits 31:0"
},
"pos_stat_msb": {
"type": "r",
"address": "12",
"reset": "0x0",
"width": "8",
"subtype": "signed",
"description": "Absolute Position value, bits 39:32"
},
"pd_ctrl": {
"address": "13",
"description": "Control the emulation of PD",
"width": "3",
"fields": {
"pd_en": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "enable the generation of PD events"
},
"pd_gen": {
"type": "w0",
"bit_len": "1",
"reset": "0x0",
"description": "issue a PD pulse"
},
"clr_pd_cnt": {
"type": "w0",
"bit_len": "1",
"reset": "0x0",
"description": "clear the value of the PD counter register"
}
}
},
"pd_pulse_width": {
"type": "w",
"address": "14",
"reset": "0x14",
"width": "16",
"description": "PD pulse-width [clock-cycles at 100 MHz]. The minimum value is 1."
},
"pd_cnt": {
"type": "r",
"address": "15",
"reset": "0x0",
"width": "24",
"description": "PD pulse counter"
},
"seq_ctrl": {
"address": "16",
"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"
}
}
}
}
},
{
"ip_name" : "enc_pd_emul_2",
"bus" : "seq",
"addr_hi_bit" : "10",
"addr_lo_bit" : "9",
"description" : "Encoder/PD emulator sequencer ram",
"sub_blocks" : {
"generic_sequencer_17" : {
"instance" : "",
"process" : "cpp",
"offset" : "0x200"
}
}
}
]

View file

@ -0,0 +1,63 @@
# Simulation macro
#.main clear
# 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
vlib ./work
vmap work ./work
# Compile the UUT
vcom -2008 -work $WORKLIB $COMMON_PATH/common_pkg.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/altera/alt_rw_dp_ram.vhd
#vcom -2008 -work $WORKLIB $SEQUENCER_PATH/altera/generic_seq_ram_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_2_pkg_auto.vhd
vcom -2008 -work $WORKLIB ./../src/enc_pd_emul_2_csr_regs_auto.vhd
vcom -2008 -work $WORKLIB ./../src/enc_pd_emul_2.vhd
# 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 support files
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
# Compile the testbench
vcom -2008 -work $WORKLIB ./../src/test/enc_pd_emul_2_tb.vhd
vsim -t ps work.enc_pd_emul_2_tb
#add wave /enc_pd_emul_1_tb/*
#add wave /enc_pd_emul_1_tb/iUUT/*
# remove warnings from standard numeric/arithmetic packages (speed-up simulation)
set StdArithNoWarnings 1
set NumericStdNoWarnings 1
do wave_enc_pd_emul_2.do
when -label end_of_simulation {test_completed == true} {echo "Simulation Completed"; stop ;}
run -all
#run 100 us;

View file

@ -0,0 +1,153 @@
onerror {resume}
quietly WaveActivateNextPane {} 0
add wave -noupdate /enc_pd_emul_2_tb/reset_n
add wave -noupdate /enc_pd_emul_2_tb/clk
add wave -noupdate /enc_pd_emul_2_tb/ttl_pd
add wave -noupdate /enc_pd_emul_2_tb/ttl_enc_p1
add wave -noupdate /enc_pd_emul_2_tb/ttl_enc_p2
add wave -noupdate /enc_pd_emul_2_tb/ttl_enc_zp
add wave -noupdate /enc_pd_emul_2_tb/rs422_pd
add wave -noupdate /enc_pd_emul_2_tb/rs422_enc_p1
add wave -noupdate /enc_pd_emul_2_tb/rs422_enc_p2
add wave -noupdate /enc_pd_emul_2_tb/rs422_enc_zp
add wave -noupdate /enc_pd_emul_2_tb/avs_address
add wave -noupdate /enc_pd_emul_2_tb/avs_write
add wave -noupdate -radix hexadecimal /enc_pd_emul_2_tb/avs_writedata
add wave -noupdate /enc_pd_emul_2_tb/avs_read
add wave -noupdate /enc_pd_emul_2_tb/avs_readdatavalid
add wave -noupdate -radix hexadecimal /enc_pd_emul_2_tb/avs_readdata
add wave -noupdate /enc_pd_emul_2_tb/setup
add wave -noupdate /enc_pd_emul_2_tb/running
add wave -noupdate /enc_pd_emul_2_tb/passed
add wave -noupdate /enc_pd_emul_2_tb/failed
add wave -noupdate /enc_pd_emul_2_tb/test_timeout
add wave -noupdate /enc_pd_emul_2_tb/test_completed
add wave -noupdate /enc_pd_emul_2_tb/error_flag
add wave -noupdate -radix hexadecimal /enc_pd_emul_2_tb/avs_mm_s_rec
add wave -noupdate -radix hexadecimal /enc_pd_emul_2_tb/avs_mm_m_rec
add wave -noupdate -divider UUT
add wave -noupdate /enc_pd_emul_2_tb/iUUT/clk
add wave -noupdate /enc_pd_emul_2_tb/iUUT/reset_n
add wave -noupdate /enc_pd_emul_2_tb/iUUT/ttl_pd
add wave -noupdate /enc_pd_emul_2_tb/iUUT/ttl_enc_p1
add wave -noupdate /enc_pd_emul_2_tb/iUUT/ttl_enc_p2
add wave -noupdate /enc_pd_emul_2_tb/iUUT/ttl_enc_zp
add wave -noupdate /enc_pd_emul_2_tb/iUUT/rs422_pd
add wave -noupdate /enc_pd_emul_2_tb/iUUT/rs422_enc_p1
add wave -noupdate /enc_pd_emul_2_tb/iUUT/rs422_enc_p2
add wave -noupdate /enc_pd_emul_2_tb/iUUT/rs422_enc_zp
add wave -noupdate -radix decimal /enc_pd_emul_2_tb/iUUT/abs_pos_out
add wave -noupdate /enc_pd_emul_2_tb/iUUT/set_pos_out
add wave -noupdate /enc_pd_emul_2_tb/iUUT/inc_pos_out
add wave -noupdate /enc_pd_emul_2_tb/iUUT/dec_pos_out
add wave -noupdate /enc_pd_emul_2_tb/iUUT/avs_address
add wave -noupdate /enc_pd_emul_2_tb/iUUT/avs_write
add wave -noupdate -radix hexadecimal /enc_pd_emul_2_tb/iUUT/avs_writedata
add wave -noupdate /enc_pd_emul_2_tb/iUUT/avs_read
add wave -noupdate /enc_pd_emul_2_tb/iUUT/avs_readdatavalid
add wave -noupdate -radix hexadecimal /enc_pd_emul_2_tb/iUUT/avs_readdata
add wave -noupdate /enc_pd_emul_2_tb/iUUT/enc_init
add wave -noupdate /enc_pd_emul_2_tb/iUUT/nco_inc_en
add wave -noupdate /enc_pd_emul_2_tb/iUUT/enc_dir
add wave -noupdate /enc_pd_emul_2_tb/iUUT/enc_p1
add wave -noupdate /enc_pd_emul_2_tb/iUUT/enc_p2
add wave -noupdate /enc_pd_emul_2_tb/iUUT/enc_p1_d
add wave -noupdate /enc_pd_emul_2_tb/iUUT/enc_p2_d
add wave -noupdate /enc_pd_emul_2_tb/iUUT/pulse_cnt_inc
add wave -noupdate /enc_pd_emul_2_tb/iUUT/pulse_cnt_inc_d
add wave -noupdate /enc_pd_emul_2_tb/iUUT/max_pulses_start
add wave -noupdate /enc_pd_emul_2_tb/iUUT/max_pulses_en
add wave -noupdate /enc_pd_emul_2_tb/iUUT/pulse_cnt_start
add wave -noupdate /enc_pd_emul_2_tb/iUUT/pulse_cnt_stop
add wave -noupdate /enc_pd_emul_2_tb/iUUT/max_pulses_done
add wave -noupdate /enc_pd_emul_2_tb/iUUT/zero_phase
add wave -noupdate /enc_pd_emul_2_tb/iUUT/pulse_cnt_running
add wave -noupdate /enc_pd_emul_2_tb/iUUT/ttl_pd_en
add wave -noupdate /enc_pd_emul_2_tb/iUUT/ttl_enc_p1_en
add wave -noupdate /enc_pd_emul_2_tb/iUUT/ttl_enc_p2_en
add wave -noupdate /enc_pd_emul_2_tb/iUUT/ttl_enc_zp_en
add wave -noupdate /enc_pd_emul_2_tb/iUUT/rs422_pd_en
add wave -noupdate /enc_pd_emul_2_tb/iUUT/enc_zp
add wave -noupdate /enc_pd_emul_2_tb/iUUT/rs422_enc_p1_en
add wave -noupdate /enc_pd_emul_2_tb/iUUT/rs422_enc_p2_en
add wave -noupdate /enc_pd_emul_2_tb/iUUT/rs422_enc_zp_en
add wave -noupdate /enc_pd_emul_2_tb/iUUT/enc_emul_en
add wave -noupdate /enc_pd_emul_2_tb/iUUT/ttl_pd_fh
add wave -noupdate /enc_pd_emul_2_tb/iUUT/ttl_enc_p1_fh
add wave -noupdate /enc_pd_emul_2_tb/iUUT/ttl_enc_p2_fh
add wave -noupdate /enc_pd_emul_2_tb/iUUT/ttl_enc_zp_fh
add wave -noupdate /enc_pd_emul_2_tb/iUUT/rs422_pd_fh
add wave -noupdate /enc_pd_emul_2_tb/iUUT/rs422_enc_p1_fh
add wave -noupdate /enc_pd_emul_2_tb/iUUT/rs422_enc_p2_fh
add wave -noupdate /enc_pd_emul_2_tb/iUUT/rs422_enc_zp_fh
add wave -noupdate -radix unsigned /enc_pd_emul_2_tb/iUUT/zero_phase_ppr
add wave -noupdate /enc_pd_emul_2_tb/iUUT/inc_pos
add wave -noupdate /enc_pd_emul_2_tb/iUUT/dec_pos
add wave -noupdate /enc_pd_emul_2_tb/iUUT/set_abs_pos
add wave -noupdate -radix decimal /enc_pd_emul_2_tb/iUUT/abs_pos
add wave -noupdate -radix decimal /enc_pd_emul_2_tb/iUUT/abs_pos_init
add wave -noupdate -radix unsigned /enc_pd_emul_2_tb/iUUT/zero_phase_cnt
add wave -noupdate -radix hexadecimal /enc_pd_emul_2_tb/iUUT/enc_nco_1
add wave -noupdate -radix hexadecimal /enc_pd_emul_2_tb/iUUT/enc_nco_2
add wave -noupdate -radix hexadecimal /enc_pd_emul_2_tb/iUUT/nco_inc
add wave -noupdate /enc_pd_emul_2_tb/iUUT/seq_pulses_start
add wave -noupdate -radix unsigned /enc_pd_emul_2_tb/iUUT/seq_pulses
add wave -noupdate -radix unsigned /enc_pd_emul_2_tb/iUUT/max_pulses
add wave -noupdate /enc_pd_emul_2_tb/iUUT/max_pulses_start_i
add wave -noupdate -radix unsigned /enc_pd_emul_2_tb/iUUT/max_pulses_i
add wave -noupdate -radix unsigned /enc_pd_emul_2_tb/iUUT/pulse_cnt
add wave -noupdate /enc_pd_emul_2_tb/iUUT/avs_write_i
add wave -noupdate /enc_pd_emul_2_tb/iUUT/seq_ram_write
add wave -noupdate /enc_pd_emul_2_tb/iUUT/seq_csr_write
add wave -noupdate /enc_pd_emul_2_tb/iUUT/avs_read_i
add wave -noupdate /enc_pd_emul_2_tb/iUUT/seq_ram_read
add wave -noupdate /enc_pd_emul_2_tb/iUUT/seq_csr_read
add wave -noupdate /enc_pd_emul_2_tb/iUUT/seq_start_req
add wave -noupdate /enc_pd_emul_2_tb/iUUT/seq_busy
add wave -noupdate /enc_pd_emul_2_tb/iUUT/ext_trigger
add wave -noupdate /enc_pd_emul_2_tb/iUUT/us_pulse
add wave -noupdate /enc_pd_emul_2_tb/iUUT/ms_pulse
add wave -noupdate /enc_pd_emul_2_tb/iUUT/sec_pulse
add wave -noupdate /enc_pd_emul_2_tb/iUUT/pd
add wave -noupdate /enc_pd_emul_2_tb/iUUT/pd_d
add wave -noupdate /enc_pd_emul_2_tb/iUUT/pd_pulse
add wave -noupdate /enc_pd_emul_2_tb/iUUT/clr_pd_cnt
add wave -noupdate /enc_pd_emul_2_tb/iUUT/pd_gen
add wave -noupdate /enc_pd_emul_2_tb/iUUT/pd_seq
add wave -noupdate /enc_pd_emul_2_tb/iUUT/pd_emul_en
add wave -noupdate /enc_pd_emul_2_tb/iUUT/pd_i
add wave -noupdate -radix unsigned /enc_pd_emul_2_tb/iUUT/pd_pulse_width
add wave -noupdate -radix unsigned /enc_pd_emul_2_tb/iUUT/pd_pulse_cnt
add wave -noupdate -radix unsigned /enc_pd_emul_2_tb/iUUT/pd_cnt
add wave -noupdate /enc_pd_emul_2_tb/iUUT/seq_csr_addr
add wave -noupdate /enc_pd_emul_2_tb/iUUT/seq_trigger_in
add wave -noupdate -radix unsigned /enc_pd_emul_2_tb/iUUT/clk_cnt
add wave -noupdate /enc_pd_emul_2_tb/iUUT/seq_ram_addr
add wave -noupdate /enc_pd_emul_2_tb/iUUT/seq_start_addr
add wave -noupdate /enc_pd_emul_2_tb/iUUT/avs_addr_i
add wave -noupdate -radix unsigned /enc_pd_emul_2_tb/iUUT/us_cnt
add wave -noupdate -radix unsigned /enc_pd_emul_2_tb/iUUT/ms_cnt
add wave -noupdate -radix hexadecimal /enc_pd_emul_2_tb/iUUT/seq_vec_out
add wave -noupdate -radix hexadecimal /enc_pd_emul_2_tb/iUUT/avs_readdata_i
add wave -noupdate -radix hexadecimal /enc_pd_emul_2_tb/iUUT/seq_ram_writedata
add wave -noupdate -radix hexadecimal /enc_pd_emul_2_tb/iUUT/seq_csr_writedata
add wave -noupdate -radix hexadecimal /enc_pd_emul_2_tb/iUUT/seq_ram_readdata
add wave -noupdate -radix hexadecimal /enc_pd_emul_2_tb/iUUT/seq_csr_readdata
TreeUpdate [SetDefaultTree]
WaveRestoreCursors {{Cursor 1} {772234424 ps} 0} {{Cursor 2} {255555000 ps} 1}
quietly wave cursor active 1
configure wave -namecolwidth 303
configure wave -valuecolwidth 134
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 {715822479 ps} {777214607 ps}

View file

@ -0,0 +1,472 @@
-------------------------------------------------------------------------------
-- Title : enc_pd_emul_1
-- Project : SMB/Encoder Simulation board
-------------------------------------------------------------------------------
-- File : enc_pd_emul_1.vhd
-- Author : Gianmarco Girau
-- Company : Global Inkjet Systems
-- Created : 2018-05-30
-- Last update: 2018-12-21
-- SVN ID : Git
-- Standard : VHDL'2008
-------------------------------------------------------------------------------
-- Description:
-- Generate synthetic encoder and product detect signals
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library work;
use work.enc_pd_emul_2_pkg.all;
entity enc_pd_emul_2 is
generic(
SEQ_ENABLE : boolean := true); -- enable the instantiation of
-- the sequencer
port(
clk : in std_logic;
reset_n : in std_logic := '1';
-- Encoder/PD outputs:
-- TTL
ttl_pd : out std_logic;
ttl_enc_p1 : out std_logic;
ttl_enc_p2 : out std_logic;
ttl_enc_zp : out std_logic;
-- RS422
rs422_pd : out std_logic;
rs422_enc_p1 : out std_logic;
rs422_enc_p2 : out std_logic;
rs422_enc_zp : out std_logic;
-- Absolute Position
abs_pos_out : out std_logic_vector(39 downto 0);
set_pos_out : out std_logic;
inc_pos_out : out std_logic;
dec_pos_out : out std_logic;
-----------------------------------------------------------------------
-- Avalon MM Interface
-----------------------------------------------------------------------
avs_address : in std_logic_vector( 9 downto 0);
avs_write : in std_logic;
avs_writedata : in std_logic_vector(31 downto 0);
avs_read : in std_logic;
avs_readdata : out std_logic_vector(31 downto 0));
end entity enc_pd_emul_2;
architecture rtl of enc_pd_emul_2 is
constant CSR_IP_ID : std_logic_vector(31 downto 0) := x"0000FF12";
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";
-- signals
signal enc_init, nco_inc_en, enc_dir : std_logic;
signal enc_p1, enc_p2, enc_p1_d, enc_p2_d : std_logic;
signal pulse_cnt_inc, pulse_cnt_inc_d : std_logic;
signal max_pulses_start, avs_read_d : std_logic;
signal max_pulses_en, pulse_cnt_start : std_logic;
signal pulse_cnt_stop, max_pulses_done : std_logic;
signal zero_phase, pulse_cnt_running : std_logic;
signal ttl_pd_en, ttl_enc_p1_en, ttl_enc_p2_en : std_logic;
signal ttl_enc_zp_en, rs422_pd_en, enc_zp : std_logic;
signal ttl_pd_fh, ttl_enc_p1_fh, ttl_enc_p2_fh : std_logic;
signal ttl_enc_zp_fh, rs422_pd_fh : std_logic;
signal rs422_enc_p1_fh, rs422_enc_p2_fh : std_logic;
signal rs422_enc_zp_fh : std_logic;
signal rs422_enc_p1_en, rs422_enc_p2_en : std_logic;
signal rs422_enc_zp_en, enc_emul_en : std_logic;
signal inc_pos, dec_pos, set_abs_pos : std_logic;
signal avs_write_i, seq_ram_write, seq_csr_write : std_logic;
signal avs_read_i, seq_ram_read, seq_csr_read : std_logic;
signal seq_start_req, seq_busy, ext_trigger : std_logic;
signal us_pulse, ms_pulse, sec_pulse : std_logic;
signal pd, pd_d, pd_pulse, clr_pd_cnt : std_logic;
signal pd_gen, pd_seq, pd_emul_en, pd_i : std_logic;
signal max_pulses_start_i, seq_pulses_start : std_logic;
signal enc_dir_i, pulse_dir, seq_present : std_logic;
signal ttl_pd_i, ttl_enc_p1_i, ttl_enc_p2_i : std_logic;
signal ttl_enc_zp_i, rs422_pd_i, rs422_enc_p1_i : std_logic;
signal rs422_enc_p2_i, rs422_enc_zp_i : std_logic;
--
signal seq_vec_out : std_logic_vector( 1 downto 0);
signal seq_csr_addr : std_logic_vector( 3 downto 0);
signal clk_cnt : std_logic_vector( 6 downto 0);
signal seq_trigger_in : std_logic_vector( 7 downto 0);
signal seq_ram_addr, seq_start_addr : std_logic_vector( 8 downto 0);
signal avs_addr_i, us_cnt, ms_cnt : std_logic_vector( 9 downto 0);
signal zero_phase_ppr, zero_phase_cnt : std_logic_vector(15 downto 0);
signal pd_pulse_width, pd_pulse_cnt : std_logic_vector(15 downto 0);
signal pd_cnt : std_logic_vector(23 downto 0);
signal enc_nco_1 : std_logic_vector(31 downto 0) := ENC_NCO_INIT_1;
signal enc_nco_2 : std_logic_vector(31 downto 0) := ENC_NCO_INIT_2;
signal nco_inc, avs_readdata_i, seq_pulses : std_logic_vector(31 downto 0);
signal seq_ram_writedata, seq_csr_writedata : std_logic_vector(31 downto 0);
signal seq_ram_readdata, seq_csr_readdata : std_logic_vector(31 downto 0);
signal max_pulses, max_pulses_i, pulse_cnt : std_logic_vector(31 downto 0);
signal abs_pos, abs_pos_init : std_logic_vector(39 downto 0);
begin
-----------------------------------------------------------------------------
-- Synthetic encoder generation
-----------------------------------------------------------------------------
pEMUL_ENC : process(clk)
begin
if(clk = '1' and clk'event) then
if(enc_init = '1') then
enc_nco_1 <= ENC_NCO_INIT_1;
enc_nco_2 <= ENC_NCO_INIT_2;
elsif(nco_inc_en = '1' and enc_dir_i = '0') then
enc_nco_1 <= std_logic_vector(signed(enc_nco_1) + signed(nco_inc));
enc_nco_2 <= std_logic_vector(signed(enc_nco_2) + signed(nco_inc));
elsif(nco_inc_en = '1' and enc_dir_i = '1') then
enc_nco_1 <= std_logic_vector(signed(enc_nco_1) - signed(nco_inc));
enc_nco_2 <= std_logic_vector(signed(enc_nco_2) - signed(nco_inc));
end if;
enc_p1 <= enc_nco_1(enc_nco_1'left);
enc_p2 <= enc_nco_2(enc_nco_2'left);
-- Pulse count mechanism
enc_p1_d <= enc_p1;
enc_p2_d <= enc_p2;
pulse_cnt_inc_d <= pulse_cnt_inc;
if(max_pulses_en = '0' or pulse_cnt_stop = '1') then
pulse_cnt_running <= '0';
elsif(pulse_cnt_start = '1') then
pulse_cnt_running <= '1';
end if;
if(max_pulses_en = '0' or (max_pulses_en = '1' and pulse_cnt_start = '1')) then
max_pulses_done <= '0';
elsif(max_pulses_en = '1' and pulse_cnt_stop = '1') then
max_pulses_done <= '1';
end if;
if(pulse_cnt_start = '1') then
pulse_cnt <= (others => '0');
elsif(pulse_cnt_running = '1' and pulse_cnt_inc = '1') then
pulse_cnt <= std_logic_vector(unsigned(pulse_cnt)+1);
end if;
max_pulses_start_i <= max_pulses_start or seq_pulses_start;
if(max_pulses_start = '1' and pulse_cnt_running = '0') then
max_pulses_i <= max_pulses;
elsif(seq_pulses_start = '1' and pulse_cnt_running = '0') then
max_pulses_i <= seq_pulses;
end if;
if(max_pulses_en = '1') then
if(max_pulses_start = '1' and pulse_cnt_running = '0') then
enc_dir_i <= enc_dir;
elsif(seq_pulses_start = '1' and pulse_cnt_running = '0') then
enc_dir_i <= pulse_dir;
end if;
else
enc_dir_i <= enc_dir;
end if;
if(enc_init = '1' or zero_phase = '1') then
if(enc_dir_i = '0') then
zero_phase_cnt <= (0 => '1', others => '0');
else
zero_phase_cnt <= zero_phase_ppr;
end if;
elsif(enc_dir_i = '0' and enc_p1 = '1' and enc_p1_d = '0') then
zero_phase_cnt <= std_logic_vector(unsigned(zero_phase_cnt)+1);
elsif(enc_dir_i = '1' and enc_p1 = '1' and enc_p1_d = '0') then
zero_phase_cnt <= std_logic_vector(unsigned(zero_phase_cnt)-1);
end if;
if(set_abs_pos = '1') then
abs_pos <= abs_pos_init;
elsif(inc_pos = '1') then
abs_pos <= std_logic_vector(signed(abs_pos)+1);
elsif(dec_pos = '1') then
abs_pos <= std_logic_vector(signed(abs_pos)-1);
end if;
set_pos_out <= set_abs_pos;
inc_pos_out <= inc_pos;
dec_pos_out <= dec_pos;
abs_pos_out <= abs_pos;
end if;
end process pEMUL_ENC;
zero_phase <= '1' when enc_p1 = '1' and enc_p1_d = '0' and ((enc_dir_i = '0' and unsigned(zero_phase_cnt) = unsigned(zero_phase_ppr)) or ((enc_dir_i = '1' and unsigned(zero_phase_cnt) = 0))) else '0';
enc_zp <= zero_phase;
nco_inc_en <= enc_emul_en and (not max_pulses_en or (max_pulses_en and pulse_cnt_running));
pulse_cnt_start <= max_pulses_en and max_pulses_start_i;
pulse_cnt_stop <= '1' when pulse_cnt_running = '1' and (unsigned(pulse_cnt) = unsigned(max_pulses_i)) and pulse_cnt_inc_d = '1' else '0';
pulse_cnt_inc <= (enc_p1 xor enc_p1_d) or (enc_p2 xor enc_p2_d);
inc_pos <= pulse_cnt_inc and not enc_dir_i;
dec_pos <= pulse_cnt_inc and enc_dir_i;
-----------------------------------------------------------------------------
-- Sequencer
-----------------------------------------------------------------------------
-- The sequencer can be use to generate complex sequences of PD and encoder events
gGEN_SEQ: if SEQ_ENABLE = true generate
seq_present <= '1';
iSEQ: entity work.generic_sequencer_15
generic map (
TRIGGER_WIDTH => 8,
VECTOR_WIDTH => 2,
BUS_WIDTH => 32,
POS_WIDTH => 24,
SEQ_DEPTH => 512,
ADD_VEC_PIPE => false,
VECT_RAMP_EN => false,
BUS_BURST_EN => true,
POS_BUS_EN => true,
ALU_EN => true)
port map (
clk => clk,
reset_n => reset_n,
avs_csr_address => seq_csr_addr,
avs_csr_write => seq_csr_write,
avs_csr_writedata => seq_csr_writedata,
avs_csr_read => seq_csr_read,
avs_csr_readdata => seq_csr_readdata,
avs_seq_address => seq_ram_addr,
avs_seq_write => seq_ram_write,
avs_seq_writedata => seq_ram_writedata,
avs_seq_read => seq_ram_read,
avs_seq_readdata => seq_ram_readdata,
start_req => seq_start_req,
start_addr => seq_start_addr,
trigger_in => seq_trigger_in,
pos_in => abs_pos(23 downto 0),
busy => seq_busy,
vector_out => seq_vec_out,
bus_data => seq_pulses,
bus_valid => seq_pulses_start,
bus_ack => '1');
seq_trigger_in <= (0 => '1',
1 => us_pulse,
2 => ms_pulse,
3 => sec_pulse,
4 => ext_trigger,
5 => max_pulses_done,
6 => pulse_cnt_running,
7 => (not pulse_cnt_running));
pd_seq <= seq_vec_out(0);
pulse_dir <= seq_vec_out(1);
pSEQ_SUPPORT: process(reset_n, clk)
begin
if(reset_n = '0') then
clk_cnt <= (others => '0');
us_cnt <= (others => '0');
ms_cnt <= (others => '0');
elsif(clk = '1' and clk'event) then
if(unsigned(clk_cnt) = 99) then
clk_cnt <= (others => '0');
us_pulse <= '1';
else
clk_cnt <= std_logic_vector(unsigned(clk_cnt)+1);
us_pulse <= '0';
end if;
ms_pulse <= '0';
if(us_pulse = '1') then
if(unsigned(us_cnt) = 999) then
us_cnt <= (others => '0');
ms_pulse <= '1';
else
us_cnt <= std_logic_vector(unsigned(us_cnt)+1);
end if;
end if;
sec_pulse <= '0';
if(ms_pulse = '1') then
if(unsigned(ms_cnt) = 999) then
ms_cnt <= (others => '0');
sec_pulse <= '1';
else
ms_cnt <= std_logic_vector(unsigned(ms_cnt)+1);
end if;
end if;
end if;
end process pSEQ_SUPPORT;
end generate gGEN_SEQ;
gDO_NOT_GEN_SEQ: if SEQ_ENABLE = false generate
seq_present <= '0';
pd_seq <= '0';
pulse_dir <= '0';
seq_pulses_start <= '0';
seq_pulses <= (others => '0');
seq_csr_readdata <= x"BAD0BAD1";
seq_ram_readdata <= x"BAD1BAD0";
seq_busy <= '0';
end generate gDO_NOT_GEN_SEQ;
-----------------------------------------------------------------------------
-- PD management
-----------------------------------------------------------------------------
-- PD events are generated exclusively using a sequencer with the encoder
-- position and appropriate timing signals as input triggers.
pPD_GEN : process(reset_n, clk)
begin
if(reset_n = '0') then
pd_cnt <= (others => '0');
elsif(clk = '1' and clk'event) then
pd <= pd_emul_en and (pd_gen or pd_seq);
pd_d <= pd;
if(pd_i) then
pd_pulse_cnt <= pd_pulse_width;
elsif(pd_pulse = '1') then
pd_pulse_cnt <= std_logic_vector(unsigned(pd_pulse_cnt)-1);
end if;
if(pd_emul_en = '0' or unsigned(pd_pulse_cnt) = 1) then
pd_pulse <= '0';
elsif(pd = '1' and pd_d = '0') then
pd_pulse <= '1';
end if;
if(clr_pd_cnt = '1') then
pd_cnt <= (others => '0');
elsif(pd_i = '1') then
pd_cnt <= std_logic_vector(unsigned(pd_cnt)+1);
end if;
end if;
end process pPD_GEN;
pd_i <= pd and not pd_d and not pd_pulse;
-----------------------------------------------------------------------------
-- Output management
-----------------------------------------------------------------------------
-- TTL
ttl_pd_i <= ttl_pd_en and pd_pulse;
ttl_enc_p1_i <= ttl_enc_p1_en and enc_p1;
ttl_enc_p2_i <= ttl_enc_p2_en and enc_p2;
ttl_enc_zp_i <= ttl_enc_zp_en and enc_zp;
ttl_pd <= ttl_pd_i;
ttl_enc_p1 <= ttl_enc_p1_i;
ttl_enc_p2 <= ttl_enc_p2_i;
ttl_enc_zp <= ttl_enc_zp_i;
-- RS422
rs422_pd_i <= rs422_pd_en and pd_pulse;
rs422_enc_p1_i <= rs422_enc_p1_en and enc_p1;
rs422_enc_p2_i <= rs422_enc_p2_en and enc_p2;
rs422_enc_zp_i <= rs422_enc_zp_en and enc_zp;
rs422_pd <= rs422_pd_i;
rs422_enc_p1 <= rs422_enc_p1_i;
rs422_enc_p2 <= rs422_enc_p2_i;
rs422_enc_zp <= rs422_enc_zp_i;
-----------------------------------------------------------------------------
-- C&S registers (Avalon-MM I/F)
-----------------------------------------------------------------------------
avs_write_i <= '1' when avs_write = '1' and avs_address(9 downto 5) = "00000" else '0';
seq_ram_write <= '1' when avs_write = '1' and avs_address(9) = '1' else '0';
seq_csr_write <= '1' when avs_write = '1' and avs_address(9 downto 5) = "00001" else '0';
avs_read_i <= '1' when avs_read = '1' and avs_address(9) = '0' else '0';
seq_ram_read <= '1' when avs_read = '1' and avs_address(9) = '1' else '0';
seq_csr_read <= '1' when avs_read = '1' and avs_address(9 downto 5) = "00001" else '0';
seq_ram_addr <= avs_address(seq_ram_addr'range);
seq_csr_addr <= avs_address(seq_csr_addr'range);
seq_ram_writedata <= avs_writedata;
seq_csr_writedata <= avs_writedata;
enc_pd_emul_2_csr_regs_i : entity work.enc_pd_emul_2_csr_regs
generic map (
ADDR_DECODE_WIDTH => 5
)
port map (
-- Clock and reset
clk => clk,
rst_n => reset_n,
-- auto-generated
-- Internal signal ports
out_enable_ttl_pd_en => ttl_pd_en,
out_enable_ttl_ph1_en => ttl_enc_p1_en,
out_enable_ttl_ph2_en => ttl_enc_p2_en,
out_enable_ttl_zp_en => ttl_enc_zp_en,
out_enable_rs422_pd_en => rs422_pd_en,
out_enable_rs422_ph1_en => rs422_enc_p1_en,
out_enable_rs422_ph2_en => rs422_enc_p2_en,
out_enable_rs422_zp_en => rs422_enc_zp_en,
out_enable_ttl_pd_fh => ttl_pd_fh,
out_enable_ttl_ph1_fh => ttl_enc_p1_fh,
out_enable_ttl_ph2_fh => ttl_enc_p2_fh,
out_enable_ttl_zp_fh => ttl_enc_zp_fh,
out_enable_rs422_pd_fh => rs422_pd_fh,
out_enable_rs422_ph1_fh => rs422_enc_p1_fh,
out_enable_rs422_ph2_fh => rs422_enc_p2_fh,
out_enable_rs422_zp_fh => rs422_enc_zp_fh,
enc_ctrl_w_nco_en => enc_emul_en,
enc_ctrl_w_enc_dir => enc_dir,
enc_ctrl_w_max_pulses_en => max_pulses_en,
enc_nco_inc => nco_inc,
enc_pulse_num => max_pulses,
enc_zp_ppr => zero_phase_ppr,
pos_init_lsb => abs_pos_init(31 downto 0),
pos_init_msb => abs_pos_init(39 downto 32),
pd_ctrl_pd_en => pd_emul_en,
pd_pulse_width => pd_pulse_width,
seq_ctrl_seq_start_addr => seq_start_addr,
enc_ctrl_w_nco_init => enc_init,
enc_ctrl_w_set_abs_pos => set_abs_pos,
enc_ctrl_w_max_pulses_start => max_pulses_start,
pd_ctrl_pd_gen => pd_gen,
pd_ctrl_clr_pd_cnt => clr_pd_cnt,
seq_ctrl_seq_start_req => seq_start_req,
seq_ctrl_seq_ext_trig => ext_trigger,
out_status_ttl_pd => ttl_pd_i,
out_status_ttl_ph1 => ttl_enc_p1_i,
out_status_ttl_ph2 => ttl_enc_p2_i,
out_status_ttl_zp => ttl_enc_zp_i,
out_status_rs422_pd => rs422_pd_i,
out_status_rs422_ph1 => rs422_enc_p1_i,
out_status_rs422_ph2 => rs422_enc_p2_i,
out_status_rs422_zp => rs422_enc_zp_i,
enc_ctrl_r_max_pulses_done => max_pulses_done,
enc_ctrl_r_seq_present => seq_present,
pos_stat_lsb => abs_pos(31 downto 0),
pos_stat_msb => abs_pos(39 downto 32),
pd_cnt => pd_cnt,
-- end auto-generated
-- Slave bus port
avs_address => avs_address(4 downto 0),
avs_write => avs_write_i,
avs_writedata => avs_writedata,
avs_read => avs_read_i,
avs_readdata => avs_readdata_i
);
avs_readdata <= avs_readdata_i when avs_address(9 downto 5) = "00000" else
seq_csr_readdata when avs_address(9 downto 5) = "00001" else
seq_ram_readdata when avs_address(9 downto 5) = "1----" else
X"BAD1BAD0";
end architecture rtl;

View file

@ -0,0 +1,527 @@
-------------------------------------------------------------------------------
-- Title : enc_pd_emul_1_tb
-- Project : SMB
-------------------------------------------------------------------------------
-- File : enc_pd_emul_1_tb.vhd
-- Author : GMG
-- Company : Global Inkjet Systems
-- Created : 2018-05-31
-- Last update: 2018-06-15
-- 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 work;
use work.log_pkg.all;
use work.avalon_verify_pkg.all;
use work.enc_pd_emul_2_pkg.all;
entity enc_pd_emul_2_tb is
-- ..
end entity enc_pd_emul_2_tb;
architecture behav of enc_pd_emul_2_tb is
constant CLK_PERIOD : time := 10 ns;
constant CLK_FREQ : real := 100.0e6; -- target clock frequency
-- Logging Verbosity Level
constant VERBOSITY_LEVEL : verb_level_t := VMEDIUM;
constant MAX_SIM_TIME : time := 1 ms; -- Maximum simulation time
constant SEQ_ENABLE : boolean := true; -- false to not instantiate the sequencer
signal reset_n : std_logic := '0';
signal clk : std_logic := '0';
signal ttl_pd : std_logic;
signal ttl_enc_p1 : std_logic;
signal ttl_enc_p2 : std_logic;
signal ttl_enc_zp : std_logic;
signal rs422_pd : std_logic;
signal rs422_enc_p1 : std_logic;
signal rs422_enc_p2 : std_logic;
signal rs422_enc_zp : std_logic;
signal set_pos : std_logic;
signal inc_pos : std_logic;
signal dec_pos : std_logic;
signal abs_pos : std_logic_vector(39 downto 0);
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_readdata : std_logic_vector(31 downto 0);
-- TB specific signals
signal setup : boolean;
signal running : boolean;
signal passed : boolean := false;
signal failed : boolean := false;
signal test_timeout : boolean := false;
signal test_completed : boolean := false;
signal error_flag : boolean;
signal avs_mm_s_rec : mm_s_rec_t;
signal avs_mm_m_rec : mm_m_rec_t;
constant SEQ_CSR_OFFSET : std_logic_vector(9 downto 0) := 10x"20";
constant SEQ_RAM_OFFSET : std_logic_vector(9 downto 0) := 10x"200";
-----------------------------------------------------------------------------
-- Subprograms
-----------------------------------------------------------------------------
procedure wait_clk_cycles(cycles : in natural) is
begin
for n in 0 to cycles-1 loop
wait until clk = '1' and clk'event;
end loop; -- n
end procedure wait_clk_cycles;
-- 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 -- architecture behav
clk <= not clk after 0.5*CLK_PERIOD;
clk_clk <= clk;
reset_reset_n <= reset_n;
-----------------------------------------------------------------------------
-- UUT
-----------------------------------------------------------------------------
iUUT : entity work.enc_pd_emul_2
generic map(
SEQ_ENABLE => SEQ_ENABLE)
port map (
clk => clk,
reset_n => reset_n,
ttl_pd => ttl_pd,
ttl_enc_p1 => ttl_enc_p1,
ttl_enc_p2 => ttl_enc_p2,
ttl_enc_zp => ttl_enc_zp,
rs422_pd => rs422_pd,
rs422_enc_p1 => rs422_enc_p1,
rs422_enc_p2 => rs422_enc_p2,
rs422_enc_zp => rs422_enc_zp,
abs_pos_out => abs_pos,
set_pos_out => set_pos,
inc_pos_out => inc_pos,
dec_pos_out => dec_pos,
avs_address => avs_address,
avs_write => avs_write,
avs_writedata => avs_writedata,
avs_read => avs_read,
avs_readdata => avs_readdata);
-----------------------------------------------------------------------------
-- AVS Sequencer signal mapping
-----------------------------------------------------------------------------
avs_mm_s_rec.mm_readdata <= avs_readdata;
avs_mm_s_rec.mm_readdatavalid <= '0';
avs_mm_s_rec.use_readvalid <= false;
avs_write <= avs_mm_m_rec.mm_write;
avs_writedata <= avs_mm_m_rec.mm_writedata;
avs_address <= avs_mm_m_rec.mm_address(avs_address'range);
avs_read <= avs_mm_m_rec.mm_read;
-----------------------------------------------------------------------------
-- Testbench Logic
-----------------------------------------------------------------------------
pTEST_PROC : process
procedure csr_read(addr : in std_logic_vector; data : out std_logic_vector(31 downto 0)) is
begin
mm_32b_read(std_logic_vector(resize(unsigned(addr),32)), data, avs_mm_s_rec, avs_mm_m_rec);
end procedure csr_read;
procedure csr_write(addr : in std_logic_vector; data : in std_logic_vector(31 downto 0)) is
begin
mm_32b_write(std_logic_vector(resize(unsigned(addr),32)), data, avs_mm_s_rec, avs_mm_m_rec);
end procedure csr_write;
procedure check_pos(exp_pos : in std_logic_vector(39 downto 0)) is
variable curr_pos : std_logic_vector(39 downto 0);
variable data : std_logic_vector(31 downto 0);
begin
csr_read(CSR_POS_STAT_LSB_ADDR, data);
curr_pos(31 downto 0) := data;
csr_read(CSR_POS_STAT_MSB_ADDR, data);
curr_pos(39 downto 32) := data(7 downto 0);
if(curr_pos /= exp_pos) then
log("ERROR: detected abs_pos = " & to_string(to_integer(signed(curr_pos))) & ", expected = " & to_string(to_integer(signed(exp_pos))) & ".", VLOW);
error_flag <= true;
end if;
end procedure check_pos;
procedure wait_pulses(timeout : in time := 0 ns) is
variable t0 : time;
variable done : boolean := false;
variable data : std_logic_vector(31 downto 0);
begin
t0 := now;
wait for 50 ns;
while done = false loop
-- check the done pulse
csr_read(CSR_ENC_CTRL_R_ADDR, data);
if(data(6) = '1') then
done := true;
elsif(timeout > 0 ns and now-t0 >= timeout) then
done := true;
log("ERROR: wait_pulses timeout.", VLOW);
error_flag <= true;
else
wait for 100 ns;
end if;
end loop;
end procedure wait_pulses;
procedure seq_ram_wr(addr : in std_logic_vector; data : in std_logic_vector(31 downto 0)) is
begin
csr_write(std_logic_vector(unsigned(SEQ_RAM_OFFSET)+unsigned(addr)), data);
end procedure seq_ram_wr;
-- Config the sequencer with various test procedures
procedure config_seq is
variable data : std_logic_vector(31 downto 0);
begin
-- issue a single PD, Offset 0x000
seq_ram_wr(10x"000", X"31000001"); -- VEC_SET, PD pulse
seq_ram_wr(10x"001", X"F0000000"); -- END
-- issue a PD after 10 encoder pulses, Offset 0x004
seq_ram_wr(10x"004", X"8100000A"); -- POS_WAIT (OP1+CURR_POS)
seq_ram_wr(10x"005", X"31000001"); -- VEC_SET, PD pulse
seq_ram_wr(10x"006", X"F0000000"); -- END
-- swathe-1
seq_ram_wr(10x"010", X"30000000"); -- VEC_SET, All zero
seq_ram_wr(10x"011", X"100000FF"); -- TRIG_MASK, all enabled
seq_ram_wr(10x"012", X"27000001"); -- TRIG_WAIT, (pulse_cnt_running = 0)
seq_ram_wr(10x"013", X"31000001"); -- VEC_SET, Issue a PD pulse, set the
-- enc_dir to 0
seq_ram_wr(10x"014", X"60000001"); -- BUS_BURST, 1 data
seq_ram_wr(10x"015", X"00000032"); -- seq_pulses = 50
seq_ram_wr(10x"016", X"26000001"); -- TRIG_WAIT, (pulse_cnt_running = 1)
seq_ram_wr(10x"017", X"25000001"); -- TRIG_WAIT, (max_pulses_done = 1)
seq_ram_wr(10x"018", X"21000005"); -- TRIG_WAIT, (5 us)
seq_ram_wr(10x"019", X"31000001"); -- VEC_SET, Issue a PD pulse
seq_ram_wr(10x"01A", X"30000002"); -- VEC_SET, set enc_dir to 1
seq_ram_wr(10x"01B", X"60000001"); -- BUS_BURST, 1 data
seq_ram_wr(10x"01C", X"0000002F"); -- seq_pulses = 50-3
seq_ram_wr(10x"01D", X"26000001"); -- TRIG_WAIT, (pulse_cnt_running = 1)
seq_ram_wr(10x"01E", X"25000001"); -- TRIG_WAIT, (max_pulses_done = 1)
seq_ram_wr(10x"01F", X"60000001"); -- BUS_BURST, 1 data
seq_ram_wr(10x"020", X"00000002"); -- seq_pulses = 2
seq_ram_wr(10x"021", X"26000001"); -- TRIG_WAIT, (pulse_cnt_running = 1)
seq_ram_wr(10x"022", X"25000001"); -- TRIG_WAIT, (max_pulses_done = 1)
seq_ram_wr(10x"023", X"60000001"); -- BUS_BURST, 1 data
seq_ram_wr(10x"024", X"00000001"); -- seq_pulses = 1
seq_ram_wr(10x"025", X"26000001"); -- TRIG_WAIT, (pulse_cnt_running = 1)
seq_ram_wr(10x"026", X"25000001"); -- TRIG_WAIT, (max_pulses_done = 1)
seq_ram_wr(10x"027", X"31000001"); -- VEC_SET, Issue a PD pulse
seq_ram_wr(10x"028", X"2000000A"); -- TRIG_WAIT, (100 ns)
seq_ram_wr(10x"029", X"F0000000"); -- END
log("Sequencer RAM configured.", VLOW);
end procedure config_seq;
-- start the sequencer at a given offset
procedure start_seq_proc(offset : in std_logic_vector) is
variable data : std_logic_vector(31 downto 0) := (others => '0');
begin
data(0) := '1'; -- start-request bit
data(24 downto 16) := offset; -- start-address
csr_write(CSR_SEQ_CTRL_ADDR, data);
end procedure start_seq_proc;
-- wait until the sequencer is not busy
procedure wait_seq_avail(timeout : in time := 0 ns) is
variable t0 : time;
variable done : boolean := false;
variable data : std_logic_vector(31 downto 0) := (others => '0');
begin
t0 := now;
wait for 50 ns;
while done = false loop
-- check the done pulse
csr_read(CSR_SEQ_CTRL_ADDR, data);
if(data(2) = '0') then
done := true;
elsif(timeout > 0 ns and now-t0 >= timeout) then
done := true;
log("ERROR: wait_seq_avail timeout.", VLOW);
error_flag <= true;
else
wait for 100 ns;
end if;
end loop;
end procedure wait_seq_avail;
begin
---------------------------------------------------------------------------
-- Initialize & Configure
---------------------------------------------------------------------------
reset_n <= '0';
mm_m_init(avs_mm_m_rec);
setup <= false;
running <= false;
error_flag <= false;
--Set the verbosity level for logging
set_log_verbosity(VERBOSITY_LEVEL);
--
wait for 100 ns;
reset_n <= '1';
-- Nothing really to do here
setup <= true;
---------------------------------------------------------------------------
-- Running
---------------------------------------------------------------------------
running <= true;
log_separator_line(VLOW);
log("Encoder/PD emulator verification:", VLOW);
log_separator_line(VLOW);
log("Manual Control testing ...", VLOW);
log_separator_line(VLOW);
log("Forcing the emulator outputs high ...", VMEDIUM);
-- Force high the outputs, on by one
csr_write(CSR_OUT_ENABLE_ADDR, X"00000100");
csr_write(CSR_OUT_ENABLE_ADDR, X"00000200");
csr_write(CSR_OUT_ENABLE_ADDR, X"00000400");
csr_write(CSR_OUT_ENABLE_ADDR, X"00000800");
csr_write(CSR_OUT_ENABLE_ADDR, X"00001000");
csr_write(CSR_OUT_ENABLE_ADDR, X"00002000");
csr_write(CSR_OUT_ENABLE_ADDR, X"00004000");
csr_write(CSR_OUT_ENABLE_ADDR, X"00008000");
csr_write(CSR_OUT_ENABLE_ADDR, X"0000AA00");
csr_write(CSR_OUT_ENABLE_ADDR, X"00005500");
csr_write(CSR_OUT_ENABLE_ADDR, X"0000FF00");
log("Done.", VMEDIUM);
-- Enable outputs
csr_write(CSR_OUT_ENABLE_ADDR, X"000000FF");
---------------------------------------------------------------------------
-- Manual Control
---------------------------------------------------------------------------
-- Configure Encoder NCO freq
csr_write(CSR_ENC_NCO_INC_ADDR, freq2NCO_inc(200.0e3, CLK_FREQ));
-- Init the encoder NCO - Preset Abs-Pos
csr_write(CSR_ENC_CTRL_W_ADDR, 32X"B");
-- Run the encoder in continuous mode, DIR-0
log("Running encoder in continuous mode, DIR-0 ...", VMEDIUM);
csr_write(CSR_ENC_CTRL_W_ADDR, 32X"1");
wait for 50 us;
-- Stop the encoder
csr_write(CSR_ENC_CTRL_W_ADDR, 32X"0");
log("Encoder stopped.", VMEDIUM);
wait for 10 us;
-- Switch to DIR-1
log("Running encoder in continuous mode, DIR-1 ...", VMEDIUM);
csr_write(CSR_ENC_CTRL_W_ADDR, 32X"5");
wait for 50 us;
-- Stop the encoder
csr_write(CSR_ENC_CTRL_W_ADDR, 32X"0");
log("Encoder stopped.", VMEDIUM);
wait for 20 us;
-- issue PD
csr_write(CSR_PD_CTRL_ADDR, 32X"3");
log("Running 100 steps in DIR-0 ...", VMEDIUM);
csr_write(CSR_ENC_PULSE_NUM_ADDR, 32X"64");
csr_write(CSR_ENC_CTRL_W_ADDR, 32X"18");
csr_write(CSR_ENC_CTRL_W_ADDR, 32X"31");
wait_pulses(0 us);
check_pos(std_logic_vector(to_signed(100, 40)));
-- issue PD
--csr_write(CSR_PD_PULSE_W_ADDR, 32X"1");
csr_write(CSR_PD_CTRL_ADDR, 32X"3");
log("Running 1 step in DIR-1 ...", VMEDIUM);
csr_write(CSR_ENC_PULSE_NUM_ADDR, 32X"1");
csr_write(CSR_ENC_CTRL_W_ADDR, 32X"35");
wait_pulses(10 us);
check_pos(std_logic_vector(to_signed(99, 40)));
log("Running 2 steps in DIR-0 ...", VMEDIUM);
csr_write(CSR_ENC_PULSE_NUM_ADDR, 32X"2");
csr_write(CSR_ENC_CTRL_W_ADDR, 32X"31");
wait_pulses(10 us);
check_pos(std_logic_vector(to_signed(101, 40)));
log("Running 51 steps in DIR-1 ...", VMEDIUM);
csr_write(CSR_ENC_PULSE_NUM_ADDR, 32X"33");
csr_write(CSR_ENC_CTRL_W_ADDR, 32X"35");
wait_pulses(0 us);
check_pos(std_logic_vector(to_signed(50, 40)));
wait for 25 us;
-- Preset the absolute position (-100)
csr_write(CSR_POS_INIT_MSB_ADDR, 32X"FF");
csr_write(CSR_POS_INIT_LSB_ADDR, 32X"FFFFFF9C");
csr_write(CSR_ENC_CTRL_W_ADDR, 32X"08");
log("Abs-Pos set to -100.", VMEDIUM);
log("Running 101 steps in DIR-0 ...", VMEDIUM);
csr_write(CSR_ENC_PULSE_NUM_ADDR, 32X"65");
csr_write(CSR_ENC_CTRL_W_ADDR, 32X"31");
wait_pulses(0 us);
check_pos(std_logic_vector(to_signed(1, 40)));
wait for 10 us;
log("Running 11 steps in DIR-1 ...", VMEDIUM);
csr_write(CSR_ENC_PULSE_NUM_ADDR, 32X"0B");
csr_write(CSR_ENC_CTRL_W_ADDR, 32X"35");
wait_pulses(0 us);
check_pos(std_logic_vector(to_signed(-10, 40)));
log("Manual Control testing completed.", VLOW);
---------------------------------------------------------------------------
-- Sequencer Control
---------------------------------------------------------------------------
if(SEQ_ENABLE = false) then
log("Skipping Sequencer testing...", VLOW);
else
log_separator_line(VLOW);
log("Sequencer Control testing ...", VLOW);
log_separator_line(VLOW);
config_seq;
-- enable the sequencer
csr_write(std_logic_vector(unsigned(SEQ_CSR_OFFSET)+3), 32x"1");
log("Sequencer Enabled.", VLOW);
wait for 50 us;
-- Issue a single PD:
start_seq_proc(9x"000");
wait_clk_cycles(5);
wait_seq_avail;
wait_clk_cycles(5);
-- Wait for an increment of 10 encoder steps, then issue a PD pulse
start_seq_proc(9x"004");
log("Running 10 steps in DIR-0 ...", VMEDIUM);
csr_write(CSR_ENC_PULSE_NUM_ADDR, 32X"0A");
csr_write(CSR_ENC_CTRL_W_ADDR, 32X"31");
wait for 50 us;
-- Wait for an increment of 10 encoder steps, then issue a PD pulse
start_seq_proc(9x"010");
log("Running a full swathe (50 steps forward, 50 steps backwards.", VMEDIUM);
wait_clk_cycles(5);
wait_seq_avail;
log("Completed.", VLOW);
end if; -- SEQ_ENABLE
wait_clk_cycles(10);
wait for 50 us;
---------------------------------------------------------------------------
-- End
---------------------------------------------------------------------------
passed <= true after 100 ns;
wait;
end process pTEST_PROC;
failed <= error_flag after 100 ns;
CHECK_SIM_TIMEOUT: process
begin -- process CHECK_SIM_TIMEOUT
while now < MAX_SIM_TIME loop
wait for 100 us;
end loop;
test_timeout <= true;
wait;
end process CHECK_SIM_TIMEOUT;
pREPORT_RESULT : process
begin
wait until failed = true or passed = true or test_timeout = 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);
elsif(test_timeout = true) then
log("FAILURE: test achieved max-sim-time without reaching ", VLOW);
log(" failed/passed condition.", VLOW);
end if;
log_separator_line(VLOW);
test_completed <= true;
end process pREPORT_RESULT;
end architecture behav;

View file

@ -69,59 +69,222 @@ add wave -noupdate /encoder_multiply_tb/iMULT/time_cnt
add wave -noupdate -radix unsigned /encoder_multiply_tb/iMULT/m_delta_t
add wave -noupdate -radix unsigned /encoder_multiply_tb/iMULT/delta_t_i
add wave -noupdate -divider Velocity
add wave -noupdate /encoder_multiply_tb/iSPEED/reset_n
add wave -noupdate /encoder_multiply_tb/iSPEED/clk
add wave -noupdate /encoder_multiply_tb/iSPEED/init
add wave -noupdate /encoder_multiply_tb/iSPEED/enable
add wave -noupdate /encoder_multiply_tb/iSPEED/avg_steps
add wave -noupdate -radix hexadecimal /encoder_multiply_tb/iSPEED/delta_init
add wave -noupdate -radix unsigned /encoder_multiply_tb/iSPEED/time_out
add wave -noupdate /encoder_multiply_tb/iSPEED/step_pos
add wave -noupdate /encoder_multiply_tb/iSPEED/step_neg
add wave -noupdate -radix hexadecimal /encoder_multiply_tb/iSPEED/delta_t
add wave -noupdate /encoder_multiply_tb/iSPEED/enforce_delta_min
add wave -noupdate /encoder_multiply_tb/iSPEED/step_pos_out
add wave -noupdate /encoder_multiply_tb/iSPEED/step_neg_out
add wave -noupdate /encoder_multiply_tb/iSPEED/time_out_flag
add wave -noupdate /encoder_multiply_tb/iSPEED/step_type
add wave -noupdate /encoder_multiply_tb/iSPEED/step_pos_i
add wave -noupdate /encoder_multiply_tb/iSPEED/step_neg_i
add wave -noupdate /encoder_multiply_tb/iSPEED/inc_last
add wave -noupdate /encoder_multiply_tb/iSPEED/inc_first
add wave -noupdate /encoder_multiply_tb/iSPEED/avg_transient_on
add wave -noupdate /encoder_multiply_tb/iSPEED/init_i
add wave -noupdate /encoder_multiply_tb/iSPEED/time_out_flag_i
add wave -noupdate /encoder_multiply_tb/iSPEED/new_step
add wave -noupdate /encoder_multiply_tb/iSPEED/inc_step_balance
add wave -noupdate /encoder_multiply_tb/iSPEED/dec_step_balance
add wave -noupdate /encoder_multiply_tb/iSPEED/inc_step_cnt
add wave -noupdate /encoder_multiply_tb/iSPEED/write_last
add wave -noupdate /encoder_multiply_tb/iSPEED/first_step
add wave -noupdate /encoder_multiply_tb/iSPEED/time_out_flag_d
add wave -noupdate /encoder_multiply_tb/iSPEED/last_step_type
add wave -noupdate /encoder_multiply_tb/iSPEED/data_valid
add wave -noupdate /encoder_multiply_tb/iSPEED/step_cnt
add wave -noupdate -radix unsigned /encoder_multiply_tb/iSPEED/first_addr
add wave -noupdate -radix unsigned /encoder_multiply_tb/iSPEED/last_addr
add wave -noupdate -radix decimal /encoder_multiply_tb/iSPEED/step_balance
add wave -noupdate -radix decimal /encoder_multiply_tb/iSPEED/step_bal_m1
add wave -noupdate -radix unsigned /encoder_multiply_tb/iSPEED/loc_time
add wave -noupdate -radix unsigned /encoder_multiply_tb/iSPEED/time_out_cnt
add wave -noupdate -radix decimal /encoder_multiply_tb/iSPEED/time_diff
add wave -noupdate -radix decimal /encoder_multiply_tb/iSPEED/time_diff_i
add wave -noupdate -format Analog-Step -height 74 -max 10903.0 -radix decimal /encoder_multiply_tb/iSPEED/delta_t_i
add wave -noupdate -radix hexadecimal /encoder_multiply_tb/iSPEED/new_tag
add wave -noupdate -radix hexadecimal /encoder_multiply_tb/iSPEED/tag_last_i
add wave -noupdate -radix hexadecimal /encoder_multiply_tb/iSPEED/tag_first
add wave -noupdate -radix hexadecimal /encoder_multiply_tb/iSPEED/tag_last
add wave -noupdate -format Analog-Step -height 100 -max 6000 -radix decimal /encoder_multiply_tb/iSPEED_8/delta_t_i
add wave -noupdate -format Analog-Step -height 100 -max 6000 -radix decimal /encoder_multiply_tb/iSPEED_16/delta_t_i
add wave -noupdate -format Analog-Step -height 100 -max 6000 -radix decimal /encoder_multiply_tb/iSPEED_32/delta_t_i
add wave -noupdate -format Analog-Step -height 100 -max 6000 -radix decimal /encoder_multiply_tb/iSPEED_64/delta_t_i
add wave -noupdate /encoder_multiply_tb/iSPEED_8/reset_n
add wave -noupdate /encoder_multiply_tb/iSPEED_8/clk
add wave -noupdate /encoder_multiply_tb/iSPEED_8/init
add wave -noupdate /encoder_multiply_tb/iSPEED_8/enable
add wave -noupdate /encoder_multiply_tb/iSPEED_8/avg_steps
add wave -noupdate -radix hexadecimal /encoder_multiply_tb/iSPEED_8/delta_init
add wave -noupdate -radix unsigned /encoder_multiply_tb/iSPEED_8/time_out
add wave -noupdate /encoder_multiply_tb/iSPEED_8/step_pos
add wave -noupdate /encoder_multiply_tb/iSPEED_8/step_neg
add wave -noupdate -radix hexadecimal /encoder_multiply_tb/iSPEED_8/delta_t
add wave -noupdate /encoder_multiply_tb/iSPEED_8/enforce_delta_min
add wave -noupdate /encoder_multiply_tb/iSPEED_8/step_pos_out
add wave -noupdate /encoder_multiply_tb/iSPEED_8/step_neg_out
add wave -noupdate /encoder_multiply_tb/iSPEED_8/time_out_flag
add wave -noupdate /encoder_multiply_tb/iSPEED_8/step_type
add wave -noupdate /encoder_multiply_tb/iSPEED_8/step_pos_i
add wave -noupdate /encoder_multiply_tb/iSPEED_8/step_neg_i
add wave -noupdate /encoder_multiply_tb/iSPEED_8/inc_last
add wave -noupdate /encoder_multiply_tb/iSPEED_8/inc_first
add wave -noupdate /encoder_multiply_tb/iSPEED_8/avg_transient_on
add wave -noupdate /encoder_multiply_tb/iSPEED_8/init_i
add wave -noupdate /encoder_multiply_tb/iSPEED_8/time_out_flag_i
add wave -noupdate /encoder_multiply_tb/iSPEED_8/new_step
add wave -noupdate /encoder_multiply_tb/iSPEED_8/inc_step_balance
add wave -noupdate /encoder_multiply_tb/iSPEED_8/dec_step_balance
add wave -noupdate /encoder_multiply_tb/iSPEED_8/inc_step_cnt
add wave -noupdate /encoder_multiply_tb/iSPEED_8/write_last
add wave -noupdate /encoder_multiply_tb/iSPEED_8/first_step
add wave -noupdate /encoder_multiply_tb/iSPEED_8/time_out_flag_d
add wave -noupdate /encoder_multiply_tb/iSPEED_8/last_step_type
add wave -noupdate /encoder_multiply_tb/iSPEED_8/data_valid
add wave -noupdate /encoder_multiply_tb/iSPEED_8/step_cnt
add wave -noupdate -radix unsigned /encoder_multiply_tb/iSPEED_8/first_addr
add wave -noupdate -radix unsigned /encoder_multiply_tb/iSPEED_8/last_addr
add wave -noupdate -radix decimal /encoder_multiply_tb/iSPEED_8/step_balance
add wave -noupdate -radix decimal /encoder_multiply_tb/iSPEED_8/step_bal_m1
add wave -noupdate -radix unsigned /encoder_multiply_tb/iSPEED_8/loc_time
add wave -noupdate -radix unsigned /encoder_multiply_tb/iSPEED_8/time_out_cnt
add wave -noupdate -radix decimal /encoder_multiply_tb/iSPEED_8/time_diff
add wave -noupdate -radix decimal /encoder_multiply_tb/iSPEED_8/time_diff_i
add wave -noupdate -radix hexadecimal /encoder_multiply_tb/iSPEED_8/new_tag
add wave -noupdate -radix hexadecimal /encoder_multiply_tb/iSPEED_8/tag_last_i
add wave -noupdate -radix hexadecimal /encoder_multiply_tb/iSPEED_8/tag_first
add wave -noupdate -radix hexadecimal /encoder_multiply_tb/iSPEED_8/tag_last
add wave -noupdate -divider {LUT Divider}
add wave -noupdate /encoder_multiply_tb/iSPEED/iLUT_DIV/clk
add wave -noupdate /encoder_multiply_tb/iSPEED/iLUT_DIV/dividend
add wave -noupdate /encoder_multiply_tb/iSPEED/iLUT_DIV/divisor
add wave -noupdate /encoder_multiply_tb/iSPEED/iLUT_DIV/quotient
add wave -noupdate /encoder_multiply_tb/iSPEED/iLUT_DIV/addr
add wave -noupdate /encoder_multiply_tb/iSPEED/iLUT_DIV/lut_q
add wave -noupdate /encoder_multiply_tb/iSPEED/iLUT_DIV/mult
add wave -noupdate /encoder_multiply_tb/iSPEED_8/iLUT_DIV/clk
add wave -noupdate /encoder_multiply_tb/iSPEED_8/iLUT_DIV/dividend
add wave -noupdate /encoder_multiply_tb/iSPEED_8/iLUT_DIV/divisor
add wave -noupdate /encoder_multiply_tb/iSPEED_8/iLUT_DIV/quotient
add wave -noupdate /encoder_multiply_tb/iSPEED_8/iLUT_DIV/addr
add wave -noupdate /encoder_multiply_tb/iSPEED_8/iLUT_DIV/lut_q
add wave -noupdate /encoder_multiply_tb/iSPEED_8/iLUT_DIV/mult
add wave -noupdate -divider Velocity
add wave -noupdate /encoder_multiply_tb/iSPEED_16/reset_n
add wave -noupdate /encoder_multiply_tb/iSPEED_16/clk
add wave -noupdate /encoder_multiply_tb/iSPEED_16/init
add wave -noupdate /encoder_multiply_tb/iSPEED_16/enable
add wave -noupdate /encoder_multiply_tb/iSPEED_16/avg_steps
add wave -noupdate -radix hexadecimal /encoder_multiply_tb/iSPEED_16/delta_init
add wave -noupdate -radix unsigned /encoder_multiply_tb/iSPEED_16/time_out
add wave -noupdate /encoder_multiply_tb/iSPEED_16/step_pos
add wave -noupdate /encoder_multiply_tb/iSPEED_16/step_neg
add wave -noupdate -radix hexadecimal /encoder_multiply_tb/iSPEED_16/delta_t
add wave -noupdate /encoder_multiply_tb/iSPEED_16/enforce_delta_min
add wave -noupdate /encoder_multiply_tb/iSPEED_16/step_pos_out
add wave -noupdate /encoder_multiply_tb/iSPEED_16/step_neg_out
add wave -noupdate /encoder_multiply_tb/iSPEED_16/time_out_flag
add wave -noupdate /encoder_multiply_tb/iSPEED_16/step_type
add wave -noupdate /encoder_multiply_tb/iSPEED_16/step_pos_i
add wave -noupdate /encoder_multiply_tb/iSPEED_16/step_neg_i
add wave -noupdate /encoder_multiply_tb/iSPEED_16/inc_last
add wave -noupdate /encoder_multiply_tb/iSPEED_16/inc_first
add wave -noupdate /encoder_multiply_tb/iSPEED_16/avg_transient_on
add wave -noupdate /encoder_multiply_tb/iSPEED_16/init_i
add wave -noupdate /encoder_multiply_tb/iSPEED_16/time_out_flag_i
add wave -noupdate /encoder_multiply_tb/iSPEED_16/new_step
add wave -noupdate /encoder_multiply_tb/iSPEED_16/inc_step_balance
add wave -noupdate /encoder_multiply_tb/iSPEED_16/dec_step_balance
add wave -noupdate /encoder_multiply_tb/iSPEED_16/inc_step_cnt
add wave -noupdate /encoder_multiply_tb/iSPEED_16/write_last
add wave -noupdate /encoder_multiply_tb/iSPEED_16/first_step
add wave -noupdate /encoder_multiply_tb/iSPEED_16/time_out_flag_d
add wave -noupdate /encoder_multiply_tb/iSPEED_16/last_step_type
add wave -noupdate /encoder_multiply_tb/iSPEED_16/data_valid
add wave -noupdate /encoder_multiply_tb/iSPEED_16/step_cnt
add wave -noupdate -radix unsigned /encoder_multiply_tb/iSPEED_16/first_addr
add wave -noupdate -radix unsigned /encoder_multiply_tb/iSPEED_16/last_addr
add wave -noupdate -radix decimal /encoder_multiply_tb/iSPEED_16/step_balance
add wave -noupdate -radix decimal /encoder_multiply_tb/iSPEED_16/step_bal_m1
add wave -noupdate -radix unsigned /encoder_multiply_tb/iSPEED_16/loc_time
add wave -noupdate -radix unsigned /encoder_multiply_tb/iSPEED_16/time_out_cnt
add wave -noupdate -radix decimal /encoder_multiply_tb/iSPEED_16/time_diff
add wave -noupdate -radix decimal /encoder_multiply_tb/iSPEED_16/time_diff_i
add wave -noupdate -radix hexadecimal /encoder_multiply_tb/iSPEED_16/new_tag
add wave -noupdate -radix hexadecimal /encoder_multiply_tb/iSPEED_16/tag_last_i
add wave -noupdate -radix hexadecimal /encoder_multiply_tb/iSPEED_16/tag_first
add wave -noupdate -radix hexadecimal /encoder_multiply_tb/iSPEED_16/tag_last
add wave -noupdate -divider {LUT Divider}
add wave -noupdate /encoder_multiply_tb/iSPEED_16/iLUT_DIV/clk
add wave -noupdate /encoder_multiply_tb/iSPEED_16/iLUT_DIV/dividend
add wave -noupdate /encoder_multiply_tb/iSPEED_16/iLUT_DIV/divisor
add wave -noupdate /encoder_multiply_tb/iSPEED_16/iLUT_DIV/quotient
add wave -noupdate /encoder_multiply_tb/iSPEED_16/iLUT_DIV/addr
add wave -noupdate /encoder_multiply_tb/iSPEED_16/iLUT_DIV/lut_q
add wave -noupdate /encoder_multiply_tb/iSPEED_16/iLUT_DIV/mult
add wave -noupdate -divider Velocity
add wave -noupdate /encoder_multiply_tb/iSPEED_32/reset_n
add wave -noupdate /encoder_multiply_tb/iSPEED_32/clk
add wave -noupdate /encoder_multiply_tb/iSPEED_32/init
add wave -noupdate /encoder_multiply_tb/iSPEED_32/enable
add wave -noupdate /encoder_multiply_tb/iSPEED_32/avg_steps
add wave -noupdate -radix hexadecimal /encoder_multiply_tb/iSPEED_32/delta_init
add wave -noupdate -radix unsigned /encoder_multiply_tb/iSPEED_32/time_out
add wave -noupdate /encoder_multiply_tb/iSPEED_32/step_pos
add wave -noupdate /encoder_multiply_tb/iSPEED_32/step_neg
add wave -noupdate -radix hexadecimal /encoder_multiply_tb/iSPEED_32/delta_t
add wave -noupdate /encoder_multiply_tb/iSPEED_32/enforce_delta_min
add wave -noupdate /encoder_multiply_tb/iSPEED_32/step_pos_out
add wave -noupdate /encoder_multiply_tb/iSPEED_32/step_neg_out
add wave -noupdate /encoder_multiply_tb/iSPEED_32/time_out_flag
add wave -noupdate /encoder_multiply_tb/iSPEED_32/step_type
add wave -noupdate /encoder_multiply_tb/iSPEED_32/step_pos_i
add wave -noupdate /encoder_multiply_tb/iSPEED_32/step_neg_i
add wave -noupdate /encoder_multiply_tb/iSPEED_32/inc_last
add wave -noupdate /encoder_multiply_tb/iSPEED_32/inc_first
add wave -noupdate /encoder_multiply_tb/iSPEED_32/avg_transient_on
add wave -noupdate /encoder_multiply_tb/iSPEED_32/init_i
add wave -noupdate /encoder_multiply_tb/iSPEED_32/time_out_flag_i
add wave -noupdate /encoder_multiply_tb/iSPEED_32/new_step
add wave -noupdate /encoder_multiply_tb/iSPEED_32/inc_step_balance
add wave -noupdate /encoder_multiply_tb/iSPEED_32/dec_step_balance
add wave -noupdate /encoder_multiply_tb/iSPEED_32/inc_step_cnt
add wave -noupdate /encoder_multiply_tb/iSPEED_32/write_last
add wave -noupdate /encoder_multiply_tb/iSPEED_32/first_step
add wave -noupdate /encoder_multiply_tb/iSPEED_32/time_out_flag_d
add wave -noupdate /encoder_multiply_tb/iSPEED_32/last_step_type
add wave -noupdate /encoder_multiply_tb/iSPEED_32/data_valid
add wave -noupdate /encoder_multiply_tb/iSPEED_32/step_cnt
add wave -noupdate -radix unsigned /encoder_multiply_tb/iSPEED_32/first_addr
add wave -noupdate -radix unsigned /encoder_multiply_tb/iSPEED_32/last_addr
add wave -noupdate -radix decimal /encoder_multiply_tb/iSPEED_32/step_balance
add wave -noupdate -radix decimal /encoder_multiply_tb/iSPEED_32/step_bal_m1
add wave -noupdate -radix unsigned /encoder_multiply_tb/iSPEED_32/loc_time
add wave -noupdate -radix unsigned /encoder_multiply_tb/iSPEED_32/time_out_cnt
add wave -noupdate -radix decimal /encoder_multiply_tb/iSPEED_32/time_diff
add wave -noupdate -radix decimal /encoder_multiply_tb/iSPEED_32/time_diff_i
add wave -noupdate -radix hexadecimal /encoder_multiply_tb/iSPEED_32/new_tag
add wave -noupdate -radix hexadecimal /encoder_multiply_tb/iSPEED_32/tag_last_i
add wave -noupdate -radix hexadecimal /encoder_multiply_tb/iSPEED_32/tag_first
add wave -noupdate -radix hexadecimal /encoder_multiply_tb/iSPEED_32/tag_last
add wave -noupdate -divider {LUT Divider}
add wave -noupdate /encoder_multiply_tb/iSPEED_32/iLUT_DIV/clk
add wave -noupdate /encoder_multiply_tb/iSPEED_32/iLUT_DIV/dividend
add wave -noupdate /encoder_multiply_tb/iSPEED_32/iLUT_DIV/divisor
add wave -noupdate /encoder_multiply_tb/iSPEED_32/iLUT_DIV/quotient
add wave -noupdate /encoder_multiply_tb/iSPEED_32/iLUT_DIV/addr
add wave -noupdate /encoder_multiply_tb/iSPEED_32/iLUT_DIV/lut_q
add wave -noupdate /encoder_multiply_tb/iSPEED_32/iLUT_DIV/mult
add wave -noupdate -divider Velocity
add wave -noupdate /encoder_multiply_tb/iSPEED_64/reset_n
add wave -noupdate /encoder_multiply_tb/iSPEED_64/clk
add wave -noupdate /encoder_multiply_tb/iSPEED_64/init
add wave -noupdate /encoder_multiply_tb/iSPEED_64/enable
add wave -noupdate /encoder_multiply_tb/iSPEED_64/avg_steps
add wave -noupdate -radix hexadecimal /encoder_multiply_tb/iSPEED_64/delta_init
add wave -noupdate -radix unsigned /encoder_multiply_tb/iSPEED_64/time_out
add wave -noupdate /encoder_multiply_tb/iSPEED_64/step_pos
add wave -noupdate /encoder_multiply_tb/iSPEED_64/step_neg
add wave -noupdate -radix hexadecimal /encoder_multiply_tb/iSPEED_64/delta_t
add wave -noupdate /encoder_multiply_tb/iSPEED_64/enforce_delta_min
add wave -noupdate /encoder_multiply_tb/iSPEED_64/step_pos_out
add wave -noupdate /encoder_multiply_tb/iSPEED_64/step_neg_out
add wave -noupdate /encoder_multiply_tb/iSPEED_64/time_out_flag
add wave -noupdate /encoder_multiply_tb/iSPEED_64/step_type
add wave -noupdate /encoder_multiply_tb/iSPEED_64/step_pos_i
add wave -noupdate /encoder_multiply_tb/iSPEED_64/step_neg_i
add wave -noupdate /encoder_multiply_tb/iSPEED_64/inc_last
add wave -noupdate /encoder_multiply_tb/iSPEED_64/inc_first
add wave -noupdate /encoder_multiply_tb/iSPEED_64/avg_transient_on
add wave -noupdate /encoder_multiply_tb/iSPEED_64/init_i
add wave -noupdate /encoder_multiply_tb/iSPEED_64/time_out_flag_i
add wave -noupdate /encoder_multiply_tb/iSPEED_64/new_step
add wave -noupdate /encoder_multiply_tb/iSPEED_64/inc_step_balance
add wave -noupdate /encoder_multiply_tb/iSPEED_64/dec_step_balance
add wave -noupdate /encoder_multiply_tb/iSPEED_64/inc_step_cnt
add wave -noupdate /encoder_multiply_tb/iSPEED_64/write_last
add wave -noupdate /encoder_multiply_tb/iSPEED_64/first_step
add wave -noupdate /encoder_multiply_tb/iSPEED_64/time_out_flag_d
add wave -noupdate /encoder_multiply_tb/iSPEED_64/last_step_type
add wave -noupdate /encoder_multiply_tb/iSPEED_64/data_valid
add wave -noupdate /encoder_multiply_tb/iSPEED_64/step_cnt
add wave -noupdate -radix unsigned /encoder_multiply_tb/iSPEED_64/first_addr
add wave -noupdate -radix unsigned /encoder_multiply_tb/iSPEED_64/last_addr
add wave -noupdate -radix decimal /encoder_multiply_tb/iSPEED_64/step_balance
add wave -noupdate -radix decimal /encoder_multiply_tb/iSPEED_64/step_bal_m1
add wave -noupdate -radix unsigned /encoder_multiply_tb/iSPEED_64/loc_time
add wave -noupdate -radix unsigned /encoder_multiply_tb/iSPEED_64/time_out_cnt
add wave -noupdate -radix decimal /encoder_multiply_tb/iSPEED_64/time_diff
add wave -noupdate -radix decimal /encoder_multiply_tb/iSPEED_64/time_diff_i
add wave -noupdate -radix hexadecimal /encoder_multiply_tb/iSPEED_64/new_tag
add wave -noupdate -radix hexadecimal /encoder_multiply_tb/iSPEED_64/tag_last_i
add wave -noupdate -radix hexadecimal /encoder_multiply_tb/iSPEED_64/tag_first
add wave -noupdate -radix hexadecimal /encoder_multiply_tb/iSPEED_64/tag_last
add wave -noupdate -divider {LUT Divider}
add wave -noupdate /encoder_multiply_tb/iSPEED_64/iLUT_DIV/clk
add wave -noupdate /encoder_multiply_tb/iSPEED_64/iLUT_DIV/dividend
add wave -noupdate /encoder_multiply_tb/iSPEED_64/iLUT_DIV/divisor
add wave -noupdate /encoder_multiply_tb/iSPEED_64/iLUT_DIV/quotient
add wave -noupdate /encoder_multiply_tb/iSPEED_64/iLUT_DIV/addr
add wave -noupdate /encoder_multiply_tb/iSPEED_64/iLUT_DIV/lut_q
add wave -noupdate /encoder_multiply_tb/iSPEED_64/iLUT_DIV/mult
TreeUpdate [SetDefaultTree]
WaveRestoreCursors {{Cursor 1} {1234195270 ps} 0}
quietly wave cursor active 1

View file

@ -28,7 +28,7 @@ use work.log_pkg.all;
entity encoder_multiply_tb is
generic(
MULT_SELECTION : integer range 0 to 7 := 0;
MULT_SELECTION : integer range 0 to 7 := 4;
FILT_AVG : integer range 0 to 255 := 8);
-- ..
end entity encoder_multiply_tb;
@ -40,9 +40,9 @@ architecture behav of encoder_multiply_tb is
-- Logging Verbosity Level
constant VERBOSITY_LEVEL : verb_level_t := VMEDIUM;
constant MAX_SIM_TIME : time := 40.0 ms; -- Maximum simulation time
constant MAX_SIM_TIME : time := 140.0 ms; -- Maximum simulation time
constant RUN_TEST : integer_vector(0 to 2) := (0, 1, 1);
constant RUN_TEST : integer_vector(0 to 4) := (0, 1, 1, 1, 1);
CONSTANT MULT_VALUE : integer := to_integer(unsigned(std_logic_vector(to_unsigned(1, 8)) sll(MULT_SELECTION)));
@ -472,6 +472,99 @@ architecture behav of encoder_multiply_tb is
end procedure run_encoder_profile_3;
-----------------------------------------------------------------------------
-- Encoder Profile #4: Increasing frequency
-----------------------------------------------------------------------------
procedure run_encoder_profile_4 (
freq : in real range 1.0e3 to 4000.0e3;
dir : in std_logic;
max_steps : in natural;
fr_ch_stps: in natural;
fr_ch : in real;
signal enable : out std_logic;
signal delta_t : out std_logic_vector(31 downto 0);
signal step_pos : out std_logic;
signal step_neg : out std_logic;
init : in boolean := false) is
variable step_cnt : natural := 0;
variable t_ref : time;
variable l_ref : time;
variable t_period : real;
begin
if(error_flag = true) then
return;
end if;
enable <= '0';
step_pos <= '0';
step_neg <= '0';
log("run_encoder_profile_4: Running " & to_string(max_steps) & " steps in direction " & to_string(dir) & ", at " & to_string(freq/1000.0) & " kHz ..." & "period factor " & to_string(fr_ch) & " every " & to_string(fr_ch_stps) & " steps", VMEDIUM);
-- normalize to us
t_period := 1.0e6/freq;
wait_clk_cycles(5);
-- set the initial velocity estimation
if(init = true) then
delta_t(delta_t'left-1 downto 0) <=std_logic_vector(to_unsigned(integer(maximum(DELTA_TMIN,2*MULT_VALUE)), 31));
else
delta_t(delta_t'left-1 downto 0) <= std_logic_vector(to_unsigned(integer(t_period*100.0), delta_t'left));
end if;
delta_t(delta_t'left) <= dir;
wait_clk_cycles(1);
-- enable the multiplier
enable <= '1';
wait_clk_cycles(5);
-- issue the first step
t_ref := now;
l_ref := now;
if(dir = '0') then
step_pos <= '1';
else
step_neg <= '1';
end if;
step_cnt := step_cnt + 1;
wait_clk_cycles(1);
step_pos <= '0';
step_neg <= '0';
while step_cnt < max_steps loop
if(now-l_ref > (1.0 us)*t_period) then
l_ref := now;
wait until clk = '1' and clk'event;
-- issue the next step
delta_t(delta_t'left-1 downto 0) <= std_logic_vector(to_unsigned(integer(t_period*100.0), delta_t'left));
delta_t(delta_t'left) <= dir;
if(dir = '0') then
step_pos <= '1';
else
step_neg <= '1';
end if;
step_cnt := step_cnt + 1;
if (step_cnt mod fr_ch_stps = 0) then
t_period := t_period * fr_ch;
end if;
wait_clk_cycles(1);
step_pos <= '0';
step_neg <= '0';
end if;
wait for 0.1*CLK_PERIOD;
end loop;
wait_clk_cycles(15);
-- disable the multiplier
enable <= '0';
end procedure run_encoder_profile_4;
begin -- architecture behav
clk <= not clk after 0.5*CLK_PERIOD;
@ -495,13 +588,13 @@ begin -- architecture behav
step_neg_out => step_neg_out);
--Speed Detection
iSPEED: entity work.encoder_speed_detect_0
iSPEED_8: entity work.encoder_speed_detect_0
port map (
reset_n => reset_n,
clk => clk,
init => init,
enable => enable,
avg_steps => avg_steps,
avg_steps => "0001000",
delta_init => delta_init,
time_out => time_out,
step_pos => step_pos_in,
@ -510,6 +603,54 @@ begin -- architecture behav
step_pos_out => step_pos,
step_neg_out => step_neg,
time_out_flag => time_out_flag);
iSPEED_16: entity work.encoder_speed_detect_0
port map (
reset_n => reset_n,
clk => clk,
init => init,
enable => enable,
avg_steps => "0010000",
delta_init => delta_init,
time_out => time_out,
step_pos => step_pos_in,
step_neg => step_neg_in,
delta_t => open,
step_pos_out => open,
step_neg_out => open,
time_out_flag => open);
iSPEED_32: entity work.encoder_speed_detect_0
port map (
reset_n => reset_n,
clk => clk,
init => init,
enable => enable,
avg_steps => "0100000",
delta_init => delta_init,
time_out => time_out,
step_pos => step_pos_in,
step_neg => step_neg_in,
delta_t => open,
step_pos_out => open,
step_neg_out => open,
time_out_flag => open);
iSPEED_64: entity work.encoder_speed_detect_0
port map (
reset_n => reset_n,
clk => clk,
init => init,
enable => enable,
avg_steps => "1000000",
delta_init => delta_init,
time_out => time_out,
step_pos => step_pos_in,
step_neg => step_neg_in,
delta_t => open,
step_pos_out => open,
step_neg_out => open,
time_out_flag => open);
-----------------------------------------------------------------------------
-- Support Logic
@ -545,7 +686,7 @@ begin -- architecture behav
delta_t_norm <= to_integer(unsigned(delta_t_i(30 downto 0))) when delta_t_i(31) = '0' else -1*to_integer(unsigned(delta_t_i(30 downto 0)));
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
-- Testbench Logic
-----------------------------------------------------------------------------
@ -741,6 +882,30 @@ begin -- architecture behav
end if;
if(RUN_TEST(3) = 1) then
log_separator_line(VLOW);
log("Tests at rising frequency:", VLOW);
log_separator_line(VLOW);
run_encoder_profile_4(100.0e3, '0', 2000, 100, 0.99, enable, delta_t, step_pos_in, step_neg_in, true);
wait for 20 us;
check_pos;
run_encoder_profile_4(100.0e3, '0', 2000, 100, 0.95, enable, delta_t, step_pos_in, step_neg_in);
wait for 20 us;
check_pos(true);
end if;
if(RUN_TEST(4) = 1) then
log_separator_line(VLOW);
log("Tests at falling frequency:", VLOW);
log_separator_line(VLOW);
run_encoder_profile_4(100.0e3, '0', 2000, 100, 1.01, enable, delta_t, step_pos_in, step_neg_in ,true);
wait for 20 us;
check_pos;
run_encoder_profile_4(100.0e3, '0', 2000, 100, 1.05, enable, delta_t, step_pos_in, step_neg_in);
wait for 20 us;
check_pos(true);
end if;
---------------------------------------------------------------------------
-- End
---------------------------------------------------------------------------

View file

@ -0,0 +1,385 @@
[{
"ip_name": "event_logger_1",
"bus": "csr",
"addr_width" : "4",
"description": "Event Logger (Slave)",
"registers": {
"ip_id" : {
"address" : "0",
"width" : "32",
"description" : "Unique ID for this IP block",
"fields": {
"ip_number" : {
"type" : "c",
"bit_len" : "8",
"reset" : "0x1B",
"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"
}
}
},
"logger_ctrl_w" : {
"address" : "2",
"width" : "11",
"description" : "Logger control register",
"fields": {
"init" : {
"type" : "w",
"bit_len" : "1",
"reset" : "0x0",
"description" : "Logger init"
},
"Reserved-0" : {
"type" : "rsv",
"bit_len" : "3",
"description" : "Reserved bits"
},
"en_1pps_event" : {
"type" : "w",
"bit_len" : "1",
"reset" : "0x0",
"description" : "enable logging of 1-PPS events"
},
"Reserved-1" : {
"type" : "rsv",
"bit_len" : "3",
"description" : "Reserved bits"
},
"irq_en" : {
"type" : "w",
"bit_len" : "1",
"reset" : "0x0",
"description" : "IRQ enable"
},
"irq_clr" : {
"type" : "w",
"bit_len" : "1",
"reset" : "0x0",
"description" : "IRQ clear"
},
"irq_mask" : {
"type" : "w",
"bit_len" : "1",
"reset" : "0x0",
"description" : "IRQ mask"
}
}
},
"logger_ctrl_r" : {
"address" : "3",
"width" : "12",
"description" : "Logger status register",
"fields": {
"Reserved-0" : {
"type" : "rsv",
"bit_len" : "11",
"description" : "Reserved bits"
},
"irq_value" : {
"type" : "r",
"bit_len" : "1",
"reset" : "0x0",
"description" : "IRQ value"
}
}
},
"src_sel" : {
"address" : "4",
"width" : "29",
"description" : "Source selection",
"fields": {
"src0_sel" : {
"type" : "w",
"bit_len" : "5",
"reset" : "0x0",
"description" : "Source-0 selection"
},
"Reserved-0" : {
"type" : "rsv",
"bit_len" : "3",
"description" : "Reserved bits"
},
"src1_sel" : {
"type" : "w",
"bit_len" : "5",
"reset" : "0x0",
"description" : "Source-1 selection"
},
"Reserved-1" : {
"type" : "rsv",
"bit_len" : "3",
"description" : "Reserved bits"
},
"src2_sel" : {
"type" : "w",
"bit_len" : "5",
"reset" : "0x0",
"description" : "Source-2 selection"
},
"Reserved-2" : {
"type" : "rsv",
"bit_len" : "3",
"description" : "Reserved bits"
},
"src3_sel" : {
"type" : "w",
"bit_len" : "5",
"reset" : "0x0",
"description" : "Source-3 selection"
}
}
},
"src_cfg" : {
"address" : "5",
"width" : "28",
"description" : "Source configuration",
"fields": {
"ris_en_0" : {
"type" : "w",
"bit_len" : "1",
"reset" : "0x0",
"description" : "Enable rising-edge events on source 0"
},
"fal_en_0" : {
"type" : "w",
"bit_len" : "1",
"reset" : "0x0",
"description" : "Enable falling-edge events on source 0"
},
"mask_en_0" : {
"type" : "w",
"bit_len" : "1",
"reset" : "0x0",
"description" : "Mask events on source 0"
},
"sync_en_0" : {
"type" : "w",
"bit_len" : "1",
"reset" : "0x0",
"description" : "Enable clock synchronization on source 0"
},
"Reserved-0" : {
"type" : "rsv",
"bit_len" : "4",
"description" : "Reserved bits"
},
"ris_en_1" : {
"type" : "w",
"bit_len" : "1",
"reset" : "0x0",
"description" : "Enable rising-edge events on source 1"
},
"fal_en_1" : {
"type" : "w",
"bit_len" : "1",
"reset" : "0x0",
"description" : "Enable falling-edge events on source 1"
},
"mask_en_1" : {
"type" : "w",
"bit_len" : "1",
"reset" : "0x0",
"description" : "Mask events on source 1"
},
"sync_en_1" : {
"type" : "w",
"bit_len" : "1",
"reset" : "0x0",
"description" : "Enable clock synchronization on source 1"
},
"Reserved-1" : {
"type" : "rsv",
"bit_len" : "4",
"description" : "Reserved bits"
},
"ris_en_2" : {
"type" : "w",
"bit_len" : "1",
"reset" : "0x0",
"description" : "Enable rising-edge events on source 2"
},
"fal_en_2" : {
"type" : "w",
"bit_len" : "1",
"reset" : "0x0",
"description" : "Enable falling-edge events on source 2"
},
"mask_en_2" : {
"type" : "w",
"bit_len" : "1",
"reset" : "0x0",
"description" : "Mask events on source 2"
},
"sync_en_2" : {
"type" : "w",
"bit_len" : "1",
"reset" : "0x0",
"description" : "Enable clock synchronization on source 2"
},
"Reserved-2" : {
"type" : "rsv",
"bit_len" : "4",
"description" : "Reserved bits"
},
"ris_en_3" : {
"type" : "w",
"bit_len" : "1",
"reset" : "0x0",
"description" : "Enable rising-edge events on source 3"
},
"fal_en_3" : {
"type" : "w",
"bit_len" : "1",
"reset" : "0x0",
"description" : "Enable falling-edge events on source 3"
},
"mask_en_3" : {
"type" : "w",
"bit_len" : "1",
"reset" : "0x0",
"description" : "Mask events on source 3"
},
"sync_en_3" : {
"type" : "w",
"bit_len" : "1",
"reset" : "0x0",
"description" : "Enable clock synchronization on source 3"
}
}
},
"log_fifo_mng_w": {
"address": "6",
"width": "16",
"description": "logger FIFO management",
"fields": {
"irq_gen_thres": {
"type": "w",
"bit_len": "15",
"reset": "0x0",
"description": "FIFO IRQ threshold"
},
"fifo_read" : {
"type" : "wp",
"bit_len" : "1",
"reset": "0x0",
"description" : "Reserved bits"
}
}
},
"log_fifo_mng_r": {
"address": "7",
"width": "32",
"description": "logger FIFO management status",
"fields": {
"reserved" : {
"type" : "rsv",
"bit_len" : "16",
"description" : "Reserved bits"
},
"fifo_level": {
"type": "r",
"bit_len": "15",
"reset": "0x0",
"description": "fifo level"
},
"fifo_overflow": {
"type": "r",
"bit_len": "1",
"reset": "0x0",
"description": "fifo overflow flag"
}
}
},
"log_fifo_out_a": {
"type": "r",
"address": "8",
"reset": "0x0",
"width": "32",
"description": "Logger FIFO output-A (time-tag)"
},
"log_fifo_out_b": {
"type": "r",
"address": "9",
"reset": "0x0",
"width": "32",
"subtype": "signed",
"description": "Logger FIFO output-B (position-tag)"
},
"init_value": {
"type": "r",
"address": "10",
"reset": "0x0",
"width": "4",
"description": "Initial value when logging starts"
},
"trigger_mng": {
"address": "11",
"width": "13",
"description": "External trigger management",
"fields": {
"ext_trig_en": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "External trigger enable"
},
"ext_trig_fal": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "External triggers happens on the falling edge"
},
"reserved" : {
"type" : "rsv",
"bit_len" : "6",
"description" : "Reserved bits"
},
"ext_trig_src": {
"type": "w",
"bit_len": "5",
"reset": "0x0",
"description": "Select the source for the external trigger"
}
}
}
}
}]

View file

@ -0,0 +1,45 @@
# Simulation macro
#.main clear
# 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 WORKLIB work
vlib ./work
vmap work ./work
# Compile the UUT
vcom -2008 -work $WORKLIB $COMMON_PATH/common_pkg.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/altera/alt_rw_dp_ram.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/altera/sync_fifo.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/sync_wire.vhd
vcom -2008 -work $WORKLIB ./../src/event_logger_1_pkg_auto.vhd
vcom -2008 -work $WORKLIB ./../src/event_logger_1_csr_regs_auto.vhd
vcom -2008 -work $WORKLIB ./../src/event_logger_1.vhd
# 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 support files
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
# remove warnings from standard numeric/arithmetic packages (speed-up simulation)
set StdArithNoWarnings 1
set NumericStdNoWarnings 1

View file

@ -0,0 +1,275 @@
-------------------------------------------------------------------------------
-- Title : event_logger_1
-- Project : EMB
-------------------------------------------------------------------------------
-- File : event_logger_1.vhd
-- Author : Gianmarco Girau
-- Company : Global Inkjet Systems
-- Created : 2016-07-19
-- Last update: 2021-03-25
-- SVN ID : Git
-- Standard : VHDL'93
-------------------------------------------------------------------------------
-- Description:
-- The event logger block detects events (rising and/or falling edges) on a
-- programmable set of inputs signals, attaches a time and position tag to
-- each event, then stores that information on an output FIFO, to be read by the HPS.
-- The time-tags use the fine time field of the EMB time counter.
-------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library work;
use work.common_pkg.all;
entity event_logger_1 is
generic(
FIFO_SIZE : natural := 1024);
port(
rstN : in std_logic;
clk : in std_logic;
data_src : in std_logic_vector(31 downto 0);
fine_time : in std_logic_vector(27 downto 0);
abs_position : in std_logic_vector(31 downto 0);
-- Interrupt Sender
ins_irq : out std_logic;
-- Avalon MM
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_readdata : out std_logic_vector(31 downto 0));
end event_logger_1;
architecture RTL of event_logger_1 is
-- constants
constant LOG_IP_ID : std_logic_vector(31 downto 0) := x"0000FF1B";
constant LOG_IP_VER : std_logic_vector(31 downto 0) := x"00000100";
--
signal init, en_1pps_event, pulse_1pps : std_logic;
signal mp_0, mp_1, mp_2, mp_3 : std_logic;
signal mp_0_i, mp_1_i, mp_2_i, mp_3_i : std_logic;
signal mp_0_d, mp_1_d, mp_2_d, mp_3_d : std_logic;
signal mp_sync_0, mp_sync_1, mp_sync_2, mp_sync_3 : std_logic;
signal mask_mp_0, mask_mp_1, mask_mp_2, mask_mp_3 : std_logic;
signal ris_en_0, ris_en_1, ris_en_2, ris_en_3 : std_logic;
signal fal_en_0, fal_en_1, fal_en_2, fal_en_3 : std_logic;
signal sync_en_0, sync_en_1, sync_en_2, sync_en_3 : std_logic;
signal irq_en, irq_clr, irq_mask, irq_val, irq, irq_d : std_logic;
signal fifo_rd_en, fifo_wr_en, fifo_full, fifo_error : std_logic;
signal time_event, log_event, trigger, trigger_d : std_logic;
signal event_detect_0, event_detect_1 : std_logic;
signal event_detect_2, event_detect_3 : std_logic;
signal ext_trg_en, ext_trg_fal, trigger_set : std_logic;
signal init_value : std_logic_vector( 3 downto 0);
signal ext_trg_src : std_logic_vector( 4 downto 0);
signal src_sel_0, src_sel_1, src_sel_2, src_sel_3 : std_logic_vector( 4 downto 0);
signal fifo_usedw, fifo_thres : std_logic_vector(log2(FIFO_SIZE)-1 downto 0);
signal fine_time_corrected : std_logic_vector(27 downto 0);
signal log_entry, fifo_q_a, fifo_q_b : std_logic_vector(31 downto 0);
signal fifo_read_pulse : std_logic;
begin -- RTL
-----------------------------------------------------------------------------
-- Data source selection and event detection
-----------------------------------------------------------------------------
-- input synchronization (in case the input is asynchronous)
iSync_0 : entity work.sync_wire
generic map (rst_val => '0', sync_stages => 2)
port map (rstN => rstN, clk => clk, async_in => mp_0_i, sync_out => mp_sync_0);
iSync_1 : entity work.sync_wire
generic map (rst_val => '0', sync_stages => 2)
port map (rstN => rstN, clk => clk, async_in => mp_1_i, sync_out => mp_sync_1);
iSync_2 : entity work.sync_wire
generic map (rst_val => '0', sync_stages => 2)
port map (rstN => rstN, clk => clk, async_in => mp_2_i, sync_out => mp_sync_2);
iSync_3 : entity work.sync_wire
generic map (rst_val => '0', sync_stages => 2)
port map (rstN => rstN, clk => clk, async_in => mp_3_i, sync_out => mp_sync_3);
mp_0 <= mp_0_i when sync_en_0 = '0' else mp_sync_0;
mp_1 <= mp_1_i when sync_en_1 = '0' else mp_sync_1;
mp_2 <= mp_2_i when sync_en_2 = '0' else mp_sync_2;
mp_3 <= mp_3_i when sync_en_3 = '0' else mp_sync_3;
pEventDetect : process(clk)
begin
if(clk = '1' and clk'event) then
mp_0_i <= data_src(to_integer(unsigned(src_sel_0)));
mp_1_i <= data_src(to_integer(unsigned(src_sel_1)));
mp_2_i <= data_src(to_integer(unsigned(src_sel_2)));
mp_3_i <= data_src(to_integer(unsigned(src_sel_3)));
mp_0_d <= mp_0;
mp_1_d <= mp_1;
mp_2_d <= mp_2;
mp_3_d <= mp_3;
trigger <= data_src(to_integer(unsigned(ext_trg_src)));
trigger_d <= trigger;
if(init = '1' or ext_trg_en = '0') then
trigger_set <= '0';
elsif((ext_trg_fal = '0' and trigger = '1' and trigger_d = '0') or (ext_trg_fal = '1' and trigger = '0' and trigger_d = '1')) then
trigger_set <= '1';
end if;
if(log_event = '1') then
log_entry <= event_detect_3 & event_detect_2 & event_detect_1 & event_detect_0 & (time_event & fine_time_corrected(26 downto 0));
end if;
fifo_wr_en <= log_event and ((ext_trg_en and trigger_set) or not ext_trg_en);
if(init = '1') then
fifo_error <= '0';
elsif(fifo_wr_en = '1' and fifo_full = '1') then
fifo_error <= '1';
end if;
if(unsigned(fine_time) = 0) then
pulse_1pps <= '1';
else
pulse_1pps <= '0';
end if;
if(init = '1') then
init_value <= mp_3 & mp_2 & mp_1 & mp_0;
end if;
end if;
end process pEventDetect;
event_detect_0 <= not mask_mp_0 and ((ris_en_0 and mp_0 and not mp_0_d) or (fal_en_0 and not mp_0 and mp_0_d));
event_detect_1 <= not mask_mp_1 and ((ris_en_1 and mp_1 and not mp_1_d) or (fal_en_1 and not mp_1 and mp_1_d));
event_detect_2 <= not mask_mp_2 and ((ris_en_2 and mp_2 and not mp_2_d) or (fal_en_2 and not mp_2 and mp_2_d));
event_detect_3 <= not mask_mp_3 and ((ris_en_3 and mp_3 and not mp_3_d) or (fal_en_3 and not mp_3 and mp_3_d));
time_event <= en_1pps_event and pulse_1pps;
log_event <= event_detect_0 or event_detect_1 or event_detect_2 or event_detect_3 or time_event;
-- correct the fine time to take into account of the detection latency
fine_time_corrected <= std_logic_vector(unsigned(fine_time)-1);
-- FIFO_A : Event Source and Time-Tag
iFIFO_A : entity work.sync_fifo
generic map(
FIFO_WIDTH => 32,
FIFO_DEPTH => FIFO_SIZE)
port map (
clock => clk,
data => log_entry,
rdreq => fifo_rd_en,
sclr => init,
wrreq => fifo_wr_en,
empty => open,
full => fifo_full,
q => fifo_q_a,
usedw => fifo_usedw);
-- FIFO_B: Position-Tag
iFIFO_B : entity work.sync_fifo
generic map(
FIFO_WIDTH => 32,
FIFO_DEPTH => FIFO_SIZE)
port map (
clock => clk,
data => abs_position,
rdreq => fifo_rd_en,
sclr => init,
wrreq => fifo_wr_en,
empty => open,
full => open,
q => fifo_q_b,
usedw => open);
fifo_rd_en <= '1' when fifo_read_pulse = '1' else '0';
-- IRQ generation and management
pIRQ : process(rstN, clk)
begin
if(rstN = '0') then
irq <= '0';
irq_d <= '0';
ins_irq <= '0';
elsif(clk = '1' and clk'event) then
irq_d <= irq;
if(irq_clr = '1') then
irq <= '0';
elsif(irq_en = '1' and (unsigned(fifo_usedw) >= unsigned(fifo_thres)) and irq_d = '0') then
irq <= '1';
end if;
ins_irq <= irq_val;
end if;
end process pIRQ;
irq_val <= irq and not irq_mask;
-----------------------------------------------------------------------------
-- C&S registers (Avalon-MM I/F)
-----------------------------------------------------------------------------
event_logger_1_csr_regs_i : entity work.event_logger_1_csr_regs
generic map (
ADDR_DECODE_WIDTH => 4
)
port map (
-- Clock and reset
clk => clk,
rst_n => rstN,
-- auto-generated
-- Internal signal ports
logger_ctrl_w_init => init,
logger_ctrl_w_en_1pps_event => en_1pps_event,
logger_ctrl_w_irq_en => irq_en,
logger_ctrl_w_irq_clr => irq_clr,
logger_ctrl_w_irq_mask => irq_mask,
src_sel_src0_sel => src_sel_0,
src_sel_src1_sel => src_sel_1,
src_sel_src2_sel => src_sel_2,
src_sel_src3_sel => src_sel_3,
src_cfg_ris_en_0 => ris_en_0,
src_cfg_fal_en_0 => fal_en_0,
src_cfg_mask_en_0 => mask_mp_0,
src_cfg_sync_en_0 => sync_en_0,
src_cfg_ris_en_1 => ris_en_1,
src_cfg_fal_en_1 => fal_en_1,
src_cfg_mask_en_1 => mask_mp_1,
src_cfg_sync_en_1 => sync_en_1,
src_cfg_ris_en_2 => ris_en_2,
src_cfg_fal_en_2 => fal_en_2,
src_cfg_mask_en_2 => mask_mp_2,
src_cfg_sync_en_2 => sync_en_2,
src_cfg_ris_en_3 => ris_en_3,
src_cfg_fal_en_3 => fal_en_3,
src_cfg_mask_en_3 => mask_mp_3,
src_cfg_sync_en_3 => sync_en_3,
log_fifo_mng_w_irq_gen_thres => fifo_thres,
trigger_mng_ext_trig_en => ext_trg_en,
trigger_mng_ext_trig_fal => ext_trg_fal,
trigger_mng_ext_trig_src => ext_trg_src,
log_fifo_mng_w_pulse => fifo_read_pulse,
log_fifo_mng_w_fifo_read => open,
log_fifo_mng_w_fifo_read_in => '0',
logger_ctrl_r_irq_value => irq_val,
log_fifo_mng_r_fifo_level => fifo_usedw,
log_fifo_mng_r_fifo_overflow => fifo_error,
log_fifo_out_a => fifo_q_a,
log_fifo_out_b => fifo_q_b,
init_value => init_value,
-- end auto-generated
-- Slave bus port
avs_address => avs_address,
avs_write => avs_write,
avs_writedata => avs_writedata,
avs_read => avs_read,
avs_readdata => avs_readdata
);
end RTL;

View file

@ -43,7 +43,7 @@ vcom -2008 -work $WORKLIB $TB_PATH/fire_pulse_manager_6_tb.vhd
vsim -t ps work.fire_pulse_manager_6_tb
# Add waves
#add wave -r sim:/fire_pulse_manager_1_tb/*
add wave -r sim:/fire_pulse_manager_6_tb/*
do wave_fpm.do
# remove warnings from standard numeric/arithmetic packages (speed-up simulation)

View file

@ -0,0 +1 @@
FPM Major version 5: FPM with Programmable number of channels

View file

@ -0,0 +1,64 @@
set_global_assignment -name IP_TOOL_NAME "fire_pulse_manager_6"
set_global_assignment -name IP_TOOL_VERSION "18.0"
set_global_assignment -name IP_GENERATED_DEVICE_FAMILY "{Cyclone V}"
set COMMON_PATH ../../../common/0/src
set POF_PATH_0 ../../../pof_protocol/0/src
set POF_PATH_1 ../../../pof_protocol/1/src
set SEQUENCER_PATH ../../../generic_sequencer/16/src
set PULSE_GEN_PATH ../../../pulse_generator/2/src
set EMUL_PATH ../../../enc_pd_emul/1/src
set LOG_PATH ../../../event_logger/0/src
set SRC_PATH ../src
# common
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "$COMMON_PATH/sync_reset.vhd"]
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "$COMMON_PATH/common_pkg.vhd"]
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "$COMMON_PATH/sync_wire.vhd"]
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "$COMMON_PATH/sync_wire_rEdge.vhd"]
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "$COMMON_PATH/altera/sync_fifo.vhd"]
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "$COMMON_PATH/queue_and_delay.vhd"]
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "$COMMON_PATH/dpram_sclk.vhd"]
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "$COMMON_PATH/alt_rw_dp_ram.vhd"]
# Generic Sequencer
#set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "$SEQUENCER_PATH/altera/generic_seq_ram_16.vhd"]
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "$SEQUENCER_PATH/generic_sequencer_16_pkg.vhd"]
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "$SEQUENCER_PATH/generic_sequencer_16.vhd"]
# Pulse Generator
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "$PULSE_GEN_PATH/simple_frac_div_3.vhd"]
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "$PULSE_GEN_PATH/pulse_generator_3_pkg.vhd"]
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "$PULSE_GEN_PATH/pulse_generator_3.vhd"]
# Emulator
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "$EMUL_PATH/enc_pd_emul_1_pkg.vhd"]
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "$EMUL_PATH/enc_pd_emul_1.vhd"]
# Event Logger
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "$LOG_PATH/event_logger_0_pkg.vhd"]
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "$LOG_PATH/event_logger_0.vhd"]
# POF-Rx
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "$POF_PATH_0/pof_uart_rx_0.vhd"]
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "$POF_PATH_0/pof_rx_0.vhd"]
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "$POF_PATH_0/pof_uart_regen_0.vhd"]
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "$POF_PATH_0/uart_tx_0.vhd"]
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "$POF_PATH_0/pof_tx_0.vhd"]
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "$POF_PATH_1/pof_uart_rx_1.vhd"]
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "$POF_PATH_1/pof_rx_1.vhd"]
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "$POF_PATH_1/pof_uart_regen_1.vhd"]
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "$POF_PATH_1/uart_tx_1.vhd"]
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "$POF_PATH_1/pof_tx_1.vhd"]
# Fire-Pulse-Manager
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "$COMMON_PATH/cs_bus_itf.vhd"]
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "$SRC_PATH/smb_diagnostics_6.vhd"]
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "$SRC_PATH/simple_enc_vel_detect_6.vhd"]
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "$SRC_PATH/fire_pulse_6_pkg.vhd"]
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "$SRC_PATH/fire_pulse_ctrl_6.vhd"]
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "$SRC_PATH/fire_pulse_manager_6.vhd"]

View file

@ -0,0 +1,295 @@
# TCL File Generated by Component Editor 16.0
# Wed Oct 25 15:26:07 BST 2017
# DO NOT MODIFY
#
# fire_pulse_manager_0 "fire_pulse_manager_6" v1.0
# GMG 2017.10.25.15:26:07
# Fire Pulse Manager
#
#
# request TCL package from ACDS 16.0
#
package require -exact qsys 16.0
#
# module fire_pulse_manager_0
#
set_module_property DESCRIPTION "Fire Pulse Manager"
set_module_property NAME fire_pulse_manager_6
set_module_property VERSION 1.0
set_module_property INTERNAL false
set_module_property OPAQUE_ADDRESS_MAP true
set_module_property GROUP "GIS Components"
set_module_property AUTHOR GMG
set_module_property DISPLAY_NAME fire_pulse_manager_6
set_module_property INSTANTIATE_IN_SYSTEM_MODULE true
set_module_property EDITABLE true
set_module_property REPORT_TO_TALKBACK false
set_module_property ALLOW_GREYBOX_GENERATION false
set_module_property REPORT_HIERARCHY false
#
# file sets
#
add_fileset QUARTUS_SYNTH QUARTUS_SYNTH "" ""
set_fileset_property QUARTUS_SYNTH TOP_LEVEL fire_pulse_manager_6
set_fileset_property QUARTUS_SYNTH ENABLE_RELATIVE_INCLUDE_PATHS false
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 common_pkg.vhd VHDL PATH ../../../common/0/src/common_pkg.vhd
add_fileset_file sync_reset.vhd VHDL PATH ../../../common/0/src/sync_reset.vhd
add_fileset_file sync_wire.vhd VHDL PATH ../../../common/0/src/sync_wire.vhd
add_fileset_file sync_wire_rEdge.vhd VHDL PATH ../../../common/0/src/sync_wire_rEdge.vhd
add_fileset_file fifo_1024x32.vhd VHDL PATH ../../../common/0//src/altera/fifo_1024x32.vhd
add_fileset_file fifo_256x32.vhd VHDL PATH ../../../common/0/src/altera/fifo_256x32.vhd
add_fileset_file sync_fifo.vhd VHDL PATH ../../../common/0/src/altera/sync_fifo.vhd
add_fileset_file cs_bus_itf.vhd VHDL PATH ../../../common/0/src/cs_bus_itf.vhd
add_fileset_file dpram_sclk.vhd VHDL PATH ../../../common/0/src/dpram_sclk.vhd
add_fileset_file alt_rw_dp_ram.vhd VHDL PATH ../../../common/0/src/altera/alt_rw_dp_ram.vhd
#add_fileset_file generic_seq_ram_16.vhd VHDL PATH ../../../generic_sequencer/16/src/altera/generic_seq_ram_16.vhd
add_fileset_file generic_sequencer_16_pkg.vhd VHDL PATH ../../../generic_sequencer/16/src/generic_sequencer_16_pkg.vhd
add_fileset_file generic_sequencer_16.vhd VHDL PATH ../../../generic_sequencer/16/src/generic_sequencer_16.vhd
add_fileset_file enc_pd_emul_1_pkg.vhd VHDL PATH ../../../enc_pd_emul/1/src/enc_pd_emul_1_pkg.vhd
add_fileset_file enc_pd_emul_1.vhd VHDL PATH ../../../enc_pd_emul/1/src/enc_pd_emul_1.vhd
add_fileset_file event_logger_0_pkg.vhd VHDL PATH ../../../event_logger/0/src/event_logger_0_pkg.vhd
add_fileset_file event_logger_0.vhd VHDL PATH ../../../event_logger/0/src/event_logger_0.vhd
add_fileset_file queue_and_delay.vhd VHDL PATH ../../../common/0/src/queue_and_delay.vhd
add_fileset_file simple_frac_div_3.vhd VHDL PATH ../../../pulse_generator/3/src/simple_frac_div_3.vhd
add_fileset_file pulse_generator_3_pkg.vhd VHDL PATH ../../../pulse_generator/3/src/pulse_generator_3_pkg.vhd
add_fileset_file pulse_generator_3.vhd VHDL PATH ../../../pulse_generator/3/src/pulse_generator_3.vhd
add_fileset_file pof_uart_rx_0.vhd VHDL PATH ../../../pof_protocol/0/src/pof_uart_rx_0.vhd
add_fileset_file pof_rx_0.vhd VHDL PATH ../../../pof_protocol/0/src/pof_rx_0.vhd
add_fileset_file pof_uart_regen_0.vhd VHDL PATH ../../../pof_protocol/0/src/pof_uart_regen_0.vhd
add_fileset_file pof_uart_rx_1.vhd VHDL PATH ../../../pof_protocol/1/src/pof_uart_rx_1.vhd
add_fileset_file pof_rx_1.vhd VHDL PATH ../../../pof_protocol/1/src/pof_rx_1.vhd
add_fileset_file pof_uart_regen_1.vhd VHDL PATH ../../../pof_protocol/1/src/pof_uart_regen_1.vhd
add_fileset_file smb_diagnostics_6.vhd VHDL PATH ../src/smb_diagnostics_6.vhd
add_fileset_file fire_pulse_6_pkg.vhd VHDL PATH ../src/fire_pulse_6_pkg.vhd
add_fileset_file simple_enc_vel_detect_6.vhd VHDL PATH ../src/simple_enc_vel_detect_6.vhd
add_fileset_file fire_pulse_ctrl_6.vhd VHDL PATH ../src/fire_pulse_ctrl_6.vhd
add_fileset_file fire_pulse_manager_6.vhd VHDL PATH ../src/fire_pulse_manager_6.vhd TOP_LEVEL_FILE
add_fileset SIM_VHDL SIM_VHDL "" ""
set_fileset_property SIM_VHDL TOP_LEVEL fire_pulse_manager_6
set_fileset_property SIM_VHDL ENABLE_RELATIVE_INCLUDE_PATHS false
set_fileset_property SIM_VHDL ENABLE_FILE_OVERWRITE_MODE false
add_fileset_file common_pkg.vhd VHDL PATH ../../../common/0/src/common_pkg.vhd
add_fileset_file sync_reset.vhd VHDL PATH ../../../common/0/src/sync_reset.vhd
add_fileset_file sync_wire.vhd VHDL PATH ../../../common/0/src/sync_wire.vhd
add_fileset_file sync_wire_rEdge.vhd VHDL PATH ../../../common/0/src/sync_wire_rEdge.vhd
add_fileset_file fifo_1024x32.vhd VHDL PATH ../../../common/0//src/altera/fifo_1024x32.vhd
add_fileset_file fifo_256x32.vhd VHDL PATH ../../../common/0/src/altera/fifo_256x32.vhd
add_fileset_file sync_fifo.vhd VHDL PATH ../../../common/0/src/altera/sync_fifo.vhd
add_fileset_file cs_bus_itf.vhd VHDL PATH ../../../common/0/src/cs_bus_itf.vhd
add_fileset_file dpram_sclk.vhd VHDL PATH ../../../common/0/src/dpram_sclk.vhd
add_fileset_file alt_rw_dp_ram.vhd VHDL PATH ../../../common/0/src/altera/alt_rw_dp_ram.vhd
#add_fileset_file generic_seq_ram_16.vhd VHDL PATH ../../../generic_sequencer/16/src/altera/generic_seq_ram_16.vhd
add_fileset_file generic_sequencer_16_pkg.vhd VHDL PATH ../../../generic_sequencer/16/src/generic_sequencer_16_pkg.vhd
add_fileset_file generic_sequencer_16.vhd VHDL PATH ../../../generic_sequencer/16/src/generic_sequencer_16.vhd
add_fileset_file enc_pd_emul_1_pkg.vhd VHDL PATH ../../../enc_pd_emul/1/src/enc_pd_emul_1_pkg.vhd
add_fileset_file enc_pd_emul_1.vhd VHDL PATH ../../../enc_pd_emul/1/src/enc_pd_emul_1.vhd
add_fileset_file event_logger_0_pkg.vhd VHDL PATH ../../../event_logger/0/src/event_logger_0_pkg.vhd
add_fileset_file event_logger_0.vhd VHDL PATH ../../../event_logger/0/src/event_logger_0.vhd
add_fileset_file queue_and_delay.vhd VHDL PATH ../../../common/0/src/queue_and_delay.vhd
add_fileset_file simple_frac_div_3.vhd VHDL PATH ../../../pulse_generator/3/src/simple_frac_div_3.vhd
add_fileset_file pulse_generator_3_pkg.vhd VHDL PATH ../../../pulse_generator/3/src/pulse_generator_3_pkg.vhd
add_fileset_file pulse_generator_3.vhd VHDL PATH ../../../pulse_generator/3/src/pulse_generator_3.vhd
add_fileset_file pof_uart_rx_0.vhd VHDL PATH ../../../pof_protocol/0/src/pof_uart_rx_0.vhd
add_fileset_file pof_rx_0.vhd VHDL PATH ../../../pof_protocol/0/src/pof_rx_0.vhd
add_fileset_file pof_uart_regen_0.vhd VHDL PATH ../../../pof_protocol/0/src/pof_uart_regen_0.vhd
add_fileset_file pof_uart_rx_1.vhd VHDL PATH ../../../pof_protocol/1/src/pof_uart_rx_1.vhd
add_fileset_file pof_rx_1.vhd VHDL PATH ../../../pof_protocol/1/src/pof_rx_1.vhd
add_fileset_file pof_uart_regen_1.vhd VHDL PATH ../../../pof_protocol/1/src/pof_uart_regen_1.vhd
add_fileset_file smb_diagnostics_6.vhd VHDL PATH ../src/smb_diagnostics_6.vhd
add_fileset_file fire_pulse_6_pkg.vhd VHDL PATH ../src/fire_pulse_6_pkg.vhd
add_fileset_file simple_enc_vel_detect_6.vhd VHDL PATH ../src/simple_enc_vel_detect_6.vhd
add_fileset_file fire_pulse_ctrl_6.vhd VHDL PATH ../src/fire_pulse_ctrl_6.vhd
add_fileset_file fire_pulse_manager_6.vhd VHDL PATH ../src/fire_pulse_manager_6.vhd
#
# parameters
#
#
# display items
#
#
# connection point clock
#
add_interface clock clock end
set_interface_property clock clockRate 0
set_interface_property clock ENABLED true
set_interface_property clock EXPORT_OF ""
set_interface_property clock PORT_NAME_MAP ""
set_interface_property clock CMSIS_SVD_VARIABLES ""
set_interface_property clock SVD_ADDRESS_GROUP ""
add_interface_port clock clk clk Input 1
#
# connection point reset
#
add_interface reset reset end
set_interface_property reset associatedClock clock
set_interface_property reset synchronousEdges DEASSERT
set_interface_property reset ENABLED true
set_interface_property reset EXPORT_OF ""
set_interface_property reset PORT_NAME_MAP ""
set_interface_property reset CMSIS_SVD_VARIABLES ""
set_interface_property reset SVD_ADDRESS_GROUP ""
add_interface_port reset reset_n reset_n Input 1
#
# connection point avs
#
add_interface avs avalon end
set_interface_property avs addressUnits WORDS
set_interface_property avs associatedClock clock
set_interface_property avs associatedReset reset
set_interface_property avs bitsPerSymbol 8
set_interface_property avs burstOnBurstBoundariesOnly false
set_interface_property avs burstcountUnits WORDS
set_interface_property avs explicitAddressSpan 0
set_interface_property avs holdTime 0
set_interface_property avs linewrapBursts false
set_interface_property avs maximumPendingReadTransactions 0
set_interface_property avs maximumPendingWriteTransactions 0
set_interface_property avs readLatency 0
set_interface_property avs readWaitTime 1
set_interface_property avs setupTime 0
set_interface_property avs timingUnits Cycles
set_interface_property avs writeWaitTime 0
set_interface_property avs ENABLED true
set_interface_property avs EXPORT_OF ""
set_interface_property avs PORT_NAME_MAP ""
set_interface_property avs CMSIS_SVD_VARIABLES ""
set_interface_property avs SVD_ADDRESS_GROUP ""
add_interface_port avs avs_address address Input 15
add_interface_port avs avs_write write Input 1
add_interface_port avs avs_writedata writedata Input 32
add_interface_port avs avs_read read Input 1
add_interface_port avs avs_readdata readdata Output 32
add_interface_port avs avs_waitrequest waitrequest Output 1
set_interface_assignment avs embeddedsw.configuration.isFlash 0
set_interface_assignment avs embeddedsw.configuration.isMemoryDevice 0
set_interface_assignment avs embeddedsw.configuration.isNonVolatileStorage 0
set_interface_assignment avs embeddedsw.configuration.isPrintableDevice 0
#
# connection point conduit_end
#
add_interface conduit_end conduit end
set_interface_property conduit_end associatedClock clock
set_interface_property conduit_end associatedReset reset
set_interface_property conduit_end ENABLED true
set_interface_property conduit_end EXPORT_OF ""
set_interface_property conduit_end PORT_NAME_MAP ""
set_interface_property conduit_end CMSIS_SVD_VARIABLES ""
set_interface_property conduit_end SVD_ADDRESS_GROUP ""
add_interface_port conduit_end pof_rx pof_rx Input 1
add_interface_port conduit_end pof_tx pof_tx Output 1
add_interface_port conduit_end pof_iso_en pof_iso_en Output 1
add_interface_port conduit_end fire_pulse fire_pulse Output 1
add_interface_port conduit_end abs_pos_out abs_pos_out Output 32
add_interface_port conduit_end print_start print_start Output 1
add_interface_port conduit_end dp_dir_out dp_dir_out Output 1
add_interface_port conduit_end mon_pt mon_pt Output 4
#
# connection point rx_clk
#
add_interface rx_clk clock end
set_interface_property rx_clk clockRate 0
set_interface_property rx_clk ENABLED true
set_interface_property rx_clk EXPORT_OF ""
set_interface_property rx_clk PORT_NAME_MAP ""
set_interface_property rx_clk CMSIS_SVD_VARIABLES ""
set_interface_property rx_clk SVD_ADDRESS_GROUP ""
add_interface_port rx_clk rx_clk clk Input 1
#
# connection point irq_0
#
add_interface irq_0 interrupt end
set_interface_property irq_0 associatedAddressablePoint ""
set_interface_property irq_0 associatedClock clock
set_interface_property irq_0 associatedReset reset
set_interface_property irq_0 bridgedReceiverOffset ""
set_interface_property irq_0 bridgesToReceiver ""
set_interface_property irq_0 ENABLED true
set_interface_property irq_0 EXPORT_OF ""
set_interface_property irq_0 PORT_NAME_MAP ""
set_interface_property irq_0 CMSIS_SVD_VARIABLES ""
set_interface_property irq_0 SVD_ADDRESS_GROUP ""
add_interface_port irq_0 ins_fpm_irq_0 irq Output 1
#
# connection point irq_1
#
add_interface irq_1 interrupt end
set_interface_property irq_1 associatedAddressablePoint ""
set_interface_property irq_1 associatedClock clock
set_interface_property irq_1 associatedReset reset
set_interface_property irq_1 bridgedReceiverOffset ""
set_interface_property irq_1 bridgesToReceiver ""
set_interface_property irq_1 ENABLED true
set_interface_property irq_1 EXPORT_OF ""
set_interface_property irq_1 PORT_NAME_MAP ""
set_interface_property irq_1 CMSIS_SVD_VARIABLES ""
set_interface_property irq_1 SVD_ADDRESS_GROUP ""
add_interface_port irq_1 ins_fpm_irq_1 irq Output 1
#
# connection point irq_2
#
add_interface irq_2 interrupt end
set_interface_property irq_2 associatedAddressablePoint ""
set_interface_property irq_2 associatedClock clock
set_interface_property irq_2 associatedReset reset
set_interface_property irq_2 bridgedReceiverOffset ""
set_interface_property irq_2 bridgesToReceiver ""
set_interface_property irq_2 ENABLED true
set_interface_property irq_2 EXPORT_OF ""
set_interface_property irq_2 PORT_NAME_MAP ""
set_interface_property irq_2 CMSIS_SVD_VARIABLES ""
set_interface_property irq_2 SVD_ADDRESS_GROUP ""
add_interface_port irq_2 ins_fpm_irq_2 irq Output 1
#
# connection point irq_3
#
add_interface irq_3 interrupt end
set_interface_property irq_3 associatedAddressablePoint ""
set_interface_property irq_3 associatedClock clock
set_interface_property irq_3 associatedReset reset
set_interface_property irq_3 bridgedReceiverOffset ""
set_interface_property irq_3 bridgesToReceiver ""
set_interface_property irq_3 ENABLED true
set_interface_property irq_3 EXPORT_OF ""
set_interface_property irq_3 PORT_NAME_MAP ""
set_interface_property irq_3 CMSIS_SVD_VARIABLES ""
set_interface_property irq_3 SVD_ADDRESS_GROUP ""
add_interface_port irq_3 ins_fpm_irq_3 irq Output 1

View file

@ -0,0 +1,66 @@
[{
"ip_name" : "fpm_7",
"bus" : "csr",
"addr_width" : "15",
"addr_hi_bit" : "14",
"addr_lo_bit" : "11",
"description" : "Fire-Pulse-Manager version 7",
"sub_blocks" : {
"fpm_ctrl_7" : {
"instance" : "",
"process" : "enabled",
"offset" : "0x0000"
},
"fpm_diags_7" : {
"instance" : "",
"process" : "enabled",
"note" : "This block is instantiated only when generic ADD_SMB_DIAG is set to true",
"offset" : "0x0800"
},
"event_logger_0" : {
"instance" : "",
"process" : "cpp, txt",
"note" : "This block is instantiated only when generic ADD_EVENT_LOGGER is set to true",
"offset" : "0x1000"
},
"enc_pd_emul_2" : {
"instance" : "",
"process" : "enabled",
"offset" : "0x1800"
},
"ems_0" : {
"instance" : "",
"process" : "cpp, txt",
"offset" : "0x2000"
},
"pof_tx_0" : {
"instance" : "",
"process" : "cpp, txt",
"offset" : "0x2800"
},
"pulse_generator_3:a" : {
"instance" : "0",
"process" : "cpp, txt",
"offset" : "0x3000"
},
"pulse_generator_3:b" : {
"instance" : "1",
"process" : "cpp, txt",
"note" : "This block may not be instantiated depending on the value of generic CH_NUM specified in the FPM top-level",
"offset" : "0x3800"
},
"pulse_generator_3:c" : {
"instance" : "2",
"process" : "cpp, txt",
"note" : "This block may not be instantiated depending on the value of generic CH_NUM specified in the FPM top-level",
"offset" : "0x4000"
},
"pulse_generator_3:d" : {
"instance" : "3",
"process" : "cpp, txt",
"note" : "This block may not be instantiated depending on the value of generic CH_NUM specified in the FPM top-level",
"offset" : "0x4800"
}
}
}
]

View file

@ -0,0 +1,487 @@
[{
"ip_name": "fpm_ctrl_7",
"bus": "csr",
"addr_width" : "5",
"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" : "0x01",
"description" : "Minor number"
},
"major_number" : {
"type" : "c",
"bit_len" : "8",
"reset" : "0x07",
"description" : "Major number"
},
"reserved" : {
"type" : "rsv",
"bit_len" : "16",
"description" : "Reserved bits"
}
}
},
"fpm_config": {
"address": "2",
"width": "11",
"description": "Configuration values for the FPM",
"fields": {
"ch_num" : {
"type" : "r",
"bit_len" : "4",
"reset" : "0",
"description" : "Number of channels"
},
"seb_epd_logic_present" : {
"type" : "r",
"bit_len" : "1",
"reset" : "0",
"description" : "0 => SEB-EPD logic not present, 1 => SEB-EPD logic present"
},
"smb_diagnostic_present" : {
"type" : "r",
"bit_len" : "1",
"reset" : "0",
"description" : "0 => SMB diagnostic block not present, 1 => SMB diagnostic block present"
},
"event_logger_present" : {
"type" : "r",
"bit_len" : "1",
"reset" : "0",
"description" : "0 => Event Logger block not present, 1 => Event Logger block present"
},
"pof_protocol_version" : {
"type" : "r",
"bit_len" : "1",
"reset" : "0",
"description" : "0 => Support POF protocol version 0, 1 => Support POF protocol version 1"
},
"delay_equalization_enable" : {
"type" : "r",
"bit_len" : "1",
"reset" : "0",
"description" : "0 => No support for delay equalization, 1 => Support for delay equalization"
},
"tof_comp_enable" : {
"type" : "r",
"bit_len" : "1",
"reset" : "0",
"description" : "0 => No support for Time-of-Flight compensation, 1 => Support for Time-of-Flight compensation"
},
"pixel_pitch_corr_enable" : {
"type" : "r",
"bit_len" : "1",
"reset" : "0",
"description" : "0 => No support for pixel-pitch correction, 1 => Support for pixel-pitch correction"
}
}
},
"fpm_init_start": {
"address": "3",
"width": "1",
"type" : "w",
"reset" : "0",
"description" : "Start the fpm_init procedure"
},
"fpm_init_done": {
"address": "4",
"width": "1",
"type" : "r",
"reset" : "0",
"description" : "fpm_init completed flag"
},
"signal_selection": {
"address": "5",
"width": "4",
"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"
},
"seb_epd_en": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "1 => Enable SEB-EPD interface, 0 => Use POF based interface"
},
"seb_epd_linkout_sel": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "0 => SEB_EPD_LINK_OUT is driven by the POF-Tx output, 0 => SEB_EPD_LINK_OUT is driven by the Drop-Watch output"
}
}
},
"pof_receiver_control": {
"address": "6",
"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": "7",
"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": "8",
"reset": "0x00000000",
"width": "32",
"description": "Defines coarse time counter value"
},
"fine_time_init": {
"address": "9",
"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": "10",
"reset": "0x0000000",
"width": "28",
"description": "Current fine time counter value"
},
"coarse_time_status": {
"type": "r",
"address": "11",
"reset": "0x00000000",
"width": "32",
"description": "Current coarse time counter value"
},
"pof_rx_status": {
"address": "12",
"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_w": {
"address": "13",
"width": "10",
"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"
}
}
},
"pof_rx_control_r": {
"address": "14",
"width": "2",
"description": "POF receiver error status",
"fields": {
"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": "15",
"width": "12",
"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": {
"address": "16",
"width": "1",
"type": "r",
"bit_len": "1",
"reset": "0x0",
"description": "0 => IRQ not active, 1 => IRQ active"
},
"pd_cnt": {
"address": "17",
"width": "16",
"type": "r",
"reset": "0x0",
"description": "PD count, at the Pulse-Generator input"
},
"drop_watch_config": {
"address": "18",
"width": "32",
"description": "Drop-Watch configuration",
"fields": {
"dw_src": {
"type": "w",
"bit_len": "4",
"reset": "0x0",
"description": "Select the source channel for the drop-watch"
},
"reserved": {
"type": "rsv",
"bit_len": "12",
"description": "Reserved"
},
"dw_pulse_width": {
"type": "w",
"bit_len": "16",
"reset": "0x000A",
"description": "Drop-Watch pulse width, expressed as clock cycles @100MHz"
}
}
},
"seb_epd_led_status": {
"address": "19",
"width": "12",
"description": "SEB-EPD LED status",
"fields": {
"led_pd_g": {
"type": "r",
"bit_len": "1",
"reset": "0x0",
"description": "LED PD Green"
},
"led_pd_y": {
"type": "r",
"bit_len": "1",
"reset": "0x0",
"description": "LED PD Yellow"
},
"led_pd_r": {
"type": "r",
"bit_len": "1",
"reset": "0x0",
"description": "LED PD Red"
},
"led_enc_p1_g": {
"type": "r",
"bit_len": "1",
"reset": "0x0",
"description": "LED Encoder-Phase-1 Green"
},
"led_enc_p1_y": {
"type": "r",
"bit_len": "1",
"reset": "0x0",
"description": "LED Encoder-Phase-1 Yellow"
},
"led_enc_p1_r": {
"type": "r",
"bit_len": "1",
"reset": "0x0",
"description": "LED Encoder-Phase-1 Red"
},
"led_enc_p2_g": {
"type": "r",
"bit_len": "1",
"reset": "0x0",
"description": "LED Encoder-Phase-2 Green"
},
"led_enc_p2_y": {
"type": "r",
"bit_len": "1",
"reset": "0x0",
"description": "LED Encoder-Phase-2 Yellow"
},
"led_enc_p2_r": {
"type": "r",
"bit_len": "1",
"reset": "0x0",
"description": "LED Encoder-Phase-2 Red"
},
"led_pof_in_g": {
"type": "r",
"bit_len": "1",
"reset": "0x0",
"description": "LED POF-In Green"
},
"led_pof_in_y": {
"type": "r",
"bit_len": "1",
"reset": "0x0",
"description": "LED POF-In Yellow"
},
"led_pof_in_r": {
"type": "r",
"bit_len": "1",
"reset": "0x0",
"description": "LED POF-In Red"
}
}
}
}
}]

View file

@ -0,0 +1,500 @@
[{
"ip_name": "fpm_diags_7",
"bus": "csr",
"addr_width" : "6",
"description": "SMB diagnostics, see https://congis.atlassian.net/wiki/spaces/EL/pages/26778599541/Notes+on+FPM+changes+to+support+auto+generated+registers",
"registers": {
"init": {
"address": "0",
"width": "7",
"description": "Diagnostic reset",
"fields": {
"init": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "initialize the full diagnostic block"
},
"rst_counters": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "reset only edge counters"
},
"rst_measur": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "reset only time-based velocity/acceleration measurement registers"
},
"rst_dir": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "reset only the logic for direction detection"
},
"rst_enc_fifo": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "reset only the encoder fifo"
},
"rst_pos": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "reset only the position detection register"
},
"rst_pd_fifo": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "reset only the PD fifo"
}
}
},
"rd_enc_fifo": {
"address": "1",
"width": "1",
"description": "Read Enc FIFO",
"type": "wp",
"reset": "0x0"
},
"rd_pd_fifo": {
"address": "2",
"width": "1",
"description": "Read the PD fifo",
"type": "wp",
"reset": "0x0"
},
"input_status": {
"address": "3",
"width": "17",
"description": "Instantaneous status of input signals",
"fields": {
"rs422_p1": {
"type": "r",
"bit_len": "1",
"reset": "0x00",
"description": "RS422 encoder phase-1"
},
"rs422_p2": {
"type": "r",
"bit_len": "1",
"reset": "0x00",
"description": "RS422 encoder phase-2"
},
"rs422_zp": {
"type": "r",
"bit_len": "1",
"reset": "0x00",
"description": "RS422 encoder zero-phase"
},
"rs422_pd": {
"type": "r",
"bit_len": "1",
"reset": "0x00",
"description": "RS422 Product Detect"
},
"ttl_p1": {
"type": "r",
"bit_len": "1",
"reset": "0x00",
"description": "TTL encoder phase-1"
},
"ttl_p2": {
"type": "r",
"bit_len": "1",
"reset": "0x00",
"description": "TTL encoder phase-2"
},
"ttl_zp": {
"type": "r",
"bit_len": "1",
"reset": "0x00",
"description": "TTL encoder zero-phase"
},
"ttl_pd_pnp": {
"type": "r",
"bit_len": "1",
"reset": "0x00",
"description": "TTL (PNP) Product Detect"
},
"ttl_pd_npn": {
"type": "r",
"bit_len": "1",
"reset": "0x00",
"description": "TTL (NPN) Product Detect"
},
"filt_p1": {
"type": "r",
"bit_len": "1",
"reset": "0x00",
"description": "EMS filtered p1"
},
"filt_p2": {
"type": "r",
"bit_len": "1",
"reset": "0x00",
"description": "EMS filtered p2"
},
"filt_zp": {
"type": "r",
"bit_len": "1",
"reset": "0x00",
"description": "EMS filtered zp"
},
"filt_pd": {
"type": "r",
"bit_len": "1",
"reset": "0x00",
"description": "EMS filtered pd"
},
"enc_pulse": {
"type": "r",
"bit_len": "1",
"reset": "0x00",
"description": "enc_pulse (after jitter removal)"
},
"pd_out": {
"type": "r",
"bit_len": "1",
"reset": "0x00",
"description": "PD output"
},
"drop_watch": {
"type": "r",
"bit_len": "1",
"reset": "0x00",
"description": "drop watch)"
},
"fire_req": {
"type": "r",
"bit_len": "1",
"reset": "0x00",
"description": "fire request"
}
}
},
"phase1_counter": {
"type": "r",
"address": "4",
"reset": "0x0",
"width": "32",
"description": "Encoder Phase-1 (filtered) edge counter"
},
"phase2_counter": {
"type": "r",
"address": "5",
"reset": "0x0",
"width": "32",
"description": "Encoder Phase-2 (filtered) edge counter"
},
"zero_phase_counter": {
"type": "r",
"address": "6",
"reset": "0x0",
"width": "32",
"description": "Encoder Zero-Phase (filtered) edge counter"
},
"pd_counter": {
"type": "r",
"address": "7",
"reset": "0x0",
"width": "32",
"description": "PD (filtered) edge counter"
},
"enc_pulse_counter": {
"type": "r",
"address": "8",
"reset": "0x0",
"width": "32",
"description": "encoder pulse counter (after jitter removal)"
},
"pd_output_counter": {
"type": "r",
"address": "9",
"reset": "0x0",
"width": "32",
"description": "PD output edge counter"
},
"fire_request_counter": {
"type": "r",
"address": "10",
"reset": "0x0",
"width": "32",
"description": "Fire-Request counter"
},
"delta_time_meas": {
"type": "r",
"address": "11",
"reset": "0x0",
"width": "32",
"description": "Delta-time measurement"
},
"deltamin_time_meas": {
"type": "r",
"address": "12",
"reset": "0x0",
"width": "32",
"description": "Delta-time-min measurement"
},
"deltamax_time_meas": {
"type": "r",
"address": "13",
"reset": "0x0",
"width": "32",
"description": "Delta-time-max measurement"
},
"delta_time_prev_meas": {
"type": "r",
"address": "14",
"reset": "0x0",
"width": "32",
"description": "Previous delta-time measurement"
},
"delta_time_meas_step": {
"type": "w",
"address": "15",
"reset": "0x0",
"width": "16",
"description": "Delta-time measurement step"
},
"abs_pos": {
"type": "r",
"address": "16",
"reset": "0x0",
"width": "32",
"description": "Detected absolution position (DEPRECATED)"
},
"dir_thres": {
"address": "17",
"width": "32",
"description": "Direction detection control",
"fields": {
"pos_dir_thres": {
"type": "w",
"bit_len": "16",
"reset": "0x007F",
"description": "threshold for positive direction detection"
},
"neg_dir_thres": {
"type": "w",
"bit_len": "16",
"reset": "0xFF81",
"description": "threshold for negative direction detection"
}
}
},
"dir_cnt": {
"address": "18",
"width": "32",
"description": "Direction status",
"fields": {
"dir_cnt": {
"type": "r",
"bit_len": "16",
"reset": "0x0",
"description": "direction count"
},
"dir_change_cnt": {
"type": "r",
"bit_len": "16",
"reset": "0x0",
"description": "direction change count"
}
}
},
"enc_sampling_period": {
"type": "w",
"address": "19",
"reset": "0x0",
"width": "28",
"description": "Encoder sampling period (encoder FIFO)"
},
"enc_fifo_mng_w": {
"address": "20",
"width": "16",
"description": "encoder FIFO management",
"fields": {
"irq_gen_thres": {
"type": "w",
"bit_len": "10",
"reset": "0x0",
"description": "FIFO IRQ threshold"
},
"reserved-0" : {
"type" : "rsv",
"bit_len" : "6",
"description" : "Reserved bits"
}
}
},
"enc_fifo_mng_r": {
"address": "21",
"width": "16",
"description": "encoder FIFO management",
"fields": {
"fifo_level": {
"type": "r",
"bit_len": "10",
"reset": "0x0",
"description": "fifo level"
},
"reserved-1" : {
"type" : "rsv",
"bit_len" : "5",
"description" : "Reserved bits"
},
"fifo_overflow": {
"type": "r",
"bit_len": "1",
"reset": "0x0",
"description": "fifo overflow flag"
}
}
},
"enc_fifo_output": {
"type": "r",
"address": "22",
"reset": "0x0",
"width": "32",
"description": "Encoder FIFO output"
},
"pd_fifo_mng_w": {
"address": "23",
"width": "16",
"description": "encoder FIFO management",
"fields": {
"irq_gen_thres": {
"type": "w",
"bit_len": "8",
"reset": "0x0",
"description": "FIFO IRQ threshold"
},
"reserved-0" : {
"type" : "rsv",
"bit_len" : "7",
"description" : "Reserved bits"
},
"pd_log_src": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "PD log source: 0 => PD-FIFO associated to PD pulse at the input of the Pulse-Generator, 1 => PD-FIFO associated to output of the PD Queue on the first channel"
}
}
},
"pd_fifo_mng_r": {
"address": "24",
"width": "16",
"description": "encoder FIFO management",
"fields": {
"fifo_level": {
"type": "r",
"bit_len": "8",
"reset": "0x0",
"description": "fifo level"
},
"reserved-1" : {
"type" : "rsv",
"bit_len" : "7",
"description" : "Reserved bits"
},
"fifo_overflow": {
"type": "r",
"bit_len": "1",
"reset": "0x0",
"description": "fifo overflow flag"
}
}
},
"pd_fifo_output": {
"type": "r",
"address": "25",
"reset": "0x0",
"width": "32",
"description": "PD FIFO output"
},
"pd_watchdog_ctrl": {
"address": "26",
"width": "2",
"description": "PD watchdog control",
"fields": {
"watchdog_en": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "PD watchdog enable"
},
"watchdog_clr": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "PD watchdog clear"
}
}
},
"pd_watchdog_status": {
"address": "27",
"width": "1",
"reset": "0x0",
"type": "r",
"description": "watchdog status"
},
"pd_watchdog_thres": {
"type": "w",
"address": "28",
"reset": "0x0",
"width": "32",
"description": "PD watchdog threshold"
},
"irq_mng": {
"address": "29",
"width": "12",
"description": "Diagnostic block IRQ management",
"fields": {
"irq_en": {
"type": "w",
"bit_len": "3",
"reset": "0x0",
"description": "IRQ enable"
},
"reserved-0" : {
"type" : "rsv",
"bit_len" : "1",
"description" : "Reserved bits"
},
"irq_clr": {
"type": "w",
"bit_len": "3",
"reset": "0x0",
"description": "IRQ clear"
},
"reserved-1" : {
"type" : "rsv",
"bit_len" : "1",
"description" : "Reserved bits"
},
"irq_mask": {
"type": "w",
"bit_len": "3",
"reset": "0x0",
"description": "IRQ mask"
},
"reserved-2" : {
"type" : "rsv",
"bit_len" : "1",
"description" : "Reserved bits"
}
}
},
"irq_value": {
"address": "30",
"width": "3",
"description": "IRQ value",
"type": "r",
"reset": "0x0"
}
}
}]

View file

@ -0,0 +1,146 @@
m255
K4
z2
13
!s112 1.1
!i10d 8192
!i10e 25
!i10f 100
cModel Technology
Z0 dE:/git/EL-GENERIC-IP_FPM7/generic_ip/fire_pulse_manager/7/sim
Prandombasepkg
Z1 DPx3 std 6 textio 0 22 zE1`LPoLg^DX3Oz^4Fj1K3
Z2 DPx4 ieee 9 math_real 0 22 Sk6CSihbPL<f[^Shm]=KX0
Z3 w1566987154
R0
Z4 8../../../common/0/src/test/OSVVM/RandomBasePkg.vhd
Z5 F../../../common/0/src/test/OSVVM/RandomBasePkg.vhd
l0
L72
VAV_I0:eWHH1cc:Z`T1jc`0
!s100 ^VH66K<SVNRTHjbdnk?0M0
Z6 OV;C;10.5b;63
33
b1
Z7 !s110 1623328226
!i10b 1
Z8 !s108 1623328225.000000
Z9 !s90 -reportprogress|300|-2008|-work|OSVVM|../../../common/0/src/test/OSVVM/RandomBasePkg.vhd|
Z10 !s107 ../../../common/0/src/test/OSVVM/RandomBasePkg.vhd|
!i113 1
Z11 o-2008 -work OSVVM
Z12 tExplicit 1 CvgOpt 0
Bbody
Z13 DPx4 work 13 randombasepkg 0 22 AV_I0:eWHH1cc:Z`T1jc`0
R1
R2
l0
L98
VGF>5TmW_9ThSc`KC:NYXh0
!s100 RA;jY]a?[9K;kjnN7>RZU0
R6
33
R7
!i10b 1
R8
R9
R10
!i113 1
R11
R12
Prandompkg
Z14 DPx4 ieee 20 numeric_std_unsigned 0 22 jF^[l6kSe0l<k3W[UC=P83
Z15 DPx4 ieee 16 std_logic_textio 0 22 V5TSK`;aJKC<l]CEg1>mz1
Z16 DPx4 ieee 11 numeric_std 0 22 :ASDNFgHXf_ih3J@9F3Ze1
Z17 DPx4 ieee 14 std_logic_1164 0 22 eNV`TJ_GofJTzYa?f<@Oe1
Z18 DPx4 work 15 sortlistpkg_int 0 22 6E1k]L0C1LH9ebg?45<[P3
R1
R2
R13
R3
R0
Z19 8../../../common/0/src/test/OSVVM/RandomPkg.vhd
Z20 F../../../common/0/src/test/OSVVM/RandomPkg.vhd
l0
L90
VT<E`JeH`:N3XN3kbO`Yaa2
!s100 ko^iiFe`U=?FQCKOn_]1X1
R6
33
b1
R7
!i10b 1
Z21 !s108 1623328226.000000
Z22 !s90 -reportprogress|300|-2008|-work|OSVVM|../../../common/0/src/test/OSVVM/RandomPkg.vhd|
Z23 !s107 ../../../common/0/src/test/OSVVM/RandomPkg.vhd|
!i113 1
R11
R12
Bbody
DPx4 work 9 randompkg 0 22 T<E`JeH`:N3XN3kbO`Yaa2
R14
R15
R16
R17
R18
R1
R2
R13
l0
L330
VoTHPF9JReBUDPT_cZFj_g0
!s100 0oQ5WVOhWTH_@S0V12@O?0
R6
33
R7
!i10b 1
R21
R22
R23
!i113 1
R11
R12
Psortlistpkg_int
R15
R16
R17
R1
R3
R0
Z24 8../../../common/0/src/test/OSVVM/SortListPkg_int.vhd
Z25 F../../../common/0/src/test/OSVVM/SortListPkg_int.vhd
l0
L69
V6E1k]L0C1LH9ebg?45<[P3
!s100 K>gUg^GdI9Q>bJfjEe[So1
R6
33
b1
R7
!i10b 1
R21
Z26 !s90 -reportprogress|300|-2008|-work|OSVVM|../../../common/0/src/test/OSVVM/SortListPkg_int.vhd|
Z27 !s107 ../../../common/0/src/test/OSVVM/SortListPkg_int.vhd|
!i113 1
R11
R12
Bbody
R18
R15
R16
R17
R1
l0
L106
V_zV?A5?_5=``eWGd`T75h0
!s100 [SPm64O]2[K]TYlbjXTLJ3
R6
33
R7
!i10b 1
R21
R26
R27
!i113 1
R11
R12

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,4 @@
m255
K4
z0
cModel Technology

View file

@ -0,0 +1,107 @@
# Multi-channel FPM compilation macro:
# To prevent cleaning the existing work library at the beginning run the command with "--nocleanup" option:
# do com_fpm.do --nocleanup
set DO_CLEANUP 1
if { $argc >= 1 } {
set PARAM $1
if { $PARAM == "--nocleanup" } {
set DO_CLEANUP 0
}
}
if { $DO_CLEANUP == 1 } {
.main clear
# Cleanup libraries
foreach lib [list work ] {
file delete -force -- $lib
vlib $lib
}
}
# Path variables
set COMMON_PATH ../../../common/0/src
set POF_PATH_2 ../../../pof_protocol/2/src
set SEQUENCER_PATH ../../../generic_sequencer/
set PULSE_GEN_PATH ../../../pulse_generator/4/src
set EMUL_PATH ../../../enc_pd_emul/2/src
set EMS_PATH ../../../ems/1/src
set ENC_MULT_PATH ../../../encoder_multiply/0/src
set LOG_PATH ../../../event_logger/1/src
set SRC_PATH ../src
set OSVVM_PATH ../../../common/0/src/test/OSVVM
set TB_PATH ../src/test
set WORKLIB work
vlib ./work
vmap work ./work
# 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/sync_wire.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/sync_wire_rEdge.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/altera/sync_fifo.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/queue_and_delay.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/dpram_sclk.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/digital_lpf.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/altera/alt_rw_dp_ram.vhd
# Generic Sequencer (both 15 and 17)
#vcom -2008 -work $WORKLIB $SEQUENCER_PATH/15/src/altera/generic_seq_ram_15.vhd
vcom -2008 -work $WORKLIB $SEQUENCER_PATH/15/src/generic_sequencer_15_pkg.vhd
vcom -2008 -work $WORKLIB $SEQUENCER_PATH/15/src/generic_sequencer_15.vhd
vcom -2008 -work $WORKLIB $SEQUENCER_PATH/17/src/generic_sequencer_17_cmd_pkg.vhd
vcom -2008 -work $WORKLIB $SEQUENCER_PATH/17/src/generic_sequencer_17_pkg_auto.vhd
vcom -2008 -work $WORKLIB $SEQUENCER_PATH/17/src/generic_sequencer_17_csr_regs_auto.vhd
vcom -2008 -work $WORKLIB $SEQUENCER_PATH/17/src/generic_sequencer_17.vhd
# Pulse Generator
vcom -2008 -work $WORKLIB $PULSE_GEN_PATH/simple_frac_div_4.vhd
vcom -2008 -work $WORKLIB $PULSE_GEN_PATH/pulse_generator_4_pkg_auto.vhd
vcom -2008 -work $WORKLIB $PULSE_GEN_PATH/pulse_generator_4_csr_regs_auto.vhd
vcom -2008 -work $WORKLIB $PULSE_GEN_PATH/pulse_generator_4.vhd
# Emulator
vcom -2008 -work $WORKLIB $EMUL_PATH/enc_pd_emul_2_pkg_auto.vhd
vcom -2008 -work $WORKLIB $EMUL_PATH/enc_pd_emul_2_csr_regs_auto.vhd
vcom -2008 -work $WORKLIB $EMUL_PATH/enc_pd_emul_2.vhd
# EMS
vcom -2008 -work $WORKLIB $ENC_MULT_PATH/lut_divider_0.vhd
vcom -2008 -work $WORKLIB $ENC_MULT_PATH/encoder_speed_detect_0.vhd
vcom -2008 -work $WORKLIB $ENC_MULT_PATH/encoder_multiply_0.vhd
vcom -2008 -work $WORKLIB $EMS_PATH/ems_1_pkg_auto.vhd
vcom -2008 -work $WORKLIB $EMS_PATH/ems_1_csr_regs_auto.vhd
vcom -2008 -work $WORKLIB $EMS_PATH/ems_1.vhd
# Event Logger
vcom -2008 -work $WORKLIB $LOG_PATH/event_logger_1_pkg_auto.vhd
vcom -2008 -work $WORKLIB $LOG_PATH/event_logger_1_csr_regs_auto.vhd
vcom -2008 -work $WORKLIB $LOG_PATH/event_logger_1.vhd
# POF-Rx
vcom -2008 -work $WORKLIB $POF_PATH_2/pof_uart_rx_2.vhd
vcom -2008 -work $WORKLIB $POF_PATH_2/pof_rx_2.vhd
vcom -2008 -work $WORKLIB $POF_PATH_2/pof_uart_regen_2.vhd
vcom -2008 -work $WORKLIB $POF_PATH_2/uart_tx_2.vhd
vcom -2008 -work $WORKLIB $POF_PATH_2/pof_tx_2_pkg_auto.vhd
vcom -2008 -work $WORKLIB $POF_PATH_2/pof_tx_2_csr_regs_auto.vhd
vcom -2008 -work $WORKLIB $POF_PATH_2/pof_tx_2.vhd
# Fire-Pulse-Manager
vcom -2008 -work $WORKLIB $COMMON_PATH/cs_bus_itf_no_wait.vhd
vcom -2008 -work $WORKLIB $SRC_PATH/fpm_diags_7_pkg_auto.vhd
vcom -2008 -work $WORKLIB $SRC_PATH/fpm_diags_7_csr_regs_auto.vhd
vcom -2008 -work $WORKLIB $SRC_PATH/smb_diagnostics_7.vhd
vcom -2008 -work $WORKLIB $SRC_PATH/simple_enc_vel_detect_7.vhd
vcom -2008 -work $WORKLIB $SRC_PATH/fire_pulse_7_pkg.vhd
vcom -2008 -work $WORKLIB $SRC_PATH/fpm_ctrl_7_pkg_auto.vhd
vcom -2008 -work $WORKLIB $SRC_PATH/fpm_ctrl_7_csr_regs_auto.vhd
vcom -2008 -work $WORKLIB $SRC_PATH/fire_pulse_ctrl_7.vhd
vcom -2008 -work $WORKLIB $SRC_PATH/seb_epd_led_gen_7.vhd
vcom -2008 -work $WORKLIB $SRC_PATH/fire_pulse_manager_7.vhd

View file

@ -0,0 +1,60 @@
# Multi-channel FPM Simulation macro
.main clear
# Cleanup libraries
foreach lib [list work OSVVM] {
file delete -force -- $lib
vlib $lib
}
# Path variables
set OSVVM_PATH ../../../common/0/src/test/OSVVM
set TB_PATH ../src/test
set WORKLIB work
vlib ./work
vmap work ./work
do com_fpm.do --nocleanup
# Compile the testbench support files:
# Compile OSVVM lib
vlib OSVVM
vcom -2008 -work OSVVM $OSVVM_PATH/RandomBasePkg.vhd
vcom -2008 -work OSVVM $OSVVM_PATH/SortListPkg_int.vhd
vcom -2008 -work OSVVM $OSVVM_PATH/RandomPkg.vhd
# Compile the testbench support files:
vcom -2008 -work $WORKLIB $COMMON_PATH/test/common_test_pkg.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/test/log_pkg.vhd
# Compile the VHDL packages that support bus protocols, memory mapped registers and functional procedures
vcom -2008 -work $WORKLIB $COMMON_PATH/test/avalon_verify_pkg_2.vhd
# Testbench support package
vcom -2008 -work $WORKLIB $TB_PATH/fire_pulse_manager_7_tb_pkg.vhd
# Testbench
vcom -2008 -work $WORKLIB $TB_PATH/fire_pulse_manager_7_tb.vhd
# Load design
vsim -t ps work.fire_pulse_manager_7_tb
# Add waves
#add wave -r sim:/fire_pulse_manager_7_tb/*
do wave_fpm.do
# remove warnings from standard numeric/arithmetic packages (speed-up simulation)
set StdArithNoWarnings 1
set NumericStdNoWarnings 1
when -label end_of_simulation {test_completed == true} {echo "Simulation Completed"; stop ;}
run -all

View file

@ -0,0 +1,49 @@
# Simulation macro
#.main clear
set OSVVM_PATH ../../../common/0/src/test/OSVVM
set COMMON_PATH ../../../common/0/src
set WORKLIB work
vlib ./work
vmap work ./work
# Compile the UUT
vcom -2008 -work $WORKLIB ../src/seb_epd_led_gen_6.vhd
# 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 support files
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
# Compile the testbench
vcom -2008 -work $WORKLIB ./../src/test/led_tb.vhd
vsim -t ps work.led_tb
#add wave /led_tb/*
#add wave /led_tb/iUUT/*
# remove warnings from standard numeric/arithmetic packages (speed-up simulation)
set StdArithNoWarnings 1
set NumericStdNoWarnings 1
do wave_led.do
when -label end_of_simulation {test_completed == true} {echo "Simulation Completed"; stop ;}
run -all
#run 200 us;

Binary file not shown.

View file

@ -0,0 +1,724 @@
onerror {resume}
quietly WaveActivateNextPane {} 0
add wave -noupdate -group TB -expand /fire_pulse_manager_7_tb/ch_offset
add wave -noupdate -group TB /fire_pulse_manager_7_tb/reset_n
add wave -noupdate -group TB /fire_pulse_manager_7_tb/clk
add wave -noupdate -group TB /fire_pulse_manager_7_tb/rx_clk
add wave -noupdate -group TB /fire_pulse_manager_7_tb/pof_tx
add wave -noupdate -group TB /fire_pulse_manager_7_tb/pof_rx
add wave -noupdate -group TB -expand /fire_pulse_manager_7_tb/ch_pulse_out
add wave -noupdate -group TB -expand /fire_pulse_manager_7_tb/ch_start_of_img
add wave -noupdate -group TB -expand /fire_pulse_manager_7_tb/ch_fire_pulse
add wave -noupdate -group TB -expand /fire_pulse_manager_7_tb/ch_start_of_image
add wave -noupdate -group TB /fire_pulse_manager_7_tb/avs_address
add wave -noupdate -group TB /fire_pulse_manager_7_tb/avs_write
add wave -noupdate -group TB /fire_pulse_manager_7_tb/avs_writedata
add wave -noupdate -group TB /fire_pulse_manager_7_tb/avs_read
add wave -noupdate -group TB /fire_pulse_manager_7_tb/avs_waitrequest
add wave -noupdate -group TB /fire_pulse_manager_7_tb/avs_readdata
add wave -noupdate -group TB /fire_pulse_manager_7_tb/rst_fp_cnt
add wave -noupdate -group TB /fire_pulse_manager_7_tb/ext_pulse
add wave -noupdate -group TB /fire_pulse_manager_7_tb/ext_pulse_enable
add wave -noupdate -group TB /fire_pulse_manager_7_tb/init_tx
add wave -noupdate -group TB /fire_pulse_manager_7_tb/inc_pos
add wave -noupdate -group TB /fire_pulse_manager_7_tb/dec_pos
add wave -noupdate -group TB -radix unsigned /fire_pulse_manager_7_tb/abs_position
add wave -noupdate -group TB /fire_pulse_manager_7_tb/tx_data
add wave -noupdate -group TB /fire_pulse_manager_7_tb/swathe_cnt
add wave -noupdate -group TB /fire_pulse_manager_7_tb/enc_p1
add wave -noupdate -group TB /fire_pulse_manager_7_tb/enc_p2
add wave -noupdate -group TB /fire_pulse_manager_7_tb/pd
add wave -noupdate -group TB /fire_pulse_manager_7_tb/seb_epd_enc_p1
add wave -noupdate -group TB /fire_pulse_manager_7_tb/seb_epd_enc_p2
add wave -noupdate -group TB /fire_pulse_manager_7_tb/seb_epd_pd
add wave -noupdate -group TB /fire_pulse_manager_7_tb/end_of_swathe
add wave -noupdate -group TB /fire_pulse_manager_7_tb/test_completed
add wave -noupdate -group TB /fire_pulse_manager_7_tb/running
add wave -noupdate -group TB /fire_pulse_manager_7_tb/configuring
add wave -noupdate -group TB /fire_pulse_manager_7_tb/passed
add wave -noupdate -group TB /fire_pulse_manager_7_tb/failed
add wave -noupdate -group TB /fire_pulse_manager_7_tb/stimuli_completed
add wave -noupdate -group TB /fire_pulse_manager_7_tb/error_flag
add wave -noupdate -group TB /fire_pulse_manager_7_tb/registers_read
add wave -noupdate -group TB /fire_pulse_manager_7_tb/reprogram_offset
add wave -noupdate -group TB /fire_pulse_manager_7_tb/avs_m
add wave -noupdate -group TB /fire_pulse_manager_7_tb/avs_s
add wave -noupdate -group TB /fire_pulse_manager_7_tb/sel_slave_0
add wave -noupdate -group TB /fire_pulse_manager_7_tb/sel_slave_1
add wave -noupdate -group TB /fire_pulse_manager_7_tb/pd_cnt
add wave -noupdate -group TB /fire_pulse_manager_7_tb/fp_cnt
add wave -noupdate -group TB /fire_pulse_manager_7_tb/run_dw
add wave -noupdate -group TB /fire_pulse_manager_7_tb/dw
add wave -noupdate -group TB /fire_pulse_manager_7_tb/dw_cnt
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/reset_n
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/clk
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/rx_clk
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/pof_rx
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/pof_tx
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/pof_iso_en
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/seb_epd_enc_p1
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/seb_epd_enc_p2
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/seb_epd_pd
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/fire_pulse
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/start_of_image
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/dp_dir_out
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/abs_pos_out
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/print_start
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/mon_pt
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/ins_fpm_irq_0
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/ins_fpm_irq_1
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/ins_fpm_irq_2
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/ins_fpm_irq_3
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/avs_address
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/avs_write
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/avs_writedata
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/avs_read
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/avs_waitrequest
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/avs_readdata
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/reset_n_i
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/cs_addr
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/cs_write_en
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/cs_write_data
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/cs_read_en
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/cs_read_valid
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/cs_read_data
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/cs_ctrl_write_en
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/cs_ctrl_read_en
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/cs_ctrl_read_valid
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/cs_ctrl_read_data
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/cs_pg_write_en
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/cs_pg_read_en
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/cs_pg_read_valid
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/cs_pg_read_data
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/cs_diag_write_en
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/cs_diag_read_en
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/cs_diag_read_valid
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/cs_diag_read_data
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/cs_log_write_en
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/cs_log_read_en
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/cs_log_read_valid
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/cs_log_read_data
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/cs_ie_write_en
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/cs_ie_read_en
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/cs_ie_read_valid
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/cs_ie_read_data
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/cs_ems_write_en
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/cs_ems_read_en
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/cs_ems_read_valid
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/cs_ems_read_data
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/cs_pof_write_en
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/cs_pof_read_en
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/cs_pof_read_valid
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/cs_pof_read_data
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/enable_rx
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/uart_regen_bypass
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/max_error_flag
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/rx_watchdog
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/rx_watchdog_en
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/rx_watchdog_clr
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/print_start_i
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/dw_src
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/error_rate_thres
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/parity_err_cnt
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/skip_pos_cnt
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/mon_point_src
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/dw_pulse_width
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/fine_time
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/coarse_time
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/init
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/remote_init
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/dp_dir
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/set_pos_ie
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/enc_pulse
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/pd_pulse
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/pd_pulse_ie
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/pd_pulse_pof
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/pd_ems
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/inc_pos
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/inc_pos_pof
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/inc_pos_ie
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/inc_pos_ems
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/dec_pos
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/dec_pos_pof
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/dec_pos_ie
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/dec_pos_ems
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/abs_pos
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/abs_pos_pof
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/abs_pos_ems
add wave -noupdate -group {FPM top} -radix decimal /fire_pulse_manager_7_tb/iDUT/abs_pos_ie
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/pd_pulse_mux
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/enc_p1_mux
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/enc_p2_mux
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/enc_p1_ie
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/enc_p2_ie
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/pof_tx_data
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/dw_pulse
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/dw_pulse_i
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/rst_dw_pulse
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/set_dw_pulse
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/dw_pulse_cnt
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/ch_pd
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/ch_raw_pulse
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/ch_mask
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/ch_start_of_image
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/src_sel
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/vel_meas
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/vel_sampling_per
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/one_pps
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/log_data_src
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/ext_fp_in_sync
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/ext_fp_in
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/ext_fp_in_d
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/ext_fp
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/pEXT_PULSE_DETECT/pulse_width_cnt
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/pEXT_PULSE_DETECT/pulse_cnt_en
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/led_pd_g
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/led_pd_y
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/led_pd_r
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/led_enc_p1_g
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/led_enc_p1_y
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/led_enc_p1_r
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/led_enc_p2_g
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/led_enc_p2_y
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/led_enc_p2_r
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/led_pof_g
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/led_pof_y
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/led_pof_r
add wave -noupdate -group {FPM top} /fire_pulse_manager_7_tb/iDUT/led_status
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/reset_n
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/clk
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/init
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/rx_clk
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/rx_data
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/init_out
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/pd_out
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/inc_pos
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/dec_pos
add wave -noupdate -group {POF RX} -radix decimal /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/abs_pos
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/enable
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/error_rate_thres
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/one_pps
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/max_error_flag
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/rx_watchdog
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/rx_watchdog_en
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/rx_watchdog_clr
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/parity_err_cnt
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/skip_pos_cnt
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/clear
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/symbol_ok
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/inc_pos_i
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/dec_pos_i
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/sync_gen
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/pd_gen
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/symbol_error
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/symbol_valid
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/symbol_valid_i
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/symbol_valid_d
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/toggle_sync
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/sync_confirmed
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/sync_toggle_test
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/sync
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/toggle_pd
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/pd_confirmed
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/pd_toggle_test
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/pd
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/valid_pos
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/upd_pos
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/corr_done
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/corr_sign
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/skip_pos
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/apply_corr
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/inc_pos_ii
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/dec_pos_ii
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/rx_error
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/rx_error_i
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/print_start_i
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/rx_symbol_val
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/clear_i
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/skip_pos_d
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/pos_recovery
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/max_error_flag_i
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/clk_cnt
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/dist
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/abs_dist
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/skip_cnt
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/next_pos_lsb
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/curr_pos_lsb
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/pos_corr
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/max_dist
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/rx_error_v
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/gray_pos
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/rx_symbol_val_v
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/symbol
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/symbol_i
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/rx_symbol
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/rx_wd_cnt
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/parity_err_cnt_i
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/skip_pos_cnt_i
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/error_rate_cnt
add wave -noupdate -group {POF RX} /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/error_rate
add wave -noupdate -group {POF RX} -radix decimal /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/abs_pos_i
add wave -noupdate -group UART_RX /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/iRX_SYMBOL/reset_n
add wave -noupdate -group UART_RX /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/iRX_SYMBOL/clk
add wave -noupdate -group UART_RX /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/iRX_SYMBOL/init
add wave -noupdate -group UART_RX /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/iRX_SYMBOL/data_out
add wave -noupdate -group UART_RX /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/iRX_SYMBOL/data_out_valid
add wave -noupdate -group UART_RX /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/iRX_SYMBOL/rx_error
add wave -noupdate -group UART_RX /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/iRX_SYMBOL/rx_data
add wave -noupdate -group UART_RX /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/iRX_SYMBOL/rx_data_i
add wave -noupdate -group UART_RX /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/iRX_SYMBOL/data
add wave -noupdate -group UART_RX /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/iRX_SYMBOL/bit_cnt_unary
add wave -noupdate -group UART_RX /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/iRX_SYMBOL/sample_cnt_unary
add wave -noupdate -group UART_RX /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/iRX_SYMBOL/receiving
add wave -noupdate -group UART_RX /fire_pulse_manager_7_tb/iDUT/gPOF/iPOF_RX/iRX_SYMBOL/init_int
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/reset_n
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/clk
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/init
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/pd_in
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/inc_pos
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/dec_pos
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/abs_position
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/tx_data
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/avs_address
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/avs_write
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/avs_writedata
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/avs_read
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/avs_readdatavalid
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/avs_readdata
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/rd_event
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/wr_event
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/empty
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/full
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/tx_ready
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/rd_event_d
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/wr_event_i
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/symbol_valid
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/enable
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/toggle_sync
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/toggle_pd
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/add_keepalive
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/ovfl_err
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/init_d
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/init_gen
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/clear
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/pd_in_d
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/pd_gen
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/parity_bit
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/inject_error
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/inject_error_req
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/pd_event
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/pd_event_d
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/pd_event_dd
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/init_blocked
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/pd_event_ddd
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/delayed_pos
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/clr_fifo_lmax
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/delayed_pos_v
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/init_v
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/gray
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/bit_div
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/latched_pos
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/event_in_i
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/event_in
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/event_out
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/symbol
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/init_blk_cnt
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/keepalive_cnt
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/keepalive_period
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/init_blocked_period
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/fifo_level
add wave -noupdate -group POF_Tx /fire_pulse_manager_7_tb/iPOF_TX/fifo_level_max
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/reset_n
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/clk
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/src_sel
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/uart_regen_bypass
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/enable_rx
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/error_rate_thres
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/max_error_flag
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/rx_watchdog
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/rx_watchdog_en
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/rx_watchdog_clr
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/parity_err_cnt
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/skip_pos_cnt
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/mon_point_src
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/mon_points
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/coarse_time
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/fine_time
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/one_pps
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/dw_src
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/dw_pulse_width
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/ins_fpm_irq_0
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/avs_address
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/avs_write
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/avs_writedata
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/avs_read
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/avs_readdatavalid
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/avs_readdata
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/enable_rx_i
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/fine_time_wrap
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/time_ld_en
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/rx_watchdog_en_i
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/rx_watchdog_clr_i
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/uart_regen_bypass_i
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/upd_min_pos_i
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/upd_max_pos_i
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/fpm_init_i
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/fpm_init_d
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/fpm_init_start
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/fpm_init_done
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/fpm_init_done_flag
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/fpm_init_pulse
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/irq
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/irq_src
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/irq_src_d
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/irq_en
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/irq_mask
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/irq_val
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/irq_clr
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/src_sel_i
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/dw_src_i
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/mp_sel0
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/mp_sel1
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/mp_sel2
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/mp_sel3
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/bit_div
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/error_rate_thres_i
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/init_cnt
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/dw_pulse_width_i
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/fine_time_init
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/fine_time_i
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/coarse_time_init
add wave -noupdate -group {FPM Ctrl} /fire_pulse_manager_7_tb/iDUT/iCTRL/coarse_time_i
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/clk
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/reset_n
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/init
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/avs_address
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/avs_write
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/avs_writedata
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/avs_read
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/avs_readdatavalid
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/avs_readdata
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/rs422_pd
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/rs422_p1
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/rs422_p2
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/rs422_zp
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/ttl_pd
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/ttl_pd_npn
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/ttl_p1
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/ttl_p2
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/ttl_zp
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/abs_position
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/pd_out
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/print_start
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/set_pos
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/inc_pos
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/dec_pos
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/filt_p1
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/filt_p2
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/filt_zp
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/filt_pd
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/init_i
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/ttl_pd_i
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/sel_ttl_npn
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/pd_mux
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/p1_mux
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/p2_mux
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/zp_mux
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/ems_init
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/pd_i
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/pd_re
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/pd_fe
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/p1_i
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/p1_re
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/p1_fe
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/p2_i
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/p2_re
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/p2_fe
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/zp_i
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/p1_re_i
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/p1_fe_i
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/p2_re_i
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/p2_fe_i
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/enc_ph1_en
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/enc_ph2_en
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/enc_rising_en
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/enc_falling_en
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/step_pos_i
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/step_neg_i
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/step_pos
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/step_neg
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/set_pos_i
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/set_abs_pos
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/wrap_pos
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/wrap_neg
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/inc_pos_i
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/dec_pos_i
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/ems_enable
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/pd_hyst_filt
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/set_pd_hyst_filt
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/pd_event
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/clr_pd_hyst_filt
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/sw_pos_step
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/sw_neg_step
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/pd_rising_en
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/pd_falling_en
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/sw_pd
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/pd
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/kickstart_pd
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/sw_clr_pd_hyst_filt
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/ld_filt_cfg_pd
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/ld_filt_cfg_zp
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/ld_filt_cfg_p1
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/ld_filt_cfg_p2
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/switch_pos_neg_inc
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/step_pos_ii
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/step_neg_ii
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/enc_enable
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/enc_enable_i
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/pd_enable
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/pd_enable_i
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/wrap_pos_i
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/wrap_neg_i
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/use_multiplier
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/m_step_pos
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/m_step_neg
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/step_pos_retimed
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/step_neg_retimed
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/init_mult
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/enable_mult
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/enc_sel
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/pd_sel
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/mult_sel
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/pd_delay_line
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/enc_cnt
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/enc_divide
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/filt_order
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/filt_hyst
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/avg_steps
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/pd_hyst_val
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/pd_hyst_pos_cnt
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/pd_hyst_neg_cnt
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/hw_pd_cnt
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/total_pd_cnt
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/delta_init
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/time_out
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/abs_pos_i
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/abs_pos_init
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/abs_pos_in
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/abs_pos_vel
add wave -noupdate -group EMS /fire_pulse_manager_7_tb/iDUT/gEMS/iEMS/delta_t
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/clk
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/reset_n
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/init
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/pd_in
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/abs_position
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/enc_vel
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/enc_speed_meas_w
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/dp_dir
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/fire_req_vec
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/start_of_image_vec
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/filtered_pd
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/ch_pd
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/ch_mask
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/raw_fire_req
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/enc_pulse
add wave -noupdate -group PG-0 -radix hexadecimal /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/avs_address
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/avs_write
add wave -noupdate -group PG-0 -radix hexadecimal /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/avs_writedata
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/avs_read
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/avs_readdatavalid
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/avs_readdata
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/init_de
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/init_qd
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/enable
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/loc_pd
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/pd_queue_error
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/ch_ctrl_start_req
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/pd_pulse
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/filt_pd
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/filt_pd_d
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/ch_ctrl_write
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/ch_ctrl_read
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/ch_ctrl_busy
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/enable_i
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/ch_mask_i
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/bypass_ch_ctrl
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/bypass_delay_equal
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/div_pulse
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/gated_pulse
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/retimed_pulse
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/avs_write_i
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/avs_read_d
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/avs_read_i
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/de_queue_error
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/cnt_dir
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/dp_dir_i
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/ch_ctrl_start_req_i
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/set_first_pd
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/dp_dir_d
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/loc_pd_d
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/loc_pd_dd
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/start_img_req
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/start_img_req_d
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/start_img
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/start_img_d
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/start_img_dd
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/fire_enable
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/img_completed
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/sw_ctrl_dp_dir
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/enable_out
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/ch_ctrl_start_req_d
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/add_img_size
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/add_img_size_d
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/abort_fire
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/ch_ctrl_csr_write
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/ch_ctrl_csr_read
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/frac_div_en_i
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/upd_max_pos
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/upd_min_pos
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/frac_div_en
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/gen_filt_pd
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/upd_max_pos_i
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/upd_min_pos_i
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/dir_change
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/first_pd
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/pd_in_d
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/filt_pd_i
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/abs_pos_lsb
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/ch_ctrl_start_req_ii
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/prevent_div_restart
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/rst_jitter
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/abs_position
add wave -noupdate -group PG-0 -radix unsigned /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/subpix_phase_cnt
add wave -noupdate -group PG-0 -radix unsigned /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/subpixel_phase_num
add wave -noupdate -group PG-0 -radix hexadecimal /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/subpix_phase
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/rst_diag_regs
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/fire_req
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/start_of_image
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/new_pixel
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/mid_cross
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/mid_crossed
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/zero_cross
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/close_to_zero
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/close_to_mid
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/div_pulse_i
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/spitting_enable
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/spit_pulse
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/seq_bus_valid
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/spit_nco_msb
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/wh_apply_corr_en
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/wh_error_meas_avail
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/wh_corr_ready
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/wh_error_meas_started
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/init_wh
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/wh_meas_event
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/wh_img_end
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/first_img_started
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/tof_lut_wr_en
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/tof_comp_enable
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/tof_saturation
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/tof_sat_flag
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/wh_apply_corr_en_d
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/wh_corr_start
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/wh_skip_corr
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/wh_img_2nd_half
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/wh_img_2nd_half_d
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/selected_pulse
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/selected_pulse_d
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/clr_pd_queue
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/zero_gap_mode
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/start_image_flag
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/use_ch_offset_dir1
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/add_ppc_regs
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/add_tof_comp_regs
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/add_delay_eq_reg
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/add_diag_reg
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/abs_pos_msb_old
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/ch_ctrl_csr_addr
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/ch_ctrl_trigger_in
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/wh_corr_ready_v
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/avs_addr
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/init_v
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/ch_ctrl_start_addr
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/bpe_top
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/ch_ctrl_address
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/tof_lut_wr_addr
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/tof_lut_addr
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/avs_address_i
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/wh_rotat_cnt
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/gnd_16
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/wh_loop_filt_tot
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/wh_loop_filt_delta
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/ch_delay
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/ch_delay_i
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/enc_speed_norm_coeff
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/tof_lut_wr_data
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/tof_lut_wr_q
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/tof_lut_comp
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/tof_lut_comp_i
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/pd_cnt
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/enc_speed_meas_w_i
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/enc_vel_i
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/img_size
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/pixel_cnt
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/ch_ctrl_vector_out
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/wh_skip_corr_thres
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/wh_img_pixel_cnt
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/wh_image_pixel_len
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/basic_pos_error_sat
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/fire_req_cnt
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/norm_enc_vel
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/ch_offset
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/avs_readdata_i
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/ch_ctrl_writedata
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/ch_ctrl_readdata
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/ch_ctrl_csr_writedata
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/ch_ctrl_csr_readdata
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/ch_offset_dir0
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/ch_offset_dir1
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/abs_pos_max
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/abs_pos_min
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/last_pd_pos
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/basic_pos_error
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/seq_bus_data
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/spit_nco
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/spit_nco_inc
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/start_pos
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/abs_pos_d
add wave -noupdate -group PG-0 -radix hexadecimal /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/subpix_phase
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/wh_pos_err_2_corr
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/wh_pos_err_max
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/wh_pos_err_min
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/wh_pos_err
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/wh_pos_err_curr
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/wh_pos_err_old
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/wh_pos_err_abs
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/wh_tot_err
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/wh_delta_err
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/div_ratio
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/div_ratio_i
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/div_ratio_corr
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/div_ratio_corr_new
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/wh_loop_err_delta
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/wh_loop_err_tot
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/pos_error
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/wh_loop_err
add wave -noupdate -group PG-0 /fire_pulse_manager_7_tb/iDUT/pulse_generator_g(0)/iCH_PG/div_ratio_corr_ext
TreeUpdate [SetDefaultTree]
WaveRestoreCursors {{Cursor 1} {10405000 ps} 0}
quietly wave cursor active 1
configure wave -namecolwidth 223
configure wave -valuecolwidth 100
configure wave -justifyvalue left
configure wave -signalnamewidth 1
configure wave -snapdistance 10
configure wave -datasetprefix 0
configure wave -rowmargin 4
configure wave -childrowmargin 2
configure wave -gridoffset 0
configure wave -gridperiod 1
configure wave -griddelta 40
configure wave -timeline 0
configure wave -timelineunits ps
update
WaveRestoreZoom {0 ps} {778147840 ps}

View file

@ -0,0 +1,103 @@
onerror {resume}
quietly WaveActivateNextPane {} 0
add wave -noupdate /led_tb/reset_n
add wave -noupdate /led_tb/clk
add wave -noupdate /led_tb/init
add wave -noupdate /led_tb/pd
add wave -noupdate /led_tb/enc_p1
add wave -noupdate /led_tb/enc_p2
add wave -noupdate /led_tb/pof
add wave -noupdate /led_tb/all_ok
add wave -noupdate /led_tb/led_pd_g
add wave -noupdate /led_tb/led_pd_y
add wave -noupdate /led_tb/led_pd_r
add wave -noupdate /led_tb/led_enc_p1_g
add wave -noupdate /led_tb/led_enc_p1_y
add wave -noupdate /led_tb/led_enc_p1_r
add wave -noupdate /led_tb/led_enc_p2_g
add wave -noupdate /led_tb/led_enc_p2_y
add wave -noupdate /led_tb/led_enc_p2_r
add wave -noupdate /led_tb/led_pof_g
add wave -noupdate /led_tb/led_pof_y
add wave -noupdate /led_tb/led_pof_r
add wave -noupdate /led_tb/setup
add wave -noupdate /led_tb/running
add wave -noupdate /led_tb/passed
add wave -noupdate /led_tb/failed
add wave -noupdate /led_tb/test_timeout
add wave -noupdate /led_tb/test_completed
add wave -noupdate /led_tb/error_flag
add wave -noupdate /led_tb/iUUT/reset_n
add wave -noupdate /led_tb/iUUT/clk
add wave -noupdate /led_tb/iUUT/init
add wave -noupdate /led_tb/iUUT/pd
add wave -noupdate /led_tb/iUUT/enc_p1
add wave -noupdate /led_tb/iUUT/enc_p2
add wave -noupdate /led_tb/iUUT/pof
add wave -noupdate /led_tb/iUUT/all_ok
add wave -noupdate /led_tb/iUUT/led_pd_g
add wave -noupdate /led_tb/iUUT/led_pd_y
add wave -noupdate /led_tb/iUUT/led_pd_r
add wave -noupdate /led_tb/iUUT/led_enc_p1_g
add wave -noupdate /led_tb/iUUT/led_enc_p1_y
add wave -noupdate /led_tb/iUUT/led_enc_p1_r
add wave -noupdate /led_tb/iUUT/led_enc_p2_g
add wave -noupdate /led_tb/iUUT/led_enc_p2_y
add wave -noupdate /led_tb/iUUT/led_enc_p2_r
add wave -noupdate /led_tb/iUUT/led_pof_g
add wave -noupdate /led_tb/iUUT/led_pof_y
add wave -noupdate /led_tb/iUUT/led_pof_r
add wave -noupdate /led_tb/iUUT/pd_d
add wave -noupdate /led_tb/iUUT/enc_p1_d
add wave -noupdate /led_tb/iUUT/enc_p2_d
add wave -noupdate /led_tb/iUUT/one_ms_pulse
add wave -noupdate /led_tb/iUUT/pd_event
add wave -noupdate /led_tb/iUUT/pd_cnt_zero_flag
add wave -noupdate /led_tb/iUUT/rst_pd_green
add wave -noupdate /led_tb/iUUT/pd_red
add wave -noupdate /led_tb/iUUT/pd_green
add wave -noupdate /led_tb/iUUT/p1_event
add wave -noupdate /led_tb/iUUT/p2_event
add wave -noupdate /led_tb/iUUT/p1_cnt_zero_flag
add wave -noupdate /led_tb/iUUT/p2_cnt_zero_flag
add wave -noupdate /led_tb/iUUT/rst_p1_green
add wave -noupdate /led_tb/iUUT/rst_p2_green
add wave -noupdate /led_tb/iUUT/p1_red
add wave -noupdate /led_tb/iUUT/p2_red
add wave -noupdate /led_tb/iUUT/p1_green
add wave -noupdate /led_tb/iUUT/p2_green
add wave -noupdate /led_tb/iUUT/pof_green
add wave -noupdate /led_tb/iUUT/rst_pof_green
add wave -noupdate /led_tb/iUUT/pof_d
add wave -noupdate /led_tb/iUUT/pof_event
add wave -noupdate /led_tb/iUUT/pof_cnt_zero_flag
add wave -noupdate /led_tb/iUUT/all_ok_d
add wave -noupdate /led_tb/iUUT/alert_cnt_zero_flag
add wave -noupdate /led_tb/iUUT/pd_active
add wave -noupdate /led_tb/iUUT/p1_active
add wave -noupdate /led_tb/iUUT/p2_active
add wave -noupdate /led_tb/iUUT/alert_led
add wave -noupdate -radix unsigned /led_tb/iUUT/pd_cnt
add wave -noupdate -radix unsigned /led_tb/iUUT/p1_cnt
add wave -noupdate -radix unsigned /led_tb/iUUT/p2_cnt
add wave -noupdate -radix unsigned /led_tb/iUUT/pof_cnt
add wave -noupdate -radix unsigned /led_tb/iUUT/alert_cnt
add wave -noupdate -radix unsigned /led_tb/iUUT/one_ms_cnt
TreeUpdate [SetDefaultTree]
WaveRestoreCursors {{Cursor 1} {510235000 ps} 0}
quietly wave cursor active 1
configure wave -namecolwidth 238
configure wave -valuecolwidth 137
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 {33524561308 ps} {49777259932 ps}

File diff suppressed because it is too large Load diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,4 @@
m255
K4
z0
cModel Technology

View file

@ -0,0 +1,38 @@
-------------------------------------------------------------------------------
-- Title : fire_pulse_pkg
-- Project : HMB/EMB/SMB
-------------------------------------------------------------------------------
-- File : fire_pulse_pkg.vhd
-- Author : Gianmarco Girau
-- Company : Global Inkjet Systems
-- Created : 2017-09-08
-- Last update: 2020-04-17
-- SVN ID : Git
-- Standard : VHDL'08
-------------------------------------------------------------------------------
-- Description:
-- Package for fire_pulse_manager block
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
package fire_pulse_7_pkg is
-----------------------------------------------------------------------------
-- Inner block mapping
-----------------------------------------------------------------------------
constant BLK_SIZE : integer := 2048;
constant FP_CTRL_ID : natural := 0; -- Block ID for the Fire-Pulse-Mang Controller
constant DIAG_BLK_ID : natural := 1; -- Block ID for the Diagnostic Block
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 EMS_BLK_ID : natural := 4; -- Block ID for the EMS block
constant POF_BLK_ID : natural := 5; -- Block ID for the POF output interface
constant PG_CH_ID : natural := 6; -- Block ID for Pulse-Generator
end package fire_pulse_7_pkg;

View file

@ -0,0 +1,265 @@
-------------------------------------------------------------------------------
-- 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: 2020-05-15
-- SVN ID : Git
-- Standard : VHDL'08
-------------------------------------------------------------------------------
-- Description:
-- Control service logic for the Fire-Controller-Manager
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library work;
entity fire_pulse_ctrl_7 is
port(
reset_n : in std_logic;
clk : in std_logic;
fpm_config : in std_logic_vector(10 downto 0);
fpm_init : out std_logic;
src_sel : out std_logic_vector(3 downto 0);
uart_regen_bypass : out std_logic;
enable_rx : out std_logic;
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);
pd_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;
dw_src : out std_logic_vector( 3 downto 0);
dw_pulse_width : out std_logic_vector(15 downto 0);
led_status : in std_logic_vector(11 downto 0);
-- Interrupt Senders
ins_fpm_irq_0 : out std_logic;
-- Avalon MM Interface
avs_address : in std_logic_vector(4 downto 0);
avs_write : in std_logic;
avs_writedata : in std_logic_vector(31 downto 0);
avs_read : in std_logic;
avs_readdata : out std_logic_vector(31 downto 0));
end entity fire_pulse_ctrl_7;
architecture rtl of fire_pulse_ctrl_7 is
-----------------------------------------------------------------------------
-- 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 fpm_init_i, fpm_init_d : std_logic;
signal fpm_init_start, fpm_init_done : std_logic;
signal fpm_init_done_flag, fpm_init_pulse : 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, dw_src_i : std_logic_vector( 3 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, init_cnt : std_logic_vector( 7 downto 0);
signal dw_pulse_width_i : std_logic_vector(15 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);
begin
pCTRL_REGs : process(reset_n, clk)
begin -- process
if (reset_n = '0') then
fpm_init_i <= '0';
fpm_init_d <= '0';
fpm_init_done_flag <= '0';
init_cnt <= (others => '0');
fine_time_i <= (others => '0');
coarse_time_i <= (others => '0');
elsif (clk = '1' and clk'event) then
fpm_init_d <= fpm_init_start;
if(fpm_init_start = '1' and fpm_init_d = '0') then
fpm_init_done_flag <= '0';
elsif(fpm_init_done = '1') then
fpm_init_done_flag <= '1';
end if;
if(fpm_init_pulse = '1') then
fpm_init_i <= '1';
elsif(fpm_init_done = '1') then
fpm_init_i <= '0';
end if;
if(fpm_init_pulse = '1') then
init_cnt <= (others => '0');
elsif(fpm_init_i = '1') then
init_cnt <= std_logic_vector(unsigned(init_cnt)+1);
end if;
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;
fpm_init_pulse <= fpm_init_start and fpm_init_d;
fpm_init_done <= '1' when unsigned(init_cnt) = 50 else '0';
fpm_init <= fpm_init_i;
fine_time_wrap <= '1' when unsigned(fine_time_i) = FINE_TIME_TC else '0';
coarse_time <= coarse_time_i;
fine_time <= fine_time_i;
dw_src <= dw_src_i;
dw_pulse_width <= dw_pulse_width_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
-----------------------------------------------------------------------------
fpm_ctrl_7_csr_regs_i : entity work.fpm_ctrl_7_csr_regs
generic map (
ADDR_DECODE_WIDTH => 5
)
port map (
-- Clock and reset
clk => clk,
rst_n => reset_n,
-- auto-generated
-- Internal signal ports
fpm_init_start => fpm_init_start,
signal_selection_fire_pulse_sel => src_sel_i(0),
signal_selection_enc_pd_emul_en => src_sel_i(1),
signal_selection_seb_epd_en => src_sel_i(2),
signal_selection_seb_epd_linkout_sel => src_sel_i(3),
pof_receiver_control_pof_rx_enable => enable_rx_i,
pof_receiver_control_uart_regeneration_bypass => uart_regen_bypass_i,
pof_receiver_control_clear_max => open,
pof_receiver_control_clear_min => open,
pof_receiver_control_uart_rx_div => open,
monitoring_point_selection_mp0 => mp_sel0,
monitoring_point_selection_mp1 => mp_sel1,
monitoring_point_selection_mp2 => mp_sel2,
monitoring_point_selection_mp3 => mp_sel3,
coarse_time_init => coarse_time_init,
fine_time_init_fine_time_init => fine_time_init,
fine_time_init_time_load_en => time_ld_en,
pof_rx_control_w_error_rate_thres => error_rate_thres_i,
pof_rx_control_w_rx_watchdog_en => rx_watchdog_en_i,
pof_rx_control_w_rx_watchdog_clr => rx_watchdog_clr_i,
fpm_interrupt_irq_en => irq_en(0),
fpm_interrupt_irq_clr => irq_clr(0),
fpm_interrupt_irq_mask => irq_mask(0),
drop_watch_config_dw_src => dw_src_i,
drop_watch_config_dw_pulse_width => dw_pulse_width_i,
fpm_config_ch_num => fpm_config(3 downto 0),
fpm_config_seb_epd_logic_present => fpm_config(4),
fpm_config_smb_diagnostic_present => fpm_config(5),
fpm_config_event_logger_present => fpm_config(6),
fpm_config_pof_protocol_version => fpm_config(7),
fpm_config_delay_equalization_enable => fpm_config(8),
fpm_config_tof_comp_enable => fpm_config(9),
fpm_config_pixel_pitch_corr_enable => fpm_config(10),
fpm_init_done => fpm_init_done_flag,
fine_time_status => fine_time_i,
coarse_time_status => coarse_time_i,
pof_rx_status_parity_bit_error_count => parity_err_cnt,
pof_rx_status_skipped_position_error_count => skip_pos_cnt,
pof_rx_control_r_rx_watchdog => rx_watchdog,
pof_rx_control_r_rx_error_flag => max_error_flag,
irq_status => irq_val(0),
pd_cnt => pd_cnt,
seb_epd_led_status_led_pd_g => led_status(0),
seb_epd_led_status_led_pd_y => led_status(1),
seb_epd_led_status_led_pd_r => led_status(2),
seb_epd_led_status_led_enc_p1_g => led_status(3),
seb_epd_led_status_led_enc_p1_y => led_status(4),
seb_epd_led_status_led_enc_p1_r => led_status(5),
seb_epd_led_status_led_enc_p2_g => led_status(6),
seb_epd_led_status_led_enc_p2_y => led_status(7),
seb_epd_led_status_led_enc_p2_r => led_status(8),
seb_epd_led_status_led_pof_in_g => led_status(9),
seb_epd_led_status_led_pof_in_y => led_status(10),
seb_epd_led_status_led_pof_in_r => led_status(11),
-- end auto-generated
-- Slave bus port
avs_address => avs_address(4 downto 0),
avs_write => avs_write,
avs_writedata => avs_writedata,
avs_read => avs_read,
avs_readdata => avs_readdata
);
src_sel <= src_sel_i;
enable_rx <= enable_rx_i;
uart_regen_bypass <= uart_regen_bypass_i;
error_rate_thres <= error_rate_thres_i;
rx_watchdog_en <= rx_watchdog_en_i;
rx_watchdog_clr <= rx_watchdog_clr_i;
end architecture rtl;

View file

@ -0,0 +1,898 @@
-------------------------------------------------------------------------------
-- 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: 2020-05-19
-- SVN ID : Git
-- Standard : VHDL'08
-------------------------------------------------------------------------------
-- Description:
-- Generates fire request from the EMS output data
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library work;
use work.common_pkg.all;
use work.fire_pulse_7_pkg.all;
entity fire_pulse_manager_7 is
generic (
SEB_EPD_MODE : boolean := false; -- Support SEB-EPD
CH_NUM : integer range 1 to 15 := 4; -- number of Pulse-Generator blocks
PD_QUEUE_SIZE : natural := 512;
ADD_SMB_DIAG : boolean := false; -- Instantiate SMB Diagnostic block
ADD_EVENT_LOGGER : boolean := false; -- Instantiate Event-Logger block
LOG_FIFO_SIZE : natural range 256 to 4096 := 1024;
POF_PROT_VER : natural range 0 to 1 := 0; -- POF-Protocol Versions:
-- 0 => Standard, 1 => Add Print-Start
PULSE_DELAY_EQUAL_EN : boolean := false;
TOF_COMP_EN : boolean := false;
PIXEL_PITCH_CORR_EN : boolean := false);
port(
reset_n : in std_logic;
clk : in std_logic; -- 100MHz
rx_clk : in std_logic; -- 300MHz (typical)
-- Datapath I/Os
pof_rx : in std_logic;
pof_tx : out std_logic;
pof_iso_en : out std_logic;
seb_epd_mode_en : out std_logic;
seb_epd_enc_p1 : in std_logic;
seb_epd_enc_p2 : in std_logic;
seb_epd_pd : in std_logic;
fire_pulse : out std_logic_vector(32*CH_NUM - 1 downto 0);
start_of_image : out std_logic_vector(32*CH_NUM - 1 downto 0);
stream_busy_a : in std_logic_vector(CH_NUM - 1 downto 0) := (others => '0');
stream_busy_b : in std_logic_vector(CH_NUM - 1 downto 0) := (others => '0');
dp_dir_out : out std_logic_vector(CH_NUM - 1 downto 0);
abs_pos_out : out std_logic_vector(31 downto 0);
print_start : out std_logic;
mon_pt : out std_logic_vector(3 downto 0); -- Monitoring Points
-- on header J7
-- Interrupt Senders
ins_fpm_irq_0 : out std_logic;
ins_fpm_irq_1 : out std_logic; -- @suppress "Unused port: ins_fpm_irq_1 is not used in work.fire_pulse_manager_6(rtl)"
ins_fpm_irq_2 : out std_logic; -- @suppress "Unused port: ins_fpm_irq_2 is not used in work.fire_pulse_manager_6(rtl)"
ins_fpm_irq_3 : out std_logic; -- @suppress "Unused port: ins_fpm_irq_3 is not used in work.fire_pulse_manager_6(rtl)"
-- Avalon MM (Slave) Interface
avs_address : in std_logic_vector(14 downto 0);
avs_write : in std_logic;
avs_writedata : in std_logic_vector(31 downto 0);
avs_read : in std_logic;
avs_readdata : out std_logic_vector(31 downto 0));
end entity fire_pulse_manager_7;
architecture rtl of fire_pulse_manager_7 is
-- Period used for Time-of-Flight compensation velocity measurememnt
constant VEL_MEAS_PERIOD : natural := 10000;
constant POF_UART_BIT_BIV : integer := 6; -- POF-Rx UART sampling clock vs
-- baudrate ratio
constant BLK_NUM : natural := 6 + CH_NUM;
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_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_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_data : std_logic_vector(32 * CH_NUM - 1 downto 0);
--
signal cs_diag_write_en : std_logic;
signal cs_diag_read_en : std_logic;
signal cs_diag_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_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_data : std_logic_vector(31 downto 0);
--
signal cs_ems_write_en : std_logic;
signal cs_ems_read_en : std_logic;
signal cs_ems_read_data : std_logic_vector(31 downto 0);
--
signal cs_pof_write_en : std_logic;
signal cs_pof_read_en : std_logic;
signal cs_pof_read_data : std_logic_vector(31 downto 0);
--
signal enable_rx : std_logic;
signal uart_regen_bypass : 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 print_start_i : std_logic;
signal dw_src : 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 dw_pulse_width : 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 init, 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_vector(CH_NUM - 1 downto 0);
signal pd_pulse : std_logic;
signal pd_pulse_ie : std_logic;
signal pd_pulse_pof : std_logic;
signal pd_ems : std_logic;
--
signal inc_pos : std_logic;
signal inc_pos_pof : std_logic;
signal inc_pos_ie : std_logic;
signal inc_pos_ems : std_logic;
signal dec_pos : std_logic;
signal dec_pos_pof : std_logic;
signal dec_pos_ie : std_logic;
signal dec_pos_ems : std_logic;
signal abs_pos : std_logic_vector(31 downto 0);
signal abs_pos_pof : std_logic_vector(31 downto 0);
signal abs_pos_ems : std_logic_vector(31 downto 0);
signal abs_pos_ie : std_logic_vector(39 downto 0);
--
signal pd_pulse_mux : std_logic;
signal enc_p1_mux : std_logic;
signal enc_p2_mux : std_logic;
signal enc_p1_ie : std_logic;
signal enc_p2_ie : std_logic;
signal ems_filt_pd : std_logic;
signal ems_filt_p1 : std_logic;
signal ems_filt_p2 : std_logic;
--
signal pof_tx_regen : std_logic;
signal pof_tx_data : std_logic;
signal dw_pulse : std_logic;
signal dw_pulse_i : std_logic;
signal rst_dw_pulse : std_logic;
signal set_dw_pulse : std_logic;
signal dw_trigger : std_logic;
signal dw_trigger_d : std_logic;
signal dw_pulse_cnt : std_logic_vector(15 downto 0);
--
signal pd_cnt : std_logic_vector(15 downto 0);
--
type fire_pulse_t is array (0 to CH_NUM-1) of std_logic_vector(31 downto 0);
signal ch_fire_pulse : fire_pulse_t;
signal ch_start_of_image : fire_pulse_t;
signal ch_pd : std_logic_vector(CH_NUM - 1 downto 0);
signal ch_raw_pulse, ch_mask : std_logic_vector(CH_NUM - 1 downto 0);
signal src_sel : std_logic_vector(3 downto 0);
signal fpm_init : std_logic;
--
signal ext_fp_in_sync : std_logic;
signal ext_fp_in : std_logic;
signal ext_fp_in_d : std_logic;
signal ext_fp : std_logic;
--
type vel_samp_per_vec_t is array (0 to CH_NUM-1) of std_logic_vector(19 downto 0);
signal vel_meas : std_logic_vector(19 downto 0);
signal vel_sampling_per : vel_samp_per_vec_t;
--
signal one_pps : std_logic;
signal log_data_src : std_logic_vector(31 downto 0);
--
signal led_pd_g : std_logic;
signal led_pd_y : std_logic;
signal led_pd_r : std_logic;
signal led_enc_p1_g : std_logic;
signal led_enc_p1_y : std_logic;
signal led_enc_p1_r : std_logic;
signal led_enc_p2_g : std_logic;
signal led_enc_p2_y : std_logic;
signal led_enc_p2_r : std_logic;
signal led_pof_g : std_logic;
signal led_pof_y : std_logic;
signal led_pof_r : std_logic;
signal led_status : std_logic_vector(11 downto 0);
--
signal fpm_generic_status : std_logic_vector(10 downto 0);
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_no_wait
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_readdata => avs_readdata,
cs_addr => cs_addr,
cs_we => cs_write_en,
cs_wr_data => cs_write_data,
cs_re => cs_read_en,
cs_rd_data => cs_read_data);
cs_ctrl_write_en <= cs_write_en(FP_CTRL_ID);
cs_diag_write_en <= cs_write_en(DIAG_BLK_ID);
cs_log_write_en <= cs_write_en(LOG_BLK_ID);
cs_ie_write_en <= cs_write_en(INT_ENC_ID);
cs_ems_write_en <= cs_write_en(EMS_BLK_ID);
cs_pof_write_en <= cs_write_en(POF_BLK_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_ctrl_read_en <= cs_read_en(FP_CTRL_ID);
cs_diag_read_en <= cs_read_en(DIAG_BLK_ID);
cs_log_read_en <= cs_read_en(LOG_BLK_ID);
cs_ie_read_en <= cs_read_en(INT_ENC_ID);
cs_ems_read_en <= cs_read_en(EMS_BLK_ID);
cs_pof_read_en <= cs_read_en(POF_BLK_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_read_data(31 + 32 * FP_CTRL_ID downto 32 * FP_CTRL_ID) <= cs_ctrl_read_data;
cs_read_data(31 + 32 * DIAG_BLK_ID downto 32 * DIAG_BLK_ID) <= cs_diag_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;
cs_read_data(31 + 32 * EMS_BLK_ID downto 32 * EMS_BLK_ID) <= cs_ems_read_data;
cs_read_data(31 + 32 * POF_BLK_ID downto 32 * POF_BLK_ID) <= cs_pof_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;
-----------------------------------------------------------------------------
-- Fire-Pulse-Manager Controller
-----------------------------------------------------------------------------
iCTRL : entity work.fire_pulse_ctrl_7
port map(
reset_n => reset_n_i,
clk => clk,
fpm_config => fpm_generic_status,
fpm_init => fpm_init,
src_sel => src_sel,
uart_regen_bypass => uart_regen_bypass,
enable_rx => enable_rx,
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,
pd_cnt => pd_cnt,
mon_point_src => mon_point_src,
mon_points => mon_pt,
coarse_time => coarse_time,
fine_time => fine_time,
one_pps => one_pps,
dw_src => dw_src,
dw_pulse_width => dw_pulse_width,
led_status => led_status,
ins_fpm_irq_0 => ins_fpm_irq_0,
avs_address => cs_addr(4 downto 0),
avs_write => cs_ctrl_write_en,
avs_writedata => cs_write_data,
avs_read => cs_ctrl_read_en,
avs_readdata => cs_ctrl_read_data);
fpm_generic_status( 3 downto 0) <= std_logic_vector(to_unsigned(CH_NUM, 4));
fpm_generic_status(4) <= '1' when SEB_EPD_MODE = true else '0';
fpm_generic_status(5) <= '1' when ADD_SMB_DIAG = true else '0';
fpm_generic_status(6) <= '1' when ADD_EVENT_LOGGER = true else '0';
fpm_generic_status(7) <= '1' when POF_PROT_VER = 1 else '0';
fpm_generic_status(8) <= '1' when PULSE_DELAY_EQUAL_EN = true else '0';
fpm_generic_status(9) <= '1' when TOF_COMP_EN = true else '0';
fpm_generic_status(10) <= '1' when PIXEL_PITCH_CORR_EN = true else '0';
-----------------------------------------------------------------------------
-- I/Os selection
-----------------------------------------------------------------------------
pENC_PD_SRC_SEL : process(clk)
begin
if(clk = '1' and clk'event) then
-- Abs-Pos and PD source selection
if(src_sel(2) = '1') then
-- Use SEB-EPD inputs
pd_pulse <= pd_ems;
abs_pos <= abs_pos_ems;
inc_pos <= inc_pos_ems;
dec_pos <= dec_pos_ems;
else
if(src_sel(1) = '0') then
pd_pulse <= pd_pulse_pof;
abs_pos <= abs_pos_pof;
inc_pos <= inc_pos_pof;
dec_pos <= dec_pos_pof;
else
pd_pulse <= pd_pulse_ie;
abs_pos <= abs_pos_ie(31 downto 0);
inc_pos <= inc_pos_ie;
dec_pos <= dec_pos_ie;
end if;
end if;
end if;
end process pENC_PD_SRC_SEL;
gPOF_TX_OUT : if SEB_EPD_MODE = true generate
pof_tx <= dw_pulse when src_sel(3) = '1' else
pof_tx_regen when src_sel(2) = '0' else
pof_tx_data;
pBUF_SEB_EPD_MODE : process(clk)
begin
if(clk = '1' and clk'event) then
seb_epd_mode_en <= src_sel(2);
end if;
end process pBUF_SEB_EPD_MODE;
else generate
pof_tx <= pof_tx_regen;
seb_epd_mode_en <= '0';
end generate gPOF_TX_OUT;
pBUF_OUT : process(clk)
begin
if(clk = '1' and clk'event) then
abs_pos_out <= abs_pos;
dp_dir_out <= dp_dir;
for i in 0 to CH_NUM-1 loop
if(src_sel(0) = '1') then
fire_pulse(i*32+31 downto i*32) <= ch_fire_pulse(i);
start_of_image(i*32+31 downto i*32) <= ch_start_of_image(i);
else
fire_pulse(i*32+31 downto i*32) <= (others => ext_fp);
start_of_image(i*32+31 downto i*32) <= (others => '0');
end if;
end loop; -- i
print_start <= print_start_i;
end if;
end process pBUF_OUT;
pINIT_GEN : process(clk)
begin
if(clk = '1' and clk'Event) then
if(src_sel(1) = '0') then
init <= fpm_init or (not src_sel(2) and (not enable_rx or remote_init));
else
init <= fpm_init or set_pos_ie;
end if;
end if;
end process pINIT_GEN;
mon_point_src(0) <= init;
mon_point_src(1) <= dp_dir(0);
mon_point_src(2) <= pd_pulse;
mon_point_src(3) <= enc_pulse(0);
mon_point_src(4) <= ch_pd(0);
mon_point_src(5) <= ch_fire_pulse(0)(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) <= ch_fire_pulse(0)(0);
mon_point_src(10) <= ch_start_of_image(0)(0);
mon_point_src(11) <= inc_pos;
mon_point_src(12) <= dec_pos;
mon_point_src(13) <= print_start_i;
--
mon_point_src(15 downto 14) <= (others => '0');
pof_iso_en <= enable_rx;
-----------------------------------------------------------------------------
-- PD Counter
-----------------------------------------------------------------------------
pPD_CNT : process(clk)
begin
if(clk = '1' and clk'event) then
if(init = '1') then
pd_cnt <= (others => '0');
elsif(pd_pulse = '1') then
pd_cnt <= std_logic_vector(unsigned(pd_cnt) + 1);
end if;
end if;
end process pPD_CNT;
-----------------------------------------------------------------------------
-- Encoder Speed Detection
-----------------------------------------------------------------------------
gENC_VEL: if TOF_COMP_EN = true generate
-- Used for Time-of-Flight Compensation
iVEL : entity work.simple_enc_vel_detect_7
port map (
clk => clk,
init => init,
step_pos => inc_pos,
step_neg => dec_pos,
sampling_period => vel_sampling_per(0),
vel_meas => vel_meas);
else generate
vel_meas <= (others => '0');
end generate gENC_VEL;
-----------------------------------------------------------------------------
-- Pulse Generator
-----------------------------------------------------------------------------
pulse_generator_g : for i in 0 to CH_NUM-1 generate
iCH_PG : entity work.pulse_generator_4
generic map(
PD_QUEUE_SIZE => PD_QUEUE_SIZE,
PULSE_DELAY_EQUAL_EN => PULSE_DELAY_EQUAL_EN,
SPITTING_EN => false,
BIDIR_CH_OFFSET_EN => false,
DIAG_COUNTERS => true,
TOF_COMP_EN => TOF_COMP_EN,
PIXEL_PITCH_CORR_EN => PIXEL_PITCH_CORR_EN)
port map(
clk => clk,
reset_n => reset_n_i,
init => init,
pd_in => pd_pulse,
abs_position => abs_pos,
enc_vel => vel_meas,
enc_speed_meas_w => vel_sampling_per(i),
dp_dir => dp_dir(i),
fire_req_vec => ch_fire_pulse(i),
start_of_image_vec => ch_start_of_image(i),
stream_busy_a => stream_busy_a(i),
stream_busy_b => stream_busy_b(i),
ch_pd => ch_pd(i),
ch_mask => ch_mask(i),
raw_fire_req => ch_raw_pulse(i),
enc_pulse => enc_pulse(i),
avs_address => cs_addr(10 downto 0),
avs_write => cs_pg_write_en(i),
avs_writedata => cs_write_data,
avs_read => cs_pg_read_en(i),
avs_readdata => cs_pg_read_data(31 + 32*i downto 32*i));
end generate;
-----------------------------------------------------------------------------
-- POF Rx Interface
-----------------------------------------------------------------------------
gPOF: if POF_PROT_VER = 0 generate
-- POF Receiver
iPOF_RX : entity work.pof_rx_2
generic map(
PROTOCOL_VER => 0,
GEN_BIT_DIV => POF_UART_BIT_BIV)
port map(
reset_n => reset_n_i,
clk => clk,
init => '0',
rx_clk => rx_clk,
rx_data => pof_rx,
init_out => remote_init,
pd_out => pd_pulse_pof,
inc_pos => inc_pos_pof,
dec_pos => dec_pos_pof,
abs_pos => abs_pos_pof,
enable => enable_rx,
error_rate_thres => error_rate_thres,
one_pps => one_pps,
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.pof_uart_regen_2
generic map(
GEN_BIT_DIV => POF_UART_BIT_BIV,
data_width => 8)
port map(
reset_n => reset_n,
clk => rx_clk,
enable => enable_rx,
bypass_en => uart_regen_bypass,
uart_rx => pof_rx,
uart_tx => pof_tx_regen);
print_start_i <= '0';
elsif POF_PROT_VER = 1 generate
-- POF Receiver
iPOF_RX : entity work.pof_rx_2
generic map(
PROTOCOL_VER => 1,
GEN_BIT_DIV => POF_UART_BIT_BIV)
port map(
reset_n => reset_n_i,
clk => clk,
init => '0',
rx_clk => rx_clk,
rx_data => pof_rx,
init_out => remote_init,
pd_out => pd_pulse_pof,
print_start => print_start_i,
inc_pos => inc_pos_pof,
dec_pos => dec_pos_pof,
abs_pos => abs_pos_pof,
enable => enable_rx,
error_rate_thres => error_rate_thres,
one_pps => one_pps,
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.pof_uart_regen_2
generic map(
GEN_BIT_DIV => POF_UART_BIT_BIV,
data_width => 9)
port map(
reset_n => reset_n,
clk => rx_clk,
enable => enable_rx,
bypass_en => uart_regen_bypass,
uart_rx => pof_rx,
uart_tx => pof_tx);
end generate gPOF;
-----------------------------------------------------------------------------
-- EMS
-----------------------------------------------------------------------------
gEMS : if SEB_EPD_MODE = true generate
iEMS : entity work.ems_1
generic map(
ADD_ENC_ZP_LOGIC => false,
ADD_MULT_DEBUG_REG => false,
GEN_PRINT_START => false)
port map (
clk => clk,
reset_n => reset_n_i,
init => init,
avs_address => cs_addr(3 downto 0),
avs_write => cs_ems_write_en,
avs_writedata => cs_write_data,
avs_read => cs_ems_read_en,
avs_readdata => cs_ems_read_data,
rs422_pd => pd_pulse_mux,
rs422_p1 => enc_p1_mux,
rs422_p2 => enc_p2_mux,
rs422_zp => '0',
ttl_pd => '0',
ttl_pd_npn => '0',
ttl_p1 => '0',
ttl_p2 => '0',
ttl_zp => '0',
abs_position => abs_pos_ems,
pd_out => pd_ems,
print_start => open,
set_pos => open,
inc_pos => inc_pos_ems,
dec_pos => dec_pos_ems,
filt_p1 => ems_filt_p1,
filt_p2 => ems_filt_p2,
filt_zp => open,
filt_pd => ems_filt_pd);
pd_pulse_mux <= seb_epd_pd when src_sel(1) = '0' else pd_pulse_ie;
enc_p1_mux <= seb_epd_enc_p1 when src_sel(1) = '0' else enc_p1_ie;
enc_p2_mux <= seb_epd_enc_p2 when src_sel(1) = '0' else enc_p2_ie;
else generate
cs_ems_read_data <= X"DEAD_BEEF";
abs_pos_ems <= (others => '0');
pd_ems <= '0';
inc_pos_ems <= '0';
dec_pos_ems <= '0';
end generate gEMS;
-----------------------------------------------------------------------------
-- POF-Tx
-----------------------------------------------------------------------------
gPOF_TX : if SEB_EPD_MODE = true generate
-- Default POF-Protocol
iPOF_TX: entity work.pof_tx_2
generic map (
PROTOCOL_VER => 0
)
port map (
reset_n => reset_n_i,
clk => clk,
init => init,
pd_in => pd_ems,
inc_pos => inc_pos_ems,
dec_pos => dec_pos_ems,
abs_position => abs_pos_ems,
tx_data => pof_tx_data,
avs_address => cs_addr(2 downto 0),
avs_write => cs_pof_write_en,
avs_writedata => cs_write_data,
avs_read => cs_pof_read_en,
avs_readdata => cs_pof_read_data);
else generate
cs_pof_read_data <= X"DEAD_BEEF";
pof_tx_data <= '0';
end generate gPOF_TX;
-----------------------------------------------------------------------------
-- SEB-EPD LEDs
-----------------------------------------------------------------------------
gSEB_EPD_LEDs : if SEB_EPD_MODE = true generate
iLED_GEN: entity work.seb_epd_led_gen_7
port map (
reset_n => reset_n,
clk => clk,
init => init,
pd => ems_filt_pd,
enc_p1 => ems_filt_p1,
enc_p2 => ems_filt_p2,
pof => pof_rx,
all_ok => '1',
led_pd_g => led_pd_g,
led_pd_y => led_pd_y,
led_pd_r => led_pd_r,
led_enc_p1_g => led_enc_p1_g,
led_enc_p1_y => led_enc_p1_y,
led_enc_p1_r => led_enc_p1_r,
led_enc_p2_g => led_enc_p2_g,
led_enc_p2_y => led_enc_p2_y,
led_enc_p2_r => led_enc_p2_r,
led_pof_g => led_pof_g,
led_pof_y => led_pof_y,
led_pof_r => led_pof_r);
led_status( 2 downto 0) <= led_pd_r & led_pd_y & led_pd_g;
led_status( 5 downto 3) <= led_enc_p1_r & led_enc_p1_y & led_enc_p1_g;
led_status( 8 downto 6) <= led_enc_p2_r & led_enc_p2_y & led_enc_p2_g;
led_status(11 downto 9) <= led_pof_r & led_pof_y & led_pof_g;
else generate
led_status <= (others => '0');
end generate gSEB_EPD_LEDs;
-----------------------------------------------------------------------------
-- Diagnostic block
-----------------------------------------------------------------------------
gDIAG: if ADD_SMB_DIAG = false generate
cs_diag_read_data <= X"DEAD_BEEF";
ins_fpm_irq_1 <= '0';
ins_fpm_irq_2 <= '0';
ins_fpm_irq_3 <= '0';
elsif ADD_SMB_DIAG = true generate
iDiagnostic : entity work.smb_diagnostics_7
port map(
clk => clk,
reset_n => reset_n_i,
ext_diag_rst => init,
rs422_phase0 => seb_epd_enc_p1,
rs422_phase1 => seb_epd_enc_p2,
rs422_zero_ph => '0',
rs422_prod_det => seb_epd_pd,
ttl_phase0 => '0',
ttl_phase1 => '0',
ttl_zero_ph => '0',
ttl_prod_det => '0',
ttl_prod_det_npn => '0',
filt_phase0 => ems_filt_p1,
filt_phase1 => ems_filt_p2,
filt_zero_ph => '0',
filt_prod_det => pd_pulse,
enc_out => enc_pulse(0),
pd_out => ch_pd(0),
pos_step => inc_pos,
neg_step => dec_pos,
drop_watch => '0',
fire_req => ch_fire_pulse(0)(0),
fine_time => fine_time,
coarse_time => coarse_time,
abs_position => open,
ins_diag_irq_0 => ins_fpm_irq_1,
ins_diag_irq_1 => ins_fpm_irq_2,
ins_diag_irq_2 => ins_fpm_irq_3,
avs_address => cs_addr(5 downto 0),
avs_write => cs_diag_write_en,
avs_writedata => cs_write_data,
avs_read => cs_diag_read_en,
avs_readdatavalid => open,
avs_readdata => cs_diag_read_data);
end generate gDIAG;
-----------------------------------------------------------------------------
-- Event Logger
-----------------------------------------------------------------------------
gEL: if ADD_EVENT_LOGGER = false generate
cs_log_read_data <= X"DEAD_BEEF";
elsif ADD_EVENT_LOGGER = true generate
event_logger_0_1: entity work.event_logger_1
generic map (
FIFO_SIZE => LOG_FIFO_SIZE)
port map (
rstN => reset_n_i,
clk => clk,
data_src => log_data_src,
fine_time => fine_time,
abs_position => abs_pos,
ins_irq => open,
avs_address => cs_addr(3 downto 0),
avs_write => cs_log_write_en,
avs_writedata => cs_write_data,
avs_read => cs_log_read_en,
avs_readdata => cs_log_read_data);
log_data_src(0) <= init;
log_data_src(1) <= dp_dir(0);
log_data_src(2) <= pd_pulse;
log_data_src(3) <= enc_pulse(0);
log_data_src(4) <= ch_pd(0);
log_data_src(5) <= ch_fire_pulse(0)(0);
log_data_src(6) <= ch_raw_pulse(0);
log_data_src(7) <= ch_mask(0);
log_data_src(8) <= pof_rx;
log_data_src(9) <= ch_fire_pulse(0)(0);
log_data_src(10) <= ch_start_of_image(0)(0);
log_data_src(11) <= inc_pos;
log_data_src(12) <= dec_pos;
log_data_src(13) <= print_start_i;
--
log_data_src(31 downto 14) <= (others => '0');
end generate gEL;
-----------------------------------------------------------------------------
-- Ext fire pulse detection
-----------------------------------------------------------------------------
-- just filter all the pulses with a width less than 200 ns
pEXT_PULSE_DETECT : process(clk)
variable pulse_width_cnt : std_logic_vector(4 downto 0);
variable pulse_cnt_en : std_logic := '0';
begin
if(clk = '1' and clk'event) then
ext_fp_in_sync <= pof_rx;
ext_fp_in <= ext_fp_in_sync;
ext_fp <= '0';
ext_fp_in_d <= ext_fp_in;
if(ext_fp_in = '1' and ext_fp_in_d = '0') then
pulse_cnt_en := '1';
pulse_width_cnt := (others => '0');
elsif(pulse_cnt_en = '1' and ext_fp_in_d = '1') then
if(unsigned(pulse_width_cnt) = 19) then
pulse_cnt_en := '0';
ext_fp <= '1';
else
pulse_width_cnt := std_logic_vector(unsigned(pulse_width_cnt)+1);
end if;
end if;
end if;
end process pEXT_PULSE_DETECT;
-----------------------------------------------------------------------------
-- Drop-Watch Pulse generation
-----------------------------------------------------------------------------
pGEN_DW: process(clk)
begin
if(clk = '1' and clk'event) then
dw_trigger_d <= dw_trigger;
if(rst_dw_pulse = '1') then
dw_pulse_i <= '0';
elsif(set_dw_pulse = '1') then
dw_pulse_i <= '1';
end if;
if(rst_dw_pulse = '1') then
dw_pulse_cnt <= (0 => '1', others => '0');
elsif(dw_pulse_i = '1') then
dw_pulse_cnt <= std_logic_vector(unsigned(dw_pulse_cnt) + 1);
end if;
end if;
end process pGEN_DW;
dw_trigger <= ch_fire_pulse(to_integer(unsigned(dw_src(log2(CH_NUM)-1 downto 0))))(0);
rst_dw_pulse <= '1' when init = '1' or unsigned(dw_pulse_cnt) = unsigned(dw_pulse_width) else '0';
set_dw_pulse <= dw_trigger and not dw_trigger_d;
dw_pulse <= dw_pulse_i;
-----------------------------------------------------------------------------
-- Internal encoder generator
-----------------------------------------------------------------------------
iEMUL : entity work.enc_pd_emul_2
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 => enc_p1_ie,
rs422_enc_p2 => enc_p2_ie,
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_readdata => cs_ie_read_data);
end architecture rtl;

View file

@ -0,0 +1,297 @@
-------------------------------------------------------------------------------
-- Title : seb_epd_led_gen_7
-- Project : SMB
-------------------------------------------------------------------------------
-- File : seb_epd_led_gen_7.vhd
-- Author : Gianmarco Girau
-- Company : Global Inkjet Systems
-- Created : 2018-08-06
-- Last update: 2020-04-16
-- SVN ID : Git
-- Standard : VHDL'08
-------------------------------------------------------------------------------
-- Description:
-- Generate signals for driving the SMB LEDs.
-- Note: those signals can still be overwritten by software through the
-- SMB-Ctrl block.
-------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity seb_epd_led_gen_7 is
generic(
MAX_PERIOD_MS : natural := 1000;
GREEN_PERIOD_MS : natural := 200);
port(
reset_n : in std_logic;
clk : in std_logic;
-- config
init : in std_logic;
-- input status signals
pd : in std_logic;
enc_p1 : in std_logic;
enc_p2 : in std_logic;
pof : in std_logic;
all_ok : in std_logic;
-- LEDs outputs values
led_pd_g : out std_logic;
led_pd_y : out std_logic;
led_pd_r : out std_logic;
led_enc_p1_g : out std_logic;
led_enc_p1_y : out std_logic;
led_enc_p1_r : out std_logic;
led_enc_p2_g : out std_logic;
led_enc_p2_y : out std_logic;
led_enc_p2_r : out std_logic;
led_pof_g : out std_logic;
led_pof_y : out std_logic;
led_pof_r : out std_logic);
end entity seb_epd_led_gen_7;
architecture rtl of seb_epd_led_gen_7 is
constant END_GREEN_PERIOD_MS : natural := MAX_PERIOD_MS - GREEN_PERIOD_MS;
signal pd_d, enc_p1_d, enc_p2_d, one_ms_pulse : std_logic;
signal pd_cnt_zero_flag, rst_pd_green, pd_red, pd_green : std_logic;
signal p1_event, p2_event, p1_cnt_zero_flag : std_logic;
signal p2_cnt_zero_flag, pd_event, rst_pof_green : std_logic;
signal rst_p1_green, rst_p2_green, p1_red, p2_red : std_logic;
signal p1_green, p2_green, pof_green, pof_d : std_logic;
signal pof_event, pof_cnt_zero_flag, pof_active : std_logic;
signal all_ok_d, alert_cnt_zero_flag : std_logic;
signal pd_active, p1_active, p2_active : std_logic;
--
signal alert_led : std_logic_vector( 3 downto 0);
signal pd_cnt, pof_cnt : std_logic_vector( 9 downto 0);
signal p1_cnt, p2_cnt, alert_cnt : std_logic_vector( 9 downto 0);
signal one_ms_cnt : std_logic_vector(16 downto 0);
begin
pGEN_1MS_PULSE : process(reset_n, clk)
begin
if(reset_n = '0') then
one_ms_pulse <= '0';
one_ms_cnt <= (others => '0');
elsif(clk = '1' and clk'event) then
if(unsigned(one_ms_cnt) = 100000-1) then
one_ms_pulse <= '1';
one_ms_cnt <= (others => '0');
else
one_ms_pulse <= '0';
one_ms_cnt <= std_logic_vector(unsigned(one_ms_cnt)+1);
end if;
end if;
end process pGEN_1MS_PULSE;
-----------------------------------------------------------------------------
-- PD LEDs
-----------------------------------------------------------------------------
pPD_LEDs : process(reset_n, clk) is
begin -- process
if(reset_n = '0') then
pd_d <= '0';
pd_event <= '0';
pd_cnt <= (others => '0');
pd_green <= '0';
led_pd_y <= '0';
led_pd_g <= '0';
pd_active <= '0';
elsif(clk = '1' and clk'event) then
pd_d <= pd;
pd_event <= pd xor pd_d;
if(init = '1') then
pd_cnt <= (others => '0');
elsif(pd_event = '1') then
pd_cnt <= std_logic_vector(to_unsigned(MAX_PERIOD_MS, pd_cnt'length));
elsif(pd_cnt_zero_flag = '0' and one_ms_pulse = '1') then
pd_cnt <= std_logic_vector(unsigned(pd_cnt)-1);
end if;
if(pd_event = '1') then
pd_green <= '1';
elsif(rst_pd_green = '1' or init = '1') then
pd_green <= '0';
end if;
led_pd_r <= all_ok and pd_red;
led_pd_y <= (all_ok and pd_cnt_zero_flag and pd_active) or alert_led(0);
led_pd_g <= all_ok and pd_green;
if(pd_event = '1') then
pd_active <= '1';
end if;
end if;
end process pPD_LEDs;
pd_cnt_zero_flag <= '1' when unsigned(pd_cnt) = 0 else '0';
rst_pd_green <= '1' when one_ms_pulse = '1' and unsigned(pd_cnt) = END_GREEN_PERIOD_MS else '0';
-- PD red LED is never activated because there is only one PD source
pd_red <= '0';
-----------------------------------------------------------------------------
-- Encoder LEDs
-----------------------------------------------------------------------------
pENC_LEDs : process(reset_n, clk)
begin
if(reset_n = '0') then
p1_cnt <= (others => '0');
p2_cnt <= (others => '0');
p1_red <= '0';
p1_green <= '0';
p2_red <= '0';
p2_green <= '0';
p1_active <= '0';
p2_active <= '0';
elsif(clk = '1' and clk'event) then
if(init = '1') then
p1_cnt <= (others => '0');
elsif(p1_event = '1' and p1_red = '0') then
p1_cnt <= std_logic_vector(to_unsigned(MAX_PERIOD_MS-1, p1_cnt'length));
elsif(p1_cnt_zero_flag = '0' and one_ms_pulse = '1') then
p1_cnt <= std_logic_vector(unsigned(p1_cnt)-1);
end if;
if(init = '1') then
p2_cnt <= (others => '0');
elsif(p2_event = '1' and p2_red = '0') then
p2_cnt <= std_logic_vector(to_unsigned(MAX_PERIOD_MS-1, p2_cnt'length));
elsif(p2_cnt_zero_flag = '0' and one_ms_pulse = '1') then
p2_cnt <= std_logic_vector(unsigned(p2_cnt)-1);
end if;
if(init = '1' or (p1_cnt_zero_flag = '1' and p1_event = '0')) then
p1_red <= '0';
elsif(p1_event = '1' and p2_event ='1') then
p1_red <= '1';
end if;
if(init = '1' or (p2_cnt_zero_flag = '1' and p2_event = '0')) then
p2_red <= '0';
elsif(p2_event = '1' and p1_event ='1') then
p2_red <= '1';
end if;
if(p1_red = '1' or rst_p1_green = '1' or init = '1') then
p1_green <= '0';
elsif(p1_event = '1') then
p1_green <= '1';
end if;
if(p2_red = '1' or rst_p2_green = '1' or init = '1') then
p2_green <= '0';
elsif(p2_event = '1') then
p2_green <= '1';
end if;
if(p1_event = '1') then
p1_active <= '1';
end if;
if(p2_event = '1') then
p2_active <= '1';
end if;
end if;
end process pENC_LEDs;
pENC_LEDs_NR : process(clk)
begin
if(clk = '1' and clk'event) then
enc_p1_d <= enc_p1;
enc_p2_d <= enc_p2;
p1_event <= enc_p1 xor enc_p1_d;
p2_event <= enc_p2 xor enc_p2_d;
led_enc_p1_r <= all_ok and p1_red;
led_enc_p1_y <= (all_ok and p1_cnt_zero_flag and not p1_red and p1_active) or alert_led(1);
led_enc_p1_g <= all_ok and p1_green and not p1_red;
led_enc_p2_r <= all_ok and p2_red;
led_enc_p2_y <= (all_ok and p2_cnt_zero_flag and not p2_red and p2_active) or alert_led(2);
led_enc_p2_g <= all_ok and p2_green and not p2_red;
end if;
end process pENC_LEDs_NR;
p1_cnt_zero_flag <= '1' when unsigned(p1_cnt) = 0 else '0';
p2_cnt_zero_flag <= '1' when unsigned(p2_cnt) = 0 else '0';
rst_p1_green <= '1' when unsigned(p1_cnt) = END_GREEN_PERIOD_MS-1 and one_ms_pulse = '1' else '0';
rst_p2_green <= '1' when unsigned(p2_cnt) = END_GREEN_PERIOD_MS-1 and one_ms_pulse = '1' else '0';
-----------------------------------------------------------------------------
-- POF LEDs
-----------------------------------------------------------------------------
pPOF_LED : process(reset_n, clk)
begin
if(reset_n = '0') then
pof_cnt <= (others => '0');
pof_d <= '0';
pof_green <= '0';
led_pof_g <= '0';
led_pof_y <= '0';
pof_event <= '0';
pof_active <= '0';
elsif(clk = '1' and clk'event) then
pof_d <= pof;
pof_event <= pof and not pof_d;
if(init = '1') then
pof_cnt <= (others => '0');
elsif(pof_event = '1') then
pof_cnt <= std_logic_vector(to_unsigned(MAX_PERIOD_MS, pof_cnt'length));
elsif(pof_cnt_zero_flag = '0' and one_ms_pulse = '1') then
pof_cnt <= std_logic_vector(unsigned(pof_cnt)-1);
end if;
if(init = '1' or (rst_pof_green = '1' and pof_event = '0')) then
pof_green <= '0';
elsif(pof_event = '1') then
pof_green <= '1';
end if;
led_pof_g <= all_ok and pof_green;
led_pof_y <= (all_ok and pof_cnt_zero_flag and pof_active) or alert_led(3);
if(pof_event = '1') then
pof_active <= '1';
end if;
end if;
end process pPOF_LED;
pof_cnt_zero_flag <= '1' when unsigned(pof_cnt) = 0 else '0';
rst_pof_green <= '1' when one_ms_pulse = '1' and unsigned(pof_cnt) = END_GREEN_PERIOD_MS else '0';
led_pof_r <= '0';
-----------------------------------------------------------------------------
-- Emergency Flashing
-----------------------------------------------------------------------------
-- when the smb_ctrl watchdog is triggered (all_ok deasserted), all the LEDs
-- need to start flashing
pEMERGENCY_FLASH : process(reset_n, clk)
begin
if(reset_n = '0') then
all_ok_d <= '0';
alert_led <= "0000";
alert_cnt <= std_logic_vector(to_unsigned(END_GREEN_PERIOD_MS-1, alert_cnt'length));
elsif(clk = '1' and clk'event) then
all_ok_d <= all_ok;
if(all_ok = '1') then
alert_led <= "0000";
elsif(all_ok = '0' and all_ok_d = '1') then
alert_cnt <= std_logic_vector(to_unsigned(END_GREEN_PERIOD_MS-1, alert_cnt'length));
else
if(alert_cnt_zero_flag = '1') then
if(alert_led = "1111") then
alert_led <= "0000";
else
alert_led <= alert_led(2 downto 0) & '1';
end if;
alert_cnt <= std_logic_vector(to_unsigned(END_GREEN_PERIOD_MS-1, alert_cnt'length));
elsif(one_ms_pulse = '1') then
alert_cnt <= std_logic_vector(unsigned(alert_cnt)-1);
end if;
end if;
end if;
end process pEMERGENCY_FLASH;
alert_cnt_zero_flag <= '1' when unsigned(alert_cnt) = 0 else '0';
end architecture rtl;

View file

@ -0,0 +1,76 @@
-------------------------------------------------------------------------------
-- Title : simple encoder velocity detection
-- Project : project independent
-------------------------------------------------------------------------------
-- File : simple_enc_vel_detect_7.vhd
-- Author : Gianmarco Girau
-- Company : Global Inkjet Systems
-- Created : 2019-06-18
-- Last update: 2020-04-16
-- SVN ID : Git
-- Standard : VHDL'2008
-------------------------------------------------------------------------------
-- Description:
-- This block detects encoder velocity by measuring the balance of encoder
-- positive and negative steps over consecutive sampling periods.
-- The sampling period is supposed to be less than 2 ms
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity simple_enc_vel_detect_7 is
port (
clk : in std_logic; -- Must be 100 MHz
init : in std_logic;
step_pos : in std_logic;
step_neg : in std_logic;
sampling_period : in std_logic_vector(19 downto 0);
vel_meas : out std_logic_vector(19 downto 0));
end simple_enc_vel_detect_7;
architecture RTL of simple_enc_vel_detect_7 is
signal init_i, sampling_pulse : std_logic;
signal sampling_per_cnt : std_logic_vector(19 downto 0);
signal vel_meas_i : std_logic_vector(19 downto 0);
signal vel_meas_sat_pos : std_logic_vector(19 downto 0);
signal vel_meas_sat_neg : std_logic_vector(19 downto 0);
begin -- RTL
pVEL_DETECT : process(clk)
begin
if(clk = '1' and clk'event) then
init_i <= init;
if(init_i = '1' or sampling_pulse = '1') then
sampling_per_cnt <= (others => '0');
else
sampling_per_cnt <= std_logic_vector(unsigned(sampling_per_cnt)+1);
end if;
if(init_i = '1' or sampling_pulse = '1') then
vel_meas_i <= (others => '0');
elsif(step_pos = '1' and signed(vel_meas_i) < signed(vel_meas_sat_pos)) then
vel_meas_i <= std_logic_vector(signed(vel_meas_i)+1);
elsif(step_neg = '1' and signed(vel_meas_i) > signed(vel_meas_sat_neg)) then
vel_meas_i <= std_logic_vector(signed(vel_meas_i)-1);
end if;
if(init_i = '1') then
vel_meas <= (others => '0');
elsif(sampling_pulse = '1') then
vel_meas <= vel_meas_i;
end if;
end if;
end process pVEL_DETECT;
sampling_pulse <= '1' when unsigned(sampling_per_cnt) = unsigned(sampling_period)-1 else '0';
-- define positive and negative saturation thresholds
vel_meas_sat_pos <= (vel_meas_i'left => '0', others => '1');
vel_meas_sat_neg <= (vel_meas_i'left => '1', others => '0');
end RTL;

View file

@ -0,0 +1,634 @@
-------------------------------------------------------------------------------
-- Title : smb diagnostic block
-- Project : SMB
-------------------------------------------------------------------------------
-- File : smb_diagnostics_7.vhd
-- Author : Gianmarco Girau
-- Company : Global Inkjet Systems
-- Created : 2016-08-02
-- Last update: 2021-01-12
-- SVN ID : Git
-- Standard : VHDL'2008
-------------------------------------------------------------------------------
-- Description: This block includes all the SMB diagnostic functionalities
-- except the event logger.
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity smb_diagnostics_7 is
port (
clk : in std_logic;
reset_n : in std_logic := '1';
-- External sync reset (via daisy-chain)
ext_diag_rst : in std_logic;
-- diagnostic inputs
rs422_phase0 : in std_logic;
rs422_phase1 : in std_logic;
rs422_zero_ph : in std_logic;
rs422_prod_det : in std_logic;
ttl_phase0 : in std_logic;
ttl_phase1 : in std_logic;
ttl_zero_ph : in std_logic;
ttl_prod_det : in std_logic;
ttl_prod_det_npn : in std_logic;
filt_phase0 : in std_logic;
filt_phase1 : in std_logic;
filt_zero_ph : in std_logic;
filt_prod_det : in std_logic;
enc_out : in std_logic;
pd_out : in std_logic;
pos_step : in std_logic;
neg_step : in std_logic;
drop_watch : in std_logic;
fire_req : in std_logic;
-- local timer
fine_time : in std_logic_vector(27 downto 0);
coarse_time : in std_logic_vector(31 downto 0);
-- Absolute Position
abs_position : out std_logic_vector(31 downto 0);
-- Interrupt Senders
ins_diag_irq_0 : out std_logic;
ins_diag_irq_1 : out std_logic;
ins_diag_irq_2 : out std_logic;
-- Avalon MM Interface
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));
end entity smb_diagnostics_7;
architecture rtl of smb_diagnostics_7 is
-- signals
type fsm_status_t is (idle, wait_ph1_ris, wait_ph0_ris);
signal fsm_status_curr,fsm_status_next : fsm_status_t;
--
signal filt_phase0_d, filt_phase1_d, filt_zero_ph_d, filt_prod_det_d : std_logic;
signal enc_out_d, pd_out_d, filt_phase0_p, filt_phase1_p, init_i : std_logic;
signal filt_zero_ph_p, filt_prod_det_p, enc_out_p, pd_out_p : std_logic;
signal init, rst_counters_i, rst_counters, rst_measur_i, rst_measur : std_logic;
signal rst_dir, rst_dir_i, enable_diff_measur, meas_enc_p : std_logic;
signal ph0_rising, ph0_falling, ph1_rising, ph1_falling : std_logic;
signal set_dir_forward, set_dir_backward, dir_pos_sat, dir_neg_sat : std_logic;
signal direction, direction_d, direction_change : std_logic;
signal sampling_time, fifo_rd_en, fifo_wr_en, fifo_full, fifo_error : std_logic;
signal rst_fifo_i, rst_fifo, rst_pos, rst_pos_i, avs_read_i : std_logic;
signal pd_fifo_error, pd_fifo_wr_en, pd_fifo_rd_en, pd_fifo_full : std_logic;
signal pd_p, pd_log_src, pd_fifo_alarm, enc_fifo_alarm : std_logic;
signal clr_pd_pos, pd_wd_en, pd_wd_alarm, rst_pd_fifo, rst_pd_fifo_i : std_logic;
signal fire_req_d, fire_req_p : std_logic;
signal rd_enc_fifo_pulse, rd_pd_fifo_pulse : std_logic;
--
signal enable_diff_measur_cnt : std_logic_vector( 1 downto 0);
signal irq_en, irq_clr, irq_src, irq_src_d : std_logic_vector( 2 downto 0);
signal irq, irq_val, irq_mask, pd_data_sel : std_logic_vector( 2 downto 0);
signal meas_enc_pulse : std_logic_vector( 3 downto 0);
signal pd_fifo_usedw, pd_fifo_thres : std_logic_vector( 7 downto 0);
signal fifo_thres, fifo_usedw : std_logic_vector( 9 downto 0);
signal dir_cnt, dir_change_cnt : std_logic_vector(15 downto 0);
signal pos_dir_thres, neg_dir_thres : std_logic_vector(15 downto 0);
signal meas_pulse_cnt, meas_step : std_logic_vector(15 downto 0);
signal input_status : std_logic_vector(16 downto 0);
signal sampling_period, sampling_time_cnt : std_logic_vector(27 downto 0);
signal fine_time_l : std_logic_vector(27 downto 0);
signal filt_phase0_cnt, filt_phase1_cnt : std_logic_vector(31 downto 0);
signal filt_zero_ph_cnt, filt_prod_det_cnt : std_logic_vector(31 downto 0);
signal enc_out_cnt, pd_out_cnt : std_logic_vector(31 downto 0);
signal enc_delta_time, enc_delta_time_prev : std_logic_vector(31 downto 0);
signal enc_delta_time_cnt : std_logic_vector(31 downto 0);
signal enc_delta_time_min, enc_delta_time_max : std_logic_vector(31 downto 0);
signal fifo_d, fifo_q, pos_cnt : std_logic_vector(31 downto 0);
signal pd_fifo_d, pd_fifo_q : std_logic_vector(31 downto 0);
signal pd_pos, coarse_time_l, pd_wd_thres : std_logic_vector(31 downto 0);
signal pd_delta_pos, pd_delta_pos_abs : std_logic_vector(31 downto 0);
signal fire_req_cnt : std_logic_vector(31 downto 0);
begin
pInit : process(clk)
begin
if(clk = '1' and clk'event) then
init <= init_i or ext_diag_rst;
end if;
end process pInit;
-----------------------------------------------------------------------------
-- Input Status
-----------------------------------------------------------------------------
pInputStatus : process(clk)
begin
if(clk = '1' and clk'event) then
input_status( 0) <= rs422_phase0;
input_status( 1) <= rs422_phase1;
input_status( 2) <= rs422_zero_ph;
input_status( 3) <= rs422_prod_det;
input_status( 4) <= ttl_phase0;
input_status( 5) <= ttl_phase1;
input_status( 6) <= ttl_zero_ph;
input_status( 7) <= ttl_prod_det;
input_status( 8) <= ttl_prod_det_npn;
input_status( 9) <= filt_phase0;
input_status(10) <= filt_phase1;
input_status(11) <= filt_zero_ph;
input_status(12) <= filt_prod_det;
input_status(13) <= enc_out;
input_status(14) <= pd_out;
input_status(15) <= drop_watch;
input_status(16) <= fire_req;
end if;
end process pInputStatus;
-----------------------------------------------------------------------------
-- Edge detection and counting
-----------------------------------------------------------------------------
pEdgeDetect_Cnt : process(clk)
begin
if(clk = '1' and clk'event) then
filt_phase0_d <= filt_phase0;
filt_phase1_d <= filt_phase1;
filt_zero_ph_d <= filt_zero_ph;
filt_prod_det_d <= filt_prod_det;
enc_out_d <= enc_out;
pd_out_d <= pd_out;
fire_req_d <= fire_req;
if(rst_counters = '1') then
filt_phase0_cnt <= (others => '0');
elsif(filt_phase0_p = '1') then
filt_phase0_cnt <= std_logic_vector(unsigned(filt_phase0_cnt)+1);
end if;
if(rst_counters = '1') then
filt_phase1_cnt <= (others => '0');
elsif(filt_phase1_p = '1') then
filt_phase1_cnt <= std_logic_vector(unsigned(filt_phase1_cnt)+1);
end if;
if(rst_counters = '1') then
filt_zero_ph_cnt <= (others => '0');
elsif(filt_zero_ph_p = '1') then
filt_zero_ph_cnt <= std_logic_vector(unsigned(filt_zero_ph_cnt)+1);
end if;
if(rst_counters = '1') then
filt_prod_det_cnt <= (others => '0');
elsif(filt_prod_det_p = '1') then
filt_prod_det_cnt <= std_logic_vector(unsigned(filt_prod_det_cnt)+1);
end if;
if(rst_counters = '1') then
enc_out_cnt <= (others => '0');
elsif(enc_out_p = '1') then
enc_out_cnt <= std_logic_vector(unsigned(enc_out_cnt)+1);
end if;
if(rst_counters = '1') then
pd_out_cnt <= (others => '0');
elsif(pd_out_p = '1') then
pd_out_cnt <= std_logic_vector(unsigned(pd_out_cnt)+1);
end if;
if(rst_counters = '1') then
fire_req_cnt <= (others => '0');
elsif(fire_req_p = '1') then
fire_req_cnt <= std_logic_vector(unsigned(fire_req_cnt)+1);
end if;
end if;
end process pEdgeDetect_Cnt;
filt_phase0_p <= filt_phase0 and not filt_phase0_d;
filt_phase1_p <= filt_phase1 and not filt_phase1_d;
filt_zero_ph_p <= filt_zero_ph and not filt_zero_ph_d;
filt_prod_det_p <= filt_prod_det and not filt_prod_det_d;
enc_out_p <= enc_out and not enc_out_d;
pd_out_p <= pd_out and not pd_out_d;
fire_req_p <= fire_req and not fire_req_d;
rst_counters <= rst_counters_i or init;
-----------------------------------------------------------------------------
-- Speed and acceleration measurements
-----------------------------------------------------------------------------
pMeasure : process(clk)
begin
if(clk = '1' and clk'event) then
if(rst_measur = '1' or meas_enc_p = '1') then
meas_pulse_cnt <= (others => '0');
elsif(enc_out_d = '1') then
meas_pulse_cnt <= std_logic_vector(unsigned(meas_pulse_cnt)+1);
end if;
if(rst_measur = '1') then
meas_enc_pulse <= (others => '0');
else
meas_enc_pulse <= meas_enc_pulse(meas_enc_pulse'high-1 downto 0) & meas_enc_p;
end if;
if(rst_measur = '1' or meas_enc_pulse(0) = '1') then
enc_delta_time_cnt <= (others => '0');
else
enc_delta_time_cnt <= std_logic_vector(unsigned(enc_delta_time_cnt)+1);
end if;
if(rst_measur = '1') then
enc_delta_time <= (others => '0');
enc_delta_time_prev <= (others => '0');
elsif(meas_enc_pulse(0) = '1') then
enc_delta_time <= enc_delta_time_cnt;
enc_delta_time_prev <= enc_delta_time;
end if;
if(rst_measur = '1' or rst_counters = '1') then
enable_diff_measur_cnt <= (others => '0');
elsif(meas_enc_p = '1') then
enable_diff_measur_cnt <= std_logic_vector(unsigned(enable_diff_measur_cnt)+1);
end if;
if(rst_measur = '1' or rst_counters = '1') then
enable_diff_measur <= '0';
elsif(enable_diff_measur_cnt = "11") then
enable_diff_measur <= '1';
end if;
if(enable_diff_measur = '0') then
enc_delta_time_min <= (others => '1');
elsif(meas_enc_pulse(2) = '1' and unsigned(enc_delta_time) < unsigned(enc_delta_time_min)) then
enc_delta_time_min <= enc_delta_time;
end if;
if(enable_diff_measur = '0') then
enc_delta_time_max <= (others => '0');
elsif(meas_enc_pulse(2) = '1' and unsigned(enc_delta_time) > unsigned(enc_delta_time_max)) then
enc_delta_time_max <= enc_delta_time;
end if;
end if;
end process pMeasure;
meas_enc_p <= '1' when enc_out_p = '1' and unsigned(meas_pulse_cnt) = unsigned(meas_step) else '0';
rst_measur <= rst_measur_i or init;
-----------------------------------------------------------------------------
-- Direction detection & Position Tracking
-----------------------------------------------------------------------------
-- Direction is detected by checking the order of rising and falling edged
-- between phase-0 and phase-1.
-- Forward direction => Phase-0 is anticipated w.r.t. Phase-1
-- Backward direction => Phase-0 is delayed w.r.t. Phase-1
ph0_rising <= filt_phase0_p;
ph0_falling <= not filt_phase0 and filt_phase0_d;
ph1_rising <= filt_phase1_p;
ph1_falling <= not filt_phase1 and filt_phase1_d;
rst_dir <= rst_dir_i or init;
-- Use a FSM to detect the sequence of events:
-- FSM Status Register
pFSM_SR : process(clk)
begin
if(clk = '1' and clk'event) then
if(rst_dir = '1') then
fsm_status_curr <= idle;
else
fsm_status_curr <= fsm_status_next;
end if;
end if;
end process pFSM_SR;
-- FSM Combinational Logic
pFSM_CL : process(fsm_status_curr, ph0_rising, ph0_falling, ph1_rising, ph1_falling)
begin
-- default assignments
set_dir_forward <= '0';
set_dir_backward <= '0';
--
fsm_status_next <= fsm_status_curr;
case fsm_status_curr is
when idle =>
if(ph0_rising = '1') then
fsm_status_next <= wait_ph1_ris;
elsif(ph1_rising = '1') then
fsm_status_next <= wait_ph0_ris;
end if;
when wait_ph1_ris =>
if(ph1_rising = '1') then
set_dir_forward <= '1';
fsm_status_next <= idle;
elsif(ph0_falling = '1') then
fsm_status_next <= idle;
end if;
when wait_ph0_ris =>
if(ph0_rising = '1') then
set_dir_backward <= '1';
fsm_status_next <= idle;
elsif(ph1_falling = '1') then
fsm_status_next <= idle;
end if;
when others => null;
end case;
end process pFSM_CL;
pDirRegs : process(clk)
begin
if(clk = '1' and clk'event) then
if(rst_dir = '1') then
dir_cnt <= (others => '0');
elsif(set_dir_forward = '1' and dir_pos_sat = '0') then
dir_cnt <= std_logic_vector(signed(dir_cnt)+1);
elsif(set_dir_backward = '1' and dir_neg_sat = '0') then
dir_cnt <= std_logic_vector(signed(dir_cnt)-1);
end if;
direction_d <= direction;
if(rst_dir = '1') then
dir_change_cnt <= (others => '0');
elsif(direction_change = '1') then
dir_change_cnt <= std_logic_vector(unsigned(dir_change_cnt)+1);
end if;
end if;
end process pDirRegs;
direction <= dir_cnt(dir_cnt'high);
direction_change <= direction xor direction_d;
-- Positive/Negative saturation for the direction counter
dir_pos_sat <= '1' when signed(dir_cnt) > signed(pos_dir_thres) else '0';
dir_neg_sat <= '1' when signed(dir_cnt) < signed(neg_dir_thres) else '0';
-- Position Tracking
pPOS_TRACK : process(clk)
begin
if(clk = '1' and clk'event) then
if(rst_pos = '1') then
pos_cnt <= (others => '0');
elsif(pos_step = '1') then
pos_cnt <= std_logic_vector(signed(pos_cnt)+1);
elsif(neg_step = '1') then
pos_cnt <= std_logic_vector(signed(pos_cnt)-1);
end if;
abs_position <= pos_cnt;
end if;
end process pPOS_TRACK;
rst_pos <= init or rst_pos_i;
-----------------------------------------------------------------------------
-- PD logging
-----------------------------------------------------------------------------
pPD_log : process(clk)
begin
if(clk = '1' and clk'event) then
if(init = '1') then
pd_fifo_error <= '0';
elsif(pd_fifo_wr_en = '1' and pd_fifo_full = '1') then
pd_fifo_error <= '1';
end if;
if(init = '0' and pd_p = '1') then
pd_data_sel <= "001";
else
pd_data_sel <= pd_data_sel(1 downto 0) & '0';
end if;
if(init = '1') then
fine_time_l <= (others => '0');
coarse_time_l <= (others => '0');
pd_pos <= (others => '0');
elsif(pd_p = '1') then
fine_time_l <= fine_time;
coarse_time_l <= coarse_time;
pd_pos <= pos_cnt;
end if;
end if;
end process pPD_log;
pd_p <= pd_out_p when pd_log_src = '1' else filt_prod_det_p;
iPD_log_fifo : entity work.sync_fifo
generic map(
FIFO_WIDTH => 32,
FIFO_DEPTH => 256)
port map (
clock => clk,
data => pd_fifo_d,
rdreq => pd_fifo_rd_en,
sclr => rst_pd_fifo,
wrreq => pd_fifo_wr_en,
empty => open,
full => pd_fifo_full,
q => pd_fifo_q,
usedw => pd_fifo_usedw);
pd_fifo_rd_en <= rd_pd_fifo_pulse;
pd_fifo_alarm <= '1' when unsigned(pd_fifo_usedw) >= unsigned(pd_fifo_thres) else '0';
-- FIFO write logic
pd_fifo_wr_en <= pd_data_sel(2) or pd_data_sel(1) or pd_data_sel(0);
-- select the input for the pd fifo
with pd_data_sel select
pd_fifo_d <=
X"0" & fine_time_l when "001",
coarse_time_l when "010",
pd_pos when others;
rst_pd_fifo <= rst_pd_fifo_i or init;
-- PD Positional Watch-Dog
pPD_WatchDog : process(clk)
begin
if(clk = '1') then
if(init = '1' or clr_pd_pos = '1' or filt_prod_det_p = '1') then
pd_delta_pos <= (others => '0');
elsif(pos_step = '1') then
pd_delta_pos <= std_logic_vector(signed(pd_delta_pos)+1);
elsif(neg_step = '1') then
pd_delta_pos <= std_logic_vector(signed(pd_delta_pos)-1);
end if;
-- compare the absolute value of the delta position against the
-- threshold. Use the 1's complement to save some logic.
if(pd_wd_en = '1' and unsigned(pd_delta_pos_abs) > unsigned(pd_wd_thres)) then
pd_wd_alarm <= '1';
else
pd_wd_alarm <= '0';
end if;
end if;
end process pPD_WatchDog;
pd_delta_pos_abs <= '0' & pd_delta_pos(30 downto 0) when pd_delta_pos(31) = '0' else '0' & not pd_delta_pos(30 downto 0);
-----------------------------------------------------------------------------
-- Encoder pulse count buffering (ACTUALLY NOW IS POSITION COUNT SAMPLING!!!)
-----------------------------------------------------------------------------
-- The encoder pulse count is periodically sampled. The samples are stored in
-- a dedicated FIFO and they can be used to generate a speed/acceleration
-- profile. => CHANGED: JUST using the position count, because it is more
-- it is independent of the encoder directionality settings
pEncPulseSample : process(clk)
begin
if(clk = '1' and clk'event) then
if(rst_fifo = '1' or sampling_time = '1') then
sampling_time_cnt <= (others => '0');
else
sampling_time_cnt <= std_logic_vector(unsigned(sampling_time_cnt)+1);
end if;
if(rst_fifo = '1') then
fifo_error <= '0';
elsif(fifo_wr_en = '1' and fifo_full = '1') then
fifo_error <= '1';
end if;
fifo_wr_en <= sampling_time;
--fifo_d <= enc_out_cnt;
fifo_d <= pos_cnt;
end if;
end process pEncPulseSample;
sampling_time <= '1' when unsigned(sampling_time_cnt) = unsigned(sampling_period) else '0';
iEncPulseFifo : entity work.sync_fifo
generic map(
FIFO_WIDTH => 32,
FIFO_DEPTH => 1024)
port map (
clock => clk,
data => fifo_d,
rdreq => fifo_rd_en,
sclr => rst_fifo,
wrreq => fifo_wr_en,
empty => open,
full => fifo_full,
q => fifo_q,
usedw => fifo_usedw);
fifo_rd_en <= rd_enc_fifo_pulse;
enc_fifo_alarm <= '1' when unsigned(fifo_usedw) >= unsigned(fifo_thres) else '0';
rst_fifo <= init or rst_fifo_i or rst_counters_i;
-----------------------------------------------------------------------------
-- IRQ generation and management
-----------------------------------------------------------------------------
pIRQ : process(reset_n, clk)
begin
if(reset_n = '0') then
ins_diag_irq_0 <= '0';
ins_diag_irq_1 <= '0';
ins_diag_irq_2 <= '0';
irq <= "000";
irq_src_d <= "000";
elsif(clk = '1' and clk'event) then
irq_src_d <= irq_src;
for n in 0 to 2 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_diag_irq_0 <= irq_val(0);
ins_diag_irq_1 <= irq_val(1);
ins_diag_irq_2 <= irq_val(2);
end if;
end process pIRQ;
irq_val <= irq and not irq_mask;
irq_src <= pd_wd_alarm & pd_fifo_alarm & enc_fifo_alarm;
-----------------------------------------------------------------------------
-- C&S registers (Avalon-MM I/F)
-----------------------------------------------------------------------------
fpm_diags_7_csr_regs_i : entity work.fpm_diags_7_csr_regs
generic map (
ADDR_DECODE_WIDTH => 5
)
port map (
-- Clock and reset
clk => clk,
rst_n => reset_n,
-- auto-generated
-- Internal signal ports
init_init => init_i,
init_rst_counters => rst_counters_i,
init_rst_measur => rst_measur_i,
init_rst_dir => rst_dir_i,
init_rst_enc_fifo => rst_fifo_i,
init_rst_pos => rst_pos_i,
init_rst_pd_fifo => rst_pd_fifo_i,
delta_time_meas_step => meas_step,
dir_thres_pos_dir_thres => pos_dir_thres,
dir_thres_neg_dir_thres => neg_dir_thres,
enc_sampling_period => sampling_period,
enc_fifo_mng_w_irq_gen_thres => fifo_thres,
pd_fifo_mng_w_irq_gen_thres => pd_fifo_thres,
pd_fifo_mng_w_pd_log_src => pd_log_src,
pd_watchdog_ctrl_watchdog_en => pd_wd_en,
pd_watchdog_ctrl_watchdog_clr => clr_pd_pos,
pd_watchdog_thres => pd_wd_thres,
irq_mng_irq_en => irq_en,
irq_mng_irq_clr => irq_clr,
irq_mng_irq_mask => irq_mask,
rd_enc_fifo_pulse => rd_enc_fifo_pulse,
rd_enc_fifo => open,
rd_enc_fifo_in => '0',
rd_pd_fifo_pulse => rd_pd_fifo_pulse,
rd_pd_fifo => open,
rd_pd_fifo_in => '0',
input_status_rs422_p1 => input_status( 0),
input_status_rs422_p2 => input_status( 1),
input_status_rs422_zp => input_status( 2),
input_status_rs422_pd => input_status( 3),
input_status_ttl_p1 => input_status( 4),
input_status_ttl_p2 => input_status( 5),
input_status_ttl_zp => input_status( 6),
input_status_ttl_pd_pnp => input_status( 7),
input_status_ttl_pd_npn => input_status( 8),
input_status_filt_p1 => input_status( 9),
input_status_filt_p2 => input_status(10),
input_status_filt_zp => input_status(11),
input_status_filt_pd => input_status(12),
input_status_enc_pulse => input_status(13),
input_status_pd_out => input_status(14),
input_status_drop_watch => input_status(15),
input_status_fire_req => input_status(16),
phase1_counter => filt_phase0_cnt,
phase2_counter => filt_phase1_cnt,
zero_phase_counter => filt_zero_ph_cnt,
pd_counter => filt_prod_det_cnt,
enc_pulse_counter => enc_out_cnt,
pd_output_counter => pd_out_cnt,
fire_request_counter => fire_req_cnt,
delta_time_meas => enc_delta_time,
deltamin_time_meas => enc_delta_time_min,
deltamax_time_meas => enc_delta_time_max,
delta_time_prev_meas => enc_delta_time_prev,
abs_pos => pos_cnt,
dir_cnt_dir_cnt => dir_cnt,
dir_cnt_dir_change_cnt => dir_change_cnt,
enc_fifo_mng_r_fifo_level => fifo_usedw,
enc_fifo_mng_r_fifo_overflow => fifo_error,
enc_fifo_output => fifo_q,
pd_fifo_mng_r_fifo_level => pd_fifo_usedw,
pd_fifo_mng_r_fifo_overflow => pd_fifo_error,
pd_fifo_output => pd_fifo_q,
pd_watchdog_status => pd_wd_alarm,
irq_value => irq_val,
-- end auto-generated
-- Slave bus port
avs_address => avs_address(4 downto 0),
avs_write => avs_write,
avs_writedata => avs_writedata,
avs_read => avs_read,
avs_readdata => avs_readdata
);
end architecture rtl;

View file

@ -0,0 +1,755 @@
-------------------------------------------------------------------------------
-- 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: 2020-04-20
-- SVN ID : Git
-- Standard : VHDL'08
-------------------------------------------------------------------------------
-- Description:
-- Testbench for fire pulse manager block
-------------------------------------------------------------------------------
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_7_pkg.all;
use work.fpm_ctrl_7_pkg.all;
use work.log_pkg.all;
use work.avalon_verify_pkg_2.all;
use work.pulse_generator_4_pkg.all;
use work.enc_pd_emul_2_pkg.all;
use work.fire_pulse_manager_7_tb_pkg.all;
library osvvm;
use osvvm.RandomPkg.all;
entity fire_pulse_manager_7_tb is
end fire_pulse_manager_7_tb;
architecture behav of fire_pulse_manager_7_tb is
constant DEV_NUM : integer := 2;
constant RX_CLK_PERIOD : time := CLK_PERIOD / 3; -- clock period for used by the
-- UART-Rx on the POF
constant POF_DELAY : time := 30 ns; -- Total delay from POF-Tx input to POF-Rx output
constant ENC_PPR : natural := 10000;
constant ENC_FREQ : enc_freq_t := 1.0e6;
constant PD_PULSE_W : pd_pulse_width_t := 0.5;
constant PD_PERIOD : pd_period_t := 2.0;
constant NUM_ITERATIONS : natural := 5;
constant SWATHE_LEN : integer := 2000;
constant IMAGE_SIZE : integer := 100;
constant DIV_RATIO : real := 5.0;
constant SUBPIX_PHASES : integer := 5;
constant SEL_SUBPIX_PH : integer := 4;
constant START_DIR : enc_dir_t := DIR_0;
-- when DRIVE_DROP_WATCH is true, FPM output pof_tx is driven with the
-- drop-watch signal
constant DRIVE_DROP_WATCH : boolean := true;
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 := (others => 0);
type fire_pulse_t is array (0 to CH_NUM-1) of std_logic_vector(31 downto 0);
signal ch_fire_pulse : fire_pulse_t;
signal ch_start_of_image : fire_pulse_t;
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 fire_pulse : std_logic_vector(32*CH_NUM-1 downto 0);
signal start_of_image : std_logic_vector(32*CH_NUM-1 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_readdata : avs_read_bus_t;
--
signal init_tx : std_logic;
signal inc_pos : std_logic;
signal dec_pos : std_logic;
signal abs_position : std_logic_vector(31 downto 0);
signal tx_data : std_logic;
signal pof_tx_avs_rv : std_logic;
signal pof_tx_avs_we_d : std_logic;
signal enc_p1 : std_logic;
signal enc_p2 : std_logic;
signal pd : std_logic;
signal seb_epd_enc_p1 : std_logic;
signal seb_epd_enc_p2 : std_logic;
signal seb_epd_pd : std_logic;
--
signal emul_address : std_logic_vector( 9 downto 0);
signal emul_write : std_logic;
signal emul_writedata : std_logic_vector(31 downto 0);
signal emul_read : std_logic;
signal emul_readdata : std_logic_vector(31 downto 0);
signal emul_inc_pos : std_logic;
signal emul_dec_pos : std_logic;
signal emul_pos : std_logic_vector(39 downto 0);
--
signal enc_dir : enc_dir_t;
signal swathe_cnt : integer;
signal half_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;
--
shared variable error_flag : boolean;
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;
signal emul_s : mm_s_rec_t;
signal emul_m : mm_m_rec_t;
--
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;
signal loc_fp_cnt : fp_cnt_t;
signal rst_fp_cnt : std_logic;
signal ch_pulse_out : std_logic_vector(CH_NUM-1 downto 0);
signal ch_pulse_out_d : std_logic_vector(CH_NUM-1 downto 0);
signal ch_start_of_img : std_logic_vector(CH_NUM-1 downto 0);
--
signal run_dw : std_logic;
signal dw : std_logic;
signal dw_d : std_logic;
signal dw_cnt : natural;
--
signal input_mode : fpm_input_type_t;
--
signal ext_pulse : std_logic;
signal ext_pulse_enable : std_logic;
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_7
generic map(
SEB_EPD_MODE => true,
CH_NUM => CH_NUM)
port map(
reset_n => reset_n,
clk => clk,
rx_clk => rx_clk,
pof_rx => pof_rx,
pof_tx => pof_tx,
seb_epd_enc_p1 => seb_epd_enc_p1,
seb_epd_enc_p2 => seb_epd_enc_p2,
seb_epd_pd => seb_epd_pd,
fire_pulse => fire_pulse,
start_of_image => start_of_image,
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_readdata => avs_readdata(0));
pof_rx <= transport tx_data after POF_DELAY when ext_pulse_enable = '0' else ext_pulse;
-----------------------------------------------------------------------------
-- Split subpixel phases
-----------------------------------------------------------------------------
pSPLIT_SUBPIX_PH : process(all)
begin
for i in 0 to CH_NUM-1 loop
ch_fire_pulse(i) <= fire_pulse(32*i+31 downto 32*i);
ch_start_of_image(i) <= start_of_image(32*i+31 downto 32*i);
ch_pulse_out(i) <= ch_fire_pulse(i)(0);
ch_start_of_img(i) <= ch_start_of_image(i)(SEL_SUBPIX_PH-1);
end loop; -- i
end process pSPLIT_SUBPIX_PH;
-----------------------------------------------------------------------------
-- Encoder/PD emulator (Stimuli Generator)
-----------------------------------------------------------------------------
-- The Emulator provides the Encoder and PD stimuli to the FPM:
-- When using the SEB-POF, the encoder stimuli is given by the absolute position.
-- A POF-Transmitter block (below) encodes the Absolute position and PD
-- events according to the POF-Protocol format.
-- When using the SEB-EPD, the encoder phase-1/2 outputs of the emulator are
-- directly fed as inputs to the FPM
iEMUL : entity work.enc_pd_emul_2
port map (
clk => clk,
reset_n => reset_n,
ttl_pd => open,
ttl_enc_p1 => open,
ttl_enc_p2 => open,
ttl_enc_zp => open,
rs422_pd => pd,
rs422_enc_p1 => enc_p1,
rs422_enc_p2 => enc_p2,
rs422_enc_zp => open,
abs_pos_out => emul_pos,
set_pos_out => open,
inc_pos_out => inc_pos,
dec_pos_out => dec_pos,
avs_address => emul_address,
avs_write => emul_write,
avs_writedata => emul_writedata,
avs_read => emul_read,
avs_readdata => emul_readdata);
abs_position <= emul_pos(31 downto 0);
seb_epd_pd <= pd;
seb_epd_enc_p1 <= enc_p1;
seb_epd_enc_p2 <= enc_p2;
-----------------------------------------------------------------------------
-- POF Tx (Stimuli Generator)
-----------------------------------------------------------------------------
iPOF_TX : entity work.pof_tx_2
generic map(
PROTOCOL_VER => 0
)
port map(
reset_n => reset_n,
clk => clk,
init => init_tx,
pd_in => pd,
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_readdata => avs_readdata(1));
-----------------------------------------------------------------------------
-- Stimuli Generation
-----------------------------------------------------------------------------
pSTIMULI : process
variable end_of_stimuli : boolean;
variable swathe_completed : boolean;
variable pd_pos : integer;
variable rv : RandomPType;
begin
-- initialization
init_tx <= '0';
enc_dir <= START_DIR;
swathe_pos <= 0;
--
swathe_cnt <= 0;
half_swathe_cnt <= 0;
stimuli_completed <= false;
end_of_swathe <= '0';
--
mm_m_init(emul_m, use_readvalid => false);
-- generating the stimulus
if(running /= true) then
wait until running = true;
end if;
wait for 200 ns;
-- Set the initial absolute-position for the encoder emulator
set_enc_abs_pos(40x"0", emul_s, emul_m);
-- Send a Init/Sync pulse to the POF-Tx
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, 199);
--ch_offset(i) <= 50;
end loop;
reprogram_offset <= true;
wait until configuring = true;
reprogram_offset <= false;
wait until configuring = false;
wait until clk = '1' and clk'event;
-- start running the encoder
run_enc_pulses(ENC_FREQ, enc_dir, true, SWATHE_LEN, ENC_PPR, emul_s, emul_m);
if(enc_dir = DIR_0) then
log("Running Swathe " & to_string(swathe_cnt + 1) & ", DIR-0.", VMEDIUM);
else
log("Running Swathe " & to_string(swathe_cnt + 1) & ", DIR-1.", VMEDIUM);
end if;
-- issue a PD to start firing
pd_pos := rv.RandInt(0, 49);
--pd_pos := 10;
for k in 1 to pd_pos loop
wait until abs_position'event;
end loop; -- k
run_pd_pulses(PD_PULSE_W, PD_PERIOD, true, emul_s, emul_m);
swathe_completed := false;
while swathe_completed = false loop
wait for 500 ns;
-- Check whether the encoder generation has completed
check_max_pulses_done(swathe_completed, emul_s, emul_m);
end loop;
wait for 25 us;
half_swathe_cnt <= half_swathe_cnt + 1;
wait until clk = '1' and clk'event;
end_of_swathe <= '1';
wait until clk = '1' and clk'event;
end_of_swathe <= '0';
-- reverse direction
if (enc_dir /= START_DIR) then
-- The number of iterations is doubled, to take into account POF and
-- EPD input types
if (swathe_cnt = 2*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;
if(enc_dir = DIR_0) then
enc_dir <= DIR_1;
else
enc_dir <= DIR_0;
end if;
-- 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;
--
pGEN_EXT_PULSE : process
begin
ext_pulse <= '0';
if ext_pulse_enable = '0' then
wait until ext_pulse_enable = '1';
end if;
wait for 200 ns;
for n in 0 to 11 loop
ext_pulse <= '1';
if n = 5 or n = 6then
wait for 170 ns;
ext_pulse <= '0';
wait for 30 ns;
else
wait for 200 ns;
ext_pulse <= '0';
end if;
wait for 800 ns;
end loop; -- n
if ext_pulse_enable = '1' then
wait until ext_pulse_enable = '0';
end if;
end process pGEN_EXT_PULSE;
-----------------------------------------------------------------------------
-- Testbench Control
-----------------------------------------------------------------------------
dw <= pof_tx when run_dw = '1' else '0';
pOUT_CHECK_REGs : process(reset_n, clk)
begin
if(reset_n = '0') then
ch_pulse_out_d <= (others => '0');
loc_fp_cnt <= (others => 0);
dw_d <= '0';
dw_cnt <= 0;
elsif(clk = '1' and clk'event) then
ch_pulse_out_d <= ch_pulse_out;
for n in 0 to CH_NUM-1 loop
if(rst_fp_cnt = '1') then
loc_fp_cnt(n) <= 0;
elsif(ch_pulse_out(n) = '1' and ch_pulse_out_d(n) = '0') then
loc_fp_cnt(n) <= loc_fp_cnt(n) + 1;
end if;
end loop; -- n
-- Check the number of generated fire-requests at the end of the swathe
if(end_of_swathe = '1') then
for n in 0 to CH_NUM-1 loop
if(loc_fp_cnt(n) /= half_swathe_cnt*IMAGE_SIZE) then
log("ERROR on Channel CH" & integer'image(n) & ": Expected Fire-Requests = " & to_string(half_swathe_cnt*IMAGE_SIZE) & ", detected Fire-Requests = " & to_string(loc_fp_cnt(n)), VLOW, true);
error_flag := true;
end if;
end loop; -- n
end if;
dw_d <= dw;
if(run_dw = '0') then
dw_cnt <= 0;
elsif(dw = '1' and dw_d = '0') then
dw_cnt <= dw_cnt + 1;
end if;
end if;
end process pOUT_CHECK_REGs;
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_pos_t is array (0 to CH_NUM - 1) of integer;
variable fp_arrived_pos : fp_arrived_pos_t;
variable fp_arrived_agg : integer;
variable pd_arrived_pos : integer;
alias pd_spy is <<signal iDUT.pd_pulse : std_logic>>;
alias abs_spy is <<signal iDUT.abs_pos : std_logic_vector(31 downto 0)>>;
begin
-- Set the verbosity level for logging
set_log_verbosity(VERBOSITY_LEVEL);
--set_log_verbosity(VHIGH);
log_header("Multi-channel FPM verification:", VLOW);
running <= false;
passed <= false;
error_flag := 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;
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_pos := to_integer(signed(abs_spy));
for i in 0 to CH_NUM - 1 loop
fp_arrived(i) := false;
fp_arrived_pos(i) := 0;
end loop;
log("Product detect fired @ " & integer'image(pd_arrived_pos) & " ... ", 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_pos(i) := to_integer(signed(abs_spy));
log("Channel CH" & integer'image(i) & " Fire pulse logged @ " & integer'image(fp_arrived_pos(i)) & " ... ", VLOW, true);
if (abs (pd_arrived_pos - fp_arrived_pos(i)) /= ch_offset(i)) then
log("ERROR on Channel CH" & integer'image(i) & ": First Fire-Pulse detected at position " & to_string(fp_arrived_pos(i)) & ", expected position is " & to_string((pd_arrived_pos+ch_offset(i))), VLOW, true);
error_flag := 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) & " PD-in counter value : " & integer'image(pd_cnt(i)) & " ... ", VLOW, true);
log("Channel CH" & integer'image(i) & " FP-out counter value : " & integer'image(fp_cnt(i)) & " ... ", VLOW, true);
log("Channel CH" & integer'image(i) & " Detected Fire-Pulses : " & integer'image(loc_fp_cnt(i)) & " ... ", VLOW, true);
if(pd_cnt(i) /= (NUM_ITERATIONS) * 2 * 2) then -- fire_pulse_manager now has no registers beyond channel 0
log("Channel CH" & integer'image(i) & " PD_cnt counter value Incorrect: ", VLOW, true);
error_flag := true;
end if;
if((loc_fp_cnt(i) /= (NUM_ITERATIONS) * 2 * 2 * IMAGE_SIZE) or (fp_cnt(i) /= (NUM_ITERATIONS) * 2 * 2 * IMAGE_SIZE)) then
log("Channel CH" & integer'image(i) & " FP_cnt counter value Incorrect: ", VLOW, true);
error_flag := true;
end if;
end loop;
wait until clk = '1' and clk'event;
running <= false;
passed <= true after 100 ns;
wait;
end process pTB_CTRL;
pFAILED : process
begin
failed <= false;
while true loop
wait for 1 us;
if(error_flag = true) then
failed <= true;
end if;
end loop;
end process pFAILED;
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;
pUUT_CTRL : process
variable addr : std_logic_vector(31 downto 0) := (others => '0');
variable data : std_logic_vector(31 downto 0) := (others => '0');
begin
sel_slave_0 <= '0';
sel_slave_1 <= '0';
rst_fp_cnt <= '0';
configuring <= true;
input_mode <= POF_INPUT;
run_dw <= '0';
-- Initialize avalon mm interfaces
mm_m_init(avs_m, use_waitrequest => false);
if (reset_n = '0') then
wait until reset_n = '1';
wait for 100 ns;
wait until clk = '1' and clk'event;
end if;
log("Driving external pulses ... ", VLOW, true);
ext_pulse_enable <= '1';
wait for 20 us;
ext_pulse_enable <= '0';
wait for 1 us;
wait until clk = '1' and clk'event;
rst_fp_cnt <= '1';
wait until clk = '1' and clk'event;
rst_fp_cnt <= '0';
log("Configuring POFTX ... ", VLOW, true);
sel_slave_1 <= '1';
-- 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 FPM ... ", VLOW, true);
fpm_ctrl_config(avs_s, avs_m);
fpm_ems_config(avs_s, avs_m);
config_pg_l : for i in 0 to CH_NUM - 1 loop
pulse_gen_config(i, ch_offset(i), DIV_RATIO, SUBPIX_PHASES, IMAGE_SIZE, avs_s, avs_m);
end loop config_pg_l;
log("Configuration completed.", VLOW, true);
configuring <= false;
log_separator_line(VLOW);
log("POF input mode verification", VLOW, true);
log_separator_line(VLOW);
fpm_input_config(input_mode, avs_s, avs_m);
if(DRIVE_DROP_WATCH = true) then
drop_watch_config('1', "0001", 15, avs_s, avs_m);
end if;
while stimuli_completed = false loop
wait until reprogram_offset = true or stimuli_completed = true;
if (stimuli_completed) then
exit;
end if;
log("Reading counters ... ", VLOW, true);
-- Read PD and FP counter from pulse generator
for i in 0 to CH_NUM - 1 loop
fpm_reg_read(PG_CH_ID+i, work.pulse_generator_4_pkg.CSR_PD_COUNTER_ADDR, data, avs_s, avs_m);
pd_cnt(i) <= to_integer(unsigned(data));
fpm_reg_read(PG_CH_ID+i, work.pulse_generator_4_pkg.CSR_FIRE_REQ_COUNTER_ADDR, data, avs_s, avs_m);
fp_cnt(i) <= to_integer(unsigned(data));
wait until clk = '1' and clk'event;
log("CH-" & to_string(i) & ": pd_in_cnt = " & to_string(pd_cnt(i)) & ", fire_req_cnt = " & to_string(fp_cnt(i)) & ", detected fire-req-cnt = " & to_string(loc_fp_cnt(i)), VMEDIUM);
end loop;
configuring <= true;
-- Reprogram the input to EPD and repeat the same number of iterations
if (swathe_cnt = NUM_ITERATIONS) then
log_separator_line(VLOW);
log("EPD input mode verification", VLOW, true);
log_separator_line(VLOW);
input_mode <= EPD_INPUT;
wait until clk = '1' and clk'event;
fpm_input_config(input_mode, avs_s, avs_m);
if(DRIVE_DROP_WATCH = true) then
drop_watch_config('1', "0001", 15, avs_s, avs_m);
end if;
run_dw <= '1';
end if;
log("Reprogramming offset ... ", VLOW, true);
config_of_l : for i in 0 to CH_NUM - 1 loop
ch_offset_config(i, ch_offset(i), avs_s, avs_m);
end loop;
configuring <= false;
end loop;
log("Reading counters ... ", VLOW, true);
-- Read PD and FP counter from pulse generator
for i in 0 to CH_NUM - 1 loop
fpm_reg_read(PG_CH_ID+i, work.pulse_generator_4_pkg.CSR_PD_COUNTER_ADDR, data, avs_s, avs_m);
pd_cnt(i) <= to_integer(unsigned(data));
fpm_reg_read(PG_CH_ID+i, work.pulse_generator_4_pkg.CSR_FIRE_REQ_COUNTER_ADDR, data, avs_s, avs_m);
fp_cnt(i) <= to_integer(unsigned(data));
wait until clk = '1' and clk'event;
log("CH-" & to_string(i) & ": pd_in_cnt = " & to_string(pd_cnt(i)) & ", fire_req_cnt = " & to_string(fp_cnt(i)), VMEDIUM);
end loop;
registers_read <= true;
wait;
end process pUUT_CTRL;
clk_clk <= clk;
reset_reset_n <= reset_n;
avs_s.mm_readdata <= avs_readdata(0) when sel_slave_0 = '1' else
avs_readdata(1) when sel_slave_1 = '1' else (others => '0');
avs_s.mm_readdatavalid <= '0';
avs_s.mm_waitrequest <= '0';
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;
-- Emulator Avalon bus maapings
emul_s.mm_readdata <= emul_readdata;
emul_s.mm_readdatavalid <= '0';
emul_s.mm_waitrequest <= '0';
emul_address <= emul_m.mm_address(emul_address'range);
emul_writedata <= emul_m.mm_writedata;
emul_write <= emul_m.mm_write;
emul_read <= emul_m.mm_read;
end behav;

View file

@ -0,0 +1,827 @@
-------------------------------------------------------------------------------
-- Title : fire_pulse_manager_7_tb_pkg
-- Project : SMB
-------------------------------------------------------------------------------
-- File : fire_pulse_manager_7_tb_pkg.vhd
-- Author : Gianmarco Girau
-- Company : Global Inkjet Systems
-- Created : 2020-01-02
-- Last update: 2021-01-06
-- SVN ID : Git
-- Standard : VHDL'2008
-------------------------------------------------------------------------------
-- Description:
-- Support package for the FPM testbench
-------------------------------------------------------------------------------
--library std;
--use std.textio.all;
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_textio.all;
use ieee.numeric_std.all;
use ieee.math_real.all;
library work;
use work.fire_pulse_7_pkg.all;
use work.ems_1_pkg.all;
use work.fpm_ctrl_7_pkg.all;
library OSVVM ;
use OSVVM.RandomBasePkg.all ;
use OSVVM.RandomPkg.all;
library work;
use work.log_pkg.all;
use work.avalon_verify_pkg_2.all;
use work.enc_pd_emul_2_pkg.all;
package fire_pulse_manager_7_tb_pkg is
constant CLK_PERIOD : time := 10.0 ns;
constant CLK_FREQ : real := 100.0e6;
constant CH_NUM : integer := 4;
constant BLK_NUM : natural := 6 + CH_NUM;
constant ENC_NCO_WIDTH : positive := 32;
-- Logging Verbosity Level
constant VERBOSITY_LEVEL : verb_level_t := VMEDIUM;
type fpm_input_type_t is (POF_INPUT, EPD_INPUT, INTERNAL);
-----------------------------------------------------------------------------
-- FPM Configuration
-----------------------------------------------------------------------------
-- fpm_reg_write with addr defined as std_logic_vector
procedure fpm_reg_write(
blk_id : in natural range 0 to BLK_NUM-1;
addr : in std_logic_vector;
data : in std_logic_vector(31 downto 0);
signal mm_s : in mm_s_rec_t;
signal mm_m : out mm_m_rec_t);
-- fpm_reg_write with addr defined as integer
procedure fpm_reg_write(
blk_id : in natural range 0 to BLK_NUM-1;
addr : in integer;
data : in std_logic_vector(31 downto 0);
signal mm_s : in mm_s_rec_t;
signal mm_m : out mm_m_rec_t);
-- fpm_reg_read with addr defined as std_logic_vector
procedure fpm_reg_read(
blk_id : in natural range 0 to BLK_NUM-1;
addr : in std_logic_vector;
data : out std_logic_vector(31 downto 0);
signal mm_s : in mm_s_rec_t;
signal mm_m : out mm_m_rec_t);
-- fpm_reg_read with addr defined as integer
procedure fpm_reg_read(
blk_id : in natural range 0 to BLK_NUM-1;
addr : in integer;
data : out std_logic_vector(31 downto 0);
signal mm_s : in mm_s_rec_t;
signal mm_m : out mm_m_rec_t);
procedure fpm_ctrl_config(
signal mm_s : in mm_s_rec_t;
signal mm_m : out mm_m_rec_t);
procedure ch_offset_config(
ch_id : in natural;
ch_offset : in natural;
signal mm_s : in mm_s_rec_t;
signal mm_m : out mm_m_rec_t);
procedure ch_ctrl_config(
ch_id : in natural;
pixel_num : in natural;
signal mm_s : in mm_s_rec_t;
signal mm_m : out mm_m_rec_t);
procedure pulse_gen_config(
ch_id : in natural;
ch_offset : in natural;
div_ratio : in real;
subpix_phases : in natural;
pixel_num : in natural;
signal mm_s : in mm_s_rec_t;
signal mm_m : out mm_m_rec_t);
procedure fpm_input_config(
input_type : in fpm_input_type_t;
signal mm_s : in mm_s_rec_t;
signal mm_m : out mm_m_rec_t);
procedure fpm_ems_config(
signal mm_s : in mm_s_rec_t;
signal mm_m : out mm_m_rec_t);
procedure drop_watch_config(
enable : in std_logic;
src : in std_logic_vector(3 downto 0);
pulse_witdth : in natural;
signal mm_s : in mm_s_rec_t;
signal mm_m : out mm_m_rec_t);
-----------------------------------------------------------------------------
-- ENC/PD Emulator Configuration
-----------------------------------------------------------------------------
type enc_phase_t is (SINGLE_PHASE, DUAL_PHASE);
type enc_edge_t is (RISING, FALLING, RISING_AND_FALLING);
type pd_edge_t is (RISING, FALLING, RISING_AND_FALLING);
subtype enc_freq_t is real range 0.0e3 to 10.0e6;
subtype pd_pulse_width_t is real range 0.0 to 1000.0; -- PD period in us
--subtype pd_period_t is real range 50.0 to 1.0e6; -- PD period in us
subtype pd_period_t is real range 0.5 to 1.0e6; -- PD period in us
type enc_dir_t is (DIR_0, DIR_1);
type emul_cfg_t is record
enc_res : real;
enc_ppr : integer;
enc_phase : enc_phase_t;
enc_edge : enc_edge_t;
enc_dir : enc_dir_t;
pd_edge : pd_edge_t;
enc_freq : enc_freq_t;
pd_pulse_w : pd_pulse_width_t;
pd_period : pd_period_t;
enc_pulses : integer;
end record emul_cfg_t;
-- set abs-pos
procedure set_enc_abs_pos(
abs_pos : in std_logic_vector(39 downto 0);
signal mm_s_rec : in mm_s_rec_t;
signal mm_m_rec : out mm_m_rec_t);
-- The ENC/PD emulator configuration is derived from the EMS
procedure apply_enc_pd_emul_cfg(
cfg : in emul_cfg_t;
init : in boolean := true;
run_pulses_mode : in boolean := false;
signal mm_s_rec : in mm_s_rec_t;
signal mm_m_rec : out mm_m_rec_t);
-- Stop the ENC/PD emulator
procedure stop_enc_pd_emul(
signal mm_s_rec : in mm_s_rec_t;
signal mm_m_rec : out mm_m_rec_t);
procedure check_max_pulses_done(
done : out boolean;
signal mm_s_rec : in mm_s_rec_t;
signal mm_m_rec : out mm_m_rec_t);
-- Run a fix number of encoder pulses
procedure run_enc_pulses(
enc_freq : in enc_freq_t;
direction : in enc_dir_t;
double_ph_mode : in boolean := true;
num_pulses : in integer;
enc_ppr : in integer;
signal mm_s_rec : in mm_s_rec_t;
signal mm_m_rec : out mm_m_rec_t);
-- Run PD pulses: either single pulse or periodic mode
procedure run_pd_pulses(
pulse_width : in pd_pulse_width_t;
pd_period : in pd_period_t;
single_pulse_mode : in boolean := false;
signal mm_s_rec : in mm_s_rec_t;
signal mm_m_rec : out mm_m_rec_t);
-----------------------------------------------------------------------------
-- Support functions
-----------------------------------------------------------------------------
-- generate the NCO increment corresponding to a given output frequency
function freq2NCO_inc(
f_out : real; f_clk : real) return std_logic_vector;
end fire_pulse_manager_7_tb_pkg;
package body fire_pulse_manager_7_tb_pkg is
-----------------------------------------------------------------------------
-- FPM Configuration
-----------------------------------------------------------------------------
-- fpm_reg_write with addr defined as std_logic_vector
procedure fpm_reg_write(
blk_id : in natural range 0 to BLK_NUM-1;
addr : in std_logic_vector;
data : in std_logic_vector(31 downto 0);
signal mm_s : in mm_s_rec_t;
signal mm_m : out mm_m_rec_t) is
variable address : std_logic_vector(31 downto 0);
begin
address := std_logic_vector(to_unsigned(blk_id*BLK_SIZE+to_integer(unsigned(addr)),32));
mm_32b_write(address, data, mm_s, mm_m);
end procedure fpm_reg_write;
-- fpm_reg_write with addr defined as integer
procedure fpm_reg_write(
blk_id : in natural range 0 to BLK_NUM-1;
addr : in integer;
data : in std_logic_vector(31 downto 0);
signal mm_s : in mm_s_rec_t;
signal mm_m : out mm_m_rec_t) is
variable address : std_logic_vector(31 downto 0);
begin
address := std_logic_vector(to_unsigned((blk_id*BLK_SIZE)+addr,32));
mm_32b_write(address, data, mm_s, mm_m);
end procedure fpm_reg_write;
-- fpm_reg_read with addr defined as std_logic_vector
procedure fpm_reg_read(
blk_id : in natural range 0 to BLK_NUM-1;
addr : in std_logic_vector;
data : out std_logic_vector(31 downto 0);
signal mm_s : in mm_s_rec_t;
signal mm_m : out mm_m_rec_t) is
variable address : std_logic_vector(31 downto 0);
begin
address := std_logic_vector(to_unsigned(blk_id*BLK_SIZE+to_integer(unsigned(addr)),32));
mm_32b_read(address, data, mm_s, mm_m);
end procedure fpm_reg_read;
-- fpm_reg_read with addr defined as std_logic_vector
procedure fpm_reg_read(
blk_id : in natural range 0 to BLK_NUM-1;
addr : in integer;
data : out std_logic_vector(31 downto 0);
signal mm_s : in mm_s_rec_t;
signal mm_m : out mm_m_rec_t) is
variable address : std_logic_vector(31 downto 0);
begin
address := std_logic_vector(to_unsigned((blk_id*BLK_SIZE)+addr,32));
mm_32b_read(address, data, mm_s, mm_m);
end procedure fpm_reg_read;
procedure fpm_ctrl_config(
signal mm_s : in mm_s_rec_t;
signal mm_m : out mm_m_rec_t) is
variable data : std_logic_vector(31 downto 0);
begin
log("Configuring FPM Controller ... ", VMEDIUM, true);
-- Enable the POF-Rx
data := X"0000_0001";
fpm_reg_write(FP_CTRL_ID, CSR_POF_RECEIVER_CONTROL_ADDR_INT, data, mm_s, mm_m);
fpm_reg_read(FP_CTRL_ID, CSR_SIGNAL_SELECTION_ADDR_INT, data, mm_s, mm_m);
-- Select the input source
data(2 downto 0) := b"001";
fpm_reg_write(FP_CTRL_ID, CSR_SIGNAL_SELECTION_ADDR_INT, data, mm_s, mm_m);
end procedure fpm_ctrl_config;
procedure ch_offset_config(
ch_id : in natural;
ch_offset : in natural;
signal mm_s : in mm_s_rec_t;
signal mm_m : out mm_m_rec_t) is
variable data : std_logic_vector(31 downto 0);
begin
-- Disable/Re-enable first the whole pulse_generator
data := std_logic_vector(to_unsigned(ch_offset, 32));
fpm_reg_write(PG_CH_ID+ch_id, work.pulse_generator_4_pkg.CSR_PD_OFFSET_DIR_0_ADDR, data, mm_s, mm_m);
fpm_reg_write(PG_CH_ID+ch_id, work.pulse_generator_4_pkg.CSR_PD_OFFSET_DIR_1_ADDR, data, mm_s, mm_m);
log("CH-" & to_string(ch_id) & ": PD offset configured to " & to_string(ch_offset) & ".", VMEDIUM);
end procedure ch_offset_config;
procedure ch_ctrl_config(
ch_id : in natural;
pixel_num : in natural;
signal mm_s : in mm_s_rec_t;
signal mm_m : out mm_m_rec_t) is
variable data : std_logic_vector(31 downto 0);
variable ram_idx : natural;
variable ram_offset : natural;
begin
ram_offset := to_integer(unsigned(work.pulse_generator_4_pkg.SEQ_GENERIC_SEQUENCER_17_CHANNEL_ADDR));
ram_idx := 0;
-- Issue first an image on DIR-0, then on DIR-1
-- Reset the vector output value
data := X"30000000";
fpm_reg_write(PG_CH_ID+ch_id, ram_offset+ram_idx, data, mm_s, mm_m);
ram_idx := ram_idx + 1;
-- Enable Trigger Mask (All the triggers)
data := X"1000000F";
fpm_reg_write(PG_CH_ID+ch_id, ram_offset+ram_idx, data, mm_s, mm_m);
ram_idx := ram_idx + 1;
-- Wait for a single PD event
data := X"20000001";
fpm_reg_write(PG_CH_ID+ch_id, ram_offset+ram_idx, data, mm_s, mm_m);
ram_idx := ram_idx + 1;
-- Issue a request to generate 'pixel_num' fire requests
data := X"30" & std_logic_vector(to_unsigned(pixel_num,16)) & X"24";
fpm_reg_write(PG_CH_ID+ch_id, ram_offset+ram_idx, data, mm_s, mm_m);
ram_idx := ram_idx + 1;
data := X"30" & std_logic_vector(to_unsigned(pixel_num,16)) & X"00";
fpm_reg_write(PG_CH_ID+ch_id, ram_offset+ram_idx, data, mm_s, mm_m);
ram_idx := ram_idx + 1;
-- wait until the end of the image
data := X"23000001";
fpm_reg_write(PG_CH_ID+ch_id, ram_offset+ram_idx, data, mm_s, mm_m);
ram_idx := ram_idx + 1;
-- Switch to DIR-1
data := X"30000001";
fpm_reg_write(PG_CH_ID+ch_id, ram_offset+ram_idx, data, mm_s, mm_m);
ram_idx := ram_idx + 1;
-- Wait for a single PD event
data := X"20000001";
fpm_reg_write(PG_CH_ID+ch_id, ram_offset+ram_idx, data, mm_s, mm_m);
ram_idx := ram_idx + 1;
-- Issue a request to generate 'pixel_num' fire requests
data := X"30" & std_logic_vector(to_unsigned(pixel_num,16)) & X"25";
fpm_reg_write(PG_CH_ID+ch_id, ram_offset+ram_idx, data, mm_s, mm_m);
ram_idx := ram_idx + 1;
data := X"30" & std_logic_vector(to_unsigned(pixel_num,16)) & X"01";
fpm_reg_write(PG_CH_ID+ch_id, ram_offset+ram_idx, data, mm_s, mm_m);
ram_idx := ram_idx + 1;
-- wait until the end of the image
data := X"23000001";
fpm_reg_write(PG_CH_ID+ch_id, ram_offset+ram_idx, data, mm_s, mm_m);
ram_idx := ram_idx + 1;
-- Jump to DIR-0
data := X"C0000000";
fpm_reg_write(PG_CH_ID+ch_id, ram_offset+ram_idx, data, mm_s, mm_m);
ram_idx := ram_idx + 1;
end procedure ch_ctrl_config;
procedure pulse_gen_config(
ch_id : in natural;
ch_offset : in natural;
div_ratio : in real;
subpix_phases : in natural;
pixel_num : in natural;
signal mm_s : in mm_s_rec_t;
signal mm_m : out mm_m_rec_t) is
variable data : std_logic_vector(31 downto 0);
variable ratio_int : integer;
variable ratio_slv : std_logic_vector(33 downto 0);
begin
log("Configuring Channel " & to_string(ch_id) & " ... ", VMEDIUM, true);
-- Disable/Re-enable first the whole pulse_generator
data := (others => '0');
fpm_reg_write(PG_CH_ID+ch_id, work.pulse_generator_4_pkg.CSR_PULSE_GEN_CONTROL_W_ADDR, data, mm_s, mm_m);
data := (0 => '1', 16 => '1', others => '0');
fpm_reg_write(PG_CH_ID+ch_id, work.pulse_generator_4_pkg.CSR_PULSE_GEN_CONTROL_W_ADDR, data, mm_s, mm_m);
-- Disable/Re-enable the Channel Controller sequencer
data := (others => '0');
fpm_reg_write(PG_CH_ID+ch_id, to_integer(unsigned(work.pulse_generator_4_pkg.CSR_GENERIC_SEQUENCER_17_CHANNEL_ADDR)) + 3, data, mm_s, mm_m);
data := (0 => '1', others => '0');
fpm_reg_write(PG_CH_ID+ch_id, to_integer(unsigned(work.pulse_generator_4_pkg.CSR_GENERIC_SEQUENCER_17_CHANNEL_ADDR)) + 3, data, mm_s, mm_m);
-- Set the number of sub-pixel phases
data := std_logic_vector(to_unsigned(subpix_phases, 32));
fpm_reg_write(PG_CH_ID+ch_id, work.pulse_generator_4_pkg.CSR_SUBPIXEL_PHASE_NUM_ADDR, data, mm_s, mm_m);
-- set the division ratio
ratio_int := integer((div_ratio / real(subpix_phases)) * 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);
fpm_reg_write(PG_CH_ID+ch_id, work.pulse_generator_4_pkg.CSR_DIVIDER_RATIO_INT_ADDR, data, mm_s, mm_m);
data(31 downto 24) := (others => '0');
data(23 downto 0) := ratio_slv(23 downto 0);
fpm_reg_write(PG_CH_ID+ch_id, work.pulse_generator_4_pkg.CSR_DIVIDER_RATIO_FRACTION_ADDR, data, mm_s, mm_m);
-- Disable/Enable the fractional divider
data := (others => '0');
fpm_reg_write(PG_CH_ID+ch_id, work.pulse_generator_4_pkg.CSR_FRACTIONAL_DIVIDER_CONTROL_ADDR, data, mm_s, mm_m);
data := (0 => '1', others => '0');
fpm_reg_write(PG_CH_ID+ch_id, work.pulse_generator_4_pkg.CSR_FRACTIONAL_DIVIDER_CONTROL_ADDR, data, mm_s, mm_m);
-- configure the channel offset
ch_offset_config(ch_id, ch_offset, mm_s, mm_m);
-- Configure the sequencer RAM
ch_ctrl_config(ch_id, pixel_num, mm_s, mm_m);
-- Restart the sequencer
data := (others => '0');
fpm_reg_write(PG_CH_ID+ch_id, work.pulse_generator_4_pkg.CSR_CHANNEL_CONTROLLER_CONTROL_W_ADDR, data, mm_s, mm_m);
data := (0 => '1', others => '0');
fpm_reg_write(PG_CH_ID+ch_id, work.pulse_generator_4_pkg.CSR_CHANNEL_CONTROLLER_CONTROL_W_ADDR, data, mm_s, mm_m);
end procedure pulse_gen_config;
procedure fpm_input_config(
input_type : in fpm_input_type_t;
signal mm_s : in mm_s_rec_t;
signal mm_m : out mm_m_rec_t) is
variable data : std_logic_vector(31 downto 0);
begin
if(input_type = POF_INPUT) then
fpm_reg_read(FP_CTRL_ID, CSR_SIGNAL_SELECTION_ADDR_INT, data, mm_s, mm_m);
data(2 downto 0) := b"001";
fpm_reg_write(FP_CTRL_ID, CSR_SIGNAL_SELECTION_ADDR_INT, data, mm_s, mm_m);
log("FPM input set to POF. ", VLOW, true);
elsif(input_type = EPD_INPUT) then
data(2 downto 0) := b"101";
fpm_reg_write(FP_CTRL_ID, CSR_SIGNAL_SELECTION_ADDR_INT, data, mm_s, mm_m);
log("FPM input set to EPD. ", VLOW, true);
end if;
end procedure fpm_input_config;
procedure fpm_ems_config(
signal mm_s : in mm_s_rec_t;
signal mm_m : out mm_m_rec_t) is
variable data : std_logic_vector(31 downto 0);
begin
log("Configuring EMS ... ", VMEDIUM, true);
-- EMS software init
fpm_reg_write(EMS_BLK_ID, work.ems_1_pkg.CSR_EMS_ENABLE_ADDR, 32x"1", mm_s, mm_m);
-- disable the EMS during the configuration
fpm_reg_write(EMS_BLK_ID, work.ems_1_pkg.CSR_EMS_ENABLE_ADDR, 32x"0", mm_s, mm_m);
-- apply EMS config
fpm_reg_write(EMS_BLK_ID, work.ems_1_pkg.CSR_EMS_CONFIG_ADDR, 32x"3E0", mm_s, mm_m);
-- enable the EMS
fpm_reg_write(EMS_BLK_ID, work.ems_1_pkg.CSR_EMS_ENABLE_ADDR, 32x"E", mm_s, mm_m);
end procedure fpm_ems_config;
procedure drop_watch_config(
enable : in std_logic;
src : in std_logic_vector(3 downto 0);
pulse_witdth : in natural;
signal mm_s : in mm_s_rec_t;
signal mm_m : out mm_m_rec_t) is
variable data : std_logic_vector(31 downto 0);
begin
-- configure the drop-watch
data := std_logic_vector(to_unsigned(pulse_witdth, 16)) & X"000" & src;
fpm_reg_write(FP_CTRL_ID, work.fpm_ctrl_7_pkg.CSR_DROP_WATCH_CONFIG_ADDR_INT, data, mm_s, mm_m);
-- Enable/disable the drop-watch
fpm_reg_read(FP_CTRL_ID, work.fpm_ctrl_7_pkg.CSR_SIGNAL_SELECTION_ADDR_INT, data, mm_s, mm_m);
data(3) := enable;
fpm_reg_write(FP_CTRL_ID, work.fpm_ctrl_7_pkg.CSR_SIGNAL_SELECTION_ADDR_INT, data, mm_s, mm_m);
if(enable = '1') then
log("Drop-Watch output enable on channel " & to_string(to_integer(unsigned(src))) & ".", VMEDIUM, true);
else
log("Drop-Watch output disabled.", VMEDIUM, true);
end if;
end procedure drop_watch_config;
-----------------------------------------------------------------------------
-- ENC/PD Emulator Configuration
-----------------------------------------------------------------------------
procedure set_enc_abs_pos(
abs_pos : in std_logic_vector(39 downto 0);
signal mm_s_rec : in mm_s_rec_t;
signal mm_m_rec : out mm_m_rec_t) is
variable addr : std_logic_vector(31 downto 0) := (others => '0');
variable data : std_logic_vector(31 downto 0) := (others => '0');
begin
-- set the value for MSBs
addr:= std_logic_vector(resize(unsigned(CSR_POS_INIT_MSB_ADDR), 32));
mm_32b_write(addr, 24x"0" & abs_pos(39 downto 32), mm_s_rec, mm_m_rec);
-- set the value for LSBs
addr:= std_logic_vector(resize(unsigned(CSR_POS_INIT_LSB_ADDR), 32));
mm_32b_write(addr, abs_pos(31 downto 0), mm_s_rec, mm_m_rec);
-- read back the encoder configuration, then apply the set_abs_pos control
-- bit
addr:= std_logic_vector(resize(unsigned(CSR_ENC_CTRL_W_ADDR), 32));
mm_32b_read(addr, data, mm_s_rec, mm_m_rec);
data(3) := '1';
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
log("Encoder/PD emulator abs-pos preset to " & to_string(to_integer(signed(abs_pos))) & ".", VMEDIUM);
end procedure set_enc_abs_pos;
procedure apply_enc_pd_emul_cfg(
cfg : in emul_cfg_t;
init : in boolean := true;
run_pulses_mode : in boolean := false;
signal mm_s_rec : in mm_s_rec_t;
signal mm_m_rec : out mm_m_rec_t) is
variable addr : std_logic_vector(31 downto 0) := (others => '0');
variable data : std_logic_vector(31 downto 0) := (others => '0');
variable data_check : std_logic_vector(31 downto 0) := (others => '0');
--
variable pd_low_period : real := 0.0; -- PD low period (ns)
variable pd_high_period : real := 0.0; -- PD high period (ns)
begin
-- Set the NCO inc: output freq
addr:= std_logic_vector(resize(unsigned(CSR_ENC_NCO_INC_ADDR), 32));
data := freq2NCO_inc(real(cfg.enc_freq), CLK_FREQ);
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
-- set the max pulses register
addr := std_logic_vector(resize(unsigned(CSR_ENC_PULSE_NUM_ADDR), 32));
data := std_logic_vector(to_unsigned(cfg.enc_pulses, 32));
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
-- set the zero-phase ppr number
addr := std_logic_vector(resize(unsigned(CSR_ENC_ZP_PPR_ADDR), 32));
data := std_logic_vector(to_unsigned(cfg.enc_ppr, 32));
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
-- Enable only the necessary outputs:
if(cfg.enc_phase = DUAL_PHASE ) then
data := 32x"FF";
else
data := 32x"BB";
end if;
addr := std_logic_vector(resize(unsigned(CSR_OUT_ENABLE_ADDR), 32));
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
addr := std_logic_vector(resize(unsigned(CSR_ENC_CTRL_W_ADDR), 32));
if(init = true) then
mm_32b_write(addr, 32x"2", mm_s_rec, mm_m_rec);
end if;
data := (others => '0');
if(run_pulses_mode = true) then
data(4) := '1';
end if;
if(cfg.enc_dir = DIR_0) then
data(2) := '0';
else
data(2) := '1';
end if;
-- enable the encoder
data(0) := '1';
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
log("Encoder/PD emulator enabled.", VMEDIUM);
end procedure apply_enc_pd_emul_cfg;
-- Stop the ENC/PD emulator
procedure stop_enc_pd_emul(
signal mm_s_rec : in mm_s_rec_t;
signal mm_m_rec : out mm_m_rec_t) is
variable addr : std_logic_vector(31 downto 0) := (others => '0');
variable data : std_logic_vector(31 downto 0) := (others => '0');
begin
-- Disable PD emulation
addr := std_logic_vector(resize(unsigned(CSR_PD_CTRL_ADDR), 32));
mm_32b_read(addr, data, mm_s_rec, mm_m_rec);
data(0) := '0';
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
-- Disable Enc emulation
addr := std_logic_vector(resize(unsigned(CSR_ENC_CTRL_W_ADDR), 32));
mm_32b_read(addr, data, mm_s_rec, mm_m_rec);
data(0) := '0';
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
end procedure stop_enc_pd_emul;
-- Check whether the generation of a fixed number of encoder pulses has completed
procedure check_max_pulses_done(
done : out boolean;
signal mm_s_rec : in mm_s_rec_t;
signal mm_m_rec : out mm_m_rec_t) is
variable addr : std_logic_vector(31 downto 0) := (others => '0');
variable data : std_logic_vector(31 downto 0) := (others => '0');
begin
addr := std_logic_vector(resize(unsigned(CSR_ENC_CTRL_R_ADDR), 32));
mm_32b_read(addr, data, mm_s_rec, mm_m_rec);
if(data(6) = '1') then
done := true;
else
done := false;
end if;
end procedure check_max_pulses_done;
-- Run a fix number of encoder pulses
procedure run_enc_pulses(
enc_freq : in enc_freq_t;
direction : in enc_dir_t;
double_ph_mode : in boolean := true;
num_pulses : in integer;
enc_ppr : in integer;
signal mm_s_rec : in mm_s_rec_t;
signal mm_m_rec : out mm_m_rec_t) is
variable addr : std_logic_vector(31 downto 0) := (others => '0');
variable data : std_logic_vector(31 downto 0) := (others => '0');
variable data_check : std_logic_vector(31 downto 0) := (others => '0');
begin
-- Set the NCO inc: output freq
addr := std_logic_vector(resize(unsigned(CSR_ENC_NCO_INC_ADDR), 32));
data := freq2NCO_inc(real(enc_freq), CLK_FREQ);
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
-- set the max pulses register
addr := std_logic_vector(resize(unsigned(CSR_ENC_PULSE_NUM_ADDR), 32));
data := std_logic_vector(to_unsigned(num_pulses, 32));
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
-- set the zero-phase ppr number
addr := std_logic_vector(resize(unsigned(CSR_ENC_ZP_PPR_ADDR), 32));
data := std_logic_vector(to_unsigned(enc_ppr, 32));
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
-- Enable only the necessary outputs:
if(double_ph_mode = true) then
data := 32x"FF";
else
data := 32x"BB";
end if;
addr := std_logic_vector(resize(unsigned(CSR_OUT_ENABLE_ADDR), 32));
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
addr := std_logic_vector(resize(unsigned(CSR_ENC_CTRL_W_ADDR), 32));
data := (4 => '1', 5 => '1', others => '0');
if(direction = DIR_0) then
data(2) := '0';
else
data(2) := '1';
end if;
-- enable the encoder
data(0) := '1';
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
--log("Running encoder pulses ... ", VMEDIUM);
end procedure run_enc_pulses;
-- Run PD pulses: either single pulse or periodic mode
procedure run_pd_pulses(
pulse_width : in pd_pulse_width_t;
pd_period : in pd_period_t;
single_pulse_mode : in boolean := false;
signal mm_s_rec : in mm_s_rec_t;
signal mm_m_rec : out mm_m_rec_t) is
variable addr : std_logic_vector(31 downto 0) := (others => '0');
variable data : std_logic_vector(31 downto 0) := (others => '0');
variable data_check : std_logic_vector(31 downto 0) := (others => '0');
variable tmp_val : integer;
variable idx : integer;
variable loop_idx : integer;
begin
-- set the pulse width
addr := std_logic_vector(resize(unsigned(CSR_PD_PULSE_WIDTH_ADDR), 32));
data := std_logic_vector(to_unsigned(integer(pulse_width*100.0),32));
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
-- No need to use the sequerncer for a single pulse
if(single_pulse_mode = true) then
addr := std_logic_vector(resize(unsigned(CSR_PD_CTRL_ADDR), 32));
mm_32b_write(addr, 32x"3", mm_s_rec, mm_m_rec);
log("Issued single PD pulse. ", VMEDIUM);
return;
end if;
-- Use the sequencer to generate periodic pulses (here the periodicity is
-- in time): First program the sequencer RAM with instructions to generate
-- pulses with the specified periodicity, then enable the sequencer,
-- finally trigger the start of the procedure:
-- Write in the Emulator sequencer a simple procedure to issue PD pulses
addr := std_logic_vector(resize(unsigned(SEQ_GENERIC_SEQUENCER_17_ADDR)+0, 32));
mm_32b_write(addr, X"100000FF", mm_s_rec, mm_m_rec); -- Enable triggers
addr := std_logic_vector(resize(unsigned(SEQ_GENERIC_SEQUENCER_17_ADDR)+1, 32));
mm_32b_write(addr, X"30000000", mm_s_rec, mm_m_rec); -- All the outputs to zero
idx := 2;
loop_idx := idx;
if(pd_period >= 1.0) then
-- add a first trigger-wait instruction for 1-us pulses
addr := std_logic_vector(resize(unsigned(SEQ_GENERIC_SEQUENCER_17_ADDR)+idx, 32));
tmp_val := integer(pd_period);
data := X"21000" & std_logic_vector(to_unsigned(tmp_val, 12));
mm_32b_write(addr, data, mm_s_rec, mm_m_rec); -- trig_wait (us pulses)
idx := idx + 1;
end if;
-- add a second trigger on single clock cycle events
addr := std_logic_vector(resize(unsigned(SEQ_GENERIC_SEQUENCER_17_ADDR)+idx, 32));
tmp_val := integer((pd_period-floor(pd_period))*100.0);
data := X"20000" & std_logic_vector(to_unsigned(tmp_val, 12));
mm_32b_write(addr, data, mm_s_rec, mm_m_rec); -- trig_wait (clk pulses)
idx := idx + 1;
-- issue the PD pulse
addr := std_logic_vector(resize(unsigned(SEQ_GENERIC_SEQUENCER_17_ADDR)+idx, 32));
mm_32b_write(addr, X"31000001", mm_s_rec, mm_m_rec); -- All the outputs to zero
idx := idx + 1;
-- Jump to the beginning of the loop
addr := std_logic_vector(resize(unsigned(SEQ_GENERIC_SEQUENCER_17_ADDR)+idx, 32));
mm_32b_write(addr, X"31000001", mm_s_rec, mm_m_rec); -- All the outputs to zero
-- Enable the sequencer
addr := std_logic_vector(resize(unsigned(SEQ_GENERIC_SEQUENCER_17_ADDR)+idx, 32));
mm_32b_write(addr, 32x"1", mm_s_rec, mm_m_rec); -- All the outputs to zero
-- issue a start-request to the sequencer
addr := std_logic_vector(resize(unsigned(CSR_SEQ_CTRL_ADDR), 32));
data(0) := '1'; -- start-request bit
data(24 downto 16) := 9x"0"; -- EAM sequence start-address
mm_32b_write(addr, 32x"1", mm_s_rec, mm_m_rec);
log("Running PD pulses ... ", VMEDIUM);
end procedure run_pd_pulses;
-----------------------------------------------------------------------------
-- Support functions
-----------------------------------------------------------------------------
-- 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(ENC_NCO_WIDTH-1 downto 0);
begin
nco_inc := std_logic_vector(to_unsigned(integer((f_out/f_clk)*(2.0**ENC_NCO_WIDTH)),ENC_NCO_WIDTH));
return nco_inc;
end function freq2NCO_inc;
end fire_pulse_manager_7_tb_pkg;

View file

@ -0,0 +1,633 @@
-------------------------------------------------------------------------------
-- Title : led_tb
-- Project : FPM
-------------------------------------------------------------------------------
-- File : led_tb.vhd
-- Author : GMG
-- Company : Global Inkjet Systems
-- Created : 2018-06-12
-- Last update: 2020-01-20
-- SVN ID : Git
-- Standard : VHDL'2008
-------------------------------------------------------------------------------
-- Description:
-- Testbench for the FPM LED generator
-------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library work;
use work.log_pkg.all;
entity led_tb is
-- ..
end entity led_tb;
architecture behav of led_tb is
constant CLK_PERIOD : time := 10 ns;
constant CLK_FREQ : real := 100.0e6; -- target clock frequency
-- Logging Verbosity Level
constant VERBOSITY_LEVEL : verb_level_t := VMEDIUM;
constant MAX_SIM_TIME : time := 50.0 ms; -- Maximum simulation time
constant MAX_PERIOD_MS : natural := 5;
constant GREEN_PERIOD_MS : natural := 2;
constant RUN_ENC_TEST : boolean := true;
constant RUN_PD_TEST : boolean := true;
constant RUN_POF_TEST : boolean := true;
signal reset_n : std_logic := '0';
signal clk : std_logic := '0';
--
signal init : std_logic;
signal pd : std_logic;
signal enc_p1 : std_logic;
signal enc_p2 : std_logic;
signal pof : std_logic;
signal all_ok : std_logic;
signal led_pd_g : std_logic;
signal led_pd_y : std_logic;
signal led_pd_r : std_logic;
signal led_enc_p1_g : std_logic;
signal led_enc_p1_y : std_logic;
signal led_enc_p1_r : std_logic;
signal led_enc_p2_g : std_logic;
signal led_enc_p2_y : std_logic;
signal led_enc_p2_r : std_logic;
signal led_pof_g : std_logic;
signal led_pof_y : std_logic;
signal led_pof_r : std_logic;
-- TB specific signals
signal setup : boolean;
signal running : boolean;
signal passed : boolean := false;
signal failed : boolean := false;
signal test_timeout : boolean := false;
signal test_completed : boolean := false;
signal error_flag : boolean;
begin -- architecture behav
clk <= not clk after 0.5*CLK_PERIOD;
-----------------------------------------------------------------------------
-- LED Generator (UUT)
-----------------------------------------------------------------------------
iUUT: entity work.seb_epd_led_gen_6
generic map (
MAX_PERIOD_MS => MAX_PERIOD_MS,
GREEN_PERIOD_MS => GREEN_PERIOD_MS)
port map (
reset_n => reset_n,
clk => clk,
init => init,
pd => pd,
enc_p1 => enc_p1,
enc_p2 => enc_p2,
pof => pof,
all_ok => all_ok,
led_pd_g => led_pd_g,
led_pd_y => led_pd_y,
led_pd_r => led_pd_r,
led_enc_p1_g => led_enc_p1_g,
led_enc_p1_y => led_enc_p1_y,
led_enc_p1_r => led_enc_p1_r,
led_enc_p2_g => led_enc_p2_g,
led_enc_p2_y => led_enc_p2_y,
led_enc_p2_r => led_enc_p2_r,
led_pof_g => led_pof_g,
led_pof_y => led_pof_y,
led_pof_r => led_pof_r);
-----------------------------------------------------------------------------
-- Testbench Logic
-----------------------------------------------------------------------------
pTEST_PROC : process
begin
---------------------------------------------------------------------------
-- Initialize & Configure
---------------------------------------------------------------------------
reset_n <= '0';
init <= '0';
setup <= false;
running <= false;
error_flag <= false;
--Set the verbosity level for logging
set_log_verbosity(VERBOSITY_LEVEL);
pd <= '0';
enc_p1 <= '0';
enc_p2 <= '0';
pof <= '0';
all_ok <= '0';
wait for 100 ns;
reset_n <= '1';
wait for 100 ns;
wait until clk = '1' and clk'event;
all_ok <= '1';
-- Nothing really to do here
setup <= true;
---------------------------------------------------------------------------
-- Running
---------------------------------------------------------------------------
running <= true;
log_separator_line(VLOW);
log("FPM (SEB-EPD) LEDs verification:", VLOW);
log_separator_line(VLOW);
wait for 0.5 ms;
---------------------------------------------------------------------------
-- POF LED
---------------------------------------------------------------------------
if(RUN_POF_TEST = true) then
log_separator_line(VLOW);
log("Testing POF LED:", VLOW);
wait for 5 us;
if(led_pof_r /= '0') then
log("ERROR: POF Red LED must be LOW.", VLOW);
error_flag <= true;
end if;
if(led_pof_y /= '0') then
log("ERROR: POF Yellow LED must be LOW.", VLOW);
error_flag <= true;
end if;
if(led_pof_g /= '0') then
log("ERROR: POF Green LED must be LOW.", VLOW);
error_flag <= true;
end if;
wait for 5 us;
wait until clk = '1' and clk'event;
pof <= not pof;
wait until clk = '1' and clk'event;
pof <= not pof;
wait for 100 ns;
if(led_pof_g /= '1') then
log("ERROR: POF Green LED must be HIGH.", VLOW);
error_flag <= true;
end if;
if(led_pof_y /= '0') then
log("ERROR: POF Yellow LED must be LOW.", VLOW);
error_flag <= true;
end if;
wait for 3 ms;
if(led_pof_g /= '0') then
log("ERROR: POF Green LED must be LOW.", VLOW);
error_flag <= true;
end if;
if(led_pof_y /= '0') then
log("ERROR: POF Yellow LED must be LOW.", VLOW);
error_flag <= true;
end if;
wait for 3 ms;
if(led_pof_g /= '0') then
log("ERROR: POF Green LED must be LOW.", VLOW);
error_flag <= true;
end if;
if(led_pof_y /= '1') then
log("ERROR: POF Yellow LED must be HIGH.", VLOW);
error_flag <= true;
end if;
wait for 5 us;
wait until clk = '1' and clk'event;
pof <= not pof;
wait until clk = '1' and clk'event;
pof <= not pof;
wait for 100 ns;
if(led_pof_g /= '1') then
log("ERROR: POF Green LED must be HIGH.", VLOW);
error_flag <= true;
end if;
if(led_pof_y /= '0') then
log("ERROR: POF Yellow LED must be LOW.", VLOW);
error_flag <= true;
end if;
for n in 0 to 8 loop
wait for 10 us;
wait until clk = '1' and clk'event;
pof <= not pof;
wait until clk = '1' and clk'event;
pof <= not pof;
end loop; -- n
wait for 100 ns;
if(led_pof_g /= '1') then
log("ERROR: POF Green LED must be HIGH.", VLOW);
error_flag <= true;
end if;
if(led_pof_y /= '0') then
log("ERROR: POF Yellow LED must be LOW.", VLOW);
error_flag <= true;
end if;
wait for 3 ms;
if(led_pof_g /= '0') then
log("ERROR: POF Green LED must be LOW.", VLOW);
error_flag <= true;
end if;
if(led_pof_y /= '0') then
log("ERROR: POF Yellow LED must be LOW.", VLOW);
error_flag <= true;
end if;
wait for 3 ms;
if(led_pof_g /= '0') then
log("ERROR: POF Green LED must be LOW.", VLOW);
error_flag <= true;
end if;
if(led_pof_y /= '1') then
log("ERROR: POF Yellow LED must be HIGH.", VLOW);
error_flag <= true;
end if;
wait for 50 ns;
if(error_flag = false) then
log("POF LEDs are OK.", VLOW);
end if;
wait for 0.5 ms;
end if; -- RUN_POF_TEST
---------------------------------------------------------------------------
-- PD LEDs
---------------------------------------------------------------------------
if(RUN_PD_TEST = true) then
log_separator_line(VLOW);
log("Testing PD LEDs:", VLOW);
pd <= '1';
wait for 100 ns;
if(led_pd_g /= '1') then
log("ERROR: PD Green LED must be HIGH.", VLOW);
error_flag <= true;
end if;
if(led_pd_y /= '0') then
log("ERROR: PD Yellow LED must be LOW.", VLOW);
error_flag <= true;
end if;
wait for 1 us;
pd <= '0';
wait for 1 us;
wait for 3 ms;
if(led_pd_g /= '0') then
log("ERROR: PD Green LED must be LOW.", VLOW);
error_flag <= true;
end if;
if(led_pd_y /= '0') then
log("ERROR: PD Yellow LED must be LOW.", VLOW);
error_flag <= true;
end if;
wait for 3 ms;
if(led_pd_g /= '0') then
log("ERROR: PD Green LED must be LOW.", VLOW);
error_flag <= true;
end if;
if(led_pd_y /= '1') then
log("ERROR: PD Yellow LED must be HIGH.", VLOW);
error_flag <= true;
end if;
wait for 1.5 ms;
pd <= '1';
wait for 1 us;
pd <= '0';
wait for 10 us;
pd <= '1';
wait for 1 us;
pd <= '0';
wait for 10 us;
pd <= '1';
wait for 1 us;
pd <= '0';
wait for 10 us;
pd <= '1';
wait for 1 us;
pd <= '0';
if(led_pd_g /= '1') then
log("ERROR: PD Green LED must be HIGH.", VLOW);
error_flag <= true;
end if;
if(led_pd_y /= '0') then
log("ERROR: PD Yellow LED must be LOW.", VLOW);
error_flag <= true;
end if;
wait for 3.0 ms;
if(led_pd_g /= '0') then
log("ERROR: PD Green LED must be LOW.", VLOW);
error_flag <= true;
end if;
if(led_pd_y /= '0') then
log("ERROR: PD Yellow LED must be LOW.", VLOW);
error_flag <= true;
end if;
wait for 3 ms;
if(led_pd_g /= '0') then
log("ERROR: PD Green LED must be LOW.", VLOW);
error_flag <= true;
end if;
if(led_pd_y /= '1') then
log("ERROR: PD Yellow LED must be HIGH.", VLOW);
error_flag <= true;
end if;
wait for 50 ns;
if(error_flag = false) then
log("PD LEDs are OK.", VLOW);
end if;
wait for 0.5 ms;
end if; -- RUN_PD_TEST
---------------------------------------------------------------------------
-- Encoder LEDs
---------------------------------------------------------------------------
if(RUN_ENC_TEST = true) then
log_separator_line(VLOW);
log("Testing Encoder LEDs:", VLOW);
wait for 5 us;
if(led_enc_p1_y /= '0') then
log("ERROR: P1 Yellow LED must be LOW.", VLOW);
error_flag <= true;
end if;
if(led_enc_p2_y /= '0') then
log("ERROR: P2 Yellow LED must be LOW.", VLOW);
error_flag <= true;
end if;
if(led_enc_p1_g /= '0') then
log("ERROR: P1 Green LED must be LOW.", VLOW);
error_flag <= true;
end if;
if(led_enc_p2_g /= '0') then
log("ERROR: P2 Green LED must be LOW.", VLOW);
error_flag <= true;
end if;
if(led_enc_p1_r /= '0') then
log("ERROR: P1 Red LED must be LOW.", VLOW);
error_flag <= true;
end if;
if(led_enc_p2_r /= '0') then
log("ERROR: P2 Red LED must be LOW.", VLOW);
error_flag <= true;
end if;
wait for 1 us;
enc_p1 <= '1';
wait for 10 us;
enc_p2 <= '1';
wait for 100 ns;
if(led_enc_p1_g /= '1') then
log("ERROR: P1 Green LED must be HIGH.", VLOW);
error_flag <= true;
end if;
if(led_enc_p2_g /= '1') then
log("ERROR: P2 Green LED must be HIGH.", VLOW);
error_flag <= true;
end if;
if(led_enc_p1_y /= '0') then
log("ERROR: P1 Yellow LED must be LOW.", VLOW);
error_flag <= true;
end if;
if(led_enc_p2_y /= '0') then
log("ERROR: P2 Yellow LED must be LOW.", VLOW);
error_flag <= true;
end if;
wait for 3 ms;
if(led_enc_p1_g /= '0') then
log("ERROR: P1 Green LED must be LOW.", VLOW);
error_flag <= true;
end if;
if(led_enc_p2_g /= '0') then
log("ERROR: P2 Green LED must be LOW.", VLOW);
error_flag <= true;
end if;
if(led_enc_p1_y /= '0') then
log("ERROR: P1 Yellow LED must be LOW.", VLOW);
error_flag <= true;
end if;
if(led_enc_p2_y /= '0') then
log("ERROR: P2 Yellow LED must be LOW.", VLOW);
error_flag <= true;
end if;
wait for 3 ms;
if(led_enc_p1_g /= '0') then
log("ERROR: P1 Green LED must be LOW.", VLOW);
error_flag <= true;
end if;
if(led_enc_p2_g /= '0') then
log("ERROR: P2 Green LED must be LOW.", VLOW);
error_flag <= true;
end if;
if(led_enc_p1_y /= '1') then
log("ERROR: P1 Yellow LED must be HIGH.", VLOW);
error_flag <= true;
end if;
if(led_enc_p2_y /= '1') then
log("ERROR: P2 Yellow LED must be HIGH.", VLOW);
error_flag <= true;
end if;
wait for 20 us;
enc_p1 <= '0';
wait for 100 ns;
if(led_enc_p1_g /= '1') then
log("ERROR: P1 Green LED must be HIGH.", VLOW);
error_flag <= true;
end if;
wait for 3 ms;
if(led_enc_p1_g /= '0') then
log("ERROR: P1 Green LED must be LOW.", VLOW);
error_flag <= true;
end if;
wait for 5 us;
enc_p1 <= '1';
wait for 100 ns;
if(led_enc_p1_g /= '1') then
log("ERROR: P1 Green LED must be HIGH.", VLOW);
error_flag <= true;
end if;
wait for 10 us;
enc_p1 <= '0';
wait for 10 us;
enc_p1 <= '1';
wait for 10 us;
enc_p1 <= '0';
wait for 10 us;
enc_p1 <= '1';
wait for 10 us;
if(led_enc_p1_g /= '1') then
log("ERROR: P1 Green LED must be HIGH.", VLOW);
error_flag <= true;
end if;
wait for 200 us;
enc_p2 <= '0';
wait for 100 ns;
if(led_enc_p2_g /= '1') then
log("ERROR: P2 Green LED must be HIGH.", VLOW);
error_flag <= true;
end if;
wait for 3 ms;
if(led_enc_p2_g /= '0') then
log("ERROR: P2 Green LED must be LOW.", VLOW);
error_flag <= true;
end if;
if(led_enc_p2_y /= '0') then
log("ERROR: P2 Yellow LED must be LOW.", VLOW);
error_flag <= true;
end if;
wait for 3 ms;
if(led_enc_p2_g /= '0') then
log("ERROR: P2 Green LED must be LOW.", VLOW);
error_flag <= true;
end if;
if(led_enc_p2_y /= '1') then
log("ERROR: P2 Yellow LED must be HIGH.", VLOW);
error_flag <= true;
end if;
wait for 10 us;
enc_p2 <= not enc_p2;
enc_p1 <= not enc_p1;
wait for 100 ns;
if(led_enc_p1_r /= '1') then
log("ERROR: P1 Red LED must be HIGH.", VLOW);
error_flag <= true;
end if;
if(led_enc_p2_r /= '1') then
log("ERROR: P2 Red LED must be HIGH.", VLOW);
error_flag <= true;
end if;
wait for 6 ms;
wait for 100 ns;
if(led_enc_p1_r /= '0') then
log("ERROR: P1 Red LED must be LOW.", VLOW);
error_flag <= true;
end if;
if(led_enc_p2_r /= '0') then
log("ERROR: P2 Red LED must be LOW.", VLOW);
error_flag <= true;
end if;
if(led_enc_p1_y /= '1') then
log("ERROR: P1 Yellow LED must be HIGH.", VLOW);
error_flag <= true;
end if;
if(led_enc_p2_y /= '1') then
log("ERROR: P2 Yellow LED must be HIGH.", VLOW);
error_flag <= true;
end if;
wait for 0.5 ms;
if(error_flag = false) then
log("Encoder LEDs are OK.", VLOW);
end if;
end if; -- RUN_ENC_TEST
---------------------------------------------------------------------------
-- End
---------------------------------------------------------------------------
wait for 20 us;
passed <= true after 100 ns;
wait;
end process pTEST_PROC;
failed <= error_flag after 100 ns;
CHECK_SIM_TIMEOUT: process
begin -- process CHECK_SIM_TIMEOUT
while now < MAX_SIM_TIME loop
wait for 100 us;
end loop;
test_timeout <= true;
wait;
end process CHECK_SIM_TIMEOUT;
pREPORT_RESULT : process
begin
wait until failed = true or passed = true or test_timeout = 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);
elsif(test_timeout = true) then
log("FAILURE: test achieved max-sim-time without reaching ", VLOW);
log(" failed/passed condition.", VLOW);
end if;
log_separator_line(VLOW);
test_completed <= true;
end process pREPORT_RESULT;
end architecture behav;

View file

@ -0,0 +1,110 @@
[{
"ip_name" : "generic_delay_queue_2",
"bus" : "csr",
"addr_width" : "4",
"description" : "This block is the generic delay queue",
"notes" : "This is the generic delay queue component, used in various projects. Details of this block can be found at https://confluence.gisapps.co.uk/display/EL/Generic+Delay+Queue.",
"registers" : {
"ip_id" : {
"address" : "0",
"width" : "32",
"description" : "Unique ID for this IP block",
"fields": {
"ip_number" : {
"type" : "c",
"bit_len" : "8",
"reset" : "0x02",
"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" : "0x01",
"description" : "Minor number"
},
"major_number" : {
"type" : "c",
"bit_len" : "8",
"reset" : "0x02",
"description" : "Major number"
},
"reserved" : {
"type" : "rsv",
"bit_len" : "16",
"description" : "Reserved bits"
}
}
},
"config" : {
"address" : "2",
"width" : "30",
"description" : "Configuration status",
"fields": {
"log2_length_depth" : {
"type" : "r",
"bit_len" : "6",
"reset" : "0x00",
"description" : "LOG2 of LENGTH_DEPTH generic"
},
"log2_delay_depth" : {
"type" : "r",
"bit_len" : "6",
"reset" : "0x00",
"description" : "LOG2 of DELAY_DEPTH generic"
},
"log2_data_depth" : {
"type" : "r",
"bit_len" : "6",
"reset" : "0x00",
"description" : "LOG2 of DATA_DEPTH generic"
},
"delay_width" : {
"type" : "r",
"bit_len" : "6",
"reset" : "0x00",
"description" : "DELAY_WIDTH generic"
},
"data_width" : {
"type" : "r",
"bit_len" : "6",
"reset" : "0x00",
"description" : "DATA_WIDTH generic"
}
}
},
"ctrl_mode" : {
"address" : "3",
"width" : "2",
"type" : "w",
"reset" : "0",
"description" : "Control mode of block. 0=>disabled, 1=>bypass, 2=>cpu, 3=>normal or streaming (if PKT_MODE)"
},
"data" : {
"address" : "4",
"width" : "32",
"type" : "wp",
"reset" : "0",
"description" : "Sets the CPU ingress data and packet delay (when in CPU mode). As the widths of these are dependent on generics, and occupy consecutive bits, the field widths are undefined, except that the ingress data is the first DATA_WIDTH bits and the packet delay is the next DELAY_WIDTH bits, as defined in the CONFIG register"
}
}
}]

View file

@ -0,0 +1,22 @@
vlib OSVVM
vcom -2008 -work OSVVM \
../../../common/0/src/test/OSVVM/NamePkg.vhd \
../../../common/0/src/test/OSVVM/SortListPkg_int.vhd \
../../../common/0/src/test/OSVVM/MessagePkg.vhd \
../../../common/0/src/test/OSVVM/RandomBasePkg.vhd \
../../../common/0/src/test/OSVVM/RandomPkg.vhd \
../../../common/0/src/test/OSVVM/CoveragePkg.vhd
vlib work
# Compile the VHDL packages that support bus protocols, memory mapped registers and functional procedures
vcom -2008 -work work \
../../../common/0/src/pkg_functions.vhd \
../../../common/0/src/test/common_test_pkg.vhd \
../../../common/0/src/test/avalon_verify_pkg.vhd \
../src/altera/fifo_delay_queue_1.vhd \
../src/altera/fifo_delay_queue_1_ff.vhd \
../src/generic_delay_queue_2_pkg_auto.vhd \
../src/generic_delay_queue_2_csr_regs_auto.vhd \
../src/generic_delay_queue_2.vhd \
../src/test/generic_delay_queue_2_tb.vhd

View file

@ -0,0 +1,5 @@
set_global_assignment -name IP_TOOL_NAME "FIFO"
set_global_assignment -name IP_TOOL_VERSION "14.1"
set_global_assignment -name IP_GENERATED_DEVICE_FAMILY "{Cyclone V}"
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "fifo_delay_queue_1.vhd"]
set_global_assignment -name MISC_FILE [file join $::quartus(qip_path) "fifo_delay_queue_1.cmp"]

View file

@ -0,0 +1,202 @@
-- megafunction wizard: %FIFO%
-- GENERATION: STANDARD
-- VERSION: WM1.0
-- MODULE: scfifo
-- ============================================================
-- File Name: fifo_64x32.vhd
-- Megafunction Name(s):
-- scfifo
--
-- Simulation Library Files(s):
-- altera_mf
-- ============================================================
-- ************************************************************
-- THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE!
--
-- 14.1.1 Build 190 01/19/2015 SJ Web Edition
-- ************************************************************
--Copyright (C) 1991-2015 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 II 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;
use work.pkg_functions.all;
ENTITY fifo_delay_queue_1 IS
GENERIC (
DATA_WIDTH : natural range 1 to 32;
DATA_DEPTH : natural range 1 to 1024
);
PORT (
aclr : IN STD_LOGIC ;
clock : IN STD_LOGIC ;
data : IN STD_LOGIC_VECTOR (DATA_WIDTH-1 DOWNTO 0);
rdreq : IN STD_LOGIC ;
wrreq : IN STD_LOGIC ;
empty : OUT STD_LOGIC ;
full : OUT STD_LOGIC ;
q : OUT STD_LOGIC_VECTOR (DATA_WIDTH-1 DOWNTO 0);
usedw : OUT STD_LOGIC_VECTOR (log2(DATA_DEPTH)-1 DOWNTO 0)
);
END fifo_delay_queue_1;
ARCHITECTURE SYN OF fifo_delay_queue_1 IS
SIGNAL sub_wire0 : STD_LOGIC ;
SIGNAL sub_wire1 : STD_LOGIC ;
SIGNAL sub_wire2 : STD_LOGIC_VECTOR (DATA_WIDTH-1 DOWNTO 0);
SIGNAL sub_wire3 : STD_LOGIC_VECTOR (log2(DATA_DEPTH)-1 DOWNTO 0);
COMPONENT scfifo
GENERIC (
add_ram_output_register : STRING;
intended_device_family : 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 (
aclr : IN STD_LOGIC ;
clock : IN STD_LOGIC ;
data : IN STD_LOGIC_VECTOR (DATA_WIDTH-1 DOWNTO 0);
rdreq : IN STD_LOGIC ;
wrreq : IN STD_LOGIC ;
empty : OUT STD_LOGIC ;
full : OUT STD_LOGIC ;
q : OUT STD_LOGIC_VECTOR (DATA_WIDTH-1 DOWNTO 0);
usedw : OUT STD_LOGIC_VECTOR (log2(DATA_DEPTH)-1 DOWNTO 0)
);
END COMPONENT;
BEGIN
empty <= sub_wire0;
full <= sub_wire1;
q <= sub_wire2(DATA_WIDTH-1 DOWNTO 0);
usedw <= sub_wire3(log2(DATA_DEPTH)-1 DOWNTO 0);
scfifo_component : scfifo
GENERIC MAP (
add_ram_output_register => "OFF",
intended_device_family => "Cyclone V",
lpm_numwords => DATA_DEPTH,
lpm_showahead => "ON",
lpm_type => "scfifo",
lpm_width => DATA_WIDTH,
lpm_widthu => log2(DATA_DEPTH),
overflow_checking => "ON",
underflow_checking => "ON",
use_eab => "ON"
)
PORT MAP (
aclr => aclr,
clock => clock,
data => data,
rdreq => rdreq,
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 "1"
-- Retrieval info: PRIVATE: Clock NUMERIC "0"
-- Retrieval info: PRIVATE: Depth NUMERIC "32"
-- 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 "0"
-- Retrieval info: PRIVATE: MAX_DEPTH_BY_9 NUMERIC "0"
-- Retrieval info: PRIVATE: OVERFLOW_CHECKING NUMERIC "0"
-- Retrieval info: PRIVATE: Optimize NUMERIC "0"
-- Retrieval info: PRIVATE: RAM_BLOCK_TYPE NUMERIC "0"
-- 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 "64"
-- Retrieval info: PRIVATE: dc_aclr NUMERIC "1"
-- Retrieval info: PRIVATE: diff_widths NUMERIC "0"
-- Retrieval info: PRIVATE: msb_usedw NUMERIC "0"
-- Retrieval info: PRIVATE: output_width NUMERIC "64"
-- Retrieval info: PRIVATE: rsEmpty NUMERIC "1"
-- Retrieval info: PRIVATE: rsFull NUMERIC "0"
-- Retrieval info: PRIVATE: rsUsedW NUMERIC "0"
-- Retrieval info: PRIVATE: sc_aclr NUMERIC "1"
-- Retrieval info: PRIVATE: sc_sclr NUMERIC "0"
-- Retrieval info: PRIVATE: wsEmpty NUMERIC "0"
-- Retrieval info: PRIVATE: wsFull NUMERIC "1"
-- Retrieval info: PRIVATE: wsUsedW NUMERIC "1"
-- Retrieval info: LIBRARY: altera_mf altera_mf.altera_mf_components.all
-- Retrieval info: CONSTANT: ADD_RAM_OUTPUT_REGISTER STRING "OFF"
-- Retrieval info: CONSTANT: INTENDED_DEVICE_FAMILY STRING "Cyclone V"
-- Retrieval info: CONSTANT: LPM_NUMWORDS NUMERIC "32"
-- Retrieval info: CONSTANT: LPM_SHOWAHEAD STRING "ON"
-- Retrieval info: CONSTANT: LPM_TYPE STRING "scfifo"
-- Retrieval info: CONSTANT: LPM_WIDTH NUMERIC "64"
-- Retrieval info: CONSTANT: LPM_WIDTHU NUMERIC "5"
-- 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: aclr 0 0 0 0 INPUT NODEFVAL "aclr"
-- Retrieval info: USED_PORT: clock 0 0 0 0 INPUT NODEFVAL "clock"
-- Retrieval info: USED_PORT: data 0 0 64 0 INPUT NODEFVAL "data[63..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 64 0 OUTPUT NODEFVAL "q[63..0]"
-- Retrieval info: USED_PORT: rdreq 0 0 0 0 INPUT NODEFVAL "rdreq"
-- Retrieval info: USED_PORT: usedw 0 0 5 0 OUTPUT NODEFVAL "usedw[4..0]"
-- Retrieval info: USED_PORT: wrreq 0 0 0 0 INPUT NODEFVAL "wrreq"
-- Retrieval info: CONNECT: @aclr 0 0 0 0 aclr 0 0 0 0
-- Retrieval info: CONNECT: @clock 0 0 0 0 clock 0 0 0 0
-- Retrieval info: CONNECT: @data 0 0 64 0 data 0 0 64 0
-- Retrieval info: CONNECT: @rdreq 0 0 0 0 rdreq 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 64 0 @q 0 0 64 0
-- Retrieval info: CONNECT: usedw 0 0 5 0 @usedw 0 0 5 0
-- Retrieval info: GEN_FILE: TYPE_NORMAL fifo_64x32.vhd TRUE
-- Retrieval info: GEN_FILE: TYPE_NORMAL fifo_64x32.inc FALSE
-- Retrieval info: GEN_FILE: TYPE_NORMAL fifo_64x32.cmp TRUE
-- Retrieval info: GEN_FILE: TYPE_NORMAL fifo_64x32.bsf FALSE
-- Retrieval info: GEN_FILE: TYPE_NORMAL fifo_64x32_inst.vhd FALSE
-- Retrieval info: LIB_FILE: altera_mf

View file

@ -0,0 +1,5 @@
set_global_assignment -name IP_TOOL_NAME "FIFO"
set_global_assignment -name IP_TOOL_VERSION "14.1"
set_global_assignment -name IP_GENERATED_DEVICE_FAMILY "{Cyclone V}"
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "fifo_delay_queue_1_ff.vhd"]
set_global_assignment -name MISC_FILE [file join $::quartus(qip_path) "fifo_delay_queue_1_ff.cmp"]

View file

@ -4,7 +4,7 @@
-- MODULE: scfifo
-- ============================================================
-- File Name: sfifo_0.vhd
-- File Name: fifo_delay_queue_1_ff.vhd
-- Megafunction Name(s):
-- scfifo
--
@ -14,23 +14,24 @@
-- ************************************************************
-- THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE!
--
-- 18.1.0 Build 625 09/12/2018 SJ Standard Edition
-- 14.1.1 Build 190 01/19/2015 SJ Web Edition
-- ************************************************************
--Copyright (C) 2018 Intel Corporation. All rights reserved.
--Your use of Intel Corporation's design tools, logic functions
--Copyright (C) 1991-2015 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 Intel Program License
--Subscription Agreement, the Intel Quartus Prime License Agreement,
--the Intel FPGA IP License Agreement, or other applicable license
--agreement, including, without limitation, that your use is for
--the sole purpose of programming logic devices manufactured by
--Intel and sold by Intel or its authorized distributors. Please
--refer to the applicable agreement for further details.
--to the terms and conditions of the Altera Program License
--Subscription Agreement, the Altera Quartus II 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;
@ -38,33 +39,34 @@ USE ieee.std_logic_1164.all;
LIBRARY altera_mf;
USE altera_mf.all;
use work.pkg_functions.all;
ENTITY sfifo_0 IS
GENERIC (
WIDTH : natural range 1 to 1024 := 80;
LOG2DEPTH : natural range 1 to 32 := 8
);
ENTITY fifo_delay_queue_1_ff IS
GENERIC (
DATA_WIDTH : natural range 1 to 32;
DATA_DEPTH : natural range 1 to 1023
);
PORT
(
aclr : IN STD_LOGIC ;
clock : IN STD_LOGIC ;
data : IN STD_LOGIC_VECTOR (WIDTH-1 DOWNTO 0);
data : IN STD_LOGIC_VECTOR (DATA_WIDTH-1 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 (WIDTH-1 DOWNTO 0);
usedw : OUT STD_LOGIC_VECTOR (LOG2DEPTH-1 DOWNTO 0)
q : OUT STD_LOGIC_VECTOR (DATA_WIDTH-1 DOWNTO 0);
usedw : OUT STD_LOGIC_VECTOR (log2(DATA_DEPTH)-1 DOWNTO 0)
);
END sfifo_0;
END fifo_delay_queue_1_ff;
ARCHITECTURE SYN OF sfifo_0 IS
ARCHITECTURE SYN OF fifo_delay_queue_1_ff IS
SIGNAL sub_wire0 : STD_LOGIC ;
SIGNAL sub_wire1 : STD_LOGIC ;
SIGNAL sub_wire2 : STD_LOGIC_VECTOR (WIDTH-1 DOWNTO 0);
SIGNAL sub_wire3 : STD_LOGIC_VECTOR (LOG2DEPTH-1 DOWNTO 0);
SIGNAL sub_wire2 : STD_LOGIC_VECTOR (DATA_WIDTH-1 DOWNTO 0);
SIGNAL sub_wire3 : STD_LOGIC_VECTOR (log2(DATA_DEPTH)-1 DOWNTO 0);
@ -72,6 +74,7 @@ ARCHITECTURE SYN OF sfifo_0 IS
GENERIC (
add_ram_output_register : STRING;
intended_device_family : STRING;
lpm_hint : STRING;
lpm_numwords : NATURAL;
lpm_showahead : STRING;
lpm_type : STRING;
@ -82,42 +85,43 @@ ARCHITECTURE SYN OF sfifo_0 IS
use_eab : STRING
);
PORT (
aclr : IN STD_LOGIC ;
clock : IN STD_LOGIC ;
data : IN STD_LOGIC_VECTOR (WIDTH-1 DOWNTO 0);
data : IN STD_LOGIC_VECTOR (DATA_WIDTH-1 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 (WIDTH-1 DOWNTO 0);
usedw : OUT STD_LOGIC_VECTOR (LOG2DEPTH-1 DOWNTO 0)
q : OUT STD_LOGIC_VECTOR (DATA_WIDTH-1 DOWNTO 0);
usedw : OUT STD_LOGIC_VECTOR (log2(DATA_DEPTH)-1 DOWNTO 0)
);
END COMPONENT;
BEGIN
empty <= sub_wire0;
full <= sub_wire1;
q <= sub_wire2(WIDTH-1 DOWNTO 0);
usedw <= sub_wire3(LOG2DEPTH-1 DOWNTO 0);
empty <= sub_wire0;
full <= sub_wire1;
q <= sub_wire2(DATA_WIDTH-1 DOWNTO 0);
usedw <= sub_wire3(log2(DATA_DEPTH)-1 DOWNTO 0);
scfifo_component : scfifo
GENERIC MAP (
add_ram_output_register => "OFF",
intended_device_family => "Cyclone V",
lpm_numwords => 2**LOG2DEPTH,
lpm_showahead => "OFF",
lpm_hint => "RAM_BLOCK_TYPE=MLAB",
lpm_numwords => DATA_DEPTH,
lpm_showahead => "ON",
lpm_type => "scfifo",
lpm_width => WIDTH,
lpm_widthu => LOG2DEPTH,
lpm_width => DATA_WIDTH,
lpm_widthu => log2(DATA_DEPTH),
overflow_checking => "ON",
underflow_checking => "ON",
use_eab => "ON"
)
PORT MAP (
aclr => aclr,
clock => clock,
data => data,
rdreq => rdreq,
sclr => sclr,
wrreq => wrreq,
empty => sub_wire0,
full => sub_wire1,
@ -143,59 +147,60 @@ END SYN;
-- 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: LegacyRREQ NUMERIC "0"
-- Retrieval info: PRIVATE: MAX_DEPTH_BY_9 NUMERIC "0"
-- Retrieval info: PRIVATE: OVERFLOW_CHECKING NUMERIC "0"
-- Retrieval info: PRIVATE: Optimize NUMERIC "0"
-- Retrieval info: PRIVATE: RAM_BLOCK_TYPE NUMERIC "0"
-- 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 "80"
-- 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 "80"
-- 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: sc_aclr NUMERIC "1"
-- Retrieval info: PRIVATE: sc_sclr NUMERIC "0"
-- 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 "OFF"
-- 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 "256"
-- Retrieval info: CONSTANT: LPM_SHOWAHEAD STRING "OFF"
-- Retrieval info: CONSTANT: LPM_SHOWAHEAD STRING "ON"
-- Retrieval info: CONSTANT: LPM_TYPE STRING "scfifo"
-- Retrieval info: CONSTANT: LPM_WIDTH NUMERIC "80"
-- Retrieval info: CONSTANT: LPM_WIDTH NUMERIC "8"
-- Retrieval info: CONSTANT: LPM_WIDTHU NUMERIC "8"
-- 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: aclr 0 0 0 0 INPUT NODEFVAL "aclr"
-- Retrieval info: USED_PORT: clock 0 0 0 0 INPUT NODEFVAL "clock"
-- Retrieval info: USED_PORT: data 0 0 80 0 INPUT NODEFVAL "data[79..0]"
-- 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 80 0 OUTPUT NODEFVAL "q[79..0]"
-- 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 8 0 OUTPUT NODEFVAL "usedw[7..0]"
-- Retrieval info: USED_PORT: wrreq 0 0 0 0 INPUT NODEFVAL "wrreq"
-- Retrieval info: CONNECT: @aclr 0 0 0 0 aclr 0 0 0 0
-- Retrieval info: CONNECT: @clock 0 0 0 0 clock 0 0 0 0
-- Retrieval info: CONNECT: @data 0 0 80 0 data 0 0 80 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 80 0 @q 0 0 80 0
-- Retrieval info: CONNECT: q 0 0 8 0 @q 0 0 8 0
-- Retrieval info: CONNECT: usedw 0 0 8 0 @usedw 0 0 8 0
-- Retrieval info: GEN_FILE: TYPE_NORMAL sfifo_0.vhd TRUE
-- Retrieval info: GEN_FILE: TYPE_NORMAL sfifo_0.inc FALSE
-- Retrieval info: GEN_FILE: TYPE_NORMAL sfifo_0.cmp FALSE
-- Retrieval info: GEN_FILE: TYPE_NORMAL sfifo_0.bsf FALSE
-- Retrieval info: GEN_FILE: TYPE_NORMAL sfifo_256x80_inst.vhd FALSE
-- Retrieval info: GEN_FILE: TYPE_NORMAL fifo_delay_queue_1_ff.vhd TRUE
-- Retrieval info: GEN_FILE: TYPE_NORMAL fifo_delay_queue_1_ff.inc FALSE
-- Retrieval info: GEN_FILE: TYPE_NORMAL fifo_delay_queue_1_ff.cmp TRUE
-- Retrieval info: GEN_FILE: TYPE_NORMAL fifo_delay_queue_1_ff.bsf FALSE
-- Retrieval info: GEN_FILE: TYPE_NORMAL fifo_delay_queue_ff_inst.vhd FALSE
-- Retrieval info: LIB_FILE: altera_mf

View file

@ -0,0 +1,450 @@
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use work.pkg_functions.all;
--
-- generic_delay_queue_2:
-- This block can delay either individual signals or packets or data for a variable amount of time
--
entity generic_delay_queue_2 is
generic (
PKT_MODE : std_logic := '1';
DATA_WIDTH : natural range 1 to 32 := 8;
DELAY_WIDTH : natural range 1 to 32 := 8;
LENGTH_WIDTH : natural range 1 to 32 := 8;
DATA_DEPTH : natural range 1 to 1023 := 255;
DELAY_DEPTH : natural range 1 to 1023 := 255;
LENGTH_DEPTH : natural range 1 to 1023 := 255
);
port (
--
clk : in std_logic;
reset_n : in std_logic;
--
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_readdata : out std_logic_vector(31 downto 0) := (others => '0');
-- Incoming signals and packets to be delayed
ingress_valid : in std_logic;
ingress_start : in std_logic;
ingress_end : in std_logic;
ingress_data : in std_logic_vector( DATA_WIDTH-1 downto 0);
ingress_ready : out std_logic;
pkt_delay : in std_logic_vector(DELAY_WIDTH-1 downto 0);
-- Outgoing delayed signals
egress_data : out std_logic_vector( DATA_WIDTH-1 downto 0);
egress_valid : out std_logic;
egress_start : out std_logic;
egress_end : out std_logic;
egress_ready : in std_logic
);
end entity generic_delay_queue_2;
architecture rtl of generic_delay_queue_2 is
constant TOTAL_WIDTH : natural range 1 to 32 := DATA_WIDTH + DELAY_WIDTH;
-- Signals for CPU controlled delayed signals
signal ingress_valid_cpu : std_logic;
signal ingress_data_cpu : std_logic_vector( DATA_WIDTH-1 downto 0);
signal pkt_delay_cpu : std_logic_vector(DELAY_WIDTH-1 downto 0);
-- Indicates which mode of operation we are in
type mode_t is ( m_disabled, m_bypass, m_cpu, m_normal, m_streaming );
signal mode : mode_t;
-- Signals for the state machine that controls writing values in the FIFOs
type ingress_fsm_t is ( s_idle, s_data, s_end );
signal ingress_fsm : ingress_fsm_t;
signal ingress_count : unsigned(LENGTH_WIDTH-1 downto 0);
-- Signals for the state machine that controls reading values from the FIFOs
type egress_fsm_t is ( s_idle, s_waiting, s_streaming );
signal egress_fsm : egress_fsm_t;
signal egress_fsm_d : egress_fsm_t;
signal egress_count : unsigned(LENGTH_WIDTH-1 downto 0);
-- FIFO signals
signal fifo_rst : std_logic;
-- Data FIFO signals
signal data_wr_req : std_logic;
signal data_wr_full : std_logic;
signal data_wr_data : std_logic_vector(DATA_WIDTH-1 downto 0);
signal data_wr_used : std_logic_vector(log2(DATA_DEPTH)-1 downto 0);
--
signal data_rd_req : std_logic;
signal data_rd_empty : std_logic;
signal data_rd_data : std_logic_vector( DATA_WIDTH-1 downto 0);
-- Delay FIFO signals
signal delay_wr_req : std_logic;
signal delay_wr_full : std_logic;
signal delay_wr_data : std_logic_vector(DELAY_WIDTH-1 downto 0);
signal delay_wr_used : std_logic_vector(log2(DELAY_DEPTH)-1 downto 0);
--
signal delay_rd_req : std_logic;
signal delay_rd_empty : std_logic;
signal delay_rd_data : std_logic_vector(DELAY_WIDTH-1 downto 0);
-- Delay FIFO signals
signal length_wr_req : std_logic;
signal length_wr_full : std_logic;
signal length_wr_data : std_logic_vector(LENGTH_WIDTH-1 downto 0);
signal length_wr_used : std_logic_vector(log2(LENGTH_DEPTH)-1 downto 0);
--
signal length_rd_req : std_logic;
signal length_rd_empty : std_logic;
signal length_rd_data : std_logic_vector(LENGTH_WIDTH-1 downto 0);
-- Tracking time
signal time_counter : unsigned(DELAY_WIDTH-1 downto 0);
signal config_data_width : std_logic_vector(5 downto 0);
signal config_delay_width : std_logic_vector(5 downto 0);
signal config_log2_data_depth : std_logic_vector(5 downto 0);
signal config_log2_delay_depth : std_logic_vector(5 downto 0);
signal config_log2_length_depth : std_logic_vector(5 downto 0);
signal data_cpu : std_logic_vector(31 downto 0);
signal mode_i : std_logic_vector(1 downto 0);
begin
generic_delay_queue_2_csr_regs_i : entity work.generic_delay_queue_2_csr_regs
generic map (
ADDR_DECODE_WIDTH => 4
)
port map (
-- Clock and reset
clk => clk,
rst_n => reset_n,
-- auto-generated
-- Internal signal ports
ctrl_mode => mode_i,
data_pulse => ingress_valid_cpu,
data => data_cpu,
data_in => (others => '0'),
config_log2_length_depth => config_log2_length_depth,
config_log2_delay_depth => config_log2_delay_depth,
config_log2_data_depth => config_log2_data_depth,
config_delay_width => config_delay_width,
config_data_width => config_data_width,
-- end auto-generated
-- Slave bus port
avs_address => avs_address,
avs_write => avs_write,
avs_writedata => avs_writedata,
avs_read => avs_read,
avs_readdata => avs_readdata
);
config_data_width <= std_logic_vector(to_unsigned( DATA_WIDTH , 6));
config_delay_width <= std_logic_vector(to_unsigned( DELAY_WIDTH , 6));
config_log2_data_depth <= std_logic_vector(to_unsigned(log2( DATA_DEPTH), 6));
config_log2_delay_depth <= std_logic_vector(to_unsigned(log2( DELAY_DEPTH), 6));
config_log2_length_depth <= std_logic_vector(to_unsigned(log2(LENGTH_DEPTH), 6));
ingress_data_cpu <= data_cpu( DATA_WIDTH - 1 downto 0);
pkt_delay_cpu <= data_cpu( TOTAL_WIDTH - 1 downto DATA_WIDTH);
mode <= m_disabled when mode_i = "00" else
m_bypass when mode_i = "01" else
m_cpu when mode_i = "10" else
m_streaming when PKT_MODE = '1' else
m_normal;
--
-- This process tracks time with a wrapping counter
--
TIME_PROC : process (clk, reset_n) is
begin
if reset_n = '0' then
time_counter <= (others => '0');
elsif clk'event and clk = '1' then
time_counter <= time_counter + 1;
end if;
end process TIME_PROC;
--
-- This process manages storing the incoming data and delays into FIFOs
--
INGRESS_PROC : process (clk, reset_n) is
variable timestamp : unsigned(DELAY_WIDTH-1 downto 0);
begin
if reset_n = '0' then
-- Reset values
data_wr_req <= '0';
data_wr_data <= (others => '0');
delay_wr_req <= '0';
delay_wr_data <= (others => '0');
length_wr_req <= '0';
length_wr_data <= (others => '0');
timestamp := (others => '0');
ingress_fsm <= s_idle;
ingress_count <= (others => '0');
ingress_ready <= '0';
elsif clk'event and clk = '1' then
-- Default values
data_wr_req <= '0';
delay_wr_req <= '0';
length_wr_req <= '0';
ingress_ready <= '1';
case mode is
when m_cpu =>
-- CPU driven signals to be delayed
if ingress_valid_cpu = '1' then
--
delay_wr_req <= '1';
timestamp := unsigned(pkt_delay_cpu) + time_counter;
delay_wr_data <= std_logic_vector(timestamp);
--
data_wr_req <= '1';
data_wr_data <= ingress_data_cpu;
end if;
when m_normal =>
-- Incoming signals to be delayed
if ingress_valid = '1' then
data_wr_req <= '1';
data_wr_data <= ingress_data;
--
delay_wr_req <= '1';
timestamp := unsigned(pkt_delay) + time_counter;
delay_wr_data <= std_logic_vector(timestamp);
end if;
when m_streaming =>
case ingress_fsm is
when s_idle =>
-- Start of packet detected
if ingress_valid = '1' and ingress_start = '1' then
-- Write timestamp into Delay FIFO
timestamp := unsigned(pkt_delay_cpu) + time_counter;
delay_wr_req <= '1';
delay_wr_data <= std_logic_vector(timestamp);
--Write packet data into Data FIFO
data_wr_req <= '1';
data_wr_data <= ingress_data;
-- Check for end of packet
if ingress_end = '1' then
ingress_fsm <= s_end;
ingress_ready <= '0';
-- Write packet size into Length FIFO
length_wr_req <= '1';
length_wr_data <= std_logic_vector(ingress_count);
ingress_count <= (others => '0');
else
ingress_fsm <= s_data;
ingress_count <= ingress_count + 1;
end if;
end if;
when s_data =>
if ingress_valid = '1' then
-- Write data into Data FIFO
data_wr_req <= '1';
data_wr_data <= ingress_data;
-- Check for end of packet
if ingress_end = '1' then
ingress_fsm <= s_end;
--ingress_fsm <= s_wait2;
ingress_ready <= '0';
-- Write packet size into Length FIFO
length_wr_req <= '1';
length_wr_data <= std_logic_vector(ingress_count);
ingress_count <= (others => '0');
else
ingress_count <= ingress_count + 1;
end if;
end if;
when s_end =>
ingress_fsm <= s_idle;
when others => null;
end case;
when others => null;
end case;
end if;
end process INGRESS_PROC;
fifo_rst <= not reset_n;
--
-- This FIFO stores the data to be delayed
--
fifo_delay_queue_data : entity work.fifo_delay_queue_1
generic map
(
DATA_WIDTH => DATA_WIDTH,
DATA_DEPTH => DATA_DEPTH
)
port map
(
clock => clk,
aclr => fifo_rst,
--
wrreq => data_wr_req,
full => data_wr_full,
data => data_wr_data,
usedw => data_wr_used,
--
rdreq => data_rd_req,
empty => data_rd_empty,
q => data_rd_data
);
--
-- This FIFO stores the timestamp at which the data is released
--
fifo_delay_queue_delay : entity work.fifo_delay_queue_1_ff
generic map
(
DATA_WIDTH => DELAY_WIDTH,
DATA_DEPTH => DELAY_DEPTH
)
port map
(
clock => clk,
aclr => fifo_rst,
--
wrreq => delay_wr_req,
full => delay_wr_full,
data => delay_wr_data,
usedw => delay_wr_used,
--
rdreq => delay_rd_req,
empty => delay_rd_empty,
q => delay_rd_data
);
--
-- This FIFO stores the size of the packet (when in packet mode)
--
fifo_delay_queue_length : entity work.fifo_delay_queue_1_ff
generic map
(
DATA_WIDTH => LENGTH_WIDTH,
DATA_DEPTH => LENGTH_DEPTH
)
port map
(
clock => clk,
aclr => fifo_rst,
--
wrreq => length_wr_req,
full => length_wr_full,
data => length_wr_data,
usedw => length_wr_used,
--
rdreq => length_rd_req,
empty => length_rd_empty,
q => length_rd_data
);
--
-- The Egress Process managed the timing of the release of signals and data
-- from the Data FIFO by monitoring timestamps and packet sizes in the Delay FIFO
--
EGRESS_PROC : process (clk, reset_n) is
variable timestamp : unsigned(DELAY_WIDTH-1 downto 0);
begin
if reset_n = '0' then
-- Reset values
data_rd_req <= '0';
egress_fsm <= s_idle;
egress_fsm_d <= s_idle;
egress_data <= (others => '0');
egress_valid <= '0';
egress_start <= '0';
egress_end <= '0';
egress_count <= (others => '0');
data_rd_req <= '0';
delay_rd_req <= '0';
length_rd_req <= '0';
timestamp := (others => '0');
elsif clk'event and clk = '1' then
-- Default values
egress_fsm_d <= egress_fsm;
data_rd_req <= '0';
delay_rd_req <= '0';
length_rd_req <= '0';
egress_valid <= '0';
egress_start <= '0';
egress_end <= '0';
case mode is
when m_bypass =>
-- Immediately output signals in 'bypass' mode
if ingress_valid = '1' then
egress_data <= ingress_data;
egress_valid <= '1';
egress_start <= ingress_start;
egress_end <= ingress_end;
end if;
when m_cpu | m_normal =>
-- Pop entries out of the FIFOs when the timestamp matches current time
if (unsigned(delay_rd_data) = time_counter) and (delay_rd_empty = '0') then
data_rd_req <= '1';
delay_rd_req <= '1';
egress_data <= data_rd_data(DATA_WIDTH - 1 downto 0);
egress_valid <= '1';
end if;
when m_streaming =>
--
case egress_fsm is
when s_idle =>
--
egress_count <= (others => '0');
-- When Delay FIFO entry detected grab the 'timestamp'
if delay_rd_empty = '0' then
delay_rd_req <= '1';
egress_fsm <= s_waiting;
timestamp := unsigned(delay_rd_data);
end if;
when s_waiting =>
-- When the delay expires stream out the associated packet
if (timestamp = time_counter) then
egress_fsm <= s_streaming;
data_rd_req <= '1';
--
if length_rd_empty = '0' and unsigned(length_rd_data) = 0 then
length_rd_req <= '1';
end if;
end if;
when s_streaming =>
-- Send out data
egress_valid <= data_rd_req;
egress_data <= data_rd_data;
if egress_fsm_d = s_waiting then
egress_start <= '1';
end if;
-- Check for last data
if egress_count = unsigned(length_rd_data) and delay_rd_empty = '0' then
delay_rd_req <= '1';
egress_fsm <= s_waiting;
timestamp := unsigned(delay_rd_data);
egress_end <= '1';
elsif egress_count = unsigned(length_rd_data) and length_rd_empty = '0' then
egress_fsm <= s_idle;
egress_end <= '1';
elsif (unsigned(data_wr_used)>1) or
(unsigned(data_wr_used)>0 and egress_count = unsigned(length_rd_data)-1) then
egress_count <= egress_count + 1;
data_rd_req <= '1';
if egress_count = unsigned(length_rd_data)-1 then
length_rd_req <= '1';
end if;
end if;
when others => null;
end case;
when others => null;
end case;
end if;
end process EGRESS_PROC;
end rtl;

View file

@ -0,0 +1,245 @@
# TCL File Generated by Component Editor 14.1
# Fri Sep 09 09:26:46 BST 2016
# DO NOT MODIFY
#
# generic_delay_queue_2 "generic_delay_queue_2" v1.0
# 2016.09.09.09:26:46
#
#
#
# request TCL package from ACDS 14.1
#
package require -exact qsys 14.1
#
# module generic_delay_queue_2
#
set_module_property DESCRIPTION ""
set_module_property NAME generic_delay_queue_2
set_module_property VERSION 1.0
set_module_property INTERNAL false
set_module_property OPAQUE_ADDRESS_MAP true
set_module_property AUTHOR ""
set_module_property DISPLAY_NAME generic_delay_queue_2
set_module_property INSTANTIATE_IN_SYSTEM_MODULE true
set_module_property EDITABLE true
set_module_property REPORT_TO_TALKBACK false
set_module_property ALLOW_GREYBOX_GENERATION false
set_module_property REPORT_HIERARCHY false
#
# file sets
#
add_fileset QUARTUS_SYNTH QUARTUS_SYNTH "" ""
set_fileset_property QUARTUS_SYNTH TOP_LEVEL generic_delay_queue_2
set_fileset_property QUARTUS_SYNTH ENABLE_RELATIVE_INCLUDE_PATHS false
set_fileset_property QUARTUS_SYNTH ENABLE_FILE_OVERWRITE_MODE false
add_fileset_file generic_delay_queue_2_pkg_auto.vhd VHDL PATH generic_delay_queue_2_pkg_auto.vhd
add_fileset_file generic_delay_queue_2_csr_regs_auto.vhd VHDL PATH generic_delay_queue_2_csr_regs_auto.vhd
add_fileset_file generic_delay_queue_2.vhd VHDL PATH generic_delay_queue_2.vhd TOP_LEVEL_FILE
add_fileset_file pkg_functions.vhd VHDL PATH ../../../common/0/src/pkg_functions.vhd
add_fileset_file fifo_delay_queue_1.vhd VHDL PATH altera/fifo_delay_queue_1.vhd
add_fileset_file fifo_delay_queue_1_ff.vhd VHDL PATH altera/fifo_delay_queue_1_ff.vhd
add_fileset SIM_VHDL SIM_VHDL "" ""
set_fileset_property SIM_VHDL TOP_LEVEL generic_delay_queue_2
set_fileset_property SIM_VHDL ENABLE_RELATIVE_INCLUDE_PATHS false
set_fileset_property SIM_VHDL ENABLE_FILE_OVERWRITE_MODE false
add_fileset_file generic_delay_queue_2_pkg_auto.vhd VHDL PATH generic_delay_queue_2_pkg_auto.vhd
add_fileset_file generic_delay_queue_2_csr_regs_auto.vhd VHDL PATH generic_delay_queue_2_csr_regs_auto.vhd
add_fileset_file generic_delay_queue_2.vhd VHDL PATH generic_delay_queue_2.vhd TOP_LEVEL_FILE
add_fileset_file pkg_functions.vhd VHDL PATH ../../../common/0/src/pkg_functions.vhd
add_fileset_file fifo_delay_queue_1.vhd VHDL PATH altera/fifo_delay_queue_1.vhd
add_fileset_file fifo_delay_queue_1_ff.vhd VHDL PATH altera/fifo_delay_queue_1_ff.vhd
#
# parameters
#
add_parameter PKT_MODE STD_LOGIC 1
set_parameter_property PKT_MODE DEFAULT_VALUE 1
set_parameter_property PKT_MODE DISPLAY_NAME PKT_MODE
set_parameter_property PKT_MODE TYPE STD_LOGIC
set_parameter_property PKT_MODE UNITS None
set_parameter_property PKT_MODE HDL_PARAMETER true
add_parameter DATA_WIDTH INTEGER 8
set_parameter_property DATA_WIDTH DEFAULT_VALUE 8
set_parameter_property DATA_WIDTH DISPLAY_NAME DATA_WIDTH
set_parameter_property DATA_WIDTH TYPE INTEGER
set_parameter_property DATA_WIDTH UNITS None
set_parameter_property DATA_WIDTH ALLOWED_RANGES -2147483648:2147483647
set_parameter_property DATA_WIDTH HDL_PARAMETER true
add_parameter DELAY_WIDTH INTEGER 8
set_parameter_property DELAY_WIDTH DEFAULT_VALUE 8
set_parameter_property DELAY_WIDTH DISPLAY_NAME DELAY_WIDTH
set_parameter_property DELAY_WIDTH TYPE INTEGER
set_parameter_property DELAY_WIDTH UNITS None
set_parameter_property DELAY_WIDTH ALLOWED_RANGES -2147483648:2147483647
set_parameter_property DELAY_WIDTH HDL_PARAMETER true
add_parameter LENGTH_WIDTH INTEGER 8
set_parameter_property LENGTH_WIDTH DEFAULT_VALUE 8
set_parameter_property LENGTH_WIDTH DISPLAY_NAME LENGTH_WIDTH
set_parameter_property LENGTH_WIDTH TYPE INTEGER
set_parameter_property LENGTH_WIDTH UNITS None
set_parameter_property LENGTH_WIDTH ALLOWED_RANGES -2147483648:2147483647
set_parameter_property LENGTH_WIDTH HDL_PARAMETER true
add_parameter DATA_DEPTH INTEGER 255
set_parameter_property DATA_DEPTH DEFAULT_VALUE 255
set_parameter_property DATA_DEPTH DISPLAY_NAME DATA_DEPTH
set_parameter_property DATA_DEPTH TYPE INTEGER
set_parameter_property DATA_DEPTH UNITS None
set_parameter_property DATA_DEPTH ALLOWED_RANGES -2147483648:2147483647
set_parameter_property DATA_DEPTH HDL_PARAMETER true
add_parameter DELAY_DEPTH INTEGER 255
set_parameter_property DELAY_DEPTH DEFAULT_VALUE 255
set_parameter_property DELAY_DEPTH DISPLAY_NAME DELAY_DEPTH
set_parameter_property DELAY_DEPTH TYPE INTEGER
set_parameter_property DELAY_DEPTH UNITS None
set_parameter_property DELAY_DEPTH ALLOWED_RANGES -2147483648:2147483647
set_parameter_property DELAY_DEPTH HDL_PARAMETER true
add_parameter LENGTH_DEPTH INTEGER 255
set_parameter_property LENGTH_DEPTH DEFAULT_VALUE 255
set_parameter_property LENGTH_DEPTH DISPLAY_NAME LENGTH_DEPTH
set_parameter_property LENGTH_DEPTH TYPE INTEGER
set_parameter_property LENGTH_DEPTH UNITS None
set_parameter_property LENGTH_DEPTH ALLOWED_RANGES -2147483648:2147483647
set_parameter_property LENGTH_DEPTH HDL_PARAMETER true
#
# display items
#
#
# connection point clock
#
add_interface clock clock end
set_interface_property clock clockRate 0
set_interface_property clock ENABLED true
set_interface_property clock EXPORT_OF ""
set_interface_property clock PORT_NAME_MAP ""
set_interface_property clock CMSIS_SVD_VARIABLES ""
set_interface_property clock SVD_ADDRESS_GROUP ""
add_interface_port clock clk clk Input 1
#
# connection point reset
#
add_interface reset reset end
set_interface_property reset associatedClock clock
set_interface_property reset synchronousEdges DEASSERT
set_interface_property reset ENABLED true
set_interface_property reset EXPORT_OF ""
set_interface_property reset PORT_NAME_MAP ""
set_interface_property reset CMSIS_SVD_VARIABLES ""
set_interface_property reset SVD_ADDRESS_GROUP ""
add_interface_port reset reset_n reset_n Input 1
#
# connection point avs_csr
#
add_interface avs_csr avalon end
set_interface_property avs_csr addressUnits WORDS
set_interface_property avs_csr associatedClock clock
set_interface_property avs_csr associatedReset reset
set_interface_property avs_csr bitsPerSymbol 8
set_interface_property avs_csr burstOnBurstBoundariesOnly false
set_interface_property avs_csr burstcountUnits WORDS
set_interface_property avs_csr explicitAddressSpan 0
set_interface_property avs_csr holdTime 0
set_interface_property avs_csr linewrapBursts false
set_interface_property avs_csr maximumPendingReadTransactions 0
set_interface_property avs_csr maximumPendingWriteTransactions 0
set_interface_property avs_csr readLatency 0
set_interface_property avs_csr readWaitTime 1
set_interface_property avs_csr setupTime 0
set_interface_property avs_csr timingUnits Cycles
set_interface_property avs_csr writeWaitTime 0
set_interface_property avs_csr ENABLED true
set_interface_property avs_csr EXPORT_OF ""
set_interface_property avs_csr PORT_NAME_MAP ""
set_interface_property avs_csr CMSIS_SVD_VARIABLES ""
set_interface_property avs_csr SVD_ADDRESS_GROUP ""
add_interface_port avs_csr avs_address address Input 4
add_interface_port avs_csr avs_write write Input 1
add_interface_port avs_csr avs_writedata writedata Input 32
add_interface_port avs_csr avs_read read Input 1
add_interface_port avs_csr avs_readdata readdata Output 32
set_interface_assignment avs_csr embeddedsw.configuration.isFlash 0
set_interface_assignment avs_csr embeddedsw.configuration.isMemoryDevice 0
set_interface_assignment avs_csr embeddedsw.configuration.isNonVolatileStorage 0
set_interface_assignment avs_csr embeddedsw.configuration.isPrintableDevice 0
#
# connection point pkt_delay
#
add_interface pkt_delay conduit end
set_interface_property pkt_delay associatedClock clock
set_interface_property pkt_delay associatedReset reset
set_interface_property pkt_delay ENABLED true
set_interface_property pkt_delay EXPORT_OF ""
set_interface_property pkt_delay PORT_NAME_MAP ""
set_interface_property pkt_delay CMSIS_SVD_VARIABLES ""
set_interface_property pkt_delay SVD_ADDRESS_GROUP ""
add_interface_port pkt_delay pkt_delay delay Input delay_width
#
# connection point avalon_streaming_sink
#
add_interface avalon_streaming_sink avalon_streaming end
set_interface_property avalon_streaming_sink associatedClock clock
set_interface_property avalon_streaming_sink associatedReset reset
set_interface_property avalon_streaming_sink dataBitsPerSymbol 8
set_interface_property avalon_streaming_sink errorDescriptor ""
set_interface_property avalon_streaming_sink firstSymbolInHighOrderBits true
set_interface_property avalon_streaming_sink maxChannel 0
set_interface_property avalon_streaming_sink readyLatency 0
set_interface_property avalon_streaming_sink ENABLED true
set_interface_property avalon_streaming_sink EXPORT_OF ""
set_interface_property avalon_streaming_sink PORT_NAME_MAP ""
set_interface_property avalon_streaming_sink CMSIS_SVD_VARIABLES ""
set_interface_property avalon_streaming_sink SVD_ADDRESS_GROUP ""
add_interface_port avalon_streaming_sink ingress_valid valid Input 1
add_interface_port avalon_streaming_sink ingress_start startofpacket Input 1
add_interface_port avalon_streaming_sink ingress_end endofpacket Input 1
add_interface_port avalon_streaming_sink ingress_data data Input data_width
add_interface_port avalon_streaming_sink ingress_ready ready Output 1
#
# connection point avalon_streaming_source
#
add_interface avalon_streaming_source avalon_streaming start
set_interface_property avalon_streaming_source associatedClock clock
set_interface_property avalon_streaming_source associatedReset reset
set_interface_property avalon_streaming_source dataBitsPerSymbol 8
set_interface_property avalon_streaming_source errorDescriptor ""
set_interface_property avalon_streaming_source firstSymbolInHighOrderBits true
set_interface_property avalon_streaming_source maxChannel 0
set_interface_property avalon_streaming_source readyLatency 0
set_interface_property avalon_streaming_source ENABLED true
set_interface_property avalon_streaming_source EXPORT_OF ""
set_interface_property avalon_streaming_source PORT_NAME_MAP ""
set_interface_property avalon_streaming_source CMSIS_SVD_VARIABLES ""
set_interface_property avalon_streaming_source SVD_ADDRESS_GROUP ""
add_interface_port avalon_streaming_source egress_data data Output data_width
add_interface_port avalon_streaming_source egress_valid valid Output 1
add_interface_port avalon_streaming_source egress_start startofpacket Output 1
add_interface_port avalon_streaming_source egress_end endofpacket Output 1

View file

@ -0,0 +1,242 @@
-------------------------------------------------------------------------------
-- Title : Command Interpreter
-- Project : SAMBA 1200 HIB
-------------------------------------------------------------------------------
-- File : command_interpreter.vhd
-- Author : Robbie Temple
-- Company : Global Inkjet Systems
-- Created : 2009-11-01
-- Last update: 2021-06-14
-- Platform :
-- Standard : VHDL'93
-------------------------------------------------------------------------------
-- Description:
--
-------------------------------------------------------------------------------
-- Copyright (c) 2016 Global Inkjet Systems
-------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library OSVVM;
use OSVVM.RandomBasePkg.all;
use OSVVM.RandomPkg.all;
entity generic_delay_queue_2_tb is
generic (
PKT_MODE : std_logic := '1';
DATA_WIDTH : natural range 1 to 32 := 8;
DELAY_WIDTH : natural range 1 to 32 := 8;
DATA_DEPTH : natural range 1 to 1023 := 255;
DELAY_DEPTH : natural range 1 to 1023 := 255
);
end generic_delay_queue_2_tb;
architecture behav of generic_delay_queue_2_tb is
signal clk : std_logic := '1';
signal reset_n : std_logic := '0';
signal avs_address : std_logic_vector( 3 downto 0);
signal avs_write : std_logic;
signal avs_writedata : std_logic_vector(31 downto 0);
signal avs_read : std_logic;
signal avs_readdata : std_logic_vector(31 downto 0);
signal ingress_valid : std_logic;
signal ingress_start : std_logic;
signal ingress_end : std_logic;
signal ingress_data : std_logic_vector( DATA_WIDTH-1 downto 0);
signal pkt_delay : std_logic_vector(DELAY_WIDTH-1 downto 0);
signal egress_data : std_logic_vector( DATA_WIDTH-1 downto 0);
signal egress_valid : std_logic;
signal egress_start : std_logic;
signal egress_end : std_logic;
signal egress_ready : std_logic;
shared variable RV : RandomPType;
begin
reset_n <= '1' after 50 ns;
PROC_CLK:process
begin
clk <= not clk;
wait for 8.333 ns;
clk <= not clk;
wait for 8.334 ns;
clk <= not clk;
wait for 8.333 ns;
end process PROC_CLK;
generic_delay_queue_inst : entity work.generic_delay_queue_2
generic map (
PKT_MODE => PKT_MODE ,
DATA_WIDTH => DATA_WIDTH ,
DELAY_WIDTH => DELAY_WIDTH,
DATA_DEPTH => DATA_DEPTH ,
DELAY_DEPTH => DELAY_DEPTH
)
port map (
clk => clk ,
reset_n => reset_n ,
--
avs_address => avs_address ,
avs_write => avs_write ,
avs_writedata => avs_writedata ,
avs_read => avs_read ,
avs_readdata => avs_readdata ,
--
ingress_valid => ingress_valid ,
ingress_start => ingress_start ,
ingress_end => ingress_end ,
ingress_data => ingress_data ,
pkt_delay => pkt_delay ,
--
egress_data => egress_data ,
egress_valid => egress_valid ,
egress_start => egress_start ,
egress_end => egress_end ,
egress_ready => egress_ready
);
STIM_PROC:process
procedure init is
begin
--
avs_address <= (others => '0');
avs_write <= '0';
avs_writedata <= (others => '0');
avs_read <= '0';
--
ingress_valid <= '0';
ingress_start <= '0';
ingress_end <= '0';
ingress_data <= (others => '0');
--
egress_ready <= '1';
--
pkt_delay <= (others => '0');
end procedure init;
procedure word_write( addr : integer;
data : std_logic_vector(31 downto 0) ) is
begin
wait until rising_edge(clk);
avs_address <= std_logic_vector(to_unsigned(addr,4));
avs_write <= '1';
avs_writedata <= data;
wait until rising_edge(clk);
avs_write <= '0';
end procedure word_write;
procedure word_delay( delay : integer;
data : std_logic_vector( 7 downto 0) ) is
begin
wait until rising_edge(clk);
ingress_valid <= '1';
ingress_data <= data;
pkt_delay <= std_logic_vector(to_unsigned(delay,8));
wait until rising_edge(clk);
ingress_valid <= '0';
end procedure word_delay;
procedure packet_delay( delay : integer;
length : integer;
max_gap : integer ) is
variable my_gap : integer;
begin
--wait until rising_edge(clk);
--ingress_valid <= '1';
--ingress_data <= std_logic_vector(to_unsigned(length,DATA_WIDTH));
pkt_delay <= std_logic_vector(to_unsigned(delay,8));
for i in 0 to length loop
my_gap := RV.RandInt(0,max_gap);
for j in 1 to my_gap loop
wait until rising_edge(clk);
ingress_valid <= '0';
end loop;
wait until rising_edge(clk);
ingress_start <= '0';
ingress_end <= '0';
if i = 0 then
ingress_start <= '1';
end if;
if i = length then
ingress_end <= '1';
end if;
ingress_valid <= '1';
ingress_data <= RV.RandSlv(DATA_WIDTH);
end loop;
wait until rising_edge(clk);
ingress_valid <= '0';
ingress_start <= '0';
ingress_end <= '0';
end procedure packet_delay;
begin
init;
wait until rising_edge(reset_n);
wait for 100 ns;
word_write(3,x"00000000"); -- mode = disabled
wait for 1 us;
word_write(4,x"00000a01"); -- data = 1, delay = 1
wait for 1 us;
word_write(3,x"00000001"); -- mode = bypass
wait for 1 us;
word_write(4,x"00000a01"); -- data = 1, delay = 1
wait for 1 us;
wait until rising_edge(clk);
ingress_valid <= '1';
ingress_data <= x"01"; -- data = 1
pkt_delay <= x"05"; -- delay = 5
wait until rising_edge(clk);
ingress_valid <= '0'; -- data = 1, delay = 1
wait for 1 us;
word_write(3,x"00000002"); -- mode = cpu
wait for 1 us;
word_write(4,x"00000a44"); -- data = 1, delay = 1
wait for 1 us;
word_write(4,x"00000a22"); -- data = 1, delay = 5
wait for 1 us;
word_write(3,x"00000003"); -- mode = normal
wait for 1 us;
if not PKT_MODE then
word_delay(80,x"31"); -- data = 1, delay = 40
wait for 200 ns;
word_delay(80,x"51"); -- data = 1, delay = 40
wait for 200 ns;
word_delay(80,x"71"); -- data = 1, delay = 40
wait for 200 ns;
word_delay(80,x"91"); -- data = 1, delay = 40
wait for 200 ns;
word_delay(80,x"b1"); -- data = 1, delay = 40
wait for 200 ns;
word_delay(80,x"d1"); -- data = 1, delay = 40
wait for 200 ns;
word_delay(80,x"f1"); -- data = 1, delay = 40
wait for 200 ns;
word_delay(80,x"21"); -- data = 1, delay = 40
wait for 1 us;
else
word_write(4,x"00000844"); -- data = 1, delay = 1
packet_delay(80,0,0);
--wait until rising_edge(clk);
--wait until rising_edge(clk);
packet_delay(99,12,2);
word_write(4,x"00002044"); -- data = 1, delay = 1
wait for 1 us;
packet_delay(80,0,0);
--wait until rising_edge(clk);
--wait until rising_edge(clk);
packet_delay(80,12,2);
end if;
wait;
end process STIM_PROC;
end architecture behav;

View file

@ -0,0 +1,16 @@
set_global_assignment -name IP_TOOL_NAME "generic_sequencer_16"
set_global_assignment -name IP_TOOL_VERSION "18.0"
set_global_assignment -name IP_GENERATED_DEVICE_FAMILY "{Cyclone V}"
set COMMON_PATH ../../../common/0/src
set SEQUENCER_PATH ../../../generic_sequencer/17/src
# common
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "$COMMON_PATH/common_pkg.vhd"]
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "$COMMON_PATH/alt_rw_dp_ram.vhd"]
# Generic Sequencer
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "$SEQUENCER_PATH/generic_sequencer_17_cmd_pkg.vhd"]
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "$SEQUENCER_PATH/generic_sequencer_17_pkg_auto.vhd"]
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "$SEQUENCER_PATH/generic_sequencer_17_csr_regs_auto.vhd"]
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "$SEQUENCER_PATH/generic_sequencer_17.vhd"]

View file

@ -0,0 +1,71 @@
# TCL File Generated by Component Editor 16.0
# Wed Oct 25 15:26:07 BST 2017
# DO NOT MODIFY
#
# generic_sequencer_17 "generic_sequencer_17" v1.0
# GMG 2017.10.25.15:26:07
# Generic Sequencer
#
#
# request TCL package from ACDS 16.0
#
package require -exact qsys 18.1
#
# module generic_sequencer_17
#
set_module_property DESCRIPTION "Generic Sequencer"
set_module_property NAME generic_sequencer_17
set_module_property VERSION 1.0
set_module_property INTERNAL false
set_module_property OPAQUE_ADDRESS_MAP true
set_module_property GROUP "GIS Components"
set_module_property AUTHOR GMG
set_module_property DISPLAY_NAME generic_sequencer_17
set_module_property INSTANTIATE_IN_SYSTEM_MODULE true
set_module_property EDITABLE true
set_module_property REPORT_TO_TALKBACK false
set_module_property ALLOW_GREYBOX_GENERATION false
set_module_property REPORT_HIERARCHY false
#
# file sets
#
add_fileset QUARTUS_SYNTH QUARTUS_SYNTH "" ""
set_fileset_property QUARTUS_SYNTH TOP_LEVEL generic_sequencer_17
set_fileset_property QUARTUS_SYNTH ENABLE_RELATIVE_INCLUDE_PATHS false
set_fileset_property QUARTUS_SYNTH ENABLE_FILE_OVERWRITE_MODE false
add_fileset_file common_pkg.vhd VHDL PATH ../../../common/0/src/common_pkg.vhd
add_fileset_file alt_rw_dp_ram.vhd VHDL PATH ../../../common/0/src/altera/alt_rw_dp_ram.vhd
add_fileset_file generic_sequencer_17_cmd_pkg.vhd VHDL PATH ../../../generic_sequencer/17/src/generic_sequencer_17_cmd_pkg.vhd
add_fileset_file generic_sequencer_17_pkg_auto.vhd VHDL PATH ../../../generic_sequencer/17/src/generic_sequencer_17_pkg_auto.vhd
add_fileset_file generic_sequencer_17_csr_regs_auto.vhd VHDL PATH ../../../generic_sequencer/17/src/generic_sequencer_17_csr_regs_auto.vhd
add_fileset_file generic_sequencer_17.vhd VHDL PATH ../../../generic_sequencer/17/src/generic_sequencer_17.vhd
#
# parameters
#
#
# display items
#
#
# connection point clock
#
add_interface clock clock end
set_interface_property clock clockRate 0
set_interface_property clock ENABLED true
set_interface_property clock EXPORT_OF ""
set_interface_property clock PORT_NAME_MAP ""
set_interface_property clock CMSIS_SVD_VARIABLES ""
set_interface_property clock SVD_ADDRESS_GROUP ""
add_interface_port clock clk clk Input 1

View file

@ -0,0 +1,333 @@
[{
"ip_name" : "generic_sequencer_17",
"bus" : "csr",
"addr_width" : "4",
"description" : "Generic Sequencer core",
"notes" : "This is the generic sequencer processing element core used in various products for a variety of purposes, such as pulse generation control, waveform generation for analogue heads and print data control. More details of this component can be found at https://confluence.gisapps.co.uk/display/EL/Generic+Sequencer.",
"registers" : {
"ip_id" : {
"address" : "0",
"width" : "32",
"description" : "Unique ID for this IP block",
"fields": {
"ip_number" : {
"type" : "c",
"bit_len" : "8",
"reset" : "0x01",
"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" : "0x11",
"description" : "Major number"
},
"reserved" : {
"type" : "rsv",
"bit_len" : "16",
"description" : "Reserved bits"
}
}
},
"config" : {
"address" : "2",
"width" : "30",
"description" : "Configuration values for sequencer",
"fields": {
"seq_depth" : {
"type" : "r",
"bit_len" : "6",
"reset" : "0",
"description" : "LOG2 (+1?) of SEQ_DEPTH generic"
},
"pos_width" : {
"type" : "r",
"bit_len" : "6",
"reset" : "0",
"description" : "POS_WIDTH generic value"
},
"bus_width" : {
"type" : "r",
"bit_len" : "6",
"reset" : "0",
"description" : "BUS_WIDTH generic value"
},
"vector_width" : {
"type" : "r",
"bit_len" : "6",
"reset" : "0",
"description" : "VECTOR_WIDTH generic value"
},
"trigger_width" : {
"type" : "r",
"bit_len" : "6",
"reset" : "0",
"description" : "TRIGGER_WIDTH generic value"
}
}
},
"ctrl_w" : {
"address" : "3",
"width" : "11",
"description" : "Control register write fields",
"fields": {
"seq_enable" : {
"type" : "w",
"bit_len" : "1",
"reset" : "0",
"description" : "Master enable for the sequencer"
},
"reserved_0" : {
"type" : "rsv",
"bit_len" : "2",
"description" : "Reserved bits"
},
"debug_mode" : {
"type" : "w",
"bit_len" : "1",
"reset" : "0",
"description" : "Enter debug mode (only has effect if not busy)"
},
"rst_vector_out" : {
"type" : "w",
"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"
},
"reserved_2" : {
"type" : "rsv",
"bit_len" : "1",
"description" : "Reserved bits"
}
}
},
"ctrl_r" : {
"address" : "4",
"width" : "11",
"description" : "Control register read fields",
"fields": {
"reserved_0" : {
"type" : "rsv",
"bit_len" : "2",
"description" : "Reserved bits"
},
"busy" : {
"type" : "r",
"bit_len" : "1",
"reset" : "0",
"description" : "Busy status (writing has no effect---in this register for backwards compatibility)"
},
"reserved_1" : {
"type" : "rsv",
"bit_len" : "7",
"description" : "Reserved bits"
},
"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"
}
}
},
"pc" : {
"address" : "5",
"width" : "32",
"description" : "RAM addresses of sequencer",
"fields": {
"ram_rd_addr" : {
"type" : "r",
"bit_len" : "8",
"reset" : "0",
"description" : "Current RAM read address"
},
"reserved_0" : {
"type" : "rsv",
"bit_len" : "8",
"description" : "Reserved bits"
},
"return_addr" : {
"type" : "r",
"bit_len" : "8",
"reset" : "0",
"description" : "Current return address"
},
"reserved_1" : {
"type" : "rsv",
"bit_len" : "8",
"description" : "Reserved bits"
}
}
},
"trigger" : {
"address" : "6",
"type" : "r",
"width" : "6",
"reset" : "0",
"description" : "Trigger input vector value"
},
"vector" : {
"address" : "7",
"type" : "wp",
"width" : "24",
"reset" : "0",
"description" : "Vector output override from CPU"
},
"r1" : {
"address" : "8",
"type" : "wp",
"width" : "12",
"reset" : "0",
"description" : "R1 register access. Writes only effective when idle."
},
"step" : {
"address" : "9",
"type" : "w0",
"width" : "1",
"reset" : "0",
"description" : "Step request from CPU"
},
"aux_config" : {
"address" : "10",
"width" : "6",
"description" : "Aux Configuration values for sequencer",
"fields": {
"ADD_VEC_PIPE" : {
"type" : "r",
"bit_len" : "1",
"reset" : "0",
"description" : "Add 1 level of pipeline on vector_out"
},
"VECT_RAMP_EN" : {
"type" : "r",
"bit_len" : "1",
"reset" : "0",
"description" : "Enable support for VEC_RAMP_UP/DN instructions"
},
"BUS_BURST_EN" : {
"type" : "r",
"bit_len" : "1",
"reset" : "0",
"description" : "Enable support for BUS_BURST instructions"
},
"POS_BUS_EN" : {
"type" : "r",
"bit_len" : "1",
"reset" : "0",
"description" : "Enable support for POS input bus"
},
"ALU_EN" : {
"type" : "r",
"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" : "11",
"type" : "r",
"width" : "24",
"reset" : "0",
"subtype" : "signed",
"description" : "value of pos_store"
},
"seq_queue_w" : {
"address" : "12",
"width" : "8",
"type" : "wp",
"reset" : "0",
"description" : "Sequence Execution Queue write"
},
"seq_queue_r" : {
"address" : "13",
"width" : "32",
"description" : "Sequence Execution Queue read bits",
"fields": {
"reserved_0" : {
"type" : "rsv",
"bit_len" : "8",
"description" : "Reserved bits"
},
"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"
}
}
}
}
},
{
"ip_name" : "generic_sequencer_17",
"bus" : "seq",
"addr_hi_bit" : "8",
"addr_lo_bit" : "0",
"process_regs" : "disabled",
"description" : "This block is the generic sequencer. It is a leaf block for the sequence bus",
"registers" : {
"seq_buff" : {
"address" : "0",
"width" : "32",
"type" : "w",
"reset" : "0",
"description" : "Sequence buffer"
}
}
}]

View file

@ -0,0 +1,120 @@
##/////////////////////////////////////////////////////////////////////////////
## Title : Run Simulation script
##/////////////////////////////////////////////////////////////////////////////
## File : run_sim.py
## Author : Gianmarco Girau
## Company : GIS
## Target : Re-usable across multiple projects with minor customizations
## Dependency : none
##/////////////////////////////////////////////////////////////////////////////
## Description: Script for running in Jenkins custom ModelSim testbenches
##/////////////////////////////////////////////////////////////////////////////
## Last update: 2017-09-26
##/////////////////////////////////////////////////////////////////////////////
## Revisions :
## Date Version Author Description
## 2017-09-26 01.00.0a gmg Created
##/////////////////////////////////////////////////////////////////////////////
import os, sys, subprocess
##/////////////////////////////////////////////////////////////////////////////
## Check Simulation Results
##/////////////////////////////////////////////////////////////////////////////
def check_result(logfile):
searchfile = open(logfile, "r")
ok = 0
for line in searchfile:
if "SUCCESS" in line:
print("/////////////////////////////////////////////////////////////////////////////")
print('TEST SUCCESSFUL')
print("/////////////////////////////////////////////////////////////////////////////")
ok = 1
break
if "FAILURE" in line:
print("/////////////////////////////////////////////////////////////////////////////")
print('TEST FAILED')
print("/////////////////////////////////////////////////////////////////////////////")
break
searchfile.close()
if ok == 0:
sys.exit(1)
##/////////////////////////////////////////////////////////////////////////////
## Run Modelsim Simulation script
##/////////////////////////////////////////////////////////////////////////////
def run_msim_script(sim_job, cmd_line_mode = 1):
# create a copy of the do file, edit the copy as necessary
orig_do_file = "./{0}.do".format(sim_job)
print("/////////////////////////////////////////////////////////////////////////////")
print("Running {0} ...".format(orig_do_file))
print("/////////////////////////////////////////////////////////////////////////////")
if os.path.isfile(orig_do_file) == False:
print("ERROR: Cannot find do file " + orig_do_file)
sys.exit(1)
do_file = "./{0}_tmp.do".format(sim_job)
orig_do_file_cnt = open(orig_do_file , "r")
do_file_cnt = open(do_file, "w")
# Remove command ".main clear" in cmd line mode
for line in orig_do_file_cnt:
if cmd_line_mode == 1 and line.strip() == ".main clear":
do_file_cnt.write("#.main clear\n")
elif cmd_line_mode == 1 and line.find("do wave_") != -1:
do_file_cnt.write("#" + line)
else:
do_file_cnt.write(line)
# manually add commands to exit from modelsim at the end of simulation
if cmd_line_mode == 1:
do_file_cnt.write("\n")
do_file_cnt.write("quit -sim; quit -f\n")
orig_do_file_cnt.close()
do_file_cnt.close()
log_file = "./{0}.log".format(sim_job)
vsim_cmd = os.environ['QUARTUS_ROOTDIR']+"\\..\\modelsim_ase\\win32aloem\\vsim"
if cmd_line_mode == 1:
cmd_opt = "-c"
else:
cmd_opt = ""
sub_call = "{0} {1} -l {2} -do {3}".format(vsim_cmd, cmd_opt, log_file, do_file)
subprocess.call(sub_call)
'''
if cmd_line_mode == 1:
# Run in command line mode
subprocess.call([vsim_cmd, "-c", "-l", log_file, "-do", do_file])
else:
# Run in GUI mode
subprocess.call([os.environ['QUARTUS_ROOTDIR']+"\\..\\modelsim_ase\\win32aloem\\vsim",
"-do", do_file, "-l", log_file])
'''
# remove the local copy of the do file
os.remove(do_file)
check_result(log_file)
##/////////////////////////////////////////////////////////////////////////////
## Execute Simulation Scripts
##/////////////////////////////////////////////////////////////////////////////
if __name__ == "__main__":
print("Running Generic-Sequencer testbench ...")
run_msim_script("sim_gen_seq", cmd_line_mode=1)

View file

@ -0,0 +1,63 @@
# Simulation macro for print_ctrl
.main clear
# 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
set WORKLIB work
vlib ./work
vmap work ./work
# Compile the UUT
vcom -2008 -work $WORKLIB $COMMON_PATH/src/common_pkg.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/src/altera/alt_rw_dp_ram.vhd
#vcom -2008 -work $WORKLIB ../src/dpram_sclk_16.vhd
#vcom -2008 -work $WORKLIB ../src/altera/generic_seq_ram_16.vhd
vcom -2008 -work $WORKLIB ../src/generic_sequencer_17_cmd_pkg.vhd
vcom -2008 -work $WORKLIB ../src/generic_sequencer_17_pkg_auto.vhd
vcom -2008 -work $WORKLIB ../src/generic_sequencer_17_csr_regs_auto.vhd
vcom -2008 -work $WORKLIB ../src/generic_sequencer_17.vhd
# 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 support files
vcom -2008 -work $WORKLIB $COMMON_PATH/src/test/common_test_pkg.vhd
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_sequencer_17_tb.vhd
vsim -t ps work.generic_sequencer_17_tb
#add wave /generic_sequencer_17_tb/*
#add wave /generic_sequencer_17_tb/iUUT/*
# remove warnings from standard numeric/arithmetic packages (speed-up simulation)
set StdArithNoWarnings 1
set NumericStdNoWarnings 1
do wave_gen_seq.do
when -label end_of_simulation {test_completed == true} {echo "Simulation Completed"; stop ;}
run -all
#run 100 us;

View file

@ -0,0 +1,160 @@
onerror {resume}
quietly WaveActivateNextPane {} 0
add wave -noupdate /generic_sequencer_17_tb/clk
add wave -noupdate /generic_sequencer_17_tb/reset_n
add wave -noupdate /generic_sequencer_17_tb/avs_csr_address
add wave -noupdate /generic_sequencer_17_tb/avs_csr_write
add wave -noupdate -radix hexadecimal /generic_sequencer_17_tb/avs_csr_writedata
add wave -noupdate /generic_sequencer_17_tb/avs_csr_read
add wave -noupdate -radix hexadecimal /generic_sequencer_17_tb/avs_csr_readdata
add wave -noupdate /generic_sequencer_17_tb/avs_seq_address
add wave -noupdate /generic_sequencer_17_tb/avs_seq_write
add wave -noupdate -radix hexadecimal /generic_sequencer_17_tb/avs_seq_writedata
add wave -noupdate /generic_sequencer_17_tb/avs_seq_read
add wave -noupdate -radix hexadecimal /generic_sequencer_17_tb/avs_seq_readdata
add wave -noupdate /generic_sequencer_17_tb/start_req
add wave -noupdate -radix hexadecimal /generic_sequencer_17_tb/start_addr
add wave -noupdate -radix hexadecimal /generic_sequencer_17_tb/trigger_in
add wave -noupdate -radix hexadecimal /generic_sequencer_17_tb/pos_in
add wave -noupdate /generic_sequencer_17_tb/busy
add wave -noupdate -radix hexadecimal /generic_sequencer_17_tb/vector_out
add wave -noupdate -radix hexadecimal /generic_sequencer_17_tb/bus_data
add wave -noupdate /generic_sequencer_17_tb/bus_valid
add wave -noupdate /generic_sequencer_17_tb/bus_ack
add wave -noupdate /generic_sequencer_17_tb/setup
add wave -noupdate /generic_sequencer_17_tb/running
add wave -noupdate /generic_sequencer_17_tb/passed
add wave -noupdate /generic_sequencer_17_tb/failed
add wave -noupdate -radix hexadecimal /generic_sequencer_17_tb/csr_mm_s_rec
add wave -noupdate -radix hexadecimal /generic_sequencer_17_tb/csr_mm_m_rec
add wave -noupdate -radix hexadecimal /generic_sequencer_17_tb/seq_mm_s_rec
add wave -noupdate -radix hexadecimal /generic_sequencer_17_tb/seq_mm_m_rec
add wave -noupdate -divider UUT
add wave -noupdate /generic_sequencer_17_tb/iUUT/clk
add wave -noupdate /generic_sequencer_17_tb/iUUT/reset_n
add wave -noupdate -radix unsigned /generic_sequencer_17_tb/iUUT/avs_csr_address
add wave -noupdate /generic_sequencer_17_tb/iUUT/avs_csr_write
add wave -noupdate -radix hexadecimal /generic_sequencer_17_tb/iUUT/avs_csr_writedata
add wave -noupdate /generic_sequencer_17_tb/iUUT/avs_csr_read
add wave -noupdate -radix hexadecimal /generic_sequencer_17_tb/iUUT/avs_csr_readdata
add wave -noupdate -radix decimal /generic_sequencer_17_tb/iUUT/avs_seq_address
add wave -noupdate /generic_sequencer_17_tb/iUUT/avs_seq_write
add wave -noupdate -radix hexadecimal /generic_sequencer_17_tb/iUUT/avs_seq_writedata
add wave -noupdate /generic_sequencer_17_tb/iUUT/avs_seq_read
add wave -noupdate -radix hexadecimal /generic_sequencer_17_tb/iUUT/avs_seq_readdata
add wave -noupdate /generic_sequencer_17_tb/iUUT/start_req
add wave -noupdate -radix hexadecimal -childformat {{/generic_sequencer_17_tb/iUUT/start_addr(8) -radix hexadecimal} {/generic_sequencer_17_tb/iUUT/start_addr(7) -radix hexadecimal} {/generic_sequencer_17_tb/iUUT/start_addr(6) -radix hexadecimal} {/generic_sequencer_17_tb/iUUT/start_addr(5) -radix hexadecimal} {/generic_sequencer_17_tb/iUUT/start_addr(4) -radix hexadecimal} {/generic_sequencer_17_tb/iUUT/start_addr(3) -radix hexadecimal} {/generic_sequencer_17_tb/iUUT/start_addr(2) -radix hexadecimal} {/generic_sequencer_17_tb/iUUT/start_addr(1) -radix hexadecimal} {/generic_sequencer_17_tb/iUUT/start_addr(0) -radix hexadecimal}} -subitemconfig {/generic_sequencer_17_tb/iUUT/start_addr(8) {-height 15 -radix hexadecimal} /generic_sequencer_17_tb/iUUT/start_addr(7) {-height 15 -radix hexadecimal} /generic_sequencer_17_tb/iUUT/start_addr(6) {-height 15 -radix hexadecimal} /generic_sequencer_17_tb/iUUT/start_addr(5) {-height 15 -radix hexadecimal} /generic_sequencer_17_tb/iUUT/start_addr(4) {-height 15 -radix hexadecimal} /generic_sequencer_17_tb/iUUT/start_addr(3) {-height 15 -radix hexadecimal} /generic_sequencer_17_tb/iUUT/start_addr(2) {-height 15 -radix hexadecimal} /generic_sequencer_17_tb/iUUT/start_addr(1) {-height 15 -radix hexadecimal} /generic_sequencer_17_tb/iUUT/start_addr(0) {-height 15 -radix hexadecimal}} /generic_sequencer_17_tb/iUUT/start_addr
add wave -noupdate -radix hexadecimal -childformat {{/generic_sequencer_17_tb/iUUT/trigger_in(11) -radix hexadecimal} {/generic_sequencer_17_tb/iUUT/trigger_in(10) -radix hexadecimal} {/generic_sequencer_17_tb/iUUT/trigger_in(9) -radix hexadecimal} {/generic_sequencer_17_tb/iUUT/trigger_in(8) -radix hexadecimal} {/generic_sequencer_17_tb/iUUT/trigger_in(7) -radix hexadecimal} {/generic_sequencer_17_tb/iUUT/trigger_in(6) -radix hexadecimal} {/generic_sequencer_17_tb/iUUT/trigger_in(5) -radix hexadecimal} {/generic_sequencer_17_tb/iUUT/trigger_in(4) -radix hexadecimal} {/generic_sequencer_17_tb/iUUT/trigger_in(3) -radix hexadecimal} {/generic_sequencer_17_tb/iUUT/trigger_in(2) -radix hexadecimal} {/generic_sequencer_17_tb/iUUT/trigger_in(1) -radix hexadecimal} {/generic_sequencer_17_tb/iUUT/trigger_in(0) -radix hexadecimal}} -subitemconfig {/generic_sequencer_17_tb/iUUT/trigger_in(11) {-height 15 -radix hexadecimal} /generic_sequencer_17_tb/iUUT/trigger_in(10) {-height 15 -radix hexadecimal} /generic_sequencer_17_tb/iUUT/trigger_in(9) {-height 15 -radix hexadecimal} /generic_sequencer_17_tb/iUUT/trigger_in(8) {-height 15 -radix hexadecimal} /generic_sequencer_17_tb/iUUT/trigger_in(7) {-height 15 -radix hexadecimal} /generic_sequencer_17_tb/iUUT/trigger_in(6) {-height 15 -radix hexadecimal} /generic_sequencer_17_tb/iUUT/trigger_in(5) {-height 15 -radix hexadecimal} /generic_sequencer_17_tb/iUUT/trigger_in(4) {-height 15 -radix hexadecimal} /generic_sequencer_17_tb/iUUT/trigger_in(3) {-height 15 -radix hexadecimal} /generic_sequencer_17_tb/iUUT/trigger_in(2) {-height 15 -radix hexadecimal} /generic_sequencer_17_tb/iUUT/trigger_in(1) {-height 15 -radix hexadecimal} /generic_sequencer_17_tb/iUUT/trigger_in(0) {-height 15 -radix hexadecimal}} /generic_sequencer_17_tb/iUUT/trigger_in
add wave -noupdate -radix hexadecimal /generic_sequencer_17_tb/iUUT/pos_in
add wave -noupdate /generic_sequencer_17_tb/iUUT/busy
add wave -noupdate /generic_sequencer_17_tb/iUUT/opcode
add wave -noupdate -radix hexadecimal /generic_sequencer_17_tb/iUUT/vector_out
add wave -noupdate -radix hexadecimal /generic_sequencer_17_tb/iUUT/bus_data
add wave -noupdate /generic_sequencer_17_tb/iUUT/bus_valid
add wave -noupdate /generic_sequencer_17_tb/iUUT/bus_ack
add wave -noupdate /generic_sequencer_17_tb/iUUT/seq_enable
add wave -noupdate /generic_sequencer_17_tb/iUUT/debug_mode
add wave -noupdate -radix hexadecimal /generic_sequencer_17_tb/iUUT/return_addr
add wave -noupdate -radix hexadecimal /generic_sequencer_17_tb/iUUT/ram_rd_addr
add wave -noupdate -radix hexadecimal /generic_sequencer_17_tb/iUUT/ram_rd_data
add wave -noupdate /generic_sequencer_17_tb/iUUT/fsm
add wave -noupdate /generic_sequencer_17_tb/iUUT/fsm_nxt
add wave -noupdate /generic_sequencer_17_tb/iUUT/fetch_enable
add wave -noupdate -radix hexadecimal /generic_sequencer_17_tb/iUUT/operand_1
add wave -noupdate -radix hexadecimal /generic_sequencer_17_tb/iUUT/operand_2
add wave -noupdate -radix hexadecimal /generic_sequencer_17_tb/iUUT/operand_comp
add wave -noupdate -radix hexadecimal /generic_sequencer_17_tb/iUUT/subcode
add wave -noupdate /generic_sequencer_17_tb/iUUT/ramp_up
add wave -noupdate -radix hexadecimal /generic_sequencer_17_tb/iUUT/ramp_curr
add wave -noupdate -radix hexadecimal /generic_sequencer_17_tb/iUUT/ramp_next
add wave -noupdate -radix hexadecimal /generic_sequencer_17_tb/iUUT/ramp_final
add wave -noupdate -radix hexadecimal /generic_sequencer_17_tb/iUUT/ramp_diff
add wave -noupdate /generic_sequencer_17_tb/iUUT/ramp_diff_top
add wave -noupdate /generic_sequencer_17_tb/iUUT/ramp_to_val
add wave -noupdate /generic_sequencer_17_tb/iUUT/ramp_done
add wave -noupdate /generic_sequencer_17_tb/iUUT/ramp_to_val_last
add wave -noupdate /generic_sequencer_17_tb/iUUT/inc_op_cnt
add wave -noupdate /generic_sequencer_17_tb/iUUT/trig_int
add wave -noupdate /generic_sequencer_17_tb/iUUT/alu_upd
add wave -noupdate -radix hexadecimal /generic_sequencer_17_tb/iUUT/r1
add wave -noupdate /generic_sequencer_17_tb/iUUT/inc_ram_addr
add wave -noupdate -radix hexadecimal /generic_sequencer_17_tb/iUUT/jump_addr_ext
add wave -noupdate -radix hexadecimal /generic_sequencer_17_tb/iUUT/jump_addr
add wave -noupdate -radix hexadecimal /generic_sequencer_17_tb/iUUT/pc_value
add wave -noupdate /generic_sequencer_17_tb/iUUT/ld_jmp_addr
add wave -noupdate /generic_sequencer_17_tb/iUUT/jump_abs
add wave -noupdate /generic_sequencer_17_tb/iUUT/jump_rel
add wave -noupdate /generic_sequencer_17_tb/iUUT/clr_seq_queue
add wave -noupdate /generic_sequencer_17_tb/iUUT/clr_seq_queue_i
add wave -noupdate /generic_sequencer_17_tb/iUUT/clr_seq_queue_exe
add wave -noupdate /generic_sequencer_17_tb/iUUT/queue_add_flag
add wave -noupdate /generic_sequencer_17_tb/iUUT/queue_add_flag_d
add wave -noupdate /generic_sequencer_17_tb/iUUT/queue_add_flag_i
add wave -noupdate /generic_sequencer_17_tb/iUUT/queue_inc
add wave -noupdate /generic_sequencer_17_tb/iUUT/queue_dec
add wave -noupdate /generic_sequencer_17_tb/iUUT/seq_completed
add wave -noupdate /generic_sequencer_17_tb/iUUT/seq_queue_empty
add wave -noupdate /generic_sequencer_17_tb/iUUT/set_queue_empty
add wave -noupdate -radix decimal /generic_sequencer_17_tb/iUUT/queue_add
add wave -noupdate -radix decimal /generic_sequencer_17_tb/iUUT/queue_add_i
add wave -noupdate -radix unsigned /generic_sequencer_17_tb/iUUT/queue_left
add wave -noupdate -radix unsigned /generic_sequencer_17_tb/iUUT/queue_exec
add wave -noupdate /generic_sequencer_17_tb/iUUT/jump_r1
add wave -noupdate /generic_sequencer_17_tb/iUUT/loop_active
add wave -noupdate /generic_sequencer_17_tb/iUUT/loop_upd
add wave -noupdate /generic_sequencer_17_tb/iUUT/loop_done
add wave -noupdate -radix unsigned /generic_sequencer_17_tb/iUUT/loop_cnt
add wave -noupdate /generic_sequencer_17_tb/iUUT/ld_trig_mask
add wave -noupdate /generic_sequencer_17_tb/iUUT/ld_trig_sel
add wave -noupdate -radix hexadecimal /generic_sequencer_17_tb/iUUT/trig_mask
add wave -noupdate /generic_sequencer_17_tb/iUUT/trig_sel
add wave -noupdate /generic_sequencer_17_tb/iUUT/trig_int
add wave -noupdate /generic_sequencer_17_tb/iUUT/ld_vec
add wave -noupdate /generic_sequencer_17_tb/iUUT/clr_vec_i
add wave -noupdate /generic_sequencer_17_tb/iUUT/clr_vec
add wave -noupdate -radix hexadecimal /generic_sequencer_17_tb/iUUT/vector_out_i
add wave -noupdate -radix hexadecimal /generic_sequencer_17_tb/iUUT/vector_out
add wave -noupdate /generic_sequencer_17_tb/iUUT/ramp_up
add wave -noupdate /generic_sequencer_17_tb/iUUT/fetch_op
add wave -noupdate /generic_sequencer_17_tb/iUUT/clr_vec_ii
add wave -noupdate /generic_sequencer_17_tb/iUUT/op_cnt
add wave -noupdate /generic_sequencer_17_tb/iUUT/op_cnt_done
add wave -noupdate /generic_sequencer_17_tb/iUUT/inc_op_cnt
add wave -noupdate -radix hexadecimal /generic_sequencer_17_tb/iUUT/bus_data
add wave -noupdate /generic_sequencer_17_tb/iUUT/bus_valid
add wave -noupdate /generic_sequencer_17_tb/iUUT/bus_ack
add wave -noupdate /generic_sequencer_17_tb/iUUT/bus_valid_i
add wave -noupdate /generic_sequencer_17_tb/iUUT/bus_pause
add wave -noupdate -radix hexadecimal /generic_sequencer_17_tb/iUUT/pos_store
add wave -noupdate /generic_sequencer_17_tb/iUUT/loop_active
add wave -noupdate /generic_sequencer_17_tb/iUUT/vector_val_cpu
add wave -noupdate -radix hexadecimal /generic_sequencer_17_tb/iUUT/vector_cpu
add wave -noupdate /generic_sequencer_17_tb/iUUT/step_req
add wave -noupdate /generic_sequencer_17_tb/iUUT/rst_vector_out
add wave -noupdate /generic_sequencer_17_tb/iUUT/pos_target
add wave -noupdate /generic_sequencer_17_tb/iUUT/ld_ret_addr
add wave -noupdate /generic_sequencer_17_tb/iUUT/save_ret_addr
add wave -noupdate /generic_sequencer_17_tb/iUUT/r1_data
add wave -noupdate /generic_sequencer_17_tb/iUUT/r1_data_valid
add wave -noupdate /generic_sequencer_17_tb/iUUT/decode
add wave -noupdate /generic_sequencer_17_tb/iUUT/busy_i
add wave -noupdate /generic_sequencer_17_tb/iUUT/ld_start_addr
add wave -noupdate /generic_sequencer_17_tb/iUUT/ld_pos
TreeUpdate [SetDefaultTree]
WaveRestoreCursors {{Cursor 1} {24927383 ps} 0}
quietly wave cursor active 1
configure wave -namecolwidth 283
configure wave -valuecolwidth 194
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 {23944887 ps} {27786423 ps}

View file

@ -0,0 +1,229 @@
-- megafunction wizard: %RAM: 2-PORT%
-- GENERATION: STANDARD
-- VERSION: WM1.0
-- MODULE: altsyncram
-- ============================================================
-- File Name: generic_seq_ram.vhd
-- Megafunction Name(s):
-- altsyncram
--
-- Simulation Library Files(s):
-- altera_mf
-- ============================================================
-- ************************************************************
-- THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE!
--
-- 14.1.1 Build 190 01/19/2015 SJ Web Edition
-- ************************************************************
--Copyright (C) 1991-2015 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 II 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.altera_mf_components.all;
use work.common_pkg.all;
ENTITY generic_seq_ram_16 IS
generic (
SEQ_DEPTH : natural range 1 to 1024
);
PORT
(
address_a : IN STD_LOGIC_VECTOR (log2(SEQ_DEPTH)-1 DOWNTO 0);
address_b : IN STD_LOGIC_VECTOR (log2(SEQ_DEPTH)-1 DOWNTO 0);
clock : IN STD_LOGIC := '1';
data_a : IN STD_LOGIC_VECTOR (31 DOWNTO 0);
data_b : IN STD_LOGIC_VECTOR (31 DOWNTO 0);
wren_a : IN STD_LOGIC := '0';
wren_b : IN STD_LOGIC := '0';
q_a : OUT STD_LOGIC_VECTOR (31 DOWNTO 0);
q_b : OUT STD_LOGIC_VECTOR (31 DOWNTO 0)
);
END generic_seq_ram_16;
ARCHITECTURE SYN OF generic_seq_ram_16 IS
SIGNAL sub_wire0 : STD_LOGIC_VECTOR (31 DOWNTO 0);
SIGNAL sub_wire1 : STD_LOGIC_VECTOR (31 DOWNTO 0);
BEGIN
q_a <= sub_wire0(31 DOWNTO 0);
q_b <= sub_wire1(31 DOWNTO 0);
altsyncram_component : altsyncram
GENERIC MAP (
address_reg_b => "CLOCK0",
clock_enable_input_a => "BYPASS",
clock_enable_input_b => "BYPASS",
clock_enable_output_a => "BYPASS",
clock_enable_output_b => "BYPASS",
indata_reg_b => "CLOCK0",
intended_device_family => "Cyclone V",
lpm_type => "altsyncram",
numwords_a => SEQ_DEPTH,
numwords_b => SEQ_DEPTH,
operation_mode => "BIDIR_DUAL_PORT",
outdata_aclr_a => "NONE",
outdata_aclr_b => "NONE",
outdata_reg_a => "UNREGISTERED",
outdata_reg_b => "UNREGISTERED",
power_up_uninitialized => "FALSE",
read_during_write_mode_mixed_ports => "OLD_DATA",
read_during_write_mode_port_a => "NEW_DATA_NO_NBE_READ",
read_during_write_mode_port_b => "NEW_DATA_NO_NBE_READ",
widthad_a => log2(SEQ_DEPTH),
widthad_b => log2(SEQ_DEPTH),
width_a => 32,
width_b => 32,
width_byteena_a => 1,
width_byteena_b => 1,
wrcontrol_wraddress_reg_b => "CLOCK0"
)
PORT MAP (
address_a => address_a,
address_b => address_b,
clock0 => clock,
data_a => data_a,
data_b => data_b,
wren_a => wren_a,
wren_b => wren_b,
q_a => sub_wire0,
q_b => sub_wire1
);
END SYN;
-- ============================================================
-- CNX file retrieval info
-- ============================================================
-- Retrieval info: PRIVATE: ADDRESSSTALL_A NUMERIC "0"
-- Retrieval info: PRIVATE: ADDRESSSTALL_B NUMERIC "0"
-- Retrieval info: PRIVATE: BYTEENA_ACLR_A NUMERIC "0"
-- Retrieval info: PRIVATE: BYTEENA_ACLR_B NUMERIC "0"
-- Retrieval info: PRIVATE: BYTE_ENABLE_A NUMERIC "0"
-- Retrieval info: PRIVATE: BYTE_ENABLE_B NUMERIC "0"
-- Retrieval info: PRIVATE: BYTE_SIZE NUMERIC "8"
-- Retrieval info: PRIVATE: BlankMemory NUMERIC "1"
-- Retrieval info: PRIVATE: CLOCK_ENABLE_INPUT_A NUMERIC "0"
-- Retrieval info: PRIVATE: CLOCK_ENABLE_INPUT_B NUMERIC "0"
-- Retrieval info: PRIVATE: CLOCK_ENABLE_OUTPUT_A NUMERIC "0"
-- Retrieval info: PRIVATE: CLOCK_ENABLE_OUTPUT_B NUMERIC "0"
-- Retrieval info: PRIVATE: CLRdata NUMERIC "0"
-- Retrieval info: PRIVATE: CLRq NUMERIC "0"
-- Retrieval info: PRIVATE: CLRrdaddress NUMERIC "0"
-- Retrieval info: PRIVATE: CLRrren NUMERIC "0"
-- Retrieval info: PRIVATE: CLRwraddress NUMERIC "0"
-- Retrieval info: PRIVATE: CLRwren NUMERIC "0"
-- Retrieval info: PRIVATE: Clock NUMERIC "0"
-- Retrieval info: PRIVATE: Clock_A NUMERIC "0"
-- Retrieval info: PRIVATE: Clock_B NUMERIC "0"
-- Retrieval info: PRIVATE: IMPLEMENT_IN_LES NUMERIC "0"
-- Retrieval info: PRIVATE: INDATA_ACLR_B NUMERIC "0"
-- Retrieval info: PRIVATE: INDATA_REG_B NUMERIC "1"
-- Retrieval info: PRIVATE: INIT_FILE_LAYOUT STRING "PORT_A"
-- Retrieval info: PRIVATE: INIT_TO_SIM_X NUMERIC "0"
-- Retrieval info: PRIVATE: INTENDED_DEVICE_FAMILY STRING "Cyclone V"
-- Retrieval info: PRIVATE: JTAG_ENABLED NUMERIC "0"
-- Retrieval info: PRIVATE: JTAG_ID STRING "NONE"
-- Retrieval info: PRIVATE: MAXIMUM_DEPTH NUMERIC "0"
-- Retrieval info: PRIVATE: MEMSIZE NUMERIC "8192"
-- Retrieval info: PRIVATE: MEM_IN_BITS NUMERIC "0"
-- Retrieval info: PRIVATE: MIFfilename STRING ""
-- Retrieval info: PRIVATE: OPERATION_MODE NUMERIC "3"
-- Retrieval info: PRIVATE: OUTDATA_ACLR_B NUMERIC "0"
-- Retrieval info: PRIVATE: OUTDATA_REG_B NUMERIC "0"
-- Retrieval info: PRIVATE: RAM_BLOCK_TYPE NUMERIC "0"
-- Retrieval info: PRIVATE: READ_DURING_WRITE_MODE_MIXED_PORTS NUMERIC "2"
-- Retrieval info: PRIVATE: READ_DURING_WRITE_MODE_PORT_A NUMERIC "3"
-- Retrieval info: PRIVATE: READ_DURING_WRITE_MODE_PORT_B NUMERIC "3"
-- Retrieval info: PRIVATE: REGdata NUMERIC "1"
-- Retrieval info: PRIVATE: REGq NUMERIC "0"
-- Retrieval info: PRIVATE: REGrdaddress NUMERIC "0"
-- Retrieval info: PRIVATE: REGrren NUMERIC "0"
-- Retrieval info: PRIVATE: REGwraddress NUMERIC "1"
-- Retrieval info: PRIVATE: REGwren NUMERIC "1"
-- Retrieval info: PRIVATE: SYNTH_WRAPPER_GEN_POSTFIX STRING "0"
-- Retrieval info: PRIVATE: USE_DIFF_CLKEN NUMERIC "0"
-- Retrieval info: PRIVATE: UseDPRAM NUMERIC "1"
-- Retrieval info: PRIVATE: VarWidth NUMERIC "0"
-- Retrieval info: PRIVATE: WIDTH_READ_A NUMERIC "32"
-- Retrieval info: PRIVATE: WIDTH_READ_B NUMERIC "32"
-- Retrieval info: PRIVATE: WIDTH_WRITE_A NUMERIC "32"
-- Retrieval info: PRIVATE: WIDTH_WRITE_B NUMERIC "32"
-- Retrieval info: PRIVATE: WRADDR_ACLR_B NUMERIC "0"
-- Retrieval info: PRIVATE: WRADDR_REG_B NUMERIC "1"
-- Retrieval info: PRIVATE: WRCTRL_ACLR_B NUMERIC "0"
-- Retrieval info: PRIVATE: enable NUMERIC "0"
-- Retrieval info: PRIVATE: rden NUMERIC "0"
-- Retrieval info: LIBRARY: altera_mf altera_mf.altera_mf_components.all
-- Retrieval info: CONSTANT: ADDRESS_REG_B STRING "CLOCK0"
-- Retrieval info: CONSTANT: CLOCK_ENABLE_INPUT_A STRING "BYPASS"
-- Retrieval info: CONSTANT: CLOCK_ENABLE_INPUT_B STRING "BYPASS"
-- Retrieval info: CONSTANT: CLOCK_ENABLE_OUTPUT_A STRING "BYPASS"
-- Retrieval info: CONSTANT: CLOCK_ENABLE_OUTPUT_B STRING "BYPASS"
-- Retrieval info: CONSTANT: INDATA_REG_B STRING "CLOCK0"
-- Retrieval info: CONSTANT: INTENDED_DEVICE_FAMILY STRING "Cyclone V"
-- Retrieval info: CONSTANT: LPM_TYPE STRING "altsyncram"
-- Retrieval info: CONSTANT: NUMWORDS_A NUMERIC "256"
-- Retrieval info: CONSTANT: NUMWORDS_B NUMERIC "256"
-- Retrieval info: CONSTANT: OPERATION_MODE STRING "BIDIR_DUAL_PORT"
-- Retrieval info: CONSTANT: OUTDATA_ACLR_A STRING "NONE"
-- Retrieval info: CONSTANT: OUTDATA_ACLR_B STRING "NONE"
-- Retrieval info: CONSTANT: OUTDATA_REG_A STRING "UNREGISTERED"
-- Retrieval info: CONSTANT: OUTDATA_REG_B STRING "UNREGISTERED"
-- Retrieval info: CONSTANT: POWER_UP_UNINITIALIZED STRING "FALSE"
-- Retrieval info: CONSTANT: READ_DURING_WRITE_MODE_MIXED_PORTS STRING "DONT_CARE"
-- Retrieval info: CONSTANT: READ_DURING_WRITE_MODE_PORT_A STRING "NEW_DATA_NO_NBE_READ"
-- Retrieval info: CONSTANT: READ_DURING_WRITE_MODE_PORT_B STRING "NEW_DATA_NO_NBE_READ"
-- Retrieval info: CONSTANT: WIDTHAD_A NUMERIC "8"
-- Retrieval info: CONSTANT: WIDTHAD_B NUMERIC "8"
-- Retrieval info: CONSTANT: WIDTH_A NUMERIC "32"
-- Retrieval info: CONSTANT: WIDTH_B NUMERIC "32"
-- Retrieval info: CONSTANT: WIDTH_BYTEENA_A NUMERIC "1"
-- Retrieval info: CONSTANT: WIDTH_BYTEENA_B NUMERIC "1"
-- Retrieval info: CONSTANT: WRCONTROL_WRADDRESS_REG_B STRING "CLOCK0"
-- Retrieval info: USED_PORT: address_a 0 0 8 0 INPUT NODEFVAL "address_a[7..0]"
-- Retrieval info: USED_PORT: address_b 0 0 8 0 INPUT NODEFVAL "address_b[7..0]"
-- Retrieval info: USED_PORT: clock 0 0 0 0 INPUT VCC "clock"
-- Retrieval info: USED_PORT: data_a 0 0 32 0 INPUT NODEFVAL "data_a[31..0]"
-- Retrieval info: USED_PORT: data_b 0 0 32 0 INPUT NODEFVAL "data_b[31..0]"
-- Retrieval info: USED_PORT: q_a 0 0 32 0 OUTPUT NODEFVAL "q_a[31..0]"
-- Retrieval info: USED_PORT: q_b 0 0 32 0 OUTPUT NODEFVAL "q_b[31..0]"
-- Retrieval info: USED_PORT: wren_a 0 0 0 0 INPUT GND "wren_a"
-- Retrieval info: USED_PORT: wren_b 0 0 0 0 INPUT GND "wren_b"
-- Retrieval info: CONNECT: @address_a 0 0 8 0 address_a 0 0 8 0
-- Retrieval info: CONNECT: @address_b 0 0 8 0 address_b 0 0 8 0
-- Retrieval info: CONNECT: @clock0 0 0 0 0 clock 0 0 0 0
-- Retrieval info: CONNECT: @data_a 0 0 32 0 data_a 0 0 32 0
-- Retrieval info: CONNECT: @data_b 0 0 32 0 data_b 0 0 32 0
-- Retrieval info: CONNECT: @wren_a 0 0 0 0 wren_a 0 0 0 0
-- Retrieval info: CONNECT: @wren_b 0 0 0 0 wren_b 0 0 0 0
-- Retrieval info: CONNECT: q_a 0 0 32 0 @q_a 0 0 32 0
-- Retrieval info: CONNECT: q_b 0 0 32 0 @q_b 0 0 32 0
-- Retrieval info: GEN_FILE: TYPE_NORMAL generic_seq_ram.vhd TRUE
-- Retrieval info: GEN_FILE: TYPE_NORMAL generic_seq_ram.inc FALSE
-- Retrieval info: GEN_FILE: TYPE_NORMAL generic_seq_ram.cmp TRUE
-- Retrieval info: GEN_FILE: TYPE_NORMAL generic_seq_ram.bsf FALSE
-- Retrieval info: GEN_FILE: TYPE_NORMAL generic_seq_ram_inst.vhd FALSE
-- Retrieval info: LIB_FILE: altera_mf

View file

@ -0,0 +1,870 @@
-------------------------------------------------------------------------------
-- Title : generic_sequencer
-- Project : Generic Components
-------------------------------------------------------------------------------
-- File : generic_sequencer.vhd
-- Author : Robbie Temple (original)
-- Company : Global Inkjet Systems
-- Created : 2016-05-12
-- Last update: 2021-01-14
-- SVN ID : Git
-- Standard : VHDL'2008
-------------------------------------------------------------------------------
-- Description:
-- Generic Sequencer core
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use work.common_pkg.all;
use work.generic_sequencer_17_cmd_pkg.all;
entity generic_sequencer_17 is
generic(
TRIGGER_WIDTH : natural range 1 to 16 := 16;
VECTOR_WIDTH : natural range 1 to 24 := 14;
RAMP_WIDTH : natural range 1 to 16 := 14; -- Must be less than or equal to VECTOR_WIDTH
BUS_WIDTH : natural range 1 to 32 := 12;
POS_WIDTH : natural range 1 to 24 := 12;
SEQ_DEPTH : natural range 256 to 4096 := 256;
ADD_VEC_PIPE : boolean := false; -- Add a pipeline register on vector_out
VECT_CPU_EN : boolean := false;
VECT_RAMP_EN : boolean := false;
BUS_BURST_EN : boolean := false;
POS_BUS_EN : boolean := false;
ALU_EN : boolean := false;
QUEUE_EN : boolean := false;
DEVICE_FAMILY : string := "Cyclone V" -- "Cyclone 10 LP"
);
port(
--
clk : in std_logic;
reset_n : in std_logic;
--
avs_csr_address : in std_logic_vector(3 downto 0);
avs_csr_write : in std_logic;
avs_csr_writedata : in std_logic_vector(31 downto 0);
avs_csr_read : in std_logic;
avs_csr_readdata : out std_logic_vector(31 downto 0) := (others => '0');
--
avs_seq_address : in std_logic_vector(log2(SEQ_DEPTH) - 1 downto 0);
avs_seq_write : in std_logic;
avs_seq_writedata : in std_logic_vector(31 downto 0);
avs_seq_read : in std_logic;
avs_seq_readdata : out std_logic_vector(31 downto 0) := (others => '0');
--
start_req : in std_logic;
start_addr : in std_logic_vector(log2(SEQ_DEPTH) - 1 downto 0);
--
trigger_in : in std_logic_vector(TRIGGER_WIDTH - 1 downto 0);
pos_in : in std_logic_vector(POS_WIDTH - 1 downto 0);
--
busy : out std_logic;
--
vector_out : out std_logic_vector(VECTOR_WIDTH - 1 downto 0);
--
bus_data : out std_logic_vector(BUS_WIDTH - 1 downto 0);
bus_valid : out std_logic;
bus_ack : in std_logic);
end entity generic_sequencer_17;
architecture rtl of generic_sequencer_17 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"00001000";
type fsm_t is (s_idle, s_init, s_fetch, s_decode,
--
s_trig_mask, s_trig_wait,
s_vec_set, s_vec_ramp,
s_bus_burst, s_bus_data,
s_pos_store, s_pos_wait,
--
s_alu,
--
s_loop, s_jump, s_branch, s_return,
--
s_end);
-----------------------------------------------------------------------------
-- Signals
-----------------------------------------------------------------------------
signal fsm, fsm_nxt : fsm_t;
signal seq_cfg_aux : std_logic_vector(31 downto 0) := 32x"0";
signal seq_enable : std_logic;
signal rst_vector_out : std_logic;
signal debug_mode : std_logic;
signal ram_rd_addr : std_logic_vector(log2(SEQ_DEPTH) - 1 downto 0);
signal ram_rd_data : std_logic_vector(31 downto 0);
signal operand_1 : std_logic_vector(11 downto 0);
signal operand_2 : std_logic_vector(11 downto 0);
signal operand_comp : std_logic_vector(23 downto 0);
signal opcode : std_logic_vector(3 downto 0);
signal subcode : std_logic_vector(3 downto 0);
signal jump_addr_ext : std_logic_vector(11 downto 0);
signal jump_addr : std_logic_vector(log2(SEQ_DEPTH) - 1 downto 0);
signal pc_value : std_logic_vector(log2(SEQ_DEPTH) - 1 downto 0);
signal pos_store : std_logic_vector(POS_WIDTH - 1 downto 0);
signal pos_target : std_logic_vector(POS_WIDTH - 1 downto 0);
signal trig_mask : std_logic_vector(TRIGGER_WIDTH - 1 downto 0);
signal trig_sel : std_logic_vector(3 downto 0);
signal trig_int : std_logic;
signal vector_out_i : std_logic_vector(VECTOR_WIDTH - 1 downto 0);
signal ramp_curr : std_logic_vector(RAMP_WIDTH - 1 downto 0);
signal ramp_next : std_logic_vector(RAMP_WIDTH - 1 downto 0);
signal ramp_final : std_logic_vector(RAMP_WIDTH - 1 downto 0);
signal ramp_diff : std_logic_vector(RAMP_WIDTH downto 0);
signal op_cnt : std_logic_vector(11 downto 0);
signal loop_cnt : std_logic_vector(11 downto 0);
signal return_addr : std_logic_vector(log2(SEQ_DEPTH) - 1 downto 0);
signal r1, r1_data : std_logic_vector(11 downto 0);
signal r1_data_valid : std_logic; -- strobe to cause R1 to be updated with R1_data value
signal decode, clr_vec, ld_vec : std_logic;
signal bus_valid_i, busy_i : std_logic;
signal ld_start_addr, inc_ram_addr : std_logic;
signal ld_trig_mask, ld_trig_sel : std_logic;
signal ld_pos, ld_ramp : std_logic;
signal zero_flag, alu_upd : std_logic;
signal clr_vec_i, clr_vec_ii : std_logic;
signal fetch_op, ramp_up : std_logic;
signal op_cnt_done, inc_op_cnt : std_logic;
signal bus_pause, ld_jmp_addr : std_logic;
signal jump_abs, jump_rel, jump_r1 : std_logic;
signal ld_ret_addr, save_ret_addr : std_logic;
signal loop_active, loop_upd : std_logic;
signal loop_done, ramp_diff_top : std_logic;
signal start_req_d, start_req_i : std_logic;
signal ramp_to_val, ramp_done : std_logic;
signal ramp_to_val_last : std_logic;
signal vector_val_cpu : std_logic;
signal vector_cpu : std_logic_vector(VECTOR_WIDTH - 1 downto 0);
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);
signal debug_mode_r : std_logic;
signal clr_seq_queue_r : std_logic;
signal clr_seq_queue_exe_r: std_logic;
signal vector_val_cpu_p : std_logic;
signal vector_cpu_r : std_logic_vector(VECTOR_WIDTH - 1 downto 0);
signal r1_data_valid_p : std_logic;
signal r1_data_r : std_logic_vector(11 downto 0);
signal seq_queue_w_p : std_logic;
signal seq_queue_w_r : std_logic_vector(7 downto 0);
begin
-----------------------------------------------------------------------------
-- Control & Status Registers
-----------------------------------------------------------------------------
generic_sequencer_17_csr_regs_i : entity work.generic_sequencer_17_csr_regs
generic map (
ADDR_DECODE_WIDTH => 4
)
port map (
-- Clock and reset
clk => clk,
rst_n => reset_n,
-- auto-generated
-- Internal signal ports
ctrl_w_seq_enable => seq_enable,
ctrl_w_debug_mode => debug_mode_r,
ctrl_w_rst_vector_out => rst_vector_out,
ctrl_w_clr_seq_queue => clr_seq_queue_r,
ctrl_w_clr_seq_queue_exe => clr_seq_queue_exe_r,
step => step_req,
vector_pulse => vector_val_cpu_p,
vector => vector_cpu_r,
vector_in => vector_out_i,
r1_pulse => r1_data_valid_p,
r1 => r1_data_r,
r1_in => r1_data,
seq_queue_w_pulse => seq_queue_w_p,
seq_queue_w => seq_queue_w_r,
seq_queue_w_in => (others => '0'),
config_seq_depth => std_logic_vector(to_unsigned(log2(SEQ_DEPTH), 6)),
config_pos_width => std_logic_vector(to_unsigned(POS_WIDTH, 6)),
config_bus_width => std_logic_vector(to_unsigned(BUS_WIDTH, 6)),
config_vector_width => std_logic_vector(to_unsigned(VECTOR_WIDTH, 6)),
config_trigger_width => std_logic_vector(to_unsigned(TRIGGER_WIDTH, 6)),
ctrl_r_busy => busy_i,
ctrl_r_seq_queue_empty => seq_queue_empty,
pc_ram_rd_addr => pc_value,
pc_return_addr => return_addr,
trigger => trigger_in,
aux_config_ADD_VEC_PIPE => seq_cfg_aux(0),
aux_config_VECT_RAMP_EN => seq_cfg_aux(1),
aux_config_BUS_BURST_EN => seq_cfg_aux(2),
aux_config_POS_BUS_EN => seq_cfg_aux(3),
aux_config_ALU_EN => seq_cfg_aux(4),
aux_config_QUEUE_EN => seq_cfg_aux(5),
pos_store => pos_store,
seq_queue_r_queue_left => queue_left,
seq_queue_r_queue_exec => queue_exec,
-- end auto-generated
-- Slave bus port
avs_address => avs_csr_address(3 downto 0),
avs_write => avs_csr_write,
avs_writedata => avs_csr_writedata,
avs_read => avs_csr_read,
avs_readdata => avs_csr_readdata
);
--
-- The process manages the registers
--
REG_PROC : process(clk, reset_n) is
begin
if reset_n = '0' then
debug_mode <= '0';
clr_seq_queue <= '0';
clr_seq_queue_exe <= '0';
seq_queue_empty <= '0';
elsif clk'event and clk = '1' then
--
vector_val_cpu <= '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 fsm = s_idle then
debug_mode <= debug_mode_r;
end if;
if (QUEUE_EN = true) then
clr_seq_queue <= clr_seq_queue_r;
clr_seq_queue_exe <= clr_seq_queue_exe_r;
end if;
if(VECT_CPU_EN = true) then
if(fsm = s_idle) and (vector_val_cpu_p = '1') then
vector_val_cpu <= '1';
vector_cpu <= vector_cpu_r;
end if;
end if;
if (ALU_EN = true) and (r1_data_valid_p = '1') then
r1_data <= r1_data_r;
r1_data_valid <= '1';
end if;
if (QUEUE_EN = true) and (seq_queue_w_p = '1') then
queue_add_flag <= '1';
queue_add <= seq_queue_w_r;
end if;
end if;
end process REG_PROC;
seq_cfg_aux(0) <= '1' when ADD_VEC_PIPE = true else '0';
seq_cfg_aux(1) <= '1' when VECT_RAMP_EN = true else '0';
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)));
--pragma translate_off
assert (to_integer(unsigned(trig_sel)) < TRIGGER_WIDTH) report "ERROR: trig_sel out of selectable trigger mask" severity failure;
--pragma translate_on
-----------------------------------------------------------------------------
-- Dual-Port Memory buffer
-----------------------------------------------------------------------------
iRAM : entity work.alt_rw_dp_ram
generic map(
DATA_WIDTH => 32,
DEPTH => SEQ_DEPTH,
REGISTER_OUTPUT => "UNREGISTERED",
READ_WRITE_MODE => "OLD_DATA",
DEVICE_FAMILY => DEVICE_FAMILY
)
port map(
clk => clk,
addr_a => avs_seq_address,
wren_a => avs_seq_write,
wrdata_a => avs_seq_writedata,
rddata_a => avs_seq_readdata,
addr_b => ram_rd_addr,
wren_b => '0',
wrdata_b => (others => '0'),
rddata_b => ram_rd_data
);
-----------------------------------------------------------------------------
-- Sequencer Logic
-----------------------------------------------------------------------------
start_req_i <= start_req and not start_req_d;
-- FSM Status Register
pFSM_SR : process(reset_n, clk)
begin
if (reset_n = '0') then
fsm <= s_idle;
elsif (clk = '1' and clk'event) then
fsm <= fsm_nxt;
opcode <= ram_rd_data(31 downto 28);
end if;
end process pFSM_SR;
-- FSM combinational logic
pFSM_CL : process(all)
begin
-- Default assignments
fsm_nxt <= fsm;
--
decode <= '0';
clr_vec_i <= '0';
ld_vec <= '0';
ld_ramp <= '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;
if (ALU_EN = true) then
alu_upd <= '0';
end if;
if (POS_BUS_EN = true) then
ld_pos <= '0';
end if;
-- Determine next state
if (seq_enable = '0') then
busy_i <= '0';
if (rst_vector_out = '1') then
clr_vec_i <= '1';
end if;
fsm_nxt <= s_idle;
elsif (start_req_i = '1') then
busy_i <= '0';
ld_start_addr <= '1';
fsm_nxt <= s_init;
else
case fsm is
when s_idle =>
busy_i <= '0';
if seq_enable = '1' and start_req_i = '1' then
ld_start_addr <= '1';
fsm_nxt <= s_init;
end if;
when s_init =>
if (rst_vector_out = '1') then
clr_vec_i <= '1';
end if;
fsm_nxt <= s_fetch;
when s_fetch =>
if (fetch_enable = '1') then
inc_ram_addr <= '1';
fetch_op <= '1';
fsm_nxt <= s_decode;
end if;
when s_return =>
fsm_nxt <= s_fetch;
when s_decode =>
decode <= '1';
case opcode is
--
when CMD_NOP => fsm_nxt <= s_fetch;
--
when CMD_TRIG_MASK => fsm_nxt <= s_trig_mask;
when CMD_TRIG_WAIT => fsm_nxt <= s_trig_wait;
when CMD_VEC_SET => fsm_nxt <= s_vec_set;
when CMD_VEC_RAMP_UP => fsm_nxt <= s_vec_ramp;
when CMD_VEC_RAMP_DN => fsm_nxt <= s_vec_ramp;
when CMD_VEC_RAMP => fsm_nxt <= s_vec_ramp;
when CMD_BUS_BURST => fsm_nxt <= s_bus_burst;
when CMD_POS_STORE => fsm_nxt <= s_pos_store;
when CMD_POS_WAIT => fsm_nxt <= s_pos_wait;
when CMD_ALU => fsm_nxt <= s_alu;
when CMD_LOOP => fsm_nxt <= s_loop;
when CMD_JUMP => fsm_nxt <= s_jump;
when CMD_BRANCH => fsm_nxt <= s_branch;
when CMD_RETURN => fsm_nxt <= s_return;
when CMD_END => fsm_nxt <= s_end;
when others => null;
end case;
when s_trig_mask =>
ld_trig_mask <= '1';
fsm_nxt <= s_fetch;
when s_trig_wait =>
if (trig_int = '1') then
inc_op_cnt <= '1';
end if;
if (op_cnt_done = '1') then
fsm_nxt <= s_fetch;
end if;
when s_vec_set =>
ld_vec <= '1';
fsm_nxt <= s_fetch;
when s_vec_ramp =>
if (VECT_RAMP_EN = false) then
fsm_nxt <= s_fetch;
else
if (trig_int = '1') then
inc_op_cnt <= '1';
ld_ramp <= '1';
end if;
if (ramp_done = '1' and ((ramp_to_val = '0' and trig_int = '1') or ramp_to_val = '1')) then
ld_ramp <= '1';
fsm_nxt <= s_fetch;
end if;
end if;
when s_bus_burst =>
if (BUS_BURST_EN = true) then
bus_valid_i <= '1';
if (op_cnt_done = '1' and bus_ack = '1') then
bus_valid_i <= '0';
fsm_nxt <= s_fetch;
elsif (bus_pause = '0') then
inc_ram_addr <= '1';
inc_op_cnt <= '1';
end if;
else
fsm_nxt <= s_fetch;
end if;
when s_pos_store =>
if (POS_BUS_EN = true) then
ld_pos <= '1';
end if;
fsm_nxt <= s_fetch;
when s_pos_wait =>
if (pos_in = pos_target) then
fsm_nxt <= s_fetch;
end if;
when s_alu =>
if (ALU_EN = true) then
alu_upd <= '1';
end if;
fsm_nxt <= s_fetch;
when s_jump | s_branch =>
fsm_nxt <= s_fetch;
when s_loop =>
loop_upd <= '1';
fsm_nxt <= s_fetch;
when s_end =>
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;
end if;
end process pFSM_CL;
ld_trig_sel <= '1' when decode = '1' and (opcode = CMD_TRIG_WAIT or opcode = CMD_VEC_RAMP_UP or opcode = CMD_VEC_RAMP_DN or opcode = CMD_VEC_RAMP) else '0';
--
pSEQ_REGs : process(reset_n, clk)
begin
if (reset_n = '0') then
vector_out_i <= (others => '0');
elsif (clk = '1' and clk'event) then
start_req_d <= start_req;
fetch_enable <= (not debug_mode) or (debug_mode and step_req);
if (fetch_op = '1') then
pc_value <= ram_rd_addr;
end if;
if (fetch_op = '1') then
operand_comp <= ram_rd_data(23 downto 0);
subcode <= ram_rd_data(27 downto 24);
end if;
busy <= busy_i;
if (ld_start_addr = '1') then
ram_rd_addr <= start_addr;
elsif (ld_jmp_addr = '1') then
ram_rd_addr <= jump_addr;
elsif (ld_ret_addr = '1') then
ram_rd_addr <= return_addr;
elsif (inc_ram_addr = '1') then
ram_rd_addr <= std_logic_vector(unsigned(ram_rd_addr) + 1);
end if;
if (ld_trig_mask = '1') then
trig_mask <= operand_comp(TRIGGER_WIDTH - 1 downto 0);
end if;
if (ld_trig_sel = '1') then
trig_sel <= subcode;
end if;
if (ld_vec = '1' and subcode = "0001") then
clr_vec_ii <= '1';
else
clr_vec_ii <= '0';
end if;
if (clr_vec = '1') then
vector_out_i <= (others => '0');
elsif (ld_vec = '1') then
vector_out_i <= operand_comp(VECTOR_WIDTH - 1 downto 0);
elsif(VECT_RAMP_EN = true and ld_ramp = '1') then
if(ramp_up = '1' and ramp_next(ramp_next'high) = '0' and vector_out_i(ramp_next'high) = '1') then
vector_out_i(RAMP_WIDTH-1 downto 0) <= (others => '1');
elsif(ramp_up = '0' and ramp_next(ramp_next'high) = '1' and vector_out_i(ramp_next'high) = '0') then
vector_out_i(RAMP_WIDTH-1 downto 0) <= (others => '0');
elsif(ramp_to_val = '1' and ramp_done = '1') then
vector_out_i(RAMP_WIDTH-1 downto 0) <= ramp_final;
else
vector_out_i(RAMP_WIDTH-1 downto 0) <= ramp_next;
end if;
elsif (VECT_CPU_EN = true and vector_val_cpu = '1') then
vector_out_i <= vector_cpu;
end if;
if(VECT_RAMP_EN = true and decode = '1') then
if(opcode = CMD_VEC_RAMP) then
ramp_to_val <= '1';
else
ramp_to_val <= '0';
end if;
end if;
if (save_ret_addr = '1') then
return_addr <= ram_rd_addr;
end if;
if (decode = '1') then
op_cnt <= (others => '0');
elsif (inc_op_cnt = '1') then
op_cnt <= std_logic_vector(unsigned(op_cnt) + 1);
end if;
if (start_req_i = '1' or (loop_done = '1' and loop_upd = '1')) then
loop_active <= '0';
elsif (decode = '1' and opcode = CMD_LOOP) then
loop_active <= '1';
end if;
if (loop_active = '0' and opcode = CMD_LOOP) then
loop_cnt <= (others => '0');
elsif (loop_upd = '1') then
loop_cnt <= std_logic_vector(unsigned(loop_cnt) + 1);
end if;
end if;
end process pSEQ_REGs;
loop_done <= '1' when unsigned(loop_cnt) = unsigned(operand_2) else '0';
operand_1 <= operand_comp(11 downto 0);
operand_2 <= operand_comp(23 downto 12);
clr_vec <= clr_vec_i or clr_vec_ii;
op_cnt_done <= '1' when op_cnt = operand_1 else '0';
jump_addr_ext <= operand_1 when jump_abs = '1' else
std_logic_vector(signed('0' & ram_rd_addr) + signed(operand_1) - 1) when jump_rel = '1' else
r1;
jump_addr <= jump_addr_ext(jump_addr'range);
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 zero_flag = '1') or (subcode = X"2" and zero_flag = '0'))) 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 zero_flag = '1') or (subcode = X"2" and zero_flag = '0'))) 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';
-----------------------------------------------------------------------------
-- Others - Generics dependent
-----------------------------------------------------------------------------
gVECT_NO_PIPE : if ADD_VEC_PIPE = false generate
vector_out <= vector_out_i;
end generate gVECT_NO_PIPE;
gVECT_PIPE : if ADD_VEC_PIPE = true generate
pVECT_PIPE : process(clk)
begin
if (clk = '1' and clk'event) then
vector_out <= vector_out_i;
end if;
end process pVECT_PIPE;
end generate gVECT_PIPE;
gRAMP_GEN : if VECT_RAMP_EN = true generate
gRAMP_FINAL: if RAMP_WIDTH > 12 generate
ramp_final <= operand_1 & std_logic_vector(to_unsigned(0, RAMP_WIDTH-12));
else generate
ramp_final <= operand_1(RAMP_WIDTH-1 downto 0);
end generate gRAMP_FINAL;
ramp_done <= '1' when (ramp_to_val = '0' and op_cnt_done = '1') or ramp_to_val_last = '1' else '0';
ramp_curr <= vector_out_i(ramp_curr'range);
ramp_next <= std_logic_vector(unsigned(ramp_curr) + unsigned(operand_2)) when ramp_up = '1' else
std_logic_vector(unsigned(ramp_curr) - unsigned(operand_2));
ramp_diff <= std_logic_vector(signed('0' & ramp_final) - signed('0' & ramp_curr));
ramp_to_val_last <= '1' when ramp_to_val = '1' and ((ramp_diff(ramp_diff'left) xor ramp_diff_top) = '1' or signed(ramp_diff) = 0) else '0';
pRAMP_REGs : process(clk)
begin
if (clk = '1' and clk'event) then
if (decode = '1') then
if (opcode = CMD_VEC_RAMP_UP) then
ramp_up <= '1';
else
ramp_up <= '0';
end if;
elsif(ramp_to_val = '1') then
ramp_up <= not ramp_diff(ramp_diff'left);
end if;
if(decode = '1' or inc_op_cnt = '1') then
ramp_diff_top <= ramp_diff(ramp_diff'left);
end if;
end if;
end process pRAMP_REGs;
end generate gRAMP_GEN;
gRAMP_NOGEN : if VECT_RAMP_EN = false generate
ramp_up <= '0';
ramp_done <= '0';
ramp_curr <= (others => '0');
ramp_next <= (others => '0');
ramp_diff <= (others => '0');
ramp_final <= (others => '0');
end generate gRAMP_NOGEN;
gBUS_BURST_GEN : if BUS_BURST_EN = true generate
pBURST_REGs : process(clk)
begin
if (clk = '1' and clk'event) then
bus_valid <= bus_valid_i and not (bus_ack and bus_pause);
bus_pause <= bus_valid_i and (not bus_ack or inc_ram_addr);
if (seq_enable = '0') then
bus_data <= (others => '0');
elsif (bus_valid_i = '1' and (bus_pause = '0' or bus_ack = '1')) then
bus_data <= ram_rd_data(BUS_WIDTH - 1 downto 0);
end if;
end if;
end process pBURST_REGs;
end generate gBUS_BURST_GEN;
gBUS_BURST_NOGEN : if BUS_BURST_EN = false generate
bus_valid <= '0';
bus_pause <= '0';
bus_data <= (others => '0');
end generate gBUS_BURST_NOGEN;
gPOS_GEN : if POS_BUS_EN = true generate
pPOS_REGs : process(clk)
begin
if (clk = '1' and clk'event) then
if (ld_pos = '1') then
pos_store <= pos_in;
end if;
if (decode = '1') then
case subcode is
when X"0" =>
pos_target <= operand_comp(pos_in'range);
when X"1" =>
pos_target <= std_logic_vector(signed(pos_in) + signed(operand_comp(pos_in'range)));
when X"2" =>
pos_target <= pos_store;
when X"3" =>
pos_target <= std_logic_vector(signed(pos_store) + signed(operand_comp(pos_in'range)));
when others => null;
end case;
end if;
end if;
end process pPOS_REGs;
end generate gPOS_GEN;
gALU_GEN : if ALU_EN = true generate
pALU_REGs : process(clk)
variable r1_next : std_logic_vector(11 downto 0);
begin
if (clk = '1' and clk'event) then
-- Update ALU register R1
if (busy_i = '0' and r1_data_valid = '1') then
r1 <= R1_data;
elsif (alu_upd = '1') then
case subcode is
when x"2" =>
r1_next := operand_1;
when x"3" =>
r1_next := std_logic_vector(signed(r1) + signed(operand_1));
when x"4" =>
r1_next := std_logic_vector(signed(r1) - signed(operand_1));
when others => null;
end case;
r1 <= r1_next;
end if;
-- Update ALU flag
if (alu_upd = '1') then
case subcode is
when x"0" =>
if ((trigger_in(TRIGGER_WIDTH - 1 downto 0) and trig_mask(TRIGGER_WIDTH - 1 downto 0)) = (operand_comp(TRIGGER_WIDTH - 1 downto 0) and trig_mask(TRIGGER_WIDTH - 1 downto 0))) then
zero_flag <= '1';
else
zero_flag <= '0';
end if;
when x"1" =>
if (r1 = operand_1) then
zero_flag <= '1';
else
zero_flag <= '0';
end if;
when x"2" | x"3" | x"4" =>
if (signed(r1_next) = 0) then
zero_flag <= '1';
else
zero_flag <= '0';
end if;
when others => null;
end case;
end if;
end if;
end process pALU_REGs;
end generate gALU_GEN;
gALU_NOGEN : if ALU_EN = false generate
r1 <= (others => '0');
zero_flag <= '0';
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;

View file

@ -0,0 +1,44 @@
-------------------------------------------------------------------------------
-- Title : generic_sequencer_17_cmd_pkg
-- Project : Generic IPs
-------------------------------------------------------------------------------
-- File : generic_sequencer_17_cmd_pkg.vhd
-- Author : GMG
-- Company : Global Inkjet Systems
-- Created : 2018-01-17
-- Last update: 2021-01-14
-- SVN ID : Git
-- Standard : VHDL'2008
-------------------------------------------------------------------------------
-- Description:
-- Package defining commmands for generic_sequencer_17 core
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use work.common_pkg.all;
package generic_sequencer_17_cmd_pkg is
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_VEC_RAMP : std_logic_vector(3 downto 0) := x"9";
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_17_cmd_pkg;

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,2 @@
Major version 2 of the protocol uses autogenerated registers and by using the generic PROTOCOL_VER
the user can select which version of the pof protocol they want to use.

View file

@ -0,0 +1,150 @@
[{
"ip_name": "pof_tx_2",
"bus": "csr",
"addr_width" : "3",
"description": "POF-Transmitter",
"registers": {
"control" : {
"address" : "0",
"width" : "12",
"description" : "Control register",
"fields": {
"enable" : {
"type" : "w",
"bit_len" : "1",
"reset" : "0x0",
"description" : "POF-Tx enable"
},
"Reserved0" : {
"type" : "rsv",
"bit_len" : "1",
"description" : "Reserved bits"
},
"clr_fifo_level_max" : {
"type" : "w0",
"bit_len" : "1",
"reset" : "0x0",
"description" : "Clears the fifo_level maximum value to zero"
},
"Reserved1" : {
"type" : "rsv",
"bit_len" : "1",
"description" : "Reserved bits"
},
"bit_div" : {
"type" : "w",
"bit_len" : "4",
"reset" : "0x2",
"description" : "UART-Tx bit-rate division ratio"
},
"print_start_event_gen" : {
"type" : "w",
"bit_len" : "1",
"reset" : "0x0",
"description" : "Enables queuing up events in the POF-Tx FIFO, each time there is a change in Print-Start value. Only used when PROTOCOL_VERSION=1"
},
"print_start_src" : {
"type" : "w",
"bit_len" : "1",
"reset" : "0x0",
"description" : "Specifies the source of Print-Start: 0 => input pin, 1 => software driven (print_start_sw). Only used when PROTOCOL_VERSION=1"
},
"print_start_sw" : {
"type" : "w",
"bit_len" : "1",
"reset" : "0x0",
"description" : "Specifies the value of Print-Start when print_start_src = 1. Only used when PROTOCOL_VERSION=1"
},
"Reserved2" : {
"type" : "rsv",
"bit_len" : "1",
"description" : "Reserved bits"
}
}
},
"status" : {
"address" : "1",
"width" : "12",
"description" : "Status register",
"fields": {
"Reserved0" : {
"type" : "rsv",
"bit_len" : "1",
"description" : "Resereved bits"
},
"ovfl_err" : {
"type" : "r",
"bit_len" : "1",
"reset" : "0x0",
"description" : "Overflow error"
},
"Reserved1" : {
"type" : "rsv",
"bit_len" : "9",
"description" : "Reserved bits"
},
"print_start_val" : {
"type" : "r",
"bit_len" : "1",
"reset" : "0x0",
"description" : "Print-Start status. Only used when PROTOCOL_VERSION=1"
}
}
},
"error_inject" : {
"address" : "2",
"width" : "1",
"type" : "w0",
"reset" : "0x0",
"description" : "Inject a parity error on the next transmitted data"
},
"timing" : {
"address" : "3",
"width" : "26",
"description" : "Timing Constants",
"fields": {
"keepalive_period" : {
"type" : "w",
"bit_len" : "10",
"reset" : "0x64",
"description" : "Specifies the keep-alive period"
},
"Reserved" : {
"type" : "rsv",
"bit_len" : "6",
"description" : "Reserved bits"
},
"init_blocked_period" : {
"type" : "w",
"bit_len" : "10",
"reset" : "0xC8",
"description" : "Specifies a guard period for the first event after an init pulse"
}
}
},
"fifo_level" : {
"address" : "4",
"width" : "26",
"description" : "Monitors FIFO level status",
"fields": {
"fifo_level" : {
"type" : "r",
"bit_len" : "10",
"reset" : "0x0",
"description" : "current value of fifo_level"
},
"Reserved" : {
"type" : "rsv",
"bit_len" : "6",
"description" : "Reserved bits"
},
"max_fifo_level" : {
"type" : "r",
"bit_len" : "10",
"reset" : "0x0",
"description" : "maximum value for fifo_level"
}
}
}
}
}]

View file

@ -0,0 +1,80 @@
# 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 COMMON_PATH ../../../common/0/src
set OSVVM_PATH $COMMON_PATH/test/OSVVM
set WORKLIB work
vlib ./work
vmap work ./work
if {$COMP_ONLY == 0} {
# Compile the constrained random related packages
vlib OSVVM
vcom -2008 -work OSVVM \
$OSVVM_PATH/RandomBasePkg.vhd \
$OSVVM_PATH/SortListPkg_int.vhd \
$OSVVM_PATH/RandomPkg.vhd \
$OSVVM_PATH/NamePkg.vhd \
$OSVVM_PATH/MessagePkg.vhd \
$OSVVM_PATH/CoveragePkg.vhd
}
# compile the UUTs:
#vcom -2008 -work $WORKLIB $COMMON_PATH/pkg_functions.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/common_pkg.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/sync_wire.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/sync_wire_redge.vhd
--vcom -2008 -work $WORKLIB ../src/altera/fifo_16x8.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/altera/sync_fifo.vhd
vcom -2008 -work $WORKLIB ../src/pof_tx_2_pkg_auto.vhd
vcom -2008 -work $WORKLIB ../src/pof_tx_2_csr_regs_auto.vhd
vcom -2008 -work $WORKLIB ../src/uart_tx_2.vhd
vcom -2008 -work $WORKLIB ../src/pof_uart_rx_2.vhd
vcom -2008 -work $WORKLIB ../src/pof_tx_2.vhd
vcom -2008 -work $WORKLIB ../src//pof_rx_2.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/pof_tx_rx_2_one_tb.vhd
vsim -t ps work.pof_tx_rx_2_one_tb
add wave /pof_tx_rx_2_one_tb/*
add wave /pof_tx_rx_2_one_tb/iPOF_TX/*
add wave /pof_tx_rx_2_one_tb/iPOF_RX/*
# remove warnings from standard numeric/arithmetic packages (speed-up simulation)
set StdArithNoWarnings 1
set NumericStdNoWarnings 1
do wave_pof_txrx_one.do
when -label end_of_simulation {test_completed == true} {echo "Simulation Completed"; stop ;}
run -all
#run 1 ms;
}

View file

@ -0,0 +1,80 @@
# 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 COMMON_PATH ../../../common/0/src
set OSVVM_PATH $COMMON_PATH/test/OSVVM
set WORKLIB work
vlib ./work
vmap work ./work
if {$COMP_ONLY == 0} {
# Compile the constrained random related packages
vlib OSVVM
vcom -2008 -work OSVVM \
$OSVVM_PATH/RandomBasePkg.vhd \
$OSVVM_PATH/SortListPkg_int.vhd \
$OSVVM_PATH/RandomPkg.vhd \
$OSVVM_PATH/NamePkg.vhd \
$OSVVM_PATH/MessagePkg.vhd \
$OSVVM_PATH/CoveragePkg.vhd
}
# compile the UUTs:
#vcom -2008 -work $WORKLIB $COMMON_PATH/pkg_functions.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/common_pkg.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/sync_wire.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/sync_wire_redge.vhd
#vcom -2008 -work $WORKLIB ../src/altera/fifo_16x8.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/altera/sync_fifo.vhd
vcom -2008 -work $WORKLIB ../src/pof_tx_2_pkg_auto.vhd
vcom -2008 -work $WORKLIB ../src/pof_tx_2_csr_regs_auto.vhd
vcom -2008 -work $WORKLIB ../src/uart_tx_2.vhd
vcom -2008 -work $WORKLIB ../src/pof_uart_rx_2.vhd
vcom -2008 -work $WORKLIB ../src/pof_tx_2.vhd
vcom -2008 -work $WORKLIB ../src/pof_rx_2.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/pof_tx_rx_2_zero_tb.vhd
vsim -t ps work.pof_tx_rx_2_zero_tb
add wave /pof_tx_rx_2_zero_tb/*
add wave /pof_tx_rx_2_zero_tb/iPOF_TX/*
add wave /pof_tx_rx_2_zero_tb/iPOF_RX/*
# remove warnings from standard numeric/arithmetic packages (speed-up simulation)
set StdArithNoWarnings 1
set NumericStdNoWarnings 1
do wave_pof_txrx_zero.do
when -label end_of_simulation {test_completed == true} {echo "Simulation Completed"; stop ;}
run -all
#run 1 ms;
}

View file

@ -0,0 +1,228 @@
onerror {resume}
quietly WaveActivateNextPane {} 0
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/clk
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/reset_n
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/avs_read
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/avs_write
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/sel_slave_0
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/sel_slave_1
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/avs_write_sl0
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/avs_read_sl0
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/avs_write_sl1
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/avs_read_sl1
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/init_tx
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/init_rx
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/dir_in
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/pd_in
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/inc_pos
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/dec_pos
add wave -noupdate -expand -group TB -radix decimal /pof_tx_rx_2_one_tb/abs_position
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/tx_data
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/rx_data
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/init_out
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/dir_out
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/enc_out
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/pd_out
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/inc_pos_out
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/dec_pos_out
add wave -noupdate -expand -group TB -radix decimal /pof_tx_rx_2_one_tb/abs_pos_out
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/print_start_in
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/print_start_out
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/ps_flip_cnt
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/test_completed
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/running
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/configuring
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/passed
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/failed
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/stimuli_completed
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/avs_address
add wave -noupdate -expand -group TB -radix hexadecimal /pof_tx_rx_2_one_tb/avs_writedata
add wave -noupdate -expand -group TB -radix hexadecimal /pof_tx_rx_2_one_tb/avs_readdata_sl0
add wave -noupdate -expand -group TB -radix hexadecimal /pof_tx_rx_2_one_tb/avs_readdata_sl1
add wave -noupdate -expand -group TB -radix decimal /pof_tx_rx_2_one_tb/abs_position_d
add wave -noupdate -expand -group TB -radix decimal /pof_tx_rx_2_one_tb/swathe_pos
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/swathe_cnt
add wave -noupdate -expand -group TB -radix hexadecimal /pof_tx_rx_2_one_tb/avs_m
add wave -noupdate -expand -group TB -radix hexadecimal /pof_tx_rx_2_one_tb/avs_s
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/detected_error
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/dir_discr_cnt
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/pd_discr_cnt
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/pd_in_cnt
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/pd_out_cnt
add wave -noupdate -expand -group TB -radix decimal /pof_tx_rx_2_one_tb/abs_position
add wave -noupdate -expand -group TB -radix decimal /pof_tx_rx_2_one_tb/abs_pos_out
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/pos_discr_cnt
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/end_of_swathe
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/enc_pulse_cnt
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/dir_err
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/pd_err
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/pos_err
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/enc_err
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/ovfl_err
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/ps_err
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/injected_errors
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/sent_packets
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/injected_error_type
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/max_pos
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/min_pos
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/exp_enc_pulse
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/exp_enc_cnt
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/error_rate_thres
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/one_pps
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/max_error_flag
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/rx_watchdog
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/rx_watchdog_en
add wave -noupdate -expand -group TB /pof_tx_rx_2_one_tb/rx_watchdog_clr
add wave -noupdate -group POF-Tx /pof_tx_rx_2_one_tb/iPOF_TX/reset_n
add wave -noupdate -group POF-Tx /pof_tx_rx_2_one_tb/iPOF_TX/clk
add wave -noupdate -group POF-Tx /pof_tx_rx_2_one_tb/iPOF_TX/init
add wave -noupdate -group POF-Tx /pof_tx_rx_2_one_tb/iPOF_TX/pd_in
add wave -noupdate -group POF-Tx /pof_tx_rx_2_one_tb/iPOF_TX/inc_pos
add wave -noupdate -group POF-Tx /pof_tx_rx_2_one_tb/iPOF_TX/dec_pos
add wave -noupdate -group POF-Tx -radix decimal /pof_tx_rx_2_one_tb/iPOF_TX/abs_position
add wave -noupdate -group POF-Tx /pof_tx_rx_2_one_tb/iPOF_TX/tx_data
add wave -noupdate -group POF-Tx /pof_tx_rx_2_one_tb/iPOF_TX/avs_address
add wave -noupdate -group POF-Tx /pof_tx_rx_2_one_tb/iPOF_TX/avs_write
add wave -noupdate -group POF-Tx /pof_tx_rx_2_one_tb/iPOF_TX/avs_writedata
add wave -noupdate -group POF-Tx /pof_tx_rx_2_one_tb/iPOF_TX/avs_read
add wave -noupdate -group POF-Tx /pof_tx_rx_2_one_tb/iPOF_TX/avs_readdata
add wave -noupdate -group POF-Tx /pof_tx_rx_2_one_tb/iPOF_TX/rd_event
add wave -noupdate -group POF-Tx /pof_tx_rx_2_one_tb/iPOF_TX/wr_event
add wave -noupdate -group POF-Tx /pof_tx_rx_2_one_tb/iPOF_TX/empty
add wave -noupdate -group POF-Tx /pof_tx_rx_2_one_tb/iPOF_TX/full
add wave -noupdate -group POF-Tx /pof_tx_rx_2_one_tb/iPOF_TX/tx_ready
add wave -noupdate -group POF-Tx /pof_tx_rx_2_one_tb/iPOF_TX/rd_event_d
add wave -noupdate -group POF-Tx /pof_tx_rx_2_one_tb/iPOF_TX/wr_event_i
add wave -noupdate -group POF-Tx /pof_tx_rx_2_one_tb/iPOF_TX/enable
add wave -noupdate -group POF-Tx /pof_tx_rx_2_one_tb/iPOF_TX/toggle_sync
add wave -noupdate -group POF-Tx /pof_tx_rx_2_one_tb/iPOF_TX/toggle_pd
add wave -noupdate -group POF-Tx /pof_tx_rx_2_one_tb/iPOF_TX/add_keepalive
add wave -noupdate -group POF-Tx /pof_tx_rx_2_one_tb/iPOF_TX/ovfl_err
add wave -noupdate -group POF-Tx /pof_tx_rx_2_one_tb/iPOF_TX/init_d
add wave -noupdate -group POF-Tx /pof_tx_rx_2_one_tb/iPOF_TX/init_gen
add wave -noupdate -group POF-Tx /pof_tx_rx_2_one_tb/iPOF_TX/init_v
add wave -noupdate -group POF-Tx /pof_tx_rx_2_one_tb/iPOF_TX/init_blocked
add wave -noupdate -group POF-Tx /pof_tx_rx_2_one_tb/iPOF_TX/init_blk_cnt
add wave -noupdate -group POF-Tx /pof_tx_rx_2_one_tb/iPOF_TX/parity_bit
add wave -noupdate -group POF-Tx /pof_tx_rx_2_one_tb/iPOF_TX/inject_error
add wave -noupdate -group POF-Tx /pof_tx_rx_2_one_tb/iPOF_TX/inject_error_req
add wave -noupdate -group POF-Tx /pof_tx_rx_2_one_tb/iPOF_TX/pd_event
add wave -noupdate -group POF-Tx /pof_tx_rx_2_one_tb/iPOF_TX/pd_event_d
add wave -noupdate -group POF-Tx /pof_tx_rx_2_one_tb/iPOF_TX/pd_event_dd
add wave -noupdate -group POF-Tx /pof_tx_rx_2_one_tb/iPOF_TX/gray
add wave -noupdate -group POF-Tx /pof_tx_rx_2_one_tb/iPOF_TX/clear
add wave -noupdate -group POF-Tx /pof_tx_rx_2_one_tb/iPOF_TX/pd_in_d
add wave -noupdate -group POF-Tx /pof_tx_rx_2_one_tb/iPOF_TX/pd_gen
add wave -noupdate -group POF-Tx /pof_tx_rx_2_one_tb/iPOF_TX/clk
add wave -noupdate -group POF-Tx /pof_tx_rx_2_one_tb/iPOF_TX/symbol_valid
add wave -noupdate -group POF-Tx /pof_tx_rx_2_one_tb/iPOF_TX/symbol
add wave -noupdate -group POF-Tx /pof_tx_rx_2_one_tb/iPOF_TX/clr_fifo_lmax
add wave -noupdate -group POF-Tx -radix unsigned /pof_tx_rx_2_one_tb/iPOF_TX/keepalive_period
add wave -noupdate -group POF-Tx -radix unsigned /pof_tx_rx_2_one_tb/iPOF_TX/init_blocked_period
add wave -noupdate -group POF-Tx -radix unsigned /pof_tx_rx_2_one_tb/iPOF_TX/fifo_level
add wave -noupdate -group POF-Tx -radix unsigned /pof_tx_rx_2_one_tb/iPOF_TX/fifo_level_max
add wave -noupdate -group POF-Tx /pof_tx_rx_2_one_tb/iPOF_TX/tx_data
add wave -noupdate -group POF-Tx /pof_tx_rx_2_one_tb/iPOF_TX/event_in_i
add wave -noupdate -group POF-Tx /pof_tx_rx_2_one_tb/iPOF_TX/event_in
add wave -noupdate -group POF-Tx /pof_tx_rx_2_one_tb/iPOF_TX/event_out
add wave -noupdate -group POF-Tx -radix decimal /pof_tx_rx_2_one_tb/iPOF_TX/keepalive_cnt
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/reset_n
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/clk
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/init
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/rx_clk
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/rx_data
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/init_out
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/pd_out
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/inc_pos
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/dec_pos
add wave -noupdate -group POF-Rx -radix decimal /pof_tx_rx_2_one_tb/iPOF_RX/abs_pos
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/print_start_out
add wave -noupdate -group POF-Rx -radix unsigned /pof_tx_rx_2_one_tb/iPOF_RX/error_rate_thres
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/one_pps
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/max_error_flag
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/rx_watchdog
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/rx_watchdog_en
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/rx_watchdog_clr
add wave -noupdate -group POF-Rx -radix unsigned /pof_tx_rx_2_one_tb/iPOF_RX/rx_wd_cnt
add wave -noupdate -group POF-Rx -radix unsigned /pof_tx_rx_2_one_tb/iPOF_RX/error_rate_cnt
add wave -noupdate -group POF-Rx -radix unsigned /pof_tx_rx_2_one_tb/iPOF_RX/error_rate
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/clear
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/clear_i
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/inc_pos_i
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/dec_pos_i
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/enable
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/sync_gen
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/pd_gen
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/symbol_error
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/rx_symbol_val
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/rx_symbol
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/rx_symbol_val_v
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/symbol_valid_i
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/symbol_valid_d
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/toggle_sync
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/sync_confirmed
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/sync_toggle_test
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/sync
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/toggle_pd
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/pd_confirmed
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/pd_toggle_test
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/pd
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/print_start_in
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/print_start_out
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/ps_flip_cnt
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/ps_gen
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/ps_new
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/ps_confirmed
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/ps_test
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/rx_error
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/rx_error_i
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/print_start_i
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/valid_pos
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/upd_pos
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/corr_done
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/corr_sign
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/skip_cnt
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/skip_pos
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/symbol_valid
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/symbol
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/apply_corr
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/clk_cnt
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/dist
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/abs_dist
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/next_pos_lsb
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/curr_pos_lsb
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/pos_corr
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/max_dist
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/gray_pos
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/symbol_i
add wave -noupdate -group POF-Rx -radix unsigned /pof_tx_rx_2_one_tb/iPOF_RX/parity_err_cnt
add wave -noupdate -group POF-Rx -radix decimal /pof_tx_rx_2_one_tb/iPOF_RX/abs_pos_i
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/inc_pos_ii
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/dec_pos_ii
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/GEN_RX_SYMBOL/iRX_SYMBOL/data_width
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/GEN_RX_SYMBOL/iRX_SYMBOL/reset_n
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/GEN_RX_SYMBOL/iRX_SYMBOL/clk
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/GEN_RX_SYMBOL/iRX_SYMBOL/init
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/GEN_RX_SYMBOL/iRX_SYMBOL/data_out
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/GEN_RX_SYMBOL/iRX_SYMBOL/data_out_valid
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/GEN_RX_SYMBOL/iRX_SYMBOL/rx_data
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/GEN_RX_SYMBOL/iRX_SYMBOL/rx_data_i
add wave -noupdate -group POF-Rx /pof_tx_rx_2_one_tb/iPOF_RX/GEN_RX_SYMBOL/iRX_SYMBOL/data
TreeUpdate [SetDefaultTree]
WaveRestoreCursors {{Cursor 1} {1338555000 ps} 0}
quietly wave cursor active 1
configure wave -namecolwidth 305
configure wave -valuecolwidth 100
configure wave -justifyvalue left
configure wave -signalnamewidth 0
configure wave -snapdistance 10
configure wave -datasetprefix 0
configure wave -rowmargin 4
configure wave -childrowmargin 2
configure wave -gridoffset 0
configure wave -gridperiod 1
configure wave -griddelta 40
configure wave -timeline 0
configure wave -timelineunits ps
update
WaveRestoreZoom {4636240802 ps} {7857466274 ps}

View file

@ -0,0 +1,219 @@
onerror {resume}
quietly WaveActivateNextPane {} 0
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/rx_watchdog_clr
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/rx_watchdog_en
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/rx_watchdog
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/max_error_flag
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/one_pps
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/error_rate_thres
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/exp_enc_cnt
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/exp_enc_pulse
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/min_pos
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/max_pos
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/injected_errors
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/sent_packets
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/injected_error_type
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/ovfl_err
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/enc_err
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/pos_err
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/pd_err
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/dir_err
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/enc_pulse_cnt
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/end_of_swathe
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/pos_discr_cnt
add wave -noupdate -expand -group TB -radix decimal /pof_tx_rx_2_zero_tb/abs_pos_out
add wave -noupdate -expand -group TB -radix decimal /pof_tx_rx_2_zero_tb/abs_position
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/pd_out_cnt
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/pd_in_cnt
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/pd_discr_cnt
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/dir_discr_cnt
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/detected_error
add wave -noupdate -expand -group TB -radix hexadecimal /pof_tx_rx_2_zero_tb/avs_s
add wave -noupdate -expand -group TB -radix hexadecimal /pof_tx_rx_2_zero_tb/avs_m
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/swathe_cnt
add wave -noupdate -expand -group TB -radix decimal /pof_tx_rx_2_zero_tb/swathe_pos
add wave -noupdate -expand -group TB -radix decimal /pof_tx_rx_2_zero_tb/abs_position_d
add wave -noupdate -expand -group TB -radix hexadecimal /pof_tx_rx_2_zero_tb/avs_readdata_sl1
add wave -noupdate -expand -group TB -radix hexadecimal /pof_tx_rx_2_zero_tb/avs_readdata_sl0
add wave -noupdate -expand -group TB -radix hexadecimal /pof_tx_rx_2_zero_tb/avs_writedata
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/avs_address
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/stimuli_completed
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/failed
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/passed
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/configuring
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/running
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/test_completed
add wave -noupdate -expand -group TB -radix decimal /pof_tx_rx_2_zero_tb/abs_pos_out
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/dec_pos_out
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/inc_pos_out
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/pd_out
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/enc_out
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/dir_out
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/init_out
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/rx_data
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/tx_data
add wave -noupdate -expand -group TB -radix decimal /pof_tx_rx_2_zero_tb/abs_position
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/dec_pos
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/inc_pos
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/pd_in
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/dir_in
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/init_rx
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/init_tx
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/avs_read_sl1
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/avs_write_sl1
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/avs_read_sl0
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/avs_write_sl0
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/sel_slave_1
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/sel_slave_0
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/avs_write
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/avs_read
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/clk
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/reset_n
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/injected_errors
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/sent_packets
add wave -noupdate -expand -group TB /pof_tx_rx_2_zero_tb/injected_error_type
add wave -noupdate -group POF-Tx /pof_tx_rx_2_zero_tb/iPOF_TX/reset_n
add wave -noupdate -group POF-Tx /pof_tx_rx_2_zero_tb/iPOF_TX/clk
add wave -noupdate -group POF-Tx /pof_tx_rx_2_zero_tb/iPOF_TX/init
add wave -noupdate -group POF-Tx /pof_tx_rx_2_zero_tb/iPOF_TX/pd_in
add wave -noupdate -group POF-Tx /pof_tx_rx_2_zero_tb/iPOF_TX/inc_pos
add wave -noupdate -group POF-Tx /pof_tx_rx_2_zero_tb/iPOF_TX/dec_pos
add wave -noupdate -group POF-Tx -radix decimal /pof_tx_rx_2_zero_tb/iPOF_TX/abs_position
add wave -noupdate -group POF-Tx /pof_tx_rx_2_zero_tb/iPOF_TX/tx_data
add wave -noupdate -group POF-Tx /pof_tx_rx_2_zero_tb/iPOF_TX/avs_address
add wave -noupdate -group POF-Tx /pof_tx_rx_2_zero_tb/iPOF_TX/avs_write
add wave -noupdate -group POF-Tx /pof_tx_rx_2_zero_tb/iPOF_TX/avs_writedata
add wave -noupdate -group POF-Tx /pof_tx_rx_2_zero_tb/iPOF_TX/avs_read
add wave -noupdate -group POF-Tx /pof_tx_rx_2_zero_tb/iPOF_TX/avs_readdata
add wave -noupdate -group POF-Tx /pof_tx_rx_2_zero_tb/iPOF_TX/rd_event
add wave -noupdate -group POF-Tx /pof_tx_rx_2_zero_tb/iPOF_TX/wr_event
add wave -noupdate -group POF-Tx /pof_tx_rx_2_zero_tb/iPOF_TX/empty
add wave -noupdate -group POF-Tx /pof_tx_rx_2_zero_tb/iPOF_TX/full
add wave -noupdate -group POF-Tx /pof_tx_rx_2_zero_tb/iPOF_TX/tx_ready
add wave -noupdate -group POF-Tx /pof_tx_rx_2_zero_tb/iPOF_TX/rd_event_d
add wave -noupdate -group POF-Tx /pof_tx_rx_2_zero_tb/iPOF_TX/wr_event_i
add wave -noupdate -group POF-Tx /pof_tx_rx_2_zero_tb/iPOF_TX/enable
add wave -noupdate -group POF-Tx /pof_tx_rx_2_zero_tb/iPOF_TX/toggle_sync
add wave -noupdate -group POF-Tx /pof_tx_rx_2_zero_tb/iPOF_TX/toggle_pd
add wave -noupdate -group POF-Tx /pof_tx_rx_2_zero_tb/iPOF_TX/add_keepalive
add wave -noupdate -group POF-Tx /pof_tx_rx_2_zero_tb/iPOF_TX/ovfl_err
add wave -noupdate -group POF-Tx /pof_tx_rx_2_zero_tb/iPOF_TX/init_d
add wave -noupdate -group POF-Tx /pof_tx_rx_2_zero_tb/iPOF_TX/init_gen
add wave -noupdate -group POF-Tx /pof_tx_rx_2_zero_tb/iPOF_TX/init_v
add wave -noupdate -group POF-Tx /pof_tx_rx_2_zero_tb/iPOF_TX/init_blocked
add wave -noupdate -group POF-Tx /pof_tx_rx_2_zero_tb/iPOF_TX/init_blk_cnt
add wave -noupdate -group POF-Tx /pof_tx_rx_2_zero_tb/iPOF_TX/parity_bit
add wave -noupdate -group POF-Tx /pof_tx_rx_2_zero_tb/iPOF_TX/inject_error
add wave -noupdate -group POF-Tx /pof_tx_rx_2_zero_tb/iPOF_TX/inject_error_req
add wave -noupdate -group POF-Tx /pof_tx_rx_2_zero_tb/iPOF_TX/pd_event
add wave -noupdate -group POF-Tx /pof_tx_rx_2_zero_tb/iPOF_TX/pd_event_d
add wave -noupdate -group POF-Tx /pof_tx_rx_2_zero_tb/iPOF_TX/pd_event_dd
add wave -noupdate -group POF-Tx /pof_tx_rx_2_zero_tb/iPOF_TX/gray
add wave -noupdate -group POF-Tx /pof_tx_rx_2_zero_tb/iPOF_TX/clear
add wave -noupdate -group POF-Tx /pof_tx_rx_2_zero_tb/iPOF_TX/pd_in_d
add wave -noupdate -group POF-Tx /pof_tx_rx_2_zero_tb/iPOF_TX/pd_gen
add wave -noupdate -group POF-Tx /pof_tx_rx_2_zero_tb/iPOF_TX/clk
add wave -noupdate -group POF-Tx /pof_tx_rx_2_zero_tb/iPOF_TX/symbol_valid
add wave -noupdate -group POF-Tx /pof_tx_rx_2_zero_tb/iPOF_TX/symbol
add wave -noupdate -group POF-Tx /pof_tx_rx_2_zero_tb/iPOF_TX/clr_fifo_lmax
add wave -noupdate -group POF-Tx -radix unsigned /pof_tx_rx_2_zero_tb/iPOF_TX/keepalive_period
add wave -noupdate -group POF-Tx -radix unsigned /pof_tx_rx_2_zero_tb/iPOF_TX/init_blocked_period
add wave -noupdate -group POF-Tx -radix unsigned /pof_tx_rx_2_zero_tb/iPOF_TX/fifo_level
add wave -noupdate -group POF-Tx -radix unsigned /pof_tx_rx_2_zero_tb/iPOF_TX/fifo_level_max
add wave -noupdate -group POF-Tx /pof_tx_rx_2_zero_tb/iPOF_TX/tx_data
add wave -noupdate -group POF-Tx /pof_tx_rx_2_zero_tb/iPOF_TX/event_in_i
add wave -noupdate -group POF-Tx /pof_tx_rx_2_zero_tb/iPOF_TX/event_in
add wave -noupdate -group POF-Tx /pof_tx_rx_2_zero_tb/iPOF_TX/event_out
add wave -noupdate -group POF-Tx -radix decimal /pof_tx_rx_2_zero_tb/iPOF_TX/keepalive_cnt
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/reset_n
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/clk
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/init
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/rx_clk
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/rx_data
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/init_out
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/pd_out
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/inc_pos
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/dec_pos
add wave -noupdate -group POF-Rx -radix decimal /pof_tx_rx_2_zero_tb/iPOF_RX/abs_pos
add wave -noupdate -group POF-Rx -radix unsigned /pof_tx_rx_2_zero_tb/iPOF_RX/error_rate_thres
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/one_pps
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/max_error_flag
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/rx_watchdog
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/rx_watchdog_en
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/rx_watchdog_clr
add wave -noupdate -group POF-Rx -radix unsigned /pof_tx_rx_2_zero_tb/iPOF_RX/rx_wd_cnt
add wave -noupdate -group POF-Rx -radix unsigned /pof_tx_rx_2_zero_tb/iPOF_RX/error_rate_cnt
add wave -noupdate -group POF-Rx -radix unsigned /pof_tx_rx_2_zero_tb/iPOF_RX/error_rate
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/clear
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/clear_i
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/inc_pos_i
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/dec_pos_i
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/enable
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/sync_gen
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/pd_gen
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/symbol_error
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/rx_symbol_val
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/rx_symbol
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/rx_symbol_val_v
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/symbol_valid_i
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/symbol_valid_d
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/toggle_sync
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/sync_confirmed
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/sync_toggle_test
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/sync
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/toggle_pd
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/pd_confirmed
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/pd_toggle_test
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/pd
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/rx_error
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/rx_error_i
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/print_start_i
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/valid_pos
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/upd_pos
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/corr_done
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/corr_sign
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/skip_cnt
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/skip_pos
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/symbol_valid
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/symbol
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/apply_corr
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/clk_cnt
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/dist
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/abs_dist
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/next_pos_lsb
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/curr_pos_lsb
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/pos_corr
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/max_dist
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/gray_pos
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/symbol_i
add wave -noupdate -group POF-Rx -radix unsigned /pof_tx_rx_2_zero_tb/iPOF_RX/parity_err_cnt
add wave -noupdate -group POF-Rx -radix decimal /pof_tx_rx_2_zero_tb/iPOF_RX/abs_pos_i
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/inc_pos_ii
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/dec_pos_ii
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/GEN_RX_SYMBOL/iRX_SYMBOL/data_width
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/GEN_RX_SYMBOL/iRX_SYMBOL/reset_n
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/GEN_RX_SYMBOL/iRX_SYMBOL/clk
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/GEN_RX_SYMBOL/iRX_SYMBOL/init
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/GEN_RX_SYMBOL/iRX_SYMBOL/data_out
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/GEN_RX_SYMBOL/iRX_SYMBOL/data_out_valid
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/GEN_RX_SYMBOL/iRX_SYMBOL/rx_data
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/GEN_RX_SYMBOL/iRX_SYMBOL/rx_data_i
add wave -noupdate -group POF-Rx /pof_tx_rx_2_zero_tb/iPOF_RX/GEN_RX_SYMBOL/iRX_SYMBOL/data
TreeUpdate [SetDefaultTree]
WaveRestoreCursors {{Cursor 1} {2137525000 ps} 0}
quietly wave cursor active 1
configure wave -namecolwidth 305
configure wave -valuecolwidth 100
configure wave -justifyvalue left
configure wave -signalnamewidth 0
configure wave -snapdistance 10
configure wave -datasetprefix 0
configure wave -rowmargin 4
configure wave -childrowmargin 2
configure wave -gridoffset 0
configure wave -gridperiod 1
configure wave -griddelta 40
configure wave -timeline 0
configure wave -timelineunits ps
update
WaveRestoreZoom {0 ps} {3221225472 ps}

View file

@ -0,0 +1,372 @@
-------------------------------------------------------------------------------
-- Title : pof_rx
-- Project : SMB
-------------------------------------------------------------------------------
-- File : pof_rx_2.vhd
-- Author : Gianmarco Girau
-- Company : Global Inkjet Systems
-- Created : 2017-08-23
-- Last update: 2021-08-06
-- SVN ID : Git
-- Standard : VHDL'08
-------------------------------------------------------------------------------
-- Description:
-- Deserializes and decodes the EMS (SMB) output, received from the POF.
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity pof_rx_2 is
generic(
PROTOCOL_VER : integer range 0 to 1;
GEN_BIT_DIV : integer := 6
);
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;
pd_out : out std_logic;
print_start : 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;
error_rate_thres : in std_logic_vector(7 downto 0);
one_pps : 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_2;
architecture rtl of pof_rx_2 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 : 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 ps_gen, ps_new, ps_confirmed, ps_test : 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 rx_error, rx_error_i, print_start_i : std_logic;
signal rx_symbol_val, clear_i, skip_pos_d, pos_recovery : std_logic;
signal 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( 8 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 : std_logic_vector(31 downto 0);
begin
clear <= not enable or init;
-----------------------------------------------------------------------------
-- De-serialize symbols (Serial clock at 300 MHz - typical)
-----------------------------------------------------------------------------
GEN_RX_SYMBOL : IF PROTOCOL_VER = 0 GENERATE
iRX_SYMBOL : entity work.pof_uart_rx_2
generic map(
GEN_BIT_DIV => GEN_BIT_DIV,
data_width => 8)
port map(
reset_n => reset_n,
clk => rx_clk,
init => clear_i,
data_out => rx_symbol(7 downto 0),
data_out_valid => rx_symbol_val,
rx_error => rx_error,
rx_data => rx_data);
rx_symbol(8) <= '0';
ELSIF PROTOCOL_VER = 1 GENERATE
iRX_SYMBOL : entity work.pof_uart_rx_2
generic map(
GEN_BIT_DIV => GEN_BIT_DIV,
data_width => 9)
port map(
reset_n => reset_n,
clk => rx_clk,
init => clear_i,
data_out => rx_symbol,
data_out_valid => rx_symbol_val,
rx_error => rx_error,
rx_data => rx_data);
END GENERATE GEN_RX_SYMBOL;
-- Synchronize to the local clock
pLATCH_RX_DATA : process(rx_clk)
begin
if (rx_clk = '1' and rx_clk'event) then
if (rx_symbol_val = '1') then
symbol <= rx_symbol;
end if;
if (rx_symbol_val = '1') then
rx_symbol_val_v <= "1111";
else
rx_symbol_val_v <= '0' & rx_symbol_val_v(3 downto 1);
end if;
if (rx_error = '1') then
rx_error_v <= "1111";
else
rx_error_v <= '0' & rx_error_v(3 downto 1);
end if;
end if;
end process pLATCH_RX_DATA;
iSYNC_SYMBOL_VAL : entity work.sync_wire_rEdge
generic map(rst_val => '0', sync_stages => 3)
port map(rstN => reset_n, clk => clk, async_in => rx_symbol_val_v(0), sync_out => symbol_valid);
iSYNC_RX_ERROR : entity work.sync_wire_rEdge
generic map(rst_val => '0', sync_stages => 3)
port map(rstN => reset_n, clk => clk, async_in => rx_error_v(0), sync_out => rx_error_i);
-- synchronize clear to tx_clk
iSYNC_CLEAR : entity work.sync_wire
generic map(rst_val => '1', sync_stages => 2)
port map(
rstN => reset_n, clk => rx_clk, async_in => clear, sync_out => clear_i);
-----------------------------------------------------------------------------
-- Toggle-Bits Decoding
-----------------------------------------------------------------------------
pTOGGLE_DEC : process(clk)
begin
if (clk = '1' and clk'event) then
-- Toggle Bits:
-- Sync
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;
-- PD
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;
-- Print Start/Stop
if (ps_gen = '1') then
ps_new <= symbol_i(7);
end if;
if (clear = '1' or ps_confirmed = '1' or (symbol_valid_i = '1' and symbol_i(7) /= ps_new)) then
ps_test <= '0';
elsif (ps_gen = '1') then
ps_test <= '1';
end if;
if(init = '1' or enable = '0') then
print_start_i <= '0';
elsif(ps_confirmed = '1') then
print_start_i <= ps_new;
end if;
--
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;
GEN_PRINT_START : IF PROTOCOL_VER = 0 GENERATE
ps_gen <= '0';
ps_confirmed <= '0';
print_start <= '0';
ELSIF PROTOCOL_VER = 1 GENERATE
ps_gen <= '1' when symbol_valid_i = '1' and symbol_i(7) /= print_start_i else '0';
ps_confirmed <= ps_gen and ps_test;
print_start <= print_start_i;
END GENERATE GEN_PRINT_START;
-----------------------------------------------------------------------------
-- 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';
end architecture rtl;

View file

@ -0,0 +1,334 @@
-------------------------------------------------------------------------------
-- Title : pof_tx_2
-- Project : SMB
-------------------------------------------------------------------------------
-- File : pof_tx_2.vhd
-- Author : Gianmarco Girau
-- Company : Global Inkjet Systems
-- Created : 2017-08-22
-- Last update: 2021-71-06
-- SVN ID : Git
-- Standard : VHDL'08
-------------------------------------------------------------------------------
-- Description:
-- Encodes the EMS output into a serial format to be distributed over the POF
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity pof_tx_2 is
generic (
PROTOCOL_VER : integer range 0 to 1
);
port(
reset_n : in std_logic;
clk : in std_logic;
init : in std_logic;
pd_in : in std_logic;
print_start : in std_logic := '0';
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_readdata : out std_logic_vector(31 downto 0));
end entity pof_tx_2;
architecture rtl of pof_tx_2 is
constant CSR : std_logic_vector( 2 downto 0) := b"000";
constant ERROR_INJ_REG : std_logic_vector( 2 downto 0) := b"001";
constant TIMING_REG : std_logic_vector( 2 downto 0) := b"010";
constant FIFO_LEVEL_REG : std_logic_vector( 2 downto 0) := b"011";
constant KEEPALIVE_PERIOD_DEF : integer := 100;
constant INIT_BLOCKED_PERIOD_DEF : 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 clr_fifo_lmax : std_logic;
signal print_start_en, print_start_src : std_logic;
signal print_start_sw, print_start_val : std_logic;
signal print_start_val_d, print_start_event : std_logic;
signal print_start_event_d, print_start_gen : 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( 7 downto 0);
signal event_in, event_out : std_logic_vector( 8 downto 0);
signal event_in_no_start : std_logic_vector( 7 downto 0);
signal symbol : std_logic_vector( 8 downto 0);
signal init_blk_cnt : std_logic_vector( 9 downto 0) := (others => '0');
signal keepalive_cnt : std_logic_vector( 9 downto 0);
signal keepalive_period : std_logic_vector( 9 downto 0);
signal init_blocked_period : std_logic_vector( 9 downto 0);
signal fifo_level, fifo_level_max : std_logic_vector( 9 downto 0);
begin
clear <= not enable or init_d;
-----------------------------------------------------------------------------
-- 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 <= init_blocked_period;
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;
if(print_start_src = '0') then
print_start_val <= print_start;
else
print_start_val <= print_start_sw;
end if;
print_start_val_d <= print_start_val;
print_start_event <= print_start_en and (print_start_val xor print_start_val_d);
print_start_event_d <= print_start_event;
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 <= keepalive_period;
else
keepalive_cnt <= std_logic_vector(unsigned(keepalive_cnt)-1);
end if;
if(clear = '1') 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;
if(init_gen = '1' or clr_fifo_lmax = '1') then
fifo_level_max <= (others => '0');
elsif(unsigned(fifo_level) > unsigned(fifo_level_max)) then
fifo_level_max <= fifo_level;
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;
-- Two symbols are queued up in the FIFO each time there is a change in value
-- on Print-Start/Stop
GEN_PRINT_START_GEN : IF PROTOCOL_VER = 0 GENERATE
print_start_gen <= '0';
ELSIF PROTOCOL_VER = 1 GENERATE
print_start_gen <= print_start_event or print_start_event_d;
END GENERATE GEN_PRINT_START_GEN;
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 or print_start_gen);
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
GEN_EVENT_IN_I : IF PROTOCOL_VER = 0 GENERATE
event_in_i <= '0' & gray & toggle_pd & toggle_pd & toggle_sync;
ELSIF PROTOCOL_VER = 1 GENERATE
event_in_i <= print_start_val & gray & toggle_pd & toggle_pd & toggle_sync;
END GENERATE GEN_EVENT_IN_I;
parity_bit <= odd_parity(event_in_i) xor inject_error;
GEN_QUEUE_EVENT : IF PROTOCOL_VER = 0 GENERATE
event_in_no_start <= event_in(8) & event_in(6 downto 0);
iQUEUE_EVENT : entity work.sync_fifo
generic map (
FIFO_WIDTH => 8,
FIFO_DEPTH => 1024)
port map (
sclr => clear,
clock => clk,
data => event_in_no_start,
rdreq => rd_event,
wrreq => wr_event,
empty => empty,
full => full,
q => event_out(7 downto 0),
usedw => fifo_level);
ELSIF PROTOCOL_VER = 1 GENERATE
iQUEUE_EVENT : entity work.sync_fifo
generic map (
FIFO_WIDTH => 9,
FIFO_DEPTH => 1024)
port map (
sclr => clear,
clock => clk,
data => event_in,
rdreq => rd_event,
wrreq => wr_event,
empty => empty,
full => full,
q => event_out,
usedw => fifo_level);
END GENERATE GEN_QUEUE_EVENT;
-----------------------------------------------------------------------------
-- 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;
GEN_TX_SYMBOL : IF PROTOCOL_VER = 0 GENERATE
iTX_SYMBOL : entity work.uart_tx_2
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(7 downto 0),
data_valid => symbol_valid,
tx_data => tx_data);
ELSIF PROTOCOL_VER = 1 GENERATE
iTX_SYMBOL : entity work.uart_tx_2
generic map (
data_width => 9)
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);
END GENERATE GEN_TX_SYMBOL;
-----------------------------------------------------------------------------
-- C&S registers
-----------------------------------------------------------------------------
pof_tx_2_csr_regs_inst : entity work.pof_tx_2_csr_regs
generic map (
ADDR_DECODE_WIDTH => 3
)
port map (
-- Clock and reset
clk => clk,
rst_n => reset_n,
-- auto-generated
-- Internal signal ports
control_enable => enable,
control_bit_div => bit_div,
control_print_start_event_gen => print_start_en,
control_print_start_src => print_start_src,
control_print_start_sw => print_start_sw,
timing_keepalive_period => keepalive_period,
timing_init_blocked_period => init_blocked_period,
control_clr_fifo_level_max => clr_fifo_lmax,
error_inject => inject_error_req,
status_ovfl_err => ovfl_err,
status_print_start_val => print_start_val,
fifo_level_fifo_level => fifo_level,
fifo_level_max_fifo_level => fifo_level_max,
-- end auto-generated
-- Slave bus port
avs_address => avs_address(2 downto 0),
avs_write => avs_write,
avs_writedata => avs_writedata,
avs_read => avs_read,
avs_readdata => avs_readdata
);
end architecture rtl;

View file

@ -0,0 +1,100 @@
-------------------------------------------------------------------------------
-- Title : uart_regen
-- Project : EMB-1
-------------------------------------------------------------------------------
-- File : uart_regen.vhd
-- Author : Gianmarco Girau/Simon Southwell
-- Company : Global Inkjet Systems
-- Created : 2017-10-31
-- Last update: 2021-06-07
-- SVN ID : Git
-- Standard : VHDL'08
-------------------------------------------------------------------------------
-- Description:
-- Regenerate the UART signal
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity pof_uart_regen_2 is
generic(
GEN_BIT_DIV : integer := 6;
data_width : natural range 1 to 31 := 8
);
port(
reset_n : in std_logic;
clk : in std_logic;
enable : in std_logic;
bypass_en : in std_logic;
uart_rx : in std_logic;
uart_tx : out std_logic);
end entity pof_uart_regen_2;
architecture rtl of pof_uart_regen_2 is
signal uart_rx_i : std_logic;
signal uart_regen : std_logic;
signal receiving : std_logic;
signal sample_cnt_unary : std_logic_vector(GEN_BIT_DIV-1 downto 0);
signal bit_cnt_unary : std_logic_vector(data_width + 1 downto 0);
begin
-- output mux (maybe register?)
uart_tx <= uart_rx when bypass_en = '1' else uart_regen;
-----------------------------------------------------------------------------
-- Input Synchronization
-----------------------------------------------------------------------------
iSYNC_IN : entity work.sync_wire
generic map(
rst_val => '1',
sync_stages => 3)
port map(
rstN => reset_n,
clk => clk,
async_in => uart_rx,
sync_out => uart_rx_i);
pREGEN : process(clk)
begin
if clk = '1' and clk'event then
if enable = '0' or bypass_en = '1' then
receiving <= '0';
bit_cnt_unary <= std_logic_vector(to_unsigned(1, bit_cnt_unary'length));
sample_cnt_unary <= std_logic_vector(to_unsigned(1, sample_cnt_unary'length));
uart_regen <= '1';
else
-- If start bit seen when not receiving, start receiving and start unary sample count shifting (with rotation).
-- Keep rotating whilst receiving.
if (receiving = '0' and uart_rx_i = '0') or receiving = '1' then
receiving <= '1';
sample_cnt_unary <= sample_cnt_unary(sample_cnt_unary'high-1 downto 0) & sample_cnt_unary(sample_cnt_unary'high);
end if;
end if;
-- At half way regenerate the input
if sample_cnt_unary(GEN_BIT_DIV/2 - 1) = '1' then
uart_regen <= uart_rx_i;
end if;
-- After half way, up the bit count
if sample_cnt_unary(GEN_BIT_DIV/2) = '1' then
bit_cnt_unary <= bit_cnt_unary(bit_cnt_unary'high-1 downto 0) & bit_cnt_unary(bit_cnt_unary'high);
end if;
-- If at the end of the last (stop) bit clear the receiving state.
if sample_cnt_unary(GEN_BIT_DIV-1) = '1' and bit_cnt_unary(0) = '1' then
receiving <= '0';
end if;
end if;
end process pREGEN;
end architecture rtl;

View file

@ -0,0 +1,126 @@
-------------------------------------------------------------------------------
-- Title : pof_uart_rx
-- Project : EMB-1
-------------------------------------------------------------------------------
-- File : pof_uart_rx.vhd
-- Author : Gianmarco Girau/Simon Southwell
-- Company : Global Inkjet Systems
-- Created : 2016-10-24
-- Last update: 2021-06-07
-- SVN ID : Git
-- Standard : VHDL'08
-------------------------------------------------------------------------------
-- Description:
-- Simple UART receiver, used to receive data over the POF, 1 start, 1 stop
-- bit, no parity
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity pof_uart_rx_2 is
generic(
GEN_BIT_DIV : integer := 6;
data_width : natural range 1 to 31 := 8
);
port(
reset_n : in std_logic;
clk : in std_logic;
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 pof_uart_rx_2;
architecture rtl of pof_uart_rx_2 is
signal rx_data_i : std_logic;
signal data : std_logic_vector(data_width + 1 downto 0);
signal bit_cnt_unary : std_logic_vector(data_width + 1 downto 0);
signal sample_cnt_unary : std_logic_vector(GEN_BIT_DIV-1 downto 0);
signal receiving : std_logic;
signal init_int : std_logic := '0';
begin
-----------------------------------------------------------------------------
-- Input Synchronization
-----------------------------------------------------------------------------
iSYNC_IN : entity work.sync_wire
generic map(
rst_val => '1',
sync_stages => 3)
port map(
rstN => reset_n,
clk => clk,
async_in => rx_data,
sync_out => rx_data_i);
-----------------------------------------------------------------------------
-- UART registers and sequential logic
-----------------------------------------------------------------------------
pRX : process(clk)
begin
if clk = '1' and clk'event then
init_int <= init;
-- Data out valid will pulse
data_out_valid <= '0';
rx_error <= '0';
-- If initialising, only clear control state
if init_int = '1' then
receiving <= '0';
bit_cnt_unary <= std_logic_vector(to_unsigned(1, bit_cnt_unary'length));
sample_cnt_unary <= std_logic_vector(to_unsigned(1, sample_cnt_unary'length));
else
-- If start bit seen when not receiving, start receiving and start unary sample count shifting (with rotation).
-- Keep rotating whilst receiving.
if (receiving = '0' and rx_data_i = '0') or receiving = '1' then
receiving <= '1';
sample_cnt_unary <= sample_cnt_unary(sample_cnt_unary'high-1 downto 0) & sample_cnt_unary(sample_cnt_unary'high);
end if;
end if;
-- At half way shift in the data (LSB first) and shift (with rotation) the unary bit count
if sample_cnt_unary(GEN_BIT_DIV/2 - 1) = '1' then
data <= rx_data_i & data(data'high downto 1);
end if;
-- After half way, up the bit count
if sample_cnt_unary(GEN_BIT_DIV/2) = '1' then
bit_cnt_unary <= bit_cnt_unary(bit_cnt_unary'high-1 downto 0) & bit_cnt_unary(bit_cnt_unary'high);
end if;
-- Extract the payload bits from the input shift register
data_out <= data(data_width downto 1);
-- If at the end of the last (stop) bit, update data out and set valid.
-- Clear the receiving state.
if sample_cnt_unary(GEN_BIT_DIV-1) = '1' and bit_cnt_unary(0) = '1' then
-- Data is valid if stop bit a 1
data_out_valid <= data(data_width+1);
-- It is an error if the stop bit is 0
rx_error <= not data(data_width+1);
-- Clear receiving flag
receiving <= '0';
end if;
end if;
end process pRX;
end architecture rtl;

View file

@ -0,0 +1,724 @@
-------------------------------------------------------------------------------
-- Title : pof_tx_rx_tb
-- Project : HMB daisy-chaining
-------------------------------------------------------------------------------
-- File : pof_tx_rx_tb.vhd
-- Author : GMG
-- Company : Global Inkjet Systems
-- Created : 2017-08-29
-- Last update: 2020-01-31
-- SVN ID : Git
-- Standard : VHDL'2008
-------------------------------------------------------------------------------
-- Description:
-- Testbench for verifying the transmission over the POF with emb2poftx and
-- pofrx2hmb blocks
-------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library OSVVM;
use OSVVM.RandomBasePkg.all;
use OSVVM.RandomPkg.all;
use work.log_pkg.all;
use work.avalon_verify_pkg.all;
use work.log_pkg.all;
entity pof_tx_rx_2_one_tb is
-- ..
end entity pof_tx_rx_2_one_tb;
architecture behav of pof_tx_rx_2_one_tb is
constant CLK_PERIOD : time := 10 ns; -- 100MHz
constant RX_CLK_PERIOD : time := 3.333 ns; -- 300MHz
constant NUM_ITERATIONS : natural := 10;
constant SWATHE_LEN : integer := 1000;
constant START_DIR : std_logic := '0';
constant INJECT_ERROR_PERC : real := 2.0; -- percentage of injected errors
constant DISCR_THRES : natural := 2000;
constant TIME_INT : time := 800 ns;
constant UART_BIT_DIV : integer := 6; -- divide by 6
constant SYMBOL_LEN : natural := 8; -- UART symbol length, excluding
-- start/stop and parity bits
-- Print-Start toggling period
constant PS_SWITCH_PER : natural := 5000;
type injected_error_t is (DATA_ERROR, START_BIT_ERROR, STOP_BIT_ERROR);
-- Logging Verbosity Level
constant VERBOSITY_LEVEL : verb_level_t := VMEDIUM;
signal clk, rx_clk, rx_clk_i, reset_n : std_logic := '0';
signal avs_read, avs_write, sel_slave_0, sel_slave_1 : std_logic;
signal avs_write_sl0, avs_read_sl0 : std_logic;
signal avs_write_sl1, avs_read_sl1 : std_logic;
signal init_tx, init_rx, dir_in, pd_in, inc_pos, dec_pos : std_logic;
signal tx_data, rx_data, init_out, dir_out : std_logic;
signal pd_out, inc_pos_out, dec_pos_out, end_of_swathe : std_logic;
signal print_start_in, print_start_out : std_logic;
signal ps_flip_cnt : natural := 0;
--
signal test_completed, running, configuring : boolean;
signal passed, failed, stimuli_completed : boolean;
signal detected_error : boolean := false;
--
signal avs_address : std_logic_vector( 2 downto 0);
signal avs_writedata : std_logic_vector(31 downto 0);
signal avs_readdata_sl0, avs_readdata_sl1 : std_logic_vector(31 downto 0);
signal abs_position, abs_position_d : std_logic_vector(31 downto 0);
signal abs_pos_out : std_logic_vector(31 downto 0);
--
signal swathe_cnt, swathe_pos : integer;
signal dir_discr_cnt, pd_discr_cnt : integer;
signal pos_discr_cnt : integer;
signal pd_in_cnt, pd_out_cnt : integer;
signal enc_pulse_cnt : integer;
signal dir_err, pd_err, ovfl_err, ps_err : std_logic;
signal pos_err, enc_err, dir_in_d : std_logic;
signal injected_errors : integer;
signal sent_packets : integer;
signal max_pos, min_pos : integer;
signal injected_error_type : injected_error_t;
signal max_pos_d, min_pos_d : integer;
signal exp_enc_cnt : integer;
signal exp_enc_pulse, enc_discr : std_logic;
signal enc_out, enc_out_d : std_logic;
signal error_rate_thres : std_logic_vector(7 downto 0);
signal one_pps : std_logic;
signal max_error_flag : std_logic;
signal rx_watchdog : std_logic;
signal rx_watchdog_en : std_logic;
signal rx_watchdog_clr : std_logic;
--
signal enable_rx : std_logic;
signal parity_err_cnt : std_logic_vector(15 downto 0);
signal skip_pos_cnt : std_logic_vector(15 downto 0);
--
signal avs_m : mm_m_rec_t;
signal avs_s : mm_s_rec_t;
--
shared variable error_logged : boolean;
begin -- architecture behav
clk <= not clk after 0.5 * CLK_PERIOD;
rx_clk_i <= not rx_clk_i after 0.5 * RX_CLK_PERIOD;
rx_clk <= rx_clk_i after 1 ns;
-----------------------------------------------------------------------------
-- UUTs
-----------------------------------------------------------------------------
iPOF_TX : entity work.pof_tx_2
generic map(
PROTOCOL_VER => 1)
port map(
reset_n => reset_n,
clk => clk,
init => init_tx,
pd_in => pd_in,
print_start => print_start_in,
inc_pos => inc_pos,
dec_pos => dec_pos,
abs_position => abs_position,
tx_data => tx_data,
avs_address => avs_address,
avs_write => avs_write_sl0,
avs_writedata => avs_writedata,
avs_read => avs_read_sl0,
avs_readdata => avs_readdata_sl0);
iPOF_RX : entity work.pof_rx_2
generic map(
PROTOCOL_VER => 1,
GEN_BIT_DIV => UART_BIT_DIV)
port map(
reset_n => reset_n,
clk => clk,
init => init_rx,
rx_clk => rx_clk,
rx_data => rx_data,
init_out => init_out,
pd_out => pd_out,
print_start => print_start_out,
inc_pos => inc_pos_out,
dec_pos => dec_pos_out,
abs_pos => abs_pos_out,
enable => enable_rx,
error_rate_thres => error_rate_thres,
one_pps => one_pps,
max_error_flag => max_error_flag,
rx_watchdog => rx_watchdog,
rx_watchdog_en => rx_watchdog_en,
rx_watchdog_clr => rx_watchdog_clr,
parity_err_cnt => parity_err_cnt,
skip_pos_cnt => skip_pos_cnt);
--rx_data <= tx_data after 40 ns;
rx_data <= transport tx_data after 40 ns;
-----------------------------------------------------------------------------
-- UUT configuration and control
-----------------------------------------------------------------------------
clk_clk <= clk;
reset_reset_n <= reset_n;
avs_s.mm_readdata <= avs_readdata_sl0 when sel_slave_0 = '1' else
avs_readdata_sl1 when sel_slave_1 = '1' else (others => '0');
avs_readdata_sl1 <= (others => '0');
avs_s.mm_readdatavalid <= '0';
avs_s.mm_waitrequest <= '0';
avs_s.use_readvalid <= true;
avs_address <= avs_m.mm_address(avs_address'range);
avs_write <= avs_m.mm_write;
avs_writedata <= avs_m.mm_writedata;
avs_read <= avs_m.mm_read;
--
avs_write_sl0 <= avs_write and sel_slave_0;
--avs_write_sl1 <= avs_write and sel_slave_1;
avs_write_sl1 <= '0';
--
avs_read_sl0 <= avs_read and sel_slave_0;
--avs_read_sl1 <= avs_read and sel_slave_1;
avs_read_sl1 <= '0';
-- 1-PPS generation: make it faster than 1-PPS for simulation reasons
pEMULATE_1PPS : process
begin
one_pps <= '0';
for n in 1 to 99999 loop
wait until clk = '1' and clk'event;
end loop; -- 1 to 9999
one_pps <= '1';
wait until clk = '1' and clk'event;
end process pEMULATE_1PPS;
pUUT_CTRL : process
variable addr : std_logic_vector(31 downto 0) := (others => '0');
variable data : std_logic_vector(31 downto 0) := (others => '0');
variable init_done : boolean := false;
variable fifo_level : integer;
begin
enable_rx <= '0';
--
rx_watchdog_en <= '0';
rx_watchdog_clr <= '0';
error_rate_thres <= X"0A";
sel_slave_0 <= '0';
sel_slave_1 <= '0';
configuring <= true;
-- initilialize the Avalon master-bus
mm_m_init(avs_m);
if (reset_n = '0') then
wait until reset_n = '1';
wait for 100 ns;
wait until clk = '1' and clk'event;
end if;
log("Configuring POF-Tx ... ", VLOW, true);
sel_slave_0 <= '1';
-- Config netfork_rx control registers:
-- disable the block
addr := std_logic_vector(to_unsigned(0, 32));
data := X"0000_0021";
mm_32b_write(addr, data, avs_s, avs_m);
sel_slave_0 <= '0';
sel_slave_1 <= '1';
wait until clk = '1' and clk'event;
log("Configuring POF-Rx ... ", VLOW, true);
enable_rx <= '1';
rx_watchdog_en <= '1';
log("Configuration completed.", VLOW, true);
configuring <= false;
wait;
end process pUUT_CTRL;
-----------------------------------------------------------------------------
-- Stimuli Generation
-----------------------------------------------------------------------------
pSTIMULI_REGs : process(clk)
begin
if(reset_n = '0') then
abs_position_d <= (others => '0');
print_start_in <= '0';
ps_flip_cnt <= 0;
elsif(clk = '1' and clk'event) then
abs_position_d <= abs_position;
if(running = true) then
if(ps_flip_cnt = PS_SWITCH_PER-1) then
ps_flip_cnt <= 0;
print_start_in <= not print_start_in;
else
ps_flip_cnt <= ps_flip_cnt + 1;
end if;
end if;
end if;
end process pSTIMULI_REGs;
inc_pos <= '1' when signed(abs_position) = signed(abs_position_d) + 1 else '0';
dec_pos <= '1' when signed(abs_position) = signed(abs_position_d) - 1 else '0';
pSTIMULI : process
variable rv : RandomPType;
variable tmp_int : integer;
variable rand_time : time;
variable end_of_stimuli : boolean;
variable pd_dist : integer;
begin
-- initialization
init_rx <= '0';
--
init_tx <= '0';
dir_in <= START_DIR;
pd_in <= '0';
abs_position <= (others => '0');
swathe_pos <= 0;
pd_dist := 0;
--
swathe_cnt <= 0;
stimuli_completed <= false;
end_of_swathe <= '0';
-- generating the stimulus
wait until running = true;
wait for 200 ns;
-- Send a Init/Sync pulse
wait until clk = '1' and clk'event;
init_tx <= '1';
wait until clk = '1' and clk'event;
init_tx <= '0';
wait for 500 ns;
-- Send a second init pulse and verify that it is ignored (because too
-- close to the previous)
wait until clk = '1' and clk'event;
init_tx <= '1';
wait until clk = '1' and clk'event;
init_tx <= '0';
wait for 2500 ns;
-- Send a third pulse (after a bigger interval from the previous).
-- Verify that this time the pulse is accepted
wait until clk = '1' and clk'event;
init_tx <= '1';
wait until clk = '1' and clk'event;
init_tx <= '0';
wait for 500 ns;
wait until clk = '1' and clk'event;
--
-- generate the forward swathe
end_of_stimuli := false;
while end_of_stimuli = false loop
swathe_pos <= 0;
wait until clk = '1' and clk'event;
while swathe_pos /= SWATHE_LEN loop
-- generate a position increment
tmp_int := rv.RandInt(1, 100);
--tmp_int := 100;
if (tmp_int < 20) then
-- generate a position increment opposite to the swathe direction
swathe_pos <= swathe_pos - 1;
if (dir_in = '0') then
abs_position <= std_logic_vector(signed(abs_position) - 1);
else
abs_position <= std_logic_vector(signed(abs_position) + 1);
end if;
else
swathe_pos <= swathe_pos + 1;
if (dir_in = '0') then
abs_position <= std_logic_vector(signed(abs_position) + 1);
else
abs_position <= std_logic_vector(signed(abs_position) - 1);
end if;
end if;
--
tmp_int := rv.RandInt(1, 100);
if (tmp_int <= 5 and pd_dist >= 10) then
pd_dist := 0;
-- generate a PD increment: the PD might be either concurrent or not
-- to the position increment
tmp_int := rv.RandInt(1, 3);
case tmp_int is
when 2 =>
-- wait less than the transmission time
wait for 90 ns;
wait until clk = '1' and clk'event;
when 3 =>
-- wait more than the transmission time
wait for 290 ns;
wait until clk = '1' and clk'event;
when others => null;
end case;
pd_in <= '1';
wait until clk = '1' and clk'event;
pd_in <= '0';
end if;
pd_dist := pd_dist + 1;
rand_time := rv.RandInt(-25, 25) * (10 ns);
wait for TIME_INT + rand_time;
end loop; -- swathe_pos /= SWATHE_LEN
wait for 25 us;
end_of_swathe <= '1';
wait until clk = '1' and clk'event;
end_of_swathe <= '0';
-- reverse direction
if (dir_in /= START_DIR) then
if (swathe_cnt = NUM_ITERATIONS) then
end_of_stimuli := true;
else
swathe_cnt <= swathe_cnt + 1;
end if;
end if;
if (end_of_stimuli = false) then
wait until clk = '1' and clk'event;
dir_in <= not dir_in;
-- Wait some time to make sure the change of direction is transmitted.
-- Note: if the position starts changing before the receiver was able to
-- confirm the change of direction, then some encoder pulses may not be
-- generated
wait for 1 us;
wait until clk = '1' and clk'event;
end if;
end loop; -- end_of_stimuli = false
stimuli_completed <= true;
wait;
end process pSTIMULI;
-----------------------------------------------------------------------------
-- Error injection
-----------------------------------------------------------------------------
-- Randomly change the payload of the data transmitted over the UART.
-- Insert 1, 2 or 3 errors per data word
-- Note: an error on the start bit of the UART will can cause more than 3
-- errors per data word, therefore this error injection method does not cover
-- all the possible cases
pERROR_INJECTION : process
--
alias symbol_valid is <<signal iPOF_TX.symbol_valid : std_logic>>;
alias symbol is <<signal iPOF_TX.symbol : std_logic_vector>>;
--
alias uart_tx_set_tx_data is <<signal iPOF_TX.GEN_TX_SYMBOL.iTX_SYMBOL.set_tx_data : std_logic>>;
--
variable rv : RandomPType;
variable rv_et : RandomPType;
variable rv_sbe : RandomPType;
variable et_sel : natural;
variable sbe_len : natural;
variable flip_vect : std_logic_vector(SYMBOL_LEN downto 0);
variable last_flip : std_logic_vector(SYMBOL_LEN downto 0);
variable bit_flips : integer range 0 to 3;
variable b0, b1, b2 : integer range 0 to 8;
variable exclude_1 : integer_vector(0 downto 0);
variable exclude_2 : integer_vector(1 downto 0);
variable test : std_logic_vector(5 downto 0);
variable last_inj_err : integer;
begin
sent_packets <= 0;
injected_errors <= 0;
last_inj_err := 0;
if (running /= true) then
wait until running = true;
end if;
while running loop
wait until symbol_valid = '1' and symbol_valid'event;
sent_packets <= sent_packets + 1;
if(last_inj_err > 0) then
last_inj_err := last_inj_err - 1;
end if;
if (last_inj_err = 0 and rv.RandInt(1, 10000) < integer(INJECT_ERROR_PERC*100.0)) then
-- Select the type of error to inject: The error type distribution is
-- as follows:
-- 80% of data errors, including errors on the parity-bit
-- 10% of start-bit errors
-- 10% of stop-bit errors
last_inj_err := 5;
et_sel := rv_et.RandInt(1, 100);
if(et_sel < 80) then
injected_error_type <= DATA_ERROR;
-- Inject an error:
-- Number of bits to flip in the tx word
bit_flips := rv.RandInt(1, 3);
--bit_flips := 2;
b0 := rv.RandInt(0, SYMBOL_LEN);
exclude_1(0) := b0;
b1 := rv.RandInt(min => 0, max => SYMBOL_LEN, exclude => exclude_1);
exclude_2 := (0 => b0, 1 => b1);
b2 := rv.RandInt(min => 0, max => SYMBOL_LEN, exclude => exclude_2);
flip_vect := (others => '0');
flip_vect(b0) := '1';
if (bit_flips >= 2) then
flip_vect(b1) := '1';
end if;
if (bit_flips = 3) then
flip_vect(b2) := '1';
end if;
-- Prevent situations with two consecutive bit flips on bit 0,1 and 2
if ((flip_vect(0) = '1' and last_flip(0) = '1') or (flip_vect(1) = '1' and last_flip(1) = '1') or (flip_vect(2) = '1' and last_flip(2) = '1')) then
flip_vect := (others => '0');
end if;
log("bit-flip = " & to_string(bit_flips) & ", flip_vect = " & to_string(flip_vect) & ".", VLOW);
symbol <= force symbol xor flip_vect;
injected_errors <= injected_errors + 1;
wait until clk = '1' and clk'event;
wait until clk = '1' and clk'event;
symbol <= release;
last_flip := flip_vect;
elsif(et_sel < 90) then
last_flip := (others => '0');
injected_error_type <= START_BIT_ERROR;
-- Directly force tx_data to low for some time
sbe_len := rv_et.RandInt(3, 10);
injected_errors <= injected_errors + 1;
log("Injected error on the UART Start-Bit.", VLOW);
tx_data <= force '0';
for i in 1 to sbe_len loop
wait until clk = '1' and clk'event;
end loop; -- i
tx_data <= release;
else
last_flip := (others => '0');
injected_error_type <= STOP_BIT_ERROR;
-- To create an error on the UART stop-bit, force to zero the signal
-- used to switch tx_data to high, at the end of the message
uart_tx_set_tx_data <= force '0';
sbe_len := rv_et.RandInt(20, 25);
for i in 1 to sbe_len loop
wait until clk = '1' and clk'event;
end loop; -- i
-- issue the stop bit
uart_tx_set_tx_data <= force '1';
wait until clk = '1' and clk'event;
uart_tx_set_tx_data <= force '0';
wait until clk = '1' and clk'event;
uart_tx_set_tx_data <= release;
injected_errors <= injected_errors + 1;
log("Injected error on the UART Stop-Bit.", VLOW);
end if;
else
last_flip := (others => '0');
end if;
end loop;
end process pERROR_INJECTION;
-----------------------------------------------------------------------------
-- Output Checking
-----------------------------------------------------------------------------
-- No more check on dir_out!!!
dir_out <= dir_in;
pEVENT_MONITOR : process(clk)
begin
if (clk = '1' and clk'event) then
if (reset_n = '0' or init_tx = '1' or running = false or dir_in = dir_out) then
dir_discr_cnt <= 0;
elsif (dir_in /= dir_out) then
dir_discr_cnt <= dir_discr_cnt + 1;
end if;
if (reset_n = '0' or init_tx = '1' or running = false) then
dir_err <= '0';
elsif (dir_discr_cnt > DISCR_THRES) then
dir_err <= '1';
if(error_logged = false) then
log("ERROR: Detected Discrepancy in the Direction: Discrepancy Count bigger than " & to_string(DISCR_THRES) & ".", VLOW);
error_logged := true;
end if;
end if;
if (reset_n = '0' or init_tx = '1' or running = false) then
pd_in_cnt <= 0;
elsif (pd_in = '1') then
pd_in_cnt <= pd_in_cnt + 1;
end if;
if (reset_n = '0' or init_tx = '1' or running = false) then
pd_out_cnt <= 0;
elsif (pd_out = '1') then
pd_out_cnt <= pd_out_cnt + 1;
end if;
if (reset_n = '0' or init_tx = '1' or running = false or pd_in_cnt = pd_out_cnt) then
pd_discr_cnt <= 0;
elsif (pd_in_cnt /= pd_out_cnt) then
pd_discr_cnt <= pd_discr_cnt + 1;
end if;
if (reset_n = '0' or init_tx = '1' or running = false) then
pd_err <= '0';
elsif (pd_discr_cnt > DISCR_THRES) then
pd_err <= '1';
if(error_logged = false) then
log("ERROR: Misaligned PD count: Discrepancy Count bigger than " & to_string(DISCR_THRES) & ".", VLOW);
error_logged := true;
end if;
end if;
if (reset_n = '0' or init_tx = '1' or running = false or signed(abs_position) = signed(abs_pos_out)) then
pos_discr_cnt <= 0;
elsif (signed(abs_position) /= signed(abs_pos_out)) then
pos_discr_cnt <= pos_discr_cnt + 1;
end if;
if (reset_n = '0' or init_tx = '1' or running = false) then
pos_err <= '0';
elsif (pos_discr_cnt > DISCR_THRES) then
pos_err <= '1';
if(error_logged = false) then
log("ERROR: Misaligned in the Absolute-Position: Discrepancy Count bigger than " & to_string(DISCR_THRES) & ".", VLOW);
error_logged := true;
end if;
end if;
dir_in_d <= dir_in;
if (reset_n = '0' or init_tx = '1' or running = false or dir_in /= dir_in_d) then
enc_pulse_cnt <= 0;
elsif (enc_out = '1') then
enc_pulse_cnt <= enc_pulse_cnt + 1;
end if;
if (reset_n = '0' or init_tx = '1' or running = false) then
enc_err <= '0';
elsif (end_of_swathe = '1' and enc_pulse_cnt /= SWATHE_LEN) then
enc_err <= '1';
end if;
if(reset_n = '0') then
ps_err <= '0';
elsif(running = true and ps_flip_cnt = integer(0.9*real(PS_SWITCH_PER)) and print_start_out /= print_start_in) then
ps_err <= '1';
if(error_logged = false) then
log("ERROR: Print-Start error.", VLOW);
error_logged := true;
end if;
end if;
max_pos_d <= max_pos;
min_pos_d <= min_pos;
if ((dir_in = '0' and max_pos /= max_pos_d) or (dir_in = '1' and min_pos /= min_pos_d)) then
exp_enc_pulse <= '1';
else
exp_enc_pulse <= '0';
end if;
enc_out_d <= enc_out;
end if;
end process pEVENT_MONITOR;
enc_discr <= enc_out_d xor exp_enc_pulse;
pMIN_MAX_POS : process(reset_n, end_of_swathe, abs_pos_out)
begin
if (reset_n = '0' or end_of_swathe = '1') then
max_pos <= -SWATHE_LEN;
elsif (signed(abs_pos_out) > max_pos) then
max_pos <= to_integer(signed(abs_pos_out));
end if;
if (reset_n = '0' or end_of_swathe = '1') then
min_pos <= SWATHE_LEN;
elsif (signed(abs_pos_out) < min_pos) then
min_pos <= to_integer(signed(abs_pos_out));
end if;
end process pMIN_MAX_POS;
exp_enc_cnt <= max_pos - min_pos;
ovfl_err <= <<signal iPOF_TX.ovfl_err : std_logic>>;
pERR_DETECT : process(reset_n, clk)
begin
if (reset_n = '0') then
detected_error <= false;
error_logged := false;
elsif (clk = '1' and clk'event) then
if (ovfl_err = '1' or dir_err = '1' or pd_err = '1' or pos_err = '1' or ps_err = '1') then
if(ovfl_err = '1') then
log("ERROR: Detected Overflow Error.", VLOW);
end if;
detected_error <= true;
end if;
end if;
end process pERR_DETECT;
-----------------------------------------------------------------------------
-- Testbench Control
-----------------------------------------------------------------------------
pTB_CTRL : process
begin
-- Set the verbosity level for logging
set_log_verbosity(VERBOSITY_LEVEL);
set_log_verbosity(VHIGH);
log_header("POF Transfer Tx/Rx verification:", VLOW);
test_completed <= false;
running <= false;
passed <= false;
failed <= false;
-- Reset
reset_n <= '0';
wait for 100 ns;
wait until clk = '1' and clk'event;
reset_n <= '1';
if (configuring /= true) then
wait until configuring = true;
end if;
wait until configuring = false;
running <= true;
wait until stimuli_completed = true or detected_error = true;
if (stimuli_completed = true) then
-- wait enough time to make sure that a max length package can be propagated
wait for 20 us;
else
wait for 20 us;
end if;
log_separator_line(VLOW);
if (detected_error = true) then
failed <= true;
log("FAILURE: test completed with errors.", VLOW);
else
passed <= true;
log("Sent Packets = " & to_string(sent_packets) & ", Injected errors = " & to_string(injected_errors) & ".", VLOW);
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;

View file

@ -0,0 +1,696 @@
-------------------------------------------------------------------------------
-- Title : pof_tx_rx_tb
-- Project : HMB daisy-chaining
-------------------------------------------------------------------------------
-- File : pof_tx_rx_tb.vhd
-- Author : GMG
-- Company : Global Inkjet Systems
-- Created : 2017-08-29
-- Last update: 2020-01-31
-- SVN ID : Git
-- Standard : VHDL'2008
-------------------------------------------------------------------------------
-- Description:
-- Testbench for verifying the transmission over the POF with emb2poftx and
-- pofrx2hmb blocks
-------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library OSVVM;
use OSVVM.RandomBasePkg.all;
use OSVVM.RandomPkg.all;
use work.log_pkg.all;
use work.avalon_verify_pkg.all;
use work.log_pkg.all;
entity pof_tx_rx_2_zero_tb is
-- ..
end entity pof_tx_rx_2_zero_tb;
architecture behav of pof_tx_rx_2_zero_tb is
constant CLK_PERIOD : time := 10 ns; -- 100MHz
constant RX_CLK_PERIOD : time := 3.333 ns; -- 300MHz
constant NUM_ITERATIONS : natural := 10;
constant SWATHE_LEN : integer := 1000;
constant START_DIR : std_logic := '0';
constant INJECT_ERROR_PERC : real := 3.0; -- percentage of injected errors
constant DISCR_THRES : natural := 2000;
constant TIME_INT : time := 800 ns;
constant UART_BIT_DIV : integer := 6; -- divide by 6
constant SYMBOL_LEN : natural := 7; -- UART symbol length, excluding
-- start/stop and parity bits
type injected_error_t is (DATA_ERROR, START_BIT_ERROR, STOP_BIT_ERROR);
-- Logging Verbosity Level
constant VERBOSITY_LEVEL : verb_level_t := VMEDIUM;
signal clk, rx_clk, rx_clk_i, reset_n : std_logic := '0';
signal avs_read, avs_write, sel_slave_0, sel_slave_1 : std_logic;
signal avs_write_sl0, avs_read_sl0 : std_logic;
signal avs_write_sl1, avs_read_sl1 : std_logic;
signal init_tx, init_rx, dir_in, pd_in, inc_pos, dec_pos : std_logic;
signal tx_data, rx_data, init_out, dir_out : std_logic;
signal pd_out, inc_pos_out, dec_pos_out, end_of_swathe : std_logic;
--
signal test_completed, running, configuring : boolean;
signal passed, failed, stimuli_completed : boolean;
signal detected_error : boolean := false;
--
signal avs_address : std_logic_vector( 2 downto 0);
signal avs_writedata : std_logic_vector(31 downto 0);
signal avs_readdata_sl0, avs_readdata_sl1 : std_logic_vector(31 downto 0);
signal abs_position, abs_position_d : std_logic_vector(31 downto 0);
signal abs_pos_out : std_logic_vector(31 downto 0);
--
signal swathe_cnt, swathe_pos : integer;
signal dir_discr_cnt, pd_discr_cnt : integer;
signal pos_discr_cnt : integer;
signal pd_in_cnt, pd_out_cnt : integer;
signal enc_pulse_cnt : integer;
signal dir_err, pd_err, ovfl_err : std_logic;
signal pos_err, enc_err, dir_in_d : std_logic;
signal injected_errors : integer;
signal sent_packets : integer;
signal max_pos, min_pos : integer;
signal injected_error_type : injected_error_t;
signal max_pos_d, min_pos_d : integer;
signal exp_enc_cnt : integer;
signal exp_enc_pulse, enc_discr : std_logic;
signal enc_out, enc_out_d : std_logic;
signal error_rate_thres : std_logic_vector(7 downto 0);
signal one_pps : std_logic;
signal max_error_flag : std_logic;
signal rx_watchdog : std_logic;
signal rx_watchdog_en : std_logic;
signal rx_watchdog_clr : std_logic;
--
signal enable_rx : std_logic;
signal parity_err_cnt : std_logic_vector(15 downto 0);
signal skip_pos_cnt : std_logic_vector(15 downto 0);
--
signal avs_m : mm_m_rec_t;
signal avs_s : mm_s_rec_t;
--
shared variable error_logged : boolean;
begin -- architecture behav
clk <= not clk after 0.5 * CLK_PERIOD;
rx_clk_i <= not rx_clk_i after 0.5 * RX_CLK_PERIOD;
rx_clk <= rx_clk_i after 1 ns;
-----------------------------------------------------------------------------
-- UUTs
-----------------------------------------------------------------------------
iPOF_TX : entity work.pof_tx_2
generic map(
PROTOCOL_VER => 0)
port map(
reset_n => reset_n,
clk => clk,
init => init_tx,
pd_in => pd_in,
inc_pos => inc_pos,
dec_pos => dec_pos,
abs_position => abs_position,
tx_data => tx_data,
avs_address => avs_address,
avs_write => avs_write_sl0,
avs_writedata => avs_writedata,
avs_read => avs_read_sl0,
avs_readdata => avs_readdata_sl0);
iPOF_RX : entity work.pof_rx_2
generic map(
PROTOCOL_VER => 0,
GEN_BIT_DIV => UART_BIT_DIV)
port map(
reset_n => reset_n,
clk => clk,
init => init_rx,
rx_clk => rx_clk,
rx_data => rx_data,
init_out => init_out,
pd_out => pd_out,
inc_pos => inc_pos_out,
dec_pos => dec_pos_out,
abs_pos => abs_pos_out,
enable => enable_rx,
error_rate_thres => error_rate_thres,
one_pps => one_pps,
max_error_flag => max_error_flag,
rx_watchdog => rx_watchdog,
rx_watchdog_en => rx_watchdog_en,
rx_watchdog_clr => rx_watchdog_clr,
parity_err_cnt => parity_err_cnt,
skip_pos_cnt => skip_pos_cnt);
--rx_data <= tx_data after 40 ns;
rx_data <= transport tx_data after 40 ns;
-----------------------------------------------------------------------------
-- UUT configuration and control
-----------------------------------------------------------------------------
clk_clk <= clk;
reset_reset_n <= reset_n;
avs_s.mm_readdata <= avs_readdata_sl0 when sel_slave_0 = '1' else
avs_readdata_sl1 when sel_slave_1 = '1' else (others => '0');
avs_readdata_sl1 <= (others => '0');
avs_s.mm_readdatavalid <= '0';
avs_s.mm_waitrequest <= '0';
avs_s.use_readvalid <= true;
avs_address <= avs_m.mm_address(avs_address'range);
avs_write <= avs_m.mm_write;
avs_writedata <= avs_m.mm_writedata;
avs_read <= avs_m.mm_read;
--
avs_write_sl0 <= avs_write and sel_slave_0;
--avs_write_sl1 <= avs_write and sel_slave_1;
avs_write_sl1 <= '0';
--
avs_read_sl0 <= avs_read and sel_slave_0;
--avs_read_sl1 <= avs_read and sel_slave_1;
avs_read_sl1 <= '0';
-- 1-PPS generation: make it faster than 1-PPS for simulation reasons
pEMULATE_1PPS : process
begin
one_pps <= '0';
for n in 1 to 99999 loop
wait until clk = '1' and clk'event;
end loop; -- 1 to 9999
one_pps <= '1';
wait until clk = '1' and clk'event;
end process pEMULATE_1PPS;
pUUT_CTRL : process
variable addr : std_logic_vector(31 downto 0) := (others => '0');
variable data : std_logic_vector(31 downto 0) := (others => '0');
variable init_done : boolean := false;
variable fifo_level : integer;
begin
enable_rx <= '0';
--
rx_watchdog_en <= '0';
rx_watchdog_clr <= '0';
error_rate_thres <= X"0A";
sel_slave_0 <= '0';
sel_slave_1 <= '0';
configuring <= true;
-- initilialize the Avalon master-bus
mm_m_init(avs_m);
if (reset_n = '0') then
wait until reset_n = '1';
wait for 100 ns;
wait until clk = '1' and clk'event;
end if;
log("Configuring POF-Tx ... ", VLOW, true);
sel_slave_0 <= '1';
-- Config netfork_rx control registers:
-- disable the block
addr := std_logic_vector(to_unsigned(0, 32));
data := X"0000_0021";
mm_32b_write(addr, data, avs_s, avs_m);
sel_slave_0 <= '0';
sel_slave_1 <= '1';
wait until clk = '1' and clk'event;
log("Configuring POF-Rx ... ", VLOW, true);
enable_rx <= '1';
rx_watchdog_en <= '1';
log("Configuration completed.", VLOW, true);
configuring <= false;
wait;
end process pUUT_CTRL;
-----------------------------------------------------------------------------
-- Stimuli Generation
-----------------------------------------------------------------------------
pSTIMULI_REGs : process(clk)
begin
if(reset_n = '0') then
abs_position_d <= (others => '0');
elsif(clk = '1' and clk'event) then
abs_position_d <= abs_position;
end if;
end process pSTIMULI_REGs;
inc_pos <= '1' when signed(abs_position) = signed(abs_position_d) + 1 else '0';
dec_pos <= '1' when signed(abs_position) = signed(abs_position_d) - 1 else '0';
pSTIMULI : process
variable rv : RandomPType;
variable tmp_int : integer;
variable rand_time : time;
variable end_of_stimuli : boolean;
variable pd_dist : integer;
begin
-- initialization
init_rx <= '0';
--
init_tx <= '0';
dir_in <= START_DIR;
pd_in <= '0';
abs_position <= (others => '0');
swathe_pos <= 0;
pd_dist := 0;
--
swathe_cnt <= 0;
stimuli_completed <= false;
end_of_swathe <= '0';
-- generating the stimulus
wait until running = true;
wait for 200 ns;
-- Send a Init/Sync pulse
wait until clk = '1' and clk'event;
init_tx <= '1';
wait until clk = '1' and clk'event;
init_tx <= '0';
wait for 500 ns;
-- Send a second init pulse and verify that it is ignored (because too
-- close to the previous)
wait until clk = '1' and clk'event;
init_tx <= '1';
wait until clk = '1' and clk'event;
init_tx <= '0';
wait for 2500 ns;
-- Send a third pulse (after a bigger interval from the previous).
-- Verify that this time the pulse is accepted
wait until clk = '1' and clk'event;
init_tx <= '1';
wait until clk = '1' and clk'event;
init_tx <= '0';
wait for 500 ns;
wait until clk = '1' and clk'event;
--
-- generate the forward swathe
end_of_stimuli := false;
while end_of_stimuli = false loop
swathe_pos <= 0;
wait until clk = '1' and clk'event;
while swathe_pos /= SWATHE_LEN loop
-- generate a position increment
tmp_int := rv.RandInt(1, 100);
--tmp_int := 100;
if (tmp_int < 20) then
-- generate a position increment opposite to the swathe direction
swathe_pos <= swathe_pos - 1;
if (dir_in = '0') then
abs_position <= std_logic_vector(signed(abs_position) - 1);
else
abs_position <= std_logic_vector(signed(abs_position) + 1);
end if;
else
swathe_pos <= swathe_pos + 1;
if (dir_in = '0') then
abs_position <= std_logic_vector(signed(abs_position) + 1);
else
abs_position <= std_logic_vector(signed(abs_position) - 1);
end if;
end if;
--
tmp_int := rv.RandInt(1, 100);
if (tmp_int <= 5 and pd_dist >= 10) then
pd_dist := 0;
-- generate a PD increment: the PD might be either concurrent or not
-- to the position increment
tmp_int := rv.RandInt(1, 3);
case tmp_int is
when 2 =>
-- wait less than the transmission time
wait for 90 ns;
wait until clk = '1' and clk'event;
when 3 =>
-- wait more than the transmission time
wait for 290 ns;
wait until clk = '1' and clk'event;
when others => null;
end case;
pd_in <= '1';
wait until clk = '1' and clk'event;
pd_in <= '0';
end if;
pd_dist := pd_dist + 1;
rand_time := rv.RandInt(-25, 25) * (10 ns);
wait for TIME_INT + rand_time;
end loop; -- swathe_pos /= SWATHE_LEN
wait for 25 us;
end_of_swathe <= '1';
wait until clk = '1' and clk'event;
end_of_swathe <= '0';
-- reverse direction
if (dir_in /= START_DIR) then
if (swathe_cnt = NUM_ITERATIONS) then
end_of_stimuli := true;
else
swathe_cnt <= swathe_cnt + 1;
end if;
end if;
if (end_of_stimuli = false) then
wait until clk = '1' and clk'event;
dir_in <= not dir_in;
-- Wait some time to make sure the change of direction is transmitted.
-- Note: if the position starts changing before the receiver was able to
-- confirm the change of direction, then some encoder pulses may not be
-- generated
wait for 1 us;
wait until clk = '1' and clk'event;
end if;
end loop; -- end_of_stimuli = false
stimuli_completed <= true;
wait;
end process pSTIMULI;
-----------------------------------------------------------------------------
-- Error injection
-----------------------------------------------------------------------------
-- Randomly change the payload of the data transmitted over the UART.
-- Insert 1, 2 or 3 errors per data word
-- Note: an error on the start bit of the UART will can cause more than 3
-- errors per data word, therefore this error injection method does not cover
-- all the possible cases
pERROR_INJECTION : process
--
alias symbol_valid is <<signal iPOF_TX.symbol_valid : std_logic>>;
alias symbol is <<signal iPOF_TX.symbol : std_logic_vector>>;
--
alias uart_tx_set_tx_data is <<signal iPOF_TX.GEN_TX_SYMBOL.iTX_SYMBOL.set_tx_data : std_logic>>;
--
variable rv : RandomPType;
variable rv_et : RandomPType;
variable rv_sbe : RandomPType;
variable et_sel : natural;
variable sbe_len : natural;
variable flip_vect : std_logic_vector(SYMBOL_LEN downto 0);
variable last_flip : std_logic_vector(SYMBOL_LEN downto 0);
variable bit_flips : integer range 0 to 3;
variable b0, b1, b2 : integer range 0 to 8;
variable exclude_1 : integer_vector(0 downto 0);
variable exclude_2 : integer_vector(1 downto 0);
variable test : std_logic_vector(5 downto 0);
variable last_inj_err : integer;
begin
sent_packets <= 0;
injected_errors <= 0;
last_inj_err := 0;
if (running /= true) then
wait until running = true;
end if;
while running loop
wait until symbol_valid = '1' and symbol_valid'event;
sent_packets <= sent_packets + 1;
if(last_inj_err > 0) then
last_inj_err := last_inj_err - 1;
end if;
if (last_inj_err = 0 and rv.RandInt(1, 10000) < integer(INJECT_ERROR_PERC*100.0)) then
-- Select the type of error to inject: The error type distribution is
-- as follows:
-- 80% of data errors, including errors on the parity-bit
-- 10% of start-bit errors
-- 10% of stop-bit errors
last_inj_err := 5;
et_sel := rv_et.RandInt(1, 100);
if(et_sel < 80) then
injected_error_type <= DATA_ERROR;
-- Inject an error:
-- Number of bits to flip in the tx word
bit_flips := rv.RandInt(1, 3);
--bit_flips := 2;
b0 := rv.RandInt(0, SYMBOL_LEN);
exclude_1(0) := b0;
b1 := rv.RandInt(min => 0, max => SYMBOL_LEN, exclude => exclude_1);
exclude_2 := (0 => b0, 1 => b1);
b2 := rv.RandInt(min => 0, max => SYMBOL_LEN, exclude => exclude_2);
flip_vect := (others => '0');
flip_vect(b0) := '1';
if (bit_flips >= 2) then
flip_vect(b1) := '1';
end if;
if (bit_flips = 3) then
flip_vect(b2) := '1';
end if;
-- Prevent situations with two consecutive bit flips on bit 0,1 and 2
if ((flip_vect(0) = '1' and last_flip(0) = '1') or (flip_vect(1) = '1' and last_flip(1) = '1') or (flip_vect(2) = '1' and last_flip(2) = '1')) then
flip_vect := (others => '0');
end if;
log("Injected paylod data error: bit-flip = " & to_string(bit_flips) & ", flip_vect = " & to_string(flip_vect) & ".", VLOW);
symbol(7 downto 0) <= force symbol(7 downto 0) xor flip_vect;
injected_errors <= injected_errors + 1;
wait until clk = '1' and clk'event;
wait until clk = '1' and clk'event;
symbol <= release;
last_flip := flip_vect;
elsif(et_sel < 90) then
last_flip := (others => '0');
injected_error_type <= START_BIT_ERROR;
-- Directly force tx_data to low for some time
sbe_len := rv_et.RandInt(3, 10);
injected_errors <= injected_errors + 1;
log("Injected error on the UART Start-Bit.", VLOW);
tx_data <= force '0';
for i in 1 to sbe_len loop
wait until clk = '1' and clk'event;
end loop; -- i
tx_data <= release;
else
last_flip := (others => '0');
injected_error_type <= STOP_BIT_ERROR;
-- To create an error on the UART stop-bit, force to zero the signal
-- used to switch tx_data to high, at the end of the message
uart_tx_set_tx_data <= force '0';
sbe_len := rv_et.RandInt(20, 25);
for i in 1 to sbe_len loop
wait until clk = '1' and clk'event;
end loop; -- i
-- issue the stop bit
uart_tx_set_tx_data <= force '1';
wait until clk = '1' and clk'event;
uart_tx_set_tx_data <= force '0';
wait until clk = '1' and clk'event;
uart_tx_set_tx_data <= release;
injected_errors <= injected_errors + 1;
log("Injected error on the UART Stop-Bit.", VLOW);
end if;
else
last_flip := (others => '0');
end if;
end loop;
end process pERROR_INJECTION;
-----------------------------------------------------------------------------
-- Output Checking
-----------------------------------------------------------------------------
-- No more check on dir_out!!!
dir_out <= dir_in;
pEVENT_MONITOR : process(clk)
begin
if (clk = '1' and clk'event) then
if (reset_n = '0' or init_tx = '1' or running = false or dir_in = dir_out) then
dir_discr_cnt <= 0;
elsif (dir_in /= dir_out) then
dir_discr_cnt <= dir_discr_cnt + 1;
end if;
if (reset_n = '0' or init_tx = '1' or running = false) then
dir_err <= '0';
elsif (dir_discr_cnt > DISCR_THRES) then
dir_err <= '1';
if(error_logged = false) then
log("ERROR: Detected Discrepancy in the Direction: Discrepancy Count bigger than " & to_string(DISCR_THRES) & ".", VLOW);
error_logged := true;
end if;
end if;
if (reset_n = '0' or init_tx = '1' or running = false) then
pd_in_cnt <= 0;
elsif (pd_in = '1') then
pd_in_cnt <= pd_in_cnt + 1;
end if;
if (reset_n = '0' or init_tx = '1' or running = false) then
pd_out_cnt <= 0;
elsif (pd_out = '1') then
pd_out_cnt <= pd_out_cnt + 1;
end if;
if (reset_n = '0' or init_tx = '1' or running = false or pd_in_cnt = pd_out_cnt) then
pd_discr_cnt <= 0;
elsif (pd_in_cnt /= pd_out_cnt) then
pd_discr_cnt <= pd_discr_cnt + 1;
end if;
if (reset_n = '0' or init_tx = '1' or running = false) then
pd_err <= '0';
elsif (pd_discr_cnt > DISCR_THRES) then
pd_err <= '1';
if(error_logged = false) then
log("ERROR: Misaligned PD count: Discrepancy Count bigger than " & to_string(DISCR_THRES) & ".", VLOW);
error_logged := true;
end if;
end if;
if (reset_n = '0' or init_tx = '1' or running = false or signed(abs_position) = signed(abs_pos_out)) then
pos_discr_cnt <= 0;
elsif (signed(abs_position) /= signed(abs_pos_out)) then
pos_discr_cnt <= pos_discr_cnt + 1;
end if;
if (reset_n = '0' or init_tx = '1' or running = false) then
pos_err <= '0';
elsif (pos_discr_cnt > DISCR_THRES) then
pos_err <= '1';
if(error_logged = false) then
log("ERROR: Misaligned in the Absolute-Position: Discrepancy Count bigger than " & to_string(DISCR_THRES) & ".", VLOW);
error_logged := true;
end if;
end if;
dir_in_d <= dir_in;
if (reset_n = '0' or init_tx = '1' or running = false or dir_in /= dir_in_d) then
enc_pulse_cnt <= 0;
elsif (enc_out = '1') then
enc_pulse_cnt <= enc_pulse_cnt + 1;
end if;
if (reset_n = '0' or init_tx = '1' or running = false) then
enc_err <= '0';
elsif (end_of_swathe = '1' and enc_pulse_cnt /= SWATHE_LEN) then
enc_err <= '1';
end if;
max_pos_d <= max_pos;
min_pos_d <= min_pos;
if ((dir_in = '0' and max_pos /= max_pos_d) or (dir_in = '1' and min_pos /= min_pos_d)) then
exp_enc_pulse <= '1';
else
exp_enc_pulse <= '0';
end if;
enc_out_d <= enc_out;
end if;
end process pEVENT_MONITOR;
enc_discr <= enc_out_d xor exp_enc_pulse;
pMIN_MAX_POS : process(reset_n, end_of_swathe, abs_pos_out)
begin
if (reset_n = '0' or end_of_swathe = '1') then
max_pos <= -SWATHE_LEN;
elsif (signed(abs_pos_out) > max_pos) then
max_pos <= to_integer(signed(abs_pos_out));
end if;
if (reset_n = '0' or end_of_swathe = '1') then
min_pos <= SWATHE_LEN;
elsif (signed(abs_pos_out) < min_pos) then
min_pos <= to_integer(signed(abs_pos_out));
end if;
end process pMIN_MAX_POS;
exp_enc_cnt <= max_pos - min_pos;
ovfl_err <= <<signal iPOF_TX.ovfl_err : std_logic>>;
pERR_DETECT : process(reset_n, clk)
begin
if (reset_n = '0') then
detected_error <= false;
error_logged := false;
elsif (clk = '1' and clk'event) then
if (ovfl_err = '1' or dir_err = '1' or pd_err = '1' or pos_err = '1') then
if(ovfl_err = '1') then
log("ERROR: Detected Overflow Error.", VLOW);
end if;
detected_error <= true;
end if;
end if;
end process pERR_DETECT;
-----------------------------------------------------------------------------
-- Testbench Control
-----------------------------------------------------------------------------
pTB_CTRL : process
begin
-- Set the verbosity level for logging
set_log_verbosity(VERBOSITY_LEVEL);
set_log_verbosity(VHIGH);
log_header("POF Transfer Tx/Rx verification:", VLOW);
test_completed <= false;
running <= false;
passed <= false;
failed <= false;
-- Reset
reset_n <= '0';
wait for 100 ns;
wait until clk = '1' and clk'event;
reset_n <= '1';
if (configuring /= true) then
wait until configuring = true;
end if;
wait until configuring = false;
running <= true;
wait until stimuli_completed = true or detected_error = true;
if (stimuli_completed = true) then
-- wait enough time to make sure that a max length package can be propagated
wait for 20 us;
else
wait for 20 us;
end if;
log_separator_line(VLOW);
if (detected_error = true) then
failed <= true;
log("FAILURE: test completed with errors.", VLOW);
else
passed <= true;
log("Sent Packets = " & to_string(sent_packets) & ", Injected errors = " & to_string(injected_errors) & ".", VLOW);
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;

View file

@ -0,0 +1,164 @@
-------------------------------------------------------------------------------
-- Title : uart_tx
-- Project : EMB-1
-------------------------------------------------------------------------------
-- File : uart_tx.vhd
-- Author : Gianmarco Girau
-- Company : Global Inkjet Systems
-- Created : 2016-10-24
-- Last update: 2021-06-07
-- SVN ID : Git
-- Standard : VHDL'08
-------------------------------------------------------------------------------
-- Description:
-- Simple UART trasmitter, used to trasmit data over the POF, 1 start, 1 stop
-- bit, no parity
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity uart_tx_2 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_2;
architecture rtl of uart_tx_2 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;

View file

@ -49,37 +49,37 @@ use work.common_pkg.all;
entity preslicer_0 is
generic(
NUM_STRIPES_DEPTH : integer range 2 to 32 := 8; -- whole 1bpp equivalent stripes must it be possible to buffer in preslicer
NUM_STRIPES_FULL_MARGIN : integer range 1 to 31 := 2; -- at least this many 1bpp equivalent stripes space must be available
SHIFT_DEPTH : integer range 1 to 2048 := 128; -- head shift buffer depth
MAX_OP_WIDTH : natural range 1 to 128 := 8;
DEVICE_FAMILY : string := "Cyclone V" -- "Cyclone 10 LP"
NUM_STRIPES_DEPTH : integer range 2 to 32 := 8; -- whole 1bpp equivalent stripes must it be possible to buffer in preslicer
NUM_STRIPES_FULL_MARGIN : integer range 1 to 31 := 2; -- at least this many 1bpp equivalent stripes space must be available
SHIFT_DEPTH : integer range 1 to 2048 := 128; -- head shift buffer depth
MAX_OP_WIDTH : natural range 1 to 128 := 8;
DEVICE_FAMILY : string := "Cyclone V" -- "Cyclone 10 LP"
);
port
(
clk : in std_logic;
rst_n : in std_logic;
clk : in std_logic;
rst_n : in std_logic;
bpp_mode : in std_logic_vector(1 downto 0);
clear_buffer : in std_logic;
bpp_mode : in std_logic_vector(1 downto 0);
clear_buffer : in std_logic;
-- Interface to print streamer
ps_buf_wr : in std_logic;
ps_buf_wr_data : in std_logic_vector(31 downto 0);
ps_buf_rdy : out std_logic;
ps_buf_last_word : in std_logic;
ps_buf_wr : in std_logic;
ps_buf_wr_data : in std_logic_vector(31 downto 0);
ps_buf_rdy : out std_logic;
ps_buf_last_word : in std_logic;
-- Output data
pixel_buf_wr : out std_logic;
pixel_buf_wr_data : out std_logic_vector(31 downto 0);
pixel_buf_rdy : in std_logic;
pixel_buf_last_word : out std_logic;
ip_id_ip_number : out std_logic_vector(7 downto 0) := 8x"1d";
ip_id_mfr_number : out std_logic_vector(7 downto 0) := 8x"00";
ip_ver_minor_number : out std_logic_vector(7 downto 0) := 8x"02";
ip_ver_major_number : out std_logic_vector(7 downto 0) := 8x"00"
pixel_buf_wr : out std_logic;
pixel_buf_wr_data : out std_logic_vector(31 downto 0);
pixel_buf_rdy : in std_logic;
pixel_buf_last_word : out std_logic;
ip_id_ip_number : out std_logic_vector(7 downto 0) := 8x"1d";
ip_id_mfr_number : out std_logic_vector(7 downto 0) := 8x"00";
ip_ver_minor_number : out std_logic_vector(7 downto 0) := 8x"03";
ip_ver_major_number : out std_logic_vector(7 downto 0) := 8x"00"
);
end preslicer_0;
@ -87,39 +87,31 @@ end preslicer_0;
architecture rtl of preslicer_0 is
type exp_data_t is array (0 to 3) of std_logic_vector(32 downto 0);
type wn_data_t is array (0 to 2) of std_logic_vector(1 downto 0);
type ps_array_t is array (natural range <>) of std_logic_vector;
signal shift_reg : exp_data_t;
signal rdreq : std_logic;
signal word_num : wn_data_t;
signal empty : std_logic;
signal full : std_logic;
signal almost_full : std_logic;
signal q : std_logic_vector(32 downto 0);
constant DWORD_BITS : integer := 32;
constant STRIPE_SIZE : integer := ((SHIFT_DEPTH * MAX_OP_WIDTH) / DWORD_BITS);
constant DWORD_BITS : integer := 32;
constant STRIPE_SIZE : integer := ((SHIFT_DEPTH * MAX_OP_WIDTH) / DWORD_BITS);
constant DEPTH : natural range 1 to 8182 := STRIPE_SIZE * NUM_STRIPES_DEPTH; -- in 32bit words (+ 1 bit flag)
constant ALMOST_FULL_THRESH : natural range 1 to 1024 := STRIPE_SIZE * (NUM_STRIPES_DEPTH - NUM_STRIPES_FULL_MARGIN);
constant DEPTH : natural range 1 to 8182 := STRIPE_SIZE * NUM_STRIPES_DEPTH; -- in 32bit words (+ 1 bit flag)
constant ALMOST_FULL_THRESH : natural range 1 to 1024 := STRIPE_SIZE * (NUM_STRIPES_DEPTH - NUM_STRIPES_FULL_MARGIN);
signal usedw : std_logic_vector(log2(DEPTH) - 1 downto 0);
signal rdreq : std_logic;
signal word_num : ps_array_t(0 to 0)(1 downto 0);
signal empty : std_logic;
signal almost_full : std_logic;
signal q : std_logic_vector(32 downto 0);
signal bpp1_slice : exp_data_t;
signal bpp2_slice : exp_data_t;
signal bpp3_slice : exp_data_t;
signal bpp1_slice : ps_array_t(0 to 3)(32 downto 0);
signal bpp2_slice : ps_array_t(0 to 1)(32 downto 0);
signal bpp3_slice : ps_array_t(0 to 0)(32 downto 0);
signal expanded_slice : exp_data_t;
signal read_phase : std_logic;
signal pixel_buf_wr_data_int : std_logic_vector(32 downto 0);
signal read_phase : std_logic;
signal word_num_is_zero : std_logic;
signal px_buf_stalled : std_logic_vector(1 downto 0);
signal ok_to_rd : std_logic;
signal pixel_buf_wr_data_int : std_logic_vector(32 downto 0);
signal ps_buf_wr_data_int : std_logic_vector(32 downto 0);
signal ps_buf_wr_int : std_logic;
signal pixel_buf_rdy_int : std_logic;
signal ps_buf_wr_data_int : std_logic_vector(32 downto 0);
signal ps_buf_wr_int : std_logic;
signal pixel_buf_rdy_int : std_logic;
begin
-- pragma translate_off
@ -127,175 +119,118 @@ begin
-- pragma translate_on
ps_buf_wr_data_int <= ps_buf_last_word & ps_buf_wr_data;
ps_buf_wr_data_int <= ps_buf_last_word & ps_buf_wr_data;
ps_buf_wr_int <= ps_buf_wr;
ps_buf_wr_int <= ps_buf_wr;
pixel_buf_rdy_int <= pixel_buf_rdy;
pixel_buf_rdy_int <= pixel_buf_rdy;
-- Pull out the bits from the shift register for the 3 BPP mode
bpp3_slice(3) <= shift_reg(3);
bpp3_slice(2) <= shift_reg(2);
bpp3_slice(1) <= shift_reg(1);
bpp3_slice(0) <= shift_reg(0);
bpp3_slice(0) <= q;
-- @formatter:off
-- Pull out the bits from the shift register for the 2BPP mode
bpp2_slice(3) <= shift_reg(1)(32) &
"00" & shift_reg(1)(31 downto 30) & "00" & shift_reg(1)(29 downto 28) &
"00" & shift_reg(1)(27 downto 26) & "00" & shift_reg(1)(25 downto 24) &
"00" & shift_reg(1)(23 downto 22) & "00" & shift_reg(1)(21 downto 20) &
"00" & shift_reg(1)(19 downto 18) & "00" & shift_reg(1)(17 downto 16);
bpp2_slice(2) <= "000" & shift_reg(1)(15 downto 14) & "00" & shift_reg(1)(13 downto 12) &
"00" & shift_reg(1)(11 downto 10) & "00" & shift_reg(1)( 9 downto 8) &
"00" & shift_reg(1)( 7 downto 6) & "00" & shift_reg(1)( 5 downto 4) &
"00" & shift_reg(1)( 3 downto 2) & "00" & shift_reg(1)( 1 downto 0);
bpp2_slice(1) <= q(32) &
"00" & q(31 downto 30) & "00" & q(29 downto 28) &
"00" & q(27 downto 26) & "00" & q(25 downto 24) &
"00" & q(23 downto 22) & "00" & q(21 downto 20) &
"00" & q(19 downto 18) & "00" & q(17 downto 16);
bpp2_slice(1) <= shift_reg(0)(32) &
"00" & shift_reg(0)(31 downto 30) & "00" & shift_reg(0)(29 downto 28) &
"00" & shift_reg(0)(27 downto 26) & "00" & shift_reg(0)(25 downto 24) &
"00" & shift_reg(0)(23 downto 22) & "00" & shift_reg(0)(21 downto 20) &
"00" & shift_reg(0)(19 downto 18) & "00" & shift_reg(0)(17 downto 16);
bpp2_slice(0) <= "000" & shift_reg(0)(15 downto 14) & "00" & shift_reg(0)(13 downto 12) &
"00" & shift_reg(0)(11 downto 10) & "00" & shift_reg(0)( 9 downto 8) &
"00" & shift_reg(0)( 7 downto 6) & "00" & shift_reg(0)( 5 downto 4) &
"00" & shift_reg(0)( 3 downto 2) & "00" & shift_reg(0)( 1 downto 0);
bpp2_slice(0) <= "000" & q(15 downto 14) & "00" & q(13 downto 12) &
"00" & q(11 downto 10) & "00" & q( 9 downto 8) &
"00" & q( 7 downto 6) & "00" & q( 5 downto 4) &
"00" & q( 3 downto 2) & "00" & q( 1 downto 0);
-- Pull out the bits from the shift register for the 3BPP mode
bpp1_slice(3) <= shift_reg(0)(32) &
"000" & shift_reg(0)(31) & "000" & shift_reg(0)(30) & "000" & shift_reg(0)(29) & "000" & shift_reg(0)(28) &
"000" & shift_reg(0)(27) & "000" & shift_reg(0)(26) & "000" & shift_reg(0)(25) & "000" & shift_reg(0)(24);
bpp1_slice(2) <= "0000" & shift_reg(0)(23) & "000" & shift_reg(0)(22) & "000" & shift_reg(0)(21) & "000" & shift_reg(0)(20) &
"000" & shift_reg(0)(19) & "000" & shift_reg(0)(18) & "000" & shift_reg(0)(17) & "000" & shift_reg(0)(16);
bpp1_slice(1) <= "0000" & shift_reg(0)(15) & "000" & shift_reg(0)(14) & "000" & shift_reg(0)(13) & "000" & shift_reg(0)(12) &
"000" & shift_reg(0)(11) & "000" & shift_reg(0)(10) & "000" & shift_reg(0)( 9) & "000" & shift_reg(0)( 8);
bpp1_slice(0) <= "0000" & shift_reg(0)( 7) & "000" & shift_reg(0)( 6) & "000" & shift_reg(0)( 5) & "000" & shift_reg(0)( 4) &
"000" & shift_reg(0)( 3) & "000" & shift_reg(0)( 2) & "000" & shift_reg(0)( 1) & "000" & shift_reg(0)( 0);
bpp1_slice(3) <= q(32) &
"000" & q(31) & "000" & q(30) & "000" & q(29) & "000" & q(28) &
"000" & q(27) & "000" & q(26) & "000" & q(25) & "000" & q(24);
bpp1_slice(2) <= "0000" & q(23) & "000" & q(22) & "000" & q(21) & "000" & q(20) &
"000" & q(19) & "000" & q(18) & "000" & q(17) & "000" & q(16);
bpp1_slice(1) <= "0000" & q(15) & "000" & q(14) & "000" & q(13) & "000" & q(12) &
"000" & q(11) & "000" & q(10) & "000" & q( 9) & "000" & q( 8);
bpp1_slice(0) <= "0000" & q( 7) & "000" & q( 6) & "000" & q( 5) & "000" & q( 4) &
"000" & q( 3) & "000" & q( 2) & "000" & q( 1) & "000" & q( 0);
-- Pick out the appropriate slices, for the BPP mode, to get the 128 bit expanded vector
GEN_EXP_DATA : for i in 0 to 3 generate
expanded_slice(i) <= bpp1_slice(i) when bpp_mode = 2x"1" else
bpp2_slice(i) when bpp_mode = 2x"2" else
bpp3_slice(i);
end generate;
-- Indicate the word_num phases to read the fifo for each BPP mode
read_phase <= '1' when (bpp_mode = 2x"1" and word_num (0) = 2x"2") or
(bpp_mode = 2x"2" and word_num(0)(1) = '0') or
bpp_mode = 2x"3" or bpp_mode = 2x"0" else '0';
read_phase <= '1' when (bpp_mode = 2x"1" and word_num(0) = 2x"3") or
(bpp_mode = 2x"2" and word_num(0)(0) = '1') or
bpp_mode = 2x"3" or bpp_mode = 2x"0" else '0';
-- @formatter:on
-- Flag when the word_num index is 0-
word_num_is_zero <= '1' when word_num(0) = 2x"0" else '0';
-- Flag, for each BPP mode, when it is okay to read from the FIFO. For 1 BPP then only a single word is needed.
-- For 2 BPP it's okay to read when at least two words are present, for 3/4 BPP it is four.
ok_to_rd <= '1' when (empty = '0' and bpp_mode = 2x"1") or
((full = '1' or unsigned(usedw(usedw'high downto 1)) /= 0) and bpp_mode = 2x"2") or
((full = '1' or unsigned(usedw(usedw'high downto 2)) /= 0) and (bpp_mode = 2x"3" or bpp_mode = 2x"0")) else '0';
pixel_buf_wr_data <= pixel_buf_wr_data_int(31 downto 0);
pixel_buf_last_word <= pixel_buf_wr_data_int(32);
pixel_buf_wr_data <= pixel_buf_wr_data_int(31 downto 0);
pixel_buf_last_word <= pixel_buf_wr_data_int(32);
-- Instantiate The FIFO.
preslicer_fifo_inst : entity work.alt_sync_fifo
generic map
(
DATA_WIDTH => 33,
DEPTH => DEPTH,
REGISTER_OUTPUT => "ON",
NEARLY_FULL => ALMOST_FULL_THRESH,
DEVICE_FAMILY => DEVICE_FAMILY,
SHOWAHEAD => "ON",
CHECKING => "ON"
DATA_WIDTH => 33,
DEPTH => DEPTH,
REGISTER_OUTPUT => "ON",
NEARLY_FULL => ALMOST_FULL_THRESH,
DEVICE_FAMILY => DEVICE_FAMILY,
SHOWAHEAD => "ON",
CHECKING => "ON"
)
port map
(
clk => clk,
sclr => clear_buffer,
wrdata => ps_buf_wr_data_int,
wrreq => ps_buf_wr_int,
almost_full => almost_full,
empty => empty,
full => full,
usedw => usedw,
rdreq => rdreq,
rddata => q
clk => clk,
sclr => clear_buffer,
wrdata => ps_buf_wr_data_int,
wrreq => ps_buf_wr_int,
almost_full => almost_full,
empty => empty,
rdreq => rdreq,
rddata => q
);
-- Flag to print streamer we're ready for data until almost full
ps_buf_rdy <= not almost_full;
ps_buf_rdy <= not almost_full;
rdreq <= pixel_buf_rdy_int and not empty and read_phase;
PRESLICER_CTRL : process(rst_n, clk) is
begin
if rst_n = '0' then
pixel_buf_wr <= '0';
rdreq <= '0';
word_num(0) <= (others => '0');
word_num(1) <= (others => '0');
word_num(2) <= (others => '0');
px_buf_stalled <= (others => '1');
pixel_buf_wr <= '0';
word_num(0) <= (others => '0');
elsif clk'event and clk = '1' then
-- By default, read request frpm FIFO is disabled
rdreq <= '0';
-- Select, for the data output from the expanded slice, using the matching pipelined word_num value.
pixel_buf_wr_data_int <= expanded_slice(to_integer(unsigned(word_num(2))))(32 downto 0);
-- the pixel buffer is stalled whenever the ready signal is inactive or fifo not ok to read,
-- and the the word_num is 0. Pipeline this to align with the stages.
px_buf_stalled <= px_buf_stalled(0) & ((not pixel_buf_rdy_int or not ok_to_rd) and word_num_is_zero);
if bpp_mode = 2x"1" then
pixel_buf_wr_data_int <= bpp1_slice(to_integer(unsigned(word_num(0))));
elsif bpp_mode = 2x"2" then
pixel_buf_wr_data_int <= bpp2_slice(to_integer(unsigned(word_num(0)(0 downto 0))));
else
pixel_buf_wr_data_int <= bpp3_slice(0);
end if;
-- Start writing to the pixel buffer when word_num reaches 2. Clear if pixel buffer is stalled
-- (aligned with output stage).
pixel_buf_wr <= (pixel_buf_wr or word_num(0)(1)) and not px_buf_stalled(1);
pixel_buf_wr <= not empty and pixel_buf_rdy_int;
-- Read from the FIFO if the pixel buffer is ready, and okay to read, but continue
-- if in the middle of a transfer. Similarly, increment the word_num index.
if (pixel_buf_rdy_int = '1' and ok_to_rd = '1') or word_num_is_zero = '0' then
rdreq <= read_phase;
word_num(0) <= std_logic_vector(unsigned(word_num(0)) + 1);
end if;
-- Create pipeline matching versions of word_num
word_num(2) <= word_num(1);
word_num(1) <= word_num(0);
-- Update the shift register with the FIFO data, as indicated by the word_num index and BPP mode.
if bpp_mode = 2x"1" then
if word_num(0) = 2x"1" then
shift_reg(0) <= q;
end if;
elsif bpp_mode = 2x"2" then
if word_num(0) = 2x"1" then
shift_reg(0) <= q;
elsif word_num(0) = 2x"2" then
shift_reg(1) <= q;
end if;
else
shift_reg(to_integer(unsigned(word_num(0)) - 1)) <= q;
if pixel_buf_rdy_int = '1' and empty = '0' then
word_num(0) <= std_logic_vector(unsigned(word_num(0)) + 1);
end if;
if clear_buffer then
pixel_buf_wr <= '0';
rdreq <= '0';
word_num(0) <= (others => '0');
word_num(1) <= (others => '0');
word_num(2) <= (others => '0');
px_buf_stalled <= (others => '1');
pixel_buf_wr <= '0';
word_num(0) <= (others => '0');
end if;
end if;
end process;
end rtl;
end rtl;

View file

@ -0,0 +1,510 @@
[{
"ip_name": "pulse_generator_4",
"bus": "csr",
"addr_width" : "5",
"description": "Generate Fire-Requests, based on the absolute position and PD inputs - W&H specific variant",
"addr_hi_bit" : "10",
"addr_lo_bit" : "5",
"sub_blocks": {
"local": {
"instance": "",
"process": "cpp, txt",
"offset": "0x0"
},
"generic_sequencer_17": {
"instance": "channel",
"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" : "0x13",
"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" : "0x04",
"description" : "Major number"
},
"reserved" : {
"type" : "rsv",
"bit_len" : "16",
"description" : "Reserved bits"
}
}
},
"pulse_gen_control_w": {
"address": "2",
"width": "20",
"description": "",
"fields": {
"enable": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "Pulse-Generator Enable"
},
"bypass_channel_controller": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "By-Pass Ch-Ctrl (=> Fractional Divider only)"
},
"reserved_0": {
"type": "rsv",
"bit_len": "1",
"description": ""
},
"bypass_delay_equalizer": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "Bypass Delay Equalization"
},
"sw_control_dp_dir": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "Dual-Phase Direction, when Ch-Ctrl is bypassed"
},
"reserved_1": {
"type": "rsv",
"bit_len": "6",
"description": ""
},
"wh_apply_corr_en": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "Enable WH wheel correction "
},
"pp_apply_corr_en": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "Enable Pixel-Pitch Correction "
},
"tof_comp_enable": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "Enable Time-of-Flight Compensation"
},
"reserved_2": {
"type": "rsv",
"bit_len": "2",
"description": ""
},
"enable_output": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "Enable fire-request output"
},
"trigger_abort_fire": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "Abort pending request of fire-request issued by Ch-Ctrl"
},
"reset_diag_regs" : {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "Reset the local PD and Fire-Request counters"
},
"clr_pd_queue" : {
"type": "w0",
"bit_len": "1",
"reset": "0x0",
"description": "Clear PD Queue"
}
}
},
"pulse_gen_control_r": {
"address": "3",
"width": "15",
"description": "",
"fields": {
"reserved_0": {
"type": "rsv",
"bit_len": "5",
"description": ""
},
"pd_queue_error_flag": {
"type": "r",
"bit_len": "1",
"reset": "0x0",
"description": "PD Queue Overflow Error"
},
"delay_equalizer_error_flag": {
"type": "r",
"bit_len": "1",
"reset": "0x0",
"description": "Delay Equalizer Overflow Error"
},
"reserved_1": {
"type": "rsv",
"bit_len": "1",
"description": ""
},
"ch_mask_status": {
"type": "r",
"bit_len": "1",
"reset": "0x0",
"description": "ch_mask status"
},
"fire_enable_status": {
"type": "r",
"bit_len": "1",
"reset": "0x0",
"description": "fire enable status"
},
"dual_phase_directionality_select_status": {
"type": "r",
"bit_len": "1",
"reset": "0x0",
"description": "Dual-Phase Direction status"
},
"reserved_2": {
"type": "rsv",
"bit_len": "3",
"description": ""
},
"tof_sat_flag": {
"type": "r",
"bit_len": "1",
"reset": "0x0",
"description": "Asserted when the current encoder velocity value falls outside of the range covered by the ToF compensation LUT. Velocity saturation is therefore applied."
}
}
},
"pd_offset_dir_0": {
"type": "w",
"address": "4",
"reset": "0x00",
"width": "32",
"description": "PD Offset for DIR-0"
},
"pd_offset_dir_1": {
"type": "w",
"address": "5",
"reset": "0x00",
"width": "32",
"description": "PD Offset for DIR-1"
},
"channel_delay": {
"type": "w",
"address": "6",
"reset": "0x00",
"width": "16",
"description": "Channel Delay (Delay Equalization)"
},
"channel_controller_control_w": {
"address": "7",
"width": "16",
"description": "",
"fields": {
"start_seq_trigger": {
"type": "w0",
"bit_len": "1",
"reset": "0x0",
"description": "Ch-Ctrl Sequencer Start-Request"
},
"reserved0": {
"type": "rsv",
"bit_len": "7",
"description": ""
},
"sequencer_start_address": {
"type": "w",
"bit_len": "8",
"reset" : "0x0",
"description": "Ch-Ctrl Sequencer Start-Address"
}
}
},
"channel_controller_control_r": {
"address": "8",
"width": "2",
"description": "",
"fields": {
"reserved0": {
"type": "rsv",
"bit_len": "1",
"description": ""
},
"busy": {
"type": "r",
"bit_len": "1",
"reset": "0x0",
"description": "Ch-Ctrl Sequencer Busy"
}
}
},
"fractional_divider_control": {
"address": "9",
"width": "3",
"description": "Fractional Divider Control Register",
"fields": {
"enable": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "Fractional Divider Enable"
},
"udp_max_pos": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "Clear the encoder jitter for DIR-0"
},
"udp_min_pos": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "Clear the encoder jitter for DIR-1"
}
}
},
"divider_ratio_int": {
"type": "w",
"address": "10",
"reset": "0x00",
"width": "10",
"description": "Integer part of the Division ratio"
},
"divider_ratio_fraction": {
"type": "w",
"address": "11",
"reset": "0x00",
"width": "24",
"description": "Fractional part of the Division ratio"
},
"subpixel_phase_num": {
"type": "w",
"address": "12",
"reset": "0x01",
"width": "6",
"description": "Number of sub-pixel phases to be generated"
},
"abs_position_max": {
"type": "r",
"address": "13",
"reset": "0x00",
"width": "32",
"subtype": "signed",
"description": "Absolute Position Maximum"
},
"abs_position_min": {
"type": "r",
"address": "14",
"reset": "0x00",
"width": "32",
"subtype": "signed",
"description": "Absolute Position Minimum"
},
"abs_position": {
"type": "r",
"address": "15",
"reset": "0x00",
"width": "32",
"subtype": "signed",
"description": "Current Absolute Position "
},
"pd_counter": {
"type": "r",
"address": "16",
"reset": "0x00",
"width": "16",
"description": "PD counter"
},
"fire_req_counter": {
"type": "r",
"address": "17",
"reset": "0x00",
"width": "24",
"description": "Fire-Request counter"
},
"enc_speed_meas_window": {
"address": "18",
"width": "20",
"type": "w",
"reset": "0x0C350",
"description": "Encoder speed measurement window length [clock cycles @100MHz]"
},
"enc_speed": {
"address": "19",
"width": "20",
"type": "r",
"reset": "0x0",
"subtype": "signed",
"description": "Encoder Velocity: balance between positive and negative encoder steps over the measurement window"
},
"tof_compensation_w": {
"address": "20",
"width": "32",
"description": "Time-of-Flight Compensation",
"fields": {
"enc_speed_norm": {
"type": "w",
"bit_len": "16",
"reset": "0x0100",
"description": "Encoder Speed Normalization factor: allow to match the encoder-speed range to the address bus width of the ToF Compensation LUT. With the default value (256), an encoder-speed measurement equal to k selects LUT address k)"
},
"reserved0": {
"type": "rsv",
"bit_len": "16",
"description": ""
}
}
},
"tof_compensation_r": {
"address": "21",
"width": "32",
"description": "Time-of-Flight Compensation",
"fields": {
"reserved0": {
"type": "rsv",
"bit_len": "16",
"description": ""
},
"tof_lut_comp": {
"type": "r",
"bit_len": "16",
"reset": "0x0",
"description": "Current value of the Time-of-Flight compensation"
}
}
},
"pixel_pitch_corr_stripe_num": {
"type": "w",
"address": "22",
"reset": "0x00",
"width": "24",
"description": "Number of stripes to be considered for pixel pitch correction: corresponds to the number of pixels composing the label, head width included)"
},
"pixel_pitch_pos_err_2_corr": {
"type": "w",
"address": "23",
"reset": "0x00",
"width": "32",
"description": "Static value used by the logic to compute pixel-pitch correction: need to be set to the number of 2^32/stripe_num, where stripe_num is the value programmed in pixel_pitch_corr_stripe_num"
},
"pixel_pitch_skip_corr_thres": {
"type": "w",
"address": "24",
"reset": "0x400000",
"width": "24",
"description": "Alignment error threshold causing a correction to be skipped, expressed in encoder steps (24-bits integer) "
},
"pixel_pitch_loop_filter_corr": {
"address": "25",
"width": "32",
"description": "Loop filter coefficient for pixel-pitch correction",
"fields": {
"delta_error_coeff": {
"type": "w",
"bit_len": "16",
"reset": "0x0100",
"description": "Loop Filter delta-error coefficient"
},
"tot_error_coeff": {
"type": "w",
"bit_len": "16",
"reset": "0x0100",
"description": "Loop Filter tot-error coefficient"
}
}
},
"pixel_pitch_pos_err_curr": {
"type": "r",
"address": "26",
"reset": "0x00",
"width": "32",
"subtype": "signed",
"description": "Pixel-pitch misalignment measured on the last rotation [encoder steps], represented as signed, fixed point with 24-bits integer part and 8-bits mantissa"
},
"pixel_pitch_pos_err_max": {
"type": "r",
"address": "27",
"reset": "0x00",
"width": "32",
"subtype": "signed",
"description": "Maximum recorded value of pixel-pitch misalignment [encoder steps], represented as signed, fixed point with 24-bits integer part and 8-bits mantissa"
},
"pixel_pitch_pos_err_min": {
"type": "r",
"address": "28",
"reset": "0x00",
"width": "32",
"subtype": "signed",
"description": "Minimum recorded value of pixel-pitch misalignment [encoder steps], represented as signed, fixed point with 24-bits integer part and 8-bits mantissa"
},
"pixel_pitch_div_ratio_corr": {
"type": "r",
"address": "29",
"reset": "0x00",
"width": "32",
"subtype": "signed",
"description": "Division-Ratio Correction (32-LSBs)"
},
"pixel_pitch_corr_cnt": {
"type": "r",
"address": "30",
"reset": "0x00",
"width": "16",
"description": "Pixel-pitch corrections count"
}
}
},
{
"ip_name" : "pulse_generator_4",
"bus" : "seq",
"addr_hi_bit" : "10",
"addr_lo_bit" : "9",
"description" : "Generate Fire-Requests, based on the absolute position and PD inputs - W&H specific variant",
"sub_blocks" : {
"generic_sequencer_17" : {
"instance" : "channel",
"process" : "cpp",
"offset" : "0x200"
}
}
}
]

View file

@ -0,0 +1,83 @@
# 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 SRC_PATH ../src
set COMMON_PATH ../../../common/0/src
set SEQUENCER_PATH ../../../generic_sequencer/17
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 $COMMON_PATH/altera/sync_fifo.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/queue_and_delay.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/dpram_sclk.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/altera/alt_rw_dp_ram.vhd
#vcom -2008 -work $WORKLIB $SEQUENCER_PATH/src/altera/generic_seq_ram_16.vhd
vcom -2008 -work $WORKLIB $SEQUENCER_PATH/src/generic_sequencer_17_cmd_pkg.vhd
vcom -2008 -work $WORKLIB $SEQUENCER_PATH/src/generic_sequencer_17_pkg_auto.vhd
vcom -2008 -work $WORKLIB $SEQUENCER_PATH/src/generic_sequencer_17_csr_regs_auto.vhd
vcom -2008 -work $WORKLIB $SEQUENCER_PATH/src/generic_sequencer_17.vhd
vcom -2008 -work $WORKLIB $SRC_PATH/simple_frac_div_4.vhd
vcom -2008 -work $WORKLIB $SRC_PATH/pulse_generator_4_pkg_auto.vhd
vcom -2008 -work $WORKLIB $SRC_PATH/pulse_generator_4_csr_regs_auto.vhd
vcom -2008 -work $WORKLIB $SRC_PATH/pulse_generator_4.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/ch_ctrl_cfg_tb.vhd
vsim -t ps work.ch_ctrl_cfg_tb
#add wave /ch_ctrl_cfg_tb/*
#add wave ch_ctrl_cfg_tb/iUUT/*
# remove warnings from standard numeric/arithmetic packages (speed-up simulation)
set StdArithNoWarnings 1
set NumericStdNoWarnings 1
do wave_ch_ctrl_cfg.do
when -label end_of_simulation {test_completed == true} {echo "Simulation Completed"; stop ;}
run -all
#run 1 ms;
}

View file

@ -0,0 +1,82 @@
# 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/17
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 $COMMON_PATH/altera/sync_fifo.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/queue_and_delay.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/dpram_sclk.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/altera/alt_rw_dp_ram.vhd
#vcom -2008 -work $WORKLIB $SEQUENCER_PATH/src/altera/generic_seq_ram_16.vhd
vcom -2008 -work $WORKLIB $SEQUENCER_PATH/src/generic_sequencer_17_cmd_pkg.vhd
vcom -2008 -work $WORKLIB $SEQUENCER_PATH/src/generic_sequencer_17_pkg_auto.vhd
vcom -2008 -work $WORKLIB $SEQUENCER_PATH/src/generic_sequencer_17_csr_regs_auto.vhd
vcom -2008 -work $WORKLIB $SEQUENCER_PATH/src/generic_sequencer_17.vhd
vcom -2008 -work $WORKLIB $SRC_PATH/simple_frac_div_4.vhd
vcom -2008 -work $WORKLIB $SRC_PATH/pulse_generator_4_pkg_auto.vhd
vcom -2008 -work $WORKLIB $SRC_PATH/pulse_generator_4_csr_regs_auto.vhd
vcom -2008 -work $WORKLIB $SRC_PATH/pulse_generator_4.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;
}

View 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_4.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;
}

View file

@ -0,0 +1,86 @@
# 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 SRC_PATH ../src
set COMMON_PATH ../../../common/0/src
set SEQUENCER_PATH ../../../generic_sequencer/17
set FPM_PATH ../../../fire_pulse_manager/7/src
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 $COMMON_PATH/altera/sync_fifo.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/queue_and_delay.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/dpram_sclk.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/altera/alt_rw_dp_ram.vhd
#vcom -2008 -work $WORKLIB $SEQUENCER_PATH/src/altera/generic_seq_ram_16.vhd
vcom -2008 -work $WORKLIB $SEQUENCER_PATH/src/generic_sequencer_17_cmd_pkg.vhd
vcom -2008 -work $WORKLIB $SEQUENCER_PATH/src/generic_sequencer_17_pkg_auto.vhd
vcom -2008 -work $WORKLIB $SEQUENCER_PATH/src/generic_sequencer_17_csr_regs_auto.vhd
vcom -2008 -work $WORKLIB $SEQUENCER_PATH/src/generic_sequencer_17.vhd
vcom -2008 -work $WORKLIB $SRC_PATH/simple_frac_div_4.vhd
vcom -2008 -work $WORKLIB $SRC_PATH/pulse_generator_4_pkg_auto.vhd
vcom -2008 -work $WORKLIB $SRC_PATH/pulse_generator_4_csr_regs_auto.vhd
vcom -2008 -work $WORKLIB $SRC_PATH/pulse_generator_4.vhd
vcom -2008 -work $WORKLIB $FPM_PATH/simple_enc_vel_detect_6.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/tof_comp_tb.vhd
vsim -t ps work.tof_comp_tb
#add wave tof_comp_tb/*
#add wave tof_comp_tb/iUUT/*
#add wave tof_comp_tb/iVEL/*
# remove warnings from standard numeric/arithmetic packages (speed-up simulation)
set StdArithNoWarnings 1
set NumericStdNoWarnings 1
do wave_tof_comp.do
when -label end_of_simulation {test_completed == true} {echo "Simulation Completed"; stop ;}
run -all
#run 1 ms;
}

View file

@ -0,0 +1,255 @@
onerror {resume}
quietly WaveActivateNextPane {} 0
add wave -noupdate /ch_ctrl_cfg_tb/reset_n
add wave -noupdate /ch_ctrl_cfg_tb/clk
add wave -noupdate /ch_ctrl_cfg_tb/wheel_error
add wave -noupdate /ch_ctrl_cfg_tb/rotation_idx
add wave -noupdate -radix decimal /ch_ctrl_cfg_tb/iUUT/wh_rotat_cnt
add wave -noupdate /ch_ctrl_cfg_tb/wh_pos_err_r
add wave -noupdate /ch_ctrl_cfg_tb/div_ratio_corr_rr
add wave -noupdate /ch_ctrl_cfg_tb/wheel_corr_on
add wave -noupdate /ch_ctrl_cfg_tb/pos_error
add wave -noupdate /ch_ctrl_cfg_tb/pos_error_old
add wave -noupdate /ch_ctrl_cfg_tb/div_ratio_corr_r
add wave -noupdate /ch_ctrl_cfg_tb/div_ratio_r
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/iUUT/div_ratio
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/iUUT/div_ratio_i
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/iUUT/div_ratio_corr
add wave -noupdate -radix decimal /ch_ctrl_cfg_tb/iUUT/wh_loop_filt_tot
add wave -noupdate -radix decimal /ch_ctrl_cfg_tb/iUUT/wh_loop_filt_delta
add wave -noupdate -radix decimal /ch_ctrl_cfg_tb/iUUT/wh_pos_err_old
add wave -noupdate -radix decimal /ch_ctrl_cfg_tb/iUUT/wh_tot_err
add wave -noupdate -radix decimal /ch_ctrl_cfg_tb/iUUT/wh_delta_err
add wave -noupdate -radix decimal /ch_ctrl_cfg_tb/iUUT/wh_loop_err
add wave -noupdate /ch_ctrl_cfg_tb/wh_pos_err_r
add wave -noupdate -radix decimal /ch_ctrl_cfg_tb/iUUT/wh_pos_err_curr
add wave -noupdate /ch_ctrl_cfg_tb/init
add wave -noupdate /ch_ctrl_cfg_tb/pd_in
add wave -noupdate /ch_ctrl_cfg_tb/skip_pd
add wave -noupdate /ch_ctrl_cfg_tb/wheel_pos
add wave -noupdate -radix decimal /ch_ctrl_cfg_tb/abs_position
add wave -noupdate /ch_ctrl_cfg_tb/dp_dir
add wave -noupdate /ch_ctrl_cfg_tb/fire_req
add wave -noupdate /ch_ctrl_cfg_tb/fire_req_vec
add wave -noupdate /ch_ctrl_cfg_tb/start_of_image_vec
add wave -noupdate /ch_ctrl_cfg_tb/filtered_pd
add wave -noupdate /ch_ctrl_cfg_tb/ch_pd
add wave -noupdate /ch_ctrl_cfg_tb/ch_mask
add wave -noupdate /ch_ctrl_cfg_tb/raw_fire_req
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/avs_address
add wave -noupdate /ch_ctrl_cfg_tb/avs_write
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/avs_writedata
add wave -noupdate /ch_ctrl_cfg_tb/avs_read
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/avs_readdata
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/avs_m
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/avs_s
add wave -noupdate /ch_ctrl_cfg_tb/pd_in_cnt
add wave -noupdate /ch_ctrl_cfg_tb/pd_out_cnt
add wave -noupdate /ch_ctrl_cfg_tb/test_completed
add wave -noupdate /ch_ctrl_cfg_tb/setup
add wave -noupdate /ch_ctrl_cfg_tb/running
add wave -noupdate /ch_ctrl_cfg_tb/passed
add wave -noupdate /ch_ctrl_cfg_tb/failed
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/fire_req
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/fire_req_vec
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/start_of_image_vec
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/start_of_image
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/start_image_flag
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/start_img
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/new_pixel
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/subpix_phase
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/subpix_phase_cnt
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/subpixel_phase_num
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/wh_apply_corr_en
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/wh_error_meas_avail
add wave -noupdate /ch_ctrl_cfg_tb/pos_error
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/iUUT/wh_pos_err_abs
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/iUUT/wh_skip_corr_thres
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/wh_skip_corr
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/wh_corr_ready
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/wh_error_meas_started
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/init_wh
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/loc_pd_d
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/wh_meas_event
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/wh_img_end
add wave -noupdate -radix unsigned /ch_ctrl_cfg_tb/iUUT/wh_img_pixel_cnt
add wave -noupdate -radix unsigned /ch_ctrl_cfg_tb/iUUT/wh_image_pixel_len
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/first_img_started
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/wh_error_meas_avail
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/wh_corr_ready_v
add wave -noupdate -radix decimal /ch_ctrl_cfg_tb/iUUT/start_pos
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/abs_pos_d
add wave -noupdate -radix decimal /ch_ctrl_cfg_tb/iUUT/basic_pos_error
add wave -noupdate -radix unsigned /ch_ctrl_cfg_tb/iUUT/wh_pos_err_abs
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/wh_skip_corr_thres
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/iUUT/wh_pos_err
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/wh_pos_err_max
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/wh_pos_err_min
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/wh_pos_err_2_corr
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/div_ratio_corr_new
add wave -noupdate -radix decimal /ch_ctrl_cfg_tb/iUUT/pos_error
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/iUUT/div_ratio_corr_ext
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/iUUT/div_ratio
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/iUUT/div_ratio_i
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/iUUT/div_ratio_corr
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/clk
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/reset_n
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/init
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/pd_in
add wave -noupdate -radix decimal /ch_ctrl_cfg_tb/iUUT/abs_position
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/dp_dir
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/filtered_pd
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/ch_pd
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/ch_mask
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/enc_pulse
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/iUUT/avs_address
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/avs_write
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/iUUT/avs_writedata
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/avs_read
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/iUUT/avs_readdata
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/init_de
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/init_qd
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/enable
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/loc_pd
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/pd_queue_error
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/ch_ctrl_start_req
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/pd_pulse
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/filt_pd
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/filt_pd_d
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/ch_ctrl_write
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/ch_ctrl_read
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/ch_ctrl_busy
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/enable_i
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/ch_mask_i
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/bypass_ch_ctrl
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/bypass_delay_equal
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/div_pulse
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/gated_pulse
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/retimed_pulse
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/avs_write_i
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/avs_read_d
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/avs_read_i
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/de_queue_error
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/cnt_dir
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/dp_dir_i
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/ch_ctrl_start_req_i
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/set_first_pd
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/dp_dir_d
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/start_img_req
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/start_img_req_d
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/start_img
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/start_img_d
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/start_img_dd
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/fire_enable
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/img_completed
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/sw_ctrl_dp_dir
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/enable_out
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/ch_ctrl_start_req_d
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/add_img_size
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/add_img_size_d
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/abort_fire
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/ch_ctrl_csr_write
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/ch_ctrl_csr_read
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/frac_div_en_i
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/upd_max_pos
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/upd_min_pos
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/frac_div_en
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/gen_filt_pd
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/upd_max_pos_i
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/upd_min_pos_i
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/dir_change
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/first_pd
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/pd_in_d
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/filt_pd_i
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/abs_pos_lsb
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/ch_ctrl_start_req_ii
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/prevent_div_restart
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/rst_jitter
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/rst_diag_regs
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/fire_req
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/mid_cross
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/mid_crossed
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/zero_cross
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/close_to_zero
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/close_to_mid
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/div_pulse_i
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/spitting_enable
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/spit_pulse
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/seq_bus_valid
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/spit_nco_msb
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/abs_pos_msb_old
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/ch_ctrl_csr_addr
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/ch_ctrl_trigger_in
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/avs_addr
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/init_v
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/ch_ctrl_start_addr
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/ch_ctrl_address
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/img_size
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/pixel_cnt
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/ch_ctrl_vector_out
add wave -noupdate -radix unsigned /ch_ctrl_cfg_tb/iUUT/ch_offset
add wave -noupdate -radix unsigned /ch_ctrl_cfg_tb/iUUT/ch_delay
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/iUUT/avs_readdata_i
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/iUUT/ch_ctrl_writedata
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/iUUT/ch_ctrl_readdata
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/iUUT/ch_ctrl_csr_writedata
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/iUUT/ch_ctrl_csr_readdata
add wave -noupdate -radix unsigned /ch_ctrl_cfg_tb/iUUT/ch_offset_dir0
add wave -noupdate -radix unsigned /ch_ctrl_cfg_tb/iUUT/ch_offset_dir1
add wave -noupdate -radix decimal /ch_ctrl_cfg_tb/iUUT/abs_pos_max
add wave -noupdate -radix decimal /ch_ctrl_cfg_tb/iUUT/abs_pos_min
add wave -noupdate -radix decimal /ch_ctrl_cfg_tb/iUUT/last_pd_pos
add wave -noupdate -radix unsigned /ch_ctrl_cfg_tb/iUUT/fire_req_cnt
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/iUUT/seq_bus_data
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/iUUT/spit_nco
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/iUUT/spit_nco_inc
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/iUUT/div_ratio
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/div_ratio_i
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/div_ratio_corr
add wave -noupdate -divider {PD Queue}
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/USE_EXT_TIME
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/QUEUE_SIZE
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/rstN
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/clk
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/init
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/cnt_dir
add wave -noupdate -radix decimal /ch_ctrl_cfg_tb/iUUT/iPD_queue/delay
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/ext_time
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/wave_in
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/wave_out
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/ovf_error
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/toggle_in
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/toggle_out
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/time_elapsed
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/wave_in_d
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/wave_out_i
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/pending_trans
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/fifo_rd_en
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/fifo_empty
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/fifo_full
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/cnt_dir_i
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/wave_out_i_d
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/new_event
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/wave_out_ii
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/shf_enable
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/delay_line
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/local_time_d
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/event_time
TreeUpdate [SetDefaultTree]
WaveRestoreCursors {{Cursor 1} {2135755000 ps} 0} {{Cursor 2} {15451360286 ps} 0}
quietly wave cursor active 2
configure wave -namecolwidth 293
configure wave -valuecolwidth 216
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 {17886802338 ps} {19427520930 ps}

View file

@ -0,0 +1,148 @@
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/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/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 -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/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/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 -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/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_ctrl_start_req_i
add wave -noupdate /pd_jitter_verify_tb/iUUT/set_first_pd
add wave -noupdate /pd_jitter_verify_tb/iUUT/dp_dir_d
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/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/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_ratio
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 {85023836 ps} {100488220 ps}

View file

@ -0,0 +1,77 @@
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/ideal_fire
add wave -noupdate /simple_frac_div_tb/firing_error
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 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 {3225966927 ps} {3226491215 ps}

View file

@ -0,0 +1,270 @@
onerror {resume}
quietly WaveActivateNextPane {} 0
add wave -noupdate /tof_comp_tb/reset_n
add wave -noupdate /tof_comp_tb/clk
add wave -noupdate /tof_comp_tb/init
add wave -noupdate /tof_comp_tb/pd_in
add wave -noupdate -radix decimal /tof_comp_tb/abs_position
add wave -noupdate /tof_comp_tb/dp_dir
add wave -noupdate /tof_comp_tb/fire_req
add wave -noupdate /tof_comp_tb/filtered_pd
add wave -noupdate /tof_comp_tb/ch_pd
add wave -noupdate /tof_comp_tb/ch_mask
add wave -noupdate /tof_comp_tb/raw_fire_req
add wave -noupdate /tof_comp_tb/avs_address
add wave -noupdate /tof_comp_tb/avs_write
add wave -noupdate /tof_comp_tb/avs_writedata
add wave -noupdate /tof_comp_tb/avs_read
add wave -noupdate /tof_comp_tb/avs_readdatavalid
add wave -noupdate /tof_comp_tb/avs_readdata
add wave -noupdate /tof_comp_tb/avs_m
add wave -noupdate /tof_comp_tb/avs_s
add wave -noupdate /tof_comp_tb/step_pos
add wave -noupdate /tof_comp_tb/step_neg
add wave -noupdate -radix decimal /tof_comp_tb/vel_meas
add wave -noupdate -radix unsigned /tof_comp_tb/iUUT/tof_lut_addr
add wave -noupdate -radix unsigned /tof_comp_tb/iUUT/tof_lut_comp
add wave -noupdate -radix unsigned /tof_comp_tb/iUUT/ch_delay
add wave -noupdate -radix unsigned /tof_comp_tb/iUUT/ch_delay_i
add wave -noupdate /tof_comp_tb/end_of_stimuli
add wave -noupdate /tof_comp_tb/test_completed
add wave -noupdate /tof_comp_tb/setup
add wave -noupdate /tof_comp_tb/running
add wave -noupdate /tof_comp_tb/passed
add wave -noupdate /tof_comp_tb/failed
add wave -noupdate /tof_comp_tb/vel_meas_cnt
add wave -noupdate /tof_comp_tb/vel_upd_flag
add wave -noupdate /tof_comp_tb/iUUT/clk
add wave -noupdate /tof_comp_tb/iUUT/reset_n
add wave -noupdate /tof_comp_tb/iUUT/init
add wave -noupdate /tof_comp_tb/iUUT/pd_in
add wave -noupdate -radix decimal /tof_comp_tb/iUUT/abs_position
add wave -noupdate /tof_comp_tb/fire_cnt
add wave -noupdate /tof_comp_tb/raw_fire_cnt
add wave -noupdate /tof_comp_tb/iUUT/dp_dir
add wave -noupdate -radix decimal /tof_comp_tb/iUUT/enc_vel
add wave -noupdate -radix hexadecimal /tof_comp_tb/iUUT/norm_enc_vel
add wave -noupdate /tof_comp_tb/iUUT/fire_req
add wave -noupdate /tof_comp_tb/iUUT/tof_comp_enable
add wave -noupdate -radix unsigned /tof_comp_tb/iUUT/tof_lut_wr_addr
add wave -noupdate -radix unsigned /tof_comp_tb/iUUT/tof_lut_addr
add wave -noupdate -radix unsigned /tof_comp_tb/iUUT/ch_delay
add wave -noupdate -radix unsigned /tof_comp_tb/iUUT/ch_delay_i
add wave -noupdate /tof_comp_tb/iUUT/tof_saturation
add wave -noupdate /tof_comp_tb/iUUT/tof_sat_flag
add wave -noupdate /tof_comp_tb/iUUT/gated_pulse
add wave -noupdate /tof_comp_tb/iUUT/retimed_pulse
add wave -noupdate -radix unsigned /tof_comp_tb/iUUT/enc_speed_norm_coeff
add wave -noupdate -radix hexadecimal /tof_comp_tb/iUUT/tof_lut_wr_data
add wave -noupdate -radix unsigned /tof_comp_tb/iUUT/tof_lut_wr_q
add wave -noupdate -radix unsigned /tof_comp_tb/iUUT/tof_lut_comp
add wave -noupdate -radix unsigned /tof_comp_tb/iUUT/tof_lut_comp_i
add wave -noupdate -radix decimal /tof_comp_tb/iVEL/vel_meas
add wave -noupdate /tof_comp_tb/iVEL/sampling_pulse
add wave -noupdate /tof_comp_tb/iUUT/filtered_pd
add wave -noupdate /tof_comp_tb/iUUT/ch_pd
add wave -noupdate /tof_comp_tb/iUUT/ch_mask
add wave -noupdate /tof_comp_tb/iUUT/raw_fire_req
add wave -noupdate /tof_comp_tb/iUUT/enc_pulse
add wave -noupdate /tof_comp_tb/iUUT/avs_address
add wave -noupdate /tof_comp_tb/iUUT/avs_write
add wave -noupdate /tof_comp_tb/iUUT/avs_writedata
add wave -noupdate /tof_comp_tb/iUUT/avs_read
add wave -noupdate /tof_comp_tb/iUUT/avs_readdatavalid
add wave -noupdate /tof_comp_tb/iUUT/avs_readdata
add wave -noupdate /tof_comp_tb/iUUT/init_de
add wave -noupdate /tof_comp_tb/iUUT/init_qd
add wave -noupdate /tof_comp_tb/iUUT/enable
add wave -noupdate /tof_comp_tb/iUUT/loc_pd
add wave -noupdate /tof_comp_tb/iUUT/pd_queue_error
add wave -noupdate /tof_comp_tb/iUUT/ch_ctrl_start_req
add wave -noupdate /tof_comp_tb/iUUT/pd_pulse
add wave -noupdate /tof_comp_tb/iUUT/filt_pd
add wave -noupdate /tof_comp_tb/iUUT/filt_pd_d
add wave -noupdate /tof_comp_tb/iUUT/ch_ctrl_write
add wave -noupdate /tof_comp_tb/iUUT/ch_ctrl_read
add wave -noupdate /tof_comp_tb/iUUT/ch_ctrl_busy
add wave -noupdate /tof_comp_tb/iUUT/enable_i
add wave -noupdate /tof_comp_tb/iUUT/ch_mask_i
add wave -noupdate /tof_comp_tb/iUUT/bypass_ch_ctrl
add wave -noupdate /tof_comp_tb/iUUT/bypass_delay_equal
add wave -noupdate /tof_comp_tb/iUUT/div_pulse
add wave -noupdate /tof_comp_tb/iUUT/gated_pulse
add wave -noupdate /tof_comp_tb/iUUT/retimed_pulse
add wave -noupdate /tof_comp_tb/iUUT/avs_write_i
add wave -noupdate /tof_comp_tb/iUUT/avs_read_d
add wave -noupdate /tof_comp_tb/iUUT/avs_read_i
add wave -noupdate /tof_comp_tb/iUUT/de_queue_error
add wave -noupdate /tof_comp_tb/iUUT/cnt_dir
add wave -noupdate /tof_comp_tb/iUUT/dp_dir_i
add wave -noupdate /tof_comp_tb/iUUT/ch_ctrl_start_req_i
add wave -noupdate /tof_comp_tb/iUUT/set_first_pd
add wave -noupdate /tof_comp_tb/iUUT/dp_dir_d
add wave -noupdate /tof_comp_tb/iUUT/pulse_scale_out
add wave -noupdate /tof_comp_tb/iUUT/start_img_req
add wave -noupdate /tof_comp_tb/iUUT/start_img_req_d
add wave -noupdate /tof_comp_tb/iUUT/start_img
add wave -noupdate /tof_comp_tb/iUUT/start_img_d
add wave -noupdate /tof_comp_tb/iUUT/start_img_dd
add wave -noupdate /tof_comp_tb/iUUT/fire_enable
add wave -noupdate /tof_comp_tb/iUUT/img_completed
add wave -noupdate /tof_comp_tb/iUUT/sw_ctrl_dp_dir
add wave -noupdate /tof_comp_tb/iUUT/enable_out
add wave -noupdate /tof_comp_tb/iUUT/ch_ctrl_start_req_d
add wave -noupdate /tof_comp_tb/iUUT/add_img_size
add wave -noupdate /tof_comp_tb/iUUT/add_img_size_d
add wave -noupdate /tof_comp_tb/iUUT/abort_fire
add wave -noupdate /tof_comp_tb/iUUT/ch_ctrl_csr_write
add wave -noupdate /tof_comp_tb/iUUT/ch_ctrl_csr_read
add wave -noupdate /tof_comp_tb/iUUT/frac_div_en_i
add wave -noupdate /tof_comp_tb/iUUT/upd_max_pos
add wave -noupdate /tof_comp_tb/iUUT/upd_min_pos
add wave -noupdate /tof_comp_tb/iUUT/frac_div_en
add wave -noupdate /tof_comp_tb/iUUT/gen_filt_pd
add wave -noupdate /tof_comp_tb/iUUT/upd_max_pos_i
add wave -noupdate /tof_comp_tb/iUUT/upd_min_pos_i
add wave -noupdate /tof_comp_tb/iUUT/dir_change
add wave -noupdate /tof_comp_tb/iUUT/first_pd
add wave -noupdate /tof_comp_tb/iUUT/pd_in_d
add wave -noupdate /tof_comp_tb/iUUT/filt_pd_i
add wave -noupdate /tof_comp_tb/iUUT/abs_pos_lsb
add wave -noupdate /tof_comp_tb/iUUT/ch_ctrl_start_req_ii
add wave -noupdate /tof_comp_tb/iUUT/prevent_div_restart
add wave -noupdate /tof_comp_tb/iUUT/rst_jitter
add wave -noupdate /tof_comp_tb/iUUT/rst_diag_regs
add wave -noupdate /tof_comp_tb/iUUT/fire_req
add wave -noupdate /tof_comp_tb/iUUT/mid_cross
add wave -noupdate /tof_comp_tb/iUUT/mid_crossed
add wave -noupdate /tof_comp_tb/iUUT/zero_cross
add wave -noupdate /tof_comp_tb/iUUT/close_to_zero
add wave -noupdate /tof_comp_tb/iUUT/close_to_mid
add wave -noupdate /tof_comp_tb/iUUT/div_pulse_i
add wave -noupdate /tof_comp_tb/iUUT/spitting_enable
add wave -noupdate /tof_comp_tb/iUUT/spit_pulse
add wave -noupdate /tof_comp_tb/iUUT/seq_bus_valid
add wave -noupdate /tof_comp_tb/iUUT/spit_nco_msb
add wave -noupdate /tof_comp_tb/iUUT/wh_apply_corr_en
add wave -noupdate /tof_comp_tb/iUUT/wh_error_meas_avail
add wave -noupdate /tof_comp_tb/iUUT/wh_corr_ready
add wave -noupdate /tof_comp_tb/iUUT/wh_error_meas_started
add wave -noupdate /tof_comp_tb/iUUT/init_wh
add wave -noupdate /tof_comp_tb/iUUT/loc_pd_d
add wave -noupdate /tof_comp_tb/iUUT/wh_meas_event
add wave -noupdate /tof_comp_tb/iUUT/tof_lut_wr_en
add wave -noupdate /tof_comp_tb/iUUT/tof_comp_enable
add wave -noupdate /tof_comp_tb/iUUT/abs_pos_msb_old
add wave -noupdate /tof_comp_tb/iUUT/ch_ctrl_csr_addr
add wave -noupdate /tof_comp_tb/iUUT/ch_ctrl_trigger_in
add wave -noupdate /tof_comp_tb/iUUT/wh_corr_ready_v
add wave -noupdate /tof_comp_tb/iUUT/avs_addr
add wave -noupdate /tof_comp_tb/iUUT/init_v
add wave -noupdate /tof_comp_tb/iUUT/ch_ctrl_start_addr
add wave -noupdate /tof_comp_tb/iUUT/ch_ctrl_address
add wave -noupdate -radix unsigned /tof_comp_tb/iUUT/tof_lut_wr_addr
add wave -noupdate -radix unsigned /tof_comp_tb/iUUT/tof_lut_addr
add wave -noupdate -radix unsigned /tof_comp_tb/iUUT/tof_lut_comp
add wave -noupdate -radix unsigned /tof_comp_tb/iUUT/tof_lut_comp_i
add wave -noupdate -radix unsigned /tof_comp_tb/iUUT/ch_delay
add wave -noupdate -radix unsigned /tof_comp_tb/iUUT/ch_delay_i
add wave -noupdate /tof_comp_tb/iUUT/tof_saturation
add wave -noupdate /tof_comp_tb/iUUT/tof_sat_flag
add wave -noupdate /tof_comp_tb/iUUT/avs_address_i
add wave -noupdate /tof_comp_tb/iUUT/enc_vel_i
add wave -noupdate /tof_comp_tb/iUUT/wh_rotat_cnt
add wave -noupdate /tof_comp_tb/iUUT/basic_pos_error
add wave -noupdate /tof_comp_tb/iUUT/wh_loop_filt_tot
add wave -noupdate /tof_comp_tb/iUUT/wh_loop_filt_delta
add wave -noupdate -radix unsigned /tof_comp_tb/iUUT/enc_speed_norm_coeff
add wave -noupdate -radix hexadecimal /tof_comp_tb/iUUT/tof_lut_wr_data
add wave -noupdate -radix unsigned /tof_comp_tb/iUUT/tof_lut_wr_q
add wave -noupdate /tof_comp_tb/iUUT/img_size
add wave -noupdate /tof_comp_tb/iUUT/pixel_cnt
add wave -noupdate /tof_comp_tb/iUUT/ch_ctrl_vector_out
add wave -noupdate /tof_comp_tb/iUUT/wh_pos_err
add wave -noupdate /tof_comp_tb/iUUT/wh_pos_err_max
add wave -noupdate /tof_comp_tb/iUUT/wh_pos_err_old
add wave -noupdate /tof_comp_tb/iUUT/wh_tot_err
add wave -noupdate /tof_comp_tb/iUUT/wh_delta_err
add wave -noupdate /tof_comp_tb/iUUT/norm_enc_vel
add wave -noupdate /tof_comp_tb/iUUT/ch_offset
add wave -noupdate -radix decimal /tof_comp_tb/iVEL/vel_meas
add wave -noupdate /tof_comp_tb/iUUT/avs_readdata_i
add wave -noupdate /tof_comp_tb/iUUT/ch_ctrl_writedata
add wave -noupdate /tof_comp_tb/iUUT/ch_ctrl_readdata
add wave -noupdate /tof_comp_tb/iUUT/ch_ctrl_csr_writedata
add wave -noupdate /tof_comp_tb/iUUT/ch_ctrl_csr_readdata
add wave -noupdate /tof_comp_tb/iUUT/ch_offset_dir0
add wave -noupdate /tof_comp_tb/iUUT/ch_offset_dir1
add wave -noupdate /tof_comp_tb/iUUT/abs_pos_max
add wave -noupdate /tof_comp_tb/iUUT/abs_pos_min
add wave -noupdate /tof_comp_tb/iUUT/last_pd_pos
add wave -noupdate /tof_comp_tb/iUUT/fire_req_cnt
add wave -noupdate /tof_comp_tb/iUUT/seq_bus_data
add wave -noupdate /tof_comp_tb/iUUT/spit_nco
add wave -noupdate /tof_comp_tb/iUUT/spit_nco_inc
add wave -noupdate /tof_comp_tb/iUUT/start_pos
add wave -noupdate /tof_comp_tb/iUUT/abs_pos_d
add wave -noupdate /tof_comp_tb/iUUT/wh_pos_err_2_corr
add wave -noupdate /tof_comp_tb/iUUT/div_ratio
add wave -noupdate /tof_comp_tb/iUUT/div_ratio_i
add wave -noupdate /tof_comp_tb/iUUT/div_ratio_corr
add wave -noupdate /tof_comp_tb/iUUT/div_ratio_corr_new
add wave -noupdate /tof_comp_tb/iUUT/pos_error
add wave -noupdate /tof_comp_tb/iUUT/wh_loop_err
add wave -noupdate /tof_comp_tb/iUUT/div_ratio_corr_ext
add wave -noupdate /tof_comp_tb/iVEL/clk
add wave -noupdate /tof_comp_tb/iVEL/init
add wave -noupdate /tof_comp_tb/iVEL/step_pos
add wave -noupdate /tof_comp_tb/iVEL/step_neg
add wave -noupdate /tof_comp_tb/iVEL/init_i
add wave -noupdate /tof_comp_tb/iVEL/sampling_pulse
add wave -noupdate /tof_comp_tb/iVEL/sampling_per_cnt
add wave -noupdate /tof_comp_tb/iVEL/vel_meas_i
add wave -noupdate /tof_comp_tb/iVEL/vel_meas_sat_pos
add wave -noupdate /tof_comp_tb/iVEL/vel_meas_sat_neg
add wave -noupdate -divider {Delay Equalizer}
add wave -noupdate /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/rstN
add wave -noupdate /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/clk
add wave -noupdate /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/init
add wave -noupdate /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/cnt_dir
add wave -noupdate -radix decimal /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/delay
add wave -noupdate /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/ext_time
add wave -noupdate /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/wave_in
add wave -noupdate /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/wave_out
add wave -noupdate /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/ovf_error
add wave -noupdate /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/toggle_in
add wave -noupdate /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/toggle_out
add wave -noupdate /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/time_elapsed
add wave -noupdate /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/wave_in_d
add wave -noupdate /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/wave_out_i
add wave -noupdate /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/pending_trans
add wave -noupdate /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/fifo_rd_en
add wave -noupdate /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/fifo_empty
add wave -noupdate /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/fifo_full
add wave -noupdate /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/cnt_dir_i
add wave -noupdate /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/wave_out_i_d
add wave -noupdate /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/new_event
add wave -noupdate /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/wave_out_ii
add wave -noupdate /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/shf_enable
add wave -noupdate /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/delay_line
add wave -noupdate -radix unsigned /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/int_time
add wave -noupdate /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/local_time_d
add wave -noupdate -radix unsigned /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/event_time
TreeUpdate [SetDefaultTree]
WaveRestoreCursors {{Cursor 1} {10895000 ps} 0} {{Cursor 2} {121098274 ps} 0}
quietly wave cursor active 1
configure wave -namecolwidth 394
configure wave -valuecolwidth 100
configure wave -justifyvalue left
configure wave -signalnamewidth 0
configure wave -snapdistance 10
configure wave -datasetprefix 0
configure wave -rowmargin 4
configure wave -childrowmargin 2
configure wave -gridoffset 0
configure wave -gridperiod 1
configure wave -griddelta 40
configure wave -timeline 0
configure wave -timelineunits ps
update
WaveRestoreZoom {0 ps} {220244480 ps}

View file

@ -0,0 +1,970 @@
-------------------------------------------------------------------------------
-- Title : Pulse Generator
-- Project : ELGIP
-------------------------------------------------------------------------------
-- File : Pulse Generator.vhd
-- Author : Gianmarco Girau
-- Company : Global Inkjet Systems
-- Created : 2016-10-24
-- Last update: 2021-04-12
-- SVN ID : Git
-- Standard : VHDL'93
-------------------------------------------------------------------------------
-- Description:
-- The Pulse Generator implements the following functionalities:
-- PD queue, with channel specific offset (positional)
-- Fire-Request-Generation (Fractional Divider)
-- Spitting Functionality
-- Delay Equalization: compensate for the difference in the channel latency
-- when daisy-chaining multiple EMBs.
-- Pulse-Width conditioning, for transmission over the POF (to be moved out
-- from the block in the future)
-- Channel control: Mask/Unmask pulse generation based on PD, image length,
-- directionality etc.
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library work;
use work.common_pkg.all;
entity pulse_generator_4 is
generic(
PD_QUEUE_SIZE : natural range 32 to 1024 := 64;
PULSE_DELAY_EQUAL_EN : boolean := true;
SPITTING_EN : boolean := true;
BIDIR_CH_OFFSET_EN : boolean := true;
DIAG_COUNTERS : boolean := true;
TOF_COMP_EN : boolean := false;
PIXEL_PITCH_CORR_EN : boolean := false);
port(
clk : in std_logic;
reset_n : in std_logic := '1';
--
init : in std_logic;
-- Sequencer I/Os
pd_in : in std_logic;
abs_position : in std_logic_vector(31 downto 0);
enc_vel : in std_logic_vector(19 downto 0) := (others => '0');
enc_speed_meas_w : out std_logic_vector(19 downto 0);
dp_dir : out std_logic;
fire_req_vec : out std_logic_vector(31 downto 0);
start_of_image_vec : out std_logic_vector(31 downto 0);
stream_busy_a : in std_logic := '0';
stream_busy_b : in std_logic := '0';
-- diagnostic outputs
filtered_pd : out std_logic;
ch_pd : out std_logic;
ch_mask : out std_logic;
raw_fire_req : out std_logic;
enc_pulse : out std_logic;
-----------------------------------------------------------------------
-- Avalon MM Interface
-----------------------------------------------------------------------
avs_address : in std_logic_vector(10 downto 0);
avs_write : in std_logic;
avs_writedata : in std_logic_vector(31 downto 0);
avs_read : in std_logic;
avs_readdata : out std_logic_vector(31 downto 0));
end entity pulse_generator_4;
architecture rtl of pulse_generator_4 is
component dpram_sclk is
generic (
DATA_WIDTH : natural;
ADDR_WIDTH : natural);
port (
clk : in std_logic;
addr_a : in std_logic_vector(ADDR_WIDTH-1 downto 0);
we_a : in std_logic := '1';
data_a : in std_logic_vector(DATA_WIDTH-1 downto 0);
q_a : out std_logic_vector(DATA_WIDTH-1 downto 0);
addr_b : in std_logic_vector(ADDR_WIDTH-1 downto 0);
we_b : in std_logic := '1';
data_b : in std_logic_vector(DATA_WIDTH-1 downto 0);
q_b : out std_logic_vector(DATA_WIDTH-1 downto 0));
end component dpram_sclk;
-- constants
constant CSR_IP_ID : std_logic_vector(31 downto 0) := x"0000FF13";
constant CSR_IP_VER : std_logic_vector(31 downto 0) := x"00000303";
constant TOF_COMP_LUT_DEPTH : natural := 512;
constant TOF_COMP_LUT_WIDTH : natural := 16;
signal init_de, init_qd, enable, loc_pd, pd_queue_error : std_logic;
signal ch_ctrl_start_req, pd_pulse, filt_pd, filt_pd_d : std_logic;
signal ch_ctrl_write, ch_ctrl_read, ch_ctrl_busy, enable_i : std_logic;
signal ch_mask_i, bypass_ch_ctrl, bypass_delay_equal : std_logic;
signal div_pulse, gated_pulse, retimed_pulse : std_logic;
signal avs_write_i, avs_read_d, avs_read_i, de_queue_error : std_logic;
signal cnt_dir, dp_dir_i, ch_ctrl_start_req_i : std_logic;
signal set_first_pd : std_logic;
signal dp_dir_d, loc_pd_d, loc_pd_dd : std_logic;
signal start_img_req, start_img_req_d, start_img, start_img_d : std_logic;
signal start_img_dd, fire_enable, img_completed : std_logic;
signal sw_ctrl_dp_dir, enable_out, ch_ctrl_start_req_d : std_logic;
signal add_img_size, add_img_size_d, abort_fire : std_logic;
signal ch_ctrl_csr_write, ch_ctrl_csr_read, frac_div_en_i : std_logic;
signal upd_max_pos, upd_min_pos, frac_div_en, gen_filt_pd : std_logic;
signal upd_max_pos_i, upd_min_pos_i, dir_change, first_pd : std_logic;
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, start_of_image, new_pixel : std_logic;
signal mid_cross, mid_crossed, zero_cross : std_logic;
signal close_to_zero, close_to_mid : std_logic;
signal div_pulse_i, spitting_enable, spit_pulse : std_logic;
signal seq_bus_valid, spit_nco_msb : std_logic;
signal wh_apply_corr_en, wh_error_meas_avail, wh_corr_ready : std_logic;
signal wh_error_meas_started, init_wh : std_logic;
signal wh_meas_event, wh_img_end, first_img_started : std_logic;
signal tof_lut_wr_en, tof_comp_enable : std_logic;
signal tof_saturation, tof_sat_flag : std_logic;
signal wh_apply_corr_en_d, wh_corr_start, wh_skip_corr : std_logic;
signal wh_img_2nd_half, wh_img_2nd_half_d : std_logic;
signal selected_pulse, selected_pulse_d, clr_pd_queue : std_logic;
signal zero_gap_mode, start_image_flag : std_logic;
signal use_ch_offset_dir1, add_ppc_regs, add_tof_comp_regs : std_logic;
signal add_delay_eq_reg, add_diag_reg : std_logic;
--
signal abs_pos_msb_old : std_logic_vector( 1 downto 0);
signal ch_ctrl_csr_addr : std_logic_vector( 3 downto 0);
signal wh_corr_ready_v, ch_ctrl_trigger_in : std_logic_vector( 5 downto 0);
signal avs_addr : std_logic_vector( 4 downto 0);
signal subpix_phase_cnt, subpixel_phase_num : std_logic_vector( 5 downto 0);
signal init_v : std_logic_vector( 7 downto 0);
signal ch_ctrl_start_addr, bpe_top : std_logic_vector( 7 downto 0);
signal ch_ctrl_address : std_logic_vector( 7 downto 0);
signal tof_lut_wr_addr, tof_lut_addr : std_logic_vector( 8 downto 0);
signal wh_rotat_cnt, gnd_16 : std_logic_vector(15 downto 0);
signal wh_loop_filt_tot, wh_loop_filt_delta : std_logic_vector(15 downto 0);
signal ch_delay, ch_delay_i : std_logic_vector(15 downto 0);
signal enc_speed_norm_coeff, tof_lut_wr_data : std_logic_vector(15 downto 0);
signal tof_lut_wr_q, tof_lut_comp : std_logic_vector(15 downto 0);
signal tof_lut_comp_i : std_logic_vector(15 downto 0);
signal pd_cnt : std_logic_vector(15 downto 0);
signal enc_speed_meas_w_i, enc_vel_i : std_logic_vector(19 downto 0);
signal img_size, pixel_cnt : std_logic_vector(23 downto 0);
signal ch_ctrl_vector_out : std_logic_vector(23 downto 0);
signal wh_skip_corr_thres : std_logic_vector(23 downto 0);
signal wh_img_pixel_cnt, wh_image_pixel_len : std_logic_vector(23 downto 0);
signal basic_pos_error_sat : std_logic_vector(23 downto 0);
signal fire_req_cnt : std_logic_vector(23 downto 0);
signal norm_enc_vel : std_logic_vector(35 downto 0);
signal ch_offset, avs_readdata_i : std_logic_vector(31 downto 0);
signal ch_ctrl_writedata, ch_ctrl_readdata : std_logic_vector(31 downto 0);
signal ch_ctrl_csr_writedata : std_logic_vector(31 downto 0);
signal ch_ctrl_csr_readdata : std_logic_vector(31 downto 0);
signal ch_offset_dir0, ch_offset_dir1 : std_logic_vector(31 downto 0);
signal abs_pos_max, abs_pos_min : std_logic_vector(31 downto 0);
signal last_pd_pos, basic_pos_error : std_logic_vector(31 downto 0);
signal seq_bus_data, spit_nco, spit_nco_inc : std_logic_vector(31 downto 0);
signal start_pos, abs_pos_d : std_logic_vector(31 downto 0);
signal subpix_phase : std_logic_vector(31 downto 0);
signal wh_pos_err_2_corr : std_logic_vector(31 downto 0);
signal wh_pos_err_max, wh_pos_err_min : std_logic_vector(31 downto 0);
signal wh_pos_err, wh_pos_err_curr : std_logic_vector(31 downto 0);
signal wh_pos_err_old, wh_pos_err_abs : std_logic_vector(31 downto 0);
signal wh_tot_err, wh_delta_err : std_logic_vector(31 downto 0);
signal div_ratio, div_ratio_i : std_logic_vector(33 downto 0);
signal div_ratio_corr, div_ratio_corr_new : std_logic_vector(33 downto 0);
signal wh_loop_err_delta, wh_loop_err_tot : std_logic_vector(47 downto 0);
signal pos_error, wh_loop_err : std_logic_vector(47 downto 0);
signal div_ratio_corr_ext : std_logic_vector(63 downto 0);
begin
-----------------------------------------------------------------------------
-- PD Jitter management
-----------------------------------------------------------------------------
-- Filter PD pulses in the following situations:
-- I. dp_dir = '0', no new max on abs_pos
-- II. dp_dir = '1', no new min on abs_pos
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 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';
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
if(clk = '1' and clk'event) then
pd_in_d <= pd_in;
if(set_first_pd = '1') then
first_pd <= '1';
elsif(filt_pd = '1') then
first_pd <= '0';
end if;
filt_pd <= gen_filt_pd;
filt_pd_d <= filt_pd;
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;
-----------------------------------------------------------------------------
-- PD Queue
-----------------------------------------------------------------------------
-- To implement the PD queuse a standard queue-and-delay block is used,
-- driven by the absolute position instead of a time counter. To prevent
-- confusing the queue-and-delay block, a PD pulse is de-asserted only on the
-- next increment of absolute position
pLOC_PD_IN : process(clk)
begin
if(clk = '1' and clk'event) then
abs_pos_lsb <= abs_position(0);
if(filt_pd = '1' and filt_pd_d = '0') then
filt_pd_i <= '1';
elsif(init = '1' or (filt_pd = '0' and filt_pd_i = '1' and abs_position(0) /= abs_pos_lsb)) then
filt_pd_i <= '0';
end if;
end if;
end process pLOC_PD_IN;
-- Note on the maximum size of queue: long PD queues must be taken care of at SW
-- level, here the size is limited to 128 (on the PMB it was 16)
iPD_queue: entity work.queue_and_delay
generic map (
USE_EXT_TIME => true,
QUEUE_SIZE => 2*PD_QUEUE_SIZE)
port map (
rstN => reset_n,
clk => clk,
init => init_qd,
cnt_dir => cnt_dir,
delay => ch_offset,
ext_time => abs_position,
wave_in => filt_pd_i,
wave_out => loc_pd,
ovf_error => pd_queue_error);
-- make sure the PD queue is always cleared whenever there is a change of direction
dir_change <= dp_dir_i xor dp_dir_d;
gBYDIR_CH_OFF: if BIDIR_CH_OFFSET_EN = true generate
use_ch_offset_dir1 <= '1';
else generate
use_ch_offset_dir1 <= '0';
end generate gBYDIR_CH_OFF;
-- channel offset selection
pCH_OFF_SEL : process(clk)
begin
if(clk = '1' and clk'event) then
if(use_ch_offset_dir1 = '1') then
if(dp_dir_i = '0') then
ch_offset <= ch_offset_dir0;
else
ch_offset <= ch_offset_dir1;
end if;
else
ch_offset <= ch_offset_dir0;
end if;
end if;
end process pCH_OFF_SEL;
-- output to the monitoring point/event-logger
ch_pd <= loc_pd;
-- enable the queue_and_delay counter to count backward
cnt_dir <= ch_ctrl_vector_out(0);
pDIR_CHG : process(clk)
begin
if(clk = '1' and clk'event) then
init_qd <= not enable or init or dir_change or clr_pd_queue or wh_corr_start;
if(bypass_ch_ctrl = '1') then
dp_dir_i <= sw_ctrl_dp_dir;
else
dp_dir_i <= ch_ctrl_vector_out(0);
end if;
dp_dir_d <= dp_dir_i;
end if;
end process pDIR_CHG;
dp_dir <= dp_dir_i;
-----------------------------------------------------------------------------
-- Channel control
-----------------------------------------------------------------------------
-- Generate a gating signal to apply to the divider output.
-- The gating signal is generated through a generic sequencer:
-- Sequencer triggers:
-- - Absolute position (bus)
-- - PD (from PD queue)
-- Sequencer outputs
-- - Gating signal (ch_mask)
i_channel_control : entity work.generic_sequencer_17
generic map (
TRIGGER_WIDTH => 6,
VECTOR_WIDTH => 24,
BUS_WIDTH => 32,
POS_WIDTH => 24,
SEQ_DEPTH => 256,
ADD_VEC_PIPE => false,
VECT_CPU_EN => false,
VECT_RAMP_EN => false,
BUS_BURST_EN => SPITTING_EN,
POS_BUS_EN => true,
ALU_EN => false,
QUEUE_EN => false)
port map (
clk => clk,
reset_n => reset_n,
avs_csr_address => ch_ctrl_csr_addr,
avs_csr_write => ch_ctrl_csr_write,
avs_csr_writedata => ch_ctrl_csr_writedata,
avs_csr_read => ch_ctrl_csr_read,
avs_csr_readdata => ch_ctrl_csr_readdata,
avs_seq_address => ch_ctrl_address,
avs_seq_write => ch_ctrl_write,
avs_seq_writedata => ch_ctrl_writedata,
avs_seq_read => ch_ctrl_read,
avs_seq_readdata => ch_ctrl_readdata,
start_req => ch_ctrl_start_req,
start_addr => ch_ctrl_start_addr,
trigger_in => ch_ctrl_trigger_in,
pos_in => abs_position(23 downto 0),
busy => ch_ctrl_busy,
vector_out => ch_ctrl_vector_out,
bus_data => seq_bus_data,
bus_valid => seq_bus_valid,
bus_ack => '1');
ch_ctrl_trigger_in <= (0 => loc_pd, 1 => fire_enable, 2 => gated_pulse, 3 => (not fire_enable), 4 => (not stream_busy_a), 5 => (not stream_busy_b));
ch_mask_i <= fire_enable or ch_ctrl_vector_out(1) or bypass_ch_ctrl;
-- output to the monitoring point/event-logger
ch_mask <= ch_mask_i;
start_img_req <= ch_ctrl_vector_out(2);
add_img_size <= ch_ctrl_vector_out(3);
prevent_div_restart <= ch_ctrl_vector_out(4);
--rst_jitter <= ch_ctrl_vector_out(5); -- The actual assignment is
--latched exactly as dp_dir to make sure both of them change at the same
--clock cycle
zero_gap_mode <= ch_ctrl_vector_out(7);
ch_ctrl_start_req_i <= ch_ctrl_start_req_ii and enable and not init;
ch_ctrl_start_req <= ch_ctrl_start_req_i and not ch_ctrl_start_req_d;
pGEN_IMAGE: process(clk)
begin
if(clk = '1' and clk'event) then
ch_ctrl_start_req_d <= ch_ctrl_start_req_i;
start_img_req_d <= start_img_req;
start_img_d <= start_img;
start_img_dd <= start_img_d;
add_img_size_d <= add_img_size;
if(img_completed = '1' or enable = '0' or abort_fire = '1') then
fire_enable <= '0';
elsif(start_img_dd = '1' and fire_enable = '0') then
fire_enable <= '1';
end if;
if(start_img = '1' and fire_enable = '0') then
img_size <= X"00" & ch_ctrl_vector_out(23 downto 8);
elsif(add_img_size = '1' and add_img_size_d = '0') then
img_size <= std_logic_vector(unsigned(img_size)+unsigned(ch_ctrl_vector_out(23 downto 8)));
end if;
if (start_img = '1' and (fire_enable = '0' or zero_gap_mode = '1')) then
pixel_cnt <= (others => '0');
elsif(fire_enable = '1' and new_pixel = '1') then
pixel_cnt <= std_logic_vector(unsigned(pixel_cnt)+1);
end if;
if(init = '1' or enable = '0' or new_pixel = '1') then
start_image_flag <= '0';
elsif(start_img = '1') then
start_image_flag <= '1';
end if;
end if;
end process pGEN_IMAGE;
start_of_image <= start_image_flag and fire_req;
start_img <= start_img_req and not start_img_req_d;
img_completed <= '1' when fire_enable = '1' and unsigned(pixel_cnt) = unsigned(img_size) else '0';
-----------------------------------------------------------------------------
-- Fractional Divider
-----------------------------------------------------------------------------
iFracDiv : entity work.simple_frac_div_4
port map (
clk => clk,
enable => frac_div_en,
dir => dp_dir_i,
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 => (others => '0'),
ratio => div_ratio_i,
abs_pos => abs_position,
enc_pulse => enc_pulse,
fire => div_pulse_i,
fire_cnt => open);
div_pulse <= div_pulse_i when spitting_enable = '0' else spit_pulse;
-- In case upd_min_pos/upd_max_pos are asserted as a consequence of init, you
-- need to guarantee a sufficient delay to make sure abs_pos get reset before
-- updating min/max pos
p_pulse_div_switch : process(clk)
begin
if(clk = '1' and clk'event) then
rst_jitter <= ch_ctrl_vector_out(5);
upd_max_pos <= upd_max_pos_i or init_v(0) or dir_change or (rst_jitter and not dp_dir_i);
upd_min_pos <= upd_min_pos_i or init_v(0) or dir_change or (rst_jitter and dp_dir_i);
frac_div_en <= frac_div_en_i and enable and not init and not ((start_img and not prevent_div_restart and not bypass_ch_ctrl) or dir_change);
end if;
end process p_pulse_div_switch;
-- output to the monitoring point/event-logger
raw_fire_req <= div_pulse;
-----------------------------------------------------------------------------
-- W&H Div-Ratio Correction for Flexo/CI cylinders
-----------------------------------------------------------------------------
gPP_CORR_GEN: if PIXEL_PITCH_CORR_EN = true generate
add_ppc_regs <= '1';
pDIV_RATIO_CORR : process(clk)
begin
if(clk = '1' and clk'event) then
-- latch the absolute-position to prevent excessive degradation of timing
abs_pos_d <= abs_position;
if(init_wh = '1' or wh_img_end = '1') then
wh_img_pixel_cnt <= (others => '0');
elsif(fire_enable = '1' and div_pulse = '1') then
wh_img_pixel_cnt <= std_logic_vector(unsigned(wh_img_pixel_cnt)+1);
end if;
loc_pd_d <= loc_pd;
wh_apply_corr_en_d <= wh_apply_corr_en;
init_wh <= init or (not enable) or (not wh_apply_corr_en);
if(init_wh = '1') then
div_ratio_corr <= (others => '0');
elsif(wh_corr_ready = '1' and wh_skip_corr = '0') then
div_ratio_corr <= std_logic_vector(signed(div_ratio_corr)+signed(div_ratio_corr_new));
end if;
div_ratio_i <= std_logic_vector(signed(div_ratio)+signed(div_ratio_corr));
wh_img_2nd_half_d <= wh_img_2nd_half;
if(init_wh = '1' or wh_skip_corr = '1') then
first_img_started <= '0';
elsif(wh_img_2nd_half = '1' and wh_img_2nd_half_d = '0') then
first_img_started <= '1';
end if;
if(init_wh = '1' or wh_skip_corr = '1') then
wh_error_meas_started <= '0';
elsif(wh_meas_event = '1' and first_img_started = '1') then
wh_error_meas_started <= not wh_error_meas_started;
end if;
if(wh_meas_event = '1' and wh_error_meas_started = '0') then
start_pos <= abs_pos_d;
end if;
if((loc_pd_d and wh_img_end) = '1' or wh_skip_corr = '1') then
basic_pos_error <= (others => '0');
elsif(wh_meas_event = '1' and wh_error_meas_started = '1') then
if(loc_pd_d = '1') then
basic_pos_error <= std_logic_vector(resize(signed(abs_pos_d)-signed(start_pos), basic_pos_error'length));
else
basic_pos_error <= std_logic_vector(resize(signed(start_pos)-signed(abs_pos_d), basic_pos_error'length));
end if;
end if;
if(wh_error_meas_started = '1' and (loc_pd_d or wh_img_end) = '1') then
wh_error_meas_avail <= '1';
else
wh_error_meas_avail <= '0';
end if;
wh_corr_ready_v <= wh_corr_ready_v(wh_corr_ready_v'left-1 downto 0) & wh_error_meas_avail;
pos_error <= std_logic_vector(signed(basic_pos_error_sat & 24x"0") - signed(div_ratio));
if(init_wh = '1' or wh_skip_corr = '1') then
wh_pos_err_old <= (others => '0');
elsif(wh_corr_ready_v(0) = '1') then
wh_pos_err_old <= wh_pos_err;
end if;
wh_loop_err_delta <= std_logic_vector(signed(wh_delta_err)*signed(wh_loop_filt_delta));
wh_loop_err_tot <= std_logic_vector(signed(wh_tot_err)*signed(wh_loop_filt_tot));
wh_loop_err <= std_logic_vector(signed(wh_loop_err_delta)+signed(wh_loop_err_tot));
if(wh_corr_ready_v(2) = '1') then
div_ratio_corr_ext <= std_logic_vector(signed(wh_loop_err(wh_loop_err'left-8 downto 8))*signed(wh_pos_err_2_corr));
end if;
-- Compute the absolute value of the position-error. Use a simple 1's
-- complement if you need to do sign inversion
if(wh_pos_err(wh_pos_err'left) = '1') then
wh_pos_err_abs <= not wh_pos_err;
else
wh_pos_err_abs <= wh_pos_err;
end if;
if(init_wh = '1') then
wh_pos_err_curr <= (others => '0');
elsif(wh_corr_ready_v(0) = '1') then
wh_pos_err_curr <= wh_pos_err;
end if;
if(wh_corr_ready_v(1) = '1' and unsigned(wh_pos_err_abs) > unsigned(wh_skip_corr_thres & X"00") and first_img_started = '1') then
wh_skip_corr <= '1';
elsif(loc_pd = '1') then
wh_skip_corr <= '0';
end if;
if(init_wh = '1') then
wh_pos_err_max <= (others => '0');
elsif(wh_corr_ready = '1' and signed(wh_pos_err) > signed(wh_pos_err_max)) then
wh_pos_err_max <= wh_pos_err;
end if;
if(init_wh = '1') then
wh_pos_err_min <= (others => '0');
elsif(wh_corr_ready = '1' and signed(wh_pos_err) < signed(wh_pos_err_min)) then
wh_pos_err_min <= wh_pos_err;
end if;
if(init_wh = '1') then
wh_rotat_cnt <= (others => '0');
elsif(wh_corr_ready = '1') then
wh_rotat_cnt <= std_logic_vector(unsigned(wh_rotat_cnt)+1);
end if;
end if;
end process pDIV_RATIO_CORR;
wh_img_end <= '1' when unsigned(wh_img_pixel_cnt) = unsigned(wh_image_pixel_len) else '0';
wh_img_2nd_half <= '1' when unsigned(wh_img_pixel_cnt) >= unsigned(wh_image_pixel_len(wh_image_pixel_len'left downto 1)) else '0';
wh_corr_start <= wh_apply_corr_en and not wh_apply_corr_en_d;
wh_meas_event <= loc_pd_d xor wh_img_end;
div_ratio_corr_new <= std_logic_vector(resize(signed(div_ratio_corr_ext(div_ratio_corr_ext'left downto 16)),div_ratio'length));
wh_corr_ready <= wh_corr_ready_v(wh_corr_ready_v'left);
-- saturate the basic position error when exceeding the size of a 24-bits
-- signed number
bpe_top <= basic_pos_error(31 downto 24);
basic_pos_error_sat <= basic_pos_error(23 downto 0) when (signed(bpe_top) = 0 or signed(bpe_top) = -1) else X"7FFFFF" when signed(bpe_top) > 0 else X"800000";
-- No need to use 24 bits mantissa for pos_error, 8 bits are plenty
wh_pos_err <= pos_error(pos_error'left downto 16);
wh_tot_err <= wh_pos_err;
wh_delta_err <= std_logic_vector(signed(wh_pos_err)-signed(wh_pos_err_old));
end generate gPP_CORR_GEN;
gNOT_PP_CORR_GEN: if PIXEL_PITCH_CORR_EN = false generate
add_ppc_regs <= '0';
--
div_ratio_i <= div_ratio;
div_ratio_corr <= (others => '0');
wh_corr_start <= '0';
wh_rotat_cnt <= (others => '0');
wh_pos_err_curr <= (others => '0');
wh_pos_err_min <= (others => '0');
wh_pos_err_max <= (others => '0');
end generate gNOT_PP_CORR_GEN;
-----------------------------------------------------------------------------
-- Spitting logic
-----------------------------------------------------------------------------
gSPIT_LOGIC: if SPITTING_EN generate
pSPITTING_LOGIC : process(clk)
begin
if(clk = '1' and clk'event) then
spitting_enable <= ch_ctrl_vector_out(6);
if(seq_bus_valid = '1') then
spit_nco_inc <= seq_bus_data;
end if;
if(spitting_enable = '0') then
spit_nco <= (others => '0');
else
spit_nco <= std_logic_vector(unsigned(spit_nco)+unsigned(spit_nco_inc));
end if;
spit_nco_msb <= spit_nco(spit_nco'left);
spit_pulse <= spit_nco(spit_nco'left) and not spit_nco_msb;
end if;
end process pSPITTING_LOGIC;
else generate
spitting_enable <= '0';
spit_pulse <= '0';
end generate gSPIT_LOGIC;
-----------------------------------------------------------------------------
-- Pulse Gating
-----------------------------------------------------------------------------
gated_pulse <= div_pulse and ch_mask_i and enable_out;
-----------------------------------------------------------------------------
-- Delay Equalization
-----------------------------------------------------------------------------
-- compendate for variation in the channel delay when daisy-chaining multiple
-- EMBs/HMBs:
gPULSE_DELAY_EQUAL: if PULSE_DELAY_EQUAL_EN = true generate
add_delay_eq_reg <= '1';
iDE: entity work.queue_and_delay
generic map (
DELAY_WIDTH => 16,
USE_EXT_TIME => false,
QUEUE_SIZE => 256)
port map (
rstN => reset_n,
clk => clk,
init => init_de,
cnt_dir => '0',
delay => ch_delay_i,
ext_time => (others => '0'),
wave_in => gated_pulse,
wave_out => retimed_pulse,
ovf_error => de_queue_error);
init_de <= (not enable) or bypass_delay_equal;
end generate gPULSE_DELAY_EQUAL;
gNOT_PULSE_DELAY_EQUAL: if PULSE_DELAY_EQUAL_EN = false generate
add_delay_eq_reg <= '0';
retimed_pulse <= gated_pulse;
de_queue_error <= '0';
end generate gNOT_PULSE_DELAY_EQUAL;
p_delay_equal_switch : process(clk)
begin
if(clk = '1' and clk'event) then
if(bypass_delay_equal = '1') then
selected_pulse <= gated_pulse;
else
selected_pulse <= retimed_pulse;
end if;
selected_pulse_d <= selected_pulse;
end if;
end process p_delay_equal_switch;
-- perform edge detection to remove the pulse-width inserted either by
-- ch-ctrl sequencer or delay-equalization
fire_req <= selected_pulse and not selected_pulse_d;
-----------------------------------------------------------------------------
-- Sub-Pixel Phase generation
-----------------------------------------------------------------------------
-- Split fire-request stream into sub-pixel offset
pSUBPIXEL_GEN : process(clk)
variable first_pixel : std_logic;
begin
if(clk = '1' and clk'event) then
if(fire_enable = '0' or new_pixel = '1') then
subpix_phase_cnt <= (others => '0');
elsif(fire_req = '1') then
subpix_phase_cnt <= std_logic_vector(unsigned(subpix_phase_cnt)+1);
end if;
if(fire_enable = '0' or new_pixel = '1') then
subpix_phase <= (0 => '1', others => '0');
elsif(fire_req = '1') then
subpix_phase <= subpix_phase(30 downto 0) & subpix_phase(31);
end if;
if(fire_req = '1') then
fire_req_vec <= subpix_phase;
else
fire_req_vec <= (others => '0');
end if;
if(fire_req = '1' and start_image_flag = '1') then
start_of_image_vec <= subpix_phase;
else
start_of_image_vec <= (others => '0');
end if;
end if;
end process pSUBPIXEL_GEN;
-- new pixel flag is asserted on the last phase of the pixel.
new_pixel <= '1' when subpix_phase_cnt = subpixel_phase_num else '0';
--fire_req_vec <= (0 => fire_req, others => '0');
--start_of_image_vec <= (0 => start_of_image, others => '0');
-----------------------------------------------------------------------------
-- Time-of-Flight Compensation
-----------------------------------------------------------------------------
gTOF_COMP_GEN: if TOF_COMP_EN = true and PULSE_DELAY_EQUAL_EN = true generate
add_tof_comp_regs <= '1';
pTOF_COMP : process(clk)
begin
if(clk = '1' and clk'event) then
-- if the encoder speed is negative, do a 1's complement (no need to
-- waste resources with the 2's complement).
-- Note: you don't really care to know whether the encoder speed
-- matches the direction used for generating fire-request, because
-- fire-request are not generated in the wrong direction
if(enc_vel(enc_vel'left) = '1') then
enc_vel_i <= not enc_vel;
else
enc_vel_i <= enc_vel;
end if;
if(tof_saturation = '1') then
tof_lut_addr <= (others => '1');
else
tof_lut_addr <= norm_enc_vel(norm_enc_vel'left-19 downto (norm_enc_vel'left-19-tof_lut_addr'left));
end if;
if(init or (not enable) or (not tof_comp_enable)) then
tof_sat_flag <= '0';
elsif(tof_saturation = '1') then
tof_sat_flag <= '1';
end if;
ch_delay_i <= std_logic_vector(unsigned(ch_delay)+unsigned(tof_lut_comp));
if(tof_comp_enable = '1') then
tof_lut_comp <= tof_lut_comp_i;
else
tof_lut_comp <= (others => '0');
end if;
end if;
end process pTOF_COMP;
norm_enc_vel <= std_logic_vector(unsigned(enc_vel_i)*unsigned(enc_speed_norm_coeff));
tof_saturation <= '1' when unsigned(norm_enc_vel(norm_enc_vel'left downto norm_enc_vel'left-18)) /= 0 else '0';
--iTOF_COMP_LUT : entity work.dpram_sclk
iTOF_COMP_LUT : dpram_sclk
generic map (
DATA_WIDTH => TOF_COMP_LUT_WIDTH,
ADDR_WIDTH => log2(TOF_COMP_LUT_DEPTH))
port map (
clk => clk,
addr_a => tof_lut_wr_addr,
we_a => tof_lut_wr_en,
data_a => tof_lut_wr_data,
q_a => tof_lut_wr_q,
addr_b => tof_lut_addr,
we_b => '0',
data_b => gnd_16,
q_b => tof_lut_comp_i);
gnd_16 <= (others => '0');
end generate gTOF_COMP_GEN;
gTOF_COMP_NOGEN: if TOF_COMP_EN = false or PULSE_DELAY_EQUAL_EN = false generate
add_tof_comp_regs <= '0';
ch_delay_i <= ch_delay;
tof_sat_flag <= '0';
tof_lut_wr_q <= (others => '0');
tof_lut_comp <= (others => '0');
end generate gTOF_COMP_NOGEN;
-----------------------------------------------------------------------------
-- Local Diagnostic registers
-----------------------------------------------------------------------------
gDIAG_CNT: if DIAG_COUNTERS = true generate
add_diag_reg <= '1';
pEdgeDetect_Cnt : process(clk)
begin
if(clk = '1' and clk'event) then
loc_pd_dd <= loc_pd;
if(init = '1' or enable = '0' or rst_diag_regs = '1') then
pd_cnt <= (others => '0');
elsif(loc_pd = '1' and loc_pd_dd = '0') then
pd_cnt <= std_logic_vector(unsigned(pd_cnt)+1);
end if;
if(init = '1' or enable = '0' or rst_diag_regs = '1') then
fire_req_cnt <= (others => '0');
elsif(new_pixel = '1') then
fire_req_cnt <= std_logic_vector(unsigned(fire_req_cnt)+1);
end if;
end if;
end process pEdgeDetect_Cnt;
else generate
add_diag_reg <= '0';
end generate gDIAG_CNT;
gNOT_DIAG_CNT: if DIAG_COUNTERS = false generate
pd_cnt <= (others => '0');
fire_req_cnt <= (others => '0');
end generate gNOT_DIAG_CNT;
-----------------------------------------------------------------------------
-- C&S registers (Avalon-MM I/F)
-----------------------------------------------------------------------------
-- Memory partitioning:
-- Relative addresses between 0 and 511 => C&S regs
-- Relative addresses between 512 and 1023 => Sequencer RAM
avs_write_i <= '1' when avs_write = '1' and avs_address(10 downto 9) = "00" else '0';
ch_ctrl_write <= '1' when avs_write = '1' and avs_address(10 downto 9) = "01" else '0';
ch_ctrl_csr_write <= '1' when avs_write = '1' and avs_address(10 downto 5) = "000001" else '0';
tof_lut_wr_en <= '1' when avs_write = '1' and avs_address(10 downto 9) = "10" else '0';
avs_read_i <= '1' when avs_read = '1' and avs_address(10 downto 9) = "00" else '0';
ch_ctrl_read <= '1' when avs_read = '1' and avs_address(10 downto 9) = "01" else '0';
ch_ctrl_csr_read <= '1' when avs_read = '1' and avs_address(10 downto 5) = "000001" else '0';
avs_addr <= avs_address(4 downto 0);
ch_ctrl_address <= avs_address(ch_ctrl_address'range);
ch_ctrl_csr_addr <= avs_address(ch_ctrl_csr_addr'range);
tof_lut_wr_addr <= avs_address(tof_lut_wr_addr'range);
ch_ctrl_writedata <= avs_writedata;
ch_ctrl_csr_writedata <= avs_writedata;
tof_lut_wr_data <= avs_writedata(tof_lut_wr_data'range);
pINIT : process(clk)
begin
if(clk = '1' and clk'event) then
if(init = '1') then
init_v <= (others => '1');
else
init_v <= '0' & init_v(init_v'high downto 1);
end if;
end if;
end process pINIT;
enable <= enable_i and not init_v(4);
enc_speed_meas_w <= enc_speed_meas_w_i;
pulse_generator_4_csr_regs_i : entity work.pulse_generator_4_csr_regs
generic map (
ADDR_DECODE_WIDTH => 5
)
port map (
-- Clock and reset
clk => clk,
rst_n => reset_n,
-- auto-generated
-- Internal signal ports
pulse_gen_control_w_enable => enable_i,
pulse_gen_control_w_bypass_channel_controller => bypass_ch_ctrl,
pulse_gen_control_w_bypass_delay_equalizer => bypass_delay_equal,
pulse_gen_control_w_sw_control_dp_dir => sw_ctrl_dp_dir,
pulse_gen_control_w_wh_apply_corr_en => wh_apply_corr_en,
pulse_gen_control_w_pp_apply_corr_en => open,
pulse_gen_control_w_tof_comp_enable => tof_comp_enable,
pulse_gen_control_w_enable_output => enable_out,
pulse_gen_control_w_trigger_abort_fire => abort_fire,
pulse_gen_control_w_reset_diag_regs => rst_diag_regs,
pd_offset_dir_0 => ch_offset_dir0,
pd_offset_dir_1 => ch_offset_dir1,
channel_delay => ch_delay,
channel_controller_control_w_sequencer_start_address => ch_ctrl_start_addr,
fractional_divider_control_enable => frac_div_en_i,
fractional_divider_control_udp_max_pos => upd_max_pos_i,
fractional_divider_control_udp_min_pos => upd_min_pos_i,
divider_ratio_int => div_ratio(33 downto 24),
divider_ratio_fraction => div_ratio(23 downto 0),
subpixel_phase_num => subpixel_phase_num,
enc_speed_meas_window => enc_speed_meas_w_i,
tof_compensation_w_enc_speed_norm => enc_speed_norm_coeff,
pixel_pitch_corr_stripe_num => wh_image_pixel_len,
pixel_pitch_pos_err_2_corr => wh_pos_err_2_corr,
pixel_pitch_skip_corr_thres => wh_skip_corr_thres,
pixel_pitch_loop_filter_corr_delta_error_coeff => wh_loop_filt_delta,
pixel_pitch_loop_filter_corr_tot_error_coeff => wh_loop_filt_tot,
pulse_gen_control_w_clr_pd_queue => clr_pd_queue,
channel_controller_control_w_start_seq_trigger => ch_ctrl_start_req_ii,
pulse_gen_control_r_pd_queue_error_flag => pd_queue_error,
pulse_gen_control_r_delay_equalizer_error_flag => de_queue_error,
pulse_gen_control_r_ch_mask_status => ch_mask_i,
pulse_gen_control_r_fire_enable_status => fire_enable,
pulse_gen_control_r_dual_phase_directionality_select_status => dp_dir_i,
pulse_gen_control_r_tof_sat_flag => tof_sat_flag,
channel_controller_control_r_busy => ch_ctrl_busy,
abs_position_max => abs_pos_max,
abs_position_min => abs_pos_min,
abs_position => abs_position,
pd_counter => pd_cnt,
fire_req_counter => fire_req_cnt,
enc_speed => enc_vel,
tof_compensation_r_tof_lut_comp => tof_lut_comp,
pixel_pitch_pos_err_curr => wh_pos_err_curr,
pixel_pitch_pos_err_max => wh_pos_err_max,
pixel_pitch_pos_err_min => wh_pos_err_min,
pixel_pitch_div_ratio_corr => div_ratio_corr(31 downto 0),
pixel_pitch_corr_cnt => wh_rotat_cnt,
-- end auto-generated
-- Slave bus port
avs_address => avs_addr(4 downto 0),
avs_write => avs_write_i,
avs_writedata => avs_writedata,
avs_read => avs_read_i,
avs_readdata => avs_readdata_i
);
avs_readdata <= avs_readdata_i when avs_address(10 downto 5) = "000000" else
ch_ctrl_csr_readdata when avs_address(10 downto 5) = "000001" else
ch_ctrl_readdata when avs_address(10 downto 5) = "01----" else
X"0000" & tof_lut_wr_q when avs_address(10 downto 5) = "10----" else
X"BAD1BAD0";
end architecture rtl;

View file

@ -0,0 +1,166 @@
-------------------------------------------------------------------------------
-- Title : simple_frac_div_4
-- Project : EMB-1
-------------------------------------------------------------------------------
-- File : simple_frac_div_4.vhd
-- Author : Gianmarco Girau
-- Company : Global Inkjet Systems
-- Created : 2017-12-04
-- Last update: 2021-04-14
-- SVN ID : Git
-- Standard : VHDL'2008
-------------------------------------------------------------------------------
-- Description:
-- Simple Fractional Divider: this version of the fractional divider identifies
-- the optimal encoder position to generate a fire-pulse, but it does not
-- identy the optimal fire time. Therefore the resulting resolution is equal to
-- +/-1/2 encoder pulse.
-- The identification of the optimal absolute position for the fire request
-- employs an iterative algorithm which checks, for every increment of the
-- absolute position, in the intended direction, whether the position error at
-- the current position is lower than the error at the next position. If the
-- result of the check is positive, the fire request will be issued at the
-- current absolute position, otherwise the check is repeated at the next step.
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity simple_frac_div_4 is
port(
clk : in std_logic;
enable : in std_logic;
upd_max_pos : in std_logic;
upd_min_pos : in std_logic;
abs_pos_max : out std_logic_vector(31 downto 0);
abs_pos_min : out std_logic_vector(31 downto 0);
dir : in std_logic;
offset : in std_logic_vector(33 downto 0);
ratio : in std_logic_vector(33 downto 0);
abs_pos : in std_logic_vector(31 downto 0);
enc_pulse : out std_logic;
fire : out std_logic;
fire_cnt : out std_logic_vector(31 downto 0));
end entity simple_frac_div_4;
architecture rtl of simple_frac_div_4 is
signal enable_d, start : std_logic;
signal update, fire_gen : std_logic;
signal inc_pos, dec_pos : std_logic;
signal new_max, new_min : std_logic;
signal delta_wrap, start_d : std_logic;
signal check_first : std_logic;
signal check_others : std_logic;
signal firing_error_comp : std_logic;
signal firing_error_is_0 : std_logic;
signal firing_error_is_1 : std_logic;
--
signal zeros, delta_pos : std_logic_vector(15 downto 0);
signal fire_cnt_i : std_logic_vector(31 downto 0);
signal pos_diff : std_logic_vector(31 downto 0);
signal pos_max, pos_min : std_logic_vector(31 downto 0);
signal dist_pos, dist_neg : std_logic_vector(31 downto 0);
signal abs_pos_d : std_logic_vector(31 downto 0);
signal ideal_fire : std_logic_vector(49 downto 0);
signal firing_error : std_logic_vector(49 downto 0);
begin
zeros <= (others => '0');
-----------------------------------------------------------------------------
-- Min/Max Absolute Position Tracking (and jitter rejection)
-----------------------------------------------------------------------------
pPOS_TRACK : process(clk)
begin
if(clk = '1' and clk'event) then
abs_pos_d <= abs_pos;
if(new_max = '1' or upd_max_pos = '1') then
pos_max <= abs_pos;
end if;
if(new_min = '1' or upd_min_pos = '1') then
pos_min <= abs_pos;
end if;
-- enc_pulse output replaces the enc_out from the EMS, because the EMS
-- does not support encoder jitter tracking anymore.
-- Note: because of the absolute position, enc_pulse is redundant and
-- used only for diagnostic purpose.
enc_pulse <= (new_max and not dir) or (new_min and dir);
end if;
end process pPOS_TRACK;
pos_diff <= std_logic_vector(signed(abs_pos) - signed(abs_pos_d));
dist_pos <= std_logic_vector(signed(abs_pos)-signed(pos_max));
dist_neg <= std_logic_vector(signed(pos_min)-signed(abs_pos));
inc_pos <= '1' when pos_diff(31) = '0' and pos_diff(2 downto 0) = "001" else '0';
dec_pos <= '1' when pos_diff(31) = '1' and pos_diff(2 downto 0) = "111" else '0';
new_max <= '1' when inc_pos = '1' and dir = '0' and dist_pos(31) = '0' and unsigned(dist_pos(3 downto 0)) /= 0 else '0';
new_min <= '1' when dec_pos = '1' and dir = '1' and dist_neg(31) = '0' and unsigned(dist_neg(3 downto 0)) /= 0 else '0';
abs_pos_min <= pos_min;
abs_pos_max <= pos_max;
-----------------------------------------------------------------------------
-- Fractional Divider Logic
-----------------------------------------------------------------------------
pFD_REGs : process(clk)
begin
if(clk = '1' and clk'event) then
enable_d <= enable;
start_d <= start;
if(enable = '0') then
delta_pos <= (others => '0');
elsif(delta_wrap = '1') then
-- Decrement delta_pos of 64
delta_pos <= (6 => '1', others => '0');
elsif(new_min = '1' or new_max = '1') then
delta_pos <= std_logic_vector(unsigned(delta_pos)+1);
end if;
if(unsigned(delta_pos) = 127 and update = '1') then
delta_wrap <= '1';
else
delta_wrap <= '0';
end if;
-- ideal_fire: represents the ideal fire position (normalized 2**RATIO_FRACT_W)
if(start = '1') then
ideal_fire <= zeros & offset;
elsif(fire_gen = '1') then
ideal_fire <= std_logic_vector(unsigned(ideal_fire)+unsigned(ratio));
elsif(delta_wrap = '1') then
-- Decrement delta_pos of 64 (normalized 2**RATIO_FRACT_W)
--ideal_fire <= std_logic_vector(unsigned(ideal_fire)- X"3F000000");
ideal_fire <= ideal_fire(ideal_fire'left downto 36) & std_logic_vector(unsigned(ideal_fire(35 downto 24))- 12X"03F") & ideal_fire(23 downto 0);
end if;
firing_error <= std_logic_vector(unsigned(ideal_fire(ideal_fire'left downto 24)) - unsigned(delta_pos)) & X"000000";
update <= enable and (start_d or new_min or new_max);
check_first <= enable and start_d;
check_others <= enable and (new_min or new_max);
fire <= fire_gen;
if(enable = '0') then
fire_cnt_i <= (others => '0');
elsif(fire_gen = '1') then
fire_cnt_i <= std_logic_vector(unsigned(fire_cnt_i)+1);
end if;
end if;
end process pFD_REGs;
-- firing_error_comp is asserted when firing_error(firing_error'left downto 24) is
-- either 0 or 1:
firing_error_comp <= '1' when unsigned(firing_error(firing_error'left downto 25)) = 0 else '0';
firing_error_is_0 <= firing_error_comp and (not firing_error(24));
firing_error_is_1 <= firing_error_comp and firing_error(24);
fire_gen <= '1' when (check_first = '1' and firing_error_is_0 = '1') or (check_others = '1' and firing_error_is_1 = '1') else '0';
start <= enable and not enable_d;
fire_cnt <= fire_cnt_i;
end architecture rtl;

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