CORE-798 Make EL GIP Library FPGA Vendor Independent.

Print Streamer v8 - fpga vendor independent. Change to Streamer_fifo_1 (fpga vendor independent)
This commit is contained in:
David Steele 2022-09-20 15:01:35 +01:00
commit b34ecaa614
7 changed files with 1428 additions and 0 deletions

View file

@ -0,0 +1,374 @@
[{
"ip_name" : "data_streamer_8",
"bus" : "csr",
"addr_width" : "4",
"description" : "This block is the print streamer for the GMA SOM board soft IP",
"notes" : "The print streamer is a block that allows read access to the main memory. It is either used to access physical locations in memory, or to access virtual locations mapped to physical page blocks (4096 bytes, or 1024 words). The main CPU control is via the CMD_PORT register. This accepts a variety of commands (see https://confluence.gisapps.co.uk/display/EL/Embedded+Logic+Print+Streamer+New+Architecture) to send stripe data to external ports, to put virtual to physical mappings into the TLB queue or to load new commands directly into the command queue from memory. The CPU must only send commands (two words) when there is sufficient space, as indicated by the QUEUE_SPACE field of the STATUS register. When using the RD_STRIPE_PADDR command, the TLB queue can be empty (with no LOAD_ADDR_MAP commands needed). When using one of the virtual address commands (e.g. RD_STRIPE_VADDR or LOAD_CMD_Q), the TLB queue must be pre-filled with mappings that cover the data transfer commands, using the LD_ADDR_MAP command. If the transfer is less than a page length, and does not cross a page boundary, then a LD_ADDR_MAP command is sent to map the physical location to the virtual address of the data, before sending the RD_STRIPE_VADDR command. If the data spans a page boundary, then two LD_ADDR_MAP commands are sent prior to the RD_STRIPE_VADDR, to map the two separate physical pages to the two (contiguous) pages in the virtual address space. Similarly, if a transfer spans multiple pages, the appropriate number of LD_ADDR_MAP commands are sent first before the RD_STRIPE_VADDR command to cover the pages for that data. Note that if the transfer is a continuation of data in a page that the last transfer completed in, then the map for this first page should not be sent, as it will still be the active mapping in the streamer. The CLR_CMD bit in the CONTROL register clears all commands and TLB mappings, so for a completely new transfer the TLB can be reset with this. The print streamer is capable of loading itself with new commands directly from memory, also using virtual addressing. The LOAD_CMD_Q command is identical in its usage to the RD_STRIPE_VADDR command, but with the destination being the command queue. Therefore commands can be pre-compiled in memory and then a LD_CMD_Q command sent to place them in the queue and start executing. If the last command in the batch is also a LD_CMD_Q, then the commands can be linked in memory indefinitely. The print streamer monitors when LD_CMD_Q commands are in the print streamer---either in the command queue itself, or active on the bus. This status is flagged as the AUTO_CMD_ACTIVE bit of the STATUS register, and the CPU must not attempt to write to the command queue when set, as this is a race hazard and could corrupt the command queue data. If a CPU write does occur, an error is flagged. In addition, if a LD_CMD_Q has a word length that is greater than the command queue length, this is an error and flagged. Various errors are monitored for, and the STATUS register returns various error statuses. If any error is active, then the print streamer is halted until the error consitions are cleared via the CLEAR_ERRORS and CLEAR_CMD bits of the CONTROL register. The errors detected include a failure to get a TLB virtual/physical mapping, an empty TLB queue when processing a virtual address command, an LD_CMD_Q with a too large word length parameter, an unrecognised command and a CPU access when LD_CMD_Q active (see the error bits of the STATUS register). The print streamer can generate an interrupt to the CPU. All error types will assert the IRQ output. In addition, if the number of commands in the command queue falls below a certain value, as configured in the WATERMARK field of the CONTROL register, IRQ is also asserted. This is effectively disabled if the watermark value is 0 (the reset value).",
"registers" : {
"ip_id" : {
"address" : "0",
"width" : "32",
"description" : "Unique ID for this IP block",
"fields": {
"ip_number" : {
"type" : "r",
"bit_len" : "8",
"reset" : "0x0d",
"description" : "IP identifier number"
},
"mfr_number" : {
"type" : "r",
"bit_len" : "8",
"reset" : "0x04",
"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" : "r",
"bit_len" : "8",
"reset" : "0x00",
"description" : "Minor number"
},
"major_number" : {
"type" : "r",
"bit_len" : "8",
"reset" : "0x08",
"description" : "Major number"
},
"reserved" : {
"type" : "rsv",
"bit_len" : "16",
"description" : "Reserved bits"
}
}
},
"cmd_port" : {
"address" : "2",
"width" : "32",
"type" : "wp",
"reset" : "0",
"description" : "Command port. A write adds a word to the command queue. Command is command code followed by parameter word. Only safe to write a command if QUEUE_SPACE in STATUS register is not 0."
},
"control" : {
"address" : "3",
"width" : "14",
"description" : "Control",
"fields" : {
"clear_cmd" : {
"type" : "w0",
"bit_len" : "1",
"reset" : "0",
"description" : "Clear the command queue of all commands (and the TLB queue of mappings)."
},
"clear_errors" : {
"type" : "w0",
"bit_len" : "1",
"reset" : "0",
"description" : "Clear outstanding errors."
},
"msb" : {
"type" : "w",
"bit_len" : "1",
"reset" : "0",
"description" : "Memory read data byte order is MSB"
},
"watermark" : {
"type" : "w",
"bit_len" : "8",
"reset" : "0",
"description" : "Watermark level to assert interrupt if command queue space falls below this value"
},
"en_acp_window" : {
"type" : "w",
"bit_len" : "1",
"reset" : "1",
"description" : "Enable AXI access via the ACP window"
},
"disable" : {
"type" : "w",
"bit_len" : "1",
"reset" : "0",
"description" : "Disable print streamer"
},
"clr_dst0_count" : {
"type" : "w0",
"bit_len" : "1",
"reset" : "0",
"description" : "Clear dst0 counter"
}
}
},
"status" : {
"address" : "4",
"width" : "28",
"description" : "Command port",
"fields" : {
"queue_space" : {
"type" : "r",
"bit_len" : "5",
"reset" : "16",
"description" : "Amount of command space left in queue, in units of commands (2 words). I.e. when 1, can write a single command of two words."
},
"tlb_mismatch_err" : {
"type" : "r",
"bit_len" : "1",
"reset" : "0",
"description" : "TLB mapping mis-match error."
},
"tlb_empty_err" : {
"type" : "r",
"bit_len" : "1",
"reset" : "0",
"description" : "TLB empty error."
},
"auto_load_err" : {
"type" : "r",
"bit_len" : "1",
"reset" : "0",
"description" : "Auto-load command request too big for queue."
},
"bad_cmd_err" : {
"type" : "r",
"bit_len" : "1",
"reset" : "0",
"description" : "Unrecognised command error."
},
"cpu_race_err" : {
"type" : "r",
"bit_len" : "1",
"reset" : "0",
"description" : "CPU write to command queue with active auto-load commands error."
},
"overrun_err" : {
"type" : "r",
"bit_len" : "1",
"reset" : "0",
"description" : "CPU write to command queue when full error."
},
"auto_cmd_active" : {
"type" : "r",
"bit_len" : "1",
"reset" : "0",
"description" : "One or more auto-loading commands are active, and CPU writes to the command port are hazardous."
},
"cmd_depth_log2" : {
"type" : "r",
"bit_len" : "4",
"reset" : "5",
"description" : "The Log2 value of the maximum command queue depth"
},
"handle" : {
"type" : "r",
"bit_len" : "12",
"reset" : "0",
"description" : "Last handle set by a NOP command to streamer"
}
}
},
"diags" : {
"address" : "5",
"width" : "28",
"description" : "Command port",
"fields" : {
"remain" : {
"type" : "r",
"bit_len" : "12",
"reset" : "0",
"description" : "Remaining burst count"
},
"cmd_pending" : {
"type" : "r",
"bit_len" : "1",
"reset" : "0",
"description" : "Command pending"
},
"data_active" : {
"type" : "r",
"bit_len" : "1",
"reset" : "0",
"description" : "Data transfer active"
},
"cmd_avail" : {
"type" : "r",
"bit_len" : "1",
"reset" : "0",
"description" : "Command available"
},
"dst_sel" : {
"type" : "r",
"bit_len" : "4",
"reset" : "0",
"description" : "Destination select"
},
"dst_rdy" : {
"type" : "r",
"bit_len" : "1",
"reset" : "0",
"description" : "Destination ready"
},
"logger_wr_ptr" : {
"type" : "r",
"bit_len" : "8",
"reset" : "0",
"description" : "Data streamer command logger write pointer"
}
}
},
"curr_cmd" : {
"address" : "6",
"width" : "32",
"type" : "r",
"reset" : "0",
"description" : "Current active command"
},
"curr_param1" : {
"address" : "7",
"width" : "32",
"type" : "r",
"reset" : "0",
"description" : "Current active parameter 1"
},
"dst0_word_count" : {
"address" : "8",
"width" : "32",
"type" : "r",
"reset" : "0",
"description" : "Word count for destination 0"
},
"fifo_wr_port" : {
"address" : "9",
"width" : "32",
"type" : "wp",
"reset" : "0",
"description" : "Fifo queue write port"
},
"fifo_rd_port" : {
"address" : "10",
"width" : "32",
"type" : "rp",
"reset" : "0",
"description" : "Fifo queue read port"
},
"fifo_status" : {
"address" : "11",
"width" : "14",
"description" : "FIFO queue status",
"fields" : {
"empty" : {
"type" : "r",
"bit_len" : "1",
"reset" : "0",
"description" : "Fifo empty"
},
"full" : {
"type" : "r",
"bit_len" : "1",
"reset" : "0",
"description" : "FIFO full"
},
"underrun" : {
"type" : "r",
"bit_len" : "1",
"reset" : "0",
"description" : "FIFO underrun"
},
"overrun" : {
"type" : "r",
"bit_len" : "1",
"reset" : "0",
"description" : "FIFO overrun"
},
"loop_count" : {
"type" : "r",
"bit_len" : "10",
"reset" : "0",
"description" : "FIFO loop count"
}
}
},
"fifo_controls" : {
"address" : "12",
"width" : "3",
"description" : "FIFO queue control",
"fields" : {
"clr_errors" : {
"type" : "w0",
"bit_len" : "1",
"reset" : "0",
"description" : "Clear FIFO errors"
},
"clr_fifo" : {
"type" : "w0",
"bit_len" : "1",
"reset" : "0",
"description" : "Disable read cause pop from FIFO"
},
"pop_rd_port" : {
"type" : "w0",
"bit_len" : "1",
"reset" : "0",
"description" : ""
}
}
},
"fifo_rd_addr" : {
"address" : "13",
"width" : "32",
"type" : "w",
"reset" : "0",
"description" : "Redirection read address"
},
"diag_step" : {
"address" : "14",
"width" : "11",
"description" : "Diagnostic streamer test",
"fields" : {
"mode_en" : {
"type" : "w",
"bit_len" : "1",
"reset" : "0",
"description" : "Enable diagnostic streamer step mode"
},
"go" : {
"type" : "w0",
"bit_len" : "1",
"reset" : "0",
"description" : "Step next queed streamer command"
},
"clr_logger" : {
"type" : "w0",
"bit_len" : "1",
"reset" : "0",
"description" : "Clear data streamer command queue logger"
},
"logger_raddr" : {
"type" : "w",
"bit_len" : "8",
"reset" : "0",
"description" : "Data streamer command queue logger read address"
}
}
},
"diag_logger_rdata" : {
"address" : "15",
"width" : "32",
"type" : "r",
"reset" : "0",
"description" : "Data streamer command queue logger read data"
}
}
}
]

View file

@ -0,0 +1,49 @@
[{
"ip_name" : "print_streamer_8",
"bus" : "csr",
"addr_hi_bit" : "6",
"addr_lo_bit" : "4",
"description" : "This block is the print streamer for the Presto products. It is a collection of data streamers (see https://confluence.gisapps.co.uk/display/EL/Embedded+Logic+Data+Streamer+New+Architecture) and support logic for multiple heads. More details can be found at https://confluence.gisapps.co.uk/display/EL/Print+Streamer.",
"sub_blocks" : {
"data_streamer_8:a" : {
"instance" : "0",
"process" : "enabled",
"offset" : "0x00"
},
"data_streamer_8:b" : {
"instance" : "1",
"process" : "enabled",
"offset" : "0x10"
},
"data_streamer_8:c" : {
"instance" : "2",
"process" : "enabled",
"offset" : "0x20"
},
"data_streamer_8:d" : {
"instance" : "3",
"process" : "enabled",
"offset" : "0x30"
},
"data_streamer_8:e" : {
"instance" : "0_aux",
"process" : "enabled",
"offset" : "0x40"
},
"data_streamer_8:f" : {
"instance" : "1_aux",
"process" : "enabled",
"offset" : "0x50"
},
"data_streamer_8:g" : {
"instance" : "2_aux",
"process" : "enabled",
"offset" : "0x60"
},
"data_streamer_8:h" : {
"instance" : "3_aux",
"process" : "enabled",
"offset" : "0x70"
}
}
}]

View file

@ -0,0 +1,120 @@
-------------------------------------------------------------------------------
--! @file
--! @brief SOM FPGA Avalon MM master to AXI4 master conversion
--!
--! @details
--!
--!
--! @b Interfaces:
--! @li Avalon MM master avm_rx_*0 : Avalon bus interface master port 0 from internal logic
--! @li Avalon MM master avm_rx_*1 : Avalon bus interface master port 1 from internal logic
--! @li AXI4 master i/f axm_* : AXI master interface to memory sub-system. Configurable for cached accesses
--!
--! @b Clock-crossing considerations:
--! @li Module is combinatorial
--!
--! @b Language build standard requirements:
--! @li VHDL 2008
--!
--! @author Simon Southwell
--! @copyright (c) 2018 Global Inkjet Systems
--! @date 2018-7-23
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use ieee.std_logic_misc.all;
entity avm_to_axi_master_8 is
generic (
ARUSER : std_logic := '1'; -- If Cacheable accesses required, this must be 1
ARCACHE : std_logic_vector(3 downto 0) := "1110" -- For cacheable accesses, bit 3 must be 1, and the rest a valid value as per A4.4 of AXI4 spec.
);
port (
en_acp_window : in std_logic;
--AXI write address bus
axm_awaddr : out std_logic_vector(31 downto 0) := (others => '0');
axm_awprot : out std_logic_vector( 2 downto 0) := (others => '0');
axm_awvalid : out std_logic; --master addr valid
axm_awready : in std_logic; --slave ready to accept
--AXI write data bus
axm_wdata : out std_logic_vector(31 downto 0) := (others => '0');
axm_wlast : out std_logic := '0'; --last transfer in burst
axm_wvalid : out std_logic; --master data valid
axm_wready : in std_logic; --slave ready to accept
--AXI write response bus
axm_bvalid : in std_logic;
axm_bready : out std_logic;
--AXI read address bus
axm_araddr : out std_logic_vector(31 downto 0);
axm_arlen : out std_logic_vector( 7 downto 0); --burst length - 1 to 16
axm_arsize : out std_logic_vector( 2 downto 0); --size of each transfer in burst
axm_arburst : out std_logic_vector( 1 downto 0); --for bursts>1, accept only incr burst=01
axm_arcache : out std_logic_vector( 3 downto 0);
axm_aruser : out std_logic;
axm_arprot : out std_logic_vector( 2 downto 0);
axm_arvalid : out std_logic; --master addr valid
axm_arready : in std_logic; --slave ready to accept
-- AXI read data bus
axm_rdata : in std_logic_vector(31 downto 0); --last transfer in burst
axm_rvalid : in std_logic; --slave data valid
axm_rready : out std_logic; --master ready to accept
-- AVM input port 0
avm_rx_read0 : in std_logic;
avm_rx_burstcount0 : in std_logic_vector(11 downto 0);
avm_rx_address0 : in std_logic_vector(31 downto 0);
-- AVM input port 1
avm_rx_read1 : in std_logic;
avm_rx_burstcount1 : in std_logic_vector(11 downto 0);
avm_rx_address1 : in std_logic_vector(31 downto 0);
-- AVM common signals
avm_rx_waitrequest : out std_logic;
avm_rx_readdata : out std_logic_vector(31 downto 0);
avm_rx_readdatavalid : out std_logic
);
end entity;
architecture rtl of avm_to_axi_master_8 is
signal avm_rx_read : std_logic;
signal avm_rx_address : std_logic_vector(31 downto 0);
signal avm_rx_burstcount : std_logic_vector(11 downto 0);
begin
-- Mux the Avalon master bus between port 0 and port 1. Port 0 has priority.
avm_rx_read <= avm_rx_read0 or avm_rx_read1;
avm_rx_address <= avm_rx_address0 when avm_rx_read0 = '1' else avm_rx_address1;
avm_rx_burstcount <= avm_rx_burstcount0 when avm_rx_read0 = '1' else avm_rx_burstcount1;
axm_awvalid <= '0';
axm_wvalid <= '0';
axm_bready <= '0';
axm_arvalid <= avm_rx_read;
axm_araddr <= en_acp_window & avm_rx_address(30 downto 0); -- Access via ACP window (bit 31 set)
axm_arlen <= std_logic_vector(unsigned(avm_rx_burstcount(7 downto 0)) - 1);
axm_arsize <= 3X"2"; -- 4 bytes transfers (2^ARSIZE bytes)
axm_arburst <= "01"; -- Increment
axm_arprot <= "000"; -- Unpriviledged, non-secure, data access
axm_arcache <= ARCACHE;
axm_aruser <= ARUSER;
axm_rready <= '1';
avm_rx_waitrequest <= not axm_arready;
avm_rx_readdatavalid <= axm_rvalid;
avm_rx_readdata <= axm_rdata;
end architecture;

View file

@ -0,0 +1,182 @@
-------------------------------------------------------------------------------
--! @file
--! @brief SOM FPGA memory access arbiter
--!
--! @details
--!
--! @b Clock/resets:
--! @li clk : nominally 100MHz
--! @li rst_n : active low reset for clk (asynchronous assert)
--!
--! @b Interfaces:
--! @li Avalon MM master avm_rx_* : External Avalon master bus interface input
--!
--! @b Clock-crossing considerations:
--! @li Module is a single clock domain synchronous block
--!
--! @b Language build standard requirements:
--! @li VHDL 2008
--!
--! @author Simon Southwell
--! @copyright (c) 2018 Global Inkjet Systems
--! @date 2018-1-10
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use ieee.std_logic_misc.all;
package mem_arbiter_8_pkg is
type bus_array_t is array(natural range <>) of std_logic_vector;
end package;
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use ieee.std_logic_misc.all;
use work.pkg_functions.all;
use work.mem_arbiter_8_pkg.all;
entity mem_arbiter_8 is
generic (
NUM_PORTS : natural range 1 to 16 := 8;
DEVICE_FAMILY : string := "Cyclone V" ; -- "Cyclone 10 LP"
);
port (
clk : in std_logic;
rst_n : in std_logic;
transfer_active : in std_logic_vector(NUM_PORTS-1 downto 0);
avm_rx_waitrequest_in : out std_logic_vector(NUM_PORTS-1 downto 0);
avm_rx_burstcount_in : in bus_array_t (0 to NUM_PORTS-1)(11 downto 0);
avm_rx_address_in : in bus_array_t (0 to NUM_PORTS-1)(31 downto 0);
avm_rx_read_in : in std_logic_vector(NUM_PORTS-1 downto 0);
avm_rx_readdata_in : out bus_array_t (0 to NUM_PORTS-1)(31 downto 0);
avm_rx_readdatavalid_in : out std_logic_vector(NUM_PORTS-1 downto 0);
avm_rx_waitrequest : in std_logic;
avm_rx_burstcount : out std_logic_vector(11 downto 0);
avm_rx_address : out std_logic_vector(31 downto 0);
avm_rx_read : out std_logic;
avm_rx_readdata : in std_logic_vector(31 downto 0);
avm_rx_readdatavalid : in std_logic
);
end entity mem_arbiter_8;
architecture rtl of mem_arbiter_8 is
signal enable : std_logic_vector(NUM_PORTS-1 downto 0);
signal mask : std_logic_vector(NUM_PORTS-1 downto 0);
signal reqs : std_logic_vector(NUM_PORTS-1 downto 0);
signal prior_choice : std_logic_vector(NUM_PORTS-1 downto 0);
signal any_choice : std_logic_vector(NUM_PORTS-1 downto 0);
signal transfer_active_dly : std_logic_vector(NUM_PORTS-1 downto 0);
signal sel_trans_end : std_logic;
begin
GEN_ARB_LOOP : for i in 0 to NUM_PORTS-1 generate
avm_rx_waitrequest_in(i) <= avm_rx_waitrequest or not enable(i);
avm_rx_readdata_in(i) <= avm_rx_readdata;
avm_rx_readdatavalid_in(i) <= avm_rx_readdatavalid and enable(i);
end generate GEN_ARB_LOOP;
-- Mux burst count on selected source
avm_rx_burstcount <= avm_rx_burstcount_in(7) when enable(7) = '1' else
avm_rx_burstcount_in(6) when enable(6) = '1' else
avm_rx_burstcount_in(5) when enable(5) = '1' else
avm_rx_burstcount_in(4) when enable(4) = '1' else
avm_rx_burstcount_in(3) when enable(3) = '1' else
avm_rx_burstcount_in(2) when enable(2) = '1' else
avm_rx_burstcount_in(1) when enable(1) = '1' else
avm_rx_burstcount_in(0);
-- Mux address on selected source
avm_rx_address <= avm_rx_address_in(7) when enable(7) = '1' else
avm_rx_address_in(6) when enable(6) = '1' else
avm_rx_address_in(5) when enable(5) = '1' else
avm_rx_address_in(4) when enable(4) = '1' else
avm_rx_address_in(3) when enable(3) = '1' else
avm_rx_address_in(2) when enable(2) = '1' else
avm_rx_address_in(1) when enable(1) = '1' else
avm_rx_address_in(0);
-- Issue a read whenever an enabled channel is requesting
avm_rx_read <= '1' when (enable and avm_rx_read_in) /= 8x"0" else '0';
-- Request vector for prioritised channels
reqs <= avm_rx_read_in and not mask;
-- Priority encoder to choose from one or more reqs
prior_choice <= "10000000" when reqs(7) else
"01000000" when reqs(6) else
"00100000" when reqs(5) else
"00010000" when reqs(4) else
"00001000" when reqs(3) else
"00000100" when reqs(2) else
"00000010" when reqs(1) else
"00000001";
-- Priority encoder to choose from any requesting channel
any_choice <= "00000001" when avm_rx_read_in(0) else
"00000010" when avm_rx_read_in(1) else
"00000100" when avm_rx_read_in(2) else
"00001000" when avm_rx_read_in(3) else
"00010000" when avm_rx_read_in(4) else
"00100000" when avm_rx_read_in(5) else
"01000000" when avm_rx_read_in(6) else
"10000000";
-- Flag when selected channel end a transfer
sel_trans_end <= (transfer_active_dly(0) and not transfer_active(0) and enable(0)) or
(transfer_active_dly(1) and not transfer_active(1) and enable(1)) or
(transfer_active_dly(2) and not transfer_active(2) and enable(2)) or
(transfer_active_dly(3) and not transfer_active(3) and enable(3)) or
(transfer_active_dly(4) and not transfer_active(4) and enable(4)) or
(transfer_active_dly(5) and not transfer_active(5) and enable(5)) or
(transfer_active_dly(6) and not transfer_active(6) and enable(6)) or
(transfer_active_dly(7) and not transfer_active(7) and enable(7));
-- Arbitration state process
process (clk, rst_n)
begin
if rst_n = '0' then
enable <= (others => '0');
mask <= (others => '0');
transfer_active_dly <= (others => '0');
elsif clk'event and clk = '1' then
-- Generate a delayed version of transfer active signal
transfer_active_dly <= transfer_active;
-- If no active channel or just ending a transfer, arbitrate for any new requests
if unsigned(enable) = 0 or sel_trans_end = '1' then
-- By default clear any outstanding enable.
enable <= (others => '0');
-- If a priority request is active, enable chosen channel, and mask it to drop its priority
if unsigned(reqs) /= 0 then
enable <= prior_choice;
mask <= mask or prior_choice;
-- If no priority reqs, choose any low priority reqs. Clear all masks except chosen
elsif unsigned(avm_rx_read_in) /= 0 then
enable <= any_choice;
mask <= any_choice;
end if;
end if;
end if;
end process;
end architecture;

View file

@ -0,0 +1,602 @@
-------------------------------------------------------------------------------
--! @file
--! @brief SOM FPGA print streamer
--!
--! @details
--!
--! @b Clock/resets:
--! @li clk : nominally 100MHz
--! @li rst_n : active low reset for clk (asynchronous assert)
--!
--! @b Interfaces:
--! @li Avalon MM slave avs_csr_* : Control and status register memory mapped bus
--! @li Avalon MM master avm_rx_* : External Avalon master bus interface input
--! @li AXI4 master i/f axm_* : AXI master interface to memory sub-system
--! @li dest_port_* : Interface to pixel buffers of each head
--! @li irq : Interrupt output
--!
--! @b Clock-crossing considerations:
--! @li Module is a single clock domain synchronous block
--!
--! @b Language build standard requirements:
--! @li VHDL 2008
--!
--! @author Simon Southwell
--! @copyright (c) 2018 Global Inkjet Systems
--! @date 2018-1-10
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use ieee.std_logic_misc.all;
use work.common_pkg.all;
use work.mem_arbiter_8_pkg.all;
entity print_streamer_8 is
generic (
CMD_QUEUE_DEPTH : natural range 1 to 1024 := 32;
MAX_HEADS : natural range 1 to 4 := 4;
NUM_HEADS : natural range 1 to 4 := 4;
NUM_CHANS : natural range 1 to 4 := 2;
MAX_CHANS : natural range 1 to 4 := 2;
NO_ZERO_GAP : boolean := false;
STREAMER_LOGGER : boolean := false;
LOGGER_DEPTH : integer range 1 to 1024 := 256;
DEVICE_FAMILY : string := "Cyclone V" ; -- "Cyclone 10 LP"
);
port(
clk : in std_logic;
rst_n : in std_logic;
avs_csr_address : in std_logic_vector(10 downto 0);
avs_csr_write : in std_logic;
avs_csr_writedata : in std_logic_vector(31 downto 0);
avs_csr_read : in std_logic;
avs_csr_readdata : out std_logic_vector(31 downto 0);
-- External master port for access to memory system via AXI bus
avm_rx_waitrequest : out std_logic;
avm_rx_burstcount : in std_logic_vector(11 downto 0);
avm_rx_address : in std_logic_vector(31 downto 0);
avm_rx_read : in std_logic;
avm_rx_readdata : out std_logic_vector(31 downto 0);
avm_rx_readdatavalid : out std_logic;
--AXI write address bus
axm_awaddr : out std_logic_vector(31 downto 0);
axm_awprot : out std_logic_vector( 2 downto 0);
axm_awvalid : out std_logic; --master addr valid
axm_awready : in std_logic; --slave ready to accept
--AXI write data bus
axm_wdata : out std_logic_vector(31 downto 0);
axm_wlast : out std_logic; --last transfer in burst
axm_wvalid : out std_logic; --master data valid
axm_wready : in std_logic; --slave ready to accept
--AXI write response bus
axm_bvalid : in std_logic;
axm_bready : out std_logic;
--AXI read address bus
axm_araddr : out std_logic_vector(31 downto 0);
axm_arlen : out std_logic_vector( 7 downto 0); --burst length - 1 to 256 (ARLEN = burst len -1)
axm_arsize : out std_logic_vector( 2 downto 0); --size, nb bytes, of each transfer in burst
axm_arburst : out std_logic_vector( 1 downto 0); --for bursts>1, accept only incr burst=01
axm_arcache : out std_logic_vector( 3 downto 0);
axm_aruser : out std_logic;
axm_arprot : out std_logic_vector( 2 downto 0);
axm_arvalid : out std_logic; --master addr valid
axm_arready : in std_logic; --slave ready to accept
-- AXI read data bus
axm_rdata : in std_logic_vector(31 downto 0);
axm_rvalid : in std_logic; --slave data valid
axm_rready : out std_logic; --master ready to access
dest_port_wr : out std_logic_vector(MAX_HEADS*NUM_CHANS-1 downto 0);
dest_port_wr_data : out std_logic_vector(31 downto 0);
dest_port_rdy : in std_logic_vector(MAX_HEADS*NUM_CHANS-1 downto 0);
dest_port_last_word : out std_logic;
irq : out std_logic;
debug_out : out std_logic_vector(19 downto 0)
);
end entity print_streamer_8;
architecture rtl of print_streamer_8 is
constant CMD_QUEUE_DEPTH_LOG2 : integer := log2(CMD_QUEUE_DEPTH)-1;
type queue_spc_t is array (0 to NUM_CHANS*MAX_HEADS-1) of std_logic_vector( 5 downto 0);
type watermark_t is array (0 to NUM_CHANS*MAX_HEADS-1) of std_logic_vector( 7 downto 0);
type handle_t is array (0 to NUM_CHANS*MAX_HEADS-1) of std_logic_vector(11 downto 0);
type debug_t is array (0 to NUM_CHANS*MAX_HEADS-1) of std_logic_vector(19 downto 0);
signal cmd_port_pulse : std_logic_vector(NUM_CHANS*MAX_HEADS-1 downto 0);
signal cmd_port : bus_array_t(0 to NUM_CHANS*MAX_HEADS-1)(31 downto 0);
signal status_queue_space : queue_spc_t;
signal control_clear_cmd : std_logic_vector(NUM_CHANS*MAX_HEADS-1 downto 0);
signal control_clear_errors : std_logic_vector(NUM_CHANS*MAX_HEADS-1 downto 0);
signal control_msb : std_logic_vector(NUM_CHANS*MAX_HEADS-1 downto 0);
signal control_watermark : watermark_t;
signal control_en_acp_window : std_logic_vector(NUM_CHANS*MAX_HEADS-1 downto 0);
signal control_disable : std_logic_vector(NUM_CHANS*MAX_HEADS-1 downto 0);
signal control_clr_dst0_count : std_logic_vector(NUM_CHANS*MAX_HEADS-1 downto 0);
signal auto_cmd_active : std_logic_vector(NUM_CHANS*MAX_HEADS-1 downto 0);
signal auto_load_err : std_logic_vector(NUM_CHANS*MAX_HEADS-1 downto 0);
signal bad_cmd_err : std_logic_vector(NUM_CHANS*MAX_HEADS-1 downto 0);
signal cpu_race_err : std_logic_vector(NUM_CHANS*MAX_HEADS-1 downto 0);
signal overrun_err : std_logic_vector(NUM_CHANS*MAX_HEADS-1 downto 0);
signal handle : handle_t;
signal avm_rx_burstcount_int : bus_array_t(0 to NUM_CHANS*MAX_HEADS-1)(11 downto 0);
signal avm_rx_address_int : bus_array_t(0 to NUM_CHANS*MAX_HEADS-1)(31 downto 0);
signal avm_rx_read_int : std_logic_vector(NUM_CHANS*MAX_HEADS-1 downto 0);
signal avm_rx_waitrequest_int : std_logic_vector(NUM_CHANS*MAX_HEADS-1 downto 0);
signal avm_rx_readdata_int : bus_array_t(0 to NUM_CHANS*MAX_HEADS-1)(31 downto 0);
signal avm_rx_readdatavalid_int : std_logic_vector(NUM_CHANS*MAX_HEADS-1 downto 0);
signal avm_rx_waitrequest_arb : std_logic;
signal avm_rx_burstcount_arb : std_logic_vector(11 downto 0);
signal avm_rx_address_arb : std_logic_vector(31 downto 0);
signal avm_rx_read_arb : std_logic;
signal avm_rx_readdata_arb : std_logic_vector(31 downto 0);
signal avm_rx_readdatavalid_arb : std_logic;
signal debug_out_int : debug_t;
signal diag_1 : bus_array_t(0 to NUM_CHANS*MAX_HEADS-1)(31 downto 0);
signal diag_2 : bus_array_t(0 to NUM_CHANS*MAX_HEADS-1)(31 downto 0);
signal dst0_word_count : bus_array_t(0 to NUM_CHANS*MAX_HEADS-1)(31 downto 0);
signal diag_step_mode : std_logic_vector(NUM_CHANS*MAX_HEADS-1 downto 0);
signal diag_step : std_logic_vector(NUM_CHANS*MAX_HEADS-1 downto 0);
signal avs_csr_readdata_int : bus_array_t(0 to NUM_CHANS*MAX_HEADS-1)(31 downto 0);
signal avs_csr_write_int : std_logic_vector(NUM_CHANS*MAX_HEADS-1 downto 0);
signal avs_csr_read_int : std_logic_vector(NUM_CHANS*MAX_HEADS-1 downto 0);
signal irq_int : std_logic_vector(NUM_CHANS*MAX_HEADS-1 downto 0);
signal dest_port_wr_data_int : bus_array_t(0 to NUM_CHANS*MAX_HEADS-1)(31 downto 0);
signal dest_port_last_word_int : std_logic_vector(NUM_CHANS*MAX_HEADS-1 downto 0);
signal dest_port_wr_0 : std_logic_vector(1 downto 0);
signal dest_port_rdy_0 : std_logic_vector(1 downto 0);
signal fifo_wr_port_pulse : std_logic_vector(NUM_CHANS*MAX_HEADS-1 downto 0);
signal fifo_wr_port : bus_array_t(0 to NUM_CHANS*MAX_HEADS-1)(31 downto 0);
signal fifo_wr_port_in : bus_array_t(0 to NUM_CHANS*MAX_HEADS-1)(31 downto 0);
signal fifo_rd_port : bus_array_t(0 to NUM_CHANS*MAX_HEADS-1)(31 downto 0);
signal fifo_rd_port_pulse : std_logic_vector(NUM_CHANS*MAX_HEADS-1 downto 0);
signal fifo_status_empty : std_logic_vector(NUM_CHANS*MAX_HEADS-1 downto 0);
signal fifo_status_full : std_logic_vector(NUM_CHANS*MAX_HEADS-1 downto 0);
signal fifo_status_underrun : std_logic_vector(NUM_CHANS*MAX_HEADS-1 downto 0);
signal fifo_status_overrun : std_logic_vector(NUM_CHANS*MAX_HEADS-1 downto 0);
signal fifo_controls_clr_fifo : std_logic_vector(NUM_CHANS*MAX_HEADS-1 downto 0);
signal fifo_controls_clr_errors : std_logic_vector(NUM_CHANS*MAX_HEADS-1 downto 0);
signal fifo_controls_pop_rd_port : std_logic_vector(NUM_CHANS*MAX_HEADS-1 downto 0);
signal fifo_rd_addr : bus_array_t(0 to NUM_CHANS*MAX_HEADS-1)(31 downto 0);
signal fifo_loop_count : bus_array_t(0 to NUM_CHANS*MAX_HEADS-1)( 9 downto 0);
signal ip_id_ip_number : bus_array_t(0 to NUM_CHANS*MAX_HEADS-1)( 7 downto 0);
signal ip_id_mfr_number : bus_array_t(0 to NUM_CHANS*MAX_HEADS-1)( 7 downto 0);
signal ip_ver_minor_number : bus_array_t(0 to NUM_CHANS*MAX_HEADS-1)( 7 downto 0);
signal ip_ver_major_number : bus_array_t(0 to NUM_CHANS*MAX_HEADS-1)( 7 downto 0);
signal transfer_active : std_logic_vector(NUM_CHANS*MAX_HEADS-1 downto 0);
signal diag_cmd_q_write : std_logic_vector(NUM_CHANS*MAX_HEADS-1 downto 0);
signal diag_cmd_q_write_data : bus_array_t(0 to NUM_CHANS*MAX_HEADS-1)(31 downto 0);
signal diag_cmd_q_read_data : bus_array_t(0 to NUM_CHANS*MAX_HEADS-1)(31 downto 0);
signal diag_cmd_q_rd_addr : bus_array_t(0 to NUM_CHANS*MAX_HEADS-1)(log2(LOGGER_DEPTH)-1 downto 0) := (others => (others => '0'));
signal diag_cmd_q_clr_log : std_logic_vector(NUM_CHANS*MAX_HEADS-1 downto 0) := (others => '0');
signal diag_cmd_q_wr_count : bus_array_t(0 to NUM_CHANS*MAX_HEADS-1)(log2(LOGGER_DEPTH)-1 downto 0) := (others => (others => '0'));
begin
debug_out <= debug_out_int(0);
irq <= '0' when irq_int = std_logic_vector(to_unsigned(0, NUM_CHANS*MAX_HEADS)) else '1';
dest_port_wr_data <= dest_port_wr_data_int(7) when dest_port_wr(7) = '1' else
dest_port_wr_data_int(6) when dest_port_wr(6) = '1' else
dest_port_wr_data_int(5) when dest_port_wr(5) = '1' else
dest_port_wr_data_int(4) when dest_port_wr(4) = '1' else
dest_port_wr_data_int(3) when dest_port_wr(3) = '1' else
dest_port_wr_data_int(2) when dest_port_wr(2) = '1' else
dest_port_wr_data_int(1) when dest_port_wr(1) = '1' else
dest_port_wr_data_int(0);
dest_port_last_word <= dest_port_last_word_int(0) or dest_port_last_word_int(1) or
dest_port_last_word_int(2) or dest_port_last_word_int(3) or
dest_port_last_word_int(4) or dest_port_last_word_int(5) or
dest_port_last_word_int(6) or dest_port_last_word_int(7);
-- If the number of heads is less than the maximum, tie off the signals from the
-- instantitad head logic
GEN_TIE_OFF_REQD : if MAX_HEADS > NUM_HEADS generate
GEN_TIE_OFF : for i in NUM_HEADS to MAX_HEADS-1 generate
avm_rx_read_int(i) <= '0';
avm_rx_read_int(i+MAX_HEADS) <= '0';
transfer_active(i) <= '0';
transfer_active(i+MAX_HEADS) <= '0';
avs_csr_readdata_int(i) <= (others => '0');
avs_csr_readdata_int(i+MAX_HEADS) <= (others => '0');
dest_port_last_word_int(i) <= '0';
dest_port_last_word_int(i+MAX_HEADS) <= '0';
dest_port_wr(i) <= '0';
dest_port_wr(i+MAX_HEADS) <= '0';
avm_rx_burstcount_int(i) <= (others => '0');
avm_rx_burstcount_int(i+MAX_HEADS) <= (others => '0');
avm_rx_address_int(i) <= (others => '0');
avm_rx_address_int(i+MAX_HEADS) <= (others => '0');
dest_port_wr_data_int(i) <= (others => '0');
dest_port_wr_data_int(i+MAX_HEADS) <= (others => '0');
diag_1(i) <= (others => '0');
diag_1(i+MAX_HEADS) <= (others => '0');
diag_2(i) <= (others => '0');
diag_2(i+MAX_HEADS) <= (others => '0');
irq_int(i) <= '0';
irq_int(i+MAX_HEADS) <= '0';
end generate GEN_TIE_OFF;
end generate GEN_TIE_OFF_REQD;
-- If zero gap support is not required tie off the signals from the uninstantiated zero gap logic
GEN_ZG_TIE_OFF : if NO_ZERO_GAP = true generate
GEN_ZG_TIE_OFF_LOOP : for i in MAX_HEADS to MAX_HEADS+NUM_HEADS-1 generate
avs_csr_readdata_int(i) <= (others => '0');
dest_port_last_word_int(i) <= '0';
dest_port_wr(i) <= '0';
avm_rx_burstcount_int(i) <= (others => '0');
dest_port_wr_data_int(i) <= (others => '0');
diag_1(i) <= (others => '0');
diag_2(i) <= (others => '0');
irq_int(i) <= '0';
end generate;
end generate GEN_ZG_TIE_OFF;
print_streamer_csr_decode_1 : entity work.print_streamer_8_csr_decode
port map (
data_streamer_8_0_write => avs_csr_write_int(0),
data_streamer_8_0_read => avs_csr_read_int(0),
data_streamer_8_0_readdata => avs_csr_readdata_int(0),
data_streamer_8_1_write => avs_csr_write_int(1),
data_streamer_8_1_read => avs_csr_read_int(1),
data_streamer_8_1_readdata => avs_csr_readdata_int(1),
data_streamer_8_2_write => avs_csr_write_int(2),
data_streamer_8_2_read => avs_csr_read_int(2),
data_streamer_8_2_readdata => avs_csr_readdata_int(2),
data_streamer_8_3_write => avs_csr_write_int(3),
data_streamer_8_3_read => avs_csr_read_int(3),
data_streamer_8_3_readdata => avs_csr_readdata_int(3),
data_streamer_8_0_aux_write => avs_csr_write_int(4),
data_streamer_8_0_aux_read => avs_csr_read_int(4),
data_streamer_8_0_aux_readdata => avs_csr_readdata_int(4),
data_streamer_8_1_aux_write => avs_csr_write_int(5),
data_streamer_8_1_aux_read => avs_csr_read_int(5),
data_streamer_8_1_aux_readdata => avs_csr_readdata_int(5),
data_streamer_8_2_aux_write => avs_csr_write_int(6),
data_streamer_8_2_aux_read => avs_csr_read_int(6),
data_streamer_8_2_aux_readdata => avs_csr_readdata_int(6),
data_streamer_8_3_aux_write => avs_csr_write_int(7),
data_streamer_8_3_aux_read => avs_csr_read_int(7),
data_streamer_8_3_aux_readdata => avs_csr_readdata_int(7),
avs_address => avs_csr_address(6 downto 4),
avs_write => avs_csr_write,
avs_read => avs_csr_read,
avs_readdata => avs_csr_readdata
);
GEN_AUX_LOOP : for j in 0 to NUM_CHANS-1 generate
GEN_PRINT_STREAMER_LOOP : for i in 0 to NUM_HEADS-1 generate
GEN_ZERO_GAP : if NO_ZERO_GAP = false or j = 0 generate
GEN_LOGGER : if STREAMER_LOGGER generate
streamer_log_inst : entity work.streamer_logger_8
generic map (
LOGGER_DEPTH => LOGGER_DEPTH,
DEVICE_FAMILY => DEVICE_FAMILY
)
port map (
clk => clk,
rst_n => rst_n,
wr_req => diag_cmd_q_write(i+j*MAX_HEADS),
wr_data => diag_cmd_q_write_data(i+j*MAX_HEADS),
wr_ptr => diag_cmd_q_wr_count(i+j*MAX_HEADS),
rd_addr => diag_cmd_q_rd_addr(i+j*MAX_HEADS),
rd_data_out => diag_cmd_q_read_data(i+j*MAX_HEADS),
clr_logger => diag_cmd_q_clr_log(i+j*MAX_HEADS)
);
end generate;
data_streamer_csr_regs_inst : entity work.data_streamer_8_csr_regs
generic map (
ADDR_DECODE_WIDTH => 4
)
port map (
clk => clk,
rst_n => rst_n,
control_clear_cmd => control_clear_cmd(i+j*MAX_HEADS),
control_clear_errors => control_clear_errors(i+j*MAX_HEADS),
control_msb => control_msb(i+j*MAX_HEADS),
control_watermark => control_watermark(i+j*MAX_HEADS),
control_en_acp_window => control_en_acp_window(i+j*MAX_HEADS),
control_disable => control_disable(i+j*MAX_HEADS),
control_clr_dst0_count => control_clr_dst0_count(i+j*MAX_HEADS),
cmd_port_pulse => cmd_port_pulse(i+j*MAX_HEADS),
cmd_port => cmd_port(i+j*MAX_HEADS),
cmd_port_in => (others => '0'),
status_queue_space => status_queue_space(i+j*MAX_HEADS)(5 downto 1),
status_tlb_mismatch_err => '0',
status_tlb_empty_err => '0',
status_auto_load_err => auto_load_err(i+j*MAX_HEADS),
status_bad_cmd_err => bad_cmd_err(i+j*MAX_HEADS),
status_cpu_race_err => cpu_race_err(i+j*MAX_HEADS),
status_overrun_err => overrun_err(i+j*MAX_HEADS),
status_auto_cmd_active => auto_cmd_active(i+j*MAX_HEADS),
status_cmd_depth_log2 => std_logic_vector(to_unsigned(CMD_QUEUE_DEPTH_LOG2, 4)),
status_handle => handle(i+j*MAX_HEADS),
diags_remain => debug_out_int(i+j*MAX_HEADS)(11 downto 0),
diags_cmd_pending => debug_out_int(i+j*MAX_HEADS)(12),
diags_data_active => debug_out_int(i+j*MAX_HEADS)(13),
diags_cmd_avail => debug_out_int(i+j*MAX_HEADS)(14),
diags_dst_sel => debug_out_int(i+j*MAX_HEADS)(18 downto 15),
diags_dst_rdy => debug_out_int(i+j*MAX_HEADS)(19),
diag_step_mode_en => diag_step_mode(i+j*MAX_HEADS),
diag_step_go => diag_step(i+j*MAX_HEADS),
diags_logger_wr_ptr => diag_cmd_q_wr_count(i+j*MAX_HEADS),
diag_logger_rdata => diag_cmd_q_read_data(i+j*MAX_HEADS),
diag_step_clr_logger => diag_cmd_q_clr_log(i+j*MAX_HEADS),
diag_step_logger_raddr => diag_cmd_q_rd_addr(i+j*MAX_HEADS),
curr_cmd => diag_1(i+j*MAX_HEADS),
curr_param1 => diag_2(i+j*MAX_HEADS),
dst0_word_count => dst0_word_count(i+j*MAX_HEADS),
fifo_wr_port_pulse => fifo_wr_port_pulse(i+j*MAX_HEADS),
fifo_wr_port => fifo_wr_port(i+j*MAX_HEADS),
fifo_wr_port_in => fifo_wr_port_in(i+j*MAX_HEADS),
fifo_rd_port => fifo_rd_port(i+j*MAX_HEADS),
fifo_rd_port_pulse => fifo_rd_port_pulse(i+j*MAX_HEADS),
fifo_status_empty => fifo_status_empty(i+j*MAX_HEADS),
fifo_status_full => fifo_status_full(i+j*MAX_HEADS),
fifo_status_underrun => fifo_status_underrun(i+j*MAX_HEADS),
fifo_status_overrun => fifo_status_overrun(i+j*MAX_HEADS),
fifo_status_loop_count => fifo_loop_count(i+j*MAX_HEADS),
fifo_controls_clr_fifo => fifo_controls_clr_fifo(i+j*MAX_HEADS),
fifo_controls_clr_errors => fifo_controls_clr_errors(i+j*MAX_HEADS),
fifo_controls_pop_rd_port => fifo_controls_pop_rd_port(i+j*MAX_HEADS),
fifo_rd_addr => fifo_rd_addr(i+j*MAX_HEADS),
ip_id_ip_number => ip_id_ip_number(i+j*MAX_HEADS),
ip_id_mfr_number => ip_id_mfr_number(i+j*MAX_HEADS),
ip_ver_minor_number => ip_ver_minor_number(i+j*MAX_HEADS),
ip_ver_major_number => ip_ver_major_number(i+j*MAX_HEADS),
avs_address => avs_csr_address(3 downto 0),
avs_write => avs_csr_write_int(i+j*MAX_HEADS),
avs_writedata => avs_csr_writedata,
avs_read => avs_csr_read_int(i+j*MAX_HEADS),
avs_readdata => avs_csr_readdata_int(i+j*MAX_HEADS)
);
fifo_queue_inst : entity work.streamer_fifo_1
generic map (
DEVICE_FAMILY => DEVICE_FAMILY
)
port map (
clk => clk,
rst_n => rst_n,
fifo_wr_port_pulse => fifo_wr_port_pulse(i+j*MAX_HEADS),
fifo_wr_port => fifo_wr_port(i+j*MAX_HEADS),
fifo_wr_port_in => fifo_wr_port_in(i+j*MAX_HEADS),
fifo_rd_port => fifo_rd_port(i+j*MAX_HEADS),
fifo_rd_port_pulse => fifo_rd_port_pulse(i+j*MAX_HEADS),
fifo_status_empty => fifo_status_empty(i+j*MAX_HEADS),
fifo_status_full => fifo_status_full(i+j*MAX_HEADS),
fifo_status_underrun => fifo_status_underrun(i+j*MAX_HEADS),
fifo_status_overrun => fifo_status_overrun(i+j*MAX_HEADS),
fifo_controls_clr_fifo => fifo_controls_clr_fifo(i+j*MAX_HEADS),
fifo_controls_clr_errors => fifo_controls_clr_errors(i+j*MAX_HEADS),
fifo_controls_pop_rd_port => fifo_controls_pop_rd_port(i+j*MAX_HEADS),
fifo_loop_count => fifo_loop_count(i+j*MAX_HEADS),
avm_rx_address => avm_rx_address_int(i+j*MAX_HEADS)(31 downto 28),
avm_rx_read => avm_rx_read_int(i+j*MAX_HEADS),
avm_rx_waitrequest => avm_rx_waitrequest_int(i+j*MAX_HEADS),
avm_rx_readdatavalid => avm_rx_readdatavalid_int(i+j*MAX_HEADS)
);
data_streamer_inst : entity work.data_streamer_8
generic map(
NUM_EXT_DSTS => 1,
CMD_QUEUE_DEPTH => CMD_QUEUE_DEPTH,
EXCLUDE_VIRTUAL_MAPPING_LOGIC => true,
DEVICE_FAMILY => DEVICE_FAMILY
)
port map(
clk => clk,
rst_n => rst_n,
control_clear_cmd => control_clear_cmd(i+j*MAX_HEADS),
control_clear_errors => control_clear_errors(i+j*MAX_HEADS),
control_msb => control_msb(i+j*MAX_HEADS),
control_watermark => control_watermark(i+j*MAX_HEADS),
control_disable => control_disable(i+j*MAX_HEADS),
control_clr_dst0_count => control_clr_dst0_count(i+j*MAX_HEADS),
cmd_port_wr => cmd_port_pulse(i+j*MAX_HEADS),
cmd_port => cmd_port(i+j*MAX_HEADS),
auto_load_err => auto_load_err(i+j*MAX_HEADS),
bad_cmd_err => bad_cmd_err(i+j*MAX_HEADS),
cpu_race_err => cpu_race_err(i+j*MAX_HEADS),
overrun_err => overrun_err(i+j*MAX_HEADS),
auto_cmd_active => auto_cmd_active(i+j*MAX_HEADS),
status_queue_space => status_queue_space(i+j*MAX_HEADS),
handle => handle(i+j*MAX_HEADS),
avm_rx_waitrequest => avm_rx_waitrequest_int(i+j*MAX_HEADS),
avm_rx_burstcount => avm_rx_burstcount_int(i+j*MAX_HEADS),
avm_rx_address => avm_rx_address_int(i+j*MAX_HEADS),
avm_rx_read => avm_rx_read_int(i+j*MAX_HEADS),
avm_rx_readdata => avm_rx_readdata_int(i+j*MAX_HEADS),
avm_rx_readdatavalid => avm_rx_readdatavalid_int(i+j*MAX_HEADS),
dest_port_wr => dest_port_wr(i+j*MAX_HEADS downto i+j*MAX_HEADS),
dest_port_wr_data => dest_port_wr_data_int(i+j*MAX_HEADS),
dest_port_rdy => dest_port_rdy(i+j*MAX_HEADS downto i+j*MAX_HEADS),
dest_port_last_word => dest_port_last_word_int(i+j*MAX_HEADS),
ip_id_ip_number => ip_id_ip_number(i+j*MAX_HEADS),
ip_id_mfr_number => ip_id_mfr_number(i+j*MAX_HEADS),
ip_ver_minor_number => ip_ver_minor_number(i+j*MAX_HEADS),
ip_ver_major_number => ip_ver_major_number(i+j*MAX_HEADS),
transfer_active => transfer_active(i+j*MAX_HEADS),
irq => irq_int(i+j*MAX_HEADS),
ld_q_redirect_addr => fifo_rd_addr(i+j*MAX_HEADS),
diag_step_mode => diag_step_mode(i+j*MAX_HEADS),
diag_step => diag_step(i+j*MAX_HEADS),
debug_out => debug_out_int(i+j*MAX_HEADS),
diag_dst0_count => dst0_word_count(i+j*MAX_HEADS),
diag_1 => diag_1(i+j*MAX_HEADS),
diag_2 => diag_2(i+j*MAX_HEADS),
diag_cmd_q_write => diag_cmd_q_write(i+j*MAX_HEADS),
diag_cmd_q_write_data => diag_cmd_q_write_data(i+j*MAX_HEADS)
);
end generate GEN_ZERO_GAP;
GEN_NO_ZERO_GAP : if NO_ZERO_GAP= true and j = 1 generate
transfer_active(i+MAX_HEADS) <= '0';
auto_cmd_active(i+MAX_HEADS) <= '0';
avm_rx_read_int(i+MAX_HEADS) <= '0';
end generate GEN_NO_ZERO_GAP;
end generate GEN_PRINT_STREAMER_LOOP;
end generate GEN_AUX_LOOP;
mem_arbiter_inst : entity work.mem_arbiter_8
generic map(
NUM_PORTS => MAX_HEADS*MAX_CHANS, -- arbiter always for the maximim
DEVICE_FAMILY => DEVICE_FAMILY
)
port map(
clk => clk,
rst_n => rst_n,
transfer_active => transfer_active,
avm_rx_waitrequest_in => avm_rx_waitrequest_int,
avm_rx_burstcount_in => avm_rx_burstcount_int,
avm_rx_address_in => avm_rx_address_int,
avm_rx_read_in => avm_rx_read_int,
avm_rx_readdata_in => avm_rx_readdata_int,
avm_rx_readdatavalid_in => avm_rx_readdatavalid_int,
avm_rx_waitrequest => avm_rx_waitrequest_arb,
avm_rx_burstcount => avm_rx_burstcount_arb,
avm_rx_address => avm_rx_address_arb,
avm_rx_read => avm_rx_read_arb,
avm_rx_readdata => avm_rx_readdata_arb,
avm_rx_readdatavalid => avm_rx_readdatavalid_arb
);
avm_to_axi_master_inst : entity work.avm_to_axi_master_8
port map (
en_acp_window => control_en_acp_window(0),
axm_awaddr => axm_awaddr,
axm_awprot => axm_awprot,
axm_awvalid => axm_awvalid,
axm_awready => axm_awready,
axm_wdata => axm_wdata,
axm_wlast => axm_wlast,
axm_wvalid => axm_wvalid,
axm_wready => axm_wready,
axm_bvalid => axm_bvalid,
axm_bready => axm_bready,
axm_araddr => axm_araddr,
axm_arlen => axm_arlen,
axm_arsize => axm_arsize,
axm_arburst => axm_arburst,
axm_arcache => axm_arcache,
axm_aruser => axm_aruser,
axm_arprot => axm_arprot,
axm_arvalid => axm_arvalid,
axm_arready => axm_arready,
axm_rdata => axm_rdata,
axm_rvalid => axm_rvalid,
axm_rready => axm_rready,
avm_rx_waitrequest => avm_rx_waitrequest_arb,
avm_rx_burstcount1 => avm_rx_burstcount,
avm_rx_address1 => avm_rx_address,
avm_rx_read1 => avm_rx_read,
avm_rx_burstcount0 => avm_rx_burstcount_arb,
avm_rx_address0 => avm_rx_address_arb,
avm_rx_read0 => avm_rx_read_arb,
avm_rx_readdata => avm_rx_readdata_arb,
avm_rx_readdatavalid => avm_rx_readdatavalid_arb
);
avm_rx_waitrequest <= avm_rx_waitrequest_arb;
avm_rx_readdata <= avm_rx_readdata_arb;
avm_rx_readdatavalid <= avm_rx_readdatavalid_arb;
end architecture;

View file

@ -0,0 +1,100 @@
-------------------------------------------------------------------------------
--! @file
--! @brief data streamer logger
--!
--! @b Clock/resets:
--! @li clk : nominally 100MHz
--! @li rst_n : active low reset for clk (asynchronous assert)
--!
--! @b Clock-crossing considerations:
--! @li Module is a single clock domain synchronous block
--!
--! @b Language build standard requirements:
--! @li VHDL 2008
--!
--! @author Simon Southwell
--! @copyright (c) 2020 Global Inkjet Systems
--! @date 2020-06-10
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use ieee.std_logic_misc.all;
use work.common_pkg.all;
entity streamer_logger_8 is
generic (
LOGGER_DEPTH : natural range 8 to 1024 := 256;
DEVICE_FAMILY : string := "Cyclone V" -- "Cyclone 10 LP"
);
port(
clk : in std_logic;
rst_n : in std_logic;
wr_req : in std_logic;
wr_data : in std_logic_vector(31 downto 0);
wr_ptr : out std_logic_vector(log2(LOGGER_DEPTH)-1 downto 0);
rd_addr : in std_logic_vector(log2(LOGGER_DEPTH)-1 downto 0);
rd_data_out : out std_logic_vector(31 downto 0);
clr_logger : in std_logic
);
end entity streamer_logger_8;
architecture rtl of streamer_logger_8 is
signal rd_data : std_logic_vector(31 downto 0);
signal wr_count : std_logic_vector(31 downto 0);
begin
wr_ptr <= wr_count(log2(LOGGER_DEPTH)-1 downto 0);
ram_inst : entity work.dp_ram
generic map (
DEPTH => LOGGER_DEPTH,
DATA_WIDTH => 32,
REGISTER_OUTPUT => "UNREGISTERED",
READ_WRITE_MODE => "DONT_CARE",
DEVICE_FAMILY => DEVICE_FAMILY
)
port map
(
clk => clk,
wrdata => wr_data,
rdaddr => rd_addr,
wraddr => wr_count(log2(LOGGER_DEPTH)-1 downto 0),
wren => wr_req,
rddata => rd_data
);
pSYNC_PROC : process(clk, rst_n)
begin
if rst_n = '0' then
wr_count <= (others => '0');
elsif clk'event and clk = '1' then
rd_data_out <= rd_data;
if wr_req then
wr_count <= std_logic_vector(unsigned(wr_count) + 1);
end if;
if clr_logger then
wr_count <= (others => '0');
end if;
end if;
end process;
end rtl;

View file

@ -0,0 +1 @@
v8 - fpga vendor independent. Change to Streamer_fifo_1 (fpga vendor independent)