ELGIP-112 Added new component major version 2 of generic delay queue using autogenerated registers

This commit is contained in:
Christos Spirotis 2021-06-15 09:24:46 +01:00
commit 929eec9198
9 changed files with 1487 additions and 0 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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