ELGIP-54 Merged updates to solve HPS lock-up issue

Merge remote-tracking branch 'remotes/origin/1.10009.j73_avalon_lockup' into 1.10007.j54_WH

# Conflicts:
#	generic_ip/common/0/sim/wave_queue_delay.do
#	generic_ip/fire_pulse_manager/0/src/fire_pulse_manager_0.vhd
#	generic_ip/pulse_generator/1/src/pulse_generator_1.vhd
#	generic_ip/pulse_generator/1/src/queue_and_delay_1.vhd
This commit is contained in:
gianmarcogirau 2019-07-22 14:02:02 +01:00
commit 3d3289a7c9
92 changed files with 7892 additions and 1372 deletions

View file

@ -0,0 +1,68 @@
# 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 OSVVM_PATH $TB_PATH/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 $SRC_PATH/cs_bus_itf.vhd
# Compile the testbench and the other components supporting the test
if {$COMP_ONLY == 0} {
# Test support packages
vcom -2008 -work $WORKLIB $TB_PATH/common_test_pkg.vhd
vcom -2008 -work $WORKLIB $TB_PATH/log_pkg.vhd
vcom -2008 -work $WORKLIB $TB_PATH/avalon_verify_pkg.vhd
# Testbench
vcom -2008 -work $WORKLIB $TB_PATH/cs_bus_itf_tb.vhd
vsim -t ps work.cs_bus_itf_tb
#add wave cs_bus_itf_tb/*
#add wave cs_bus_itf_tb/iUUT/*
# remove warnings from standard numeric/arithmetic packages (speed-up simulation)
set StdArithNoWarnings 1
set NumericStdNoWarnings 1
do wave_cs_bus_itf.do
when -label end_of_simulation {test_completed == true} {echo "Simulation Completed"; stop ;}
run -all
#run 1 ms;
}

View file

@ -0,0 +1,78 @@
onerror {resume}
quietly WaveActivateNextPane {} 0
add wave -noupdate /cs_bus_itf_tb/reset_n
add wave -noupdate /cs_bus_itf_tb/clk
add wave -noupdate -radix hexadecimal /cs_bus_itf_tb/avs_address
add wave -noupdate /cs_bus_itf_tb/avs_write
add wave -noupdate -radix hexadecimal /cs_bus_itf_tb/avs_writedata
add wave -noupdate /cs_bus_itf_tb/avs_read
add wave -noupdate /cs_bus_itf_tb/avs_waitrequest
add wave -noupdate -radix hexadecimal /cs_bus_itf_tb/avs_readdata
add wave -noupdate /cs_bus_itf_tb/cs_addr
add wave -noupdate /cs_bus_itf_tb/cs_we
add wave -noupdate -radix hexadecimal /cs_bus_itf_tb/cs_wr_data
add wave -noupdate /cs_bus_itf_tb/cs_re
add wave -noupdate /cs_bus_itf_tb/cs_rv
add wave -noupdate -radix hexadecimal /cs_bus_itf_tb/cs_rd_data
add wave -noupdate -radix hexadecimal /cs_bus_itf_tb/avs_m
add wave -noupdate -radix hexadecimal /cs_bus_itf_tb/avs_s
add wave -noupdate /cs_bus_itf_tb/end_of_stimuli
add wave -noupdate /cs_bus_itf_tb/test_completed
add wave -noupdate /cs_bus_itf_tb/setup
add wave -noupdate /cs_bus_itf_tb/running
add wave -noupdate /cs_bus_itf_tb/passed
add wave -noupdate /cs_bus_itf_tb/failed
add wave -noupdate /cs_bus_itf_tb/blk_0_re
add wave -noupdate /cs_bus_itf_tb/blk_0_we
add wave -noupdate /cs_bus_itf_tb/blk_0_rv
add wave -noupdate /cs_bus_itf_tb/blk_0_re_d
add wave -noupdate /cs_bus_itf_tb/blk_1_re
add wave -noupdate /cs_bus_itf_tb/blk_1_we
add wave -noupdate /cs_bus_itf_tb/blk_1_rv
add wave -noupdate /cs_bus_itf_tb/blk_1_re_d
add wave -noupdate -radix hexadecimal /cs_bus_itf_tb/blk_0_wr_data
add wave -noupdate -radix hexadecimal /cs_bus_itf_tb/blk_0_rd_data
add wave -noupdate -radix hexadecimal /cs_bus_itf_tb/blk_1_wr_data
add wave -noupdate -radix hexadecimal /cs_bus_itf_tb/blk_1_rd_data
add wave -noupdate /cs_bus_itf_tb/iUUT/rstN
add wave -noupdate /cs_bus_itf_tb/iUUT/clk
add wave -noupdate -radix hexadecimal /cs_bus_itf_tb/iUUT/avs_address
add wave -noupdate /cs_bus_itf_tb/iUUT/avs_write
add wave -noupdate -radix hexadecimal /cs_bus_itf_tb/iUUT/avs_writedata
add wave -noupdate /cs_bus_itf_tb/iUUT/avs_read
add wave -noupdate /cs_bus_itf_tb/iUUT/avs_waitrequest
add wave -noupdate -radix hexadecimal /cs_bus_itf_tb/iUUT/avs_readdata
add wave -noupdate -radix hexadecimal /cs_bus_itf_tb/iUUT/cs_addr
add wave -noupdate /cs_bus_itf_tb/iUUT/cs_we
add wave -noupdate -radix hexadecimal /cs_bus_itf_tb/iUUT/cs_wr_data
add wave -noupdate /cs_bus_itf_tb/iUUT/cs_re
add wave -noupdate /cs_bus_itf_tb/iUUT/cs_rv
add wave -noupdate -radix hexadecimal /cs_bus_itf_tb/iUUT/cs_rd_data
add wave -noupdate -radix hexadecimal /cs_bus_itf_tb/iUUT/cs_rd_data_i
add wave -noupdate /cs_bus_itf_tb/iUUT/avs_read_d
add wave -noupdate /cs_bus_itf_tb/iUUT/avs_rd_en
add wave -noupdate /cs_bus_itf_tb/iUUT/avs_wr_en_d
add wave -noupdate /cs_bus_itf_tb/iUUT/busy
add wave -noupdate /cs_bus_itf_tb/iUUT/read_valid
add wave -noupdate /cs_bus_itf_tb/iUUT/dummy_rv
add wave -noupdate /cs_bus_itf_tb/iUUT/timeout_flag
add wave -noupdate -radix unsigned /cs_bus_itf_tb/iUUT/read_timeout_cnt
add wave -noupdate /cs_bus_itf_tb/iUUT/avs_address_i
TreeUpdate [SetDefaultTree]
WaveRestoreCursors {{Cursor 1} {515000 ps} 0}
quietly wave cursor active 1
configure wave -namecolwidth 273
configure wave -valuecolwidth 187
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} {3540224 ps}

View file

@ -42,7 +42,7 @@ add wave -noupdate /queue_and_delay_tb/iUUT/pending_trans
add wave -noupdate /queue_and_delay_tb/iUUT/fifo_rd_en
add wave -noupdate /queue_and_delay_tb/iUUT/fifo_empty
add wave -noupdate /queue_and_delay_tb/iUUT/fifo_full
add wave -noupdate -radix unsigned /queue_and_delay_tb/iUUT/local_time
add wave -noupdate -radix unsigned /queue_and_delay_tb/iUUT/int_time
add wave -noupdate -radix decimal /queue_and_delay_tb/iUUT/event_time
TreeUpdate [SetDefaultTree]
WaveRestoreCursors {{Cursor 1} {5695000 ps} 0}

View file

@ -13,6 +13,7 @@
-- Description:
-- Common Package
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;

View file

@ -10,19 +10,22 @@
-- Description: Split the memory space from the Avalon-MM I/F and drive the C&S
-- bus for a programmable number of FW processing blocks
-------------------------------------------------------------------------------
-- Last update: 2016-10-28
-- Last update: 2019-07-12
-------------------------------------------------------------------------------
-- Revisions :
-- Date Version Author Description
-- 2015-10-19 1.0 gmg Created
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity cs_bus_ift is
generic(blk_num : integer range 1 to 16 := 1);
generic(
BLK_NUM : integer range 1 to 16 := 1;
READ_TIMEOUT : integer range 16 to 1023 := 64);
port(
rstN : in std_logic;
clk : in std_logic;
@ -31,32 +34,40 @@ entity cs_bus_ift is
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_waitrequest : out std_logic;
avs_readdata : out std_logic_vector(31 downto 0);
-- C&S bus
cs_addr : out std_logic_vector(10 downto 0);
cs_we : out std_logic_vector(blk_num-1 downto 0);
cs_we : out std_logic_vector(BLK_NUM-1 downto 0);
cs_wr_data : out std_logic_vector(31 downto 0);
cs_re : out std_logic_vector(blk_num-1 downto 0);
cs_rv : in std_logic_vector(blk_num-1 downto 0);
cs_rd_data : in std_logic_vector(32*blk_num-1 downto 0));
cs_re : out std_logic_vector(BLK_NUM-1 downto 0);
cs_rv : in std_logic_vector(BLK_NUM-1 downto 0);
cs_rd_data : in std_logic_vector(32*BLK_NUM-1 downto 0));
end cs_bus_ift;
architecture RTL of cs_bus_ift 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);
type rd_bus_t is array (0 to BLK_NUM-1) of std_logic_vector(31 downto 0);
signal cs_rd_data_i : rd_bus_t;
signal avs_read_d : std_logic;
signal avs_rd_en : std_logic;
signal dummy_rv : std_logic; -- Dummy Read valid: asserted when
-- trying to read from not allocated addresses
signal avs_address_i : std_logic_vector(14 downto 0);
signal cs_rd_data_i : rd_bus_t;
signal busy : std_logic;
signal avs_read_d : std_logic;
signal avs_rd_en : std_logic;
signal avs_wr_en : std_logic;
signal avs_wr_en_d : std_logic;
signal sel_read_valid : std_logic;
signal read_valid : std_logic;
signal read_valid_d : std_logic;
signal dummy_rv : std_logic; -- Dummy Read valid: asserted when
-- trying to read from not allocated addresses
signal timeout_flag : std_logic;
signal read_timeout_cnt : std_logic_vector( 9 downto 0);
signal avs_address_i : std_logic_vector(14 downto 0);
begin
BUS_REMAP: for i in 0 to blk_num-1 generate
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;
@ -67,49 +78,83 @@ begin
cs_we <= (others => '0');
cs_wr_data <= (others => '0');
cs_re <= (others => '0');
avs_readdatavalid <= '0';
avs_readdata <= (others => '0');
avs_waitrequest <= '1';
busy <= '0';
avs_wr_en_d <= '0';
avs_read_d <= '0';
read_valid_d <= '0';
dummy_rv <= '0';
elsif(clk = '1' and clk'event) then
if(avs_write = '1' or avs_read = '1') then
avs_address_i <= avs_address;
end if;
avs_read_d <= avs_read;
for i in 0 to blk_num-1 loop
avs_wr_en_d <= avs_wr_en;
avs_read_d <= avs_read;
read_valid_d <= read_valid;
for i in 0 to BLK_NUM-1 loop
-- limit to 16 the maximum number of user blocks
if(avs_write = '1' and to_integer(unsigned(avs_address(avs_address'high downto avs_address'high-3))) = i) then
if(avs_wr_en = '1' and to_integer(unsigned(avs_address(avs_address'high downto avs_address'high-3))) = i) then
cs_we(i) <= '1';
else
cs_we(i) <= '0';
end if;
end loop; -- i
cs_wr_data <= avs_writedata;
for i in 0 to blk_num-1 loop
if(avs_wr_en = '1') then
cs_wr_data <= avs_writedata;
end if;
for i in 0 to BLK_NUM-1 loop
if(avs_rd_en = '1' and to_integer(unsigned(avs_address(avs_address'high downto avs_address'high-3))) = i) then
cs_re(i) <= '1';
else
cs_re(i) <= '0';
end if;
end loop; -- i
if(avs_rd_en = '1' and (to_integer(unsigned(avs_address(avs_address'high downto avs_address'high-3))) >= blk_num)) then
if((avs_rd_en = '1' and (to_integer(unsigned(avs_address(avs_address'high downto avs_address'high-3))) >= BLK_NUM)) or timeout_flag = '1') then
dummy_rv <= '1';
else
dummy_rv <= '0';
end if;
avs_readdatavalid <= dummy_rv or cs_rv(to_integer(unsigned(avs_address_i(avs_address'high downto avs_address'high-3))));
if(dummy_rv = '0') then
if(sel_read_valid = '1') then
avs_readdata <= cs_rd_data_i(to_integer(unsigned(avs_address_i(avs_address'high downto avs_address'high-3))));
else
elsif(dummy_rv = '1') then
avs_readdata <= X"DEAD_BEEF";
end if;
-- waitrequest can be decoupled from the read and write request signals.
-- waitrequest may be asserted during idle cycles. An Avalon-MM master may initiate
-- a transaction when waitrequest is asserted and wait for that signal to be
-- deasserted. Decoupling waitrequest from read and write requests may improve
-- system timing. Decoupling eliminates a combinational loop including the read,
-- write, and waitrequest signals.
if(avs_wr_en = '1' or read_valid = '1') then
avs_waitrequest <= '0';
else
avs_waitrequest <= '1';
end if;
if(avs_wr_en = '1' or avs_rd_en = '1') then
busy <= '1';
elsif(avs_wr_en_d = '1' or read_valid_d = '1') then
busy <= '0';
end if;
if(avs_rd_en = '1') then
read_timeout_cnt <= (others => '0');
elsif(avs_read_d = '1') then
read_timeout_cnt <= std_logic_vector(unsigned(read_timeout_cnt)+1);
end if;
end if;
end process pLatchIO;
avs_rd_en <= avs_read and not avs_read_d;
sel_read_valid <= cs_rv(to_integer(unsigned(avs_address_i(avs_address'high downto avs_address'high-3))));
read_valid <= dummy_rv or sel_read_valid;
avs_rd_en <= avs_read and not busy;
avs_wr_en <= avs_write and not busy;
cs_addr <= avs_address_i(10 downto 0);
timeout_flag <= '1' when unsigned(read_timeout_cnt) = READ_TIMEOUT else '0';
end RTL;

View file

@ -52,6 +52,7 @@
-- half_per_min = 3 => LPF order=4, hyst=1
-- half_per_min = 2 => LPF order=2, hyst=1
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;

View file

@ -13,6 +13,7 @@
-- Description:
-- True Dual-Port, single clock RAM
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;

View file

@ -27,6 +27,7 @@
-- Date Version Author Description
-- 2008-05-01 1.0 Damian Created
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;

View file

@ -14,6 +14,7 @@
-------------------------------------------------------------------------------
-- Copyright (c) 2010 Global Inkjet Systems
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;

View file

@ -19,6 +19,7 @@
-- than 1024 pulses in 2 ms => max pulse rate = 512kHz. The block rises the
-- error bit when this condition is violated.
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;

View file

@ -13,6 +13,7 @@
-- Description:
-- Stretch pulse to a programmable width
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;

View file

@ -16,6 +16,7 @@
-- Date Version Author Description
-- 2010-08-06 1.0 gmg Created
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;

View file

@ -15,6 +15,7 @@
-- Date Version Author Description
-- 2010-10-25 1.0 gmg Created
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;

View file

@ -15,6 +15,7 @@
-- Date Version Author Description
-- 2010-12-03 1.0 gmg Created
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;

View file

@ -353,9 +353,9 @@ package body AVALON_VERIFY_PKG is
mm_m_rec.mm_writedata <= data;
mm_m_rec.mm_write <= '1';
wait until falling_edge(clk_clk);
while(mm_use_waitrequest.is_set = true and mm_s_rec.mm_waitrequest = '1') loop
wait until falling_edge(clk_clk);
end loop;
if(mm_use_waitrequest.is_set = true and mm_s_rec.mm_waitrequest = '1') then
wait until falling_edge(mm_s_rec.mm_waitrequest);
end if;
wait until rising_edge(clk_clk);
mm_m_rec.mm_byteenable <= "0000";
mm_m_rec.mm_write <= '0';
@ -425,9 +425,9 @@ package body AVALON_VERIFY_PKG is
mm_m_rec.mm_address <= addr or base_addr;
mm_m_rec.mm_read <= '1';
wait until falling_edge(clk_clk);
while(mm_use_waitrequest.is_set = true and mm_s_rec.mm_waitrequest = '1') loop
wait until falling_edge(clk_clk);
end loop;
if(mm_use_waitrequest.is_set = true and mm_s_rec.mm_waitrequest = '1') then
wait until falling_edge(mm_s_rec.mm_waitrequest);
end if;
wait until rising_edge(clk_clk);
mm_m_rec.mm_read <= '0';
if(mm_use_waitrequest.is_set = false) then

View file

@ -0,0 +1,523 @@
-------------------------------------------------------------------------------
-- Title : cs_bus_itf_tb
-- Project : Generic
-------------------------------------------------------------------------------
-- File : cs_bus_itf_tb.vhd
-- Author : GMG
-- Company : Global Inkjet Systems
-- Created : 2019-07-10
-- Last update: 2019-07-17
-- SVN ID : Git
-- Standard : VHDL'2008
-------------------------------------------------------------------------------
-- Description:
-- Verifies Time-of-Flight Compensation
-------------------------------------------------------------------------------
library std;
use std.textio.all;
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use work.log_pkg.all;
use work.avalon_verify_pkg.all;
entity cs_bus_itf_tb is
-- ..
end entity cs_bus_itf_tb;
architecture behav of cs_bus_itf_tb is
constant CLK_PERIOD : time := 10 ns;
-- Logging Verbosity Level
constant VERBOSITY_LEVEL : verb_level_t := VMEDIUM;
constant BLK_NUM : natural := 8;
-----------------------------------------------------------------------------
-- Signal declarations
-----------------------------------------------------------------------------
signal reset_n : std_logic;
signal clk : std_logic := '0';
signal avs_address : std_logic_vector(14 downto 0);
signal avs_write : std_logic;
signal avs_writedata : std_logic_vector(31 downto 0);
signal avs_read : std_logic;
signal avs_waitrequest : std_logic;
signal avs_readdata : std_logic_vector(31 downto 0);
signal cs_addr : std_logic_vector(10 downto 0);
signal cs_we : std_logic_vector(BLK_NUM-1 downto 0);
signal cs_wr_data : std_logic_vector(31 downto 0);
signal cs_re : std_logic_vector(BLK_NUM-1 downto 0);
signal cs_rv : std_logic_vector(BLK_NUM-1 downto 0);
signal cs_rd_data : std_logic_vector(32*BLK_NUM-1 downto 0);
--
signal avs_m : mm_m_rec_t;
signal avs_s : mm_s_rec_t;
--
signal end_of_stimuli : boolean;
signal test_completed : boolean;
signal setup : boolean;
signal running : boolean;
signal passed : boolean;
signal failed : boolean;
shared variable error_flag : boolean;
signal blk_0_re, blk_0_we, blk_0_rv, blk_0_re_d : std_logic;
signal blk_1_re, blk_1_we, blk_1_rv, blk_1_re_d : std_logic;
signal blk_0_wr_data, blk_0_rd_data : std_logic_vector(31 downto 0);
signal blk_1_wr_data, blk_1_rd_data : std_logic_vector(31 downto 0);
-----------------------------------------------------------------------------
-- TB Functions / Procedures
-----------------------------------------------------------------------------
procedure wait_latency(
signal clk : in std_logic;
cycles : in natural) is
begin
for i in 1 to cycles loop
wait until clk = '1' and clk'event;
end loop; -- i
end procedure wait_latency;
procedure mm_32b_write_f( addr : in std_logic_vector(31 downto 0);
data : in std_logic_vector(31 downto 0);
skip_wait_re : in boolean := false;
signal mm_s_rec : in mm_s_rec_t;
signal mm_m_rec : out mm_m_rec_t) is
begin
wait until rising_edge(clk_clk);
mm_m_rec.mm_address <= addr or base_addr;
mm_m_rec.mm_byteenable <= "1111";
mm_m_rec.mm_writedata <= data;
mm_m_rec.mm_write <= '1';
wait until falling_edge(clk_clk);
if(mm_use_waitrequest.is_set = true and mm_s_rec.mm_waitrequest = '1') then
wait until falling_edge(mm_s_rec.mm_waitrequest);
end if;
if(skip_wait_re = false) then
wait until rising_edge(clk_clk);
else
wait until falling_edge(clk_clk);
end if;
mm_m_rec.mm_byteenable <= "0000";
mm_m_rec.mm_write <= '0';
end mm_32b_write_f;
procedure mm_32b_read_f( addr : in std_logic_vector(31 downto 0);
data : out std_logic_vector(31 downto 0);
skip_wait_re : in boolean := false;
signal mm_s_rec : in mm_s_rec_t;
signal mm_m_rec : out mm_m_rec_t) is
begin
wait until rising_edge(clk_clk);
mm_m_rec.mm_address <= addr or base_addr;
mm_m_rec.mm_read <= '1';
wait until falling_edge(clk_clk);
if(mm_use_waitrequest.is_set = true and mm_s_rec.mm_waitrequest = '1') then
wait until falling_edge(mm_s_rec.mm_waitrequest);
end if;
if(skip_wait_re = false) then
wait until rising_edge(clk_clk);
else
wait until falling_edge(clk_clk);
end if;
mm_m_rec.mm_read <= '0';
if(mm_use_waitrequest.is_set = false) then
for n in 1 to mm_read_latency.get loop
wait until rising_edge(clk_clk);
end loop; -- n
end if;
if(mm_s_rec.use_readvalid = true) then
if(mm_s_rec.mm_readdatavalid = '0') then
wait until mm_s_rec.mm_readdatavalid = '1';
end if;
end if;
--wait until falling_edge(clk_clk);
data := mm_s_rec.mm_readdata;
end mm_32b_read_f;
-----------------------------------------------------------------------------
-- End declarative part
-----------------------------------------------------------------------------
begin -- architecture behav
clk <= not clk after 0.5*CLK_PERIOD;
-----------------------------------------------------------------------------
-- UUT
-----------------------------------------------------------------------------
iUUT: entity work.cs_bus_ift
generic map (
BLK_NUM => BLK_NUM,
READ_TIMEOUT => 32)
port map (
rstN => reset_n,
clk => clk,
avs_address => avs_address,
avs_write => avs_write,
avs_writedata => avs_writedata,
avs_read => avs_read,
avs_waitrequest => avs_waitrequest,
avs_readdata => avs_readdata,
cs_addr => cs_addr,
cs_we => cs_we,
cs_wr_data => cs_wr_data,
cs_re => cs_re,
cs_rv => cs_rv,
cs_rd_data => cs_rd_data);
-- Instantiate only 2 dummy blocks, leave the rest unconnected
blk_0_we <= cs_we(0);
blk_1_we <= cs_we(1);
blk_0_re <= cs_re(0);
blk_1_re <= cs_re(1);
cs_rv <= (0 => blk_0_rv, 1 => blk_1_rv, others => '0');
cs_rd_data(31 downto 0) <= blk_0_rd_data;
cs_rd_data(63 downto 32) <= blk_1_rd_data;
cs_rd_data(32*BLK_NUM-1 downto 64) <= (others => '1');
-----------------------------------------------------------------------------
-- CS-BUS dummy pripherals
-----------------------------------------------------------------------------
pDUMMY_0 : process(clk)
variable rd_val_v : std_logic_vector(3 downto 0) := (others => '0');
begin
if(clk = '1' and clk'event) then
if(blk_0_we = '1') then
blk_0_wr_data <= cs_wr_data;
end if;
blk_0_re_d <= blk_0_re;
if(blk_0_re = '1' and blk_0_re_d = '0') then
rd_val_v := (0 => '1', others => '0');
else
rd_val_v := '0' & rd_val_v(rd_val_v'left downto 1);
end if;
if(rd_val_v(0) = '1') then
blk_0_rv <= '1';
blk_0_rd_data <= X"AAAA0000";
else
blk_0_rv <= '0';
blk_0_rd_data <= X"0000BAD0";
end if;
end if;
end process pDUMMY_0;
pDUMMY_1 : process(clk)
variable rd_val_v : std_logic_vector(3 downto 0) := (others => '0');
begin
if(clk = '1' and clk'event) then
if(blk_1_we = '1') then
blk_1_wr_data <= cs_wr_data;
end if;
blk_1_re_d <= blk_1_re;
if(blk_1_re = '1' and blk_1_re_d = '0') then
rd_val_v := (3 => '1', others => '0');
else
rd_val_v := '0' & rd_val_v(rd_val_v'left downto 1);
end if;
if(rd_val_v(0) = '1') then
blk_1_rv <= '1';
blk_1_rd_data <= X"BBBB0000";
else
blk_1_rv <= '0';
blk_1_rd_data <= X"0000BAD1";
end if;
end if;
end process pDUMMY_1;
-----------------------------------------------------------------------------
-- Avalon interface
-----------------------------------------------------------------------------
clk_clk <= clk;
reset_reset_n <= reset_n;
avs_s.mm_readdata <= avs_readdata;
avs_s.mm_readdatavalid <= '0';
avs_s.mm_waitrequest <= avs_waitrequest;
avs_s.use_readvalid <= false;
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;
-----------------------------------------------------------------------------
-- Testbench Logic
-----------------------------------------------------------------------------
pTB_CTRL : process
procedure wr_data(
blk : natural;
reg : natural;
data : in std_logic_vector(31 downto 0);
signal avs_s : in mm_s_rec_t;
signal avs_m : out mm_m_rec_t;
skip_wait_re : boolean := false) is
variable addr : std_logic_vector(31 downto 0) := (others => '0');
begin
addr := 17x"0" & std_logic_vector(to_unsigned(blk,4)) & std_logic_vector(to_unsigned(reg,11));
mm_32b_write_f(addr, data, skip_wait_re, avs_s, avs_m);
end procedure wr_data;
procedure rd_data(
blk : natural;
reg : natural;
data : out std_logic_vector(31 downto 0);
signal avs_s : in mm_s_rec_t;
signal avs_m : out mm_m_rec_t;
skip_wait_re : boolean := false) is
variable addr : std_logic_vector(31 downto 0) := (others => '0');
begin
addr := 17x"0" & std_logic_vector(to_unsigned(blk,4)) & std_logic_vector(to_unsigned(reg,11));
mm_32b_read_f(addr, data, skip_wait_re, avs_s, avs_m);
end procedure rd_data;
variable data : std_logic_vector(31 downto 0);
begin
-- Set the verbosity level for logging
set_log_verbosity(VERBOSITY_LEVEL);
--set_log_verbosity(VHIGH);
-- initilialize the Avalon master-bus
mm_m_init(avs_m, use_waitrequest => true);
log_header("verifying CS_BUS_ITF:", VLOW);
setup <= false;
running <= false;
passed <= false;
failed <= false;
error_flag := false;
-- Reset
reset_n <= '0';
wait for 100 ns;
wait until clk = '1' and clk'event;
reset_n <= '1';
wait for 200 ns;
running <= true;
---------------------------------------------------------------------------
-- Write & Read : pause between operations
---------------------------------------------------------------------------
wait_latency(clk, 20);
wr_data(0, 4, X"A0A0B1B1", avs_s, avs_m);
wait_latency(clk, 5);
if(blk_0_wr_data /= X"A0A0B1B1") then
log("ERROR : Expecting written data A0A0B1B1 on block 0", VLOW);
error_flag := true;
end if;
wait_latency(clk, 20);
wr_data(1, 8, X"C0C0D1D1", avs_s, avs_m);
wait_latency(clk, 5);
if(blk_1_wr_data /= X"C0C0D1D1") then
log("ERROR : Expecting written data C0C0D1D1 on block 1", VLOW);
error_flag := true;
end if;
wait_latency(clk, 20);
wr_data(2, 0, X"EE00FF11", avs_s, avs_m);
wait_latency(clk, 20);
wr_data(7, 0, X"EE00FF11", avs_s, avs_m);
for blk_num in 0 to 7 loop
rd_data(blk_num, 16, data, avs_s, avs_m);
log("Read Data 0x" & to_hstring(data) & " from block " & to_string(blk_num), VLOW);
wait_latency(clk, 50);
end loop; -- blk_num
-- repeat the same test, but without pause between read/write accesses
---------------------------------------------------------------------------
-- Write & Read : no pause between operations
---------------------------------------------------------------------------
log_header("Repeating the test without pauses between accesses:", VLOW);
wait_latency(clk, 20);
/*
wr_data(0, 4, X"A2A2B1B1", avs_s, avs_m, true);
wr_data(1, 8, X"C2C2D1D1", avs_s, avs_m, true);
wr_data(2, 0, X"EE00FF11", avs_s, avs_m, true);
wr_data(7, 0, X"EE00FF11", avs_s, avs_m, true);
for blk_num in 0 to 7 loop
rd_data(blk_num, 16, data, avs_s, avs_m, true);
log("Read Data 0x" & to_hstring(data) & " from block " & to_string(blk_num), VLOW);
end loop; -- blk_num
*/
-- manually drive the master signals
wait until clk = '1' and clk'event;
avs_m.mm_address <= 17x"0" & std_logic_vector(to_unsigned(0,4)) & std_logic_vector(to_unsigned(4,11));
avs_m.mm_writedata <= X"A2A2B1B1";
avs_m.mm_write <= '1';
wait until clk = '0' and clk'event;
while avs_s.mm_waitrequest = '1' loop
wait until clk = '0' and clk'event;
end loop;
wait until clk = '1' and clk'event;
-- transfer is concluded, but don't de-assert the write enable, just move
-- to the next data
avs_m.mm_address <= 17x"0" & std_logic_vector(to_unsigned(1,4)) & std_logic_vector(to_unsigned(8,11));
avs_m.mm_writedata <= X"C2C2D1D1";
avs_m.mm_write <= '1';
wait until clk = '0' and clk'event;
-- Check first the data written before:
if(blk_0_wr_data /= X"A2A2B1B1") then
log("ERROR : Expecting written data A2A2B1B1 on block 0", VLOW);
error_flag := true;
end if;
while avs_s.mm_waitrequest = '1' loop
wait until clk = '0' and clk'event;
end loop;
wait until clk = '1' and clk'event;
-- transfer is concluded, but don't de-assert the write enable, just move
-- to the next data
avs_m.mm_address <= 17x"0" & std_logic_vector(to_unsigned(2,4)) & std_logic_vector(to_unsigned(0,11));
avs_m.mm_writedata <= X"EE00FF11";
avs_m.mm_write <= '1';
wait until clk = '0' and clk'event;
-- Check first the data written before:
if(blk_1_wr_data /= X"C2C2D1D1") then
log("ERROR : Expecting written data C2C2D1D1 on block 1", VLOW);
error_flag := true;
end if;
while avs_s.mm_waitrequest = '1' loop
wait until clk = '0' and clk'event;
end loop;
wait until clk = '1' and clk'event;
-- transfer is concluded, but don't de-assert the write enable, just move
-- to the next data
avs_m.mm_address <= 17x"0" & std_logic_vector(to_unsigned(7,4)) & std_logic_vector(to_unsigned(0,11));
avs_m.mm_writedata <= X"FF11EE00";
avs_m.mm_write <= '1';
wait until clk = '0' and clk'event;
while avs_s.mm_waitrequest = '1' loop
wait until clk = '0' and clk'event;
end loop;
wait until clk = '1' and clk'event;
-- disable write and start immediately reading
avs_m.mm_write <= '0';
for n in 0 to 7 loop
avs_m.mm_address <= 17x"0" & std_logic_vector(to_unsigned(n,4)) & std_logic_vector(to_unsigned(16,11));
avs_m.mm_read <= '1';
wait until clk = '0' and clk'event;
while avs_s.mm_waitrequest = '1' loop
wait until clk = '0' and clk'event;
end loop;
log("Read Data 0x" & to_hstring(avs_s.mm_readdata) & " from block " & to_string(n), VLOW);
wait until clk = '1' and clk'event;
end loop; -- n
avs_m.mm_read <= '0';
wait until clk = '1' and clk'event;
wait until clk = '1' and clk'event;
wait until clk = '1' and clk'event;
wait until clk = '1' and clk'event;
-- now do a loop with read-write-read without interruption
for n in 0 to 7 loop
avs_m.mm_address <= 17x"0" & std_logic_vector(to_unsigned(n,4)) & std_logic_vector(to_unsigned(16,11));
avs_m.mm_read <= '1';
wait until clk = '0' and clk'event;
while avs_s.mm_waitrequest = '1' loop
wait until clk = '0' and clk'event;
end loop;
log("Read Data 0x" & to_hstring(avs_s.mm_readdata) & " from block " & to_string(n), VLOW);
wait until clk = '1' and clk'event;
avs_m.mm_read <= '0';
avs_m.mm_address <= 17x"0" & std_logic_vector(to_unsigned(0,4)) & std_logic_vector(to_unsigned(4,11));
avs_m.mm_writedata <= X"A2A2B1B1";
avs_m.mm_write <= '1';
wait until clk = '0' and clk'event;
while avs_s.mm_waitrequest = '1' loop
wait until clk = '0' and clk'event;
end loop;
wait until clk = '1' and clk'event;
avs_m.mm_write <= '0';
avs_m.mm_address <= 17x"0" & std_logic_vector(to_unsigned(7,4)) & std_logic_vector(to_unsigned(8,11));
avs_m.mm_read <= '1';
wait until clk = '0' and clk'event;
while avs_s.mm_waitrequest = '1' loop
wait until clk = '0' and clk'event;
end loop;
log("Read Data 0x" & to_hstring(avs_s.mm_readdata) & " from block " & to_string(7), VLOW);
wait until clk = '1' and clk'event;
end loop; -- n
avs_m.mm_read <= '0';
wait_latency(clk, 50);
running <= false;
wait for 5 us;
end_of_stimuli <= true;
if(error_flag = false) then
passed <= true after 100 ns;
else
failed <= true;
end if;
wait;
end process pTB_CTRL;
--failed <= error_flag after 100 ns;
pREPORT_RESULT : process
begin
wait until failed = true or passed = true;
wait for 1 us;
log_separator_line(VLOW);
if(failed = true) then
log("FAILURE: test completed with errors.", VLOW);
elsif(passed = true) then
log("SUCCESS: test successfully completed.", VLOW);
end if;
log_separator_line(VLOW);
test_completed <= true;
end process pREPORT_RESULT;
end architecture behav;

View file

@ -14,6 +14,7 @@
-- 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;

View file

@ -14,6 +14,7 @@
-- 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;

View file

@ -1,84 +1,69 @@
-------------------------------------------------------------------------------
-- Title : Command Interpreter
-- Project : SAMBA 1200 HIB
-------------------------------------------------------------------------------
-- File : command_interpreter.vhd
-- Author : Robbie Temple
-- Company : Global Inkjet Systems
-- Created : 2009-11-01
-- Last update: 2014-12-01
-- Platform :
-- Standard : VHDL'93
-------------------------------------------------------------------------------
-- Description:
-- SAMBA 1200 HIB test data board command interpreter version
-- Interprets the data stream and distributed data to the rest of the FPGA.
-- Receives responses and transmits them back to the LVDS parser.
-- FIXME - for now, assume that latency is OK and there is no need to back off
-- response messages - but test for this!
-- reports the unique FPGA ID
-------------------------------------------------------------------------------
-- Copyright (c) 2009 Global Inkjet Systems
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity comms_avalon_unique_id is
port (
port(
-- Clocks, resets and enables
clk : in std_logic;
rst_n : in std_logic;
clk : in std_logic;
rst_n : in std_logic;
----Avalon MM interface
avs_readdata : out std_logic_vector(31 downto 0);
avs_address : in std_logic_vector(1 downto 0);
avs_read_n : in std_logic
);
avs_readdata : out std_logic_vector(31 downto 0);
avs_address : in std_logic_vector(1 downto 0);
avs_read_n : in std_logic
);
end comms_avalon_unique_id;
architecture rtl of comms_avalon_unique_id is
component unique_chip_ID is
port (
clkin : in std_logic := '0'; -- clkin.clk
reset : in std_logic := '0'; -- reset.reset
data_valid : out std_logic; -- output.valid
chip_id : out std_logic_vector(63 downto 0) -- .data
);
component unique_chip_ID is
port(
clkin : in std_logic := '0'; -- clkin.clk
reset : in std_logic := '0'; -- reset.reset
data_valid : out std_logic; -- output.valid
chip_id : out std_logic_vector(63 downto 0) -- .data
);
end component;
signal data_valid : std_logic;
signal chip_id : std_logic_vector (63 downto 0);
signal data_valid : std_logic;
signal chip_id : std_logic_vector(63 downto 0);
begin
u_chip_ID : unique_chip_ID
port map (
port map(
clkin => clk,
reset => not rst_n,
data_valid => data_valid,
data_valid => data_valid,
chip_id => chip_id
);
);
--------Avalon Process
P_avalon_MM_read : process (clk, rst_n) is
begin -- process P_avalon_MM_read
--------Avalon Process
P_avalon_MM_read : process(clk, rst_n) is
begin -- process P_avalon_MM_read
if rst_n = '0' then
avs_readdata <= (others => '0');
elsif clk'event and clk = '1' then
avs_readdata <= (others => '0');
avs_readdata <= (others => '0');
if avs_read_n = '0' then
case avs_address is
when "00" =>
if data_valid='1' then
avs_readdata <= chip_id(31 downto 0);
end if;
when "00" =>
if data_valid = '1' then
avs_readdata <= chip_id(31 downto 0);
end if;
when "01" =>
if data_valid='1' then
avs_readdata <= chip_id(63 downto 32);
end if;
when "10" =>
avs_readdata(0) <=data_valid;
if data_valid = '1' then
avs_readdata <= chip_id(63 downto 32);
end if;
when "10" =>
avs_readdata(0) <= data_valid;
when others => null;
end case;
end if;

View file

@ -42,8 +42,9 @@ use work.pkg_functions.all;
entity data_streamer_7 is
generic (
NUM_EXT_DSTS : natural range 1 to 16 := 5;
CMD_QUEUE_DEPTH : natural range 1 to 1024 := 32
NUM_EXT_DSTS : natural range 1 to 16 := 5;
CMD_QUEUE_DEPTH : natural range 1 to 1024 := 32;
EXCLUDE_VIRTUAL_MAPPING_LOGIC : boolean := false
);
port(
@ -106,7 +107,7 @@ architecture rtl of data_streamer_7 is
constant CONST_IP_ID_NUMBER : std_logic_vector(7 downto 0) := 8x"0d";
constant CONST_IP_ID_MFR_NUMBER: std_logic_vector(7 downto 0) := 8x"04";
constant CONST_IP_VER_MINOR : std_logic_vector(7 downto 0) := 8x"01";
constant CONST_IP_VER_MINOR : std_logic_vector(7 downto 0) := 8x"02";
constant CONST_IP_VER_MAJOR : std_logic_vector(7 downto 0) := 8x"07";
subtype CMD_BITS is natural range 3 downto 0;
@ -204,6 +205,8 @@ architecture rtl of data_streamer_7 is
signal cmd_port_wr_int : std_logic;
signal cmd_port_int : std_logic_vector(31 downto 0);
signal is_slim : std_logic;
begin
@ -242,7 +245,9 @@ begin
-- ---------------------------------------
-- Address translation queue
-- ---------------------------------------
tlb_queue_inst : entity work.tlb_queue_7
GEN_TLB: if not EXCLUDE_VIRTUAL_MAPPING_LOGIC generate
tlb_queue_inst : entity work.tlb_queue_7
generic map(
QUEUE_DEPTH => CMD_QUEUE_DEPTH
)
@ -259,10 +264,35 @@ begin
empty => tlb_empty
);
end generate;
-- ---------------------------------------
-- COMBINATORIAL SIGNALS
-- ---------------------------------------
GEN_SLIM : if EXCLUDE_VIRTUAL_MAPPING_LOGIC generate
is_slim <= '1';
end generate;
GEN_NOT_SLIM : if not EXCLUDE_VIRTUAL_MAPPING_LOGIC generate
is_slim <= '0';
-- Flag when the address low bits (page offset) are 0
addr_offset_is_zero <= '1' when curr_vaddr(11 downto 2) = 10x"0" else '0';
-- Flag when remaining_burst count is 0
remaining_burst_is_zero <= '1' when remaining_burst = 12x"0" else '0';
-- Calculate the number of words from the address page offset to the end of the page
count_to_page_bdry <= PAGE_WORD_LEN - unsigned(curr_vaddr(11 downto 2));
page_num <= curr_vaddr(31 downto 12) when use_latched_addr = '1' else cmd_data_q(31 downto 12);
-- Flag when the command queue output (paramter 0 bits) match the TLB virtual address
vaddr_match <= '1' when page_num = tlb_rd_data(19 downto 0) else '0';
end generate;
cmd_q_write_int <= cmd_port_wr_int or dest_port_wr_int(NUM_EXT_DSTS);
cmd_q_write <= cmd_q_write_int and not cmd_full;
@ -276,20 +306,6 @@ begin
cmd_read <= (cmd_available and not cmd_pending and not data_cmd_active and not tlb_cmd_active and loop_count_is_zero) or
cmd_gobble or pop_parameter;
-- Flag when the address low bits (page offset) are 0
addr_offset_is_zero <= '1' when curr_vaddr(11 downto 2) = 10x"0" else '0';
-- Flag when remaining_burst count is 0
remaining_burst_is_zero <= '1' when remaining_burst = 12x"0" else '0';
-- Calculate the number of words from the address page offset to the end of the page
count_to_page_bdry <= PAGE_WORD_LEN - unsigned(curr_vaddr(11 downto 2));
page_num <= curr_vaddr(31 downto 12) when use_latched_addr = '1' else cmd_data_q(31 downto 12);
-- Flag when the command queue output (paramter 0 bits) match the TLB virtual address
vaddr_match <= '1' when page_num = tlb_rd_data(19 downto 0) else '0';
-- Flag when there is enough space in the command queue for a LD_CMD_Q transfer
cmd_dest_rdy <= '1' when status_queue_space >= remaining_burst else '0';
@ -304,7 +320,7 @@ begin
okay_to_transfer <= avm_active_read and dst_port_rdy;
-- Combined errors signal
cmd_error <= tlb_mismatch_err or tlb_empty_err or auto_load_err or
cmd_error <= (not is_slim and (tlb_mismatch_err or tlb_empty_err)) or auto_load_err or
bad_cmd_err or cpu_race_err or overrun_err;
-- An AVM read is active when read asserted and no wait request
@ -388,7 +404,7 @@ begin
end if;
-- Latch the command value when not pending for use in processing any subsequent parameters
if (cmd_pending = '0' and loop_count_is_zero = '1') or (tlb_write = '1' and cmd_available = '1') then
if (cmd_pending = '0' and loop_count_is_zero = '1') or (is_slim = '0' and tlb_write = '1' and cmd_available = '1') then
cmd_data <= cmd_data_q;
end if;
@ -475,136 +491,137 @@ begin
-- Reading data into the command queue (CMD_LD_CMD_Q) is almost identical, but for a
-- different destination.
when CMD_RD_DATA_VADDR | CMD_LD_CMD_Q =>
if cmd_pending = '0' then
-- Latch the word length into the remaining burst counter
remaining_burst <= cmd_data(CMD_PARAM0_WORDLEN);
loop_is_first <= '1';
if cmd_data(CMD_BITS) = CMD_LD_CMD_Q then
-- Destination index for command queue is one above the defined number of external desitinations.
dst_sel <= std_logic_vector(to_unsigned(NUM_EXT_DSTS, 4));
-- Flag that auto-loading commands are now active whenever a LD_CMD_Q is written.
-- This will not be cleared until the command queue is empty and no outstanding
-- data transfers
auto_cmd_active <= '1';
else
-- Latch the destination index
dst_sel <= cmd_data(CMD_DEST_BITS);
end if;
-- Command is now pending until parameters (if any processed) and command completed.
cmd_pending <= '1';
-- For virtual commands, flag to pop the virtual address parameter
fetch_vaddr <= '1';
-- Won't commit to the read until cmd_pending phase and destination is ready
read_committed <= '0';
-- Clear the state that inidicates that the correct TLB map is found.
checked_tlb <= '0';
elsif dst_port_rdy = '1' or read_committed = '1' then
-- As the destination has been seen as ready, commit to the reads, including the multi-burst page crossing accesses
read_committed <= '1';
-- If a new TLB entry was extracted, check it matches otherwise it's an error
if tlb_read_last = '1' and vaddr_match = '0' then
tlb_mismatch_err <= '1';
end if;
-- If the virtual address does not match that at the o/p of the TLB queue,
-- pop the value from the queue to get the next one. Only check this if not validated
-- before, since the parameter may have been popped from the queue.
if checked_tlb = '0' then
-- Pop the entry
tlb_read <= not vaddr_match and not tlb_read and not tlb_empty;
-- It is an error if the queue is empty
tlb_empty_err <= tlb_empty;
-- Flag that we checked the TLB output already
checked_tlb <= '1';
else
-- If first cycle with virtual address parameter from queue, latch the
-- low bits this cycle to relieve timing on processing in the following cycles.
if fetch_vaddr = '1' then
if use_latched_addr = '0' then
curr_vaddr <= cmd_data_q;
diag_2 <= cmd_data_q;
end if;
fetch_vaddr <= '0';
elsif data_cmd_active = '0' then
-- If address low bits are not page aligned...
if not addr_offset_is_zero then
-- If burst does not cross a page boundary then set burst length to remaining
-- words, set remaining count to 0 and clear multi-burst flag as this is the last
-- transfer.
if count_to_page_bdry >= unsigned(remaining_burst) then
var_multi_burst := '0';
avm_rx_burstcount <= remaining_burst;
var_remaining_burst := (others => '0');
-- If burst crosses a page boundary, set the burst count to take us up to
-- the next page boundary, and subtract that length from remaining count.
-- Subsequent bursts should all be page aligned.
else
avm_rx_burstcount <= "00" & std_logic_vector(count_to_page_bdry);
var_remaining_burst := std_logic_vector(unsigned(remaining_burst) - count_to_page_bdry);
if is_slim = '0' then
if cmd_pending = '0' then
-- Latch the word length into the remaining burst counter
remaining_burst <= cmd_data(CMD_PARAM0_WORDLEN);
loop_is_first <= '1';
if cmd_data(CMD_BITS) = CMD_LD_CMD_Q then
-- Destination index for command queue is one above the defined number of external desitinations.
dst_sel <= std_logic_vector(to_unsigned(NUM_EXT_DSTS, 4));
-- Flag that auto-loading commands are now active whenever a LD_CMD_Q is written.
-- This will not be cleared until the command queue is empty and no outstanding
-- data transfers
auto_cmd_active <= '1';
else
-- Latch the destination index
dst_sel <= cmd_data(CMD_DEST_BITS);
end if;
-- Command is now pending until parameters (if any processed) and command completed.
cmd_pending <= '1';
-- For virtual commands, flag to pop the virtual address parameter
fetch_vaddr <= '1';
-- Won't commit to the read until cmd_pending phase and destination is ready
read_committed <= '0';
-- Clear the state that inidicates that the correct TLB map is found.
checked_tlb <= '0';
elsif dst_port_rdy = '1' or read_committed = '1' then
-- As the destination has been seen as ready, commit to the reads, including the multi-burst page crossing accesses
read_committed <= '1';
-- If a new TLB entry was extracted, check it matches otherwise it's an error
if tlb_read_last = '1' and vaddr_match = '0' then
tlb_mismatch_err <= '1';
end if;
-- If the virtual address does not match that at the o/p of the TLB queue,
-- pop the value from the queue to get the next one. Only check this if not validated
-- before, since the parameter may have been popped from the queue.
if checked_tlb = '0' then
-- Pop the entry
tlb_read <= not vaddr_match and not tlb_read and not tlb_empty;
-- It is an error if the queue is empty
tlb_empty_err <= tlb_empty;
-- Flag that we checked the TLB output already
checked_tlb <= '1';
else
-- If first cycle with virtual address parameter from queue, latch the
-- low bits this cycle to relieve timing on processing in the following cycles.
if fetch_vaddr = '1' then
if use_latched_addr = '0' then
curr_vaddr <= cmd_data_q;
diag_2 <= cmd_data_q;
end if;
-- Address low bits are page aligned...
else
-- If remaining burst is equal or less than a page, set burst to be remaining
-- count, set the count to 0 and clear the multi-burst variable as this is the last
-- transfer.
if unsigned(remaining_burst) <= PAGE_WORD_LEN then
var_multi_burst := '0';
avm_rx_burstcount <= remaining_burst;
var_remaining_burst := (others => '0');
-- If the remaining count is greater than a page, set the burst length to a page
-- and subtract the length from the remaining count.
fetch_vaddr <= '0';
elsif data_cmd_active = '0' then
-- If address low bits are not page aligned...
if not addr_offset_is_zero then
-- If burst does not cross a page boundary then set burst length to remaining
-- words, set remaining count to 0 and clear multi-burst flag as this is the last
-- transfer.
if count_to_page_bdry >= unsigned(remaining_burst) then
var_multi_burst := '0';
avm_rx_burstcount <= remaining_burst;
var_remaining_burst := (others => '0');
-- If burst crosses a page boundary, set the burst count to take us up to
-- the next page boundary, and subtract that length from remaining count.
-- Subsequent bursts should all be page aligned.
else
avm_rx_burstcount <= "00" & std_logic_vector(count_to_page_bdry);
var_remaining_burst := std_logic_vector(unsigned(remaining_burst) - count_to_page_bdry);
end if;
-- Address low bits are page aligned...
else
avm_rx_burstcount <= std_logic_vector(to_unsigned(PAGE_WORD_LEN, 12));
var_remaining_burst := std_logic_vector(unsigned(remaining_burst) - PAGE_WORD_LEN);
-- If remaining burst is equal or less than a page, set burst to be remaining
-- count, set the count to 0 and clear the multi-burst variable as this is the last
-- transfer.
if unsigned(remaining_burst) <= PAGE_WORD_LEN then
var_multi_burst := '0';
avm_rx_burstcount <= remaining_burst;
var_remaining_burst := (others => '0');
-- If the remaining count is greater than a page, set the burst length to a page
-- and subtract the length from the remaining count.
else
avm_rx_burstcount <= std_logic_vector(to_unsigned(PAGE_WORD_LEN, 12));
var_remaining_burst := std_logic_vector(unsigned(remaining_burst) - PAGE_WORD_LEN);
end if;
end if;
end if;
-- When transfer initiated, update the remaining burst count to take in to account
-- the words requested.
if avm_active_read = '1' then
remaining_burst <= var_remaining_burst;
end if;
-- The address to use is the TLB physical address bits, and the addr lower bits.
avm_rx_address <= tlb_rd_data(39 downto 20) & curr_vaddr(11 downto 0);
-- Issue the read command. Hold until active (no wait request).
avm_rx_read <= not avm_active_read;
-- Flag as data transfer active only if source and destination are ready
data_cmd_active <= avm_active_read;
-- Complete command (clear pending) when source and destination ready
-- and not a multi-burst command
cmd_pending <= not avm_active_read or var_multi_burst;
-- Flag when a LD_CMD_Q command popped from the queue and has started running (i.e. when cmd_pending cleared)
if cmd_data(CMD_BITS) = CMD_LD_CMD_Q then
-- It is an error to have insufficient space left when executing LD_CMD_Q, as
-- it is a lock condition.
if not dst_port_rdy then
auto_load_err <= '1';
-- When transfer initiated, update the remaining burst count to take in to account
-- the words requested.
if avm_active_read = '1' then
remaining_burst <= var_remaining_burst;
end if;
-- The address to use is the TLB physical address bits, and the addr lower bits.
avm_rx_address <= tlb_rd_data(39 downto 20) & curr_vaddr(11 downto 0);
-- Issue the read command. Hold until active (no wait request).
avm_rx_read <= not avm_active_read;
-- Flag as data transfer active only if source and destination are ready
data_cmd_active <= avm_active_read;
-- Complete command (clear pending) when source and destination ready
-- and not a multi-burst command
cmd_pending <= not avm_active_read or var_multi_burst;
-- Flag when a LD_CMD_Q command popped from the queue and has started running (i.e. when cmd_pending cleared)
if cmd_data(CMD_BITS) = CMD_LD_CMD_Q then
-- It is an error to have insufficient space left when executing LD_CMD_Q, as
-- it is a lock condition.
if not dst_port_rdy then
auto_load_err <= '1';
end if;
end if;
end if;
end if;
@ -613,16 +630,18 @@ begin
-- When a TLB load command, grab the parameters, and push to the queue
when CMD_LD_ADDR_MAP =>
if cmd_pending = '0' then
cmd_pending <= '1';
pop_parameter <= '1';
paddr <= cmd_data(CMD_PARAM_0);
else
cmd_pending <= '0';
tlb_cmd_active <= '1';
tlb_write <= '1';
tlb_wr_data <= paddr & cmd_data_q(31 downto 12);
diag_2 <= cmd_data_q;
if is_slim = '0' then
if cmd_pending = '0' then
cmd_pending <= '1';
pop_parameter <= '1';
paddr <= cmd_data(CMD_PARAM_0);
else
cmd_pending <= '0';
tlb_cmd_active <= '1';
tlb_write <= '1';
tlb_wr_data <= paddr & cmd_data_q(31 downto 12);
diag_2 <= cmd_data_q;
end if;
end if;
-- A NOP command
@ -673,24 +692,27 @@ begin
-- Clear the strip active flag
data_cmd_active <= '0';
-- Increment the latched virtual address's page number, and set the offset
-- bits to zero, as next burst starts from thebegiinng of the next virtual
-- page.
curr_vaddr <= std_logic_vector(unsigned(curr_vaddr(31 downto 12)) + 1) & 12x"0";
-- If more bursts to come, flag to use the latched virtual address, and clear
-- set the fetch_vaddr flag to indicate re-checking of TLB mapping required
if remaining_burst_is_zero = '0' then
use_latched_addr <= '1';
fetch_vaddr <= '1';
-- If at the end of the last burst, clear the use_latched_addr and fetch_vaddr state
else
use_latched_addr <= '0';
fetch_vaddr <= '0';
if is_slim = '0' then
-- Increment the latched virtual address's page number, and set the offset
-- bits to zero, as next burst starts from thebegiinng of the next virtual
-- page.
curr_vaddr <= std_logic_vector(unsigned(curr_vaddr(31 downto 12)) + 1) & 12x"0";
-- If more bursts to come, flag to use the latched virtual address, and clear
-- set the fetch_vaddr flag to indicate re-checking of TLB mapping required
if remaining_burst_is_zero = '0' then
use_latched_addr <= '1';
fetch_vaddr <= '1';
-- If at the end of the last burst, clear the use_latched_addr and fetch_vaddr state
else
use_latched_addr <= '0';
fetch_vaddr <= '0';
end if;
checked_tlb <= '0';
end if;
checked_tlb <= '0';
end if;
@ -707,7 +729,7 @@ begin
-- A TLB load command is cmpeted in the cycle after the TLB queue was written, to ensure
-- that the new translatin is available for the next command.
if tlb_write_last = '1' then
if is_slim = '0' and tlb_write_last = '1' then
tlb_cmd_active <= '0';
end if;
@ -728,7 +750,7 @@ begin
-- Latch the read data for the pixel buffer when data arrives from memory
if avm_rx_readdatavalid = '1' then
if control_msb = '1' then
if is_slim = '0' and control_msb = '1' then
dest_port_wr_data_int <= avm_rx_readdata( 7 downto 0) & avm_rx_readdata(15 downto 8) &
avm_rx_readdata(23 downto 16) & avm_rx_readdata(31 downto 24);
else
@ -736,12 +758,14 @@ begin
end if;
end if;
if is_slim = '0' then
-- Assert IRQ if number of used command queue spaces falls below watermark
if unsigned(usedw) < unsigned(control_watermark) and cmd_full = '0' then
irq <= '1';
else
-- Assert the interrupt if there's an error
irq <= cmd_error;
if unsigned(usedw) < unsigned(control_watermark) and cmd_full = '0' then
irq <= '1';
else
-- Assert the interrupt if there's an error
irq <= cmd_error;
end if;
end if;
-- Process the LD_CMD_Q count. Increment when pushed to queue (if not popping) and
@ -750,14 +774,16 @@ begin
cmd_pending <= '0';
cmd_available <= '0';
data_cmd_active <= '0';
read_committed <= '0';
fetch_vaddr <= '0';
checked_tlb <= '0';
use_latched_addr <= '0';
if is_slim ='0' then
read_committed <= '0';
fetch_vaddr <= '0';
checked_tlb <= '0';
use_latched_addr <= '0';
end if;
end if;
-- This is a debug signal to expose the variable if needed
multi_burst_last <= var_multi_burst;
multi_burst_last <= not is_slim and var_multi_burst;
if control_clr_dst0_count = '1' then
diag_dst0_count <= (others => '0');

View file

@ -27,6 +27,7 @@
-- step_pos_out : positive encoder step, before multiplication
-- step_neg_out : negative encoder step, before multiplication
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;

View file

@ -26,6 +26,7 @@
-- delta_t : estimated average time between encoder steps
-- time_out_flag : time-out flag
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;

View file

@ -18,6 +18,7 @@
-- Using a single M10k block the LUT width is 32 bits, which is more than needed
-- for the mantissa.
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;

View file

@ -1,11 +1,11 @@
# TCL File Generated by Component Editor 16.0
# Wed Oct 25 15:26:07 BST 2017
# Wed Jul 10 10:00:03 BST 2019
# DO NOT MODIFY
#
# fire_pulse_manager_0 "fire_pulse_manager_0" v1.0
# GMG 2017.10.25.15:26:07
# GMG 2019.07.10.10:00:03
# Fire Pulse Manager
#
@ -40,12 +40,11 @@ add_fileset QUARTUS_SYNTH QUARTUS_SYNTH "" ""
set_fileset_property QUARTUS_SYNTH TOP_LEVEL fire_pulse_manager_0
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_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
@ -72,12 +71,11 @@ add_fileset SIM_VHDL SIM_VHDL "" ""
set_fileset_property SIM_VHDL TOP_LEVEL fire_pulse_manager_0
set_fileset_property SIM_VHDL ENABLE_RELATIVE_INCLUDE_PATHS false
set_fileset_property SIM_VHDL ENABLE_FILE_OVERWRITE_MODE false
#add_fileset_file pkg_functions.vhd VHDL PATH ../../../common/0/src/pkg_functions.vhd
add_fileset_file 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_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
@ -98,7 +96,7 @@ add_fileset_file smb_diagnostics_0.vhd VHDL PATH ../src/smb_diagnostics_0.vhd
add_fileset_file fire_pulse_0_pkg.vhd VHDL PATH ../src/fire_pulse_0_pkg.vhd
add_fileset_file uart_regen_0.vhd VHDL PATH ../src/uart_regen_0.vhd
add_fileset_file fire_pulse_ctrl_0.vhd VHDL PATH ../src/fire_pulse_ctrl_0.vhd
add_fileset_file fire_pulse_manager_0.vhd VHDL PATH ../src/fire_pulse_manager_0.vhd
add_fileset_file fire_pulse_manager_0.vhd VHDL PATH ../src/fire_pulse_manager_0.vhd
#
@ -153,7 +151,7 @@ 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 1
set_interface_property avs maximumPendingReadTransactions 0
set_interface_property avs maximumPendingWriteTransactions 0
set_interface_property avs readLatency 0
set_interface_property avs readWaitTime 1
@ -170,8 +168,8 @@ 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_readdatavalid readdatavalid Output 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
@ -217,6 +215,7 @@ add_interface_port rx_clk rx_clk clk Input 1
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
@ -227,12 +226,14 @@ 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
@ -243,12 +244,14 @@ 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
@ -259,12 +262,14 @@ 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

View file

@ -13,6 +13,7 @@
-- Description:
-- Package for fire_pulse_manager block
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;

View file

@ -13,6 +13,7 @@
-- Description:
-- Control service logic for the Fire-Controller-Manager
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;

View file

@ -6,7 +6,7 @@
-- Author : Gianmarco Girau
-- Company : Global Inkjet Systems
-- Created : 2017-09-06
-- Last update: 2019-05-29
-- Last update: 2019-07-22
-- SVN ID : Git
-- Standard : VHDL'08
-------------------------------------------------------------------------------
@ -14,6 +14,7 @@
-- Generates fire request from the EMS output data, transferred either via POF
-- or through NetSync
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;
@ -47,7 +48,7 @@ entity fire_pulse_manager_0 is
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_waitrequest : out std_logic;
avs_readdata : out std_logic_vector(31 downto 0));
end entity fire_pulse_manager_0;
@ -137,6 +138,7 @@ architecture rtl of fire_pulse_manager_0 is
signal src_sel : std_logic_vector( 1 downto 0);
--
signal one_pps : std_logic;
signal log_data_src : std_logic_vector(31 downto 0);
begin
@ -165,7 +167,7 @@ begin
avs_write => avs_write,
avs_writedata => avs_writedata,
avs_read => avs_read,
avs_readdatavalid => avs_readdatavalid,
avs_waitrequest => avs_waitrequest,
avs_readdata => avs_readdata,
cs_addr => cs_addr,
cs_we => cs_write_en,

View file

@ -13,6 +13,7 @@
-- 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;

View file

@ -13,6 +13,7 @@
-- 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;

View file

@ -13,6 +13,7 @@
-- Description:
-- Regenerate the UART signal
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;

View file

@ -37,6 +37,7 @@ vcom -2008 -work $WORKLIB $GENERIC_PATH/generic_sequencer/15/src/generic_sequenc
vcom -2008 -work $WORKLIB $GENERIC_PATH/generic_sequencer/15/src/generic_sequencer_15.vhd
# Pulse Generator
vcom -2008 -work $WORKLIB $GENERIC_PATH/pulse_generator/1/src/altera/sync_fifo_1.vhd
vcom -2008 -work $WORKLIB $GENERIC_PATH/pulse_generator/1/src/pulse_generator_1_pkg.vhd
vcom -2008 -work $WORKLIB $GENERIC_PATH/pulse_generator/1/src/pulse_conditioning_1.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/altera/sync_fifo.vhd
@ -51,9 +52,9 @@ vcom -2008 -work $WORKLIB $GENERIC_PATH/enc_pd_emul/1/src/enc_pd_emul_1.vhd
# Fire-Pulse-Manager
vcom -2008 -work $WORKLIB $SRC_PATH/fire_pulse_1_pkg.vhd
vcom -2008 -work $WORKLIB $SRC_PATH/uart_rx_1.vhd
vcom -2008 -work $WORKLIB $SRC_PATH/sync_wire_1.vhd
vcom -2008 -work $WORKLIB $SRC_PATH/uart_regen_1.vhd
vcom -2008 -work $WORKLIB $SRC_PATH/fire_pulse_ctrl_1.vhd
vcom -2008 -work $WORKLIB $SRC_PATH/sync_wire_1.vhd
vcom -2008 -work $WORKLIB $SRC_PATH/sync_wire_rEdge_1.vhd
vcom -2008 -work $WORKLIB $SRC_PATH/pof_rx_1.vhd
vcom -2008 -work $WORKLIB $SRC_PATH/cs_bus_itf_1.vhd
@ -72,7 +73,8 @@ vcom -2008 -work $WORKLIB $TB_PATH/fire_pulse_manager_1_tb.vhd
vsim -t ps work.fire_pulse_manager_1_tb
# Add waves
add wave -r sim:/fire_pulse_manager_1_tb/*
#add wave -r sim:/fire_pulse_manager_1_tb/*
do wave_fpm.do
# remove warnings from standard numeric/arithmetic packages (speed-up simulation)
set StdArithNoWarnings 1

View file

@ -0,0 +1,70 @@
# Simulation macro Net-Sync testbench
.main clear
set COMP_ONLY 0
set TB_PATH ./../src/test
set COMMON_PATH ../../../common/0/src
set OSVVM_PATH $COMMON_PATH/test/OSVVM
set WORKLIB work
vlib ./work
vmap work ./work
if {$COMP_ONLY == 0} {
# Compile the constrained random related packages
vlib OSVVM
vcom -2008 -work OSVVM \
$OSVVM_PATH/RandomBasePkg.vhd \
$OSVVM_PATH/SortListPkg_int.vhd \
$OSVVM_PATH/RandomPkg.vhd \
$OSVVM_PATH/NamePkg.vhd \
$OSVVM_PATH/MessagePkg.vhd \
$OSVVM_PATH/CoveragePkg.vhd
}
# compile the UUTs:
#vcom -2008 -work $WORKLIB $COMMON_PATH/pkg_functions.vhd
vcom -2008 -work $WORKLIB ../src/sync_wire_1.vhd
vcom -2008 -work $WORKLIB ../src/sync_wire_redge_1.vhd
vcom -2008 -work $WORKLIB ../src/uart_rx_1.vhd
vcom -2008 -work $WORKLIB ../src/pof_rx_1.vhd
# Compile the testbench and the other components supporting the test
if {$COMP_ONLY == 0} {
# Test support packages
vcom -2008 -work $WORKLIB $COMMON_PATH/test/common_test_pkg.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/test/log_pkg.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/test/avalon_verify_pkg.vhd
# Testbench
# in fire pulse manager, the tx components are part of the testbench
vcom -2008 -work $WORKLIB $TB_PATH/fifo_16x8_1.vhd
vcom -2008 -work $WORKLIB $TB_PATH/pof_tx_1.vhd
vcom -2008 -work $WORKLIB $TB_PATH/uart_tx_1.vhd
vcom -2008 -work $WORKLIB $TB_PATH/pof_tx_rx_1_tb.vhd
vsim -t ps work.pof_tx_rx_1_tb
#add wave /pof_tx_rx_tb/*
#add wave /pof_tx_rx_tb/iPOF_TX/*
#add wave /pof_tx_rx_tb/iPOF_RX/*
# remove warnings from standard numeric/arithmetic packages (speed-up simulation)
set StdArithNoWarnings 1
set NumericStdNoWarnings 1
do wave_pof_txrx.do
when -label end_of_simulation {test_completed == true} {echo "Simulation Completed"; stop ;}
run -all
#run 1 ms;
}

View file

@ -0,0 +1,171 @@
onerror {resume}
quietly WaveActivateNextPane {} 0
add wave -noupdate -group TB /fire_pulse_manager_1_tb/ch_offset
add wave -noupdate -group TB /fire_pulse_manager_1_tb/reset_n
add wave -noupdate -group TB /fire_pulse_manager_1_tb/clk
add wave -noupdate -group TB /fire_pulse_manager_1_tb/rx_clk
add wave -noupdate -group TB /fire_pulse_manager_1_tb/pof_tx
add wave -noupdate -group TB /fire_pulse_manager_1_tb/pof_rx
add wave -noupdate -group TB /fire_pulse_manager_1_tb/ch_pulse_out
add wave -noupdate -group TB /fire_pulse_manager_1_tb/avs_address
add wave -noupdate -group TB /fire_pulse_manager_1_tb/avs_write
add wave -noupdate -group TB /fire_pulse_manager_1_tb/avs_writedata
add wave -noupdate -group TB /fire_pulse_manager_1_tb/avs_read
add wave -noupdate -group TB /fire_pulse_manager_1_tb/avs_readdatavalid
add wave -noupdate -group TB /fire_pulse_manager_1_tb/avs_readdata
add wave -noupdate -group TB /fire_pulse_manager_1_tb/init_tx
add wave -noupdate -group TB /fire_pulse_manager_1_tb/pd_in
add wave -noupdate -group TB /fire_pulse_manager_1_tb/pd_spy
add wave -noupdate -group TB /fire_pulse_manager_1_tb/inc_pos
add wave -noupdate -group TB /fire_pulse_manager_1_tb/dec_pos
add wave -noupdate -group TB /fire_pulse_manager_1_tb/abs_position
add wave -noupdate -group TB /fire_pulse_manager_1_tb/abs_spy
add wave -noupdate -group TB /fire_pulse_manager_1_tb/tx_data
add wave -noupdate -group TB /fire_pulse_manager_1_tb/abs_position_d
add wave -noupdate -group TB /fire_pulse_manager_1_tb/dir_in
add wave -noupdate -group TB /fire_pulse_manager_1_tb/swathe_cnt
add wave -noupdate -group TB /fire_pulse_manager_1_tb/swathe_pos
add wave -noupdate -group TB /fire_pulse_manager_1_tb/end_of_swathe
add wave -noupdate -group TB /fire_pulse_manager_1_tb/test_completed
add wave -noupdate -group TB /fire_pulse_manager_1_tb/running
add wave -noupdate -group TB /fire_pulse_manager_1_tb/configuring
add wave -noupdate -group TB /fire_pulse_manager_1_tb/passed
add wave -noupdate -group TB /fire_pulse_manager_1_tb/failed
add wave -noupdate -group TB /fire_pulse_manager_1_tb/stimuli_completed
add wave -noupdate -group TB /fire_pulse_manager_1_tb/detected_error
add wave -noupdate -group TB /fire_pulse_manager_1_tb/registers_read
add wave -noupdate -group TB /fire_pulse_manager_1_tb/reprogram_offset
add wave -noupdate -group TB /fire_pulse_manager_1_tb/avs_m
add wave -noupdate -group TB /fire_pulse_manager_1_tb/avs_s
add wave -noupdate -group TB /fire_pulse_manager_1_tb/sel_slave_0
add wave -noupdate -group TB /fire_pulse_manager_1_tb/sel_slave_1
add wave -noupdate -group TB /fire_pulse_manager_1_tb/pd_cnt
add wave -noupdate -group TB /fire_pulse_manager_1_tb/fp_cnt
add wave -noupdate -group TB /fire_pulse_manager_1_tb/tx_clk
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/reset_n
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/clk
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/init
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/rx_clk
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/rx_data
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/init_out
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/dp_dir
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/enc_out
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/pd_out
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/inc_pos
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/dec_pos
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/abs_pos
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/enable
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/bit_div
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/error_rate_thres
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/one_pps
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/upd_max_pos
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/upd_min_pos
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/max_error_flag
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/rx_watchdog
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/rx_watchdog_en
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/rx_watchdog_clr
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/parity_err_cnt
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/skip_pos_cnt
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/clear
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/symbol_ok
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/inc_pos_i
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/dec_pos_i
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/sync_gen
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/pd_gen
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/symbol_error
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/sync_d
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/symbol_valid
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/symbol_valid_i
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/symbol_valid_d
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/toggle_sync
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/sync_confirmed
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/sync_toggle_test
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/sync
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/toggle_pd
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/pd_confirmed
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/pd_toggle_test
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/pd
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/valid_pos
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/upd_pos
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/corr_done
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/corr_sign
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/skip_pos
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/apply_corr
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/inc_pos_ii
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/dec_pos_ii
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/new_max
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/new_min
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/rx_error
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/rx_error_i
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/rx_symbol_val
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/clear_i
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/skip_pos_d
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/pos_recovery
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/dp_dir_d
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/dp_dir_change
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/max_error_flag_i
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/clk_cnt
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/dist
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/abs_dist
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/skip_cnt
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/next_pos_lsb
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/curr_pos_lsb
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/pos_corr
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/max_dist
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/rx_error_v
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/gray_pos
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/rx_symbol_val_v
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/symbol
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/symbol_i
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/rx_symbol
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/rx_wd_cnt
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/parity_err_cnt_i
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/skip_pos_cnt_i
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/error_rate_cnt
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/error_rate
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/abs_pos_i
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/pos_max
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/pos_min
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/dist_pos
add wave -noupdate -group {POF RX} /fire_pulse_manager_1_tb/iDUT/iPOF_RX/dist_neg
add wave -noupdate -group UART_RX /fire_pulse_manager_1_tb/iDUT/iPOF_RX/iRX_SYMBOL/reset_n
add wave -noupdate -group UART_RX /fire_pulse_manager_1_tb/iDUT/iPOF_RX/iRX_SYMBOL/clk
add wave -noupdate -group UART_RX /fire_pulse_manager_1_tb/iDUT/iPOF_RX/iRX_SYMBOL/bit_div
add wave -noupdate -group UART_RX /fire_pulse_manager_1_tb/iDUT/iPOF_RX/iRX_SYMBOL/init
add wave -noupdate -group UART_RX /fire_pulse_manager_1_tb/iDUT/iPOF_RX/iRX_SYMBOL/data_out
add wave -noupdate -group UART_RX /fire_pulse_manager_1_tb/iDUT/iPOF_RX/iRX_SYMBOL/data_out_valid
add wave -noupdate -group UART_RX /fire_pulse_manager_1_tb/iDUT/iPOF_RX/iRX_SYMBOL/rx_error
add wave -noupdate -group UART_RX /fire_pulse_manager_1_tb/iDUT/iPOF_RX/iRX_SYMBOL/rx_data
add wave -noupdate -group UART_RX /fire_pulse_manager_1_tb/iDUT/iPOF_RX/iRX_SYMBOL/fsm_state_curr
add wave -noupdate -group UART_RX /fire_pulse_manager_1_tb/iDUT/iPOF_RX/iRX_SYMBOL/fsm_state_next
add wave -noupdate -group UART_RX /fire_pulse_manager_1_tb/iDUT/iPOF_RX/iRX_SYMBOL/rx_data_i
add wave -noupdate -group UART_RX /fire_pulse_manager_1_tb/iDUT/iPOF_RX/iRX_SYMBOL/shf_data
add wave -noupdate -group UART_RX /fire_pulse_manager_1_tb/iDUT/iPOF_RX/iRX_SYMBOL/rst_bit_cnt
add wave -noupdate -group UART_RX /fire_pulse_manager_1_tb/iDUT/iPOF_RX/iRX_SYMBOL/inc_bit_cnt
add wave -noupdate -group UART_RX /fire_pulse_manager_1_tb/iDUT/iPOF_RX/iRX_SYMBOL/rst_clk_cnt
add wave -noupdate -group UART_RX /fire_pulse_manager_1_tb/iDUT/iPOF_RX/iRX_SYMBOL/end_of_bit
add wave -noupdate -group UART_RX /fire_pulse_manager_1_tb/iDUT/iPOF_RX/iRX_SYMBOL/end_of_rx
add wave -noupdate -group UART_RX /fire_pulse_manager_1_tb/iDUT/iPOF_RX/iRX_SYMBOL/data_valid
add wave -noupdate -group UART_RX /fire_pulse_manager_1_tb/iDUT/iPOF_RX/iRX_SYMBOL/stop_bit
add wave -noupdate -group UART_RX /fire_pulse_manager_1_tb/iDUT/iPOF_RX/iRX_SYMBOL/rx_error_i
add wave -noupdate -group UART_RX /fire_pulse_manager_1_tb/iDUT/iPOF_RX/iRX_SYMBOL/data
add wave -noupdate -group UART_RX /fire_pulse_manager_1_tb/iDUT/iPOF_RX/iRX_SYMBOL/clk_cnt
add wave -noupdate -group UART_RX /fire_pulse_manager_1_tb/iDUT/iPOF_RX/iRX_SYMBOL/bit_cnt
TreeUpdate [SetDefaultTree]
WaveRestoreCursors {{Cursor 1} {0 ps} 0}
quietly wave cursor active 0
configure wave -namecolwidth 150
configure wave -valuecolwidth 100
configure wave -justifyvalue left
configure wave -signalnamewidth 1
configure wave -snapdistance 10
configure wave -datasetprefix 0
configure wave -rowmargin 4
configure wave -childrowmargin 2
configure wave -gridoffset 0
configure wave -gridperiod 1
configure wave -griddelta 40
configure wave -timeline 0
configure wave -timelineunits ps
update
WaveRestoreZoom {64332055 ps} {64335156 ps}

View file

@ -0,0 +1,235 @@
onerror {resume}
quietly WaveActivateNextPane {} 0
add wave -noupdate /pof_tx_rx_1_tb/reset_n
add wave -noupdate /pof_tx_rx_1_tb/hmb_clk
add wave -noupdate /pof_tx_rx_1_tb/sm_clk
add wave -noupdate /pof_tx_rx_1_tb/avs_read
add wave -noupdate /pof_tx_rx_1_tb/avs_write
add wave -noupdate /pof_tx_rx_1_tb/sel_slave_0
add wave -noupdate /pof_tx_rx_1_tb/sel_slave_1
add wave -noupdate /pof_tx_rx_1_tb/avs_write_sl0
add wave -noupdate /pof_tx_rx_1_tb/avs_read_sl0
add wave -noupdate /pof_tx_rx_1_tb/avs_readdatavalid_sl0
add wave -noupdate /pof_tx_rx_1_tb/avs_write_sl1
add wave -noupdate /pof_tx_rx_1_tb/avs_read_sl1
add wave -noupdate /pof_tx_rx_1_tb/avs_readdatavalid_sl1
add wave -noupdate /pof_tx_rx_1_tb/init_tx
add wave -noupdate /pof_tx_rx_1_tb/init_rx
add wave -noupdate /pof_tx_rx_1_tb/dir_in
add wave -noupdate /pof_tx_rx_1_tb/pd_in
add wave -noupdate /pof_tx_rx_1_tb/inc_pos
add wave -noupdate /pof_tx_rx_1_tb/dec_pos
add wave -noupdate -radix decimal /pof_tx_rx_1_tb/abs_position
add wave -noupdate /pof_tx_rx_1_tb/tx_data
add wave -noupdate /pof_tx_rx_1_tb/rx_data
add wave -noupdate /pof_tx_rx_1_tb/init_out
add wave -noupdate /pof_tx_rx_1_tb/dir_out
add wave -noupdate /pof_tx_rx_1_tb/enc_out
add wave -noupdate /pof_tx_rx_1_tb/pd_out
add wave -noupdate /pof_tx_rx_1_tb/inc_pos_out
add wave -noupdate /pof_tx_rx_1_tb/dec_pos_out
add wave -noupdate -radix decimal /pof_tx_rx_1_tb/abs_pos_out
add wave -noupdate /pof_tx_rx_1_tb/test_completed
add wave -noupdate /pof_tx_rx_1_tb/running
add wave -noupdate /pof_tx_rx_1_tb/configuring
add wave -noupdate /pof_tx_rx_1_tb/passed
add wave -noupdate /pof_tx_rx_1_tb/failed
add wave -noupdate /pof_tx_rx_1_tb/stimuli_completed
add wave -noupdate /pof_tx_rx_1_tb/avs_address
add wave -noupdate -radix hexadecimal /pof_tx_rx_1_tb/avs_writedata
add wave -noupdate -radix hexadecimal /pof_tx_rx_1_tb/avs_readdata_sl0
add wave -noupdate -radix hexadecimal /pof_tx_rx_1_tb/avs_readdata_sl1
add wave -noupdate -radix decimal /pof_tx_rx_1_tb/abs_position_d
add wave -noupdate -radix decimal /pof_tx_rx_1_tb/swathe_pos
add wave -noupdate /pof_tx_rx_1_tb/swathe_cnt
add wave -noupdate -radix hexadecimal /pof_tx_rx_1_tb/avs_m
add wave -noupdate -radix hexadecimal /pof_tx_rx_1_tb/avs_s
add wave -noupdate /pof_tx_rx_1_tb/detected_error
add wave -noupdate /pof_tx_rx_1_tb/dir_discr_cnt
add wave -noupdate /pof_tx_rx_1_tb/pd_discr_cnt
add wave -noupdate /pof_tx_rx_1_tb/pd_in_cnt
add wave -noupdate /pof_tx_rx_1_tb/pd_out_cnt
add wave -noupdate -radix decimal /pof_tx_rx_1_tb/abs_position
add wave -noupdate -radix decimal /pof_tx_rx_1_tb/abs_pos_out
add wave -noupdate /pof_tx_rx_1_tb/pos_discr_cnt
add wave -noupdate /pof_tx_rx_1_tb/end_of_swathe
add wave -noupdate /pof_tx_rx_1_tb/enc_pulse_cnt
add wave -noupdate /pof_tx_rx_1_tb/dir_err
add wave -noupdate /pof_tx_rx_1_tb/pd_err
add wave -noupdate /pof_tx_rx_1_tb/pos_err
add wave -noupdate /pof_tx_rx_1_tb/enc_err
add wave -noupdate /pof_tx_rx_1_tb/ovfl_err
add wave -noupdate /pof_tx_rx_1_tb/injected_errors
add wave -noupdate /pof_tx_rx_1_tb/max_pos
add wave -noupdate /pof_tx_rx_1_tb/min_pos
add wave -noupdate /pof_tx_rx_1_tb/exp_enc_pulse
add wave -noupdate /pof_tx_rx_1_tb/enc_discr
add wave -noupdate /pof_tx_rx_1_tb/exp_enc_cnt
add wave -noupdate /pof_tx_rx_1_tb/error_rate_thres
add wave -noupdate /pof_tx_rx_1_tb/one_pps
add wave -noupdate /pof_tx_rx_1_tb/max_error_flag
add wave -noupdate /pof_tx_rx_1_tb/rx_watchdog
add wave -noupdate /pof_tx_rx_1_tb/rx_watchdog_en
add wave -noupdate /pof_tx_rx_1_tb/rx_watchdog_clr
add wave -noupdate -divider EMB2POF
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/reset_n
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/clk
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/init
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/pd_in
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/inc_pos
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/dec_pos
add wave -noupdate -radix decimal /pof_tx_rx_1_tb/iPOF_TX/abs_position
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/tx_data
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/avs_address
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/avs_write
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/avs_writedata
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/avs_read
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/avs_readdatavalid
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/avs_readdata
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/rd_event
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/wr_event
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/empty
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/full
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/tx_ready
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/rd_event_d
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/wr_event_i
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/enable
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/toggle_sync
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/toggle_pd
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/add_keepalive
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/ovfl_err
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/init_d
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/init_gen
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/init_v
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/init_blocked
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/init_blk_cnt
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/parity_bit
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/inject_error
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/inject_error_req
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/pd_event
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/pd_event_d
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/pd_event_dd
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/gray
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/clear
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/pd_in_d
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/pd_gen
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/clk
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/symbol_valid
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/symbol
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/tx_data
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/event_in_i
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/event_in
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/event_out
add wave -noupdate -radix decimal /pof_tx_rx_1_tb/iPOF_TX/keepalive_cnt
add wave -noupdate -divider POF2HMB
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/reset_n
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/clk
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/init
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/rx_clk
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/rx_data
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/init_out
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/enc_out
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/pd_out
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/inc_pos
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/dec_pos
add wave -noupdate -radix decimal /pof_tx_rx_1_tb/iPOF_RX/abs_pos
add wave -noupdate -radix unsigned /pof_tx_rx_1_tb/iPOF_RX/error_rate_thres
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/one_pps
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/max_error_flag
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/rx_watchdog
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/rx_watchdog_en
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/rx_watchdog_clr
add wave -noupdate -radix unsigned /pof_tx_rx_1_tb/iPOF_RX/rx_wd_cnt
add wave -noupdate -radix unsigned /pof_tx_rx_1_tb/iPOF_RX/error_rate_cnt
add wave -noupdate -radix unsigned /pof_tx_rx_1_tb/iPOF_RX/error_rate
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/clear
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/clear_i
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/inc_pos_i
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/dec_pos_i
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/enable
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/sync_gen
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/pd_gen
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/symbol_error
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/rx_symbol_val
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/rx_symbol
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/rx_symbol_val_v
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/symbol_valid_i
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/symbol_valid_d
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/toggle_sync
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/sync_confirmed
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/sync_toggle_test
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/sync
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/toggle_pd
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/pd_confirmed
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/pd_toggle_test
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/pd
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/valid_pos
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/upd_pos
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/corr_done
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/corr_sign
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/skip_cnt
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/skip_pos
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/symbol_valid
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/symbol
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/apply_corr
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/clk_cnt
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/dist
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/abs_dist
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/next_pos_lsb
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/curr_pos_lsb
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/pos_corr
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/max_dist
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/gray_pos
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/symbol_i
add wave -noupdate -radix unsigned /pof_tx_rx_1_tb/iPOF_RX/parity_err_cnt
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/enc_out
add wave -noupdate -radix decimal /pof_tx_rx_1_tb/iPOF_RX/abs_pos_i
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/inc_pos_ii
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/dec_pos_ii
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/new_max
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/new_min
add wave -noupdate -radix decimal /pof_tx_rx_1_tb/iPOF_RX/pos_max
add wave -noupdate -radix decimal /pof_tx_rx_1_tb/iPOF_RX/pos_min
add wave -noupdate -radix decimal /pof_tx_rx_1_tb/iPOF_RX/dist_pos
add wave -noupdate -radix decimal /pof_tx_rx_1_tb/iPOF_RX/dist_neg
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/iRX_SYMBOL/data_width
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/iRX_SYMBOL/reset_n
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/iRX_SYMBOL/clk
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/iRX_SYMBOL/bit_div
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/iRX_SYMBOL/init
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/iRX_SYMBOL/data_out
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/iRX_SYMBOL/data_out_valid
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/iRX_SYMBOL/rx_data
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/iRX_SYMBOL/fsm_state_curr
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/iRX_SYMBOL/fsm_state_next
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/iRX_SYMBOL/rx_data_i
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/iRX_SYMBOL/shf_data
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/iRX_SYMBOL/rst_bit_cnt
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/iRX_SYMBOL/inc_bit_cnt
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/iRX_SYMBOL/rst_clk_cnt
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/iRX_SYMBOL/end_of_bit
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/iRX_SYMBOL/end_of_rx
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/iRX_SYMBOL/data_valid
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/iRX_SYMBOL/stop_bit
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/iRX_SYMBOL/data
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/iRX_SYMBOL/clk_cnt
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/iRX_SYMBOL/bit_cnt
TreeUpdate [SetDefaultTree]
WaveRestoreCursors {{Cursor 2} {28538165210 ps} 0} {{Cursor 3} {28538185210 ps} 0} {{Cursor 4} {28538205210 ps} 0} {{Cursor 5} {28538225210 ps} 0}
WaveRestoreCursorLinks {1 {2 {20000 ps} 3 {40000 ps} 4 {60000 ps}}} {2 {1 {-20000 ps}}} {3 {1 {-40000 ps}}} {4 {1 {-60000 ps}}}
quietly wave cursor active 1
configure wave -namecolwidth 365
configure wave -valuecolwidth 100
configure wave -justifyvalue left
configure wave -signalnamewidth 0
configure wave -snapdistance 10
configure wave -datasetprefix 0
configure wave -rowmargin 4
configure wave -childrowmargin 2
configure wave -gridoffset 0
configure wave -gridperiod 1
configure wave -griddelta 40
configure wave -timeline 0
configure wave -timelineunits ps
update
WaveRestoreZoom {28537732626 ps} {28538723476 ps}

View file

@ -16,6 +16,7 @@
-- Date Version Author Description
-- 2015-10-19 1.0 gmg Created
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;

View file

@ -13,6 +13,7 @@
-- Description:
-- Package for fire_pulse_manager block
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;

View file

@ -13,6 +13,7 @@
-- Description:
-- Control service logic for the Fire-Controller-Manager
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;
@ -22,21 +23,21 @@ entity fire_pulse_ctrl_1 is
port(
reset_n : in std_logic;
clk : in std_logic;
src_sel : out std_logic_vector( 1 downto 0);
src_sel : out std_logic_vector(1 downto 0);
uart_regen_bypass : out std_logic;
upd_max_pos : out std_logic;
upd_min_pos : out std_logic;
enable_rx : out std_logic;
uart_bit_div : out std_logic_vector( 3 downto 0);
error_rate_thres : out std_logic_vector( 7 downto 0);
uart_bit_div : out std_logic_vector(3 downto 0);
error_rate_thres : out std_logic_vector(7 downto 0);
max_error_flag : in std_logic;
rx_watchdog : in std_logic;
rx_watchdog_en : out std_logic;
rx_watchdog_clr : out std_logic;
parity_err_cnt : in std_logic_vector(15 downto 0);
skip_pos_cnt : in std_logic_vector(15 downto 0);
mon_point_src : in std_logic_vector(15 downto 0);
mon_points : out std_logic_vector( 3 downto 0);
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;
@ -45,7 +46,7 @@ entity fire_pulse_ctrl_1 is
-- Interrupt Senders
ins_fpm_irq_0 : out std_logic;
-- Avalon MM Interface
avs_address : in std_logic_vector( 3 downto 0);
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;
@ -58,41 +59,41 @@ architecture rtl of fire_pulse_ctrl_1 is
-----------------------------------------------------------------------------
-- Control & Status Registers Map
-----------------------------------------------------------------------------
constant CSR_IP_ID : std_logic_vector(31 downto 0) := x"0000FF14";
constant CSR_IP_VER : std_logic_vector(31 downto 0) := x"00000100";
constant CSR_IP_ID : std_logic_vector(31 downto 0) := x"0000FF14";
constant CSR_IP_VER : std_logic_vector(31 downto 0) := x"00000101";
constant CSR_IP_ID_REG : std_logic_vector( 3 downto 0) := b"0000";
constant CSR_IP_VER_REG : std_logic_vector( 3 downto 0) := b"0001";
constant SRC_SEL_REG : std_logic_vector( 3 downto 0) := b"0010";
constant POF_RX_CTRL : std_logic_vector( 3 downto 0) := b"0011";
constant MON_PT_CTRL_REG : std_logic_vector( 3 downto 0) := b"0100";
constant COARSE_TIME_INIT_REG : std_logic_vector( 3 downto 0) := b"0101";
constant FINE_TIME_INIT_REG : std_logic_vector( 3 downto 0) := b"0110";
constant FINE_TIME_REG : std_logic_vector( 3 downto 0) := b"0111";
constant COARSE_TIME_REG : std_logic_vector( 3 downto 0) := b"1000";
constant RX_ERROR_STATUS : std_logic_vector( 3 downto 0) := b"1001";
constant RX_ERROR_CSR : std_logic_vector( 3 downto 0) := b"1010";
constant IRQ_MNG_REG : std_logic_vector( 3 downto 0) := b"1011";
constant EXT_FP_CTRL_REG : std_logic_vector( 3 downto 0) := b"1100";
constant CSR_IP_ID_REG : std_logic_vector(3 downto 0) := b"0000";
constant CSR_IP_VER_REG : std_logic_vector(3 downto 0) := b"0001";
constant SRC_SEL_REG : std_logic_vector(3 downto 0) := b"0010";
constant POF_RX_CTRL : std_logic_vector(3 downto 0) := b"0011";
constant MON_PT_CTRL_REG : std_logic_vector(3 downto 0) := b"0100";
constant COARSE_TIME_INIT_REG : std_logic_vector(3 downto 0) := b"0101";
constant FINE_TIME_INIT_REG : std_logic_vector(3 downto 0) := b"0110";
constant FINE_TIME_REG : std_logic_vector(3 downto 0) := b"0111";
constant COARSE_TIME_REG : std_logic_vector(3 downto 0) := b"1000";
constant RX_ERROR_STATUS : std_logic_vector(3 downto 0) := b"1001";
constant RX_ERROR_CSR : std_logic_vector(3 downto 0) := b"1010";
constant IRQ_MNG_REG : std_logic_vector(3 downto 0) := b"1011";
constant EXT_FP_CTRL_REG : std_logic_vector(3 downto 0) := b"1100";
-----------------------------------------------------------------------------
-- Constants, Signals
-----------------------------------------------------------------------------
constant FINE_TIME_TC : integer := 100000000-1; -- clk must be 100MHz to
-- make it right
constant FINE_TIME_TC : integer := 100000000 - 1; -- clk must be 100MHz to
-- make it right
signal enable_rx_i : std_logic;
signal fine_time_wrap, time_ld_en : std_logic;
signal rx_watchdog_en_i, rx_watchdog_clr_i : std_logic;
signal uart_regen_bypass_i : std_logic;
signal upd_min_pos_i, upd_max_pos_i : std_logic;
signal irq, irq_src, irq_src_d : std_logic_vector( 0 downto 0);
signal irq_en, irq_mask, irq_val, irq_clr : std_logic_vector( 0 downto 0);
signal src_sel_i : std_logic_vector( 1 downto 0);
signal mp_sel0, mp_sel1, mp_sel2, mp_sel3 : std_logic_vector( 3 downto 0);
signal bit_div : std_logic_vector( 3 downto 0);
signal error_rate_thres_i : std_logic_vector( 7 downto 0);
signal irq, irq_src, irq_src_d : std_logic_vector(0 downto 0);
signal irq_en, irq_mask, irq_val, irq_clr : std_logic_vector(0 downto 0);
signal src_sel_i : std_logic_vector(1 downto 0);
signal mp_sel0, mp_sel1, mp_sel2, mp_sel3 : std_logic_vector(3 downto 0);
signal bit_div : std_logic_vector(3 downto 0);
signal error_rate_thres_i : std_logic_vector(7 downto 0);
signal fine_time_init, fine_time_i : std_logic_vector(27 downto 0);
signal coarse_time_init, coarse_time_i : std_logic_vector(31 downto 0);
signal ext_fp_det_i, ext_fp_gen_i : std_logic_vector(15 downto 0);
@ -100,22 +101,22 @@ architecture rtl of fire_pulse_ctrl_1 is
begin
pCTRL_REGs : process(reset_n, clk)
begin -- process
if(reset_n = '0') then
fine_time_i <= (others => '0');
coarse_time_i <= (others => '0');
elsif(clk = '1' and clk'event) then
if(time_ld_en = '1') then
begin -- process
if (reset_n = '0') then
fine_time_i <= (others => '0');
coarse_time_i <= (others => '0');
elsif (clk = '1' and clk'event) then
if (time_ld_en = '1') then
fine_time_i <= fine_time_init;
elsif(fine_time_wrap = '1') then
elsif (fine_time_wrap = '1') then
fine_time_i <= (others => '0');
else
fine_time_i <= std_logic_vector(unsigned(fine_time_i)+1);
fine_time_i <= std_logic_vector(unsigned(fine_time_i) + 1);
end if;
if(time_ld_en = '1') then
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);
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;
@ -138,19 +139,19 @@ begin
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;
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
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
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
end loop; -- n
ins_fpm_irq_0 <= irq_val(0);
end if;
end process pIRQ;
@ -174,12 +175,12 @@ begin
rx_watchdog_en <= rx_watchdog_en_i;
rx_watchdog_clr <= rx_watchdog_clr_i;
ext_fp_det <= ext_fp_det_i;
ext_fp_gen <= ext_fp_gen_i;
ext_fp_det <= ext_fp_det_i;
ext_fp_gen <= ext_fp_gen_i;
pCTRL_STATUS : process(reset_n, clk)
begin
if(reset_n = '0') then
if (reset_n = '0') then
avs_readdatavalid <= '0';
src_sel_i <= "00";
enable_rx_i <= '0';
@ -199,65 +200,65 @@ begin
time_ld_en <= '0';
ext_fp_det_i <= X"0010";
ext_fp_gen_i <= X"0020";
elsif(clk = '1' and clk'event) then
elsif (clk = '1' and clk'event) then
-- CTRL registers
if(avs_write = '1') then
if (avs_write = '1') then
case avs_address is
when SRC_SEL_REG =>
src_sel_i <= avs_writedata( 1 downto 0);
src_sel_i <= avs_writedata(1 downto 0);
when POF_RX_CTRL =>
enable_rx_i <= avs_writedata(0);
uart_regen_bypass_i <= avs_writedata(1);
upd_max_pos_i <= avs_writedata(2);
upd_min_pos_i <= avs_writedata(3);
bit_div <= avs_writedata( 7 downto 4);
bit_div <= avs_writedata(7 downto 4);
when MON_PT_CTRL_REG =>
mp_sel0 <= avs_writedata( 3 downto 0);
mp_sel1 <= avs_writedata( 7 downto 4);
mp_sel2 <= avs_writedata(11 downto 8);
mp_sel3 <= avs_writedata(15 downto 12);
when COARSE_TIME_INIT_REG =>
coarse_time_init <= avs_writedata;
mp_sel0 <= avs_writedata(3 downto 0);
mp_sel1 <= avs_writedata(7 downto 4);
mp_sel2 <= avs_writedata(11 downto 8);
mp_sel3 <= avs_writedata(15 downto 12);
when COARSE_TIME_INIT_REG =>
coarse_time_init <= avs_writedata;
when FINE_TIME_INIT_REG =>
time_ld_en <= avs_writedata(28);
fine_time_init <= avs_writedata(27 downto 0);
time_ld_en <= avs_writedata(28);
fine_time_init <= avs_writedata(27 downto 0);
when RX_ERROR_CSR =>
error_rate_thres_i <= avs_writedata( 7 downto 0);
rx_watchdog_en_i <= avs_writedata(8);
rx_watchdog_clr_i <= avs_writedata(9);
error_rate_thres_i <= avs_writedata(7 downto 0);
rx_watchdog_en_i <= avs_writedata(8);
rx_watchdog_clr_i <= avs_writedata(9);
when IRQ_MNG_REG =>
irq_en <= avs_writedata( 0 downto 0);
irq_clr <= avs_writedata( 4 downto 4);
irq_mask <= avs_writedata( 8 downto 8);
irq_en <= avs_writedata(0 downto 0);
irq_clr <= avs_writedata(4 downto 4);
irq_mask <= avs_writedata(8 downto 8);
when EXT_FP_CTRL_REG =>
ext_fp_det_i <= avs_writedata(15 downto 0);
ext_fp_gen_i <= avs_writedata(31 downto 16);
ext_fp_det_i <= avs_writedata(15 downto 0);
ext_fp_gen_i <= avs_writedata(31 downto 16);
when others => null;
end case;
end if;
end if;
-- Read Ctrl & Status registers
avs_readdatavalid <= avs_read;
if(avs_read = '1') then
if (avs_read = '1') then
case avs_address is
when CSR_IP_ID_REG =>
avs_readdata <= CSR_IP_ID;
when CSR_IP_VER_REG =>
avs_readdata <= CSR_IP_VER;
when SRC_SEL_REG =>
when SRC_SEL_REG =>
avs_readdata <= (0 => src_sel_i(0), 1 => src_sel_i(1), others => '0');
when POF_RX_CTRL =>
when POF_RX_CTRL =>
avs_readdata <= X"000000" & bit_div & upd_min_pos_i & upd_max_pos_i & uart_regen_bypass_i & enable_rx_i;
when MON_PT_CTRL_REG =>
avs_readdata <= X"0000" & mp_sel3 & mp_sel2 & mp_sel1 & mp_sel0;
when COARSE_TIME_INIT_REG =>
avs_readdata <= coarse_time_init;
when FINE_TIME_INIT_REG =>
when FINE_TIME_INIT_REG =>
avs_readdata <= b"000" & time_ld_en & fine_time_init;
when RX_ERROR_STATUS =>
avs_readdata <= skip_pos_cnt & parity_err_cnt;
when FINE_TIME_REG =>
when FINE_TIME_REG =>
avs_readdata <= X"0" & fine_time_i;
when COARSE_TIME_REG =>
when COARSE_TIME_REG =>
avs_readdata <= coarse_time_i;
when RX_ERROR_CSR =>
avs_readdata <= X"00000" & max_error_flag & rx_watchdog & rx_watchdog_clr_i & rx_watchdog_en_i & error_rate_thres_i;
@ -271,5 +272,5 @@ begin
end if;
end if;
end process pCTRL_STATUS;
end architecture rtl;

View file

@ -13,6 +13,7 @@
-- Description:
-- Detects external fire pulse and regenerates it
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;

View file

@ -14,31 +14,31 @@
-- Generates fire request from the EMS output data, transferred either via POF
-- or through NetSync
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library work;
use work.fire_pulse_1_pkg.all;
entity fire_pulse_manager_1 is
port(
reset_n : in std_logic;
clk : in std_logic; -- 100MHz
rx_clk : in std_logic; -- 200MHz
rx_clk : in std_logic; -- 300MHz (typical)
-- Datapath I/Os
pof_rx : in std_logic;
pof_tx : out std_logic;
pof_iso_en : out std_logic;
fire_pulse : out std_logic_vector(ch_num-1 downto 0);
mon_pt : out std_logic_vector( 3 downto 0); -- Monitoring Points
-- on header J7
fire_pulse : out std_logic_vector(ch_num - 1 downto 0);
mon_pt : out std_logic_vector(3 downto 0); -- Monitoring Points
-- on header J7
-- Interrupt Senders
ins_fpm_irq_0 : out std_logic;
ins_fpm_irq_1 : out std_logic;
ins_fpm_irq_2 : out std_logic;
ins_fpm_irq_3 : out std_logic;
ins_fpm_irq_1 : out std_logic; -- @suppress "Unused port: ins_fpm_irq_1 is not used in work.fire_pulse_manager_1(rtl)"
ins_fpm_irq_2 : out std_logic; -- @suppress "Unused port: ins_fpm_irq_2 is not used in work.fire_pulse_manager_1(rtl)"
ins_fpm_irq_3 : out std_logic; -- @suppress "Unused port: ins_fpm_irq_3 is not used in work.fire_pulse_manager_1(rtl)"
-- Avalon MM (Slave) Interface
avs_address : in std_logic_vector(14 downto 0);
avs_write : in std_logic;
@ -52,87 +52,87 @@ architecture rtl of fire_pulse_manager_1 is
constant PD_QUEUE_SIZE : natural := 512;
type diag_cnt_en_t is array (1 to ch_num) of boolean;
type diag_cnt_en_t is array (1 to ch_num) of boolean;
constant DIAG_COUNTER_EN : diag_cnt_en_t := (1 => true, others => false);
signal reset_n_i : std_logic;
signal reset_n_i : std_logic;
--
signal cs_addr : std_logic_vector(10 downto 0);
signal cs_write_en : std_logic_vector(blk_num-1 downto 0);
signal cs_write_data : std_logic_vector(31 downto 0);
signal cs_read_en : std_logic_vector(blk_num-1 downto 0);
signal cs_read_valid : std_logic_vector(blk_num-1 downto 0);
signal cs_read_data : std_logic_vector(32*blk_num-1 downto 0);
signal cs_addr : std_logic_vector(10 downto 0);
signal cs_write_en : std_logic_vector(blk_num - 1 downto 0);
signal cs_write_data : std_logic_vector(31 downto 0);
signal cs_read_en : std_logic_vector(blk_num - 1 downto 0);
signal cs_read_valid : std_logic_vector(blk_num - 1 downto 0);
signal cs_read_data : std_logic_vector(32 * blk_num - 1 downto 0);
--
signal cs_ctrl_write_en : std_logic;
signal cs_ctrl_read_en : std_logic;
signal cs_ctrl_read_valid : std_logic;
signal cs_ctrl_read_data : std_logic_vector(31 downto 0);
signal cs_ctrl_write_en : std_logic;
signal cs_ctrl_read_en : std_logic;
signal cs_ctrl_read_valid : std_logic;
signal cs_ctrl_read_data : std_logic_vector(31 downto 0);
--
signal cs_pg_write_en : std_logic_vector(ch_num-1 downto 0);
signal cs_pg_read_en : std_logic_vector(ch_num-1 downto 0);
signal cs_pg_read_valid : std_logic_vector(ch_num-1 downto 0);
signal cs_pg_read_data : std_logic_vector(32*ch_num-1 downto 0);
signal cs_pg_write_en : std_logic_vector(ch_num - 1 downto 0);
signal cs_pg_read_en : std_logic_vector(ch_num - 1 downto 0);
signal cs_pg_read_valid : std_logic_vector(ch_num - 1 downto 0);
signal cs_pg_read_data : std_logic_vector(32 * ch_num - 1 downto 0);
--
signal cs_nsnk_write_en : std_logic;
signal cs_nsnk_read_en : std_logic;
signal cs_nsnk_read_valid : std_logic;
signal cs_nsnk_read_data : std_logic_vector(31 downto 0);
signal cs_nsnk_write_en : std_logic;
signal cs_nsnk_read_en : std_logic;
signal cs_nsnk_read_valid : std_logic;
signal cs_nsnk_read_data : std_logic_vector(31 downto 0);
--
signal cs_log_write_en : std_logic;
signal cs_log_read_en : std_logic;
signal cs_log_read_valid : std_logic;
signal cs_log_read_data : std_logic_vector(31 downto 0);
signal cs_log_write_en : std_logic;
signal cs_log_read_en : std_logic;
signal cs_log_read_valid : std_logic;
signal cs_log_read_data : std_logic_vector(31 downto 0);
--
signal cs_ie_write_en : std_logic;
signal cs_ie_read_en : std_logic;
signal cs_ie_read_valid : std_logic;
signal cs_ie_read_data : std_logic_vector(31 downto 0);
signal cs_ie_write_en : std_logic;
signal cs_ie_read_en : std_logic;
signal cs_ie_read_valid : std_logic;
signal cs_ie_read_data : std_logic_vector(31 downto 0);
--
signal enable_rx : std_logic;
signal uart_regen_bypass : std_logic;
signal upd_max_pos : std_logic;
signal upd_min_pos : std_logic;
signal max_error_flag : std_logic;
signal rx_watchdog : std_logic;
signal rx_watchdog_en : std_logic;
signal rx_watchdog_clr : std_logic;
signal bit_div : std_logic_vector( 3 downto 0);
signal error_rate_thres : std_logic_vector( 7 downto 0);
signal parity_err_cnt : std_logic_vector(15 downto 0);
signal skip_pos_cnt : std_logic_vector(15 downto 0);
signal mon_point_src : std_logic_vector(15 downto 0);
signal fine_time : std_logic_vector(27 downto 0);
signal coarse_time : std_logic_vector(31 downto 0);
signal enable_rx : std_logic;
signal uart_regen_bypass : std_logic;
signal upd_max_pos : std_logic;
signal upd_min_pos : std_logic;
signal max_error_flag : std_logic;
signal rx_watchdog : std_logic;
signal rx_watchdog_en : std_logic;
signal rx_watchdog_clr : std_logic;
signal bit_div : std_logic_vector(3 downto 0);
signal error_rate_thres : std_logic_vector(7 downto 0);
signal parity_err_cnt : std_logic_vector(15 downto 0);
signal skip_pos_cnt : std_logic_vector(15 downto 0);
signal mon_point_src : std_logic_vector(15 downto 0);
signal fine_time : std_logic_vector(27 downto 0);
signal coarse_time : std_logic_vector(31 downto 0);
--
signal remote_init : std_logic;
signal dp_dir : std_logic_vector(ch_num-1 downto 0);
signal set_pos_ie : std_logic;
signal enc_pulse : std_logic;
signal enc_pulse_ie : std_logic;
signal enc_pulse_pof : std_logic;
signal pd_pulse : std_logic;
signal pd_pulse_ie : std_logic;
signal pd_pulse_pof : std_logic;
signal inc_pos : std_logic;
signal inc_pos_pof : std_logic;
signal inc_pos_ie : std_logic;
signal dec_pos : std_logic;
signal dec_pos_pof : std_logic;
signal dec_pos_ie : std_logic;
signal abs_pos : std_logic_vector(31 downto 0);
signal abs_pos_pof : std_logic_vector(31 downto 0);
signal abs_pos_ie : std_logic_vector(39 downto 0);
signal remote_init : std_logic;
signal dp_dir : std_logic_vector(ch_num - 1 downto 0);
signal set_pos_ie : std_logic;
signal enc_pulse : std_logic;
signal enc_pulse_ie : std_logic;
signal enc_pulse_pof : std_logic;
signal pd_pulse : std_logic;
signal pd_pulse_ie : std_logic;
signal pd_pulse_pof : std_logic;
signal inc_pos : std_logic;
signal inc_pos_pof : std_logic;
signal inc_pos_ie : std_logic;
signal dec_pos : std_logic;
signal dec_pos_pof : std_logic;
signal dec_pos_ie : std_logic;
signal abs_pos : std_logic_vector(31 downto 0);
signal abs_pos_pof : std_logic_vector(31 downto 0);
signal abs_pos_ie : std_logic_vector(39 downto 0);
--
signal ch_pd, ch_pulse_out : std_logic_vector(ch_num-1 downto 0);
signal ch_raw_pulse, ch_mask : std_logic_vector(ch_num-1 downto 0);
signal fire_pulse_i : std_logic_vector(ch_num-1 downto 0);
signal src_sel : std_logic_vector(1 downto 0);
signal ch_pd, ch_pulse_out : std_logic_vector(ch_num - 1 downto 0);
signal ch_raw_pulse, ch_mask : std_logic_vector(ch_num - 1 downto 0);
signal fire_pulse_i : std_logic_vector(ch_num - 1 downto 0);
signal src_sel : std_logic_vector(1 downto 0);
--
signal one_pps : std_logic;
signal ext_fp_det : std_logic_vector(15 downto 0);
signal ext_fp_gen : std_logic_vector(15 downto 0);
signal pof_rx_regen : std_logic;
signal one_pps : std_logic;
signal ext_fp_det : std_logic_vector(15 downto 0);
signal ext_fp_gen : std_logic_vector(15 downto 0);
signal pof_rx_regen : std_logic;
begin
@ -141,7 +141,7 @@ begin
-----------------------------------------------------------------------------
iSyncReset : entity work.sync_reset
port map (
port map(
async_rstN => reset_n,
clk => clk,
sync_rstN => reset_n_i);
@ -151,10 +151,10 @@ begin
-- C&S Register Interface Splitting
-----------------------------------------------------------------------------
iCS_BUS_ITF: entity work.cs_bus_ift_1
generic map (
iCS_BUS_ITF : entity work.cs_bus_ift_1
generic map(
blk_num => blk_num)
port map (
port map(
rstN => reset_n_i,
clk => clk,
avs_address => avs_address(14 downto 0),
@ -170,44 +170,44 @@ begin
cs_rv => cs_read_valid,
cs_rd_data => cs_read_data);
cs_ctrl_write_en <= cs_write_en(fp_ctrl_id);
cs_ctrl_write_en <= cs_write_en(fp_ctrl_id);
cs_pg_write_en_g : for i in 1 to ch_num generate
cs_pg_write_en(i-1) <= cs_write_en(pg_ch_id+i-1);
cs_pg_write_en(i - 1) <= cs_write_en(pg_ch_id + i - 1);
end generate;
cs_nsnk_write_en <= cs_write_en(net_snk_id);
cs_log_write_en <= cs_write_en(log_blk_id);
cs_ie_write_en <= cs_write_en(int_enc_id);
cs_nsnk_write_en <= cs_write_en(net_snk_id);
cs_log_write_en <= cs_write_en(log_blk_id);
cs_ie_write_en <= cs_write_en(int_enc_id);
cs_ctrl_read_en <= cs_read_en(fp_ctrl_id);
cs_ctrl_read_en <= cs_read_en(fp_ctrl_id);
cs_pg_read_en_g : for i in 1 to ch_num generate
cs_pg_read_en(i-1) <= cs_read_en(pg_ch_id+i-1);
end generate;
cs_nsnk_read_en <= cs_read_en(net_snk_id);
cs_log_read_en <= cs_read_en(log_blk_id);
cs_ie_read_en <= cs_read_en(int_enc_id);
cs_pg_read_en(i - 1) <= cs_read_en(pg_ch_id + i - 1);
end generate;
cs_nsnk_read_en <= cs_read_en(net_snk_id);
cs_log_read_en <= cs_read_en(log_blk_id);
cs_ie_read_en <= cs_read_en(int_enc_id);
cs_read_valid(fp_ctrl_id) <= cs_ctrl_read_valid;
cs_read_valid(fp_ctrl_id) <= cs_ctrl_read_valid;
cs_read_valid_pg_g : for i in 1 to ch_num generate
cs_read_valid(pg_ch_id+i-1) <= cs_pg_read_valid(i-1);
cs_read_valid(pg_ch_id + i - 1) <= cs_pg_read_valid(i - 1);
end generate;
cs_read_valid(net_snk_id) <= cs_nsnk_read_valid;
cs_read_valid(log_blk_id) <= cs_log_read_valid;
cs_read_valid(int_enc_id) <= cs_ie_read_valid;
cs_read_valid(net_snk_id) <= cs_nsnk_read_valid;
cs_read_valid(log_blk_id) <= cs_log_read_valid;
cs_read_valid(int_enc_id) <= cs_ie_read_valid;
cs_read_data(31+32*fp_ctrl_id downto 32*fp_ctrl_id) <= cs_ctrl_read_data;
cs_read_data(31 + 32 * fp_ctrl_id downto 32 * fp_ctrl_id) <= cs_ctrl_read_data;
cs_read_data_pg_g : for i in 1 to ch_num generate
cs_read_data(31+32*(pg_ch_id+i-1) downto 32*(pg_ch_id+i-1)) <= cs_pg_read_data(31+32*(i-1) downto 32*(i-1));
cs_read_data(31 + 32 * (pg_ch_id + i - 1) downto 32 * (pg_ch_id + i - 1)) <= cs_pg_read_data(31 + 32 * (i - 1) downto 32 * (i - 1));
end generate;
cs_read_data(31+32*net_snk_id downto 32*net_snk_id) <= cs_nsnk_read_data;
cs_read_data(31+32*log_blk_id downto 32*log_blk_id) <= cs_log_read_data;
cs_read_data(31+32*int_enc_id downto 32*int_enc_id) <= cs_ie_read_data;
cs_read_data(31 + 32 * net_snk_id downto 32 * net_snk_id) <= cs_nsnk_read_data;
cs_read_data(31 + 32 * log_blk_id downto 32 * log_blk_id) <= cs_log_read_data;
cs_read_data(31 + 32 * int_enc_id downto 32 * int_enc_id) <= cs_ie_read_data;
-----------------------------------------------------------------------------
-- Fire-Pulse-Manager Controller
-----------------------------------------------------------------------------
iCTRL: entity work.fire_pulse_ctrl_1
port map (
iCTRL : entity work.fire_pulse_ctrl_1
port map(
reset_n => reset_n_i,
clk => clk,
src_sel => src_sel,
@ -238,61 +238,65 @@ begin
avs_readdatavalid => cs_ctrl_read_valid,
avs_readdata => cs_ctrl_read_data);
ins_fpm_irq_1 <= '0';
ins_fpm_irq_2 <= '0';
ins_fpm_irq_3 <= '0';
-- Output multiplexer
fire_pulse_i <= ch_pulse_out when src_sel(0) = '1' else (others => pof_rx_regen);
fire_pulse <= fire_pulse_i;
pd_pulse <= pd_pulse_pof when src_sel(1) = '0' else pd_pulse_ie;
pd_pulse <= pd_pulse_pof when src_sel(1) = '0' else pd_pulse_ie;
enc_pulse <= enc_pulse_pof when src_sel(1) = '0' else enc_pulse_ie;
abs_pos <= abs_pos_pof when src_sel(1) = '0' else abs_pos_ie(31 downto 0);
inc_pos <= inc_pos_pof when src_sel(1) = '0' else inc_pos_ie;
dec_pos <= dec_pos_pof when src_sel(1) = '0' else dec_pos_ie;
mon_point_src( 0) <= remote_init;
mon_point_src( 1) <= dp_dir(0);
mon_point_src( 2) <= pd_pulse;
mon_point_src( 3) <= enc_pulse;
mon_point_src( 4) <= ch_pd(0);
mon_point_src( 5) <= ch_pulse_out(0);
mon_point_src( 6) <= ch_raw_pulse(0);
mon_point_src( 7) <= ch_mask(0);
mon_point_src( 8) <= pof_rx;
mon_point_src( 9) <= fire_pulse_i(0);
abs_pos <= abs_pos_pof when src_sel(1) = '0' else abs_pos_ie(31 downto 0);
inc_pos <= inc_pos_pof when src_sel(1) = '0' else inc_pos_ie;
dec_pos <= dec_pos_pof when src_sel(1) = '0' else dec_pos_ie;
mon_point_src(0) <= remote_init;
mon_point_src(1) <= dp_dir(0);
mon_point_src(2) <= pd_pulse;
mon_point_src(3) <= enc_pulse;
mon_point_src(4) <= ch_pd(0);
mon_point_src(5) <= ch_pulse_out(0);
mon_point_src(6) <= ch_raw_pulse(0);
mon_point_src(7) <= ch_mask(0);
mon_point_src(8) <= pof_rx;
mon_point_src(9) <= fire_pulse_i(0);
--
mon_point_src(15 downto 10) <= (others => '0');
pof_iso_en <= enable_rx;
pof_iso_en <= enable_rx;
-----------------------------------------------------------------------------
-- Pulse Generator
-----------------------------------------------------------------------------
pulse_generator_g : for i in 1 to ch_num generate
iCH_PG: entity work.pulse_generator_1
iCH_PG : entity work.pulse_generator_1
generic map(
PD_QUEUE_SIZE => PD_QUEUE_SIZE,
PULSE_DELAY_EQUAL_EN => false,
OUT_PULSE_CONDITION => true,
OVERDRIVE_CHECK => false,
DIAG_COUNTERS => DIAG_COUNTER_EN(i))
port map (
clk => clk,
reset_n => reset_n_i,
init => remote_init,
pd_in => pd_pulse,
abs_position => abs_pos,
dp_dir => dp_dir(i-1),
pulse_out => ch_pulse_out(i-1),
ch_pd => ch_pd(i-1),
ch_mask => ch_mask(i-1),
raw_pulse_out => ch_raw_pulse(i-1),
enc_pulse => open,
avs_address => cs_addr(9 downto 0),
avs_write => cs_pg_write_en(i-1),
avs_writedata => cs_write_data,
avs_read => cs_pg_read_en(i-1),
avs_readdatavalid => cs_pg_read_valid(i-1),
avs_readdata => cs_pg_read_data(31+32*(i-1) downto 32*(i-1)));
PD_QUEUE_SIZE => PD_QUEUE_SIZE,
PULSE_DELAY_EQUAL_EN => false,
OUT_PULSE_CONDITION => true,
OVERDRIVE_CHECK => false,
DIAG_COUNTERS => DIAG_COUNTER_EN(i))
port map(
clk => clk,
reset_n => reset_n_i,
init => remote_init,
pd_in => pd_pulse,
abs_position => abs_pos,
dp_dir => dp_dir(i - 1),
pulse_out => ch_pulse_out(i - 1),
ch_pd => ch_pd(i - 1),
ch_mask => ch_mask(i - 1),
raw_pulse_out => ch_raw_pulse(i - 1),
enc_pulse => open,
avs_address => cs_addr(9 downto 0),
avs_write => cs_pg_write_en(i - 1),
avs_writedata => cs_write_data,
avs_read => cs_pg_read_en(i - 1),
avs_readdatavalid => cs_pg_read_valid(i - 1),
avs_readdata => cs_pg_read_data(31 + 32 * (i - 1) downto 32 * (i - 1)));
end generate;
-----------------------------------------------------------------------------
-- POF Interface
@ -300,37 +304,37 @@ begin
-- POF Receiver
iPOF_RX : entity work.pof_rx_1
port map (
reset_n => reset_n_i,
clk => clk,
init => '0',
rx_clk => rx_clk,
rx_data => pof_rx,
init_out => remote_init,
dp_dir => dp_dir(0),
enc_out => enc_pulse_pof,
pd_out => pd_pulse_pof,
inc_pos => inc_pos_pof,
dec_pos => dec_pos_pof,
abs_pos => abs_pos_pof,
enable => enable_rx,
bit_div => bit_div,
error_rate_thres => error_rate_thres,
one_pps => one_pps,
upd_max_pos => upd_max_pos,
upd_min_pos => upd_min_pos,
max_error_flag => max_error_flag,
rx_watchdog => rx_watchdog,
rx_watchdog_en => rx_watchdog_en,
rx_watchdog_clr => rx_watchdog_clr,
parity_err_cnt => parity_err_cnt,
skip_pos_cnt => skip_pos_cnt);
port map(
reset_n => reset_n_i,
clk => clk,
init => '0',
rx_clk => rx_clk,
rx_data => pof_rx,
init_out => remote_init,
dp_dir => dp_dir(0),
enc_out => enc_pulse_pof,
pd_out => pd_pulse_pof,
inc_pos => inc_pos_pof,
dec_pos => dec_pos_pof,
abs_pos => abs_pos_pof,
enable => enable_rx,
bit_div => bit_div,
error_rate_thres => error_rate_thres,
one_pps => one_pps,
upd_max_pos => upd_max_pos,
upd_min_pos => upd_min_pos,
max_error_flag => max_error_flag,
rx_watchdog => rx_watchdog,
rx_watchdog_en => rx_watchdog_en,
rx_watchdog_clr => rx_watchdog_clr,
parity_err_cnt => parity_err_cnt,
skip_pos_cnt => skip_pos_cnt);
-- UART signal regeneration
iUART_REGEN : entity work.uart_regen_1
generic map (
generic map(
data_width => 8)
port map (
port map(
reset_n => reset_n,
clk => rx_clk,
bit_div => bit_div,
@ -344,25 +348,25 @@ begin
-----------------------------------------------------------------------------
fire_pulse_ext_i : entity work.fire_pulse_ext_1
port map (
reset_n => reset_n_i,
clk => clk,
port map(
reset_n => reset_n_i,
clk => clk,
ext_fp_det => ext_fp_det,
ext_fp_gen => ext_fp_gen,
ext_fp_det => ext_fp_det,
ext_fp_gen => ext_fp_gen,
ext_in => pof_rx,
ext_out => pof_rx_regen
);
ext_in => pof_rx,
ext_out => pof_rx_regen
);
-----------------------------------------------------------------------------
-- Internal encoder generator
-----------------------------------------------------------------------------
iEMUL: entity work.enc_pd_emul_1
generic map (
iEMUL : entity work.enc_pd_emul_1
generic map(
SEQ_ENABLE => false)
port map (
port map(
clk => clk,
reset_n => reset_n_i,
ttl_pd => open,
@ -385,7 +389,7 @@ begin
avs_readdata => cs_ie_read_data);
enc_pulse_ie <= inc_pos_ie when dp_dir(0) = '0' else dec_pos_ie;
-----------------------------------------------------------------------------
-- NetSync Sink
-----------------------------------------------------------------------------
@ -393,25 +397,25 @@ begin
-- Not instantiated yet
pNSNK_RD_VALID : process(clk)
begin
if(clk = '1' and clk'event) then
if (clk = '1' and clk'event) then
cs_nsnk_read_valid <= cs_nsnk_read_en;
end if;
end process pNSNK_RD_VALID;
cs_nsnk_read_data <= X"DEAD_BEEF";
cs_nsnk_read_data <= X"DEAD_BEEF";
-----------------------------------------------------------------------------
-- Event Logger
-----------------------------------------------------------------------------
-- Not instantiated yet
pLOG_RD_VALID : process(clk)
pLOG_RD_VALID : process(clk)
begin
if(clk = '1' and clk'event) then
if (clk = '1' and clk'event) then
cs_log_read_valid <= cs_log_read_en;
end if;
end process pLOG_RD_VALID;
cs_log_read_data <= X"DEAD_BEEF";
cs_log_read_data <= X"DEAD_BEEF";
end architecture rtl;

View file

@ -13,6 +13,7 @@
-- 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;
@ -20,32 +21,32 @@ use ieee.numeric_std.all;
entity pof_rx_1 is
port(
reset_n : in std_logic;
clk : in std_logic;
reset_n : in std_logic;
clk : in std_logic;
--
init : in std_logic;
rx_clk : in std_logic;
rx_data : in std_logic;
init_out : out std_logic;
dp_dir : in std_logic;
enc_out : out std_logic;
pd_out : out std_logic;
inc_pos : out std_logic;
dec_pos : out std_logic;
abs_pos : out std_logic_vector(31 downto 0);
init : in std_logic;
rx_clk : in std_logic;
rx_data : in std_logic;
init_out : out std_logic;
dp_dir : in std_logic;
enc_out : out std_logic;
pd_out : out std_logic;
inc_pos : out std_logic;
dec_pos : out std_logic;
abs_pos : out std_logic_vector(31 downto 0);
-- C&S
enable : in std_logic;
bit_div : in std_logic_vector( 3 downto 0);
error_rate_thres : in std_logic_vector( 7 downto 0);
one_pps : in std_logic;
upd_max_pos : in std_logic;
upd_min_pos : in std_logic;
max_error_flag : out std_logic;
rx_watchdog : out std_logic;
rx_watchdog_en : in std_logic;
rx_watchdog_clr : in std_logic;
parity_err_cnt : out std_logic_vector(15 downto 0);
skip_pos_cnt : out std_logic_vector(15 downto 0));
enable : in std_logic;
bit_div : in std_logic_vector(3 downto 0);
error_rate_thres : in std_logic_vector(7 downto 0);
one_pps : in std_logic;
upd_max_pos : in std_logic;
upd_min_pos : in std_logic;
max_error_flag : out std_logic;
rx_watchdog : out std_logic;
rx_watchdog_en : in std_logic;
rx_watchdog_clr : in std_logic;
parity_err_cnt : out std_logic_vector(15 downto 0);
skip_pos_cnt : out std_logic_vector(15 downto 0));
end entity pof_rx_1;
architecture rtl of pof_rx_1 is
@ -54,9 +55,9 @@ architecture rtl of pof_rx_1 is
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
for n in 0 to data'length - 1 loop
parity_bit := parity_bit xor data(n);
end loop; -- n
end loop; -- n
return parity_bit;
end function odd_parity_check;
@ -64,10 +65,10 @@ architecture rtl of pof_rx_1 is
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
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;
@ -82,30 +83,30 @@ architecture rtl of pof_rx_1 is
signal rx_symbol_val, clear_i, skip_pos_d, pos_recovery : std_logic;
signal dp_dir_d, dp_dir_change, max_error_flag_i : std_logic;
--
signal clk_cnt : std_logic_vector( 1 downto 0);
signal dist, abs_dist, skip_cnt : std_logic_vector( 3 downto 0);
signal next_pos_lsb, curr_pos_lsb : std_logic_vector( 3 downto 0);
signal pos_corr, max_dist, rx_error_v : std_logic_vector( 3 downto 0);
signal gray_pos, rx_symbol_val_v : std_logic_vector( 3 downto 0);
signal symbol, symbol_i, rx_symbol : std_logic_vector( 7 downto 0);
signal rx_wd_cnt : std_logic_vector( 9 downto 0);
signal parity_err_cnt_i, skip_pos_cnt_i : std_logic_vector(15 downto 0);
signal error_rate_cnt, error_rate : std_logic_vector(15 downto 0);
signal abs_pos_i, pos_max, pos_min : std_logic_vector(31 downto 0);
signal dist_pos, dist_neg : std_logic_vector(31 downto 0);
signal clk_cnt : std_logic_vector(1 downto 0);
signal dist, abs_dist, skip_cnt : std_logic_vector(3 downto 0);
signal next_pos_lsb, curr_pos_lsb : std_logic_vector(3 downto 0);
signal pos_corr, max_dist, rx_error_v : std_logic_vector(3 downto 0);
signal gray_pos, rx_symbol_val_v : std_logic_vector(3 downto 0);
signal symbol, symbol_i, rx_symbol : std_logic_vector(7 downto 0);
signal rx_wd_cnt : std_logic_vector(9 downto 0);
signal parity_err_cnt_i, skip_pos_cnt_i : std_logic_vector(15 downto 0);
signal error_rate_cnt, error_rate : std_logic_vector(15 downto 0);
signal abs_pos_i, pos_max, pos_min : std_logic_vector(31 downto 0);
signal dist_pos, dist_neg : std_logic_vector(31 downto 0);
begin
clear <= not enable or init;
-----------------------------------------------------------------------------
-- De-serialize symbols (Serial clock at 200 MHz)
-- De-serialize symbols (Serial clock at 300 MHz - typical)
-----------------------------------------------------------------------------
iRX_SYMBOL : entity work.uart_rx_1
generic map (
generic map(
data_width => 8)
port map (
port map(
reset_n => reset_n,
clk => rx_clk,
bit_div => bit_div,
@ -118,16 +119,16 @@ begin
-- 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
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
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
if (rx_error = '1') then
rx_error_v <= "1111";
else
rx_error_v <= '0' & rx_error_v(3 downto 1);
@ -136,17 +137,17 @@ begin
end process pLATCH_RX_DATA;
iSYNC_SYMBOL_VAL : entity work.sync_wire_rEdge_1
generic map (rst_val => '0', sync_stages => 3)
port map (rstN => reset_n, clk => clk, async_in => rx_symbol_val_v(0), sync_out => symbol_valid);
generic map(rst_val => '0', sync_stages => 3)
port map(rstN => reset_n, clk => clk, async_in => rx_symbol_val_v(0), sync_out => symbol_valid);
iSYNC_RX_ERROR : entity work.sync_wire_rEdge_1
generic map (rst_val => '0', sync_stages => 3)
port map (rstN => reset_n, clk => clk, async_in => rx_error_v(0), sync_out => rx_error_i);
generic map(rst_val => '0', sync_stages => 3)
port map(rstN => reset_n, clk => clk, async_in => rx_error_v(0), sync_out => rx_error_i);
-- synchronize clear to tx_clk
iSYNC_CLEAR: entity work.sync_wire_1
generic map (rst_val => '1', sync_stages => 2)
port map (
rstN => reset_n, clk => rx_clk, async_in => clear, sync_out => clear_i);
iSYNC_CLEAR : entity work.sync_wire_1
generic map(rst_val => '1', sync_stages => 2)
port map(
rstN => reset_n, clk => rx_clk, async_in => clear, sync_out => clear_i);
-----------------------------------------------------------------------------
-- Toggle-Bits Decoding
@ -154,38 +155,38 @@ begin
pTOGGLE_DEC : process(clk)
begin
if(clk = '1' and clk'event) then
if (clk = '1' and clk'event) then
-- Toggle Bits
if(clear = '1') then
if (clear = '1') then
toggle_sync <= '0';
elsif(sync_confirmed = '1') then
toggle_sync <= not toggle_sync;
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
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
elsif (sync_gen = '1') then
sync_toggle_test <= '1';
end if;
sync <= sync_confirmed;
sync_d <= sync;
if(clear = '1') then
sync <= sync_confirmed;
sync_d <= sync;
if (clear = '1') then
toggle_pd <= '0';
elsif(pd_confirmed = '1') then
toggle_pd <= not toggle_pd;
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
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
elsif (pd_gen = '1') then
pd_toggle_test <= '1';
end if;
pd <= pd_confirmed;
pd <= pd_confirmed;
--
symbol_valid_i <= symbol_valid and symbol_ok;
symbol_error <= symbol_valid and not symbol_ok;
if(clear = '1') then
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);
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;
@ -196,14 +197,14 @@ begin
-- 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_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;
pd_confirmed <= pd_gen and pd_toggle_test;
--
init_out <= sync;
pd_out <= pd;
init_out <= sync;
pd_out <= pd;
parity_err_cnt <= parity_err_cnt_i;
@ -216,63 +217,63 @@ begin
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);
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));
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
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
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
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);
elsif (apply_corr = '1') then
pos_corr <= std_logic_vector(unsigned(pos_corr) - 1);
end if;
if(clear = '1' or corr_done = '1') then
if (clear = '1' or corr_done = '1') then
upd_pos <= '0';
elsif(symbol_valid_d = '1' and valid_pos = '1') then
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
if (upd_pos = '0' or unsigned(clk_cnt) = 2) then
clk_cnt <= (others => '0');
else
clk_cnt <= std_logic_vector(unsigned(clk_cnt)+1);
clk_cnt <= std_logic_vector(unsigned(clk_cnt) + 1);
end if;
if(symbol_valid_d = '1' and valid_pos = '1') then
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
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);
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
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);
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
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);
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';
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';
@ -291,26 +292,26 @@ begin
pERROR_REPORTING : process(clk)
begin
if(clk = '1' and clk'event) then
if(clear = '1' or one_pps = '1') then
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);
elsif (symbol_error = '1') then
error_rate_cnt <= std_logic_vector(unsigned(error_rate_cnt) + 1);
end if;
if(clear = '1') then
if (clear = '1') then
error_rate <= (others => '0');
elsif(one_pps = '1') then
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
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);
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
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
elsif (unsigned(rx_wd_cnt) > 1000) then
rx_watchdog <= '1';
end if;
end if;
@ -334,24 +335,24 @@ begin
pENC_MNG : process(clk)
begin
if(clk = '1' and clk'event) then
if (clk = '1' and clk'event) then
dp_dir_d <= dp_dir;
if(sync_d = '1' or dp_dir_change = '1' or new_max = '1' or upd_max_pos = '1') then
if (sync_d = '1' or dp_dir_change = '1' or new_max = '1' or upd_max_pos = '1') then
pos_max <= abs_pos_i;
end if;
if(sync_d = '1' or dp_dir_change = '1' or new_min = '1' or upd_min_pos = '1') then
if (sync_d = '1' or dp_dir_change = '1' or new_min = '1' or upd_min_pos = '1') then
pos_min <= abs_pos_i;
end if;
enc_out <= new_min or new_max;
enc_out <= new_min or new_max;
end if;
end process pENC_MNG;
dp_dir_change <= dp_dir xor dp_dir_d;
dist_pos <= std_logic_vector(signed(abs_pos_i)-signed(pos_max));
dist_neg <= std_logic_vector(signed(pos_min)-signed(abs_pos_i));
dist_pos <= std_logic_vector(signed(abs_pos_i) - signed(pos_max));
dist_neg <= std_logic_vector(signed(pos_min) - signed(abs_pos_i));
new_max <= '1' when inc_pos_i = '1' and dp_dir = '0' and dist_pos(31) = '0' and unsigned(dist_pos(3 downto 0)) /= 0 else '0';
new_min <= '1' when dec_pos_i = '1' and dp_dir = '1' and dist_neg(31) = '0' and unsigned(dist_neg(3 downto 0)) /= 0 else '0';
end architecture rtl;

View file

@ -15,6 +15,7 @@
-- Date Version Author Description
-- 2010-10-25 1.0 gmg Created
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;

View file

@ -15,6 +15,7 @@
-- Date Version Author Description
-- 2010-12-03 1.0 gmg Created
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;

View file

@ -48,9 +48,9 @@ architecture behav of fire_pulse_manager_1_tb is
constant CLK_FREQ : real := 100.0e6;
constant TX_CLK_PERIOD : time := CLK_PERIOD; -- nominally the same as clk_period
constant RX_CLK_PERIOD : time := 5.0 ns; -- clock period for used by the
-- UART-Rx on the POF
-- TODO Try different receive oversampling ratios - 300MHz is in the real system
constant RX_CLK_PERIOD : time := CLK_PERIOD / 3; -- clock period for used by the
-- UART-Rx on the POF
constant POF_DELAY : time := 30 ns; -- Total delay from POF-Tx input to POF-Rx output
@ -474,10 +474,14 @@ begin -- behav
for i in 0 to CH_NUM - 1 loop
log("Channel CH" & integer'image(i) & " PDin counter value : " & integer'image(pd_cnt(i)) & " ... ", VLOW, true);
log("Channel CH" & integer'image(i) & " FPout counter value : " & integer'image(fp_cnt(i)) & " ... ", VLOW, true);
if (pd_cnt(i) /= (NUM_ITERATIONS) * 2) then
if (i = 0 and (pd_cnt(i) /= (NUM_ITERATIONS) * 2)) or
(i /= 0 and pd_cnt(i) /= 0) then -- fire_pulse_manager now has no registers beyond channel 0
log("Channel CH" & integer'image(i) & " PD_cnt counter value Incorrect: ", VLOW, true);
detected_error <= true;
end if;
if (fp_cnt(i) /= (NUM_ITERATIONS) * 2 * 100) then
if (i = 0 and (fp_cnt(i) /= (NUM_ITERATIONS) * 2 * 100)) or
(i /= 0 and fp_cnt(i) /= 0) then
log("Channel CH" & integer'image(i) & " FP_cnt counter value Incorrect: ", VLOW, true);
detected_error <= true;
end if;
end loop;
@ -546,8 +550,8 @@ begin -- behav
-- Config fire_pulse_manager control registers:
-- Enable the POF-Rx
addr := std_logic_vector(to_unsigned(3, 32));
data := X"0000_8041";
-- Write the data to the register
data := X"0000_8061"; -- set bit_div to 6 to match the 50MBd TX signal to the 300MHz RX_CLK
-- Write the data to the register
mm_32b_write(addr, data, avs_s, avs_m);
-- Select pulse generator
addr := std_logic_vector(to_unsigned(2, 32));

View file

@ -0,0 +1,623 @@
-------------------------------------------------------------------------------
-- Title : pof_tx_rx_tb
-- Project : HMB daisy-chaining
-------------------------------------------------------------------------------
-- File : pof_tx_rx_tb.vhd
-- Author : GMG
-- Company : Global Inkjet Systems
-- Created : 2017-08-29
-- Last update: 2018-07-03
-- 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_1_tb is
-- ..
end entity pof_tx_rx_1_tb;
architecture behav of pof_tx_rx_1_tb is
constant CLK_PERIOD : time := 10 ns; -- 100MHz
constant RX_CLK_PERIOD : time := 3.333 ns; -- 300MHz
constant NUM_ITERATIONS : natural := 10;
constant SWATHE_LEN : integer := 1000;
constant START_DIR : std_logic := '0';
constant INJECT_ERROR_PERC : natural := 4; -- percentage of injected errors
constant DISCR_THRES : natural := 1000;
constant TIME_INT : time := 800 ns;
constant UART_BIT_DIV : std_logic_vector(3 downto 0) := "0110"; -- divide by 6
-- Logging Verbosity Level
constant VERBOSITY_LEVEL : verb_level_t := VMEDIUM;
signal clk, rx_clk, rx_clk_i, reset_n : std_logic := '0';
signal avs_read, avs_write, sel_slave_0, sel_slave_1 : std_logic;
signal avs_write_sl0, avs_read_sl0, avs_readdatavalid_sl0 : std_logic;
signal avs_write_sl1, avs_read_sl1, avs_readdatavalid_sl1 : std_logic;
signal init_tx, init_rx, dir_in, pd_in, inc_pos, dec_pos : std_logic;
signal tx_data, rx_data, init_out, dir_out, enc_out : std_logic;
signal pd_out, inc_pos_out, dec_pos_out, end_of_swathe : std_logic;
--
signal test_completed, running, configuring : boolean;
signal passed, failed, stimuli_completed : boolean;
signal detected_error : boolean := false;
--
signal avs_address : std_logic_vector(2 downto 0);
signal avs_writedata : std_logic_vector(31 downto 0);
signal avs_readdata_sl0, avs_readdata_sl1 : std_logic_vector(31 downto 0);
signal abs_position, abs_position_d : std_logic_vector(31 downto 0);
signal abs_pos_out : std_logic_vector(31 downto 0);
--
signal swathe_cnt, swathe_pos : integer;
signal dir_discr_cnt, pd_discr_cnt : integer;
signal pos_discr_cnt : integer;
signal pd_in_cnt, pd_out_cnt : integer;
signal enc_pulse_cnt : integer;
signal dir_err, pd_err, ovfl_err : std_logic;
signal pos_err, enc_err, dir_in_d : std_logic;
signal injected_errors : integer;
signal max_pos, min_pos : integer;
signal max_pos_d, min_pos_d : integer;
signal exp_enc_cnt : integer;
signal exp_enc_pulse, enc_discr : std_logic;
signal enc_out_d : std_logic;
signal error_rate_thres : std_logic_vector(7 downto 0);
signal one_pps : std_logic;
signal max_error_flag : std_logic;
signal rx_watchdog : std_logic;
signal rx_watchdog_en : std_logic;
signal rx_watchdog_clr : std_logic;
--
signal enable_rx : std_logic;
signal parity_err_cnt : std_logic_vector(15 downto 0);
signal skip_pos_cnt : std_logic_vector(15 downto 0);
--
signal avs_m : mm_m_rec_t;
signal avs_s : mm_s_rec_t;
begin -- architecture behav
clk <= not clk after 0.5 * CLK_PERIOD;
rx_clk_i <= not rx_clk_i after 0.5 * RX_CLK_PERIOD;
rx_clk <= rx_clk_i after 1 ns;
-----------------------------------------------------------------------------
-- UUTs
-----------------------------------------------------------------------------
iPOF_TX : entity work.pof_tx_1
port map(
reset_n => reset_n,
clk => clk,
init => init_tx,
pd_in => pd_in,
inc_pos => inc_pos,
dec_pos => dec_pos,
abs_position => abs_position,
tx_data => tx_data,
avs_address => avs_address,
avs_write => avs_write_sl0,
avs_writedata => avs_writedata,
avs_read => avs_read_sl0,
avs_readdatavalid => avs_readdatavalid_sl0,
avs_readdata => avs_readdata_sl0);
iPOF_RX : entity work.pof_rx_1
port map(
reset_n => reset_n,
clk => clk,
init => init_rx,
rx_clk => rx_clk,
rx_data => rx_data,
init_out => init_out,
dp_dir => dir_in,
enc_out => enc_out,
pd_out => pd_out,
inc_pos => inc_pos_out,
dec_pos => dec_pos_out,
abs_pos => abs_pos_out,
enable => enable_rx,
bit_div => UART_BIT_DIV,
error_rate_thres => error_rate_thres,
one_pps => one_pps,
upd_max_pos => '0',
upd_min_pos => '0',
max_error_flag => max_error_flag,
rx_watchdog => rx_watchdog,
rx_watchdog_en => rx_watchdog_en,
rx_watchdog_clr => rx_watchdog_clr,
parity_err_cnt => parity_err_cnt,
skip_pos_cnt => skip_pos_cnt);
--rx_data <= tx_data after 40 ns;
rx_data <= transport tx_data after 40 ns;
-----------------------------------------------------------------------------
-- UUT configuration and control
-----------------------------------------------------------------------------
clk_clk <= clk;
reset_reset_n <= reset_n;
avs_s.mm_readdata <= avs_readdata_sl0 when sel_slave_0 = '1' else
avs_readdata_sl1 when sel_slave_1 = '1' else (others => '0');
avs_readdata_sl1 <= (others => '0');
avs_s.mm_readdatavalid <= avs_readdatavalid_sl0 when sel_slave_0 = '1' else
avs_readdatavalid_sl1 when sel_slave_1 = '1' else '0';
avs_readdatavalid_sl1 <= '0';
avs_s.mm_waitrequest <= '0';
avs_s.use_readvalid <= true;
avs_address <= avs_m.mm_address(avs_address'range);
avs_write <= avs_m.mm_write;
avs_writedata <= avs_m.mm_writedata;
avs_read <= avs_m.mm_read;
--
avs_write_sl0 <= avs_write and sel_slave_0;
--avs_write_sl1 <= avs_write and sel_slave_1;
avs_write_sl1 <= '0';
--
avs_read_sl0 <= avs_read and sel_slave_0;
--avs_read_sl1 <= avs_read and sel_slave_1;
avs_read_sl1 <= '0';
-- 1-PPS generation: make it faster than 1-PPS for simulation reasons
pEMULATE_1PPS : process
begin
one_pps <= '0';
for n in 1 to 99999 loop
wait until clk = '1' and clk'event;
end loop; -- 1 to 9999
one_pps <= '1';
wait until clk = '1' and clk'event;
end process pEMULATE_1PPS;
pUUT_CTRL : process
variable addr : std_logic_vector(31 downto 0) := (others => '0');
variable data : std_logic_vector(31 downto 0) := (others => '0');
variable init_done : boolean := false;
variable fifo_level : integer;
begin
enable_rx <= '0';
--
rx_watchdog_en <= '0';
rx_watchdog_clr <= '0';
error_rate_thres <= X"0A";
sel_slave_0 <= '0';
sel_slave_1 <= '0';
configuring <= true;
-- initilialize the Avalon master-bus
mm_m_init(avs_m);
if (reset_n = '0') then
wait until reset_n = '1';
wait for 100 ns;
wait until clk = '1' and clk'event;
end if;
log("Configuring EMB2POFTX ... ", VLOW, true);
sel_slave_0 <= '1';
-- Config netfork_rx control registers:
-- disable the block
addr := std_logic_vector(to_unsigned(0, 32));
data := X"0000_0021";
mm_32b_write(addr, data, avs_s, avs_m);
sel_slave_0 <= '0';
sel_slave_1 <= '1';
wait until clk = '1' and clk'event;
log("Configuring POFRX2HMB ... ", VLOW, true);
-- Config netfork_rx control registers:
-- disable the block
addr := std_logic_vector(to_unsigned(0, 32));
data := X"0000_0001";
--mm_32b_write(addr, data, avs_s, avs_m);
enable_rx <= '1';
rx_watchdog_en <= '1';
log("Configuration completed.", VLOW, true);
configuring <= false;
wait;
end process pUUT_CTRL;
-----------------------------------------------------------------------------
-- Stimuli Generation
-----------------------------------------------------------------------------
pSTIMULI_REGs : process(clk)
begin
if (clk = '1' and clk'event) then
abs_position_d <= abs_position;
end if;
end process pSTIMULI_REGs;
inc_pos <= '1' when signed(abs_position) = signed(abs_position_d) + 1 else '0';
dec_pos <= '1' when signed(abs_position) = signed(abs_position_d) - 1 else '0';
pSTIMULI : process
variable rv : RandomPType;
variable tmp_int : integer;
variable rand_time : time;
variable end_of_stimuli : boolean;
variable pd_dist : integer;
begin
-- initialization
init_rx <= '0';
--
init_tx <= '0';
dir_in <= START_DIR;
pd_in <= '0';
abs_position <= (others => '0');
swathe_pos <= 0;
pd_dist := 0;
--
swathe_cnt <= 0;
stimuli_completed <= false;
end_of_swathe <= '0';
-- generating the stimulus
wait until running = true;
wait for 200 ns;
-- Send a Init/Sync pulse
wait until clk = '1' and clk'event;
init_tx <= '1';
wait until clk = '1' and clk'event;
init_tx <= '0';
wait for 500 ns;
-- Send a second init pulse and verify that it is ignored (because too
-- close to the previous)
wait until clk = '1' and clk'event;
init_tx <= '1';
wait until clk = '1' and clk'event;
init_tx <= '0';
wait for 2500 ns;
-- Send a third pulse (after a bigger interval from the previous).
-- Verify that this time the pulse is accepted
wait until clk = '1' and clk'event;
init_tx <= '1';
wait until clk = '1' and clk'event;
init_tx <= '0';
wait for 500 ns;
wait until clk = '1' and clk'event;
--
-- generate the forward swathe
end_of_stimuli := false;
while end_of_stimuli = false loop
swathe_pos <= 0;
wait until clk = '1' and clk'event;
while swathe_pos /= SWATHE_LEN loop
-- generate a position increment
tmp_int := rv.RandInt(1, 100);
--tmp_int := 100;
if (tmp_int < 20) then
-- generate a position increment opposite to the swathe direction
swathe_pos <= swathe_pos - 1;
if (dir_in = '0') then
abs_position <= std_logic_vector(signed(abs_position) - 1);
else
abs_position <= std_logic_vector(signed(abs_position) + 1);
end if;
else
swathe_pos <= swathe_pos + 1;
if (dir_in = '0') then
abs_position <= std_logic_vector(signed(abs_position) + 1);
else
abs_position <= std_logic_vector(signed(abs_position) - 1);
end if;
end if;
--
tmp_int := rv.RandInt(1, 100);
if (tmp_int <= 5 and pd_dist >= 10) then
pd_dist := 0;
-- generate a PD increment: the PD might be either concurren or not
-- to the position increment
tmp_int := rv.RandInt(1, 3);
case tmp_int is
when 2 =>
-- wait less than the transmission time
wait for 90 ns;
wait until clk = '1' and clk'event;
when 3 =>
-- wait more than the transmission time
wait for 290 ns;
wait until clk = '1' and clk'event;
when others => null;
end case;
pd_in <= '1';
wait until clk = '1' and clk'event;
pd_in <= '0';
end if;
pd_dist := pd_dist + 1;
rand_time := rv.RandInt(-25, 25) * (10 ns);
wait for TIME_INT + rand_time;
end loop; -- swathe_pos /= SWATHE_LEN
wait for 25 us;
end_of_swathe <= '1';
wait until clk = '1' and clk'event;
end_of_swathe <= '0';
-- reverse direction
if (dir_in /= START_DIR) then
if (swathe_cnt = NUM_ITERATIONS) then
end_of_stimuli := true;
else
swathe_cnt <= swathe_cnt + 1;
end if;
end if;
if (end_of_stimuli = false) then
wait until clk = '1' and clk'event;
dir_in <= not dir_in;
-- Wait some time to make sure the change of direction is transmitted.
-- Note: if the position starts changing before the receiver was able to
-- confirm the change of direction, then some encoder pulses may not be
-- generated
wait for 1 us;
wait until clk = '1' and clk'event;
end if;
end loop; -- end_of_stimuli = false
stimuli_completed <= true;
wait;
end process pSTIMULI;
-----------------------------------------------------------------------------
-- Error injection
-----------------------------------------------------------------------------
-- Randomly change the payload of the data transmitted over the UART.
-- Insert 1, 2 or 3 errors per data word
-- Note: an error on the start bit of the UART will can cause more than 3
-- errors per data word, therefore this error injection method does not cover
-- all the possible cases
pERROR_INJECTION : process
--
alias symbol_valid is <<signal iPOF_TX.symbol_valid : std_logic>>;
alias symbol is <<signal iPOF_TX.symbol : std_logic_vector>>;
--
variable rv : RandomPType;
variable flip_vect : std_logic_vector(7 downto 0);
variable last_flip : std_logic_vector(7 downto 0);
variable bit_flips : integer range 0 to 3;
variable b0, b1, b2 : integer range 0 to 9;
variable exclude_1 : integer_vector(0 downto 0);
variable exclude_2 : integer_vector(1 downto 0);
variable test : std_logic_vector(5 downto 0);
begin
injected_errors <= 0;
if (running /= true) then
wait until running = true;
end if;
while running loop
wait until symbol_valid = '1' and symbol_valid'event;
if (rv.RandInt(1, 100) < INJECT_ERROR_PERC) then
-- Inject an error:
-- Number of bits to flip in the tx word
bit_flips := rv.RandInt(1, 3);
--bit_flips := 2;
b0 := rv.RandInt(0, 7);
exclude_1(0) := b0;
b1 := rv.RandInt(min => 0, max => 7, exclude => exclude_1);
exclude_2 := (0 => b0, 1 => b1);
b2 := rv.RandInt(min => 0, max => 7, exclude => exclude_2);
flip_vect := (others => '0');
flip_vect(b0) := '1';
if (bit_flips >= 2) then
flip_vect(b1) := '1';
end if;
if (bit_flips = 3) then
flip_vect(b2) := '1';
end if;
-- Prevent situations with two consecutive bit flips on bit 0,1 and 2
if ((flip_vect(0) = '1' and last_flip(0) = '1') or (flip_vect(1) = '1' and last_flip(1) = '1') or (flip_vect(2) = '1' and last_flip(2) = '1')) then
flip_vect := (others => '0');
end if;
log("bit-flip = " & to_string(bit_flips) & ", flip_vect = " & to_string(flip_vect) & ".", VLOW);
symbol <= force symbol xor flip_vect;
injected_errors <= injected_errors + 1;
wait until clk = '1' and clk'event;
wait until clk = '1' and clk'event;
symbol <= release;
last_flip := flip_vect;
else
last_flip := (others => '0');
end if;
end loop;
end process pERROR_INJECTION;
-----------------------------------------------------------------------------
-- Output Checking
-----------------------------------------------------------------------------
-- No more check on dir_out!!!
dir_out <= dir_in;
pEVENT_MONITOR : process(clk)
begin
if (clk = '1' and clk'event) then
if (reset_n = '0' or init_tx = '1' or running = false or dir_in = dir_out) then
dir_discr_cnt <= 0;
elsif (dir_in /= dir_out) then
dir_discr_cnt <= dir_discr_cnt + 1;
end if;
if (reset_n = '0' or init_tx = '1' or running = false) then
dir_err <= '0';
elsif (dir_discr_cnt > DISCR_THRES) then
dir_err <= '1';
end if;
if (reset_n = '0' or init_tx = '1' or running = false) then
pd_in_cnt <= 0;
elsif (pd_in = '1') then
pd_in_cnt <= pd_in_cnt + 1;
end if;
if (reset_n = '0' or init_tx = '1' or running = false) then
pd_out_cnt <= 0;
elsif (pd_out = '1') then
pd_out_cnt <= pd_out_cnt + 1;
end if;
if (reset_n = '0' or init_tx = '1' or running = false or pd_in_cnt = pd_out_cnt) then
pd_discr_cnt <= 0;
elsif (pd_in_cnt /= pd_out_cnt) then
pd_discr_cnt <= pd_discr_cnt + 1;
end if;
if (reset_n = '0' or init_tx = '1' or running = false) then
pd_err <= '0';
elsif (pd_discr_cnt > DISCR_THRES) then
pd_err <= '1';
end if;
if (reset_n = '0' or init_tx = '1' or running = false or signed(abs_position) = signed(abs_pos_out)) then
pos_discr_cnt <= 0;
elsif (signed(abs_position) /= signed(abs_pos_out)) then
pos_discr_cnt <= pos_discr_cnt + 1;
end if;
if (reset_n = '0' or init_tx = '1' or running = false) then
pos_err <= '0';
elsif (pos_discr_cnt > DISCR_THRES) then
pos_err <= '1';
end if;
dir_in_d <= dir_in;
if (reset_n = '0' or init_tx = '1' or running = false or dir_in /= dir_in_d) then
enc_pulse_cnt <= 0;
elsif (enc_out = '1') then
enc_pulse_cnt <= enc_pulse_cnt + 1;
end if;
if (reset_n = '0' or init_tx = '1' or running = false) then
enc_err <= '0';
elsif (end_of_swathe = '1' and enc_pulse_cnt /= SWATHE_LEN) then
enc_err <= '1';
end if;
max_pos_d <= max_pos;
min_pos_d <= min_pos;
if ((dir_in = '0' and max_pos /= max_pos_d) or (dir_in = '1' and min_pos /= min_pos_d)) then
exp_enc_pulse <= '1';
else
exp_enc_pulse <= '0';
end if;
enc_out_d <= enc_out;
end if;
end process pEVENT_MONITOR;
enc_discr <= enc_out_d xor exp_enc_pulse;
pMIN_MAX_POS : process(reset_n, end_of_swathe, abs_pos_out)
begin
if (reset_n = '0' or end_of_swathe = '1') then
max_pos <= -SWATHE_LEN;
elsif (signed(abs_pos_out) > max_pos) then
max_pos <= to_integer(signed(abs_pos_out));
end if;
if (reset_n = '0' or end_of_swathe = '1') then
min_pos <= SWATHE_LEN;
elsif (signed(abs_pos_out) < min_pos) then
min_pos <= to_integer(signed(abs_pos_out));
end if;
end process pMIN_MAX_POS;
exp_enc_cnt <= max_pos - min_pos;
ovfl_err <= <<signal iPOF_TX.ovfl_err : std_logic>>;
pERR_DETECT : process(reset_n, clk)
begin
if (reset_n = '0') then
detected_error <= false;
elsif (clk = '1' and clk'event) then
--if(ovfl_err = '1' or dir_err = '1' or pd_err = '1' or pos_err = '1' or enc_err = '1') then
if (ovfl_err = '1' or dir_err = '1' or pd_err = '1' or pos_err = '1') then
detected_error <= true;
end if;
end if;
end process pERR_DETECT;
-----------------------------------------------------------------------------
-- Testbench Control
-----------------------------------------------------------------------------
pTB_CTRL : process
begin
-- Set the verbosity level for logging
set_log_verbosity(VERBOSITY_LEVEL);
set_log_verbosity(VHIGH);
log_header("POF Transfer Tx/Rx verification:", VLOW);
test_completed <= false;
running <= false;
passed <= false;
failed <= false;
-- Reset
reset_n <= '0';
wait for 100 ns;
wait until clk = '1' and clk'event;
reset_n <= '1';
if (configuring /= true) then
wait until configuring = true;
end if;
wait until configuring = false;
running <= true;
wait until stimuli_completed = true or detected_error = true;
if (stimuli_completed = true) then
-- wait enough time to make sure that a max length package can be propagated
wait for 20 us;
end if;
if (detected_error = true) then
failed <= true;
log("FAILURE: test completed with errors.", VLOW);
else
passed <= true;
log("SUCCESS: test successfully completed.", VLOW);
end if;
log_separator_line(VLOW);
test_completed <= true;
running <= false;
wait;
end process pTB_CTRL;
end architecture behav;

View file

@ -13,6 +13,7 @@
-- Description:
-- Regenerate the UART signal
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;
@ -22,50 +23,39 @@ entity uart_regen_1 is
generic(
data_width : natural range 1 to 31);
port(
reset_n : in std_logic;
clk : in std_logic;
bit_div : in std_logic_vector(3 downto 0); -- number of clock cycles per tx bit
enable : in std_logic;
bypass_en : in std_logic;
uart_rx : in std_logic;
uart_tx : out std_logic);
reset_n : in std_logic;
clk : in std_logic;
bit_div : in std_logic_vector(3 downto 0); -- number of clock cycles per tx bit
enable : in std_logic;
bypass_en : in std_logic;
uart_rx : in std_logic;
uart_tx : out std_logic);
end entity uart_regen_1;
architecture rtl of uart_regen_1 is
component sync_wire_1
generic (
rst_val : std_logic;
sync_stages : positive);
port (
rstN : in std_logic;
clk : in std_logic;
async_in : in std_logic;
sync_out : out std_logic);
end component;
type fsm_state_t is (s_init, s_idle, s_regen);
signal fsm_state_curr, fsm_state_next : fsm_state_t;
signal fsm_state_curr, fsm_state_next : fsm_state_t;
--
signal uart_rx_i, ld_data, rst_bit_cnt, inc_bit_cnt : std_logic;
signal rst_clk_cnt, end_of_bit, end_of_rx : std_logic;
signal uart_regen, uart_regen_i : std_logic;
signal uart_rx_i, ld_data, rst_bit_cnt, inc_bit_cnt : std_logic;
signal rst_clk_cnt, end_of_bit, end_of_rx : std_logic;
signal uart_regen, uart_regen_i : std_logic;
--
signal clk_cnt : std_logic_vector(3 downto 0);
signal bit_cnt : std_logic_vector(5 downto 0);
signal clk_cnt : std_logic_vector(3 downto 0);
signal bit_cnt : std_logic_vector(5 downto 0);
begin
-----------------------------------------------------------------------------
-- Input Synchronization
-----------------------------------------------------------------------------
iSYNC_IN : sync_wire_1
generic map (
iSYNC_IN : entity work.sync_wire_1
generic map(
rst_val => '1',
sync_stages => 3)
port map (
port map(
rstN => reset_n,
clk => clk,
async_in => uart_rx,
@ -80,32 +70,37 @@ begin
pREGs : process(clk)
begin
if(clk ='1' and clk'event) then
if(rst_bit_cnt = '1') then
if (clk = '1' and clk'event) then
if (rst_bit_cnt = '1') then
bit_cnt <= (others => '0');
elsif(inc_bit_cnt = '1') then
bit_cnt <= std_logic_vector(unsigned(bit_cnt)+1);
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');
ld_data <= '0';
if clk_cnt = ('0' & std_logic_vector(unsigned(bit_div(bit_div'high downto 1)) + 1)) then
ld_data <= '1';
end if;
if (rst_clk_cnt = '1' or end_of_bit = '1') then
clk_cnt <= std_logic_vector(unsigned(bit_div) - 1);
else
clk_cnt <= std_logic_vector(unsigned(clk_cnt)+1);
clk_cnt <= std_logic_vector(unsigned(clk_cnt) - 1);
end if;
if(enable = '0') then
if (enable = '0') then
uart_regen_i <= '1';
elsif(ld_data = '1') then
elsif (ld_data = '1') then
uart_regen_i <= uart_rx_i;
end if;
uart_regen <= uart_regen_i;
end if;
end process pREGs;
end_of_bit <= '1' when unsigned(clk_cnt) = (unsigned(bit_div)-1) else '0';
end_of_rx <= '1' when unsigned(bit_cnt) = data_width+1 else '0';
end_of_bit <= '1' when unsigned(clk_cnt) = 0 else '0';
end_of_rx <= '1' when unsigned(bit_cnt) = data_width + 1 else '0';
-- output mux
uart_tx <= uart_rx when bypass_en = '1' else uart_regen;
-----------------------------------------------------------------------------
-- FSM
-----------------------------------------------------------------------------
@ -113,15 +108,15 @@ begin
-- FSM state register
pFSM_SR : process(clk)
begin
if(clk = '1' and clk'event) then
if(enable = '0' or bypass_en = '1') then
if (clk = '1' and clk'event) then
if (enable = '0' or bypass_en = '1') then
fsm_state_curr <= s_init;
else
fsm_state_curr <= fsm_state_next;
end if;
end if;
end process pFSM_SR;
-- FSM Combinational Logic
pFSM_CL : process(fsm_state_curr, uart_rx_i, end_of_bit, end_of_rx, clk_cnt, bit_div)
begin
@ -129,31 +124,28 @@ begin
rst_clk_cnt <= '0';
rst_bit_cnt <= '0';
inc_bit_cnt <= '0';
ld_data <= '0';
--
fsm_state_next <= fsm_state_curr;
case fsm_state_curr is
when s_init =>
if(uart_rx_i = '1') then
if (uart_rx_i = '1') then
fsm_state_next <= s_idle;
end if;
when s_idle =>
if(uart_rx_i = '0') then
if (uart_rx_i = '0') then
rst_clk_cnt <= '1';
rst_bit_cnt <= '1';
fsm_state_next <= s_regen;
end if;
when s_regen =>
if(unsigned(clk_cnt) = (unsigned(bit_div(bit_div'high downto 1))-1)) then
ld_data <= '1';
end if;
if(end_of_bit = '1') then
inc_bit_cnt <= '1';
if(end_of_rx = '1') then
if(uart_rx_i = '1') then
if (end_of_bit = '1') then
inc_bit_cnt <= '1';
if (end_of_rx = '1') then
if (uart_rx_i = '1') then
fsm_state_next <= s_idle;
else
fsm_state_next <= s_init;
@ -161,7 +153,6 @@ begin
end if;
end if;
when others => null;
end case;
end process pFSM_CL;

View file

@ -14,6 +14,7 @@
-- 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;
@ -35,28 +36,26 @@ end entity uart_rx_1;
architecture rtl of uart_rx_1 is
component sync_wire_1
generic(
rst_val : std_logic;
sync_stages : positive);
port(
rstN : in std_logic;
clk : in std_logic;
async_in : in std_logic;
sync_out : out std_logic);
end component;
type fsm_state_t is (s_init, s_idle, s_get_start_bit, s_get_data, s_get_stop_bit);
signal fsm_state_curr, fsm_state_next : fsm_state_t;
signal fsm_state_curr, fsm_state_next : fsm_state_t;
--
signal rx_data_i, shf_data, rst_bit_cnt, inc_bit_cnt : std_logic;
signal rst_clk_cnt, end_of_bit, end_of_rx, data_valid : std_logic;
signal stop_bit, rx_error_i : std_logic;
signal rx_data_i, rst_bit_cnt, inc_bit_cnt : std_logic;
signal rst_clk_cnt, end_of_rx, data_valid : std_logic;
signal stop_bit, rx_error_i : std_logic;
--
signal data : std_logic_vector(data_width - 1 downto 0);
signal clk_cnt : std_logic_vector(3 downto 0);
signal bit_cnt : std_logic_vector(5 downto 0);
signal data : std_logic_vector(data_width - 1 downto 0);
signal bit_cnt : std_logic_vector(5 downto 0);
-- avoid maths with loadable shift registers
-- bit_div will be used to set an indexed bit of the timer shift register
-- the timers will shift down towards zeroth bit which will indicate timer has completed.
-- this should be faster than using a decrementer and comparators
signal uart_bit_timer, uart_bit_sample_timer : std_logic_vector(2**bit_div'length - 1 downto 0);
signal uart_bit_timer_load_value, uart_bit_sample_timer_load_value : std_logic_vector(2**bit_div'length - 1 downto 0);
signal end_of_bit : std_logic;
signal shf_data : std_logic;
begin
@ -64,7 +63,7 @@ begin
-- Input Synchronization
-----------------------------------------------------------------------------
iSYNC_IN : sync_wire_1
iSYNC_IN : entity work.sync_wire_1
generic map(
rst_val => '1',
sync_stages => 3)
@ -86,32 +85,31 @@ begin
elsif (inc_bit_cnt = '1') then
bit_cnt <= std_logic_vector(unsigned(bit_cnt) + 1);
end if;
shf_data <= '0';
if clk_cnt = ('0' & std_logic_vector(unsigned(bit_div(bit_div'high downto 1)) + 1)) and stop_bit = '0' then
shf_data <= '1';
end if;
if (rst_clk_cnt = '1' or end_of_bit = '1') then
clk_cnt <= std_logic_vector(unsigned(bit_div) - 1);
uart_bit_timer <= uart_bit_timer_load_value;
uart_bit_sample_timer <= uart_bit_sample_timer_load_value;
else
clk_cnt <= std_logic_vector(unsigned(clk_cnt) - 1);
uart_bit_timer <= '0' & uart_bit_timer(uart_bit_timer'high downto 1);
uart_bit_sample_timer <= '0' & uart_bit_sample_timer(uart_bit_sample_timer'high downto 1);
end if;
if (rst_clk_cnt = '1') then
data <= (others => '0');
elsif (shf_data = '1') then
if (shf_data = '1') then
data <= rx_data_i & data(data'high downto 1);
end if;
data_out_valid <= data_valid;
if (init = '1') then
data_out <= (others => '0');
elsif (data_valid = '1') then
data_out_valid <= data_valid;
if (data_valid = '1') then
data_out <= data;
end if;
rx_error <= rx_error_i;
rx_error <= rx_error_i;
uart_bit_timer_load_value <= (others => '0');
uart_bit_timer_load_value(to_integer(unsigned(bit_div) -1 )) <= '1';
uart_bit_sample_timer_load_value <= (others => '0');
uart_bit_sample_timer_load_value(to_integer( unsigned(bit_div(bit_div'high downto 1)) -1)) <= '1';
end if;
end process pREGs;
end_of_bit <= '1' when unsigned(clk_cnt) = 0 else '0';
end_of_rx <= '1' when unsigned(bit_cnt) = data_width else '0';
shf_data <= uart_bit_sample_timer(0) and not stop_bit;
end_of_bit <= uart_bit_timer(0);
end_of_rx <= '1' when unsigned(bit_cnt) = data_width else '0';
-----------------------------------------------------------------------------
-- FSM
@ -130,7 +128,7 @@ begin
end process pFSM_SR;
-- FSM Combinational Logic
pFSM_CL : process(fsm_state_curr, rx_data_i, end_of_bit, end_of_rx)
pFSM_CL : process(all)
begin
--default assignments
rst_clk_cnt <= '0';
@ -181,7 +179,6 @@ begin
end if;
end if;
when others => null;
end case;
end process pFSM_CL;

View file

@ -158,7 +158,7 @@ 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 1
set_interface_property avs maximumPendingReadTransactions 0
set_interface_property avs maximumPendingWriteTransactions 0
set_interface_property avs readLatency 0
set_interface_property avs readWaitTime 1
@ -175,8 +175,8 @@ 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_readdatavalid readdatavalid Output 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
@ -222,6 +222,7 @@ add_interface_port rx_clk rx_clk clk Input 1
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
@ -238,6 +239,7 @@ add_interface_port irq_0 ins_fpm_irq_0 irq Output 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
@ -254,6 +256,7 @@ add_interface_port irq_1 ins_fpm_irq_1 irq Output 1
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
@ -270,6 +273,7 @@ add_interface_port irq_2 ins_fpm_irq_2 irq Output 1
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

View file

@ -6,13 +6,14 @@
-- Author : Gianmarco Girau
-- Company : Global Inkjet Systems
-- Created : 2017-09-08
-- Last update: 2019-05-29
-- Last update: 2019-07-22
-- 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;

View file

@ -6,13 +6,14 @@
-- Author : Gianmarco Girau
-- Company : Global Inkjet Systems
-- Created : 2017-09-06
-- Last update: 2019-05-29
-- Last update: 2019-07-22
-- 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;

View file

@ -6,7 +6,7 @@
-- Author : Gianmarco Girau
-- Company : Global Inkjet Systems
-- Created : 2017-09-06
-- Last update: 2019-07-03
-- Last update: 2019-07-22
-- SVN ID : Git
-- Standard : VHDL'08
-------------------------------------------------------------------------------
@ -14,6 +14,7 @@
-- Generates fire request from the EMS output data, transferred either via POF
-- or through NetSync
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;
@ -47,7 +48,7 @@ entity fire_pulse_manager_2 is
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_waitrequest : out std_logic;
avs_readdata : out std_logic_vector(31 downto 0));
end entity fire_pulse_manager_2;
@ -169,7 +170,7 @@ begin
avs_write => avs_write,
avs_writedata => avs_writedata,
avs_read => avs_read,
avs_readdatavalid => avs_readdatavalid,
avs_waitrequest => avs_waitrequest,
avs_readdata => avs_readdata,
cs_addr => cs_addr,
cs_we => cs_write_en,

View file

@ -6,13 +6,14 @@
-- Author : Gianmarco Girau
-- Company : Global Inkjet Systems
-- Created : 2017-08-23
-- Last update: 2019-05-29
-- Last update: 2019-07-22
-- 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;

View file

@ -6,7 +6,7 @@
-- Author : Gianmarco Girau
-- Company : Global Inkjet Systems
-- Created : 2019-06-18
-- Last update: 2019-07-01
-- Last update: 2019-07-22
-- SVN ID : Git
-- Standard : VHDL'2008
-------------------------------------------------------------------------------
@ -14,6 +14,7 @@
-- This block detects encoder velocity by measuring the balance of encoder
-- positive and negative steps over consecutive sampling periods.
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;

View file

@ -6,13 +6,14 @@
-- Author : Gianmarco Girau
-- Company : Global Inkjet Systems
-- Created : 2016-08-02
-- Last update: 2019-05-29
-- Last update: 2019-07-22
-- 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;

View file

@ -6,13 +6,14 @@
-- Author : Gianmarco Girau
-- Company : Global Inkjet Systems
-- Created : 2017-10-31
-- Last update: 2019-05-29
-- Last update: 2019-07-22
-- 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;

View file

@ -0,0 +1,3 @@
FPM Major version 3: Multi-Channel FPM. The initial version differs from major version 1
only in the cs_bus_itf block, which uses Avalon waitrequest instead of readdatavalid to
achieve a variable read latency

View file

@ -0,0 +1,310 @@
[{
"ip_name": "fpm_ctrl_3",
"bus": "csr",
"description": "This block is the fire pulse manager control",
"registers": {
"ip_id" : {
"address" : "0",
"width" : "32",
"description" : "Unique ID for this IP block",
"fields": {
"ip_number" : {
"type" : "c",
"bit_len" : "8",
"reset" : "0x14",
"description" : "IP identifier number"
},
"mfr_number" : {
"type" : "c",
"bit_len" : "8",
"reset" : "0xFF",
"description" : "Manufacturer number"
},
"reserved" : {
"type" : "rsv",
"bit_len" : "16",
"description" : "Reserved bits"
}
}
},
"ip_ver" : {
"address" : "1",
"width" : "32",
"description" : "IP Version",
"fields": {
"minor_number" : {
"type" : "c",
"bit_len" : "8",
"reset" : "0x00",
"description" : "Minor number"
},
"major_number" : {
"type" : "c",
"bit_len" : "8",
"reset" : "0x03",
"description" : "Major number"
},
"reserved" : {
"type" : "rsv",
"bit_len" : "16",
"description" : "Reserved bits"
}
}
},
"Signal selection": {
"address": "2",
"width": "2",
"description": "Controls signal selection",
"fields": {
"fire_pulse_sel": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "0 => Use External fire pulses, 1 => Use FPM fire pulses"
},
"enc_pd_emul_en": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "0 => Use POF RX, 1 => Use internal enc/PD emulator"
}
}
},
"pof_receiver_control": {
"address": "3",
"width": "8",
"description": "Controls POF receiver",
"fields": {
"pof_rx_enable": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "0 => Disable POF RX, 1 => Enable POF RX"
},
"uart_regeneration_bypass": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "0 => Use UART Regeneration, 1 => Bypass UART Regeneration"
},
"clear_max": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "0 => Disabled, 1 => Load the current value of Absolute Position as new maximum"
},
"clear_min": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "0 => Disabled, 1 => Load the current value of Absolute Position as new miniumum"
},
"uart_rx_div": {
"type": "w",
"bit_len": "4",
"reset": "0x4",
"description": "Defines the number of 200 MHz clock cycles per UART data bit"
}
}
},
"monitoring_point_selection": {
"address": "4",
"width": "16",
"description": "Selects monitoring points for external header",
"fields": {
"mp0": {
"type": "w",
"bit_len": "4",
"reset": "0x0",
"description": "Selects first monitoring point"
},
"mp1": {
"type": "w",
"bit_len": "4",
"reset": "0x0",
"description": "Selects second monitoring point"
},
"mp2": {
"type": "w",
"bit_len": "4",
"reset": "0x0",
"description": "Selects third monitoring point"
},
"mp3": {
"type": "w",
"bit_len": "4",
"reset": "0x0",
"description": "Selects fourth monitoring point"
}
}
},
"coarse_time_init": {
"type": "w",
"address": "5",
"reset": "0x00000000",
"width": "32",
"description": "Defines coarse time counter value"
},
"fine_time_init": {
"address": "6",
"width": "29",
"description": "Fine time counter value/Load counter enable",
"fields": {
"fine_time_init": {
"type" :"w",
"bit_len": "28",
"reset": "0x0000000",
"description": "Defines fine time counter value"
},
"time_load_en": {
"type" :"w",
"bit_len" : "1",
"reset": "0x0",
"description" : "Writting 1 loads the coarse and fine time counters"
}
}
},
"fine_time_status": {
"type": "r",
"address": "7",
"reset": "0x0000000",
"width": "28",
"description": "Current fine time counter value"
},
"coarse_time_status": {
"type": "r",
"address": "8",
"reset": "0x00000000",
"width": "32",
"description": "Current coarse time counter value"
},
"pof_rx_status": {
"address": "9",
"width": "32",
"description": "Status of POF receiver",
"fields": {
"parity_bit_error_count": {
"type": "r",
"bit_len": "16",
"reset": "0x0000",
"description": "Counts number of parity errors"
},
"skipped_position_error_count": {
"type": "r",
"bit_len": "16",
"reset": "0x0000",
"description": "Counts position skipped type errors"
}
}
},
"pof_rx_control": {
"address": "10",
"width": "12",
"description": "POF receiver error control",
"fields": {
"error_rate_thres": {
"type" : "w",
"bit_len": "8",
"reset": "0x0A",
"description": "Defines RX error rate threshold"
},
"rx_watchdog_en": {
"type": "w",
"bit_len": "1",
"reset": "0x1",
"description": "0 => Disable RX watchdog, 1 => Enable RX Watchdog"
},
"rx_watchdog_clr": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "0 => RX watchdog counter running, 1 => Clear RX watchdog counter"
},
"rx_watchdog": {
"type": "r",
"bit_len": "1",
"reset": "0x0",
"description": "0 => RX watchdog not triggered, 1 => RX watchdog triggered"
},
"rx_error_flag": {
"type": "r",
"bit_len": "1",
"reset": "0x0",
"description": "0 => Error rate below threshold, 1 => Error rate above threshold"
}
}
},
"fpm_interrupt": {
"address": "11",
"width": "16",
"description": "Interrupt control",
"fields": {
"irq_en": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "0 => Disable IRQ, 1 => Enable IRQ"
},
"reserved1": {
"type": "rsv",
"bit_len": "3",
"description": "Reserved"
},
"irq_clr": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "0 => Don't clear pending IRQ, 1 => Clear pending IRQ"
},
"reserved2": {
"type": "rsv",
"bit_len": "3",
"description": "Reserved"
},
"irq_mask": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "0 => IRQ not masked, 1 => IRQ masked"
},
"reserved3": {
"type": "rsv",
"bit_len": "3",
"description": "Reserved"
},
"irq_status": {
"type": "r",
"bit_len": "1",
"reset": "0x0",
"description": "0 => IRQ not active, 1 => IRQ active"
},
"reserved4": {
"type": "rsv",
"bit_len": "3",
"description": "Reserved"
}
}
},
"fpm_ext_ctrl": {
"address": "12",
"width": "32",
"description": "Controls regeneration of external fire pulses",
"fields": {
"ext_fp_det": {
"type": "w",
"bit_len": "16",
"reset": "0x0010",
"description": "Minimum width of external fire pulses"
},
"ext_fp_gen": {
"type": "w",
"bit_len": "16",
"reset": "0x0020",
"description": "Width of regenerated external fire pulses"
}
}
}
}
}]

View file

@ -0,0 +1,169 @@
[{
"ip_name": "fpm_diags_1",
"bus": "csr",
"description": "This block is the fire pulse manager diagnostics",
"registers": {
"init": {
"type": "w",
"address": "0",
"reset": "0x00",
"width": "32",
"description": "Write 1 then 0 to initialize the diagnostics block"
},
"input_status": {
"address": "1",
"width": "13",
"description": "Instantaneous status of input signals",
"fields": {
"Rs422Phase0Input": {
"type": "r",
"bit_len": "1",
"reset": "0x00",
"description": ""
},
"Rs422Phase1Input": {
"type": "r",
"bit_len": "1",
"reset": "0x00",
"description": ""
},
"Rs422ZeroPhase": {
"type": "r",
"bit_len": "1",
"reset": "0x00",
"description": ""
},
"Rs422ProductDetect": {
"type": "r",
"bit_len": "1",
"reset": "0x00",
"description": ""
},
"TtlPhase0Input": {
"type": "r",
"bit_len": "1",
"reset": "0x00",
"description": ""
},
"TtlPhase1Input": {
"type": "r",
"bit_len": "1",
"reset": "0x00",
"description": ""
},
"TtlProductDetect": {
"type": "r",
"bit_len": "1",
"reset": "0x00",
"description": ""
},
"FilteredPhase0Input": {
"type": "r",
"bit_len": "1",
"reset": "0x00",
"description": ""
},
"FilteredPhase1Input": {
"type": "r",
"bit_len": "1",
"reset": "0x00",
"description": ""
},
"FilteredZeroPhase": {
"type": "r",
"bit_len": "1",
"reset": "0x00",
"description": ""
},
"FilteredProductDetect": {
"type": "r",
"bit_len": "1",
"reset": "0x00",
"description": ""
},
"EmsEncoderOutput": {
"type": "r",
"bit_len": "1",
"reset": "0x00",
"description": ""
},
"EmsProductDetectOutput": {
"type": "r",
"bit_len": "1",
"reset": "0x00",
"description": ""
}
}
},
"phase0_counter": {
"type": "r",
"address": "2",
"reset": "0x0",
"width": "32",
"description": ""
},
"phase1_counter": {
"type": "r",
"address": "3",
"reset": "0x0",
"width": "32",
"description": ""
},
"ems_encoder_output_counter": {
"type": "r",
"address": "6",
"reset": "0x0",
"width": "32",
"description": ""
},
"ems_pd_output_counter": {
"type": "r",
"address": "7",
"reset": "0x0",
"width": "32",
"description": ""
},
"fire_request_channel_counter": {
"type": "r",
"address": "8",
"reset": "0x0",
"width": "32",
"description": ""
},
"delta_time_measurement_interval": {
"type": "w",
"address": "16",
"reset": "0x0",
"width": "32",
"description": ""
},
"position": {
"type": "r",
"address": "17",
"reset": "0x0",
"width": "32",
"description": ""
},
"delta_position_measurement_interval": {
"type": "w",
"address": "20",
"reset": "0x0",
"width": "32",
"description": ""
},
"delta_position_fifo_control": {
"type": "w",
"address": "21",
"reset": "0x0",
"width": "32",
"description": ""
},
"irq_management": {
"type": "w",
"address": "27",
"reset": "0x0",
"width": "32",
"description": ""
}
}
}]

View file

@ -0,0 +1,57 @@
[{
"ip_name" : "fpm_event_log_1",
"bus" : "csr",
"description" : "This block is the fire pulse manager diags",
"registers" : {
"ip_id" : {
"address" : "0",
"width" : "32",
"description" : "Unique ID for this IP block",
"fields": {
"ip_number" : {
"type" : "c",
"bit_len" : "8",
"reset" : "0xFF",
"description" : "IP identifier number (unknown)"
},
"mfr_number" : {
"type" : "c",
"bit_len" : "8",
"reset" : "0xFF",
"description" : "Manufacturer number"
},
"reserved" : {
"type" : "rsv",
"bit_len" : "16",
"description" : "Reserved bits"
}
}
},
"ip_ver" : {
"address" : "1",
"width" : "32",
"description" : "Bits[7:0] = Minor version number, Bits[15:8] = Major version number, etc.",
"fields": {
"minor_number" : {
"type" : "c",
"bit_len" : "8",
"reset" : "0x01",
"description" : "Minor number"
},
"major_number" : {
"type" : "c",
"bit_len" : "8",
"reset" : "0x00",
"description" : "Major number"
},
"reserved" : {
"type" : "rsv",
"bit_len" : "16",
"description" : "Reserved bits"
}
}
}
}
}]

View file

@ -0,0 +1 @@
### REPLACED BY THE ENC/PD EMULATOR BLOCK ###

View file

@ -0,0 +1,57 @@
[{
"ip_name" : "fpm_net_sync_1",
"bus" : "csr",
"description" : "This block is the fire pulse manager net sync",
"registers" : {
"ip_id" : {
"address" : "0",
"width" : "32",
"description" : "Unique ID for this IP block",
"fields": {
"ip_number" : {
"type" : "c",
"bit_len" : "8",
"reset" : "0xFF",
"description" : "IP identifier number (unknown)"
},
"mfr_number" : {
"type" : "c",
"bit_len" : "8",
"reset" : "0xFF",
"description" : "Manufacturer number"
},
"reserved" : {
"type" : "rsv",
"bit_len" : "16",
"description" : "Reserved bits"
}
}
},
"ip_ver" : {
"address" : "1",
"width" : "32",
"description" : "Bits[7:0] = Minor version number, Bits[15:8] = Major version number, etc.",
"fields": {
"minor_number" : {
"type" : "c",
"bit_len" : "8",
"reset" : "0x01",
"description" : "Minor number"
},
"major_number" : {
"type" : "c",
"bit_len" : "8",
"reset" : "0x00",
"description" : "Major number"
},
"reserved" : {
"type" : "rsv",
"bit_len" : "16",
"description" : "Reserved bits"
}
}
}
}
}]

View file

@ -0,0 +1,89 @@
# Multi-channel FPM Simulation macro
.main clear
# Path variables
set COMMON_PATH ../../../common/0/src
set GENERIC_PATH ../../../
set OSVVM_PATH ../../../common/0/src/test/OSVVM
set SRC_PATH ../src
set TB_PATH ../src/test
set WORKLIB work
vlib ./work
vmap work ./work
# Compile OSVVM lib
vlib OSVVM
vcom -2008 -work OSVVM $OSVVM_PATH/RandomBasePkg.vhd
vcom -2008 -work OSVVM $OSVVM_PATH/SortListPkg_int.vhd
vcom -2008 -work OSVVM $OSVVM_PATH/RandomPkg.vhd
# Compile the testbench support files:
# Log package and common
vcom -2008 -work $WORKLIB $COMMON_PATH/sync_reset.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/sync_wire.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/sync_wire_redge.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/cs_bus_itf.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/common_pkg.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/test/common_test_pkg.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/test/log_pkg.vhd
# Compile the VHDL packages that support bus protocols, memory mapped registers and functional procedures
vcom -2008 -work $WORKLIB $COMMON_PATH/test/avalon_verify_pkg.vhd
# Generic Sequencer
vcom -2008 -work $WORKLIB $GENERIC_PATH/generic_sequencer/15/src/altera/generic_seq_ram_15.vhd
vcom -2008 -work $WORKLIB $GENERIC_PATH/generic_sequencer/15/src/generic_sequencer_15_pkg.vhd
vcom -2008 -work $WORKLIB $GENERIC_PATH/generic_sequencer/15/src/generic_sequencer_15.vhd
# Pulse Generator
vcom -2008 -work $WORKLIB $GENERIC_PATH/pulse_generator/1/src/altera/sync_fifo_1.vhd
vcom -2008 -work $WORKLIB $GENERIC_PATH/pulse_generator/1/src/pulse_generator_1_pkg.vhd
vcom -2008 -work $WORKLIB $GENERIC_PATH/pulse_generator/1/src/pulse_conditioning_1.vhd
vcom -2008 -work $WORKLIB $GENERIC_PATH/pulse_generator/1/src/queue_and_delay_1.vhd
vcom -2008 -work $WORKLIB $GENERIC_PATH/pulse_generator/1/src/simple_frac_div_1.vhd
vcom -2008 -work $WORKLIB $GENERIC_PATH/pulse_generator/1/src/pulse_generator_1.vhd
# Enc PD Emul
vcom -2008 -work $WORKLIB $GENERIC_PATH/enc_pd_emul/1/src/enc_pd_emul_1_pkg.vhd
vcom -2008 -work $WORKLIB $GENERIC_PATH/enc_pd_emul/1/src/enc_pd_emul_1.vhd
# Fire-Pulse-Manager
vcom -2008 -work $WORKLIB $SRC_PATH/fire_pulse_3_pkg.vhd
vcom -2008 -work $WORKLIB $SRC_PATH/uart_rx_3.vhd
vcom -2008 -work $WORKLIB $SRC_PATH/uart_regen_3.vhd
vcom -2008 -work $WORKLIB $SRC_PATH/fire_pulse_ctrl_3.vhd
vcom -2008 -work $WORKLIB $SRC_PATH/pof_rx_3.vhd
vcom -2008 -work $WORKLIB $SRC_PATH/fire_pulse_ext_3.vhd
vcom -2008 -work $WORKLIB $SRC_PATH/fire_pulse_manager_3.vhd
# POF TX
vcom -2008 -work $WORKLIB $TB_PATH/fifo_16x8_3.vhd
vcom -2008 -work $WORKLIB $TB_PATH/uart_tx_3.vhd
vcom -2008 -work $WORKLIB $TB_PATH/pof_tx_3.vhd
# Testbench
vcom -2008 -work $WORKLIB $TB_PATH/fire_pulse_manager_3_tb.vhd
# Load design
vsim -t ps work.fire_pulse_manager_3_tb
# Add waves
#add wave -r sim:/fire_pulse_manager_1_tb/*
do wave_fpm.do
# remove warnings from standard numeric/arithmetic packages (speed-up simulation)
set StdArithNoWarnings 1
set NumericStdNoWarnings 1
when -label end_of_simulation {test_completed == true} {echo "Simulation Completed"; stop ;}
run -all

View file

@ -0,0 +1,70 @@
# Simulation macro
.main clear
set COMP_ONLY 0
set TB_PATH ./../src/test
set COMMON_PATH ../../../common/0/src
set OSVVM_PATH $COMMON_PATH/test/OSVVM
set WORKLIB work
vlib ./work
vmap work ./work
if {$COMP_ONLY == 0} {
# Compile the constrained random related packages
vlib OSVVM
vcom -2008 -work OSVVM \
$OSVVM_PATH/RandomBasePkg.vhd \
$OSVVM_PATH/SortListPkg_int.vhd \
$OSVVM_PATH/RandomPkg.vhd \
$OSVVM_PATH/NamePkg.vhd \
$OSVVM_PATH/MessagePkg.vhd \
$OSVVM_PATH/CoveragePkg.vhd
}
# compile the UUTs:
#vcom -2008 -work $WORKLIB $COMMON_PATH/pkg_functions.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/sync_wire.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/sync_wire_redge.vhd
vcom -2008 -work $WORKLIB ../src/uart_rx_3.vhd
vcom -2008 -work $WORKLIB ../src/pof_rx_3.vhd
# Compile the testbench and the other components supporting the test
if {$COMP_ONLY == 0} {
# Test support packages
vcom -2008 -work $WORKLIB $COMMON_PATH/test/common_test_pkg.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/test/log_pkg.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/test/avalon_verify_pkg.vhd
# Testbench
# in fire pulse manager, the tx components are part of the testbench
vcom -2008 -work $WORKLIB $TB_PATH/fifo_16x8_3.vhd
vcom -2008 -work $WORKLIB $TB_PATH/uart_tx_3.vhd
vcom -2008 -work $WORKLIB $TB_PATH/pof_tx_3.vhd
vcom -2008 -work $WORKLIB $TB_PATH/pof_tx_rx_3_tb.vhd
vsim -t ps work.pof_tx_rx_3_tb
#add wave /pof_tx_rx_tb/*
#add wave /pof_tx_rx_tb/iPOF_TX/*
#add wave /pof_tx_rx_tb/iPOF_RX/*
# remove warnings from standard numeric/arithmetic packages (speed-up simulation)
set StdArithNoWarnings 1
set NumericStdNoWarnings 1
do wave_pof_txrx.do
when -label end_of_simulation {test_completed == true} {echo "Simulation Completed"; stop ;}
run -all
#run 1 ms;
}

View file

@ -0,0 +1,171 @@
onerror {resume}
quietly WaveActivateNextPane {} 0
add wave -noupdate -group TB /fire_pulse_manager_3_tb/ch_offset
add wave -noupdate -group TB /fire_pulse_manager_3_tb/reset_n
add wave -noupdate -group TB /fire_pulse_manager_3_tb/clk
add wave -noupdate -group TB /fire_pulse_manager_3_tb/rx_clk
add wave -noupdate -group TB /fire_pulse_manager_3_tb/pof_tx
add wave -noupdate -group TB /fire_pulse_manager_3_tb/pof_rx
add wave -noupdate -group TB /fire_pulse_manager_3_tb/ch_pulse_out
add wave -noupdate -group TB /fire_pulse_manager_3_tb/avs_address
add wave -noupdate -group TB /fire_pulse_manager_3_tb/avs_write
add wave -noupdate -group TB /fire_pulse_manager_3_tb/avs_writedata
add wave -noupdate -group TB /fire_pulse_manager_3_tb/avs_read
add wave -noupdate -group TB /fire_pulse_manager_3_tb/avs_waitrequest
add wave -noupdate -group TB /fire_pulse_manager_3_tb/avs_readdata
add wave -noupdate -group TB /fire_pulse_manager_3_tb/init_tx
add wave -noupdate -group TB /fire_pulse_manager_3_tb/pd_in
add wave -noupdate -group TB /fire_pulse_manager_3_tb/pd_spy
add wave -noupdate -group TB /fire_pulse_manager_3_tb/inc_pos
add wave -noupdate -group TB /fire_pulse_manager_3_tb/dec_pos
add wave -noupdate -group TB /fire_pulse_manager_3_tb/abs_position
add wave -noupdate -group TB /fire_pulse_manager_3_tb/abs_spy
add wave -noupdate -group TB /fire_pulse_manager_3_tb/tx_data
add wave -noupdate -group TB /fire_pulse_manager_3_tb/abs_position_d
add wave -noupdate -group TB /fire_pulse_manager_3_tb/dir_in
add wave -noupdate -group TB /fire_pulse_manager_3_tb/swathe_cnt
add wave -noupdate -group TB /fire_pulse_manager_3_tb/swathe_pos
add wave -noupdate -group TB /fire_pulse_manager_3_tb/end_of_swathe
add wave -noupdate -group TB /fire_pulse_manager_3_tb/test_completed
add wave -noupdate -group TB /fire_pulse_manager_3_tb/running
add wave -noupdate -group TB /fire_pulse_manager_3_tb/configuring
add wave -noupdate -group TB /fire_pulse_manager_3_tb/passed
add wave -noupdate -group TB /fire_pulse_manager_3_tb/failed
add wave -noupdate -group TB /fire_pulse_manager_3_tb/stimuli_completed
add wave -noupdate -group TB /fire_pulse_manager_3_tb/detected_error
add wave -noupdate -group TB /fire_pulse_manager_3_tb/registers_read
add wave -noupdate -group TB /fire_pulse_manager_3_tb/reprogram_offset
add wave -noupdate -group TB /fire_pulse_manager_3_tb/avs_m
add wave -noupdate -group TB /fire_pulse_manager_3_tb/avs_s
add wave -noupdate -group TB /fire_pulse_manager_3_tb/sel_slave_0
add wave -noupdate -group TB /fire_pulse_manager_3_tb/sel_slave_1
add wave -noupdate -group TB /fire_pulse_manager_3_tb/pd_cnt
add wave -noupdate -group TB /fire_pulse_manager_3_tb/fp_cnt
add wave -noupdate -group TB /fire_pulse_manager_3_tb/tx_clk
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/reset_n
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/clk
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/init
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/rx_clk
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/rx_data
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/init_out
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/dp_dir
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/enc_out
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/pd_out
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/inc_pos
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/dec_pos
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/abs_pos
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/enable
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/bit_div
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/error_rate_thres
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/one_pps
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/upd_max_pos
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/upd_min_pos
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/max_error_flag
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/rx_watchdog
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/rx_watchdog_en
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/rx_watchdog_clr
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/parity_err_cnt
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/skip_pos_cnt
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/clear
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/symbol_ok
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/inc_pos_i
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/dec_pos_i
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/sync_gen
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/pd_gen
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/symbol_error
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/sync_d
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/symbol_valid
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/symbol_valid_i
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/symbol_valid_d
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/toggle_sync
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/sync_confirmed
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/sync_toggle_test
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/sync
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/toggle_pd
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/pd_confirmed
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/pd_toggle_test
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/pd
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/valid_pos
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/upd_pos
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/corr_done
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/corr_sign
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/skip_pos
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/apply_corr
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/inc_pos_ii
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/dec_pos_ii
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/new_max
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/new_min
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/rx_error
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/rx_error_i
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/rx_symbol_val
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/clear_i
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/skip_pos_d
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/pos_recovery
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/dp_dir_d
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/dp_dir_change
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/max_error_flag_i
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/clk_cnt
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/dist
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/abs_dist
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/skip_cnt
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/next_pos_lsb
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/curr_pos_lsb
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/pos_corr
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/max_dist
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/rx_error_v
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/gray_pos
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/rx_symbol_val_v
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/symbol
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/symbol_i
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/rx_symbol
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/rx_wd_cnt
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/parity_err_cnt_i
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/skip_pos_cnt_i
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/error_rate_cnt
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/error_rate
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/abs_pos_i
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/pos_max
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/pos_min
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/dist_pos
add wave -noupdate -group {POF RX} /fire_pulse_manager_3_tb/iDUT/iPOF_RX/dist_neg
add wave -noupdate -group UART_RX /fire_pulse_manager_3_tb/iDUT/iPOF_RX/iRX_SYMBOL/reset_n
add wave -noupdate -group UART_RX /fire_pulse_manager_3_tb/iDUT/iPOF_RX/iRX_SYMBOL/clk
add wave -noupdate -group UART_RX /fire_pulse_manager_3_tb/iDUT/iPOF_RX/iRX_SYMBOL/bit_div
add wave -noupdate -group UART_RX /fire_pulse_manager_3_tb/iDUT/iPOF_RX/iRX_SYMBOL/init
add wave -noupdate -group UART_RX /fire_pulse_manager_3_tb/iDUT/iPOF_RX/iRX_SYMBOL/data_out
add wave -noupdate -group UART_RX /fire_pulse_manager_3_tb/iDUT/iPOF_RX/iRX_SYMBOL/data_out_valid
add wave -noupdate -group UART_RX /fire_pulse_manager_3_tb/iDUT/iPOF_RX/iRX_SYMBOL/rx_error
add wave -noupdate -group UART_RX /fire_pulse_manager_3_tb/iDUT/iPOF_RX/iRX_SYMBOL/rx_data
add wave -noupdate -group UART_RX /fire_pulse_manager_3_tb/iDUT/iPOF_RX/iRX_SYMBOL/fsm_state_curr
add wave -noupdate -group UART_RX /fire_pulse_manager_3_tb/iDUT/iPOF_RX/iRX_SYMBOL/fsm_state_next
add wave -noupdate -group UART_RX /fire_pulse_manager_3_tb/iDUT/iPOF_RX/iRX_SYMBOL/rx_data_i
add wave -noupdate -group UART_RX /fire_pulse_manager_3_tb/iDUT/iPOF_RX/iRX_SYMBOL/shf_data
add wave -noupdate -group UART_RX /fire_pulse_manager_3_tb/iDUT/iPOF_RX/iRX_SYMBOL/rst_bit_cnt
add wave -noupdate -group UART_RX /fire_pulse_manager_3_tb/iDUT/iPOF_RX/iRX_SYMBOL/inc_bit_cnt
add wave -noupdate -group UART_RX /fire_pulse_manager_3_tb/iDUT/iPOF_RX/iRX_SYMBOL/rst_clk_cnt
add wave -noupdate -group UART_RX /fire_pulse_manager_3_tb/iDUT/iPOF_RX/iRX_SYMBOL/end_of_bit
add wave -noupdate -group UART_RX /fire_pulse_manager_3_tb/iDUT/iPOF_RX/iRX_SYMBOL/end_of_rx
add wave -noupdate -group UART_RX /fire_pulse_manager_3_tb/iDUT/iPOF_RX/iRX_SYMBOL/data_valid
add wave -noupdate -group UART_RX /fire_pulse_manager_3_tb/iDUT/iPOF_RX/iRX_SYMBOL/stop_bit
add wave -noupdate -group UART_RX /fire_pulse_manager_3_tb/iDUT/iPOF_RX/iRX_SYMBOL/rx_error_i
add wave -noupdate -group UART_RX /fire_pulse_manager_3_tb/iDUT/iPOF_RX/iRX_SYMBOL/data
add wave -noupdate -group UART_RX /fire_pulse_manager_3_tb/iDUT/iPOF_RX/iRX_SYMBOL/clk_cnt
add wave -noupdate -group UART_RX /fire_pulse_manager_3_tb/iDUT/iPOF_RX/iRX_SYMBOL/bit_cnt
TreeUpdate [SetDefaultTree]
WaveRestoreCursors {{Cursor 1} {0 ps} 0}
quietly wave cursor active 0
configure wave -namecolwidth 150
configure wave -valuecolwidth 100
configure wave -justifyvalue left
configure wave -signalnamewidth 1
configure wave -snapdistance 10
configure wave -datasetprefix 0
configure wave -rowmargin 4
configure wave -childrowmargin 2
configure wave -gridoffset 0
configure wave -gridperiod 1
configure wave -griddelta 40
configure wave -timeline 0
configure wave -timelineunits ps
update
WaveRestoreZoom {64332055 ps} {64335156 ps}

View file

@ -0,0 +1,235 @@
onerror {resume}
quietly WaveActivateNextPane {} 0
add wave -noupdate /pof_tx_rx_3_tb/reset_n
add wave -noupdate /pof_tx_rx_3_tb/hmb_clk
add wave -noupdate /pof_tx_rx_3_tb/sm_clk
add wave -noupdate /pof_tx_rx_3_tb/avs_read
add wave -noupdate /pof_tx_rx_3_tb/avs_write
add wave -noupdate /pof_tx_rx_3_tb/sel_slave_0
add wave -noupdate /pof_tx_rx_3_tb/sel_slave_1
add wave -noupdate /pof_tx_rx_3_tb/avs_write_sl0
add wave -noupdate /pof_tx_rx_3_tb/avs_read_sl0
add wave -noupdate /pof_tx_rx_3_tb/avs_readdatavalid_sl0
add wave -noupdate /pof_tx_rx_3_tb/avs_write_sl1
add wave -noupdate /pof_tx_rx_3_tb/avs_read_sl1
add wave -noupdate /pof_tx_rx_3_tb/avs_readdatavalid_sl1
add wave -noupdate /pof_tx_rx_3_tb/init_tx
add wave -noupdate /pof_tx_rx_3_tb/init_rx
add wave -noupdate /pof_tx_rx_3_tb/dir_in
add wave -noupdate /pof_tx_rx_3_tb/pd_in
add wave -noupdate /pof_tx_rx_3_tb/inc_pos
add wave -noupdate /pof_tx_rx_3_tb/dec_pos
add wave -noupdate -radix decimal /pof_tx_rx_3_tb/abs_position
add wave -noupdate /pof_tx_rx_3_tb/tx_data
add wave -noupdate /pof_tx_rx_3_tb/rx_data
add wave -noupdate /pof_tx_rx_3_tb/init_out
add wave -noupdate /pof_tx_rx_3_tb/dir_out
add wave -noupdate /pof_tx_rx_3_tb/enc_out
add wave -noupdate /pof_tx_rx_3_tb/pd_out
add wave -noupdate /pof_tx_rx_3_tb/inc_pos_out
add wave -noupdate /pof_tx_rx_3_tb/dec_pos_out
add wave -noupdate -radix decimal /pof_tx_rx_3_tb/abs_pos_out
add wave -noupdate /pof_tx_rx_3_tb/test_completed
add wave -noupdate /pof_tx_rx_3_tb/running
add wave -noupdate /pof_tx_rx_3_tb/configuring
add wave -noupdate /pof_tx_rx_3_tb/passed
add wave -noupdate /pof_tx_rx_3_tb/failed
add wave -noupdate /pof_tx_rx_3_tb/stimuli_completed
add wave -noupdate /pof_tx_rx_3_tb/avs_address
add wave -noupdate -radix hexadecimal /pof_tx_rx_3_tb/avs_writedata
add wave -noupdate -radix hexadecimal /pof_tx_rx_3_tb/avs_readdata_sl0
add wave -noupdate -radix hexadecimal /pof_tx_rx_3_tb/avs_readdata_sl1
add wave -noupdate -radix decimal /pof_tx_rx_3_tb/abs_position_d
add wave -noupdate -radix decimal /pof_tx_rx_3_tb/swathe_pos
add wave -noupdate /pof_tx_rx_3_tb/swathe_cnt
add wave -noupdate -radix hexadecimal /pof_tx_rx_3_tb/avs_m
add wave -noupdate -radix hexadecimal /pof_tx_rx_3_tb/avs_s
add wave -noupdate /pof_tx_rx_3_tb/detected_error
add wave -noupdate /pof_tx_rx_3_tb/dir_discr_cnt
add wave -noupdate /pof_tx_rx_3_tb/pd_discr_cnt
add wave -noupdate /pof_tx_rx_3_tb/pd_in_cnt
add wave -noupdate /pof_tx_rx_3_tb/pd_out_cnt
add wave -noupdate -radix decimal /pof_tx_rx_3_tb/abs_position
add wave -noupdate -radix decimal /pof_tx_rx_3_tb/abs_pos_out
add wave -noupdate /pof_tx_rx_3_tb/pos_discr_cnt
add wave -noupdate /pof_tx_rx_3_tb/end_of_swathe
add wave -noupdate /pof_tx_rx_3_tb/enc_pulse_cnt
add wave -noupdate /pof_tx_rx_3_tb/dir_err
add wave -noupdate /pof_tx_rx_3_tb/pd_err
add wave -noupdate /pof_tx_rx_3_tb/pos_err
add wave -noupdate /pof_tx_rx_3_tb/enc_err
add wave -noupdate /pof_tx_rx_3_tb/ovfl_err
add wave -noupdate /pof_tx_rx_3_tb/injected_errors
add wave -noupdate /pof_tx_rx_3_tb/max_pos
add wave -noupdate /pof_tx_rx_3_tb/min_pos
add wave -noupdate /pof_tx_rx_3_tb/exp_enc_pulse
add wave -noupdate /pof_tx_rx_3_tb/enc_discr
add wave -noupdate /pof_tx_rx_3_tb/exp_enc_cnt
add wave -noupdate /pof_tx_rx_3_tb/error_rate_thres
add wave -noupdate /pof_tx_rx_3_tb/one_pps
add wave -noupdate /pof_tx_rx_3_tb/max_error_flag
add wave -noupdate /pof_tx_rx_3_tb/rx_watchdog
add wave -noupdate /pof_tx_rx_3_tb/rx_watchdog_en
add wave -noupdate /pof_tx_rx_3_tb/rx_watchdog_clr
add wave -noupdate -divider EMB2POF
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/reset_n
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/clk
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/init
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/pd_in
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/inc_pos
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/dec_pos
add wave -noupdate -radix decimal /pof_tx_rx_3_tb/iPOF_TX/abs_position
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/tx_data
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/avs_address
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/avs_write
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/avs_writedata
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/avs_read
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/avs_readdatavalid
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/avs_readdata
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/rd_event
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/wr_event
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/empty
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/full
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/tx_ready
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/rd_event_d
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/wr_event_i
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/enable
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/toggle_sync
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/toggle_pd
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/add_keepalive
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/ovfl_err
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/init_d
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/init_gen
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/init_v
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/init_blocked
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/init_blk_cnt
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/parity_bit
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/inject_error
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/inject_error_req
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/pd_event
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/pd_event_d
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/pd_event_dd
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/gray
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/clear
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/pd_in_d
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/pd_gen
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/clk
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/symbol_valid
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/symbol
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/tx_data
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/event_in_i
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/event_in
add wave -noupdate /pof_tx_rx_3_tb/iPOF_TX/event_out
add wave -noupdate -radix decimal /pof_tx_rx_3_tb/iPOF_TX/keepalive_cnt
add wave -noupdate -divider POF2HMB
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/reset_n
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/clk
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/init
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/rx_clk
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/rx_data
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/init_out
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/enc_out
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/pd_out
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/inc_pos
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/dec_pos
add wave -noupdate -radix decimal /pof_tx_rx_3_tb/iPOF_RX/abs_pos
add wave -noupdate -radix unsigned /pof_tx_rx_3_tb/iPOF_RX/error_rate_thres
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/one_pps
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/max_error_flag
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/rx_watchdog
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/rx_watchdog_en
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/rx_watchdog_clr
add wave -noupdate -radix unsigned /pof_tx_rx_3_tb/iPOF_RX/rx_wd_cnt
add wave -noupdate -radix unsigned /pof_tx_rx_3_tb/iPOF_RX/error_rate_cnt
add wave -noupdate -radix unsigned /pof_tx_rx_3_tb/iPOF_RX/error_rate
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/clear
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/clear_i
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/inc_pos_i
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/dec_pos_i
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/enable
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/sync_gen
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/pd_gen
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/symbol_error
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/rx_symbol_val
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/rx_symbol
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/rx_symbol_val_v
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/symbol_valid_i
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/symbol_valid_d
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/toggle_sync
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/sync_confirmed
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/sync_toggle_test
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/sync
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/toggle_pd
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/pd_confirmed
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/pd_toggle_test
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/pd
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/valid_pos
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/upd_pos
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/corr_done
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/corr_sign
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/skip_cnt
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/skip_pos
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/symbol_valid
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/symbol
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/apply_corr
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/clk_cnt
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/dist
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/abs_dist
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/next_pos_lsb
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/curr_pos_lsb
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/pos_corr
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/max_dist
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/gray_pos
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/symbol_i
add wave -noupdate -radix unsigned /pof_tx_rx_3_tb/iPOF_RX/parity_err_cnt
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/enc_out
add wave -noupdate -radix decimal /pof_tx_rx_3_tb/iPOF_RX/abs_pos_i
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/inc_pos_ii
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/dec_pos_ii
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/new_max
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/new_min
add wave -noupdate -radix decimal /pof_tx_rx_3_tb/iPOF_RX/pos_max
add wave -noupdate -radix decimal /pof_tx_rx_3_tb/iPOF_RX/pos_min
add wave -noupdate -radix decimal /pof_tx_rx_3_tb/iPOF_RX/dist_pos
add wave -noupdate -radix decimal /pof_tx_rx_3_tb/iPOF_RX/dist_neg
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/iRX_SYMBOL/data_width
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/iRX_SYMBOL/reset_n
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/iRX_SYMBOL/clk
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/iRX_SYMBOL/bit_div
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/iRX_SYMBOL/init
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/iRX_SYMBOL/data_out
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/iRX_SYMBOL/data_out_valid
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/iRX_SYMBOL/rx_data
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/iRX_SYMBOL/fsm_state_curr
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/iRX_SYMBOL/fsm_state_next
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/iRX_SYMBOL/rx_data_i
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/iRX_SYMBOL/shf_data
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/iRX_SYMBOL/rst_bit_cnt
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/iRX_SYMBOL/inc_bit_cnt
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/iRX_SYMBOL/rst_clk_cnt
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/iRX_SYMBOL/end_of_bit
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/iRX_SYMBOL/end_of_rx
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/iRX_SYMBOL/data_valid
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/iRX_SYMBOL/stop_bit
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/iRX_SYMBOL/data
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/iRX_SYMBOL/clk_cnt
add wave -noupdate /pof_tx_rx_3_tb/iPOF_RX/iRX_SYMBOL/bit_cnt
TreeUpdate [SetDefaultTree]
WaveRestoreCursors {{Cursor 2} {28538165210 ps} 0} {{Cursor 3} {28538185210 ps} 0} {{Cursor 4} {28538205210 ps} 0} {{Cursor 5} {28538225210 ps} 0}
WaveRestoreCursorLinks {1 {2 {20000 ps} 3 {40000 ps} 4 {60000 ps}}} {2 {1 {-20000 ps}}} {3 {1 {-40000 ps}}} {4 {1 {-60000 ps}}}
quietly wave cursor active 1
configure wave -namecolwidth 365
configure wave -valuecolwidth 100
configure wave -justifyvalue left
configure wave -signalnamewidth 0
configure wave -snapdistance 10
configure wave -datasetprefix 0
configure wave -rowmargin 4
configure wave -childrowmargin 2
configure wave -gridoffset 0
configure wave -gridperiod 1
configure wave -griddelta 40
configure wave -timeline 0
configure wave -timelineunits ps
update
WaveRestoreZoom {28537732626 ps} {28538723476 ps}

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: 2019-07-15
-- SVN ID : Git
-- Standard : VHDL'08
-------------------------------------------------------------------------------
-- Description:
-- Package for fire_pulse_manager block
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
package fire_pulse_3_pkg is
-----------------------------------------------------------------------------
-- Inner block mapping
-----------------------------------------------------------------------------
constant blk_num : integer := 8; -- number of sub-blocks with dedicated
-- C&S registers
constant ch_num : integer := 4; -- number of Pulse-Generator blocks
constant fp_ctrl_id : natural := 0; -- Block ID for the Fire-Pulse-Mang Controller
constant net_snk_id : natural := 1; -- Block ID for Net-Sync Sink
constant log_blk_id : natural := 2; -- Block ID for the Event Logger
constant int_enc_id : natural := 3; -- Block ID for the Internal Encoder Block
constant pg_ch_id : natural := 4; -- Block ID for Pulse-Generator
end package fire_pulse_3_pkg;

View file

@ -0,0 +1,276 @@
-------------------------------------------------------------------------------
-- Title : fire_pulse_ctrl
-- Project : HMB/EMB/SMB
-------------------------------------------------------------------------------
-- File : fire_pulse_ctrl.vhd
-- Author : Gianmarco Girau
-- Company : Global Inkjet Systems
-- Created : 2017-09-06
-- Last update: 2019-07-15
-- SVN ID : Git
-- Standard : VHDL'08
-------------------------------------------------------------------------------
-- Description:
-- Control service logic for the Fire-Controller-Manager
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity fire_pulse_ctrl_3 is
port(
reset_n : in std_logic;
clk : in std_logic;
src_sel : out std_logic_vector(1 downto 0);
uart_regen_bypass : out std_logic;
upd_max_pos : out std_logic;
upd_min_pos : out std_logic;
enable_rx : out std_logic;
uart_bit_div : out std_logic_vector(3 downto 0);
error_rate_thres : out std_logic_vector(7 downto 0);
max_error_flag : in std_logic;
rx_watchdog : in std_logic;
rx_watchdog_en : out std_logic;
rx_watchdog_clr : out std_logic;
parity_err_cnt : in std_logic_vector(15 downto 0);
skip_pos_cnt : in std_logic_vector(15 downto 0);
mon_point_src : in std_logic_vector(15 downto 0);
mon_points : out std_logic_vector(3 downto 0);
coarse_time : out std_logic_vector(31 downto 0);
fine_time : out std_logic_vector(27 downto 0);
one_pps : out std_logic;
ext_fp_det : out std_logic_vector(15 downto 0);
ext_fp_gen : out std_logic_vector(15 downto 0);
-- Interrupt Senders
ins_fpm_irq_0 : out std_logic;
-- Avalon MM Interface
avs_address : in std_logic_vector(3 downto 0);
avs_write : in std_logic;
avs_writedata : in std_logic_vector(31 downto 0);
avs_read : in std_logic;
avs_readdatavalid : out std_logic;
avs_readdata : out std_logic_vector(31 downto 0));
end entity fire_pulse_ctrl_3;
architecture rtl of fire_pulse_ctrl_3 is
-----------------------------------------------------------------------------
-- Control & Status Registers Map
-----------------------------------------------------------------------------
constant CSR_IP_ID : std_logic_vector(31 downto 0) := x"0000FF14";
constant CSR_IP_VER : std_logic_vector(31 downto 0) := x"00000300";
constant CSR_IP_ID_REG : std_logic_vector(3 downto 0) := b"0000";
constant CSR_IP_VER_REG : std_logic_vector(3 downto 0) := b"0001";
constant SRC_SEL_REG : std_logic_vector(3 downto 0) := b"0010";
constant POF_RX_CTRL : std_logic_vector(3 downto 0) := b"0011";
constant MON_PT_CTRL_REG : std_logic_vector(3 downto 0) := b"0100";
constant COARSE_TIME_INIT_REG : std_logic_vector(3 downto 0) := b"0101";
constant FINE_TIME_INIT_REG : std_logic_vector(3 downto 0) := b"0110";
constant FINE_TIME_REG : std_logic_vector(3 downto 0) := b"0111";
constant COARSE_TIME_REG : std_logic_vector(3 downto 0) := b"1000";
constant RX_ERROR_STATUS : std_logic_vector(3 downto 0) := b"1001";
constant RX_ERROR_CSR : std_logic_vector(3 downto 0) := b"1010";
constant IRQ_MNG_REG : std_logic_vector(3 downto 0) := b"1011";
constant EXT_FP_CTRL_REG : std_logic_vector(3 downto 0) := b"1100";
-----------------------------------------------------------------------------
-- Constants, Signals
-----------------------------------------------------------------------------
constant FINE_TIME_TC : integer := 100000000 - 1; -- clk must be 100MHz to
-- make it right
signal enable_rx_i : std_logic;
signal fine_time_wrap, time_ld_en : std_logic;
signal rx_watchdog_en_i, rx_watchdog_clr_i : std_logic;
signal uart_regen_bypass_i : std_logic;
signal upd_min_pos_i, upd_max_pos_i : std_logic;
signal irq, irq_src, irq_src_d : std_logic_vector(0 downto 0);
signal irq_en, irq_mask, irq_val, irq_clr : std_logic_vector(0 downto 0);
signal src_sel_i : std_logic_vector(1 downto 0);
signal mp_sel0, mp_sel1, mp_sel2, mp_sel3 : std_logic_vector(3 downto 0);
signal bit_div : std_logic_vector(3 downto 0);
signal error_rate_thres_i : std_logic_vector(7 downto 0);
signal fine_time_init, fine_time_i : std_logic_vector(27 downto 0);
signal coarse_time_init, coarse_time_i : std_logic_vector(31 downto 0);
signal ext_fp_det_i, ext_fp_gen_i : std_logic_vector(15 downto 0);
begin
pCTRL_REGs : process(reset_n, clk)
begin -- process
if (reset_n = '0') then
fine_time_i <= (others => '0');
coarse_time_i <= (others => '0');
elsif (clk = '1' and clk'event) then
if (time_ld_en = '1') then
fine_time_i <= fine_time_init;
elsif (fine_time_wrap = '1') then
fine_time_i <= (others => '0');
else
fine_time_i <= std_logic_vector(unsigned(fine_time_i) + 1);
end if;
if (time_ld_en = '1') then
coarse_time_i <= coarse_time_init;
elsif (fine_time_wrap = '1') then
coarse_time_i <= std_logic_vector(unsigned(coarse_time_i) + 1);
end if;
one_pps <= fine_time_wrap;
end if;
end process pCTRL_REGs;
fine_time_wrap <= '1' when unsigned(fine_time_i) = FINE_TIME_TC else '0';
coarse_time <= coarse_time_i;
fine_time <= fine_time_i;
-- MOnitoring Point selection
mon_points(0) <= mon_point_src(to_integer(unsigned(mp_sel0)));
mon_points(1) <= mon_point_src(to_integer(unsigned(mp_sel1)));
mon_points(2) <= mon_point_src(to_integer(unsigned(mp_sel2)));
mon_points(3) <= mon_point_src(to_integer(unsigned(mp_sel3)));
-----------------------------------------------------------------------------
-- IRQ generation and management
-----------------------------------------------------------------------------
pIRQ : process(reset_n, clk)
begin
if (reset_n = '0') then
ins_fpm_irq_0 <= '0';
irq <= "0";
irq_src_d <= "0";
elsif (clk = '1' and clk'event) then
irq_src_d <= irq_src;
for n in 0 to irq'left loop
if (irq_clr(n) = '1') then
irq(n) <= '0';
elsif (irq_en(n) = '1' and irq_src(n) = '1' and irq_src_d(n) = '0') then
irq(n) <= '1';
end if;
end loop; -- n
ins_fpm_irq_0 <= irq_val(0);
end if;
end process pIRQ;
irq_val <= irq and not irq_mask;
irq_src <= "1" when max_error_flag = '1' or rx_watchdog = '1' else "0";
-----------------------------------------------------------------------------
-- C&S registers
-----------------------------------------------------------------------------
src_sel <= src_sel_i;
enable_rx <= enable_rx_i;
uart_regen_bypass <= uart_regen_bypass_i;
uart_bit_div <= bit_div;
upd_max_pos <= upd_max_pos_i;
upd_min_pos <= upd_min_pos_i;
error_rate_thres <= error_rate_thres_i;
rx_watchdog_en <= rx_watchdog_en_i;
rx_watchdog_clr <= rx_watchdog_clr_i;
ext_fp_det <= ext_fp_det_i;
ext_fp_gen <= ext_fp_gen_i;
pCTRL_STATUS : process(reset_n, clk)
begin
if (reset_n = '0') then
avs_readdatavalid <= '0';
src_sel_i <= "00";
enable_rx_i <= '0';
uart_regen_bypass_i <= '0';
upd_max_pos_i <= '0';
upd_min_pos_i <= '0';
bit_div <= "0100";
error_rate_thres_i <= X"0A";
rx_watchdog_en_i <= '1';
rx_watchdog_clr_i <= '0';
mp_sel0 <= X"0";
mp_sel1 <= X"0";
mp_sel2 <= X"0";
mp_sel3 <= X"0";
coarse_time_init <= (others => '0');
fine_time_init <= (others => '0');
time_ld_en <= '0';
ext_fp_det_i <= X"0010";
ext_fp_gen_i <= X"0020";
elsif (clk = '1' and clk'event) then
-- CTRL registers
if (avs_write = '1') then
case avs_address is
when SRC_SEL_REG =>
src_sel_i <= avs_writedata(1 downto 0);
when POF_RX_CTRL =>
enable_rx_i <= avs_writedata(0);
uart_regen_bypass_i <= avs_writedata(1);
upd_max_pos_i <= avs_writedata(2);
upd_min_pos_i <= avs_writedata(3);
bit_div <= avs_writedata(7 downto 4);
when MON_PT_CTRL_REG =>
mp_sel0 <= avs_writedata(3 downto 0);
mp_sel1 <= avs_writedata(7 downto 4);
mp_sel2 <= avs_writedata(11 downto 8);
mp_sel3 <= avs_writedata(15 downto 12);
when COARSE_TIME_INIT_REG =>
coarse_time_init <= avs_writedata;
when FINE_TIME_INIT_REG =>
time_ld_en <= avs_writedata(28);
fine_time_init <= avs_writedata(27 downto 0);
when RX_ERROR_CSR =>
error_rate_thres_i <= avs_writedata(7 downto 0);
rx_watchdog_en_i <= avs_writedata(8);
rx_watchdog_clr_i <= avs_writedata(9);
when IRQ_MNG_REG =>
irq_en <= avs_writedata(0 downto 0);
irq_clr <= avs_writedata(4 downto 4);
irq_mask <= avs_writedata(8 downto 8);
when EXT_FP_CTRL_REG =>
ext_fp_det_i <= avs_writedata(15 downto 0);
ext_fp_gen_i <= avs_writedata(31 downto 16);
when others => null;
end case;
end if;
-- Read Ctrl & Status registers
avs_readdatavalid <= avs_read;
if (avs_read = '1') then
case avs_address is
when CSR_IP_ID_REG =>
avs_readdata <= CSR_IP_ID;
when CSR_IP_VER_REG =>
avs_readdata <= CSR_IP_VER;
when SRC_SEL_REG =>
avs_readdata <= (0 => src_sel_i(0), 1 => src_sel_i(1), others => '0');
when POF_RX_CTRL =>
avs_readdata <= X"000000" & bit_div & upd_min_pos_i & upd_max_pos_i & uart_regen_bypass_i & enable_rx_i;
when MON_PT_CTRL_REG =>
avs_readdata <= X"0000" & mp_sel3 & mp_sel2 & mp_sel1 & mp_sel0;
when COARSE_TIME_INIT_REG =>
avs_readdata <= coarse_time_init;
when FINE_TIME_INIT_REG =>
avs_readdata <= b"000" & time_ld_en & fine_time_init;
when RX_ERROR_STATUS =>
avs_readdata <= skip_pos_cnt & parity_err_cnt;
when FINE_TIME_REG =>
avs_readdata <= X"0" & fine_time_i;
when COARSE_TIME_REG =>
avs_readdata <= coarse_time_i;
when RX_ERROR_CSR =>
avs_readdata <= X"00000" & max_error_flag & rx_watchdog & rx_watchdog_clr_i & rx_watchdog_en_i & error_rate_thres_i;
when IRQ_MNG_REG =>
avs_readdata <= X"0000" & "000" & irq_val & "000" & irq_mask & "000" & irq_clr & "000" & irq_en;
when EXT_FP_CTRL_REG =>
avs_readdata <= ext_fp_gen_i & ext_fp_det_i;
when others =>
avs_readdata <= X"BAD1BAD0";
end case;
end if;
end if;
end process pCTRL_STATUS;
end architecture rtl;

View file

@ -0,0 +1,108 @@
-------------------------------------------------------------------------------
-- Title : fire_pulse_manager
-- Project : GMA
-------------------------------------------------------------------------------
-- File : fire_pulse_ext.vhd
-- Author : Christos Spirotis
-- Company : Global Inkjet Systems
-- Created : 2017-10-03
-- Last update: 2019-07-15
-- SVN ID : Git
-- Standard : VHDL'08
-------------------------------------------------------------------------------
-- Description:
-- Detects external fire pulse and regenerates it
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library work;
entity fire_pulse_ext_3 is
port(
reset_n : in std_logic;
clk : in std_logic; -- 100MHz
ext_fp_det : in std_logic_vector(15 downto 0);
ext_fp_gen : in std_logic_vector(15 downto 0);
ext_in : in std_logic;
ext_out : out std_logic
);
end entity fire_pulse_ext_3;
architecture rtl of fire_pulse_ext_3 is
signal ext_in_cnt : unsigned(15 downto 0);
signal ext_out_cnt : unsigned(15 downto 0);
signal ext_in_det : std_logic_vector( 2 downto 0);
signal fp_gen : std_logic;
begin
-- Detect pulse
pulse_det : process (clk, reset_n)
begin
if (reset_n = '0') then
ext_in_cnt <= (others => '0');
ext_in_det <= (others => '0');
fp_gen <= '0';
elsif rising_edge(clk) then
fp_gen <= '0';
ext_in_det <= ext_in_det(1 downto 0) & ext_in;
-- Detect rising edge while idle
if (ext_in_det(2 downto 1) = "01" and ext_in_cnt = 0) then
-- Start width counter
ext_in_cnt <= X"0001";
-- Measure width while signal high
elsif ext_in_cnt /= 0 and ext_in_det(1) = '1' then
-- Counter++
ext_in_cnt <= ext_in_cnt + 1;
-- If reached minimum width
if ext_in_cnt >= unsigned(ext_fp_det) then
-- Regenerate pulse
fp_gen <= '1';
-- Reset width counter
ext_in_cnt <= (others => '0');
end if;
-- If signal drops before detection
elsif ext_in_cnt /= 0 and ext_in_det(1) = '0' then
-- Reset width counter
ext_in_cnt <= (others => '0');
end if;
end if;
end process pulse_det;
-- Regenerate pulse
pulse_regen : process (clk, reset_n)
begin
if (reset_n = '0') then
ext_out_cnt <= (others => '0');
ext_out <= '0';
elsif rising_edge(clk) then
-- Look for pulse detected
if fp_gen = '1' and ext_out_cnt = 0 then
-- Start width counter
ext_out_cnt <= X"0001";
-- Generate pulse
ext_out <= '1';
-- If counting
elsif ext_out_cnt /= 0 then
-- Increment width
ext_out_cnt <= ext_out_cnt + 1;
-- If width reached programmed value
if ext_out_cnt >= unsigned(ext_fp_gen) then
-- Reset pulse
ext_out <= '0';
-- Reset width counter
ext_out_cnt <= (others => '0');
end if;
end if;
end if;
end process pulse_regen;
end architecture rtl;

View file

@ -0,0 +1,421 @@
-------------------------------------------------------------------------------
-- Title : fire_pulse_manager
-- Project : HMB/EMB/SMB
-------------------------------------------------------------------------------
-- File : fire_pulse_manager.vhd
-- Author : Gianmarco Girau
-- Company : Global Inkjet Systems
-- Created : 2017-09-06
-- Last update: 2019-07-15
-- SVN ID : Git
-- Standard : VHDL'08
-------------------------------------------------------------------------------
-- Description:
-- Generates fire request from the EMS output data, transferred either via POF
-- or through NetSync
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use work.fire_pulse_3_pkg.all;
entity fire_pulse_manager_3 is
port(
reset_n : in std_logic;
clk : in std_logic; -- 100MHz
rx_clk : in std_logic; -- 300MHz (typical)
-- Datapath I/Os
pof_rx : in std_logic;
pof_tx : out std_logic;
pof_iso_en : out std_logic;
fire_pulse : out std_logic_vector(ch_num - 1 downto 0);
mon_pt : out std_logic_vector(3 downto 0); -- Monitoring Points
-- on header J7
-- Interrupt Senders
ins_fpm_irq_0 : out std_logic;
ins_fpm_irq_1 : out std_logic; -- @suppress "Unused port: ins_fpm_irq_1 is not used in work.fire_pulse_manager_1(rtl)"
ins_fpm_irq_2 : out std_logic; -- @suppress "Unused port: ins_fpm_irq_2 is not used in work.fire_pulse_manager_1(rtl)"
ins_fpm_irq_3 : out std_logic; -- @suppress "Unused port: ins_fpm_irq_3 is not used in work.fire_pulse_manager_1(rtl)"
-- Avalon MM (Slave) Interface
avs_address : in std_logic_vector(14 downto 0);
avs_write : in std_logic;
avs_writedata : in std_logic_vector(31 downto 0);
avs_read : in std_logic;
avs_waitrequest : out std_logic;
avs_readdata : out std_logic_vector(31 downto 0));
end entity fire_pulse_manager_3;
architecture rtl of fire_pulse_manager_3 is
constant PD_QUEUE_SIZE : natural := 512;
type diag_cnt_en_t is array (1 to ch_num) of boolean;
constant DIAG_COUNTER_EN : diag_cnt_en_t := (1 => true, others => false);
signal reset_n_i : std_logic;
--
signal cs_addr : std_logic_vector(10 downto 0);
signal cs_write_en : std_logic_vector(blk_num - 1 downto 0);
signal cs_write_data : std_logic_vector(31 downto 0);
signal cs_read_en : std_logic_vector(blk_num - 1 downto 0);
signal cs_read_valid : std_logic_vector(blk_num - 1 downto 0);
signal cs_read_data : std_logic_vector(32 * blk_num - 1 downto 0);
--
signal cs_ctrl_write_en : std_logic;
signal cs_ctrl_read_en : std_logic;
signal cs_ctrl_read_valid : std_logic;
signal cs_ctrl_read_data : std_logic_vector(31 downto 0);
--
signal cs_pg_write_en : std_logic_vector(ch_num - 1 downto 0);
signal cs_pg_read_en : std_logic_vector(ch_num - 1 downto 0);
signal cs_pg_read_valid : std_logic_vector(ch_num - 1 downto 0);
signal cs_pg_read_data : std_logic_vector(32 * ch_num - 1 downto 0);
--
signal cs_nsnk_write_en : std_logic;
signal cs_nsnk_read_en : std_logic;
signal cs_nsnk_read_valid : std_logic;
signal cs_nsnk_read_data : std_logic_vector(31 downto 0);
--
signal cs_log_write_en : std_logic;
signal cs_log_read_en : std_logic;
signal cs_log_read_valid : std_logic;
signal cs_log_read_data : std_logic_vector(31 downto 0);
--
signal cs_ie_write_en : std_logic;
signal cs_ie_read_en : std_logic;
signal cs_ie_read_valid : std_logic;
signal cs_ie_read_data : std_logic_vector(31 downto 0);
--
signal enable_rx : std_logic;
signal uart_regen_bypass : std_logic;
signal upd_max_pos : std_logic;
signal upd_min_pos : std_logic;
signal max_error_flag : std_logic;
signal rx_watchdog : std_logic;
signal rx_watchdog_en : std_logic;
signal rx_watchdog_clr : std_logic;
signal bit_div : std_logic_vector(3 downto 0);
signal error_rate_thres : std_logic_vector(7 downto 0);
signal parity_err_cnt : std_logic_vector(15 downto 0);
signal skip_pos_cnt : std_logic_vector(15 downto 0);
signal mon_point_src : std_logic_vector(15 downto 0);
signal fine_time : std_logic_vector(27 downto 0);
signal coarse_time : std_logic_vector(31 downto 0);
--
signal remote_init : std_logic;
signal dp_dir : std_logic_vector(ch_num - 1 downto 0);
signal set_pos_ie : std_logic;
signal enc_pulse : std_logic;
signal enc_pulse_ie : std_logic;
signal enc_pulse_pof : std_logic;
signal pd_pulse : std_logic;
signal pd_pulse_ie : std_logic;
signal pd_pulse_pof : std_logic;
signal inc_pos : std_logic;
signal inc_pos_pof : std_logic;
signal inc_pos_ie : std_logic;
signal dec_pos : std_logic;
signal dec_pos_pof : std_logic;
signal dec_pos_ie : std_logic;
signal abs_pos : std_logic_vector(31 downto 0);
signal abs_pos_pof : std_logic_vector(31 downto 0);
signal abs_pos_ie : std_logic_vector(39 downto 0);
--
signal ch_pd, ch_pulse_out : std_logic_vector(ch_num - 1 downto 0);
signal ch_raw_pulse, ch_mask : std_logic_vector(ch_num - 1 downto 0);
signal fire_pulse_i : std_logic_vector(ch_num - 1 downto 0);
signal src_sel : std_logic_vector(1 downto 0);
--
signal one_pps : std_logic;
signal ext_fp_det : std_logic_vector(15 downto 0);
signal ext_fp_gen : std_logic_vector(15 downto 0);
signal pof_rx_regen : std_logic;
begin
-----------------------------------------------------------------------------
-- Synchronize the input reset (h2f_reset) to the clock (from PLL)
-----------------------------------------------------------------------------
iSyncReset : entity work.sync_reset
port map(
async_rstN => reset_n,
clk => clk,
sync_rstN => reset_n_i);
-----------------------------------------------------------------------------
-- C&S Register Interface Splitting
-----------------------------------------------------------------------------
iCS_BUS_ITF : entity work.cs_bus_ift
generic map(
blk_num => blk_num)
port map(
rstN => reset_n_i,
clk => clk,
avs_address => avs_address(14 downto 0),
avs_write => avs_write,
avs_writedata => avs_writedata,
avs_read => avs_read,
avs_waitrequest => avs_waitrequest,
avs_readdata => avs_readdata,
cs_addr => cs_addr,
cs_we => cs_write_en,
cs_wr_data => cs_write_data,
cs_re => cs_read_en,
cs_rv => cs_read_valid,
cs_rd_data => cs_read_data);
cs_ctrl_write_en <= cs_write_en(fp_ctrl_id);
cs_pg_write_en_g : for i in 1 to ch_num generate
cs_pg_write_en(i - 1) <= cs_write_en(pg_ch_id + i - 1);
end generate;
cs_nsnk_write_en <= cs_write_en(net_snk_id);
cs_log_write_en <= cs_write_en(log_blk_id);
cs_ie_write_en <= cs_write_en(int_enc_id);
cs_ctrl_read_en <= cs_read_en(fp_ctrl_id);
cs_pg_read_en_g : for i in 1 to ch_num generate
cs_pg_read_en(i - 1) <= cs_read_en(pg_ch_id + i - 1);
end generate;
cs_nsnk_read_en <= cs_read_en(net_snk_id);
cs_log_read_en <= cs_read_en(log_blk_id);
cs_ie_read_en <= cs_read_en(int_enc_id);
cs_read_valid(fp_ctrl_id) <= cs_ctrl_read_valid;
cs_read_valid_pg_g : for i in 1 to ch_num generate
cs_read_valid(pg_ch_id + i - 1) <= cs_pg_read_valid(i - 1);
end generate;
cs_read_valid(net_snk_id) <= cs_nsnk_read_valid;
cs_read_valid(log_blk_id) <= cs_log_read_valid;
cs_read_valid(int_enc_id) <= cs_ie_read_valid;
cs_read_data(31 + 32 * fp_ctrl_id downto 32 * fp_ctrl_id) <= cs_ctrl_read_data;
cs_read_data_pg_g : for i in 1 to ch_num generate
cs_read_data(31 + 32 * (pg_ch_id + i - 1) downto 32 * (pg_ch_id + i - 1)) <= cs_pg_read_data(31 + 32 * (i - 1) downto 32 * (i - 1));
end generate;
cs_read_data(31 + 32 * net_snk_id downto 32 * net_snk_id) <= cs_nsnk_read_data;
cs_read_data(31 + 32 * log_blk_id downto 32 * log_blk_id) <= cs_log_read_data;
cs_read_data(31 + 32 * int_enc_id downto 32 * int_enc_id) <= cs_ie_read_data;
-----------------------------------------------------------------------------
-- Fire-Pulse-Manager Controller
-----------------------------------------------------------------------------
iCTRL : entity work.fire_pulse_ctrl_3
port map(
reset_n => reset_n_i,
clk => clk,
src_sel => src_sel,
uart_regen_bypass => uart_regen_bypass,
upd_max_pos => upd_max_pos,
upd_min_pos => upd_min_pos,
enable_rx => enable_rx,
uart_bit_div => bit_div,
error_rate_thres => error_rate_thres,
max_error_flag => max_error_flag,
rx_watchdog => rx_watchdog,
rx_watchdog_en => rx_watchdog_en,
rx_watchdog_clr => rx_watchdog_clr,
parity_err_cnt => parity_err_cnt,
skip_pos_cnt => skip_pos_cnt,
mon_point_src => mon_point_src,
mon_points => mon_pt,
coarse_time => coarse_time,
fine_time => fine_time,
one_pps => one_pps,
ext_fp_det => ext_fp_det,
ext_fp_gen => ext_fp_gen,
ins_fpm_irq_0 => ins_fpm_irq_0,
avs_address => cs_addr(3 downto 0),
avs_write => cs_ctrl_write_en,
avs_writedata => cs_write_data,
avs_read => cs_ctrl_read_en,
avs_readdatavalid => cs_ctrl_read_valid,
avs_readdata => cs_ctrl_read_data);
ins_fpm_irq_1 <= '0';
ins_fpm_irq_2 <= '0';
ins_fpm_irq_3 <= '0';
-- Output multiplexer
fire_pulse_i <= ch_pulse_out when src_sel(0) = '1' else (others => pof_rx_regen);
fire_pulse <= fire_pulse_i;
pd_pulse <= pd_pulse_pof when src_sel(1) = '0' else pd_pulse_ie;
enc_pulse <= enc_pulse_pof when src_sel(1) = '0' else enc_pulse_ie;
abs_pos <= abs_pos_pof when src_sel(1) = '0' else abs_pos_ie(31 downto 0);
inc_pos <= inc_pos_pof when src_sel(1) = '0' else inc_pos_ie;
dec_pos <= dec_pos_pof when src_sel(1) = '0' else dec_pos_ie;
mon_point_src(0) <= remote_init;
mon_point_src(1) <= dp_dir(0);
mon_point_src(2) <= pd_pulse;
mon_point_src(3) <= enc_pulse;
mon_point_src(4) <= ch_pd(0);
mon_point_src(5) <= ch_pulse_out(0);
mon_point_src(6) <= ch_raw_pulse(0);
mon_point_src(7) <= ch_mask(0);
mon_point_src(8) <= pof_rx;
mon_point_src(9) <= fire_pulse_i(0);
--
mon_point_src(15 downto 10) <= (others => '0');
pof_iso_en <= enable_rx;
-----------------------------------------------------------------------------
-- Pulse Generator
-----------------------------------------------------------------------------
pulse_generator_g : for i in 1 to ch_num generate
iCH_PG : entity work.pulse_generator_1
generic map(
PD_QUEUE_SIZE => PD_QUEUE_SIZE,
PULSE_DELAY_EQUAL_EN => false,
OUT_PULSE_CONDITION => true,
OVERDRIVE_CHECK => false,
DIAG_COUNTERS => DIAG_COUNTER_EN(i))
port map(
clk => clk,
reset_n => reset_n_i,
init => remote_init,
pd_in => pd_pulse,
abs_position => abs_pos,
dp_dir => dp_dir(i - 1),
pulse_out => ch_pulse_out(i - 1),
ch_pd => ch_pd(i - 1),
ch_mask => ch_mask(i - 1),
raw_pulse_out => ch_raw_pulse(i - 1),
enc_pulse => open,
avs_address => cs_addr(9 downto 0),
avs_write => cs_pg_write_en(i - 1),
avs_writedata => cs_write_data,
avs_read => cs_pg_read_en(i - 1),
avs_readdatavalid => cs_pg_read_valid(i - 1),
avs_readdata => cs_pg_read_data(31 + 32 * (i - 1) downto 32 * (i - 1)));
end generate;
-----------------------------------------------------------------------------
-- POF Interface
-----------------------------------------------------------------------------
-- POF Receiver
iPOF_RX : entity work.pof_rx_3
port map(
reset_n => reset_n_i,
clk => clk,
init => '0',
rx_clk => rx_clk,
rx_data => pof_rx,
init_out => remote_init,
dp_dir => dp_dir(0),
enc_out => enc_pulse_pof,
pd_out => pd_pulse_pof,
inc_pos => inc_pos_pof,
dec_pos => dec_pos_pof,
abs_pos => abs_pos_pof,
enable => enable_rx,
bit_div => bit_div,
error_rate_thres => error_rate_thres,
one_pps => one_pps,
upd_max_pos => upd_max_pos,
upd_min_pos => upd_min_pos,
max_error_flag => max_error_flag,
rx_watchdog => rx_watchdog,
rx_watchdog_en => rx_watchdog_en,
rx_watchdog_clr => rx_watchdog_clr,
parity_err_cnt => parity_err_cnt,
skip_pos_cnt => skip_pos_cnt);
-- UART signal regeneration
iUART_REGEN : entity work.uart_regen_3
generic map(
data_width => 8)
port map(
reset_n => reset_n,
clk => rx_clk,
bit_div => bit_div,
enable => enable_rx,
bypass_en => uart_regen_bypass,
uart_rx => pof_rx,
uart_tx => pof_tx);
-----------------------------------------------------------------------------
-- Ext fire pulse regen
-----------------------------------------------------------------------------
fire_pulse_ext_i : entity work.fire_pulse_ext_3
port map(
reset_n => reset_n_i,
clk => clk,
ext_fp_det => ext_fp_det,
ext_fp_gen => ext_fp_gen,
ext_in => pof_rx,
ext_out => pof_rx_regen
);
-----------------------------------------------------------------------------
-- Internal encoder generator
-----------------------------------------------------------------------------
iEMUL : entity work.enc_pd_emul_1
generic map(
SEQ_ENABLE => false)
port map(
clk => clk,
reset_n => reset_n_i,
ttl_pd => open,
ttl_enc_p1 => open,
ttl_enc_p2 => open,
ttl_enc_zp => open,
rs422_pd => pd_pulse_ie,
rs422_enc_p1 => open,
rs422_enc_p2 => open,
rs422_enc_zp => open,
abs_pos_out => abs_pos_ie,
set_pos_out => set_pos_ie,
inc_pos_out => inc_pos_ie,
dec_pos_out => dec_pos_ie,
avs_address => cs_addr(9 downto 0),
avs_write => cs_ie_write_en,
avs_writedata => cs_write_data,
avs_read => cs_ie_read_en,
avs_readdatavalid => cs_ie_read_valid,
avs_readdata => cs_ie_read_data);
enc_pulse_ie <= inc_pos_ie when dp_dir(0) = '0' else dec_pos_ie;
-----------------------------------------------------------------------------
-- NetSync Sink
-----------------------------------------------------------------------------
-- Not instantiated yet
pNSNK_RD_VALID : process(clk)
begin
if (clk = '1' and clk'event) then
cs_nsnk_read_valid <= cs_nsnk_read_en;
end if;
end process pNSNK_RD_VALID;
cs_nsnk_read_data <= X"DEAD_BEEF";
-----------------------------------------------------------------------------
-- Event Logger
-----------------------------------------------------------------------------
-- Not instantiated yet
pLOG_RD_VALID : process(clk)
begin
if (clk = '1' and clk'event) then
cs_log_read_valid <= cs_log_read_en;
end if;
end process pLOG_RD_VALID;
cs_log_read_data <= X"DEAD_BEEF";
end architecture rtl;

View file

@ -0,0 +1,358 @@
-------------------------------------------------------------------------------
-- Title : pof_rx
-- Project : SMB
-------------------------------------------------------------------------------
-- File : pof_rx.vhd
-- Author : Gianmarco Girau
-- Company : Global Inkjet Systems
-- Created : 2017-08-23
-- Last update: 2019-07-15
-- SVN ID : Git
-- Standard : VHDL'08
-------------------------------------------------------------------------------
-- Description:
-- Deserializes and decodes the EMS (SMB) output, received from the POF.
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity pof_rx_3 is
port(
reset_n : in std_logic;
clk : in std_logic;
--
init : in std_logic;
rx_clk : in std_logic;
rx_data : in std_logic;
init_out : out std_logic;
dp_dir : in std_logic;
enc_out : out std_logic;
pd_out : out std_logic;
inc_pos : out std_logic;
dec_pos : out std_logic;
abs_pos : out std_logic_vector(31 downto 0);
-- C&S
enable : in std_logic;
bit_div : in std_logic_vector(3 downto 0);
error_rate_thres : in std_logic_vector(7 downto 0);
one_pps : in std_logic;
upd_max_pos : in std_logic;
upd_min_pos : in std_logic;
max_error_flag : out std_logic;
rx_watchdog : out std_logic;
rx_watchdog_en : in std_logic;
rx_watchdog_clr : in std_logic;
parity_err_cnt : out std_logic_vector(15 downto 0);
skip_pos_cnt : out std_logic_vector(15 downto 0));
end entity pof_rx_3;
architecture rtl of pof_rx_3 is
-- check the parity bit (odd parity)
function odd_parity_check(data : std_logic_vector) return std_logic is
variable parity_bit : std_logic := '0';
begin
for n in 0 to data'length - 1 loop
parity_bit := parity_bit xor data(n);
end loop; -- n
return parity_bit;
end function odd_parity_check;
-- Gray-to-Binary coding
function gray2bin(gray : std_logic_vector) return std_logic_vector is
variable bin : std_logic_vector(gray'range);
begin
bin(gray'length - 1) := gray(gray'length - 1);
for i in gray'length - 2 downto 0 loop
bin(i) := bin(i + 1) xor gray(i);
end loop; -- n
return bin;
end function gray2bin;
signal clear, symbol_ok, inc_pos_i, dec_pos_i : std_logic;
signal sync_gen, pd_gen, symbol_error, sync_d : std_logic;
signal symbol_valid, symbol_valid_i, symbol_valid_d : std_logic;
signal toggle_sync, sync_confirmed, sync_toggle_test, sync : std_logic;
signal toggle_pd, pd_confirmed, pd_toggle_test, pd : std_logic;
signal valid_pos, upd_pos, corr_done, corr_sign : std_logic;
signal skip_pos, apply_corr, inc_pos_ii, dec_pos_ii : std_logic;
signal new_max, new_min, rx_error, rx_error_i : std_logic;
signal rx_symbol_val, clear_i, skip_pos_d, pos_recovery : std_logic;
signal dp_dir_d, dp_dir_change, max_error_flag_i : std_logic;
--
signal clk_cnt : std_logic_vector(1 downto 0);
signal dist, abs_dist, skip_cnt : std_logic_vector(3 downto 0);
signal next_pos_lsb, curr_pos_lsb : std_logic_vector(3 downto 0);
signal pos_corr, max_dist, rx_error_v : std_logic_vector(3 downto 0);
signal gray_pos, rx_symbol_val_v : std_logic_vector(3 downto 0);
signal symbol, symbol_i, rx_symbol : std_logic_vector(7 downto 0);
signal rx_wd_cnt : std_logic_vector(9 downto 0);
signal parity_err_cnt_i, skip_pos_cnt_i : std_logic_vector(15 downto 0);
signal error_rate_cnt, error_rate : std_logic_vector(15 downto 0);
signal abs_pos_i, pos_max, pos_min : std_logic_vector(31 downto 0);
signal dist_pos, dist_neg : std_logic_vector(31 downto 0);
begin
clear <= not enable or init;
-----------------------------------------------------------------------------
-- De-serialize symbols (Serial clock at 300 MHz - typical)
-----------------------------------------------------------------------------
iRX_SYMBOL : entity work.uart_rx_3
generic map(
data_width => 8)
port map(
reset_n => reset_n,
clk => rx_clk,
bit_div => bit_div,
init => clear_i,
data_out => rx_symbol,
data_out_valid => rx_symbol_val,
rx_error => rx_error,
rx_data => rx_data);
-- Synchronize to the local clock
pLATCH_RX_DATA : process(rx_clk)
begin
if (rx_clk = '1' and rx_clk'event) then
if (rx_symbol_val = '1') then
symbol <= rx_symbol;
end if;
if (rx_symbol_val = '1') then
rx_symbol_val_v <= "1111";
else
rx_symbol_val_v <= '0' & rx_symbol_val_v(3 downto 1);
end if;
if (rx_error = '1') then
rx_error_v <= "1111";
else
rx_error_v <= '0' & rx_error_v(3 downto 1);
end if;
end if;
end process pLATCH_RX_DATA;
iSYNC_SYMBOL_VAL : entity work.sync_wire_rEdge
generic map(rst_val => '0', sync_stages => 3)
port map(rstN => reset_n, clk => clk, async_in => rx_symbol_val_v(0), sync_out => symbol_valid);
iSYNC_RX_ERROR : entity work.sync_wire_rEdge
generic map(rst_val => '0', sync_stages => 3)
port map(rstN => reset_n, clk => clk, async_in => rx_error_v(0), sync_out => rx_error_i);
-- synchronize clear to tx_clk
iSYNC_CLEAR : entity work.sync_wire
generic map(rst_val => '1', sync_stages => 2)
port map(
rstN => reset_n, clk => rx_clk, async_in => clear, sync_out => clear_i);
-----------------------------------------------------------------------------
-- Toggle-Bits Decoding
-----------------------------------------------------------------------------
pTOGGLE_DEC : process(clk)
begin
if (clk = '1' and clk'event) then
-- Toggle Bits
if (clear = '1') then
toggle_sync <= '0';
elsif (sync_confirmed = '1') then
toggle_sync <= not toggle_sync;
end if;
if (clear = '1' or sync_confirmed = '1' or (symbol_valid_i = '1' and symbol_i(0) = toggle_sync)) then
sync_toggle_test <= '0';
elsif (sync_gen = '1') then
sync_toggle_test <= '1';
end if;
sync <= sync_confirmed;
sync_d <= sync;
if (clear = '1') then
toggle_pd <= '0';
elsif (pd_confirmed = '1') then
toggle_pd <= not toggle_pd;
end if;
if (clear = '1' or pd_confirmed = '1' or (symbol_valid_i = '1' and symbol_i(2) = toggle_pd)) then
pd_toggle_test <= '0';
elsif (pd_gen = '1') then
pd_toggle_test <= '1';
end if;
pd <= pd_confirmed;
--
symbol_valid_i <= symbol_valid and symbol_ok;
symbol_error <= symbol_valid and not symbol_ok;
if (clear = '1') then
parity_err_cnt_i <= (others => '0');
elsif (symbol_error = '1') then
parity_err_cnt_i <= std_logic_vector(unsigned(parity_err_cnt_i) + 1);
end if;
end if;
end process pTOGGLE_DEC;
symbol_i <= symbol;
-- The received symbol is assumed to be vaild when there is not parity error
-- and when the two bits with the PD-toggle bit are equal
symbol_ok <= '1' when odd_parity_check(symbol) = '1' and (symbol(1) = symbol(2)) else '0';
sync_gen <= '1' when symbol_valid_i = '1' and symbol_i(0) /= toggle_sync else '0';
pd_gen <= '1' when symbol_valid_i = '1' and symbol_i(2) /= toggle_pd else '0';
--
sync_confirmed <= sync_gen and sync_toggle_test;
pd_confirmed <= pd_gen and pd_toggle_test;
--
init_out <= sync;
pd_out <= pd;
parity_err_cnt <= parity_err_cnt_i;
-----------------------------------------------------------------------------
-- Position management & Error Recovery
-----------------------------------------------------------------------------
gray_pos <= symbol_i(6 downto 3);
next_pos_lsb <= gray2bin(gray_pos);
curr_pos_lsb <= abs_pos_i(3 downto 0);
--dist <= std_logic_vector(signed(next_pos_lsb)-signed(curr_pos_lsb));
abs_dist <= dist when dist(3) = '0' else std_logic_vector(unsigned(not dist) + 1);
pPOS_MNG : process(clk)
begin
if (clk = '1' and clk'event) then
dist <= std_logic_vector(signed(next_pos_lsb) - signed(curr_pos_lsb));
symbol_valid_d <= symbol_valid_i;
if (clear = '1' or (symbol_valid_d = '1' and signed(dist) = 0) or pos_recovery = '1') then
max_dist <= "0001";
elsif (skip_pos = '1' or rx_error_i = '1') then
max_dist <= std_logic_vector(unsigned(max_dist) + 1);
end if;
if (symbol_valid_d = '1' and valid_pos = '1') then
pos_corr <= abs_dist;
elsif (apply_corr = '1') then
pos_corr <= std_logic_vector(unsigned(pos_corr) - 1);
end if;
if (clear = '1' or corr_done = '1') then
upd_pos <= '0';
elsif (symbol_valid_d = '1' and valid_pos = '1') then
upd_pos <= '1';
end if;
if (upd_pos = '0' or unsigned(clk_cnt) = 2) then
clk_cnt <= (others => '0');
else
clk_cnt <= std_logic_vector(unsigned(clk_cnt) + 1);
end if;
if (symbol_valid_d = '1' and valid_pos = '1') then
corr_sign <= dist(3);
end if;
inc_pos_i <= inc_pos_ii;
dec_pos_i <= dec_pos_ii;
inc_pos <= inc_pos_i;
dec_pos <= dec_pos_i;
if (clear = '1' or sync = '1') then
abs_pos_i <= (others => '0');
elsif (inc_pos_ii = '1') then
abs_pos_i <= std_logic_vector(signed(abs_pos_i) + 1);
elsif (dec_pos_ii = '1') then
abs_pos_i <= std_logic_vector(signed(abs_pos_i) - 1);
end if;
abs_pos <= abs_pos_i;
skip_pos_d <= skip_pos;
if (clear = '1' or (symbol_valid_d = '1' and valid_pos = '1')) then
skip_cnt <= (others => '0');
elsif (skip_pos = '1' and skip_pos_d = '0') then
skip_cnt <= std_logic_vector(unsigned(skip_cnt) + 1);
end if;
if (clear = '1') then
skip_pos_cnt_i <= (others => '0');
elsif (skip_pos_d = '1') then
skip_pos_cnt_i <= std_logic_vector(unsigned(skip_pos_cnt_i) + 1);
end if;
end if;
end process pPOS_MNG;
skip_pos <= '1' when (symbol_valid = '1' and symbol_ok = '0') or (symbol_valid_d = '1' and valid_pos = '0') else '0';
pos_recovery <= '1' when unsigned(skip_cnt) >= 3 else '0';
valid_pos <= '1' when unsigned(abs_dist) <= unsigned(max_dist) or pos_recovery = '1' else '0';
apply_corr <= '1' when upd_pos = '1' and clk_cnt = "01" else '0';
corr_done <= '1' when signed(dist) = 0 else '0';
inc_pos_ii <= '1' when apply_corr = '1' and corr_sign = '0' else '0';
dec_pos_ii <= '1' when apply_corr = '1' and corr_sign = '1' else '0';
skip_pos_cnt <= skip_pos_cnt_i;
-----------------------------------------------------------------------------
-- Additional logic for error reporting
-----------------------------------------------------------------------------
pERROR_REPORTING : process(clk)
begin
if (clk = '1' and clk'event) then
if (clear = '1' or one_pps = '1') then
error_rate_cnt <= (others => '0');
elsif (symbol_error = '1') then
error_rate_cnt <= std_logic_vector(unsigned(error_rate_cnt) + 1);
end if;
if (clear = '1') then
error_rate <= (others => '0');
elsif (one_pps = '1') then
error_rate <= error_rate_cnt;
end if;
max_error_flag <= not clear and max_error_flag_i;
if (clear = '1' or symbol_valid_i = '1' or rx_watchdog_clr = '1') then
rx_wd_cnt <= (others => '0');
else
rx_wd_cnt <= std_logic_vector(unsigned(rx_wd_cnt) + 1);
end if;
if (clear = '1' or rx_watchdog_clr = '1' or rx_watchdog_en = '0' or sync = '1') then
rx_watchdog <= '0';
elsif (unsigned(rx_wd_cnt) > 1000) then
rx_watchdog <= '1';
end if;
end if;
end process pERROR_REPORTING;
max_error_flag_i <= '1' when unsigned(error_rate) > unsigned(error_rate_thres) else '0';
-----------------------------------------------------------------------------
-- Encoder Pulse management
-----------------------------------------------------------------------------
-- Encoder pulses are generated only when there is an increment of the
-- position in the intended direction, which exceeds the previous maximum.
-- The value of the maximum is reset in the following situations:
-- 1. After a Init/Sync pulse
-- 2. After a direction change
-- 3. When the distance between the current position and the previous maximum
-- exceeds a programmable threshold, where the threshold is a 32 bit signed
-- number. Only the 16 MSBs of this threshold can be configured. The threshold
-- is set to the maximum value by default (e.g.: (2^23 = 8388608)
pENC_MNG : process(clk)
begin
if (clk = '1' and clk'event) then
dp_dir_d <= dp_dir;
if (sync_d = '1' or dp_dir_change = '1' or new_max = '1' or upd_max_pos = '1') then
pos_max <= abs_pos_i;
end if;
if (sync_d = '1' or dp_dir_change = '1' or new_min = '1' or upd_min_pos = '1') then
pos_min <= abs_pos_i;
end if;
enc_out <= new_min or new_max;
end if;
end process pENC_MNG;
dp_dir_change <= dp_dir xor dp_dir_d;
dist_pos <= std_logic_vector(signed(abs_pos_i) - signed(pos_max));
dist_neg <= std_logic_vector(signed(pos_min) - signed(abs_pos_i));
new_max <= '1' when inc_pos_i = '1' and dp_dir = '0' and dist_pos(31) = '0' and unsigned(dist_pos(3 downto 0)) /= 0 else '0';
new_min <= '1' when dec_pos_i = '1' and dp_dir = '1' and dist_neg(31) = '0' and unsigned(dist_neg(3 downto 0)) /= 0 else '0';
end architecture rtl;

View file

@ -0,0 +1,201 @@
-- megafunction wizard: %FIFO%
-- GENERATION: STANDARD
-- VERSION: WM1.0
-- MODULE: scfifo
-- ============================================================
-- File Name: fifo_16x8.vhd
-- Megafunction Name(s):
-- scfifo
--
-- Simulation Library Files(s):
-- altera_mf
-- ============================================================
-- ************************************************************
-- THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE!
--
-- 16.0.2 Build 222 07/20/2016 SJ Lite Edition
-- ************************************************************
--Copyright (C) 1991-2016 Altera Corporation. All rights reserved.
--Your use of Altera Corporation's design tools, logic functions
--and other software and tools, and its AMPP partner logic
--functions, and any output files from any of the foregoing
--(including device programming or simulation files), and any
--associated documentation or information are expressly subject
--to the terms and conditions of the Altera Program License
--Subscription Agreement, the Altera Quartus Prime License Agreement,
--the Altera MegaCore Function License Agreement, or other
--applicable license agreement, including, without limitation,
--that your use is for the sole purpose of programming logic
--devices manufactured by Altera and sold by Altera or its
--authorized distributors. Please refer to the applicable
--agreement for further details.
LIBRARY ieee;
USE ieee.std_logic_1164.all;
LIBRARY altera_mf;
USE altera_mf.all;
ENTITY fifo_16x8_3 IS
PORT
(
clock : IN STD_LOGIC ;
data : IN STD_LOGIC_VECTOR (7 DOWNTO 0);
rdreq : IN STD_LOGIC ;
sclr : IN STD_LOGIC ;
wrreq : IN STD_LOGIC ;
empty : OUT STD_LOGIC ;
full : OUT STD_LOGIC ;
q : OUT STD_LOGIC_VECTOR (7 DOWNTO 0);
usedw : OUT STD_LOGIC_VECTOR (3 DOWNTO 0)
);
END fifo_16x8_3;
ARCHITECTURE SYN OF fifo_16x8_3 IS
SIGNAL sub_wire0 : STD_LOGIC ;
SIGNAL sub_wire1 : STD_LOGIC ;
SIGNAL sub_wire2 : STD_LOGIC_VECTOR (7 DOWNTO 0);
SIGNAL sub_wire3 : STD_LOGIC_VECTOR (3 DOWNTO 0);
COMPONENT scfifo
GENERIC (
add_ram_output_register : STRING;
intended_device_family : STRING;
lpm_hint : STRING;
lpm_numwords : NATURAL;
lpm_showahead : STRING;
lpm_type : STRING;
lpm_width : NATURAL;
lpm_widthu : NATURAL;
overflow_checking : STRING;
underflow_checking : STRING;
use_eab : STRING
);
PORT (
clock : IN STD_LOGIC ;
data : IN STD_LOGIC_VECTOR (7 DOWNTO 0);
rdreq : IN STD_LOGIC ;
sclr : IN STD_LOGIC ;
wrreq : IN STD_LOGIC ;
empty : OUT STD_LOGIC ;
full : OUT STD_LOGIC ;
q : OUT STD_LOGIC_VECTOR (7 DOWNTO 0);
usedw : OUT STD_LOGIC_VECTOR (3 DOWNTO 0)
);
END COMPONENT;
BEGIN
empty <= sub_wire0;
full <= sub_wire1;
q <= sub_wire2(7 DOWNTO 0);
usedw <= sub_wire3(3 DOWNTO 0);
scfifo_component : scfifo
GENERIC MAP (
add_ram_output_register => "ON",
intended_device_family => "Cyclone V",
lpm_hint => "RAM_BLOCK_TYPE=MLAB",
lpm_numwords => 16,
lpm_showahead => "OFF",
lpm_type => "scfifo",
lpm_width => 8,
lpm_widthu => 4,
overflow_checking => "ON",
underflow_checking => "ON",
use_eab => "ON"
)
PORT MAP (
clock => clock,
data => data,
rdreq => rdreq,
sclr => sclr,
wrreq => wrreq,
empty => sub_wire0,
full => sub_wire1,
q => sub_wire2,
usedw => sub_wire3
);
END SYN;
-- ============================================================
-- CNX file retrieval info
-- ============================================================
-- Retrieval info: PRIVATE: AlmostEmpty NUMERIC "0"
-- Retrieval info: PRIVATE: AlmostEmptyThr NUMERIC "-1"
-- Retrieval info: PRIVATE: AlmostFull NUMERIC "0"
-- Retrieval info: PRIVATE: AlmostFullThr NUMERIC "-1"
-- Retrieval info: PRIVATE: CLOCKS_ARE_SYNCHRONIZED NUMERIC "0"
-- Retrieval info: PRIVATE: Clock NUMERIC "0"
-- Retrieval info: PRIVATE: Depth NUMERIC "16"
-- Retrieval info: PRIVATE: Empty NUMERIC "1"
-- Retrieval info: PRIVATE: Full NUMERIC "1"
-- Retrieval info: PRIVATE: INTENDED_DEVICE_FAMILY STRING "Cyclone V"
-- Retrieval info: PRIVATE: LE_BasedFIFO NUMERIC "0"
-- Retrieval info: PRIVATE: LegacyRREQ NUMERIC "1"
-- Retrieval info: PRIVATE: MAX_DEPTH_BY_9 NUMERIC "0"
-- Retrieval info: PRIVATE: OVERFLOW_CHECKING NUMERIC "0"
-- Retrieval info: PRIVATE: Optimize NUMERIC "1"
-- Retrieval info: PRIVATE: RAM_BLOCK_TYPE NUMERIC "1"
-- Retrieval info: PRIVATE: SYNTH_WRAPPER_GEN_POSTFIX STRING "0"
-- Retrieval info: PRIVATE: UNDERFLOW_CHECKING NUMERIC "0"
-- Retrieval info: PRIVATE: UsedW NUMERIC "1"
-- Retrieval info: PRIVATE: Width NUMERIC "8"
-- Retrieval info: PRIVATE: dc_aclr NUMERIC "0"
-- Retrieval info: PRIVATE: diff_widths NUMERIC "0"
-- Retrieval info: PRIVATE: msb_usedw NUMERIC "0"
-- Retrieval info: PRIVATE: output_width NUMERIC "8"
-- Retrieval info: PRIVATE: rsEmpty NUMERIC "1"
-- Retrieval info: PRIVATE: rsFull NUMERIC "0"
-- Retrieval info: PRIVATE: rsUsedW NUMERIC "0"
-- Retrieval info: PRIVATE: sc_aclr NUMERIC "0"
-- Retrieval info: PRIVATE: sc_sclr NUMERIC "1"
-- Retrieval info: PRIVATE: wsEmpty NUMERIC "0"
-- Retrieval info: PRIVATE: wsFull NUMERIC "1"
-- Retrieval info: PRIVATE: wsUsedW NUMERIC "0"
-- Retrieval info: LIBRARY: altera_mf altera_mf.altera_mf_components.all
-- Retrieval info: CONSTANT: ADD_RAM_OUTPUT_REGISTER STRING "ON"
-- Retrieval info: CONSTANT: INTENDED_DEVICE_FAMILY STRING "Cyclone V"
-- Retrieval info: CONSTANT: LPM_HINT STRING "RAM_BLOCK_TYPE=MLAB"
-- Retrieval info: CONSTANT: LPM_NUMWORDS NUMERIC "16"
-- Retrieval info: CONSTANT: LPM_SHOWAHEAD STRING "OFF"
-- Retrieval info: CONSTANT: LPM_TYPE STRING "scfifo"
-- Retrieval info: CONSTANT: LPM_WIDTH NUMERIC "8"
-- Retrieval info: CONSTANT: LPM_WIDTHU NUMERIC "4"
-- Retrieval info: CONSTANT: OVERFLOW_CHECKING STRING "ON"
-- Retrieval info: CONSTANT: UNDERFLOW_CHECKING STRING "ON"
-- Retrieval info: CONSTANT: USE_EAB STRING "ON"
-- Retrieval info: USED_PORT: clock 0 0 0 0 INPUT NODEFVAL "clock"
-- Retrieval info: USED_PORT: data 0 0 8 0 INPUT NODEFVAL "data[7..0]"
-- Retrieval info: USED_PORT: empty 0 0 0 0 OUTPUT NODEFVAL "empty"
-- Retrieval info: USED_PORT: full 0 0 0 0 OUTPUT NODEFVAL "full"
-- Retrieval info: USED_PORT: q 0 0 8 0 OUTPUT NODEFVAL "q[7..0]"
-- Retrieval info: USED_PORT: rdreq 0 0 0 0 INPUT NODEFVAL "rdreq"
-- Retrieval info: USED_PORT: sclr 0 0 0 0 INPUT NODEFVAL "sclr"
-- Retrieval info: USED_PORT: usedw 0 0 4 0 OUTPUT NODEFVAL "usedw[3..0]"
-- Retrieval info: USED_PORT: wrreq 0 0 0 0 INPUT NODEFVAL "wrreq"
-- Retrieval info: CONNECT: @clock 0 0 0 0 clock 0 0 0 0
-- Retrieval info: CONNECT: @data 0 0 8 0 data 0 0 8 0
-- Retrieval info: CONNECT: @rdreq 0 0 0 0 rdreq 0 0 0 0
-- Retrieval info: CONNECT: @sclr 0 0 0 0 sclr 0 0 0 0
-- Retrieval info: CONNECT: @wrreq 0 0 0 0 wrreq 0 0 0 0
-- Retrieval info: CONNECT: empty 0 0 0 0 @empty 0 0 0 0
-- Retrieval info: CONNECT: full 0 0 0 0 @full 0 0 0 0
-- Retrieval info: CONNECT: q 0 0 8 0 @q 0 0 8 0
-- Retrieval info: CONNECT: usedw 0 0 4 0 @usedw 0 0 4 0
-- Retrieval info: GEN_FILE: TYPE_NORMAL fifo_16x8.vhd TRUE
-- Retrieval info: GEN_FILE: TYPE_NORMAL fifo_16x8.inc FALSE
-- Retrieval info: GEN_FILE: TYPE_NORMAL fifo_16x8.cmp FALSE
-- Retrieval info: GEN_FILE: TYPE_NORMAL fifo_16x8.bsf FALSE
-- Retrieval info: GEN_FILE: TYPE_NORMAL fifo_16x8_inst.vhd FALSE
-- Retrieval info: LIB_FILE: altera_mf

View file

@ -0,0 +1,715 @@
-------------------------------------------------------------------------------
-- Title : fire_pulse_manager_tb
-- Project : fire_pulse_manager
-------------------------------------------------------------------------------
-- File : fire_pulse_manager_tb.vhd
-- Author : Christos Spirotis
-- Company : Global Inkjet Systems
-- Created : 2018-08-10
-- Last update: 2019-07-15
-- SVN ID : Git
-- Standard : VHDL'08
-------------------------------------------------------------------------------
-- Description:
-- Testbench for fire pulse manager block
-------------------------------------------------------------------------------
library modelsim_lib;
use modelsim_lib.util.all;
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use ieee.math_real.all;
use std.textio.all;
library work;
use work.fire_pulse_3_pkg.all;
use work.log_pkg.all;
use work.avalon_verify_pkg.all;
use work.pulse_generator_1_pkg.all;
use work.enc_pd_emul_1_pkg.CSR_ENC_NCO_INC_ADDR;
use work.enc_pd_emul_1_pkg.CSR_ENC_CTRL_ADDR;
use work.enc_pd_emul_1_pkg.CSR_PD_CTRL_ADDR;
use work.enc_pd_emul_1_pkg.CSR_OUT_ENABLE_ADDR;
use work.enc_pd_emul_1_pkg.CSR_PULSE_NUM_ADDR;
library osvvm;
use osvvm.RandomPkg.all;
entity fire_pulse_manager_3_tb is
end fire_pulse_manager_3_tb;
architecture behav of fire_pulse_manager_3_tb is
constant CH_NUM : integer := 4;
constant DEV_NUM : integer := 2;
constant CLK_PERIOD : time := 10.0 ns;
constant CLK_FREQ : real := 100.0e6;
-- TODO Try different receive oversampling ratios - 300MHz is in the real system
constant RX_CLK_PERIOD : time := CLK_PERIOD / 3; -- clock period for used by the
-- UART-Rx on the POF
constant POF_DELAY : time := 30 ns; -- Total delay from POF-Tx input to POF-Rx output
constant NUM_ITERATIONS : natural := 5;
constant SWATHE_LEN : integer := 600;
constant START_DIR : std_logic := '0';
constant TIME_INT : time := 5000 ns;
constant VERBOSITY_LEVEL : verb_level_t := VMEDIUM;
type ch_offset_t is array (0 to CH_NUM - 1) of integer;
signal ch_offset : ch_offset_t := (100, 308, 316, 324);
type avs_read_bus_t is array (0 to DEV_NUM - 1) of std_logic_vector(31 downto 0);
signal reset_n : std_logic := '0';
signal clk : std_logic := '0';
signal rx_clk : std_logic := '0';
signal pof_tx, pof_rx : std_logic;
signal ch_pulse_out : std_logic_vector(3 downto 0);
signal avs_address : std_logic_vector(14 downto 0);
signal avs_write : std_logic_vector(DEV_NUM - 1 downto 0);
signal avs_writedata : std_logic_vector(31 downto 0);
signal avs_read : std_logic_vector(DEV_NUM - 1 downto 0);
signal avs_waitrequest : std_logic_vector(DEV_NUM - 1 downto 0);
signal avs_readdata : avs_read_bus_t;
--
signal init_tx : std_logic;
signal pd_in : std_logic;
signal pd_spy : std_logic;
signal inc_pos : std_logic;
signal dec_pos : std_logic;
signal abs_position : std_logic_vector(31 downto 0);
signal abs_spy : std_logic_vector(31 downto 0);
signal tx_data : std_logic;
signal pof_tx_avs_rv : std_logic;
signal pof_tx_avs_we_d : std_logic;
--
signal abs_position_d : std_logic_vector(31 downto 0);
signal dir_in : std_logic;
signal swathe_cnt : integer;
signal swathe_pos : integer;
signal end_of_swathe : std_logic;
signal test_completed : boolean;
signal running : boolean;
signal configuring : boolean;
signal passed : boolean;
signal failed : boolean;
signal stimuli_completed : boolean;
signal detected_error : boolean := false;
signal registers_read : boolean := false;
signal reprogram_offset : boolean := false;
--
signal avs_m : mm_m_rec_t;
signal avs_s : mm_s_rec_t;
signal sel_slave_0 : std_logic;
signal sel_slave_1 : std_logic;
--
type pd_cnt_t is array (0 to CH_NUM - 1) of integer;
signal pd_cnt : pd_cnt_t;
type fp_cnt_t is array (0 to CH_NUM - 1) of integer;
signal fp_cnt : fp_cnt_t;
-- generate the NCO increment corresponding to a given output frequency
function freq2NCO_inc(
f_out : real; f_clk : real) return std_logic_vector is
variable nco_inc : std_logic_vector(31 downto 0);
begin
nco_inc := std_logic_vector(to_unsigned(integer((f_out / f_clk) * (2.0**32)), 32));
return nco_inc;
end function freq2NCO_inc;
begin -- behav
clk_pr : process
begin
clk <= '0';
wait for 0.5 * CLK_PERIOD;
clk <= '1';
wait for 0.5 * CLK_PERIOD;
end process clk_pr;
rx_clk_pr : process
begin
rx_clk <= '0';
wait for 0.5 * RX_CLK_PERIOD;
rx_clk <= '1';
wait for 0.5 * RX_CLK_PERIOD;
end process rx_clk_pr;
-----------------------------------------------------------------------------
-- DUTs : Fire Pulse Manager
-----------------------------------------------------------------------------
iDUT : entity work.fire_pulse_manager_3
port map(
reset_n => reset_n,
clk => clk,
rx_clk => rx_clk,
pof_rx => pof_rx,
pof_tx => pof_tx,
fire_pulse => ch_pulse_out,
mon_pt => open,
ins_fpm_irq_0 => open,
ins_fpm_irq_1 => open,
ins_fpm_irq_2 => open,
ins_fpm_irq_3 => open,
avs_address => avs_address,
avs_write => avs_write(0),
avs_writedata => avs_writedata,
avs_read => avs_read(0),
avs_waitrequest => avs_waitrequest(0),
avs_readdata => avs_readdata(0)
);
pof_rx <= transport tx_data after POF_DELAY;
-----------------------------------------------------------------------------
-- POF Tx
-----------------------------------------------------------------------------
iPOF_TX : entity work.pof_tx_3
port map(
reset_n => reset_n,
clk => clk,
init => init_tx,
pd_in => pd_in,
inc_pos => inc_pos,
dec_pos => dec_pos,
abs_position => abs_position,
tx_data => tx_data,
avs_address => avs_address(2 downto 0),
avs_write => avs_write(1),
avs_writedata => avs_writedata,
avs_read => avs_read(1),
avs_readdatavalid => pof_tx_avs_rv,
avs_readdata => avs_readdata(1));
-- Generate a dummy waitrequest for the POF-tx
pPOF_TX_DUMMY_WR : process(clk)
begin
if(clk = '1' and clk'event) then
pof_tx_avs_we_d <= avs_write(1);
end if;
end process pPOF_TX_DUMMY_WR;
avs_waitrequest(1) <= '0' when pof_tx_avs_we_d = '1' or pof_tx_avs_rv = '1' else '0';
-----------------------------------------------------------------------------
-- Stimuli Generation
-----------------------------------------------------------------------------
pSTIMULI_REGs : process(clk)
begin
if (clk = '1' and clk'event) then
abs_position_d <= abs_position;
end if;
end process pSTIMULI_REGs;
inc_pos <= '1' when signed(abs_position) = signed(abs_position_d) + 1 else '0';
dec_pos <= '1' when signed(abs_position) = signed(abs_position_d) - 1 else '0';
pSTIMULI : process
variable end_of_stimuli : boolean;
variable rv : RandomPType;
begin
-- initialization
init_tx <= '0';
dir_in <= START_DIR;
pd_in <= '0';
abs_position <= (others => '0');
swathe_pos <= 0;
--
swathe_cnt <= 0;
stimuli_completed <= false;
end_of_swathe <= '0';
-- generating the stimulus
wait until running = true;
wait for 200 ns;
-- Send a Init/Sync pulse
wait until clk = '1' and clk'event;
init_tx <= '1';
wait until clk = '1' and clk'event;
init_tx <= '0';
wait for 500 ns;
--
-- generate the forward swathe
end_of_stimuli := false;
while end_of_stimuli = false loop
swathe_pos <= 0;
for i in 0 to CH_NUM - 1 loop
ch_offset(i) <= rv.RandInt(0, 379);
end loop;
reprogram_offset <= true;
wait until configuring = true;
reprogram_offset <= false;
wait until configuring = false;
wait until clk = '1' and clk'event;
while swathe_pos /= SWATHE_LEN loop
--generate a position increment
swathe_pos <= swathe_pos + 1;
if (dir_in = '0') then
abs_position <= std_logic_vector(signed(abs_position) + 1);
else
abs_position <= std_logic_vector(signed(abs_position) - 1);
end if;
--
if (swathe_pos = 16) then
-- generate a PD increment: the PD might be either concurren or not
-- to the position increment
wait for 0.5 * CLK_PERIOD;
pd_in <= '1';
wait for 100 ns;
wait until clk = '1' and clk'event;
pd_in <= '0';
end if;
wait for TIME_INT;
end loop; -- swathe_pos /= SWATHE_LEN
wait for 25 us;
end_of_swathe <= '1';
wait until clk = '1' and clk'event;
end_of_swathe <= '0';
-- reverse direction
if (dir_in /= START_DIR) then
if (swathe_cnt = NUM_ITERATIONS - 1) then
end_of_stimuli := true;
else
swathe_cnt <= swathe_cnt + 1;
end if;
end if;
if (end_of_stimuli = false) then
wait until clk = '1' and clk'event;
dir_in <= not dir_in;
-- Wait some time to make sure the change of direction is transmitted.
-- Note: if the position starts changing before the receiver was able to
-- confirm the change of direction, then some encoder pulses may not be
-- generated
wait for 1 us;
wait until clk = '1' and clk'event;
end if;
end loop; -- end_of_stimuli = false
stimuli_completed <= true;
wait;
end process pSTIMULI;
-----------------------------------------------------------------------------
-- Testbench Control
-----------------------------------------------------------------------------
pTB_CTRL : process
type fp_arrived_t is array (0 to CH_NUM - 1) of boolean;
variable fp_arrived : fp_arrived_t;
type fp_arrived_time_t is array (0 to CH_NUM - 1) of integer;
variable fp_arrived_time : fp_arrived_time_t;
variable fp_arrived_agg : integer;
variable pd_arrived_time : integer;
begin
-- init_signal_spy("/iDUT/abs_pos","abs_spy",0);
-- init_signal_spy("/iDUT/pd_pulse","pd_spy",0);
init_signal_spy("abs_position", "abs_spy", 0);
init_signal_spy("pd_in", "pd_spy", 0);
-- Set the verbosity level for logging
set_log_verbosity(VERBOSITY_LEVEL);
set_log_verbosity(VHIGH);
log_header("Multi-channel FPM verification:", VLOW);
test_completed <= false;
running <= false;
passed <= false;
failed <= false;
-- Reset
reset_n <= '0';
wait for 100 ns;
wait until clk = '1' and clk'event;
reset_n <= '1';
if (configuring /= true) then
wait until configuring = true;
end if;
wait until configuring = false;
running <= true;
log("Running test ... ", VLOW, true);
while stimuli_completed = false loop
wait until ((pd_spy = '1' and pd_spy'event) or stimuli_completed);
if (stimuli_completed) then
exit;
end if;
pd_arrived_time := to_integer(signed(abs_spy));
for i in 0 to CH_NUM - 1 loop
fp_arrived(i) := false;
fp_arrived_time(i) := 0;
end loop;
log("Product detect fired @ " & integer'image(pd_arrived_time) & " ... ", VLOW, true);
fp_arrived_agg := 0;
while fp_arrived_agg < CH_NUM loop
fp_arrived_agg := 0;
for i in 0 to CH_NUM - 1 loop
if fp_arrived(i) = true then
fp_arrived_agg := fp_arrived_agg + 1;
end if;
end loop;
wait until (unsigned(ch_pulse_out) /= 0 or stimuli_completed);
if (stimuli_completed) then
exit;
end if;
for i in 0 to CH_NUM - 1 loop
if ch_pulse_out(i) = '1' and fp_arrived(i) = false then
fp_arrived(i) := true;
fp_arrived_time(i) := to_integer(signed(abs_spy));
log("Channel CH" & integer'image(i) & " Fire pulse logged @ " & integer'image(fp_arrived_time(i)) & " ... ", VLOW, true);
if (abs (pd_arrived_time - fp_arrived_time(i)) /= ch_offset(i)) then
log("Channel CH" & integer'image(i) & " OFFSET INCORRECT !!! ", VLOW, true);
detected_error <= true;
end if;
end if;
end loop;
end loop;
end loop;
if (stimuli_completed = true) then
-- wait enough time to make sure that a max length package can be propagated
wait for 20 us;
end if;
if (registers_read = false) then
wait until registers_read = true;
end if;
-- Report PD and FP counter from pulse generator
for i in 0 to CH_NUM - 1 loop
log("Channel CH" & integer'image(i) & " PDin counter value : " & integer'image(pd_cnt(i)) & " ... ", VLOW, true);
log("Channel CH" & integer'image(i) & " FPout counter value : " & integer'image(fp_cnt(i)) & " ... ", VLOW, true);
if (i = 0 and (pd_cnt(i) /= (NUM_ITERATIONS) * 2)) or
(i /= 0 and pd_cnt(i) /= 0) then -- fire_pulse_manager now has no registers beyond channel 0
log("Channel CH" & integer'image(i) & " PD_cnt counter value Incorrect: ", VLOW, true);
detected_error <= true;
end if;
if (i = 0 and (fp_cnt(i) /= (NUM_ITERATIONS) * 2 * 100)) or
(i /= 0 and fp_cnt(i) /= 0) then
log("Channel CH" & integer'image(i) & " FP_cnt counter value Incorrect: ", VLOW, true);
detected_error <= true;
end if;
end loop;
wait until clk = '1' and clk'event;
if (detected_error = true) then
failed <= true;
log("FAILURE: test completed with errors.", VLOW);
else
passed <= true;
log("SUCCESS: test successfully completed.", VLOW);
end if;
log_separator_line(VLOW);
test_completed <= true;
running <= false;
wait;
end process pTB_CTRL;
pUUT_CTRL : process
variable addr : std_logic_vector(31 downto 0) := (others => '0');
variable data : std_logic_vector(31 downto 0) := (others => '0');
variable ratio_int : integer;
variable ratio_slv : std_logic_vector(33 downto 0);
begin
sel_slave_0 <= '0';
sel_slave_1 <= '0';
configuring <= true;
-- initilialize the Avalon master-bus
mm_m_init(avs_m, use_waitrequest => true);
if (reset_n = '0') then
wait until reset_n = '1';
wait for 100 ns;
wait until clk = '1' and clk'event;
end if;
log("Configuring POFTX ... ", VLOW, true);
sel_slave_1 <= '1';
-- Config netfork_tx control registers:
-- enable the block
addr := std_logic_vector(to_unsigned(0, 32));
data := X"0000_0021";
mm_32b_write(addr, data, avs_s, avs_m);
sel_slave_1 <= '0';
sel_slave_0 <= '1';
wait until clk = '1' and clk'event;
log("Configuring EMUL ... ", VLOW, true);
-- Configure Encoder NCO freq
addr := std_logic_vector(to_unsigned(6144 + to_integer(unsigned(CSR_ENC_NCO_INC_ADDR)), 32));
data := freq2NCO_inc(200.0e3, CLK_FREQ);
-- Write the data to the register
mm_32b_write(addr, data, avs_s, avs_m);
-- Enable outputs
addr := std_logic_vector(to_unsigned(6144 + to_integer(unsigned(CSR_OUT_ENABLE_ADDR)), 32));
data := X"000000FF";
-- Write the data to the register
mm_32b_write(addr, data, avs_s, avs_m);
log("Configuring FPM ... ", VLOW, true);
-- Config fire_pulse_manager control registers:
-- Enable the POF-Rx
addr := std_logic_vector(to_unsigned(3, 32));
data := X"0000_8061"; -- set bit_div to 6 to match the 50MBd TX signal to the 300MHz RX_CLK
-- Write the data to the register
mm_32b_write(addr, data, avs_s, avs_m);
-- Select pulse generator
addr := std_logic_vector(to_unsigned(2, 32));
data := X"0000_0001";
-- Write the data to the register
mm_32b_write(addr, data, avs_s, avs_m);
-- Config external fire pulses
addr := std_logic_vector(to_unsigned(12, 32));
data := X"0008_0004";
-- Write the data to the register
mm_32b_write(addr, data, avs_s, avs_m);
config_pg_l : for i in 0 to CH_NUM - 1 loop
-- Disable/Re-enable first the whole pulse_generator
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(PULSE_GEN_CTRL_REG)), 32));
data := (others => '0');
mm_32b_write(addr, data, avs_s, avs_m);
data := (0 => '1', 16 => '1', others => '0');
mm_32b_write(addr, data, avs_s, avs_m);
-- Disable/Re-enable the Channel Controller sequencer
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(CH_CTRL_CTRL_REG)), 32));
data := (others => '0');
mm_32b_write(addr, data, avs_s, avs_m);
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(CH_CTRL_CTRL_REG)), 32));
data := (0 => '1', others => '0');
mm_32b_write(addr, data, avs_s, avs_m);
-- set the sub-pixel offset
data := std_logic_vector(to_unsigned(0, 32));
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(SP_OFFSET_INT)), 32));
mm_32b_write(addr, data, avs_s, avs_m);
data := std_logic_vector(to_unsigned(0, 32));
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(SP_OFFSET_FRAC)), 32));
mm_32b_write(addr, data, avs_s, avs_m);
-- set the division ratio
ratio_int := integer(2.0 * real(2**24));
ratio_slv := std_logic_vector(to_unsigned(ratio_int, 34));
-- Set the integer part of the div-ratio
data(31 downto 10) := (others => '0');
data(9 downto 0) := ratio_slv(33 downto 24);
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(DIV_RATIO_INT)), 32));
mm_32b_write(addr, data, avs_s, avs_m);
-- Set the fractional part of the div-ratio
data(31 downto 24) := (others => '0');
data(23 downto 0) := ratio_slv(23 downto 0);
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(DIV_RATIO_FRAC)), 32));
mm_32b_write(addr, data, avs_s, avs_m);
-- Disable/Enable the fractional divider
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(FRAC_DIV_CTRL_REG)), 32));
data := (others => '0');
mm_32b_write(addr, data, avs_s, avs_m);
data := (0 => '1', others => '0');
mm_32b_write(addr, data, avs_s, avs_m);
-- Configure the Channel Offset (Both DIR_0 and DIR_1):
-- DIR_0
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(CH_OFFSET_D0_REG)), 32));
data := std_logic_vector(to_unsigned(ch_offset(i), 32));
mm_32b_write(addr, data, avs_s, avs_m);
-- DIR_1
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(CH_OFFSET_D1_REG)), 32));
data := std_logic_vector(to_unsigned(ch_offset(i), 32));
mm_32b_write(addr, data, avs_s, avs_m);
-- Configure the Channel Delay
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(CH_DELAY_REG)), 32));
data := std_logic_vector(to_unsigned(0, 32));
mm_32b_write(addr, data, avs_s, avs_m);
-- Fill Sequencer RAM with simple swathe DIR-0
-- 0x00, 0x30000000 – Reset the vector output value
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(SEQ_RAM_OFFSET)), 32));
data := X"30000000";
mm_32b_write(addr, data, avs_s, avs_m);
-- 0x01, 0x10000001 – Trigger Mask (PD trigger enabled)
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(SEQ_RAM_OFFSET) + 1), 32));
data := X"10000001";
mm_32b_write(addr, data, avs_s, avs_m);
-- 0x02, 0x20000001 – Wait for a single PD event
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(SEQ_RAM_OFFSET) + 2), 32));
data := X"20000001";
mm_32b_write(addr, data, avs_s, avs_m);
-- 0x03, 0x30006404 – Issue a request for starting the generation of 100 fire pulses (DIR-0)
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(SEQ_RAM_OFFSET) + 3), 32));
data := X"30006404";
mm_32b_write(addr, data, avs_s, avs_m);
-- 0x04, 0x30006400 – De-assert the request bit (start_image_req)
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(SEQ_RAM_OFFSET) + 4), 32));
data := X"30006400";
mm_32b_write(addr, data, avs_s, avs_m);
-- 0x05, 0x80000258 – Wait till POS END
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(SEQ_RAM_OFFSET) + 5), 32));
data := X"80000258";
mm_32b_write(addr, data, avs_s, avs_m);
-- 0x06, 0xC0000000 – Jump to DIR-1
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(SEQ_RAM_OFFSET) + 6), 32));
data := X"C0000010";
mm_32b_write(addr, data, avs_s, avs_m);
-- Fill Sequencer RAM with simple swathe DIR-1
-- 0x10, 0x30000000 – Reset the vector output value
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(SEQ_RAM_OFFSET) + 16), 32));
data := X"30000001";
mm_32b_write(addr, data, avs_s, avs_m);
-- 0x11, 0x10000001 – Trigger Mask (PD trigger enabled)
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(SEQ_RAM_OFFSET) + 17), 32));
data := X"10000001";
mm_32b_write(addr, data, avs_s, avs_m);
-- 0x12, 0x20000001 – Wait for a single PD event
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(SEQ_RAM_OFFSET) + 18), 32));
data := X"20000001";
mm_32b_write(addr, data, avs_s, avs_m);
-- 0x13, 0x30006405 – Issue a request for starting the generation of 100 fire pulses (DIR-1)
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(SEQ_RAM_OFFSET) + 19), 32));
data := X"30006405";
mm_32b_write(addr, data, avs_s, avs_m);
-- 0x14, 0x30006401 – De-assert the request bit (start_image_req)
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(SEQ_RAM_OFFSET) + 20), 32));
data := X"30006401";
mm_32b_write(addr, data, avs_s, avs_m);
-- 0x15, 0x80000000 – Wait till POS START
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(SEQ_RAM_OFFSET) + 21), 32));
data := X"80000000";
mm_32b_write(addr, data, avs_s, avs_m);
-- 0x16, 0xC0000000 – Jump to DIR-0
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(SEQ_RAM_OFFSET) + 22), 32));
data := X"C0000000";
mm_32b_write(addr, data, avs_s, avs_m);
-- Start Sequencer
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(SEQ_CSR_OFFSET) + 3), 32));
data := (0 => '1', others => '0');
mm_32b_write(addr, data, avs_s, avs_m);
end loop config_pg_l;
-- Init the encoder NCO - Preset Abs-Pos
addr := std_logic_vector(to_unsigned(6144 + to_integer(unsigned(CSR_ENC_CTRL_ADDR)), 32));
data := 32X"B";
-- Write the data to the register
mm_32b_write(addr, data, avs_s, avs_m);
log("Configuration completed.", VLOW, true);
configuring <= false;
while stimuli_completed = false loop
wait until reprogram_offset = true or stimuli_completed = true;
if (stimuli_completed) then
exit;
end if;
configuring <= true;
log("Reprogramming offset ... ", VLOW, true);
config_of_l : for i in 0 to CH_NUM - 1 loop
-- Configure the Channel Offset (Both DIR_0 and DIR_1):
-- DIR_0
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(CH_OFFSET_D0_REG)), 32));
data := std_logic_vector(to_unsigned(ch_offset(i), 32));
mm_32b_write(addr, data, avs_s, avs_m);
-- DIR_1
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(CH_OFFSET_D1_REG)), 32));
data := std_logic_vector(to_unsigned(ch_offset(i), 32));
mm_32b_write(addr, data, avs_s, avs_m);
end loop;
configuring <= false;
-- issue PD
addr := std_logic_vector(to_unsigned(6144 + to_integer(unsigned(CSR_PD_CTRL_ADDR)), 32));
data := 32X"3";
-- Write the data to the register
mm_32b_write(addr, data, avs_s, avs_m);
if dir_in = '0' then
log("Running 600 steps in DIR-0 ...", VLOW);
addr := std_logic_vector(to_unsigned(6144 + to_integer(unsigned(CSR_PULSE_NUM_ADDR)), 32));
data := 32X"258";
-- Write the data to the register
mm_32b_write(addr, data, avs_s, avs_m);
addr := std_logic_vector(to_unsigned(6144 + to_integer(unsigned(CSR_ENC_CTRL_ADDR)), 32));
data := 32X"11";
-- Write the data to the register
mm_32b_write(addr, data, avs_s, avs_m);
addr := std_logic_vector(to_unsigned(6144 + to_integer(unsigned(CSR_ENC_CTRL_ADDR)), 32));
data := 32X"31";
-- Write the data to the register
mm_32b_write(addr, data, avs_s, avs_m);
else
log("Running 600 steps in DIR-1 ...", VLOW);
addr := std_logic_vector(to_unsigned(6144 + to_integer(unsigned(CSR_PULSE_NUM_ADDR)), 32));
data := 32X"258";
-- Write the data to the register
mm_32b_write(addr, data, avs_s, avs_m);
addr := std_logic_vector(to_unsigned(6144 + to_integer(unsigned(CSR_ENC_CTRL_ADDR)), 32));
data := 32X"15";
-- Write the data to the register
mm_32b_write(addr, data, avs_s, avs_m);
addr := std_logic_vector(to_unsigned(6144 + to_integer(unsigned(CSR_ENC_CTRL_ADDR)), 32));
data := 32X"35";
-- Write the data to the register
mm_32b_write(addr, data, avs_s, avs_m);
end if;
end loop;
-- Read PD and FP counter from pulse generator
for i in 0 to CH_NUM - 1 loop
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(PD_IN_CNT_REG)), 32));
mm_32b_read(addr, data, avs_s, avs_m);
pd_cnt(i) <= to_integer(unsigned(data));
addr := std_logic_vector(to_unsigned(8192 + (2048 * i) + to_integer(unsigned(FIRE_REQ_CNT_REG)), 32));
mm_32b_read(addr, data, avs_s, avs_m);
fp_cnt(i) <= to_integer(unsigned(data));
end loop;
registers_read <= true;
wait;
end process pUUT_CTRL;
clk_clk <= clk;
reset_reset_n <= reset_n;
avs_s.mm_readdata <= avs_readdata(0) when sel_slave_0 = '1' else
avs_readdata(1) when sel_slave_1 = '1' else (others => '0');
avs_s.mm_readdatavalid <= '0';
avs_s.mm_waitrequest <= avs_waitrequest(0) when sel_slave_0 = '1' else
avs_waitrequest(1) when sel_slave_1 = '1' else '0';
avs_s.use_readvalid <= false;
avs_address <= avs_m.mm_address(avs_address'range);
avs_write(0) <= avs_m.mm_write and sel_slave_0;
avs_write(1) <= avs_m.mm_write and sel_slave_1;
avs_writedata <= avs_m.mm_writedata;
avs_read(0) <= avs_m.mm_read and sel_slave_0;
avs_read(1) <= avs_m.mm_read and sel_slave_1;
end behav;

View file

@ -0,0 +1,245 @@
-------------------------------------------------------------------------------
-- Title : pof_tx
-- Project : SMB
-------------------------------------------------------------------------------
-- File : pof_tx.vhd
-- Author : Gianmarco Girau
-- Company : Global Inkjet Systems
-- Created : 2017-08-22
-- Last update: 2019-07-15
-- SVN ID : Git
-- Standard : VHDL'08
-------------------------------------------------------------------------------
-- Description:
-- Encodes the EMS output into a serial format to be distributed over the POF
-------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity pof_tx_3 is
port(
reset_n : in std_logic;
clk : in std_logic;
init : in std_logic;
pd_in : in std_logic;
inc_pos : in std_logic;
dec_pos : in std_logic;
abs_position : in std_logic_vector(31 downto 0);
tx_data : out std_logic;
-- Avalon MM Interface
avs_address : in std_logic_vector( 2 downto 0);
avs_write : in std_logic;
avs_writedata : in std_logic_vector(31 downto 0);
avs_read : in std_logic;
avs_readdatavalid : out std_logic;
avs_readdata : out std_logic_vector(31 downto 0));
end entity pof_tx_3;
architecture rtl of pof_tx_3 is
constant CSR : std_logic_vector( 2 downto 0) := b"000";
constant ERROR_INJ_REG : std_logic_vector( 2 downto 0) := b"001";
constant KEEPALIVE_PERIOD : integer := 100;
constant INIT_BLOCKED_PERIOD : integer := 200;
function odd_parity(data : std_logic_vector) return std_logic is
variable parity_bit : std_logic := '1';
begin
for n in 0 to data'length-1 loop
parity_bit := parity_bit xor data(n);
end loop; -- n
return parity_bit;
end function odd_parity;
function bin2gray(bin : std_logic_vector) return std_logic_vector is
variable gray : std_logic_vector(bin'range);
begin
gray := bin xor ('0' & bin(bin'length-1 downto 1));
return gray;
end function bin2gray;
signal rd_event, wr_event, empty, full, tx_ready : std_logic;
signal rd_event_d, wr_event_i, symbol_valid : std_logic;
signal enable, toggle_sync, toggle_pd : std_logic;
signal add_keepalive, ovfl_err, init_d, init_gen : std_logic;
signal clear, pd_in_d, pd_gen, parity_bit : std_logic;
signal inject_error, inject_error_req : std_logic;
signal pd_event, pd_event_d, pd_event_dd : std_logic;
signal init_blocked, pd_event_ddd, delayed_pos : std_logic;
--
signal delayed_pos_v : std_logic_vector( 2 downto 0);
signal init_v, gray, bit_div : std_logic_vector( 3 downto 0);
signal latched_pos : std_logic_vector( 3 downto 0);
signal event_in_i : std_logic_vector( 6 downto 0);
signal keepalive_cnt : std_logic_vector( 7 downto 0);
signal event_in, event_out : std_logic_vector( 7 downto 0);
signal symbol : std_logic_vector( 7 downto 0);
signal init_blk_cnt : std_logic_vector( 9 downto 0) := (others => '0');
begin
clear <= not enable;
-----------------------------------------------------------------------------
-- Encode events and queue these in a FIFO
-----------------------------------------------------------------------------
pEVENT_GEN : process(clk)
begin
if(clk = '1' and clk'event) then
init_d <= init;
if(init = '1' and init_d = '0' and init_blocked = '0') then
init_v <= "1100";
else
init_v <= '0' & init_v(3 downto 1);
end if;
if(enable = '0') then
toggle_sync <= '0';
elsif(init_d = '1' and init_blocked = '0') then
toggle_sync <= not toggle_sync;
end if;
if(init_gen = '1') then
init_blk_cnt <= std_logic_vector(to_unsigned(INIT_BLOCKED_PERIOD, 10));
elsif(init_blocked = '1') then
init_blk_cnt <= std_logic_vector(unsigned(init_blk_cnt)-1);
end if;
pd_in_d <= pd_in;
pd_event_d <= pd_event;
pd_event_dd <= pd_event_d;
pd_event_ddd <= pd_event_dd;
if(pd_event = '1') then
latched_pos <= abs_position(3 downto 0);
end if;
if((dec_pos = '1' or inc_pos = '1') and pd_gen = '1') then
delayed_pos_v <= "111";
else
delayed_pos_v <= '0' & delayed_pos_v(2 downto 1);
end if;
if(enable = '0') then
toggle_pd <= '0';
elsif(pd_event = '1') then
toggle_pd <= not toggle_pd;
end if;
wr_event <= wr_event_i or add_keepalive;
event_in <= parity_bit & event_in_i;
if(enable = '0' or wr_event_i = '1') then
keepalive_cnt <= std_logic_vector(to_unsigned(KEEPALIVE_PERIOD, 8));
else
keepalive_cnt <= std_logic_vector(unsigned(keepalive_cnt)-1);
end if;
if(enable = '0') then
ovfl_err <= '0';
elsif(wr_event = '1' and full = '1') then
ovfl_err <= '1';
end if;
if(clear = '1' or wr_event = '1') then
inject_error <= '0';
elsif(inject_error_req = '1') then
inject_error <= '1';
end if;
end if;
end process pEVENT_GEN;
init_gen <= init_v(0);
init_blocked <= '1' when unsigned(init_blk_cnt) /= 0 else '0';
pd_event <= pd_in and not pd_in_d;
pd_gen <= pd_event or pd_event_d or pd_event_dd;
delayed_pos <= delayed_pos_v(0) and pd_event_ddd;
wr_event_i <= enable and (init_gen or pd_gen or dec_pos or inc_pos or delayed_pos);
add_keepalive <= '1' when wr_event_i = '0' and unsigned(keepalive_cnt) = 0 else '0';
gray <= bin2gray(latched_pos) when (pd_event_d = '1' or pd_event_dd = '1') else bin2gray(abs_position(3 downto 0));
-- toggle_pd is repeated twice in the tx word, to improve resiliance against
-- double bit-flips errors
event_in_i <= gray & toggle_pd & toggle_pd & toggle_sync;
parity_bit <= odd_parity(event_in_i) xor inject_error;
iQUEUE_EVENT : entity work.fifo_16x8_3
port map (
clock => clk,
data => event_in,
rdreq => rd_event,
sclr => clear,
wrreq => wr_event,
empty => empty,
full => full,
q => event_out,
usedw => open);
-----------------------------------------------------------------------------
-- Transmit symbols over serial link
-----------------------------------------------------------------------------
pGET_EVENT : process(clk)
begin
if(clk = '1' and clk'event) then
rd_event_d <= rd_event;
symbol_valid <= rd_event_d;
end if;
end process pGET_EVENT;
rd_event <= '1' when tx_ready = '1' and empty = '0' and rd_event_d = '0' and symbol_valid = '0' else '0';
symbol <= event_out;
iTX_SYMBOL : entity work.uart_tx_3
generic map (
data_width => 8)
port map (
reset_n => reset_n,
clk => clk,
bit_div => bit_div,
init => clear,
ready => tx_ready,
data_in => symbol,
data_valid => symbol_valid,
tx_data => tx_data);
-----------------------------------------------------------------------------
-- C&S registers
-----------------------------------------------------------------------------
pCTRL_STATUS : process(reset_n, clk)
begin
if(reset_n = '0') then
avs_readdatavalid <= '0';
enable <= '0';
bit_div <= "0010";
elsif(clk = '1' and clk'event) then
inject_error_req <= '0';
-- CTRL registers
if(avs_write = '1') then
case avs_address is
when CSR =>
enable <= avs_writedata(0);
bit_div <= avs_writedata(7 downto 4);
when ERROR_INJ_REG =>
inject_error_req <= avs_writedata(0);
when others => null;
end case;
end if;
-- Read Ctrl & Status registers
avs_readdatavalid <= avs_read;
if(avs_read = '1') then
case avs_address is
when CSR =>
avs_readdata <= X"000000" & bit_div & b"00" & ovfl_err & enable;
when others =>
avs_readdata <= X"BAD1BAD0";
end case;
end if;
end if;
end process pCTRL_STATUS;
end architecture rtl;

View file

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

View file

@ -0,0 +1,163 @@
-------------------------------------------------------------------------------
-- Title : uart_tx
-- Project : EMB-1
-------------------------------------------------------------------------------
-- File : uart_tx.vhd
-- Author : Gianmarco Girau
-- Company : Global Inkjet Systems
-- Created : 2016-10-24
-- Last update: 2019-07-15
-- SVN ID : Git
-- Standard : VHDL'08
-------------------------------------------------------------------------------
-- Description:
-- Simple UART trasmitter, used to trasmit data over the POF, 1 start, 1 stop
-- bit, no parity
-------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity uart_tx_3 is
generic(
data_width : natural range 1 to 31);
port(
reset_n : in std_logic;
clk : in std_logic;
bit_div : in std_logic_vector(3 downto 0); -- number of clock cycles per tx bit
init : in std_logic;
ready : out std_logic;
data_in : in std_logic_vector(data_width-1 downto 0);
data_valid : in std_logic;
tx_data : out std_logic);
end entity uart_tx_3;
architecture rtl of uart_tx_3 is
type fsm_state_t is (idle, send_start_bit, send_data, send_stop_bit);
signal fsm_state_curr, fsm_state_next : fsm_state_t;
--
signal ld_data, shf_data, rst_bit_cnt, inc_bit_cnt : std_logic;
signal rst_clk_cnt, end_of_bit, end_of_tx : std_logic;
signal rst_tx_data, set_tx_data, ld_tx_data : std_logic;
signal ready_i : std_logic;
--
signal data : std_logic_vector(data_width-1 downto 0);
signal clk_cnt : std_logic_vector(3 downto 0);
signal bit_cnt : std_logic_vector(5 downto 0);
begin
-----------------------------------------------------------------------------
-- UART registers and sequential logic
-----------------------------------------------------------------------------
pREGs : process(clk)
begin
if(clk ='1' and clk'event) then
if(ld_data = '1') then
data <= data_in;
elsif(shf_data = '1') then
data <= '0' & data(data'high downto 1);
end if;
if(rst_bit_cnt = '1') then
bit_cnt <= (others => '0');
elsif(inc_bit_cnt = '1') then
bit_cnt <= std_logic_vector(unsigned(bit_cnt)+1);
end if;
if(rst_clk_cnt = '1' or end_of_bit = '1') then
clk_cnt <= (others => '0');
else
clk_cnt <= std_logic_vector(unsigned(clk_cnt)+1);
end if;
if(rst_tx_data = '1') then
tx_data <= '0';
elsif(set_tx_data = '1') then
tx_data <= '1';
elsif(ld_tx_data = '1') then
tx_data <= data(0);
end if;
end if;
end process pREGs;
end_of_bit <= '1' when unsigned(clk_cnt) = (unsigned(bit_div)-1) else '0';
end_of_tx <= '1' when unsigned(bit_cnt) = data_width else '0';
--shf_data <= inc_bit_cnt;
shf_data <= ld_tx_data;
inc_bit_cnt <= ld_tx_data;
-----------------------------------------------------------------------------
-- FSM
-----------------------------------------------------------------------------
-- FSM state register
pFSM_SR : process(reset_n, clk)
begin
if(reset_n = '0') then
fsm_state_curr <= idle;
elsif(clk = '1' and clk'event) then
fsm_state_curr <= fsm_state_next;
end if;
end process pFSM_SR;
-- FSM Combinational Logic
pFSM_CL : process(fsm_state_curr, init, data_valid, end_of_bit, end_of_tx)
begin
--default assignments
ready_i <= '0';
rst_clk_cnt <= '0';
rst_tx_data <= '0';
set_tx_data <= '0';
ld_tx_data <= '0';
rst_bit_cnt <= '0';
ld_data <= '0';
--
fsm_state_next <= fsm_state_curr;
if(init = '1') then
set_tx_data <= '1';
fsm_state_next <= idle;
else
case fsm_state_curr is
when idle =>
ready_i <= '1';
ld_data <= '1';
rst_clk_cnt <= '1';
rst_bit_cnt <= '1';
set_tx_data <= '1';
if(data_valid = '1') then
rst_tx_data <= '1';
fsm_state_next <= send_start_bit;
end if;
when send_start_bit =>
if(end_of_bit = '1') then
ld_tx_data <= '1';
fsm_state_next <= send_data;
end if;
when send_data =>
if(end_of_bit = '1') then
ld_tx_data <= '1';
if(end_of_tx = '1') then
set_tx_data <= '1';
fsm_state_next <= send_stop_bit;
end if;
end if;
when send_stop_bit =>
if(end_of_bit = '1') then
fsm_state_next <= idle;
end if;
when others => null;
end case;
end if;
end process pFSM_CL;
ready <= ready_i;
end architecture rtl;

View file

@ -0,0 +1,160 @@
-------------------------------------------------------------------------------
-- Title : uart_regen
-- Project : EMB-1
-------------------------------------------------------------------------------
-- File : uart_regen.vhd
-- Author : Gianmarco Girau
-- Company : Global Inkjet Systems
-- Created : 2017-10-31
-- Last update: 2019-07-15
-- SVN ID : Git
-- Standard : VHDL'08
-------------------------------------------------------------------------------
-- Description:
-- Regenerate the UART signal
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity uart_regen_3 is
generic(
data_width : natural range 1 to 31);
port(
reset_n : in std_logic;
clk : in std_logic;
bit_div : in std_logic_vector(3 downto 0); -- number of clock cycles per tx bit
enable : in std_logic;
bypass_en : in std_logic;
uart_rx : in std_logic;
uart_tx : out std_logic);
end entity uart_regen_3;
architecture rtl of uart_regen_3 is
type fsm_state_t is (s_init, s_idle, s_regen);
signal fsm_state_curr, fsm_state_next : fsm_state_t;
--
signal uart_rx_i, ld_data, rst_bit_cnt, inc_bit_cnt : std_logic;
signal rst_clk_cnt, end_of_bit, end_of_rx : std_logic;
signal uart_regen, uart_regen_i : std_logic;
--
signal clk_cnt : std_logic_vector(3 downto 0);
signal bit_cnt : std_logic_vector(5 downto 0);
begin
-----------------------------------------------------------------------------
-- Input Synchronization
-----------------------------------------------------------------------------
iSYNC_IN : entity work.sync_wire
generic map(
rst_val => '1',
sync_stages => 3)
port map(
rstN => reset_n,
clk => clk,
async_in => uart_rx,
sync_out => uart_rx_i);
-- NOTE : No NEED TO SYNCHRONIZE TO THE LOCAL CLOCK inputs enable, bypass_en
-- and bit_biv BECAUSE THOSE SIGNALS ARE PREDOMINANTLY STATIC
-----------------------------------------------------------------------------
-- UART registers and sequential logic
-----------------------------------------------------------------------------
pREGs : process(clk)
begin
if (clk = '1' and clk'event) then
if (rst_bit_cnt = '1') then
bit_cnt <= (others => '0');
elsif (inc_bit_cnt = '1') then
bit_cnt <= std_logic_vector(unsigned(bit_cnt) + 1);
end if;
ld_data <= '0';
if clk_cnt = ('0' & std_logic_vector(unsigned(bit_div(bit_div'high downto 1)) + 1)) then
ld_data <= '1';
end if;
if (rst_clk_cnt = '1' or end_of_bit = '1') then
clk_cnt <= std_logic_vector(unsigned(bit_div) - 1);
else
clk_cnt <= std_logic_vector(unsigned(clk_cnt) - 1);
end if;
if (enable = '0') then
uart_regen_i <= '1';
elsif (ld_data = '1') then
uart_regen_i <= uart_rx_i;
end if;
uart_regen <= uart_regen_i;
end if;
end process pREGs;
end_of_bit <= '1' when unsigned(clk_cnt) = 0 else '0';
end_of_rx <= '1' when unsigned(bit_cnt) = data_width + 1 else '0';
-- output mux
uart_tx <= uart_rx when bypass_en = '1' else uart_regen;
-----------------------------------------------------------------------------
-- FSM
-----------------------------------------------------------------------------
-- FSM state register
pFSM_SR : process(clk)
begin
if (clk = '1' and clk'event) then
if (enable = '0' or bypass_en = '1') then
fsm_state_curr <= s_init;
else
fsm_state_curr <= fsm_state_next;
end if;
end if;
end process pFSM_SR;
-- FSM Combinational Logic
pFSM_CL : process(fsm_state_curr, uart_rx_i, end_of_bit, end_of_rx, clk_cnt, bit_div)
begin
--default assignments
rst_clk_cnt <= '0';
rst_bit_cnt <= '0';
inc_bit_cnt <= '0';
--
fsm_state_next <= fsm_state_curr;
case fsm_state_curr is
when s_init =>
if (uart_rx_i = '1') then
fsm_state_next <= s_idle;
end if;
when s_idle =>
if (uart_rx_i = '0') then
rst_clk_cnt <= '1';
rst_bit_cnt <= '1';
fsm_state_next <= s_regen;
end if;
when s_regen =>
if (end_of_bit = '1') then
inc_bit_cnt <= '1';
if (end_of_rx = '1') then
if (uart_rx_i = '1') then
fsm_state_next <= s_idle;
else
fsm_state_next <= s_init;
end if;
end if;
end if;
end case;
end process pFSM_CL;
end architecture rtl;

View file

@ -0,0 +1,186 @@
-------------------------------------------------------------------------------
-- Title : uart_rx
-- Project : EMB-1
-------------------------------------------------------------------------------
-- File : uart_rx.vhd
-- Author : Gianmarco Girau
-- Company : Global Inkjet Systems
-- Created : 2016-10-24
-- Last update: 2019-07-15
-- SVN ID : Git
-- Standard : VHDL'08
-------------------------------------------------------------------------------
-- Description:
-- Simple UART receiver, used to receive data over the POF, 1 start, 1 stop
-- bit, no parity
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity uart_rx_3 is
generic(
data_width : natural range 1 to 31);
port(
reset_n : in std_logic;
clk : in std_logic;
bit_div : in std_logic_vector(3 downto 0); -- number of clock cycles per tx bit
init : in std_logic;
data_out : out std_logic_vector(data_width - 1 downto 0);
data_out_valid : out std_logic;
rx_error : out std_logic;
rx_data : in std_logic);
end entity uart_rx_3;
architecture rtl of uart_rx_3 is
type fsm_state_t is (s_init, s_idle, s_get_start_bit, s_get_data, s_get_stop_bit);
signal fsm_state_curr, fsm_state_next : fsm_state_t;
--
signal rx_data_i, rst_bit_cnt, inc_bit_cnt : std_logic;
signal rst_clk_cnt, end_of_rx, data_valid : std_logic;
signal stop_bit, rx_error_i : std_logic;
--
signal data : std_logic_vector(data_width - 1 downto 0);
signal bit_cnt : std_logic_vector(5 downto 0);
-- avoid maths with loadable shift registers
-- bit_div will be used to set an indexed bit of the timer shift register
-- the timers will shift down towards zeroth bit which will indicate timer has completed.
-- this should be faster than using a decrementer and comparators
signal uart_bit_timer, uart_bit_sample_timer : std_logic_vector(2**bit_div'length - 1 downto 0);
signal uart_bit_timer_load_value, uart_bit_sample_timer_load_value : std_logic_vector(2**bit_div'length - 1 downto 0);
signal end_of_bit : std_logic;
signal shf_data : std_logic;
begin
-----------------------------------------------------------------------------
-- Input Synchronization
-----------------------------------------------------------------------------
iSYNC_IN : entity work.sync_wire
generic map(
rst_val => '1',
sync_stages => 3)
port map(
rstN => reset_n,
clk => clk,
async_in => rx_data,
sync_out => rx_data_i);
-----------------------------------------------------------------------------
-- UART registers and sequential logic
-----------------------------------------------------------------------------
pREGs : process(clk)
begin
if (clk = '1' and clk'event) then
if (rst_bit_cnt = '1') then
bit_cnt <= (others => '0');
elsif (inc_bit_cnt = '1') then
bit_cnt <= std_logic_vector(unsigned(bit_cnt) + 1);
end if;
if (rst_clk_cnt = '1' or end_of_bit = '1') then
uart_bit_timer <= uart_bit_timer_load_value;
uart_bit_sample_timer <= uart_bit_sample_timer_load_value;
else
uart_bit_timer <= '0' & uart_bit_timer(uart_bit_timer'high downto 1);
uart_bit_sample_timer <= '0' & uart_bit_sample_timer(uart_bit_sample_timer'high downto 1);
end if;
if (shf_data = '1') then
data <= rx_data_i & data(data'high downto 1);
end if;
data_out_valid <= data_valid;
if (data_valid = '1') then
data_out <= data;
end if;
rx_error <= rx_error_i;
uart_bit_timer_load_value <= (others => '0');
uart_bit_timer_load_value(to_integer(unsigned(bit_div) -1 )) <= '1';
uart_bit_sample_timer_load_value <= (others => '0');
uart_bit_sample_timer_load_value(to_integer( unsigned(bit_div(bit_div'high downto 1)) -1)) <= '1';
end if;
end process pREGs;
shf_data <= uart_bit_sample_timer(0) and not stop_bit;
end_of_bit <= uart_bit_timer(0);
end_of_rx <= '1' when unsigned(bit_cnt) = data_width else '0';
-----------------------------------------------------------------------------
-- FSM
-----------------------------------------------------------------------------
-- FSM state register
pFSM_SR : process(clk)
begin
if (clk = '1' and clk'event) then
if (init = '1') then
fsm_state_curr <= s_init;
else
fsm_state_curr <= fsm_state_next;
end if;
end if;
end process pFSM_SR;
-- FSM Combinational Logic
pFSM_CL : process(all)
begin
--default assignments
rst_clk_cnt <= '0';
rst_bit_cnt <= '0';
inc_bit_cnt <= '0';
data_valid <= '0';
stop_bit <= '0';
rx_error_i <= '0';
--
fsm_state_next <= fsm_state_curr;
case fsm_state_curr is
when s_init =>
if (rx_data_i = '1') then
fsm_state_next <= s_idle;
end if;
when s_idle =>
if (rx_data_i = '0') then
rst_clk_cnt <= '1';
rst_bit_cnt <= '1';
fsm_state_next <= s_get_start_bit;
end if;
when s_get_start_bit =>
if (end_of_bit = '1') then
inc_bit_cnt <= '1';
fsm_state_next <= s_get_data;
end if;
when s_get_data =>
if (end_of_bit = '1') then
inc_bit_cnt <= '1';
if (end_of_rx = '1') then
fsm_state_next <= s_get_stop_bit;
end if;
end if;
when s_get_stop_bit =>
stop_bit <= '1';
if (end_of_bit = '1') then
if (rx_data_i = '1') then
data_valid <= '1';
fsm_state_next <= s_idle;
else
rx_error_i <= '1';
fsm_state_next <= s_init;
end if;
end if;
end case;
end process pFSM_CL;
end architecture rtl;

View file

@ -1,3 +1,5 @@
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;

View file

@ -37,7 +37,7 @@
"minor_number" : {
"type" : "c",
"bit_len" : "8",
"reset" : "0x11",
"reset" : "0x12",
"description" : "Minor number"
},
"major_number" : {

View file

@ -64,6 +64,9 @@ add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/iUUT/operand_1
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/iUUT/operand_2
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/iUUT/operand_comp
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/iUUT/subcode
add wave -noupdate /generic_sequencer_15_tb/iUUT/alu_upd
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/iUUT/r1
add wave -noupdate /generic_sequencer_15_tb/iUUT/flag
add wave -noupdate /generic_sequencer_15_tb/iUUT/inc_ram_addr
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/iUUT/jump_addr_ext
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/iUUT/jump_addr
@ -86,14 +89,11 @@ add wave -noupdate -radix decimal /generic_sequencer_15_tb/iUUT/queue_add
add wave -noupdate -radix decimal /generic_sequencer_15_tb/iUUT/queue_add_i
add wave -noupdate -radix unsigned /generic_sequencer_15_tb/iUUT/queue_left
add wave -noupdate -radix unsigned /generic_sequencer_15_tb/iUUT/queue_exec
add wave -noupdate /generic_sequencer_15_tb/iUUT/alu_upd
add wave -noupdate /generic_sequencer_15_tb/iUUT/jump_r1
add wave -noupdate /generic_sequencer_15_tb/iUUT/loop_active
add wave -noupdate /generic_sequencer_15_tb/iUUT/loop_upd
add wave -noupdate /generic_sequencer_15_tb/iUUT/loop_done
add wave -noupdate -radix unsigned /generic_sequencer_15_tb/iUUT/loop_cnt
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/iUUT/r1
add wave -noupdate /generic_sequencer_15_tb/iUUT/flag
add wave -noupdate /generic_sequencer_15_tb/iUUT/ld_trig_mask
add wave -noupdate /generic_sequencer_15_tb/iUUT/ld_trig_sel
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/iUUT/trig_mask
@ -111,9 +111,9 @@ add wave -noupdate /generic_sequencer_15_tb/iUUT/clr_vec_ii
add wave -noupdate /generic_sequencer_15_tb/iUUT/op_cnt
add wave -noupdate /generic_sequencer_15_tb/iUUT/op_cnt_done
add wave -noupdate /generic_sequencer_15_tb/iUUT/inc_op_cnt
add wave -noupdate /generic_sequencer_15_tb/iUUT/bus_ack
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/iUUT/bus_data
add wave -noupdate /generic_sequencer_15_tb/iUUT/bus_valid
add wave -noupdate /generic_sequencer_15_tb/iUUT/bus_ack
add wave -noupdate /generic_sequencer_15_tb/iUUT/bus_valid_i
add wave -noupdate /generic_sequencer_15_tb/iUUT/bus_pause
add wave -noupdate -radix hexadecimal /generic_sequencer_15_tb/iUUT/pos_store
@ -133,7 +133,7 @@ add wave -noupdate /generic_sequencer_15_tb/iUUT/ld_start_addr
add wave -noupdate /generic_sequencer_15_tb/iUUT/ld_pos
add wave -noupdate /generic_sequencer_15_tb/iUUT/flag
TreeUpdate [SetDefaultTree]
WaveRestoreCursors {{Cursor 1} {27385000 ps} 0}
WaveRestoreCursors {{Cursor 1} {16785000 ps} 0}
quietly wave cursor active 1
configure wave -namecolwidth 283
configure wave -valuecolwidth 194

View file

@ -1,74 +0,0 @@
-------------------------------------------------------------------------------
-- Title : dpram_sclk
-- Project : Dual-Port, single clock RAM
-------------------------------------------------------------------------------
-- File : dpram_sclk.vhd
-- Author : GMG
-- Company : Global Inkjet Systems
-- Created : 2018-04-24
-- Last update: 2018-04-24
-- SVN ID : Git
-- Standard : VHDL'2008
-------------------------------------------------------------------------------
-- Description:
-- True Dual-Port, single clock RAM
-------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use work.common_pkg.all;
entity dpram_sclk_15 is
generic(
WIDTH : natural := 32;
DEPTH : natural := 256);
port(
clk : in std_logic;
-- Port-A
addr_a : in std_logic_vector(log2(DEPTH)-1 downto 0);
we_a : in std_logic := '1';
data_a : in std_logic_vector(WIDTH-1 downto 0);
q_a : out std_logic_vector(WIDTH-1 downto 0);
-- Port-B
addr_b : in std_logic_vector(log2(DEPTH)-1 downto 0);
we_b : in std_logic := '1';
data_b : in std_logic_vector(WIDTH-1 downto 0);
q_b : out std_logic_vector(WIDTH-1 downto 0));
end dpram_sclk_15;
architecture rtl of dpram_sclk_15 is
-- Build a 2-D array type for the RAM
subtype word_t is std_logic_vector(WIDTH-1 downto 0);
type memory_t is array(DEPTH-1 downto 0) of word_t;
-- Declare the RAM
shared variable ram : memory_t;
begin
-- Port A
pPORT_A : process(clk)
begin
if(clk = '1' and clk'event) then
if(we_a = '1') then
ram(to_integer(unsigned(addr_a))) := data_a;
end if;
q_a <= ram(to_integer(unsigned(addr_a)));
end if;
end process pPORT_A;
-- Port B
pPORT_B : process(clk)
begin
if(clk = '1' and clk'event) then
if(we_b = '1') then
ram(to_integer(unsigned(addr_b))) := data_b;
end if;
q_b <= ram(to_integer(unsigned(addr_b)));
end if;
end process pPORT_B;
end rtl;

View file

@ -6,7 +6,7 @@
-- Author : Robbie Temple (original)
-- Company : Global Inkjet Systems
-- Created : 2016-05-12
-- Last update: 2019-03-05
-- Last update: 2019-05-17
-- SVN ID : Git
-- Standard : VHDL'2008
-------------------------------------------------------------------------------
@ -24,17 +24,17 @@ use work.generic_sequencer_15_pkg.all;
entity generic_sequencer_15 is
generic(
TRIGGER_WIDTH : natural range 1 to 16 := 16;
VECTOR_WIDTH : natural range 1 to 24 := 12;
BUS_WIDTH : natural range 1 to 32 := 12;
POS_WIDTH : natural range 1 to 24 := 12;
TRIGGER_WIDTH : natural range 1 to 16 := 16;
VECTOR_WIDTH : natural range 1 to 24 := 12;
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_RAMP_EN : boolean := false;
BUS_BURST_EN : boolean := false;
POS_BUS_EN : boolean := false;
ALU_EN : boolean := false;
QUEUE_EN : boolean := false);
ADD_VEC_PIPE : boolean := false; -- Add a pipeline register on vector_out
VECT_RAMP_EN : boolean := false;
BUS_BURST_EN : boolean := false;
POS_BUS_EN : boolean := false;
ALU_EN : boolean := false;
QUEUE_EN : boolean := false);
port(
--
clk : in std_logic;
@ -46,23 +46,23 @@ entity generic_sequencer_15 is
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_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);
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);
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);
vector_out : out std_logic_vector(VECTOR_WIDTH - 1 downto 0);
--
bus_data : out std_logic_vector(BUS_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_15;
@ -74,8 +74,8 @@ architecture rtl of generic_sequencer_15 is
-----------------------------------------------------------------------------
constant CSR_IP_ID : std_logic_vector(31 downto 0) := x"0000FF01";
constant CSR_IP_VER : std_logic_vector(31 downto 0) := x"00000F11";
constant CSR_IP_VER : std_logic_vector(31 downto 0) := x"00000F12";
type fsm_t is (s_idle, s_init, s_fetch, s_decode,
--
s_trig_mask, s_trig_wait,
@ -93,50 +93,50 @@ architecture rtl of generic_sequencer_15 is
-- Signals
-----------------------------------------------------------------------------
signal fsm, fsm_nxt : fsm_t;
signal fsm, fsm_nxt : fsm_t;
signal seq_cfg_aux : std_logic_vector(31 downto 0) := 32x"0";
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 ram_rd_addr : std_logic_vector(log2(SEQ_DEPTH) - 1 downto 0);
signal ram_rd_data : std_logic_vector(31 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 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 vector_out_i : std_logic_vector(VECTOR_WIDTH-1 downto 0);
signal ramp_val : std_logic_vector(VECTOR_WIDTH-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 op_cnt : std_logic_vector(11 downto 0);
signal loop_cnt : std_logic_vector(11 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 return_addr : std_logic_vector(log2(SEQ_DEPTH)-1 downto 0);
signal vector_out_i : std_logic_vector(VECTOR_WIDTH - 1 downto 0);
signal ramp_val : std_logic_vector(VECTOR_WIDTH - 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 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 : std_logic;
signal flag, alu_upd : 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;
@ -150,8 +150,8 @@ architecture rtl of generic_sequencer_15 is
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 step_req : std_logic;
signal fetch_enable : std_logic;
signal clr_seq_queue : std_logic;
signal clr_seq_queue_i : std_logic;
@ -164,9 +164,9 @@ architecture rtl of generic_sequencer_15 is
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_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);
@ -182,7 +182,7 @@ begin
AVS_PROC : process(clk, reset_n) is
begin
if reset_n = '0' then
avs_csr_readdata <= (others => '0');
avs_csr_readdata <= (others => '0');
seq_enable <= '0';
rst_vector_out <= '0';
debug_mode <= '0';
@ -194,29 +194,29 @@ begin
seq_queue_empty <= '0';
elsif clk'event and clk = '1' then
--
avs_csr_readdata <= (others => '0');
avs_csr_readdata <= (others => '0');
vector_val_cpu <= '0';
step_req <= '0';
clr_seq_queue <= '0';
clr_seq_queue_exe <= '0';
queue_add_flag <= '0';
if(ALU_EN = true) then
if(busy_i = '0') then
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
if (QUEUE_EN = true and set_queue_empty = '1') then
seq_queue_empty <= '1';
end if;
if avs_csr_write = '1' then
case avs_csr_address is
when CSR_CTRL_ADDR =>
seq_enable <= avs_csr_writedata(0);
rst_vector_out <= avs_csr_writedata(4);
if(QUEUE_EN = true) then
seq_enable <= avs_csr_writedata(0);
rst_vector_out <= avs_csr_writedata(4);
if (QUEUE_EN = true) then
clr_seq_queue <= avs_csr_writedata(8);
clr_seq_queue_exe <= avs_csr_writedata(9);
end if;
@ -231,14 +231,14 @@ begin
when CSR_STEP_ADDR =>
step_req <= '1';
when CSR_R1_ADDR =>
if(ALU_EN = true) then
if (ALU_EN = true) then
r1_data <= avs_csr_writedata(R1_data'range);
r1_data_valid <= '1';
end if;
when CSR_SEQ_QUEUE_ADDR =>
if(QUEUE_EN = true) then
if (QUEUE_EN = true) then
queue_add_flag <= '1';
queue_add <= avs_csr_writedata( 7 downto 0);
queue_add <= avs_csr_writedata(7 downto 0);
end if;
when others => null;
end case;
@ -252,10 +252,10 @@ begin
avs_csr_readdata <= "00" & std_logic_vector(to_unsigned(TRIGGER_WIDTH, 6)) & std_logic_vector(to_unsigned(VECTOR_WIDTH, 6)) & std_logic_vector(to_unsigned(BUS_WIDTH, 6)) & std_logic_vector(to_unsigned(POS_WIDTH, 6)) & std_logic_vector(to_unsigned(log2(SEQ_DEPTH), 6));
when CSR_CTRL_ADDR =>
avs_csr_readdata <= 21x"0" & seq_queue_empty & 5x"0" & rst_vector_out & debug_mode & busy & '0' & seq_enable;
seq_queue_empty <= '0';
seq_queue_empty <= '0';
when CSR_PC_ADDR =>
avs_csr_readdata(log2(SEQ_DEPTH)-1+ 16 downto 16) <= return_addr;
avs_csr_readdata(log2(SEQ_DEPTH)-1 downto 0) <= pc_value;
avs_csr_readdata(log2(SEQ_DEPTH) - 1 + 16 downto 16) <= return_addr;
avs_csr_readdata(log2(SEQ_DEPTH) - 1 downto 0) <= pc_value;
when CSR_TRIGGER_ADDR =>
avs_csr_readdata(TRIGGER_WIDTH - 1 downto 0) <= trigger_in;
when CSR_VECTOR_ADDR =>
@ -267,7 +267,7 @@ begin
when CSR_POS_STORE_ADDR =>
avs_csr_readdata(POS_WIDTH - 1 downto 0) <= pos_store;
when CSR_SEQ_QUEUE_ADDR =>
if(QUEUE_EN = true) then
if (QUEUE_EN = true) then
avs_csr_readdata <= queue_exec & queue_left & x"00";
end if;
when others => null;
@ -279,20 +279,24 @@ begin
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';
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.generic_seq_ram_15
generic map (
generic map(
SEQ_DEPTH => SEQ_DEPTH)
port map (
port map(
clock => clk,
address_a => avs_seq_address,
wren_a => avs_seq_write,
@ -314,10 +318,10 @@ begin
-- 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;
if (reset_n = '0') then
fsm <= s_idle;
elsif (clk = '1' and clk'event) then
fsm <= fsm_nxt;
end if;
end process pFSM_SR;
@ -325,7 +329,7 @@ begin
pFSM_CL : process(all)
begin
-- Default assignments
fsm_nxt <= fsm;
fsm_nxt <= fsm;
--
decode <= '0';
clr_vec_i <= '0';
@ -339,53 +343,53 @@ begin
loop_upd <= '0';
seq_completed <= '0';
set_queue_empty <= '0';
if(BUS_BURST_EN = true) then
bus_valid_i <= '0';
if (BUS_BURST_EN = true) then
bus_valid_i <= '0';
end if;
if(ALU_EN = true) then
alu_upd <= '0';
if (ALU_EN = true) then
alu_upd <= '0';
end if;
if(POS_BUS_EN = true) then
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
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
elsif (start_req_i = '1') then
busy_i <= '0';
ld_start_addr <= '1';
fsm_nxt <= s_init;
fsm_nxt <= s_init;
else
case fsm is
when s_idle =>
busy_i <= '0';
busy_i <= '0';
if seq_enable = '1' and start_req_i = '1' then
ld_start_addr <= '1';
fsm_nxt <= s_init;
fsm_nxt <= s_init;
end if;
when s_init =>
if(rst_vector_out = '1') then
if (rst_vector_out = '1') then
clr_vec_i <= '1';
end if;
end if;
fsm_nxt <= s_fetch;
when s_fetch =>
if(fetch_enable = '1') then
if (fetch_enable = '1') then
inc_ram_addr <= '1';
fetch_op <= '1';
fsm_nxt <= s_decode;
fsm_nxt <= s_decode;
end if;
when s_return =>
fsm_nxt <= s_fetch;
when s_decode =>
decode <= '1';
case opcode is
@ -408,135 +412,136 @@ begin
when CMD_END => fsm_nxt <= s_end;
when others => null;
end case;
when s_trig_mask =>
ld_trig_mask <= '1';
fsm_nxt <= s_fetch;
fsm_nxt <= s_fetch;
when s_trig_wait =>
if(trig_int = '1') then
if (trig_int = '1') then
inc_op_cnt <= '1';
end if;
if(op_cnt_done = '1') then
if (op_cnt_done = '1') then
fsm_nxt <= s_fetch;
end if;
when s_vec_set =>
ld_vec <= '1';
ld_vec <= '1';
fsm_nxt <= s_fetch;
when s_vec_ramp =>
if(VECT_RAMP_EN = false) then
if (VECT_RAMP_EN = false) then
fsm_nxt <= s_fetch;
else
if(trig_int = '1') then
if (trig_int = '1') then
inc_op_cnt <= '1';
if(op_cnt_done = '1') then
if (op_cnt_done = '1') then
fsm_nxt <= s_fetch;
end if;
end if;
end if;
when s_bus_burst =>
if(BUS_BURST_EN = true) then
if(op_cnt_done = '1') then
fsm_nxt <= s_fetch;
elsif(bus_ack = '1' and bus_pause = '0') then
inc_ram_addr <= '1';
inc_op_cnt <= '1';
bus_valid_i <= '1';
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
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
if (pos_in = pos_target) then
fsm_nxt <= s_fetch;
end if;
when s_alu =>
if(ALU_EN = true) then
alu_upd <= '1';
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;
fsm_nxt <= s_fetch;
when s_end =>
if(subcode = x"0") then
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
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;
fsm_nxt <= s_fetch;
else
set_queue_empty <= '1';
fsm_nxt <= s_end;
fsm_nxt <= s_end;
end if;
else
fsm_nxt <= s_idle;
end if;
when others => null;
end if;
when others => null;
end case;
end if;
end process pFSM_CL;
ld_trig_sel <= '1' when decode = '1' and opcode /= CMD_JUMP else '0';
ld_trig_sel <= '1' when decode = '1' and (opcode = CMD_TRIG_WAIT or opcode = CMD_VEC_RAMP_UP or opcode = CMD_VEC_RAMP_DN) 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;
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
if (fetch_op = '1') then
pc_value <= ram_rd_addr;
end if;
if(fetch_op = '1') then
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
busy <= busy_i;
if (ld_start_addr = '1') then
ram_rd_addr <= start_addr;
elsif(ld_jmp_addr = '1') then
elsif (ld_jmp_addr = '1') then
ram_rd_addr <= jump_addr;
elsif(ld_ret_addr = '1') then
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);
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
if (ld_trig_mask = '1') then
trig_mask <= operand_comp(TRIGGER_WIDTH - 1 downto 0);
end if;
if(ld_trig_sel = '1') then
if (ld_trig_sel = '1') then
trig_sel <= subcode;
end if;
if(ld_vec = '1' and subcode = "0001") then
if (ld_vec = '1' and subcode = "0001") then
clr_vec_ii <= '1';
else
clr_vec_ii <= '0';
clr_vec_ii <= '0';
end if;
if(clr_vec = '1') then
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 inc_op_cnt = '1') then
elsif (ld_vec = '1') then
vector_out_i <= operand_comp(VECTOR_WIDTH - 1 downto 0);
elsif (VECT_RAMP_EN = true and inc_op_cnt = '1') then
if ramp_up = '1' and ramp_val(ramp_val'high) = '0' and vector_out_i(vector_out_i'high) = '1' then
vector_out_i <= (others => '1');
elsif ramp_up = '0' and ramp_val(ramp_val'high) = '1' and vector_out_i(vector_out_i'high) = '0' then
@ -544,80 +549,80 @@ begin
else
vector_out_i <= ramp_val;
end if;
elsif(vector_val_cpu = '1') then
vector_out_i <=vector_cpu;
elsif (vector_val_cpu = '1') then
vector_out_i <= vector_cpu;
end if;
if(save_ret_addr = '1') then
if (save_ret_addr = '1') then
return_addr <= ram_rd_addr;
end if;
if(decode = '1') then
if (decode = '1') then
op_cnt <= (others => '0');
elsif(inc_op_cnt = '1') then
op_cnt <= std_logic_vector(unsigned(op_cnt)+1);
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
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
elsif (decode = '1' and opcode = CMD_LOOP) then
loop_active <= '1';
end if;
if(loop_active = '0' and opcode = CMD_LOOP) then
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);
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_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
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 flag = '0') or (subcode = X"2" and flag = '1'))) or (opcode = CMD_END and subcode = X"1") else '0';
jump_rel <= '1' when (opcode = CMD_BRANCH and (subcode = X"0" or (subcode = X"1" and flag = '0') or (subcode = X"2" and flag = '1'))) or (opcode = CMD_LOOP and loop_done = '0') or (opcode = CMD_END and subcode = X"2") else '0';
jump_r1 <= '1' when opcode = CMD_JUMP and subcode = X"F" else '0';
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';
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
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
gVECT_PIPE : if ADD_VEC_PIPE = true generate
pVECT_PIPE : process(clk)
begin
if(clk = '1' and clk'event) then
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_GEN : if VECT_RAMP_EN = true generate
ramp_val <= std_logic_vector(unsigned(vector_out_i) + unsigned(operand_2)) when ramp_up = '1' else
std_logic_vector(unsigned(vector_out_i) - unsigned(operand_2));
pRAMP_REGs : process(clk)
begin
if(clk = '1' and clk'event) then
if(decode = '1') then
if(opcode = CMD_VEC_RAMP_UP) then
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';
@ -625,31 +630,32 @@ begin
end if;
end if;
end process pRAMP_REGs;
end generate gRAMP_GEN;
gRAMP_NOGEN: if VECT_RAMP_EN = false generate
gRAMP_NOGEN : if VECT_RAMP_EN = false generate
ramp_val <= (others => '0');
ramp_up <= '0';
end generate gRAMP_NOGEN;
gBUS_BURST_GEN: if BUS_BURST_EN = true generate
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;
bus_pause <= bus_valid_i;
if(seq_enable = '0') then
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') then
bus_data <= ram_rd_data(BUS_WIDTH-1 downto 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
gBUS_BURST_NOGEN : if BUS_BURST_EN = false generate
bus_valid <= '0';
bus_pause <= '0';
@ -657,15 +663,15 @@ begin
end generate gBUS_BURST_NOGEN;
gPOS_GEN: if POS_BUS_EN = true generate
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
if (clk = '1' and clk'event) then
if (ld_pos = '1') then
pos_store <= pos_in;
end if;
if(decode = '1') then
if (decode = '1') then
case subcode is
when X"0" =>
pos_target <= operand_comp(pos_in'range);
@ -680,99 +686,101 @@ begin
end if;
end if;
end process pPOS_REGs;
end generate gPOS_GEN;
gALU_GEN: if ALU_EN = true generate
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
if (clk = '1' and clk'event) then
-- Update ALU register R1
if(busy_i = '0' and r1_data_valid = '1') then
if (busy_i = '0' and r1_data_valid = '1') then
r1 <= R1_data;
elsif(alu_upd = '1') then
elsif (alu_upd = '1') then
case subcode is
when x"2" =>
r1 <= operand_1;
r1_next := operand_1;
when x"3" =>
r1 <= std_logic_vector(signed(r1) + signed(operand_1));
r1_next := std_logic_vector(signed(r1) + signed(operand_1));
when x"4" =>
r1 <= std_logic_vector(signed(r1) - signed(operand_1));
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
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
flag <= '1';
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
flag <= '0';
zero_flag <= '0';
end if;
when x"1" | x"3" | x"4" =>
if(r1 = operand_1) then
flag <= '1';
when x"1" =>
if (r1 = operand_1) then
zero_flag <= '1';
else
flag <= '0';
zero_flag <= '0';
end if;
when x"2" =>
if(unsigned(operand_1) = 0) then
flag <= '1';
when x"2" | x"3" | x"4" =>
if (signed(r1_next) = 0) then
zero_flag <= '1';
else
flag <= '0';
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
gALU_NOGEN : if ALU_EN = false generate
r1 <= (others => '0');
zero_flag <= '0';
r1 <= (others => '0');
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
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);
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
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);
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;
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;
queue_add_flag_i <= queue_add_flag or queue_add_flag_d;
end generate gQUEUE_GEN;

View file

@ -14,6 +14,7 @@
-- Package defining common constants for generic_sequencer_15 core, such as
-- Control & Status registers offset etc.
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;

View file

@ -27,7 +27,7 @@ architecture behav of generic_sequencer_15_tb is
constant QUEUE_EN : boolean := true;
constant CSR_IP_ID : std_logic_vector(31 downto 0) := x"0000FF01";
constant CSR_IP_VER : std_logic_vector(31 downto 0) := x"00000F11";
constant CSR_IP_VER : std_logic_vector(31 downto 0) := x"00000F12";
constant CLK_PERIOD : time := 10 ns;
@ -255,32 +255,32 @@ begin
mm_32b_write(x"00000090", x"1000000F", seq_mm_s_rec, seq_mm_m_rec); -- TRIG_MASK
mm_32b_write(x"00000091", x"30000000", seq_mm_s_rec, seq_mm_m_rec); -- VEC_SET
mm_32b_write(x"00000092", x"20000001", seq_mm_s_rec, seq_mm_m_rec); -- TRIG_WAIT
mm_32b_write(x"00000093", x"A000000F", seq_mm_s_rec, seq_mm_m_rec); -- ALU
mm_32b_write(x"00000094", x"C2000090", seq_mm_s_rec, seq_mm_m_rec); -- JUMP (meant to fail)
mm_32b_write(x"00000093", x"A000000C", seq_mm_s_rec, seq_mm_m_rec); -- ALU
mm_32b_write(x"00000094", x"C1000090", seq_mm_s_rec, seq_mm_m_rec); -- JUMP (meant to fail)
mm_32b_write(x"00000095", x"30000001", seq_mm_s_rec, seq_mm_m_rec); -- VEC_SET
mm_32b_write(x"00000096", x"A000000F", seq_mm_s_rec, seq_mm_m_rec); -- ALU
mm_32b_write(x"00000097", x"C20000E0", seq_mm_s_rec, seq_mm_m_rec); -- JUMP
mm_32b_write(x"00000097", x"C10000E0", seq_mm_s_rec, seq_mm_m_rec); -- JUMP
mm_32b_write(x"00000098", x"30000002", seq_mm_s_rec, seq_mm_m_rec); -- VEC_SET
mm_32b_write(x"00000099", x"A20000A5", seq_mm_s_rec, seq_mm_m_rec); -- ALU
mm_32b_write(x"0000009A", x"A100005A", seq_mm_s_rec, seq_mm_m_rec); -- ALU
mm_32b_write(x"0000009B", x"C2000090", seq_mm_s_rec, seq_mm_m_rec); -- JUMP (meant to fail)
mm_32b_write(x"0000009B", x"C1000090", seq_mm_s_rec, seq_mm_m_rec); -- JUMP (meant to fail)
mm_32b_write(x"0000009C", x"30000003", seq_mm_s_rec, seq_mm_m_rec); -- VEC_SET
mm_32b_write(x"0000009D", x"A10000A5", seq_mm_s_rec, seq_mm_m_rec); -- ALU
mm_32b_write(x"0000009E", x"C20000E2", seq_mm_s_rec, seq_mm_m_rec); -- JUMP
mm_32b_write(x"0000009E", x"C10000E2", seq_mm_s_rec, seq_mm_m_rec); -- JUMP
mm_32b_write(x"0000009F", x"30000004", seq_mm_s_rec, seq_mm_m_rec); -- VEC_SET
mm_32b_write(x"000000A0", x"A3000001", seq_mm_s_rec, seq_mm_m_rec); -- ALU
mm_32b_write(x"000000A1", x"A10000A5", seq_mm_s_rec, seq_mm_m_rec); -- ALU
mm_32b_write(x"000000A2", x"C10000E2", seq_mm_s_rec, seq_mm_m_rec); -- JUMP
mm_32b_write(x"000000A2", x"C20000E2", seq_mm_s_rec, seq_mm_m_rec); -- JUMP
mm_32b_write(x"000000A3", x"30000005", seq_mm_s_rec, seq_mm_m_rec); -- VEC_SET
mm_32b_write(x"000000A4", x"A10000A6", seq_mm_s_rec, seq_mm_m_rec); -- ALU
mm_32b_write(x"000000A5", x"C20000E2", seq_mm_s_rec, seq_mm_m_rec); -- JUMP
mm_32b_write(x"000000A5", x"C10000E2", seq_mm_s_rec, seq_mm_m_rec); -- JUMP
mm_32b_write(x"000000A6", x"30000006", seq_mm_s_rec, seq_mm_m_rec); -- VEC_SET
mm_32b_write(x"000000A7", x"A4000002", seq_mm_s_rec, seq_mm_m_rec); -- ALU
mm_32b_write(x"000000A8", x"A10000A5", seq_mm_s_rec, seq_mm_m_rec); -- ALU
mm_32b_write(x"000000A9", x"C10000E2", seq_mm_s_rec, seq_mm_m_rec); -- JUMP
mm_32b_write(x"000000A9", x"C20000E2", seq_mm_s_rec, seq_mm_m_rec); -- JUMP
mm_32b_write(x"000000AA", x"30000007", seq_mm_s_rec, seq_mm_m_rec); -- VEC_SET
mm_32b_write(x"000000AB", x"A10000A4", seq_mm_s_rec, seq_mm_m_rec); -- ALU
mm_32b_write(x"000000AC", x"C20000E2", seq_mm_s_rec, seq_mm_m_rec); -- JUMP
mm_32b_write(x"000000AC", x"C10000E2", seq_mm_s_rec, seq_mm_m_rec); -- JUMP
mm_32b_write(x"000000AD", x"30000008", seq_mm_s_rec, seq_mm_m_rec); -- VEC_SET
mm_32b_write(x"000000AE", x"A20000E2", seq_mm_s_rec, seq_mm_m_rec); -- ALU
mm_32b_write(x"000000AF", x"CF000000", seq_mm_s_rec, seq_mm_m_rec); -- JUMP
@ -296,18 +296,18 @@ begin
mm_32b_write(x"000000C1", x"30000000", seq_mm_s_rec, seq_mm_m_rec); -- VEC_SET
mm_32b_write(x"000000C2", x"20000001", seq_mm_s_rec, seq_mm_m_rec); -- TRIG_WAIT
mm_32b_write(x"000000C3", x"D0000002", seq_mm_s_rec, seq_mm_m_rec); -- BRANCH
mm_32b_write(x"000000C4", x"C00000B0", seq_mm_s_rec, seq_mm_m_rec); -- JUMP (to not be executed)
mm_32b_write(x"000000C4", x"C00000C0", seq_mm_s_rec, seq_mm_m_rec); -- JUMP (to not be executed)
mm_32b_write(x"000000C5", x"30000001", seq_mm_s_rec, seq_mm_m_rec); -- VEC_SET
mm_32b_write(x"000000C6", x"A2000055", seq_mm_s_rec, seq_mm_m_rec); -- ALU
mm_32b_write(x"000000C7", x"A10000AA", seq_mm_s_rec, seq_mm_m_rec); -- ALU
mm_32b_write(x"000000C8", x"D1000002", seq_mm_s_rec, seq_mm_m_rec); -- BRANCH
mm_32b_write(x"000000C9", x"C00000B0", seq_mm_s_rec, seq_mm_m_rec); -- JUMP (to not be executed)
mm_32b_write(x"000000C8", x"D2000002", seq_mm_s_rec, seq_mm_m_rec); -- BRANCH
mm_32b_write(x"000000C9", x"C00000C0", seq_mm_s_rec, seq_mm_m_rec); -- JUMP (to not be executed)
mm_32b_write(x"000000CA", x"30000002", seq_mm_s_rec, seq_mm_m_rec); -- VEC_SET
mm_32b_write(x"000000CB", x"A1000055", seq_mm_s_rec, seq_mm_m_rec); -- ALU
mm_32b_write(x"000000CC", x"D1000FF4", seq_mm_s_rec, seq_mm_m_rec); -- BRANCH (to not be executed)
mm_32b_write(x"000000CC", x"D2000FF4", seq_mm_s_rec, seq_mm_m_rec); -- BRANCH (to not be executed)
mm_32b_write(x"000000CD", x"30000003", seq_mm_s_rec, seq_mm_m_rec); -- VEC_SET
mm_32b_write(x"000000CE", x"D2000002", seq_mm_s_rec, seq_mm_m_rec); -- BRANCH
mm_32b_write(x"000000CF", x"C00000B0", seq_mm_s_rec, seq_mm_m_rec); -- JUMP (to not be executed)
mm_32b_write(x"000000CE", x"D1000002", seq_mm_s_rec, seq_mm_m_rec); -- BRANCH
mm_32b_write(x"000000CF", x"C00000C0", seq_mm_s_rec, seq_mm_m_rec); -- JUMP (to not be executed)
mm_32b_write(x"000000D0", x"30000004", seq_mm_s_rec, seq_mm_m_rec); -- BRANCH
mm_32b_write(x"000000D1", x"F0000000", seq_mm_s_rec, seq_mm_m_rec); -- END
@ -359,6 +359,19 @@ begin
mm_32b_write(x"00000140", x"20000001", seq_mm_s_rec, seq_mm_m_rec); -- TRIG_WAIT
mm_32b_write(x"00000141", x"30000B00", seq_mm_s_rec, seq_mm_m_rec); -- VEC_SET
mm_32b_write(x"00000142", x"F1000131", seq_mm_s_rec, seq_mm_m_rec); -- END_AND_QUEUE-(JUMP to ox131)
-- BRANCH, ALU (2): Check Zero Flag update on ALU ADD/SUB
mm_32b_write(x"00000150", x"30000000", seq_mm_s_rec, seq_mm_m_rec); -- VEC_SET
mm_32b_write(x"00000151", x"A2000000", seq_mm_s_rec, seq_mm_m_rec); -- MOV R1, Op1
mm_32b_write(x"00000152", x"A3000001", seq_mm_s_rec, seq_mm_m_rec); -- ADD R1,R1, OP1
mm_32b_write(x"00000153", x"D2000002", seq_mm_s_rec, seq_mm_m_rec); -- BRANCH PC+2 IF FLAG/=0
mm_32b_write(x"00000154", x"C0000000", seq_mm_s_rec, seq_mm_m_rec); -- JUMP (to not be executed)
mm_32b_write(x"00000155", x"30000003", seq_mm_s_rec, seq_mm_m_rec); -- VEC_SET
mm_32b_write(x"00000156", x"A4000001", seq_mm_s_rec, seq_mm_m_rec); -- SUB R1,R1, OP1
mm_32b_write(x"00000157", x"D1000002", seq_mm_s_rec, seq_mm_m_rec); -- BRANCH PC+2 IF FLAG=0
mm_32b_write(x"00000158", x"C0000000", seq_mm_s_rec, seq_mm_m_rec); -- JUMP (to not be executed)
mm_32b_write(x"00000159", x"30000007", seq_mm_s_rec, seq_mm_m_rec); -- VEC_SET
mm_32b_write(x"0000015A", x"F0000000", seq_mm_s_rec, seq_mm_m_rec); -- END
--
@ -422,14 +435,14 @@ begin
end if;
end loop; -- n
if(valid = false) then
log("ERROR: cannot detect bus_valid before timeout.", VLOW);
log("ERROR: cannot detect bus_valid before timeout (Expected value = " & to_hstring(exp_val) & ").", VLOW);
error_flag <= true;
wait;
else
if(bus_data /= exp_val) then
log("ERROR: detected bus_data = 0x" & to_hstring(bus_data) & ", expected = 0x" & to_hstring(exp_val) & ".", VLOW);
error_flag <= true;
wait;
error_flag <= true;
wait;
end if;
end if;
end procedure check_burst_data;
@ -693,16 +706,24 @@ begin
trigger_in <= (0 => '1', others => '0');
wait_clk_cycles(1);
trigger_in <= (others => '0');
wait_clk_cycles(5);
wait_clk_cycles(2);
if(bus_valid /='1') then
wait until bus_valid = '1';
end if;
bus_ack <= '1';
check_burst_data(X"DEADBEEF", 4);
check_burst_data(X"BADA5555", 4);
check_burst_data(X"CAFEF00D", 4);
check_burst_data(X"DEADBEEF", 4);
check_burst_data(X"FFFF0000", 4);
check_burst_data(X"0000FFFF", 4);
check_burst_data(X"DEADBEEF", 1);
wait_clk_cycles(2);
check_burst_data(X"BADA5555", 1);
wait_clk_cycles(2);
check_burst_data(X"CAFEF00D", 1);
wait_clk_cycles(2);
check_burst_data(X"DEADBEEF", 1);
wait_clk_cycles(4);
check_burst_data(X"FFFF0000", 1);
wait_clk_cycles(4);
check_burst_data(X"0000FFFF", 1);
wait until busy = '0';
wait until bus_valid = '0';
bus_ack <= '0';
wait_clk_cycles(10);
@ -720,34 +741,36 @@ begin
trigger_in <= (others => '0');
wait_clk_cycles(5);
bus_ack <= '1';
--wait_clk_cycles(1);
--bus_ack <= '0';
check_burst_data(X"DEADBEEF", 1);
wait_clk_cycles(1);
bus_ack <= '0';
check_burst_data(X"DEADBEEF", 4);
wait_clk_cycles(3);
bus_ack <= '1';
check_burst_data(X"BADA5555", 1);
wait_clk_cycles(1);
bus_ack <= '0';
wait_clk_cycles(1);
bus_ack <= '1';
check_burst_data(X"CAFEF00D", 1);
wait_clk_cycles(1);
bus_ack <= '0';
check_burst_data(X"BADA5555", 4);
wait_clk_cycles(3);
bus_ack <= '1';
check_burst_data(X"DEADBEEF", 1);
wait_clk_cycles(1);
bus_ack <= '0';
check_burst_data(X"CAFEF00D", 4);
wait_clk_cycles(3);
bus_ack <= '1';
check_burst_data(X"FFFF0000", 1);
wait_clk_cycles(1);
bus_ack <= '0';
check_burst_data(X"DEADBEEF", 4);
wait_clk_cycles(3);
bus_ack <= '1';
check_burst_data(X"0000FFFF", 1);
wait_clk_cycles(1);
bus_ack <= '0';
check_burst_data(X"FFFF0000", 4);
wait_clk_cycles(3);
bus_ack <= '1';
wait_clk_cycles(1);
bus_ack <= '0';
check_burst_data(X"0000FFFF", 4);
wait until busy = '0';
wait_clk_cycles(10);
@ -1219,6 +1242,37 @@ begin
log("Completed.", VLOW);
wait_clk_cycles(10);
---------------------------------------------------------------------------
-- BRANCH/ALU Test (2)
---------------------------------------------------------------------------
wait_clk_cycles(20);
log_separator_line(VLOW);
log("Verifying BRANCH, ALU instructions (2) ...", VLOW);
-- Issue a start request
trigger_in <= (others => '0');
wait until clk = '1' and clk'event;
start_addr <= std_logic_vector(to_unsigned((16+5)*16, log2(SEQ_DEPTH)));
start_req <= '1';
wait until clk = '1' and clk'event;
start_req <= '0';
-- Issue a trigger event at the time
check_vector(7, 24x"0");
check_vector(vect_out_lat+6, 24x"3");
check_vector(vect_out_lat+6, 24x"7");
if(busy /= '0') then
wait until busy = '0';
end if;
log("Completed.", VLOW);
wait_clk_cycles(10);
---------------------------------------------------------------------------

View file

@ -4,7 +4,7 @@
"bus": "csr",
"addr_width": "4",
"description": "This block is the generic versioning",
"notes" : "NB: this block is a key component that is parsed externally, and cannot be renamed with major number tags in order to be processed correctly. Therefore do not modify the source code for this block. If a change is required for a project then a whole new component will be necessary and this signed off in review by the embedded logic line manager.",
"notes": "NB: this block is a key component that is parsed externally, and cannot be renamed with major number tags in order to be processed correctly. Therefore do not modify the source code for this block. If a change is required for a project then a whole new component will be necessary and this signed off in review by the embedded logic line manager.",
"registers": {
"ip_id": {
"address": "0",

View file

@ -50,7 +50,7 @@
"minor_number" : {
"type" : "c",
"bit_len" : "8",
"reset" : "0x05",
"reset" : "0x06",
"description" : "Minor number"
},
"major_number" : {

View file

@ -14,6 +14,7 @@
-- merge input pulses and pd events into a single bit signal, extend the witdth
-- to make sure the signal is safely transmitted over the POF
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;

View file

@ -6,7 +6,7 @@
-- Author : Gianmarco Girau
-- Company : Global Inkjet Systems
-- Created : 2016-10-24
-- Last update: 2019-05-23
-- Last update: 2019-07-22
-- SVN ID : Git
-- Standard : VHDL'93
-------------------------------------------------------------------------------
@ -32,44 +32,44 @@ use work.pulse_generator_1_pkg.all;
entity pulse_generator_1 is
generic(
PD_QUEUE_SIZE : natural range 32 to 1024 := 64;
PULSE_DELAY_EQUAL_EN : boolean := true;
OUT_PULSE_CONDITION : boolean := true;
OVERDRIVE_CHECK : boolean := true;
DIAG_COUNTERS : boolean := true);
PD_QUEUE_SIZE : natural range 32 to 1024 := 64;
PULSE_DELAY_EQUAL_EN : boolean := true;
OUT_PULSE_CONDITION : boolean := true;
OVERDRIVE_CHECK : boolean := true;
DIAG_COUNTERS : boolean := true);
port(
clk : in std_logic;
reset_n : in std_logic := '1';
clk : in std_logic;
reset_n : in std_logic := '1';
--
init : in std_logic;
init : in std_logic;
-- Sequencer I/Os
pd_in : in std_logic;
abs_position : in std_logic_vector(31 downto 0);
dp_dir : out std_logic;
pulse_out : out std_logic;
pd_in : in std_logic;
abs_position : in std_logic_vector(31 downto 0);
dp_dir : out std_logic;
pulse_out : out std_logic;
-- diagnostic outputs
filtered_pd : out std_logic;
ch_pd : out std_logic;
ch_mask : out std_logic;
raw_pulse_out : out std_logic;
enc_pulse : out std_logic;
filtered_pd : out std_logic;
ch_pd : out std_logic;
ch_mask : out std_logic;
raw_pulse_out : out std_logic;
enc_pulse : 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_readdatavalid : out std_logic;
avs_readdata : out std_logic_vector(31 downto 0));
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_readdatavalid : out std_logic;
avs_readdata : out std_logic_vector(31 downto 0));
end entity pulse_generator_1;
architecture rtl of pulse_generator_1 is
-- constants
constant CSR_IP_ID : std_logic_vector(31 downto 0) := x"0000FF13";
constant CSR_IP_VER : std_logic_vector(31 downto 0) := x"00000105";
constant CSR_IP_ID : std_logic_vector(31 downto 0) := x"0000FF13";
constant CSR_IP_VER : std_logic_vector(31 downto 0) := x"00000106";
signal init_de, init_qd, enable, loc_pd, pd_queue_error : std_logic;
@ -78,10 +78,10 @@ architecture rtl of pulse_generator_1 is
signal ch_mask_i, bypass_ch_ctrl, bypass_delay_equal : std_logic;
signal div_pulse, gated_pulse, retimed_pulse, pulse_out_i : std_logic;
signal avs_write_i, avs_read_d, avs_read_i, de_queue_error : std_logic;
signal cnt_dir, dp_dir_i, ch_mask_d, ch_ctrl_start_req_i : std_logic;
signal cnt_dir, dp_dir_i, ch_mask_d, ch_ctrl_start_req_i : std_logic; -- @suppress "signal ch_mask_d is never read" (testbench)
signal set_first_pd, pulse_out_ii : std_logic;
signal loc_pulse_out_d, loc_pulse, first_pulse, dp_dir_d : std_logic;
signal overdrive_rst, overdrv_event, pulse_scale_out : std_logic;
signal overdrive_rst, overdrv_event : 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;
@ -97,27 +97,27 @@ architecture rtl of pulse_generator_1 is
signal div_pulse_i, spitting_enable, spit_pulse : std_logic;
signal seq_bus_valid, spit_nco_msb : std_logic;
--
signal abs_pos_msb_old : std_logic_vector( 1 downto 0);
signal ch_ctrl_csr_addr, ch_ctrl_trigger_in : std_logic_vector( 3 downto 0);
signal avs_addr : std_logic_vector( 4 downto 0);
signal pulse_width, pulse_width_ext, init_v : std_logic_vector( 7 downto 0);
signal ch_ctrl_start_addr : std_logic_vector( 7 downto 0);
signal ch_ctrl_address : std_logic_vector( 7 downto 0);
signal avs_address_i : std_logic_vector( 9 downto 0);
signal overdrive_events, overdrive_thres : std_logic_vector(15 downto 0);
signal pulse_interval : std_logic_vector(15 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 ch_offset, ch_delay, 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 : std_logic_vector(31 downto 0);
signal pd_in_cnt, fire_req_cnt : std_logic_vector(31 downto 0);
signal seq_bus_data, spit_nco, spit_nco_inc : std_logic_vector(31 downto 0);
signal div_offset, div_ratio : std_logic_vector(33 downto 0);
signal abs_pos_msb_old : std_logic_vector(1 downto 0);
signal ch_ctrl_csr_addr, ch_ctrl_trigger_in : std_logic_vector(3 downto 0);
signal avs_addr : std_logic_vector(4 downto 0);
signal pulse_width, pulse_width_ext, init_v : std_logic_vector(7 downto 0);
signal ch_ctrl_start_addr : std_logic_vector(7 downto 0);
signal ch_ctrl_address : std_logic_vector(7 downto 0);
signal avs_address_i : std_logic_vector(9 downto 0);
signal overdrive_events, overdrive_thres : std_logic_vector(15 downto 0);
signal pulse_interval : std_logic_vector(15 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 ch_offset, ch_delay, 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 : std_logic_vector(31 downto 0);
signal pd_in_cnt, fire_req_cnt : std_logic_vector(31 downto 0);
signal seq_bus_data, spit_nco, spit_nco_inc : std_logic_vector(31 downto 0);
signal div_offset, div_ratio : std_logic_vector(33 downto 0);
begin
@ -133,38 +133,38 @@ begin
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 = '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';
(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';
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
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
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
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
if (init_qd = '1' or zero_cross = '1') then
mid_crossed <= '0';
elsif(mid_cross = '1') then
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';
@ -180,11 +180,11 @@ begin
-- next increment of absolute position
pLOC_PD_IN : process(clk)
begin
if(clk = '1' and clk'event) then
if (clk = '1' and clk'event) then
abs_pos_lsb <= abs_position(0);
if(filt_pd = '1' and filt_pd_d = '0') then
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
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;
@ -195,8 +195,8 @@ begin
iPD_queue: entity work.queue_and_delay
generic map (
use_ext_time => true,
queue_size => 2*PD_QUEUE_SIZE)
port map (
queue_size => 2 * PD_QUEUE_SIZE)
port map(
rstN => reset_n,
clk => clk,
init => init_qd,
@ -209,13 +209,13 @@ begin
-- make sure the PD queue is always cleared whenever there is a change of direction
dir_change <= dp_dir_i xor dp_dir_d;
init_qd <= not enable or init or dir_change;
init_qd <= not enable or init or dir_change;
-- channel offset selection
pCH_OFF_SEL : process(clk)
begin
if(clk = '1' and clk'event) then
if(dp_dir_i = '0') then
if (clk = '1' and clk'event) then
if (dp_dir_i = '0') then
ch_offset <= ch_offset_dir0;
else
ch_offset <= ch_offset_dir1;
@ -231,8 +231,8 @@ begin
pDIR_CHG : process(clk)
begin
if(clk = '1' and clk'event) then
if(bypass_ch_ctrl = '1') then
if (clk = '1' and clk'event) then
if (bypass_ch_ctrl = '1') then
dp_dir_i <= sw_ctrl_dp_dir;
else
dp_dir_i <= ch_ctrl_vector_out(0);
@ -256,8 +256,8 @@ begin
-- - Gating signal (ch_mask)
i_channel_control : entity work.generic_sequencer_15
generic map (
TRIGGER_WIDTH => 4,
generic map(
TRIGGER_WIDTH => 4,
VECTOR_WIDTH => 24,
BUS_WIDTH => 32,
POS_WIDTH => 24,
@ -268,31 +268,31 @@ begin
POS_BUS_EN => true,
ALU_EN => false,
QUEUE_EN => true)
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');
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));
ch_mask_i <= fire_enable or ch_ctrl_vector_out(1) or bypass_ch_ctrl;
-- output to the monitoring point/event-logger
@ -306,60 +306,60 @@ begin
--clock cycle
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;
ch_ctrl_start_req <= ch_ctrl_start_req_i and not ch_ctrl_start_req_d;
pGEN_IMAGE: process(clk)
pGEN_IMAGE : process(clk)
begin
if(clk = '1' and clk'event) then
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
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
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)));
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') then
pixel_cnt <= (others => '0');
elsif(fire_enable = '1' and div_pulse = '1') then
pixel_cnt <= std_logic_vector(unsigned(pixel_cnt)+1);
if (start_img = '1' and fire_enable = '0') then
pixel_cnt <= (others => '0');
elsif (fire_enable = '1' and div_pulse = '1') then
pixel_cnt <= std_logic_vector(unsigned(pixel_cnt) + 1);
end if;
end if;
end process pGEN_IMAGE;
start_img <= start_img_req and not start_img_req_d;
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';
-- DO NOT REMOVE: USED BY THE TESTBENCH!
-- synthesis translate_off
p_ch_mask_d : process(clk)
begin
if(clk = '1' and clk'event) then
if (clk = '1' and clk'event) then
ch_mask_d <= ch_mask_i;
end if;
end process p_ch_mask_d;
-- synthesis translate_on
-----------------------------------------------------------------------------
-- Fractional Divider
-----------------------------------------------------------------------------
iFracDiv : entity work.simple_frac_div_1
port map (
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,
dir => dp_dir_i,
offset => div_offset,
ratio => div_ratio,
abs_pos => abs_position,
@ -375,7 +375,7 @@ begin
p_pulse_div_switch : process(clk)
begin
if(clk = '1' and clk'event) then
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);
@ -392,18 +392,18 @@ begin
pSPITTING_LOGIC : process(clk)
begin
if(clk = '1' and clk'event) then
if (clk = '1' and clk'event) then
spitting_enable <= ch_ctrl_vector_out(6);
if(seq_bus_valid = '1') then
if (seq_bus_valid = '1') then
spit_nco_inc <= seq_bus_data;
end if;
if(spitting_enable = '0') then
if (spitting_enable = '0') then
spit_nco <= (others => '0');
else
spit_nco <= std_logic_vector(unsigned(spit_nco)+unsigned(spit_nco_inc));
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;
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;
@ -424,7 +424,7 @@ begin
generic map (
use_ext_time => false,
queue_size => 256)
port map (
port map(
rstN => reset_n,
clk => clk,
init => init_de,
@ -439,7 +439,7 @@ begin
end generate gPULSE_DELAY_EQUAL;
gNOT_PULSE_DELAY_EQUAL: if PULSE_DELAY_EQUAL_EN = false generate
gNOT_PULSE_DELAY_EQUAL : if PULSE_DELAY_EQUAL_EN = false generate
retimed_pulse <= gated_pulse;
@ -449,8 +449,8 @@ begin
p_delay_equal_switch : process(clk)
begin
if(clk = '1' and clk'event) then
if(bypass_delay_equal = '1') then
if (clk = '1' and clk'event) then
if (bypass_delay_equal = '1') then
pulse_out_i <= gated_pulse;
else
pulse_out_i <= retimed_pulse;
@ -463,32 +463,32 @@ begin
-----------------------------------------------------------------------------
gODRV_CHK : if OVERDRIVE_CHECK = true generate
loc_pulse <= enable and (pulse_out_i and not loc_pulse_out_d);
pODRV_CHK : process(clk)
begin
if(clk = '1' and clk'event) then
if (clk = '1' and clk'event) then
loc_pulse_out_d <= pulse_out_i;
if(enable = '0' or overdrive_rst = '1' or unsigned(pulse_interval) = 2**16-1) then
if (enable = '0' or overdrive_rst = '1' or unsigned(pulse_interval) = 2**16 - 1) then
first_pulse <= '1';
elsif(loc_pulse = '1') then
elsif (loc_pulse = '1') then
first_pulse <= '0';
end if;
if(loc_pulse = '1') then
if (loc_pulse = '1') then
pulse_interval <= (others => '0');
else
pulse_interval <= std_logic_vector(unsigned(pulse_interval)+1);
pulse_interval <= std_logic_vector(unsigned(pulse_interval) + 1);
end if;
if(loc_pulse = '1' and first_pulse = '0' and unsigned(pulse_interval) < unsigned(overdrive_thres)) then
if (loc_pulse = '1' and first_pulse = '0' and unsigned(pulse_interval) < unsigned(overdrive_thres)) then
overdrv_event <= '1';
else
overdrv_event <= '0';
end if;
if(enable = '0' or overdrive_rst = '1') then
if (enable = '0' or overdrive_rst = '1') then
overdrive_events <= (others => '0');
elsif(overdrv_event = '1') then
overdrive_events <= std_logic_vector(unsigned(overdrive_events)+1);
elsif (overdrv_event = '1') then
overdrive_events <= std_logic_vector(unsigned(overdrive_events) + 1);
end if;
end if;
end process pODRV_CHK;
@ -501,18 +501,18 @@ begin
first_pulse <= '0';
pulse_interval <= (others => '0');
overdrive_events <= (others => '0');
overdrv_event <= '0';
overdrv_event <= '0';
end generate gNOT_ODRV_CHK;
-----------------------------------------------------------------------------
-- Pulse Width Conditioning
-----------------------------------------------------------------------------
gOUT_COND: if OUT_PULSE_CONDITION = true generate
iPC: entity work.pulse_conditioning_1
port map (
gOUT_COND : if OUT_PULSE_CONDITION = true generate
iPC : entity work.pulse_conditioning_1
port map(
reset_n => reset_n,
clk => clk,
enable => enable,
@ -526,7 +526,7 @@ begin
fire_req <= pulse_out_ii when bypass_pulse_cond = '0' else pulse_out_i;
end generate gOUT_COND;
gOUT_BYPASS : if OUT_PULSE_CONDITION = false generate
pulse_out <= pulse_out_i;
@ -539,33 +539,33 @@ begin
-----------------------------------------------------------------------------
gDIAG_CNT: if DIAG_COUNTERS = true generate
gDIAG_CNT : if DIAG_COUNTERS = true generate
pEdgeDetect_Cnt : process(clk)
begin
if(clk = '1' and clk'event) then
fire_req_d <= fire_req;
if(init = '1' or enable = '0' or rst_diag_regs = '1') then
if (clk = '1' and clk'event) then
fire_req_d <= fire_req;
if (init = '1' or enable = '0' or rst_diag_regs = '1') then
pd_in_cnt <= (others => '0');
elsif(pd_pulse = '1') then
pd_in_cnt <= std_logic_vector(unsigned(pd_in_cnt)+1);
elsif (pd_pulse = '1') then
pd_in_cnt <= std_logic_vector(unsigned(pd_in_cnt) + 1);
end if;
if(init = '1' or enable = '0' or rst_diag_regs = '1') then
if (init = '1' or enable = '0' or rst_diag_regs = '1') then
fire_req_cnt <= (others => '0');
elsif(fire_req_p = '1') then
fire_req_cnt <= std_logic_vector(unsigned(fire_req_cnt)+1);
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;
fire_req_p <= fire_req and not fire_req_d;
fire_req_p <= fire_req and not fire_req_d;
end generate gDIAG_CNT;
gNOT_DIAG_CNT: if DIAG_COUNTERS = false generate
gNOT_DIAG_CNT : if DIAG_COUNTERS = false generate
pd_in_cnt <= (others => '0');
fire_req_cnt <= (others => '0');
end generate gNOT_DIAG_CNT;
-----------------------------------------------------------------------------
@ -580,12 +580,12 @@ begin
ch_ctrl_write <= '1' when avs_write = '1' and avs_address(9) = '1' else '0';
ch_ctrl_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';
ch_ctrl_read <= '1' when avs_read = '1' and avs_address(9) = '1' else '0';
ch_ctrl_csr_read <= '1' when avs_read = '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';
ch_ctrl_read <= '1' when avs_read = '1' and avs_address(9) = '1' else '0';
ch_ctrl_csr_read <= '1' when avs_read = '1' and avs_address(9 downto 5) = "00001" else '0';
avs_addr <= avs_address(4 downto 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);
@ -594,8 +594,8 @@ begin
pINIT : process(clk)
begin
if(clk = '1' and clk'event) then
if(init = '1') then
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);
@ -607,86 +607,86 @@ begin
pCTRL_STATUS : process(reset_n, clk)
begin
if(reset_n = '0') then
avs_read_d <= '0';
avs_readdatavalid <= '0';
avs_readdata_i <= (others => '0');
if (reset_n = '0') then
avs_read_d <= '0';
avs_readdatavalid <= '0';
avs_readdata_i <= (others => '0');
--
enable_i <= '0';
bypass_ch_ctrl <= '0';
bypass_pulse_cond <= '0';
bypass_delay_equal <= '0';
sw_ctrl_dp_dir <= '0';
enable_out <= '0';
abort_fire <= '0';
enable_i <= '0';
bypass_ch_ctrl <= '0';
bypass_pulse_cond <= '0';
bypass_delay_equal <= '0';
sw_ctrl_dp_dir <= '0';
enable_out <= '0';
abort_fire <= '0';
--
ch_offset_dir0 <= (others => '0');
ch_offset_dir1 <= (others => '0');
ch_delay <= (others => '0');
ch_offset_dir0 <= (others => '0');
ch_offset_dir1 <= (others => '0');
ch_delay <= (others => '0');
--
ch_ctrl_start_req_ii <= '0';
ch_ctrl_start_addr <= (others => '0');
ch_ctrl_start_addr <= (others => '0');
--
frac_div_en_i <= '0';
upd_max_pos_i <= '0';
upd_min_pos_i <= '0';
frac_div_en_i <= '0';
upd_max_pos_i <= '0';
upd_min_pos_i <= '0';
--
pulse_width <= std_logic_vector(to_unsigned(20,8)); -- 200 ns at clk=100MHz
pulse_width_ext <= std_logic_vector(to_unsigned(50,8)); -- 500 ns at clk=100MHz
pulse_width <= std_logic_vector(to_unsigned(20, 8)); -- 200 ns at clk=100MHz
pulse_width_ext <= std_logic_vector(to_unsigned(50, 8)); -- 500 ns at clk=100MHz
--
overdrive_rst <= '0';
overdrive_thres <= std_logic_vector(to_unsigned(100-1,16));
overdrive_rst <= '0';
overdrive_thres <= std_logic_vector(to_unsigned(100 - 1, 16));
--
div_offset <= (others => '0');
div_ratio <= (others => '0');
elsif(clk = '1' and clk'event) then
div_offset <= (others => '0');
div_ratio <= (others => '0');
elsif (clk = '1' and clk'event) then
-- CTRL registers
if(avs_write_i = '1' and avs_address(9 downto 4) = "000000") then
if (avs_write_i = '1' and avs_address(9 downto 4) = "000000") then
case avs_addr is
when PULSE_GEN_CTRL_REG =>
enable_i <= avs_writedata(0);
bypass_ch_ctrl <= avs_writedata(1);
bypass_pulse_cond <= avs_writedata(2);
bypass_delay_equal <= avs_writedata(3);
sw_ctrl_dp_dir <= avs_writedata(4);
enable_out <= avs_writedata(16);
abort_fire <= avs_writedata(17);
rst_diag_regs <= avs_writedata(18);
enable_i <= avs_writedata(0);
bypass_ch_ctrl <= avs_writedata(1);
bypass_pulse_cond <= avs_writedata(2);
bypass_delay_equal <= avs_writedata(3);
sw_ctrl_dp_dir <= avs_writedata(4);
enable_out <= avs_writedata(16);
abort_fire <= avs_writedata(17);
rst_diag_regs <= avs_writedata(18);
when CH_OFFSET_D0_REG =>
ch_offset_dir0 <= avs_writedata;
ch_offset_dir0 <= avs_writedata;
when CH_DELAY_REG =>
ch_delay <= avs_writedata;
ch_delay <= avs_writedata;
when CH_CTRL_CTRL_REG =>
ch_ctrl_start_req_ii <= avs_writedata(0);
ch_ctrl_start_addr <= avs_writedata(15 downto 8);
ch_ctrl_start_addr <= avs_writedata(15 downto 8);
when FRAC_DIV_CTRL_REG =>
frac_div_en_i <= avs_writedata(0);
upd_max_pos_i <= avs_writedata(1);
upd_min_pos_i <= avs_writedata(2);
frac_div_en_i <= avs_writedata(0);
upd_max_pos_i <= avs_writedata(1);
upd_min_pos_i <= avs_writedata(2);
when PULSE_WIDTH_REG =>
pulse_width <= avs_writedata( 7 downto 0);
pulse_width_ext <= avs_writedata(23 downto 16);
pulse_width <= avs_writedata(7 downto 0);
pulse_width_ext <= avs_writedata(23 downto 16);
when OVERDRV_THRES_REG =>
overdrive_rst <= avs_writedata(0);
overdrive_thres <= avs_writedata(31 downto 16);
overdrive_rst <= avs_writedata(0);
overdrive_thres <= avs_writedata(31 downto 16);
when CH_OFFSET_D1_REG =>
ch_offset_dir1 <= avs_writedata;
ch_offset_dir1 <= avs_writedata;
when DIV_RATIO_INT =>
div_ratio(33 downto 24) <= avs_writedata( 9 downto 0);
div_ratio(33 downto 24) <= avs_writedata(9 downto 0);
when DIV_RATIO_FRAC =>
div_ratio(23 downto 0) <= avs_writedata(23 downto 0);
div_ratio(23 downto 0) <= avs_writedata(23 downto 0);
when SP_OFFSET_INT =>
div_offset(33 downto 24) <= avs_writedata( 9 downto 0);
div_offset(33 downto 24) <= avs_writedata(9 downto 0);
when SP_OFFSET_FRAC =>
div_offset(23 downto 0) <= avs_writedata(23 downto 0);
div_offset(23 downto 0) <= avs_writedata(23 downto 0);
when others => null;
end case;
end if;
-- Read Ctrl & Status registers
avs_read_d <= avs_read;
avs_readdatavalid <= avs_read_d;
if(avs_read_i = '1') then
if (avs_read_i = '1') then
case avs_addr is
when CSR_IP_ID_ADDR =>
avs_readdata_i <= CSR_IP_ID;
@ -694,13 +694,13 @@ begin
avs_readdata_i <= CSR_IP_VER;
when PULSE_GEN_CTRL_REG =>
avs_readdata_i(31 downto 8) <= (8 => ch_mask_i, 9 => fire_enable, 10 => dp_dir, 16 => enable_out, 17 => abort_fire, 18 => rst_diag_regs, others => '0');
avs_readdata_i( 7 downto 4) <= b"0" & de_queue_error & pd_queue_error & sw_ctrl_dp_dir;
avs_readdata_i( 3 downto 0) <= bypass_delay_equal & bypass_pulse_cond & bypass_ch_ctrl & enable_i;
when CH_OFFSET_D0_REG =>
avs_readdata_i(7 downto 4) <= b"0" & de_queue_error & pd_queue_error & sw_ctrl_dp_dir;
avs_readdata_i(3 downto 0) <= bypass_delay_equal & bypass_pulse_cond & bypass_ch_ctrl & enable_i;
when CH_OFFSET_D0_REG =>
avs_readdata_i <= ch_offset_dir0;
when CH_OFFSET_D1_REG =>
when CH_OFFSET_D1_REG =>
avs_readdata_i <= ch_offset_dir1;
when CH_DELAY_REG =>
when CH_DELAY_REG =>
avs_readdata_i <= ch_delay;
when CH_CTRL_CTRL_REG =>
avs_readdata_i <= X"0000" & ch_ctrl_start_addr & X"0" & "00" & ch_ctrl_busy & ch_ctrl_start_req_ii;
@ -709,7 +709,7 @@ begin
when PULSE_WIDTH_REG =>
avs_readdata_i <= X"00" & pulse_width_ext & X"00" & pulse_width;
when OVERDRV_THRES_REG =>
avs_readdata_i(15 downto 0) <= (0 => overdrive_rst, others => '0');
avs_readdata_i(15 downto 0) <= (0 => overdrive_rst, others => '0');
avs_readdata_i(31 downto 16) <= overdrive_thres;
when OVERDRV_EVENT_REG =>
avs_readdata_i <= X"0000" & overdrive_events;
@ -737,11 +737,11 @@ begin
else
avs_readdata_i <= X"BAD1BAD0";
end if;
if(avs_read = '1') then
if (avs_read = '1') then
avs_address_i <= avs_address;
end if;
-- output multiplexer
case? avs_address_i( 9 downto 5) is
case? avs_address_i(9 downto 5) is
when "00000" =>
avs_readdata <= avs_readdata_i;
when "00001" =>
@ -750,8 +750,8 @@ begin
avs_readdata <= ch_ctrl_readdata;
when others =>
avs_readdata <= X"BAD1BAD0";
end case?;
end case?;
end if;
end process pCTRL_STATUS;
end process pCTRL_STATUS;
end architecture rtl;

View file

@ -22,6 +22,7 @@
-- 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;

View file

@ -6,7 +6,7 @@
-- Author : Gianmarco Girau
-- Company : Global Inkjet Systems
-- Created : 2016-05-28
-- Last update: 2019-05-22
-- Last update: 2019-07-22
-- SVN ID : Git
-- Standard : VHDL'93
-------------------------------------------------------------------------------
@ -14,6 +14,7 @@
-- merge input pulses and pd events into a single bit signal, extend the witdth
-- to make sure the signal is safely transmitted over the POF
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;

View file

@ -6,7 +6,7 @@
-- Author : Gianmarco Girau
-- Company : Global Inkjet Systems
-- Created : 2017-12-04
-- Last update: 2019-05-22
-- Last update: 2019-07-22
-- SVN ID : Git
-- Standard : VHDL'2008
-------------------------------------------------------------------------------
@ -22,6 +22,7 @@
-- 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;

View file

@ -14,6 +14,7 @@
-- som_ctrl block: this block gathers together SOM specific functionalies, such
-- as the SWIM interface, power-good input signals, host-power enable signals etc.
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;

View file

@ -13,6 +13,7 @@
-- Description:
-- Package defining common constants for the som_ctrl, block
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;