Merge remote-tracking branch 'remotes/origin/1.10004.SMB-147_importing_g-ip_into_smb'
This commit is contained in:
commit
33bed4fdbc
23 changed files with 4667 additions and 38 deletions
198
generic_ip/common/0/src/altera/fifo_1024x32.vhd
Normal file
198
generic_ip/common/0/src/altera/fifo_1024x32.vhd
Normal file
|
|
@ -0,0 +1,198 @@
|
|||
-- megafunction wizard: %FIFO%
|
||||
-- GENERATION: STANDARD
|
||||
-- VERSION: WM1.0
|
||||
-- MODULE: scfifo
|
||||
|
||||
-- ============================================================
|
||||
-- File Name: fifo_1024x32.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;
|
||||
|
||||
ENTITY fifo_1024x32 IS
|
||||
PORT
|
||||
(
|
||||
clock : IN STD_LOGIC ;
|
||||
data : IN STD_LOGIC_VECTOR (31 DOWNTO 0);
|
||||
rdreq : IN STD_LOGIC ;
|
||||
sclr : IN STD_LOGIC ;
|
||||
wrreq : IN STD_LOGIC ;
|
||||
empty : OUT STD_LOGIC ;
|
||||
full : OUT STD_LOGIC ;
|
||||
q : OUT STD_LOGIC_VECTOR (31 DOWNTO 0);
|
||||
usedw : OUT STD_LOGIC_VECTOR (9 DOWNTO 0)
|
||||
);
|
||||
END fifo_1024x32;
|
||||
|
||||
|
||||
ARCHITECTURE SYN OF fifo_1024x32 IS
|
||||
|
||||
SIGNAL sub_wire0 : STD_LOGIC ;
|
||||
SIGNAL sub_wire1 : STD_LOGIC ;
|
||||
SIGNAL sub_wire2 : STD_LOGIC_VECTOR (31 DOWNTO 0);
|
||||
SIGNAL sub_wire3 : STD_LOGIC_VECTOR (9 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 (
|
||||
clock : IN STD_LOGIC ;
|
||||
data : IN STD_LOGIC_VECTOR (31 DOWNTO 0);
|
||||
rdreq : IN STD_LOGIC ;
|
||||
sclr : IN STD_LOGIC ;
|
||||
wrreq : IN STD_LOGIC ;
|
||||
empty : OUT STD_LOGIC ;
|
||||
full : OUT STD_LOGIC ;
|
||||
q : OUT STD_LOGIC_VECTOR (31 DOWNTO 0);
|
||||
usedw : OUT STD_LOGIC_VECTOR (9 DOWNTO 0)
|
||||
);
|
||||
END COMPONENT;
|
||||
|
||||
BEGIN
|
||||
empty <= sub_wire0;
|
||||
full <= sub_wire1;
|
||||
q <= sub_wire2(31 DOWNTO 0);
|
||||
usedw <= sub_wire3(9 DOWNTO 0);
|
||||
|
||||
scfifo_component : scfifo
|
||||
GENERIC MAP (
|
||||
add_ram_output_register => "OFF",
|
||||
intended_device_family => "Cyclone IV GX",
|
||||
lpm_numwords => 1024,
|
||||
lpm_showahead => "OFF",
|
||||
lpm_type => "scfifo",
|
||||
lpm_width => 32,
|
||||
lpm_widthu => 10,
|
||||
overflow_checking => "ON",
|
||||
underflow_checking => "ON",
|
||||
use_eab => "ON"
|
||||
)
|
||||
PORT MAP (
|
||||
clock => clock,
|
||||
data => data,
|
||||
rdreq => rdreq,
|
||||
sclr => sclr,
|
||||
wrreq => wrreq,
|
||||
empty => sub_wire0,
|
||||
full => sub_wire1,
|
||||
q => sub_wire2,
|
||||
usedw => sub_wire3
|
||||
);
|
||||
|
||||
|
||||
|
||||
END SYN;
|
||||
|
||||
-- ============================================================
|
||||
-- CNX file retrieval info
|
||||
-- ============================================================
|
||||
-- Retrieval info: PRIVATE: AlmostEmpty NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: AlmostEmptyThr NUMERIC "-1"
|
||||
-- Retrieval info: PRIVATE: AlmostFull NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: AlmostFullThr NUMERIC "-1"
|
||||
-- Retrieval info: PRIVATE: CLOCKS_ARE_SYNCHRONIZED NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: Clock NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: Depth NUMERIC "1024"
|
||||
-- Retrieval info: PRIVATE: Empty NUMERIC "1"
|
||||
-- Retrieval info: PRIVATE: Full NUMERIC "1"
|
||||
-- Retrieval info: PRIVATE: INTENDED_DEVICE_FAMILY STRING "Cyclone IV GX"
|
||||
-- Retrieval info: PRIVATE: LE_BasedFIFO NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: LegacyRREQ NUMERIC "1"
|
||||
-- Retrieval info: PRIVATE: MAX_DEPTH_BY_9 NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: OVERFLOW_CHECKING NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: Optimize NUMERIC "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 "32"
|
||||
-- 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 "32"
|
||||
-- Retrieval info: PRIVATE: rsEmpty NUMERIC "1"
|
||||
-- Retrieval info: PRIVATE: rsFull NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: rsUsedW NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: sc_aclr NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: sc_sclr NUMERIC "1"
|
||||
-- Retrieval info: PRIVATE: wsEmpty NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: wsFull NUMERIC "1"
|
||||
-- Retrieval info: PRIVATE: wsUsedW NUMERIC "0"
|
||||
-- Retrieval info: LIBRARY: altera_mf altera_mf.altera_mf_components.all
|
||||
-- Retrieval info: CONSTANT: ADD_RAM_OUTPUT_REGISTER STRING "OFF"
|
||||
-- Retrieval info: CONSTANT: INTENDED_DEVICE_FAMILY STRING "Cyclone IV GX"
|
||||
-- Retrieval info: CONSTANT: LPM_NUMWORDS NUMERIC "1024"
|
||||
-- Retrieval info: CONSTANT: LPM_SHOWAHEAD STRING "OFF"
|
||||
-- Retrieval info: CONSTANT: LPM_TYPE STRING "scfifo"
|
||||
-- Retrieval info: CONSTANT: LPM_WIDTH NUMERIC "32"
|
||||
-- Retrieval info: CONSTANT: LPM_WIDTHU NUMERIC "10"
|
||||
-- Retrieval info: CONSTANT: OVERFLOW_CHECKING STRING "ON"
|
||||
-- Retrieval info: CONSTANT: UNDERFLOW_CHECKING STRING "ON"
|
||||
-- Retrieval info: CONSTANT: USE_EAB STRING "ON"
|
||||
-- Retrieval info: USED_PORT: clock 0 0 0 0 INPUT NODEFVAL "clock"
|
||||
-- Retrieval info: USED_PORT: data 0 0 32 0 INPUT NODEFVAL "data[31..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 32 0 OUTPUT NODEFVAL "q[31..0]"
|
||||
-- Retrieval info: USED_PORT: rdreq 0 0 0 0 INPUT NODEFVAL "rdreq"
|
||||
-- Retrieval info: USED_PORT: sclr 0 0 0 0 INPUT NODEFVAL "sclr"
|
||||
-- Retrieval info: USED_PORT: usedw 0 0 10 0 OUTPUT NODEFVAL "usedw[9..0]"
|
||||
-- Retrieval info: USED_PORT: wrreq 0 0 0 0 INPUT NODEFVAL "wrreq"
|
||||
-- Retrieval info: CONNECT: @clock 0 0 0 0 clock 0 0 0 0
|
||||
-- Retrieval info: CONNECT: @data 0 0 32 0 data 0 0 32 0
|
||||
-- Retrieval info: CONNECT: @rdreq 0 0 0 0 rdreq 0 0 0 0
|
||||
-- Retrieval info: CONNECT: @sclr 0 0 0 0 sclr 0 0 0 0
|
||||
-- Retrieval info: CONNECT: @wrreq 0 0 0 0 wrreq 0 0 0 0
|
||||
-- Retrieval info: CONNECT: empty 0 0 0 0 @empty 0 0 0 0
|
||||
-- Retrieval info: CONNECT: full 0 0 0 0 @full 0 0 0 0
|
||||
-- Retrieval info: CONNECT: q 0 0 32 0 @q 0 0 32 0
|
||||
-- Retrieval info: CONNECT: usedw 0 0 10 0 @usedw 0 0 10 0
|
||||
-- Retrieval info: GEN_FILE: TYPE_NORMAL fifo_1024x32.vhd TRUE
|
||||
-- Retrieval info: GEN_FILE: TYPE_NORMAL fifo_1024x32.inc FALSE
|
||||
-- Retrieval info: GEN_FILE: TYPE_NORMAL fifo_1024x32.cmp FALSE
|
||||
-- Retrieval info: GEN_FILE: TYPE_NORMAL fifo_1024x32.bsf FALSE
|
||||
-- Retrieval info: GEN_FILE: TYPE_NORMAL fifo_1024x32_inst.vhd FALSE
|
||||
-- Retrieval info: LIB_FILE: altera_mf
|
||||
198
generic_ip/common/0/src/altera/fifo_256x32.vhd
Normal file
198
generic_ip/common/0/src/altera/fifo_256x32.vhd
Normal file
|
|
@ -0,0 +1,198 @@
|
|||
-- megafunction wizard: %FIFO%
|
||||
-- GENERATION: STANDARD
|
||||
-- VERSION: WM1.0
|
||||
-- MODULE: scfifo
|
||||
|
||||
-- ============================================================
|
||||
-- File Name: fifo_256x32.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;
|
||||
|
||||
ENTITY fifo_256x32 IS
|
||||
PORT
|
||||
(
|
||||
clock : IN STD_LOGIC ;
|
||||
data : IN STD_LOGIC_VECTOR (31 DOWNTO 0);
|
||||
rdreq : IN STD_LOGIC ;
|
||||
sclr : IN STD_LOGIC ;
|
||||
wrreq : IN STD_LOGIC ;
|
||||
empty : OUT STD_LOGIC ;
|
||||
full : OUT STD_LOGIC ;
|
||||
q : OUT STD_LOGIC_VECTOR (31 DOWNTO 0);
|
||||
usedw : OUT STD_LOGIC_VECTOR (7 DOWNTO 0)
|
||||
);
|
||||
END fifo_256x32;
|
||||
|
||||
|
||||
ARCHITECTURE SYN OF fifo_256x32 IS
|
||||
|
||||
SIGNAL sub_wire0 : STD_LOGIC ;
|
||||
SIGNAL sub_wire1 : STD_LOGIC ;
|
||||
SIGNAL sub_wire2 : STD_LOGIC_VECTOR (31 DOWNTO 0);
|
||||
SIGNAL sub_wire3 : STD_LOGIC_VECTOR (7 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 (
|
||||
clock : IN STD_LOGIC ;
|
||||
data : IN STD_LOGIC_VECTOR (31 DOWNTO 0);
|
||||
rdreq : IN STD_LOGIC ;
|
||||
sclr : IN STD_LOGIC ;
|
||||
wrreq : IN STD_LOGIC ;
|
||||
empty : OUT STD_LOGIC ;
|
||||
full : OUT STD_LOGIC ;
|
||||
q : OUT STD_LOGIC_VECTOR (31 DOWNTO 0);
|
||||
usedw : OUT STD_LOGIC_VECTOR (7 DOWNTO 0)
|
||||
);
|
||||
END COMPONENT;
|
||||
|
||||
BEGIN
|
||||
empty <= sub_wire0;
|
||||
full <= sub_wire1;
|
||||
q <= sub_wire2(31 DOWNTO 0);
|
||||
usedw <= sub_wire3(7 DOWNTO 0);
|
||||
|
||||
scfifo_component : scfifo
|
||||
GENERIC MAP (
|
||||
add_ram_output_register => "OFF",
|
||||
intended_device_family => "Cyclone V",
|
||||
lpm_numwords => 256,
|
||||
lpm_showahead => "OFF",
|
||||
lpm_type => "scfifo",
|
||||
lpm_width => 32,
|
||||
lpm_widthu => 8,
|
||||
overflow_checking => "ON",
|
||||
underflow_checking => "ON",
|
||||
use_eab => "ON"
|
||||
)
|
||||
PORT MAP (
|
||||
clock => clock,
|
||||
data => data,
|
||||
rdreq => rdreq,
|
||||
sclr => sclr,
|
||||
wrreq => wrreq,
|
||||
empty => sub_wire0,
|
||||
full => sub_wire1,
|
||||
q => sub_wire2,
|
||||
usedw => sub_wire3
|
||||
);
|
||||
|
||||
|
||||
|
||||
END SYN;
|
||||
|
||||
-- ============================================================
|
||||
-- CNX file retrieval info
|
||||
-- ============================================================
|
||||
-- Retrieval info: PRIVATE: AlmostEmpty NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: AlmostEmptyThr NUMERIC "-1"
|
||||
-- Retrieval info: PRIVATE: AlmostFull NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: AlmostFullThr NUMERIC "-1"
|
||||
-- Retrieval info: PRIVATE: CLOCKS_ARE_SYNCHRONIZED NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: Clock NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: Depth NUMERIC "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 "1"
|
||||
-- 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 "32"
|
||||
-- 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 "32"
|
||||
-- Retrieval info: PRIVATE: rsEmpty NUMERIC "1"
|
||||
-- Retrieval info: PRIVATE: rsFull NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: rsUsedW NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: sc_aclr NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: sc_sclr NUMERIC "1"
|
||||
-- Retrieval info: PRIVATE: wsEmpty NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: wsFull NUMERIC "1"
|
||||
-- Retrieval info: PRIVATE: wsUsedW NUMERIC "0"
|
||||
-- Retrieval info: LIBRARY: altera_mf altera_mf.altera_mf_components.all
|
||||
-- Retrieval info: CONSTANT: ADD_RAM_OUTPUT_REGISTER STRING "OFF"
|
||||
-- Retrieval info: CONSTANT: INTENDED_DEVICE_FAMILY STRING "Cyclone V"
|
||||
-- Retrieval info: CONSTANT: LPM_NUMWORDS NUMERIC "256"
|
||||
-- Retrieval info: CONSTANT: LPM_SHOWAHEAD STRING "OFF"
|
||||
-- Retrieval info: CONSTANT: LPM_TYPE STRING "scfifo"
|
||||
-- Retrieval info: CONSTANT: LPM_WIDTH NUMERIC "32"
|
||||
-- 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: clock 0 0 0 0 INPUT NODEFVAL "clock"
|
||||
-- Retrieval info: USED_PORT: data 0 0 32 0 INPUT NODEFVAL "data[31..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 32 0 OUTPUT NODEFVAL "q[31..0]"
|
||||
-- Retrieval info: USED_PORT: rdreq 0 0 0 0 INPUT NODEFVAL "rdreq"
|
||||
-- Retrieval info: USED_PORT: sclr 0 0 0 0 INPUT NODEFVAL "sclr"
|
||||
-- Retrieval info: USED_PORT: usedw 0 0 8 0 OUTPUT NODEFVAL "usedw[7..0]"
|
||||
-- Retrieval info: USED_PORT: wrreq 0 0 0 0 INPUT NODEFVAL "wrreq"
|
||||
-- Retrieval info: CONNECT: @clock 0 0 0 0 clock 0 0 0 0
|
||||
-- Retrieval info: CONNECT: @data 0 0 32 0 data 0 0 32 0
|
||||
-- Retrieval info: CONNECT: @rdreq 0 0 0 0 rdreq 0 0 0 0
|
||||
-- Retrieval info: CONNECT: @sclr 0 0 0 0 sclr 0 0 0 0
|
||||
-- Retrieval info: CONNECT: @wrreq 0 0 0 0 wrreq 0 0 0 0
|
||||
-- Retrieval info: CONNECT: empty 0 0 0 0 @empty 0 0 0 0
|
||||
-- Retrieval info: CONNECT: full 0 0 0 0 @full 0 0 0 0
|
||||
-- Retrieval info: CONNECT: q 0 0 32 0 @q 0 0 32 0
|
||||
-- Retrieval info: CONNECT: usedw 0 0 8 0 @usedw 0 0 8 0
|
||||
-- Retrieval info: GEN_FILE: TYPE_NORMAL fifo_256x32.vhd TRUE
|
||||
-- Retrieval info: GEN_FILE: TYPE_NORMAL fifo_256x32.inc FALSE
|
||||
-- Retrieval info: GEN_FILE: TYPE_NORMAL fifo_256x32.cmp FALSE
|
||||
-- Retrieval info: GEN_FILE: TYPE_NORMAL fifo_256x32.bsf FALSE
|
||||
-- Retrieval info: GEN_FILE: TYPE_NORMAL fifo_256x32_inst.vhd FALSE
|
||||
-- Retrieval info: LIB_FILE: altera_mf
|
||||
201
generic_ip/common/0/src/altera/sync_fifo.vhd
Normal file
201
generic_ip/common/0/src/altera/sync_fifo.vhd
Normal file
|
|
@ -0,0 +1,201 @@
|
|||
-- megafunction wizard: %FIFO%
|
||||
-- GENERATION: STANDARD
|
||||
-- VERSION: WM1.0
|
||||
-- MODULE: scfifo
|
||||
|
||||
-- ============================================================
|
||||
-- File Name: sync_fifo.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.common_pkg.all;
|
||||
|
||||
entity sync_fifo is
|
||||
generic (
|
||||
FIFO_WIDTH : natural range 1 to 32;
|
||||
FIFO_DEPTH : natural range 1 to 8182);
|
||||
port (
|
||||
sclr : in std_logic;
|
||||
clock : in std_logic;
|
||||
data : in std_logic_vector (FIFO_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 (FIFO_WIDTH-1 downto 0);
|
||||
usedw : out std_logic_vector (log2(FIFO_DEPTH)-1 downto 0)
|
||||
);
|
||||
end sync_fifo;
|
||||
|
||||
|
||||
ARCHITECTURE SYN OF sync_fifo IS
|
||||
|
||||
SIGNAL sub_wire0 : STD_LOGIC ;
|
||||
SIGNAL sub_wire1 : STD_LOGIC ;
|
||||
SIGNAL sub_wire2 : STD_LOGIC_VECTOR (FIFO_WIDTH-1 DOWNTO 0);
|
||||
SIGNAL sub_wire3 : STD_LOGIC_VECTOR (log2(FIFO_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 (
|
||||
sclr : IN STD_LOGIC ;
|
||||
clock : IN STD_LOGIC ;
|
||||
data : IN STD_LOGIC_VECTOR (FIFO_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 (FIFO_WIDTH-1 DOWNTO 0);
|
||||
usedw : OUT STD_LOGIC_VECTOR (log2(FIFO_DEPTH)-1 DOWNTO 0)
|
||||
);
|
||||
END COMPONENT;
|
||||
|
||||
BEGIN
|
||||
empty <= sub_wire0;
|
||||
full <= sub_wire1;
|
||||
q <= sub_wire2(FIFO_WIDTH-1 DOWNTO 0);
|
||||
usedw <= sub_wire3(log2(FIFO_DEPTH)-1 DOWNTO 0);
|
||||
|
||||
scfifo_component : scfifo
|
||||
GENERIC MAP (
|
||||
add_ram_output_register => "OFF",
|
||||
intended_device_family => "Cyclone V",
|
||||
lpm_numwords => FIFO_DEPTH,
|
||||
lpm_showahead => "OFF",
|
||||
lpm_type => "scfifo",
|
||||
lpm_width => FIFO_WIDTH,
|
||||
lpm_widthu => log2(FIFO_DEPTH-1),
|
||||
overflow_checking => "ON",
|
||||
underflow_checking => "ON",
|
||||
use_eab => "ON"
|
||||
)
|
||||
PORT MAP (
|
||||
sclr => sclr,
|
||||
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 "1"
|
||||
-- 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 "32"
|
||||
-- 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 "32"
|
||||
-- Retrieval info: PRIVATE: rsEmpty NUMERIC "1"
|
||||
-- Retrieval info: PRIVATE: rsFull NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: rsUsedW NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: sc_aclr NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: sc_sclr NUMERIC "1"
|
||||
-- Retrieval info: PRIVATE: wsEmpty NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: wsFull NUMERIC "1"
|
||||
-- Retrieval info: PRIVATE: wsUsedW NUMERIC "0"
|
||||
-- Retrieval info: LIBRARY: altera_mf altera_mf.altera_mf_components.all
|
||||
-- Retrieval info: CONSTANT: ADD_RAM_OUTPUT_REGISTER STRING "OFF"
|
||||
-- Retrieval info: CONSTANT: INTENDED_DEVICE_FAMILY STRING "Cyclone V"
|
||||
-- Retrieval info: CONSTANT: LPM_NUMWORDS NUMERIC "256"
|
||||
-- Retrieval info: CONSTANT: LPM_SHOWAHEAD STRING "OFF"
|
||||
-- Retrieval info: CONSTANT: LPM_TYPE STRING "scfifo"
|
||||
-- Retrieval info: CONSTANT: LPM_WIDTH NUMERIC "32"
|
||||
-- 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: clock 0 0 0 0 INPUT NODEFVAL "clock"
|
||||
-- Retrieval info: USED_PORT: data 0 0 32 0 INPUT NODEFVAL "data[31..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 32 0 OUTPUT NODEFVAL "q[31..0]"
|
||||
-- Retrieval info: USED_PORT: rdreq 0 0 0 0 INPUT NODEFVAL "rdreq"
|
||||
-- Retrieval info: USED_PORT: sclr 0 0 0 0 INPUT NODEFVAL "sclr"
|
||||
-- Retrieval info: USED_PORT: usedw 0 0 8 0 OUTPUT NODEFVAL "usedw[7..0]"
|
||||
-- Retrieval info: USED_PORT: wrreq 0 0 0 0 INPUT NODEFVAL "wrreq"
|
||||
-- Retrieval info: CONNECT: @clock 0 0 0 0 clock 0 0 0 0
|
||||
-- Retrieval info: CONNECT: @data 0 0 32 0 data 0 0 32 0
|
||||
-- Retrieval info: CONNECT: @rdreq 0 0 0 0 rdreq 0 0 0 0
|
||||
-- Retrieval info: CONNECT: @sclr 0 0 0 0 sclr 0 0 0 0
|
||||
-- Retrieval info: CONNECT: @wrreq 0 0 0 0 wrreq 0 0 0 0
|
||||
-- Retrieval info: CONNECT: empty 0 0 0 0 @empty 0 0 0 0
|
||||
-- Retrieval info: CONNECT: full 0 0 0 0 @full 0 0 0 0
|
||||
-- Retrieval info: CONNECT: q 0 0 32 0 @q 0 0 32 0
|
||||
-- Retrieval info: CONNECT: usedw 0 0 8 0 @usedw 0 0 8 0
|
||||
-- Retrieval info: GEN_FILE: TYPE_NORMAL sync_fifo.vhd TRUE
|
||||
-- Retrieval info: GEN_FILE: TYPE_NORMAL sync_fifo.inc FALSE
|
||||
-- Retrieval info: GEN_FILE: TYPE_NORMAL sync_fifo.cmp FALSE
|
||||
-- Retrieval info: GEN_FILE: TYPE_NORMAL sync_fifo.bsf FALSE
|
||||
-- Retrieval info: GEN_FILE: TYPE_NORMAL sync_fifo_inst.vhd FALSE
|
||||
-- Retrieval info: LIB_FILE: altera_mf
|
||||
116
generic_ip/common/0/src/cs_bus_itf.vhd
Normal file
116
generic_ip/common/0/src/cs_bus_itf.vhd
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
-------------------------------------------------------------------------------
|
||||
-- Title : cs_bus_ift
|
||||
-------------------------------------------------------------------------------
|
||||
-- File : cs_bus_ift.vhd
|
||||
-- Author : Gianmarco Girau
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Target : Altera Nios/HPS based systems
|
||||
-- Dependency : none
|
||||
-------------------------------------------------------------------------------
|
||||
-- Description: Split the memory space from the Avalon-MM I/F and drive the C&S
|
||||
-- bus for a programmable number of FW processing blocks
|
||||
-------------------------------------------------------------------------------
|
||||
-- Last update: 2016-10-28
|
||||
-------------------------------------------------------------------------------
|
||||
-- Revisions :
|
||||
-- Date Version Author Description
|
||||
-- 2015-10-19 1.0 gmg Created
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
entity cs_bus_ift is
|
||||
generic(blk_num : integer range 1 to 16 := 1);
|
||||
port(
|
||||
rstN : in std_logic;
|
||||
clk : in std_logic;
|
||||
-- Avalon-MM itf
|
||||
avs_address : in std_logic_vector(14 downto 0);
|
||||
avs_write : in std_logic;
|
||||
avs_writedata : in std_logic_vector(31 downto 0);
|
||||
avs_read : in std_logic;
|
||||
avs_readdatavalid : out std_logic;
|
||||
avs_readdata : out std_logic_vector(31 downto 0);
|
||||
-- C&S bus
|
||||
cs_addr : out std_logic_vector(10 downto 0);
|
||||
cs_we : out std_logic_vector(blk_num-1 downto 0);
|
||||
cs_wr_data : out std_logic_vector(31 downto 0);
|
||||
cs_re : out std_logic_vector(blk_num-1 downto 0);
|
||||
cs_rv : in std_logic_vector(blk_num-1 downto 0);
|
||||
cs_rd_data : in std_logic_vector(32*blk_num-1 downto 0));
|
||||
end cs_bus_ift;
|
||||
|
||||
architecture RTL of cs_bus_ift is
|
||||
|
||||
-- limit to 16 the maximum number of user blocks
|
||||
type rd_bus_t is array (0 to blk_num-1) of std_logic_vector(31 downto 0);
|
||||
|
||||
signal cs_rd_data_i : rd_bus_t;
|
||||
signal avs_read_d : std_logic;
|
||||
signal avs_rd_en : std_logic;
|
||||
signal dummy_rv : std_logic; -- Dummy Read valid: asserted when
|
||||
-- trying to read from not allocated addresses
|
||||
signal avs_address_i : std_logic_vector(14 downto 0);
|
||||
|
||||
begin
|
||||
|
||||
BUS_REMAP: for i in 0 to blk_num-1 generate
|
||||
cs_rd_data_i(i) <= cs_rd_data((i+1)*32-1 downto i*32);
|
||||
end generate BUS_REMAP;
|
||||
|
||||
pLatchIO : process(rstN, clk)
|
||||
begin
|
||||
if(rstN = '0') then
|
||||
avs_address_i <= (others => '0');
|
||||
cs_we <= (others => '0');
|
||||
cs_wr_data <= (others => '0');
|
||||
cs_re <= (others => '0');
|
||||
avs_readdatavalid <= '0';
|
||||
avs_readdata <= (others => '0');
|
||||
avs_read_d <= '0';
|
||||
dummy_rv <= '0';
|
||||
elsif(clk = '1' and clk'event) then
|
||||
if(avs_write = '1' or avs_read = '1') then
|
||||
avs_address_i <= avs_address;
|
||||
end if;
|
||||
avs_read_d <= avs_read;
|
||||
for i in 0 to blk_num-1 loop
|
||||
-- limit to 16 the maximum number of user blocks
|
||||
if(avs_write = '1' and to_integer(unsigned(avs_address(avs_address'high downto avs_address'high-3))) = i) then
|
||||
cs_we(i) <= '1';
|
||||
else
|
||||
cs_we(i) <= '0';
|
||||
end if;
|
||||
end loop; -- i
|
||||
cs_wr_data <= avs_writedata;
|
||||
for i in 0 to blk_num-1 loop
|
||||
if(avs_rd_en = '1' and to_integer(unsigned(avs_address(avs_address'high downto avs_address'high-3))) = i) then
|
||||
cs_re(i) <= '1';
|
||||
else
|
||||
cs_re(i) <= '0';
|
||||
end if;
|
||||
end loop; -- i
|
||||
if(avs_rd_en = '1' and (to_integer(unsigned(avs_address(avs_address'high downto avs_address'high-3))) >= blk_num)) then
|
||||
dummy_rv <= '1';
|
||||
else
|
||||
dummy_rv <= '0';
|
||||
end if;
|
||||
avs_readdatavalid <= dummy_rv or cs_rv(to_integer(unsigned(avs_address_i(avs_address'high downto avs_address'high-3))));
|
||||
if(dummy_rv = '0') then
|
||||
avs_readdata <= cs_rd_data_i(to_integer(unsigned(avs_address_i(avs_address'high downto avs_address'high-3))));
|
||||
else
|
||||
avs_readdata <= X"DEAD_BEEF";
|
||||
end if;
|
||||
end if;
|
||||
end process pLatchIO;
|
||||
|
||||
avs_rd_en <= avs_read and not avs_read_d;
|
||||
|
||||
cs_addr <= avs_address_i(10 downto 0);
|
||||
|
||||
end RTL;
|
||||
|
||||
|
||||
|
||||
216
generic_ip/common/0/src/digital_lpf.vhd
Normal file
216
generic_ip/common/0/src/digital_lpf.vhd
Normal file
|
|
@ -0,0 +1,216 @@
|
|||
-------------------------------------------------------------------------------
|
||||
-- Title : digital_lpf
|
||||
-------------------------------------------------------------------------------
|
||||
-- File : digital_lpf.vhd
|
||||
-- Author : GMG
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Target : Generic (simulation), Generic (synthesis)
|
||||
-- Dependency : none
|
||||
-------------------------------------------------------------------------------
|
||||
-- Description: Digital Low-Pass-Filter with programmable lenght and
|
||||
-- hysteresis, with clock domain synchronization
|
||||
-------------------------------------------------------------------------------
|
||||
-- Last update: 2018-08-20
|
||||
-------------------------------------------------------------------------------
|
||||
-- Revisions :
|
||||
-- Date Version Author Description
|
||||
-- 2010-05-10 1.0 gmg Created
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- Filter Description:
|
||||
-------------------------------------------------------------------------------
|
||||
-- The filter includes an input synchronization stage, to the local clock, and
|
||||
-- a programmable lenght delay line. At reset, or after applying a new
|
||||
-- configuration the filter reset to initial state: the internal delay line and
|
||||
-- the output value switches to the reset value.
|
||||
-- When running, the filter counts the internal value of '0' and '1' in the
|
||||
-- delay line. If the value of ones is greater than or equal than the upper
|
||||
-- threshold (floor(filt_order/2)+hyst), the output switches to '1'.
|
||||
-- If the value of ones is less than or equal than the lower threshold
|
||||
-- (floor(filt_order/2)-hyst), the output switches to '1'.
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- Filter Configuration
|
||||
-------------------------------------------------------------------------------
|
||||
-- To support a signal with a maximum frequency f_max, being half_per_min the
|
||||
-- number of clock cycles corresponding to a half period, then the following
|
||||
-- inequality needs to be met:
|
||||
-- floor(filt_order/2) + hyst <= floor(half_per_min)
|
||||
-- For signals with asymmetric duty-cycles, half_per_min must be set to the
|
||||
-- minimum of the active high/low period.
|
||||
-- Examples:
|
||||
-- half_per_min = 11 => LPF order=18, hyst=2, or LPF order=16, hyst=3
|
||||
-- half_per_min = 10 => LPF order=16, hyst=2
|
||||
-- half_per_min = 9 => LPF order=14, hyst=2
|
||||
-- half_per_min = 8 => LPF order=12, hyst=2
|
||||
-- half_per_min = 7 => LPF order=10, hyst=2
|
||||
-- half_per_min = 6 => LPF order=10, hyst=1, LPF order=8, hyst=2
|
||||
-- half_per_min = 5 => LPF order=8, hyst=1
|
||||
-- half_per_min = 4 => LPF order=6, hyst=1
|
||||
-- half_per_min = 3 => LPF order=4, hyst=1
|
||||
-- half_per_min = 2 => LPF order=2, hyst=1
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
library work;
|
||||
use work.common_pkg.all;
|
||||
|
||||
entity digital_lpf is
|
||||
generic(
|
||||
RESET_VALUE : std_logic := '0';
|
||||
MAX_ORDER : positive := 32; -- max length of the delay line
|
||||
DEFAULT_ORDER : positive := 8; -- delay line length at reset (minimum = 2)
|
||||
DEFAULT_HYST : positive := 2); -- hysteresis value at reset (minimum = 1)
|
||||
port(
|
||||
clk : in std_logic;
|
||||
reset_n : in std_logic;
|
||||
ld_cfg : in std_logic; -- load filt_order and hyst values,
|
||||
-- reset the content of the filter
|
||||
filt_order : in std_logic_vector(log2(MAX_ORDER)-1 downto 0);
|
||||
hyst : in std_logic_vector(log2(MAX_ORDER)-1 downto 0);
|
||||
filt_in : in std_logic;
|
||||
filt_out : out std_logic;
|
||||
rEdge : out std_logic;
|
||||
fEdge : out std_logic);
|
||||
end entity digital_lpf;
|
||||
|
||||
architecture behav of digital_lpf is
|
||||
|
||||
signal sig_ii, sig_i, sig : std_logic;
|
||||
--
|
||||
signal filt_order_i : std_logic_vector(log2(MAX_ORDER)-1 downto 0);
|
||||
signal cnt_ones, hyst_i : std_logic_vector(log2(MAX_ORDER)-1 downto 0);
|
||||
signal delay_line : std_logic_vector(MAX_ORDER-1 downto 0);
|
||||
|
||||
begin
|
||||
|
||||
-- A couple of FFs to avoid metastability issues
|
||||
SynchrFFs : process(reset_n, clk)
|
||||
begin
|
||||
if(reset_n = '0') then
|
||||
sig_ii <= reset_value;
|
||||
sig_i <= reset_value;
|
||||
elsif(clk = '1' and clk'event) then
|
||||
sig_ii <= filt_in;
|
||||
sig_i <= sig_ii;
|
||||
end if;
|
||||
end process SynchrFFs;
|
||||
|
||||
-- Configuration register
|
||||
pCFG_REGs : process(reset_n, clk)
|
||||
begin
|
||||
if(reset_n = '0') then
|
||||
filt_order_i <= std_logic_vector(to_unsigned(DEFAULT_ORDER, log2(MAX_ORDER)));
|
||||
hyst_i <= std_logic_vector(to_unsigned(DEFAULT_HYST, log2(MAX_ORDER)));
|
||||
elsif(clk = '1' and clk'event) then
|
||||
if(ld_cfg = '1') then
|
||||
filt_order_i <= filt_order;
|
||||
hyst_i <= hyst;
|
||||
end if;
|
||||
end if;
|
||||
end process pCFG_REGs;
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
-- LPF for signals equal to '0' at reset
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
-- Low-Pass Filter process
|
||||
gLPF0: if reset_value = '0' generate
|
||||
pLPF : process(reset_n, clk)
|
||||
begin
|
||||
if(reset_n = '0') then
|
||||
sig <= '0';
|
||||
rEdge <= '0';
|
||||
fEdge <= '0';
|
||||
cnt_ones <= (others => '0');
|
||||
delay_line <= (others => '0');
|
||||
elsif(clk = '1' and clk'event) then
|
||||
rEdge <= '0';
|
||||
fEdge <= '0';
|
||||
-- update the filter output
|
||||
if(ld_cfg = '1') then
|
||||
sig <= '0';
|
||||
elsif(unsigned(cnt_ones) >= unsigned(filt_order_i(log2(MAX_ORDER)-1 downto 1)) + unsigned(hyst_i)) then
|
||||
sig <= '1';
|
||||
if(sig = '0') then
|
||||
rEdge <= '1';
|
||||
end if;
|
||||
elsif(unsigned(cnt_ones) <= unsigned(filt_order_i(log2(MAX_ORDER)-1 downto 1)) - unsigned(hyst_i)) then
|
||||
sig <= '0';
|
||||
if(sig = '1') then
|
||||
fEdge <= '1';
|
||||
end if;
|
||||
end if;
|
||||
-- update the filter memory and the count of logic ones
|
||||
if(ld_cfg = '1') then
|
||||
delay_line <= (others => '0');
|
||||
else
|
||||
delay_line <= delay_line(MAX_ORDER-2 downto 0) & sig_i;
|
||||
end if;
|
||||
if(ld_cfg = '1') then
|
||||
cnt_ones <= (others => '0');
|
||||
elsif(sig_i = '1' and delay_line(to_integer(unsigned(filt_order_i)-1)) = '0' and unsigned(cnt_ones) /= unsigned(filt_order_i)) then
|
||||
cnt_ones <= std_logic_vector(unsigned(cnt_ones)+1);
|
||||
elsif(sig_i = '0' and delay_line(to_integer(unsigned(filt_order_i)-1)) = '1' and unsigned(cnt_ones) /= 0) then
|
||||
cnt_ones <= std_logic_vector(unsigned(cnt_ones)-1);
|
||||
end if;
|
||||
end if;
|
||||
end process pLPF;
|
||||
end generate gLPF0;
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
-- LPF for signals equal to '1' at reset
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
-- Low-Pass Filter process
|
||||
gLPF1: if reset_value = '1' generate
|
||||
pLPF : process(reset_n, clk)
|
||||
begin
|
||||
if(reset_n = '0') then
|
||||
sig <= '1';
|
||||
rEdge <= '0';
|
||||
fEdge <= '0';
|
||||
cnt_ones <= (others => '1');
|
||||
delay_line <= (others => '1');
|
||||
elsif(clk = '1' and clk'event) then
|
||||
rEdge <= '0';
|
||||
fEdge <= '0';
|
||||
-- update the filter output
|
||||
if(ld_cfg = '1') then
|
||||
sig <= '1';
|
||||
elsif(unsigned(cnt_ones) >= unsigned(filt_order_i(log2(MAX_ORDER)-1 downto 1)) + unsigned(hyst_i)) then
|
||||
sig <= '1';
|
||||
if(sig = '0') then
|
||||
rEdge <= '1';
|
||||
end if;
|
||||
elsif(unsigned(cnt_ones) <= unsigned(filt_order_i(log2(MAX_ORDER)-1 downto 1)) - unsigned(hyst_i)) then
|
||||
sig <= '0';
|
||||
if(sig = '1') then
|
||||
fEdge <= '1';
|
||||
end if;
|
||||
end if;
|
||||
-- update the filter memory and the count of logic ones
|
||||
if(ld_cfg = '1') then
|
||||
delay_line <= (others => '1');
|
||||
else
|
||||
delay_line <= delay_line(MAX_ORDER-2 downto 0) & sig_i;
|
||||
end if;
|
||||
if(ld_cfg = '1') then
|
||||
cnt_ones <= (others => '1');
|
||||
elsif(sig_i = '1' and delay_line(to_integer(unsigned(filt_order_i)-1)) = '0' and unsigned(cnt_ones) /= unsigned(filt_order_i)) then
|
||||
cnt_ones <= std_logic_vector(unsigned(cnt_ones)+1);
|
||||
elsif(sig_i = '0' and delay_line(to_integer(unsigned(filt_order_i)-1)) = '1' and unsigned(cnt_ones) /= 0) then
|
||||
cnt_ones <= std_logic_vector(unsigned(cnt_ones)-1);
|
||||
end if;
|
||||
end if;
|
||||
end process pLPF;
|
||||
end generate gLPF1;
|
||||
|
||||
filt_out <= sig;
|
||||
|
||||
end architecture behav;
|
||||
251
generic_ip/common/0/src/queue_and_delay.vhd
Normal file
251
generic_ip/common/0/src/queue_and_delay.vhd
Normal file
|
|
@ -0,0 +1,251 @@
|
|||
-------------------------------------------------------------------------------
|
||||
-- Title : queue_and_delay
|
||||
-- Project : project independent
|
||||
-------------------------------------------------------------------------------
|
||||
-- File : queue_and_delay.vhd
|
||||
-- Author : Gianmarco Girau
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2016-05-28
|
||||
-- Last update: 2018-06-28
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'93
|
||||
-------------------------------------------------------------------------------
|
||||
-- Description:
|
||||
-- Generic component implementing a queue and delay functionality: Apply a
|
||||
-- static programmable delay to the input signal. Since the block is FIFO based
|
||||
-- (2048 words), the user must make sure that the number of transitions on the
|
||||
-- input signal happening within the programmed delay is lower than the size of the FIFO.
|
||||
-- E.g.: if the user program a delay of 2 ms, the input signal must have less
|
||||
-- than 1024 pulses in 2 ms => max pulse rate = 512kHz. The block rises the
|
||||
-- error bit when this condition is violated.
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
library work;
|
||||
use work.common_pkg.all;
|
||||
|
||||
entity queue_and_delay is
|
||||
generic(
|
||||
use_ext_time : boolean := false;
|
||||
queue_size : natural range 16 to 8192 := 1024);
|
||||
port (
|
||||
rstN : in std_logic;
|
||||
clk : in std_logic;
|
||||
init : in std_logic;
|
||||
cnt_dir : in std_logic; -- specify the direction of the cnt (0 => up, 1
|
||||
-- => down), when use_ext_time is set to ture
|
||||
delay : in std_logic_vector(31 downto 0);
|
||||
ext_time : in std_logic_vector(31 downto 0);
|
||||
wave_in : in std_logic;
|
||||
wave_out : out std_logic;
|
||||
ovf_error : out std_logic);
|
||||
end queue_and_delay;
|
||||
|
||||
architecture RTL of queue_and_delay is
|
||||
|
||||
component sync_fifo
|
||||
generic (
|
||||
FIFO_WIDTH : natural range 1 to 32;
|
||||
FIFO_DEPTH : natural range 1 to 8192);
|
||||
port (
|
||||
clock : in std_logic;
|
||||
data : in std_logic_vector (FIFO_WIDTH-1 downto 0);
|
||||
rdreq : in std_logic;
|
||||
sclr : in std_logic;
|
||||
wrreq : in std_logic;
|
||||
empty : out std_logic;
|
||||
full : out std_logic;
|
||||
q : out std_logic_vector (FIFO_WIDTH-1 downto 0);
|
||||
usedw : out std_logic_vector (log2(FIFO_DEPTH)-1 downto 0));
|
||||
end component;
|
||||
|
||||
signal toggle_in, toggle_out,time_elapsed : std_logic;
|
||||
signal wave_in_d, wave_out_i, pending_trans : std_logic;
|
||||
signal fifo_rd_en, fifo_empty, fifo_full : std_logic;
|
||||
signal cnt_dir_i, wave_out_i_d, new_event : std_logic;
|
||||
signal wave_out_ii, shf_enable : std_logic;
|
||||
signal delay_line : std_logic_vector( 7 downto 0);
|
||||
signal local_time, local_time_d, event_time : std_logic_vector(31 downto 0);
|
||||
|
||||
begin -- RTL
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Detect transitions in the input signal and memorize those events in a
|
||||
-- FIFO, together with a timetag. This process can be seen as a representation
|
||||
-- of the input signal in a compressed format.
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
toggle_in <= '1' when wave_in /= wave_in_d else '0';
|
||||
|
||||
pInputEdgeDetect : process(clk)
|
||||
begin
|
||||
if(clk = '1' and clk'event) then
|
||||
wave_in_d <= wave_in;
|
||||
end if;
|
||||
end process pInputEdgeDetect;
|
||||
|
||||
iENTRY_QUEUE: sync_fifo
|
||||
generic map(
|
||||
FIFO_WIDTH => 32,
|
||||
FIFO_DEPTH => queue_size)
|
||||
port map (
|
||||
clock => clk,
|
||||
data => local_time,
|
||||
rdreq => fifo_rd_en,
|
||||
sclr => init,
|
||||
wrreq => toggle_in,
|
||||
empty => fifo_empty,
|
||||
full => fifo_full,
|
||||
q => event_time,
|
||||
usedw => open);
|
||||
|
||||
-- Check Overflow error:
|
||||
pCHECK_OVF : process(rstN, clk)
|
||||
begin
|
||||
if(rstN = '0') then
|
||||
ovf_error <= '0';
|
||||
elsif(clk = '1' and clk'event) then
|
||||
if(init = '1') then
|
||||
ovf_error <= '0';
|
||||
elsif(toggle_in = '1' and fifo_full = '1') then
|
||||
ovf_error <= '1';
|
||||
end if;
|
||||
end if;
|
||||
end process pCHECK_OVF;
|
||||
|
||||
-- Time reference: either use the external one or generate it locally
|
||||
gTIME_REF0: if use_ext_time = true generate
|
||||
local_time <= ext_time;
|
||||
|
||||
shf_enable <= '1' when local_time /= local_time_d else '0';
|
||||
|
||||
--pTimeElapsed : process(cnt_dir, local_time, event_time, delay)
|
||||
pTimeElapsed : process(clk)
|
||||
begin
|
||||
if(clk = '1' and clk'event) then
|
||||
local_time_d <= local_time;
|
||||
cnt_dir_i <= cnt_dir;
|
||||
if(cnt_dir_i = '0') then
|
||||
if(signed(local_time) >= signed(event_time) + signed(delay)) then
|
||||
time_elapsed <= '1';
|
||||
else
|
||||
time_elapsed <= '0';
|
||||
end if;
|
||||
else
|
||||
if(signed(local_time) <= signed(event_time) - signed(delay)) then
|
||||
time_elapsed <= '1';
|
||||
else
|
||||
time_elapsed <= '0';
|
||||
end if;
|
||||
end if;
|
||||
new_event <= fifo_rd_en;
|
||||
end if;
|
||||
end process pTimeElapsed;
|
||||
|
||||
end generate gTIME_REF0;
|
||||
|
||||
gTIME_REF1: if use_ext_time = false generate
|
||||
|
||||
pGEN_LOC_REF : process(rstN, clk)
|
||||
begin
|
||||
if(rstN = '0') then
|
||||
local_time <= (others => '0');
|
||||
elsif(clk = '1' and clk'event) then
|
||||
if(init = '1') then
|
||||
local_time <= (others => '0');
|
||||
else
|
||||
local_time <= std_logic_vector(unsigned(local_time)+1);
|
||||
end if;
|
||||
end if;
|
||||
end process pGEN_LOC_REF;
|
||||
|
||||
new_event <= fifo_rd_en;
|
||||
time_elapsed <= '1' when unsigned(local_time) >= unsigned(event_time) + unsigned(delay) else '0';
|
||||
|
||||
shf_enable <= '1';
|
||||
|
||||
end generate gTIME_REF1;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Delay the input signal
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
-- Read the signal transitions recorded in the FIFO, apply the static delay
|
||||
pDELAY_WAVE_GEN : process(clk)
|
||||
begin
|
||||
if(clk = '1' and clk'event) then
|
||||
if(init = '1' or (time_elapsed = '1' and new_event = '0')) then
|
||||
pending_trans <= '0';
|
||||
elsif(new_event = '1') then
|
||||
pending_trans <= '1';
|
||||
end if;
|
||||
if(pending_trans = '0' and fifo_empty = '0' and fifo_rd_en = '0' and new_event = '0') then
|
||||
fifo_rd_en <= '1';
|
||||
else
|
||||
fifo_rd_en <= '0';
|
||||
end if;
|
||||
end if;
|
||||
end process pDELAY_WAVE_GEN;
|
||||
|
||||
pGEN_OUT : process(rstN, clk)
|
||||
begin
|
||||
if(rstN = '0') then
|
||||
wave_out_i <= '0';
|
||||
elsif(clk = '1' and clk'event) then
|
||||
if(init = '1') then
|
||||
wave_out_i <= wave_in_d;
|
||||
elsif(toggle_out = '1') then
|
||||
wave_out_i <= not wave_out_i;
|
||||
end if;
|
||||
end if;
|
||||
end process pGEN_OUT;
|
||||
|
||||
-- Because of the intrinsic latency with the FIFO, a shift register is used
|
||||
-- to achieve small delays (< 8).
|
||||
pDELAY_THROUGH_SHF : process(clk)
|
||||
begin
|
||||
if(clk = '1' and clk'event) then
|
||||
if(shf_enable = '1') then
|
||||
delay_line <= delay_line(6 downto 0) & wave_in;
|
||||
end if;
|
||||
end if;
|
||||
end process pDELAY_THROUGH_SHF;
|
||||
|
||||
toggle_out <= time_elapsed and pending_trans;
|
||||
|
||||
-- When using the external counter, the input signal might have multiple rising and
|
||||
-- falling events whitout a change a value in the counter. When this happens,
|
||||
-- the pulse width is not properly replicated in the output of the delay
|
||||
-- block. To make the behaviour more predictable, when using the external
|
||||
-- counter, a positive edge detector is inserted at the output.
|
||||
|
||||
gOUT_GEN0: if use_ext_time = false generate
|
||||
|
||||
wave_out_ii <= wave_out_i when unsigned(delay) >= 8 else delay_line(to_integer(unsigned(delay(2 downto 0))));
|
||||
|
||||
pOUT_GEN0: process(clk)
|
||||
begin
|
||||
if(clk = '1' and clk'event) then
|
||||
wave_out <= wave_out_ii;
|
||||
end if;
|
||||
end process pOUT_GEN0;
|
||||
|
||||
end generate gOUT_GEN0;
|
||||
|
||||
gOUT_GEN1: if use_ext_time = true generate
|
||||
|
||||
pOUT_GEN1: process(clk)
|
||||
begin
|
||||
if(clk = '1' and clk'event) then
|
||||
wave_out_i_d <= wave_out_i;
|
||||
wave_out <= wave_out_i and not wave_out_i_d;
|
||||
end if;
|
||||
end process pOUT_GEN1;
|
||||
|
||||
end generate gOUT_GEN1;
|
||||
|
||||
|
||||
end RTL;
|
||||
66
generic_ip/common/0/src/sync_wire_rEdge.vhd
Normal file
66
generic_ip/common/0/src/sync_wire_rEdge.vhd
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
-------------------------------------------------------------------------------
|
||||
-- Title : sync_wire_rEdge
|
||||
-------------------------------------------------------------------------------
|
||||
-- File : sync_wire_rEdge.vhd
|
||||
-- Author : Gianmarco Girau <ggianmarco.girau@gmail.com>
|
||||
-- Company : On my own
|
||||
-- Target : Generic (simulation), Generic (synthesis)
|
||||
-- Dependency : none
|
||||
-------------------------------------------------------------------------------
|
||||
-- Description: synchronize a std_logic signal to a clock domain with rising edge
|
||||
-------------------------------------------------------------------------------
|
||||
-- Last update: 2015-08-17
|
||||
-------------------------------------------------------------------------------
|
||||
-- Revisions :
|
||||
-- Date Version Author Description
|
||||
-- 2010-12-03 1.0 gmg Created
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
|
||||
entity sync_wire_rEdge is
|
||||
generic(
|
||||
rst_val : std_logic := '0';
|
||||
sync_stages : positive := 2);
|
||||
port(
|
||||
rstN : in std_logic;
|
||||
clk : in std_logic;
|
||||
async_in : in std_logic;
|
||||
sync_out : out std_logic);
|
||||
end sync_wire_rEdge;
|
||||
|
||||
architecture RTL of sync_wire_rEdge is
|
||||
|
||||
signal sync_out_i, sync_out_d : std_logic;
|
||||
signal sync_sig : std_logic_vector(sync_stages-1 downto 0);
|
||||
|
||||
begin
|
||||
|
||||
pSYNC : process(rstN, clk)
|
||||
begin
|
||||
if(rstN = '0') then
|
||||
sync_out_d <= rst_val;
|
||||
for n in 0 to sync_stages-1 loop
|
||||
sync_sig(n) <= rst_val;
|
||||
end loop; -- n
|
||||
elsif(clk = '1' and clk'event) then
|
||||
sync_out_d <= sync_out_i;
|
||||
for n in 0 to sync_stages-1 loop
|
||||
if(n = 0) then
|
||||
sync_sig(0) <= async_in;
|
||||
else
|
||||
sync_sig(n) <= sync_sig(n-1);
|
||||
end if;
|
||||
end loop; -- n
|
||||
end if;
|
||||
end process pSYNC;
|
||||
|
||||
sync_out_i <= sync_sig(sync_stages-1);
|
||||
-- rising edge detect
|
||||
sync_out <= sync_out_i and not sync_out_d;
|
||||
|
||||
end RTL;
|
||||
|
||||
|
||||
|
||||
188
generic_ip/common/0/src/uart_rx.vhd
Normal file
188
generic_ip/common/0/src/uart_rx.vhd
Normal file
|
|
@ -0,0 +1,188 @@
|
|||
-------------------------------------------------------------------------------
|
||||
-- Title : uart_rx
|
||||
-- Project : EMB-1
|
||||
-------------------------------------------------------------------------------
|
||||
-- File : uart_rx.vhd
|
||||
-- Author : Gianmarco Girau
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2016-10-24
|
||||
-- Last update: 2018-09-12
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'08
|
||||
-------------------------------------------------------------------------------
|
||||
-- Description:
|
||||
-- Simple UART receiver, used to receive data over the POF, 1 start, 1 stop
|
||||
-- bit, no parity
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
entity uart_rx is
|
||||
generic(
|
||||
data_width : natural range 1 to 31);
|
||||
port(
|
||||
reset_n : in std_logic;
|
||||
clk : in std_logic;
|
||||
bit_div : in std_logic_vector(3 downto 0); -- number of clock cycles per tx bit
|
||||
init : in std_logic;
|
||||
data_out : out std_logic_vector(data_width-1 downto 0);
|
||||
data_out_valid : out std_logic;
|
||||
rx_error : out std_logic;
|
||||
rx_data : in std_logic);
|
||||
end entity uart_rx;
|
||||
|
||||
architecture rtl of uart_rx is
|
||||
|
||||
component sync_wire
|
||||
generic (
|
||||
rst_val : std_logic;
|
||||
sync_stages : positive);
|
||||
port (
|
||||
rstN : in std_logic;
|
||||
clk : in std_logic;
|
||||
async_in : in std_logic;
|
||||
sync_out : out std_logic);
|
||||
end component;
|
||||
|
||||
type fsm_state_t is (s_init, s_idle, s_get_start_bit, s_get_data, s_get_stop_bit);
|
||||
|
||||
signal fsm_state_curr, fsm_state_next : fsm_state_t;
|
||||
--
|
||||
signal rx_data_i, shf_data, rst_bit_cnt, inc_bit_cnt : std_logic;
|
||||
signal rst_clk_cnt, end_of_bit, end_of_rx, data_valid : std_logic;
|
||||
signal stop_bit, rx_error_i : std_logic;
|
||||
--
|
||||
signal data : std_logic_vector(data_width-1 downto 0);
|
||||
signal clk_cnt : std_logic_vector(3 downto 0);
|
||||
signal bit_cnt : std_logic_vector(5 downto 0);
|
||||
|
||||
begin
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Input Synchronization
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
iSYNC_IN : sync_wire
|
||||
generic map (
|
||||
rst_val => '1',
|
||||
sync_stages => 3)
|
||||
port map (
|
||||
rstN => reset_n,
|
||||
clk => clk,
|
||||
async_in => rx_data,
|
||||
sync_out => rx_data_i);
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- UART registers and sequential logic
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
pREGs : process(clk)
|
||||
begin
|
||||
if(clk ='1' and clk'event) then
|
||||
if(rst_bit_cnt = '1') then
|
||||
bit_cnt <= (others => '0');
|
||||
elsif(inc_bit_cnt = '1') then
|
||||
bit_cnt <= std_logic_vector(unsigned(bit_cnt)+1);
|
||||
end if;
|
||||
if(rst_clk_cnt = '1' or end_of_bit = '1') then
|
||||
clk_cnt <= (others => '0');
|
||||
else
|
||||
clk_cnt <= std_logic_vector(unsigned(clk_cnt)+1);
|
||||
end if;
|
||||
if(rst_clk_cnt = '1') then
|
||||
data <= (others => '0');
|
||||
elsif(shf_data = '1') then
|
||||
data <= rx_data_i & data(data'high downto 1);
|
||||
end if;
|
||||
data_out_valid <= data_valid;
|
||||
if(init = '1') then
|
||||
data_out <= (others => '0');
|
||||
elsif(data_valid = '1') then
|
||||
data_out <= data;
|
||||
end if;
|
||||
rx_error <= rx_error_i;
|
||||
end if;
|
||||
end process pREGs;
|
||||
|
||||
end_of_bit <= '1' when unsigned(clk_cnt) = (unsigned(bit_div)-1) else '0';
|
||||
end_of_rx <= '1' when unsigned(bit_cnt) = data_width else '0';
|
||||
|
||||
--shf_data <= '1' when unsigned(clk_cnt) = 1 and stop_bit = '0' else '0';
|
||||
shf_data <= '1' when unsigned(clk_cnt) = (unsigned(bit_div(bit_div'high downto 1))-1) and stop_bit = '0' else '0';
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- FSM
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
-- FSM state register
|
||||
pFSM_SR : process(clk)
|
||||
begin
|
||||
if(clk = '1' and clk'event) then
|
||||
if(init = '1') then
|
||||
fsm_state_curr <= s_init;
|
||||
else
|
||||
fsm_state_curr <= fsm_state_next;
|
||||
end if;
|
||||
end if;
|
||||
end process pFSM_SR;
|
||||
|
||||
-- FSM Combinational Logic
|
||||
pFSM_CL : process(fsm_state_curr, rx_data_i, end_of_bit, end_of_rx)
|
||||
begin
|
||||
--default assignments
|
||||
rst_clk_cnt <= '0';
|
||||
rst_bit_cnt <= '0';
|
||||
inc_bit_cnt <= '0';
|
||||
data_valid <= '0';
|
||||
stop_bit <= '0';
|
||||
rx_error_i <= '0';
|
||||
--
|
||||
fsm_state_next <= fsm_state_curr;
|
||||
|
||||
case fsm_state_curr is
|
||||
when s_init =>
|
||||
if(rx_data_i = '1') then
|
||||
fsm_state_next <= s_idle;
|
||||
end if;
|
||||
|
||||
when s_idle =>
|
||||
if(rx_data_i = '0') then
|
||||
rst_clk_cnt <= '1';
|
||||
rst_bit_cnt <= '1';
|
||||
fsm_state_next <= s_get_start_bit;
|
||||
end if;
|
||||
|
||||
when s_get_start_bit =>
|
||||
if(end_of_bit = '1') then
|
||||
inc_bit_cnt <= '1';
|
||||
fsm_state_next <= s_get_data;
|
||||
end if;
|
||||
|
||||
when s_get_data =>
|
||||
if(end_of_bit = '1') then
|
||||
inc_bit_cnt <= '1';
|
||||
if(end_of_rx = '1') then
|
||||
fsm_state_next <= s_get_stop_bit;
|
||||
end if;
|
||||
end if;
|
||||
|
||||
when s_get_stop_bit =>
|
||||
stop_bit <= '1';
|
||||
if(end_of_bit = '1') then
|
||||
if(rx_data_i = '1') then
|
||||
data_valid <= '1';
|
||||
fsm_state_next <= s_idle;
|
||||
else
|
||||
rx_error_i <= '1';
|
||||
fsm_state_next <= s_init;
|
||||
end if;
|
||||
end if;
|
||||
|
||||
when others => null;
|
||||
end case;
|
||||
end process pFSM_CL;
|
||||
|
||||
|
||||
end architecture rtl;
|
||||
163
generic_ip/common/0/src/uart_tx.vhd
Normal file
163
generic_ip/common/0/src/uart_tx.vhd
Normal file
|
|
@ -0,0 +1,163 @@
|
|||
-------------------------------------------------------------------------------
|
||||
-- Title : uart_tx
|
||||
-- Project : EMB-1
|
||||
-------------------------------------------------------------------------------
|
||||
-- File : uart_tx.vhd
|
||||
-- Author : Gianmarco Girau
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2016-10-24
|
||||
-- Last update: 2017-10-19
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'08
|
||||
-------------------------------------------------------------------------------
|
||||
-- Description:
|
||||
-- Simple UART trasmitter, used to trasmit data over the POF, 1 start, 1 stop
|
||||
-- bit, no parity
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
entity uart_tx is
|
||||
generic(
|
||||
data_width : natural range 1 to 31);
|
||||
port(
|
||||
reset_n : in std_logic;
|
||||
clk : in std_logic;
|
||||
bit_div : in std_logic_vector(3 downto 0); -- number of clock cycles per tx bit
|
||||
init : in std_logic;
|
||||
ready : out std_logic;
|
||||
data_in : in std_logic_vector(data_width-1 downto 0);
|
||||
data_valid : in std_logic;
|
||||
tx_data : out std_logic);
|
||||
end entity uart_tx;
|
||||
|
||||
architecture rtl of uart_tx is
|
||||
|
||||
type fsm_state_t is (idle, send_start_bit, send_data, send_stop_bit);
|
||||
|
||||
signal fsm_state_curr, fsm_state_next : fsm_state_t;
|
||||
--
|
||||
signal ld_data, shf_data, rst_bit_cnt, inc_bit_cnt : std_logic;
|
||||
signal rst_clk_cnt, end_of_bit, end_of_tx : std_logic;
|
||||
signal rst_tx_data, set_tx_data, ld_tx_data : std_logic;
|
||||
signal ready_i : std_logic;
|
||||
--
|
||||
signal data : std_logic_vector(data_width-1 downto 0);
|
||||
signal clk_cnt : std_logic_vector(3 downto 0);
|
||||
signal bit_cnt : std_logic_vector(5 downto 0);
|
||||
|
||||
begin
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- UART registers and sequential logic
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
pREGs : process(clk)
|
||||
begin
|
||||
if(clk ='1' and clk'event) then
|
||||
if(ld_data = '1') then
|
||||
data <= data_in;
|
||||
elsif(shf_data = '1') then
|
||||
data <= '0' & data(data'high downto 1);
|
||||
end if;
|
||||
if(rst_bit_cnt = '1') then
|
||||
bit_cnt <= (others => '0');
|
||||
elsif(inc_bit_cnt = '1') then
|
||||
bit_cnt <= std_logic_vector(unsigned(bit_cnt)+1);
|
||||
end if;
|
||||
if(rst_clk_cnt = '1' or end_of_bit = '1') then
|
||||
clk_cnt <= (others => '0');
|
||||
else
|
||||
clk_cnt <= std_logic_vector(unsigned(clk_cnt)+1);
|
||||
end if;
|
||||
if(rst_tx_data = '1') then
|
||||
tx_data <= '0';
|
||||
elsif(set_tx_data = '1') then
|
||||
tx_data <= '1';
|
||||
elsif(ld_tx_data = '1') then
|
||||
tx_data <= data(0);
|
||||
end if;
|
||||
end if;
|
||||
end process pREGs;
|
||||
|
||||
end_of_bit <= '1' when unsigned(clk_cnt) = (unsigned(bit_div)-1) else '0';
|
||||
end_of_tx <= '1' when unsigned(bit_cnt) = data_width else '0';
|
||||
|
||||
--shf_data <= inc_bit_cnt;
|
||||
shf_data <= ld_tx_data;
|
||||
inc_bit_cnt <= ld_tx_data;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- FSM
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
-- FSM state register
|
||||
pFSM_SR : process(reset_n, clk)
|
||||
begin
|
||||
if(reset_n = '0') then
|
||||
fsm_state_curr <= idle;
|
||||
elsif(clk = '1' and clk'event) then
|
||||
fsm_state_curr <= fsm_state_next;
|
||||
end if;
|
||||
end process pFSM_SR;
|
||||
|
||||
-- FSM Combinational Logic
|
||||
pFSM_CL : process(fsm_state_curr, init, data_valid, end_of_bit, end_of_tx)
|
||||
begin
|
||||
--default assignments
|
||||
ready_i <= '0';
|
||||
rst_clk_cnt <= '0';
|
||||
rst_tx_data <= '0';
|
||||
set_tx_data <= '0';
|
||||
ld_tx_data <= '0';
|
||||
rst_bit_cnt <= '0';
|
||||
ld_data <= '0';
|
||||
--
|
||||
fsm_state_next <= fsm_state_curr;
|
||||
|
||||
if(init = '1') then
|
||||
set_tx_data <= '1';
|
||||
fsm_state_next <= idle;
|
||||
else
|
||||
case fsm_state_curr is
|
||||
when idle =>
|
||||
ready_i <= '1';
|
||||
ld_data <= '1';
|
||||
rst_clk_cnt <= '1';
|
||||
rst_bit_cnt <= '1';
|
||||
set_tx_data <= '1';
|
||||
if(data_valid = '1') then
|
||||
rst_tx_data <= '1';
|
||||
fsm_state_next <= send_start_bit;
|
||||
end if;
|
||||
|
||||
when send_start_bit =>
|
||||
if(end_of_bit = '1') then
|
||||
ld_tx_data <= '1';
|
||||
fsm_state_next <= send_data;
|
||||
end if;
|
||||
|
||||
when send_data =>
|
||||
if(end_of_bit = '1') then
|
||||
ld_tx_data <= '1';
|
||||
if(end_of_tx = '1') then
|
||||
set_tx_data <= '1';
|
||||
fsm_state_next <= send_stop_bit;
|
||||
end if;
|
||||
end if;
|
||||
|
||||
when send_stop_bit =>
|
||||
if(end_of_bit = '1') then
|
||||
fsm_state_next <= idle;
|
||||
end if;
|
||||
|
||||
when others => null;
|
||||
end case;
|
||||
end if;
|
||||
end process pFSM_CL;
|
||||
|
||||
ready <= ready_i;
|
||||
|
||||
end architecture rtl;
|
||||
|
|
@ -0,0 +1,277 @@
|
|||
# TCL File Generated by Component Editor 16.0
|
||||
# Wed Oct 25 15:26:07 BST 2017
|
||||
# DO NOT MODIFY
|
||||
|
||||
|
||||
#
|
||||
# fire_pulse_manager_0 "fire_pulse_manager_0" v1.0
|
||||
# GMG 2017.10.25.15:26:07
|
||||
# Fire Pulse Manager
|
||||
#
|
||||
|
||||
#
|
||||
# request TCL package from ACDS 16.0
|
||||
#
|
||||
package require -exact qsys 16.0
|
||||
|
||||
|
||||
#
|
||||
# module fire_pulse_manager_0
|
||||
#
|
||||
set_module_property DESCRIPTION "Fire Pulse Manager"
|
||||
set_module_property NAME fire_pulse_manager_0
|
||||
set_module_property VERSION 1.0
|
||||
set_module_property INTERNAL false
|
||||
set_module_property OPAQUE_ADDRESS_MAP true
|
||||
set_module_property GROUP "GIS Components"
|
||||
set_module_property AUTHOR GMG
|
||||
set_module_property DISPLAY_NAME fire_pulse_manager_0
|
||||
set_module_property INSTANTIATE_IN_SYSTEM_MODULE true
|
||||
set_module_property EDITABLE true
|
||||
set_module_property REPORT_TO_TALKBACK false
|
||||
set_module_property ALLOW_GREYBOX_GENERATION false
|
||||
set_module_property REPORT_HIERARCHY false
|
||||
|
||||
|
||||
#
|
||||
# file sets
|
||||
#
|
||||
add_fileset QUARTUS_SYNTH QUARTUS_SYNTH "" ""
|
||||
set_fileset_property QUARTUS_SYNTH TOP_LEVEL fire_pulse_manager_0
|
||||
set_fileset_property QUARTUS_SYNTH ENABLE_RELATIVE_INCLUDE_PATHS false
|
||||
set_fileset_property QUARTUS_SYNTH ENABLE_FILE_OVERWRITE_MODE false
|
||||
#add_fileset_file pkg_functions.vhd VHDL PATH ../../../common/0/src/pkg_functions.vhd
|
||||
add_fileset_file common_pkg.vhd VHDL PATH ../../../common/0/src/common_pkg.vhd
|
||||
add_fileset_file sync_reset.vhd VHDL PATH ../../../common/0/src/sync_reset.vhd
|
||||
add_fileset_file sync_wire.vhd VHDL PATH ../../../common/0/src/sync_wire.vhd
|
||||
add_fileset_file sync_wire_rEdge.vhd VHDL PATH ../../../common/0/src/sync_wire_rEdge.vhd
|
||||
add_fileset_file fifo_1024x32.vhd VHDL PATH ../../../common/0//src/altera/fifo_1024x32.vhd
|
||||
add_fileset_file fifo_256x32.vhd VHDL PATH ../../../common/0/src/altera/fifo_256x32.vhd
|
||||
add_fileset_file sync_fifo.vhd VHDL PATH ../../../common/0/src/altera/sync_fifo.vhd
|
||||
add_fileset_file cs_bus_itf.vhd VHDL PATH ../../../common/0/src/cs_bus_itf.vhd
|
||||
add_fileset_file uart_rx.vhd VHDL PATH ../../../common/0/src/uart_rx.vhd
|
||||
add_fileset_file dpram_sclk_15.vhd VHDL PATH ../../../generic_sequencer/15/src/dpram_sclk_15.vhd
|
||||
add_fileset_file generic_sequencer_15_pkg.vhd VHDL PATH ../../../generic_sequencer/15/src/generic_sequencer_15_pkg.vhd
|
||||
add_fileset_file generic_sequencer_15.vhd VHDL PATH ../../../generic_sequencer/15/src/generic_sequencer_15.vhd
|
||||
add_fileset_file enc_pd_emul_1_pkg.vhd VHDL PATH ../../../enc_pd_emul/1/src/enc_pd_emul_1_pkg.vhd
|
||||
add_fileset_file enc_pd_emul_1.vhd VHDL PATH ../../../enc_pd_emul/1/src/enc_pd_emul_1.vhd
|
||||
add_fileset_file pulse_conditioning_1.vhd VHDL PATH ../../../pulse_generator/1/src/pulse_conditioning_1.vhd
|
||||
add_fileset_file sync_fifo_1.vhd VHDL PATH ../../../pulse_generator/1/src/altera/sync_fifo_1.vhd
|
||||
add_fileset_file queue_and_delay_1.vhd VHDL PATH ../../../pulse_generator/1/src/queue_and_delay_1.vhd
|
||||
add_fileset_file simple_frac_div_1.vhd VHDL PATH ../../../pulse_generator/1/src/simple_frac_div_1.vhd
|
||||
add_fileset_file pulse_generator_1_pkg.vhd VHDL PATH ../../../pulse_generator/1/src/pulse_generator_1_pkg.vhd
|
||||
add_fileset_file pulse_generator_1.vhd VHDL PATH ../../../pulse_generator/1/src/pulse_generator_1.vhd
|
||||
add_fileset_file pof_rx_0.vhd VHDL PATH ../src/pof_rx_0.vhd
|
||||
add_fileset_file smb_diagnostics_0.vhd VHDL PATH ../src/smb_diagnostics_0.vhd
|
||||
add_fileset_file fire_pulse_0_pkg.vhd VHDL PATH ../src/fire_pulse_0_pkg.vhd
|
||||
add_fileset_file uart_regen_0.vhd VHDL PATH ../src/uart_regen_0.vhd
|
||||
add_fileset_file fire_pulse_ctrl_0.vhd VHDL PATH ../src/fire_pulse_ctrl_0.vhd
|
||||
add_fileset_file fire_pulse_manager_0.vhd VHDL PATH ../src/fire_pulse_manager_0.vhd TOP_LEVEL_FILE
|
||||
|
||||
add_fileset SIM_VHDL SIM_VHDL "" ""
|
||||
set_fileset_property SIM_VHDL TOP_LEVEL fire_pulse_manager_0
|
||||
set_fileset_property SIM_VHDL ENABLE_RELATIVE_INCLUDE_PATHS false
|
||||
set_fileset_property SIM_VHDL ENABLE_FILE_OVERWRITE_MODE false
|
||||
#add_fileset_file pkg_functions.vhd VHDL PATH ../../../common/0/src/pkg_functions.vhd
|
||||
add_fileset_file common_pkg.vhd VHDL PATH ../../../common/0/src/common_pkg.vhd
|
||||
add_fileset_file sync_reset.vhd VHDL PATH ../../../common/0/src/sync_reset.vhd
|
||||
add_fileset_file sync_wire.vhd VHDL PATH ../../../common/0/src/sync_wire.vhd
|
||||
add_fileset_file sync_wire_rEdge.vhd VHDL PATH ../../../common/0/src/sync_wire_rEdge.vhd
|
||||
add_fileset_file fifo_1024x32.vhd VHDL PATH ../../../common/0//src/altera/fifo_1024x32.vhd
|
||||
add_fileset_file fifo_256x32.vhd VHDL PATH ../../../common/0/src/altera/fifo_256x32.vhd
|
||||
add_fileset_file sync_fifo.vhd VHDL PATH ../../../common/0/src/altera/sync_fifo.vhd
|
||||
add_fileset_file cs_bus_itf.vhd VHDL PATH ../../../common/0/src/cs_bus_itf.vhd
|
||||
add_fileset_file uart_rx.vhd VHDL PATH ../../../common/0/src/uart_rx.vhd
|
||||
add_fileset_file dpram_sclk_15.vhd VHDL PATH ../../../generic_sequencer/15/src/dpram_sclk_15.vhd
|
||||
add_fileset_file generic_sequencer_15_pkg.vhd VHDL PATH ../../../generic_sequencer/15/src/generic_sequencer_15_pkg.vhd
|
||||
add_fileset_file generic_sequencer_15.vhd VHDL PATH ../../../generic_sequencer/15/src/generic_sequencer_15.vhd
|
||||
add_fileset_file enc_pd_emul_1_pkg.vhd VHDL PATH ../../../enc_pd_emul/1/src/enc_pd_emul_1_pkg.vhd
|
||||
add_fileset_file enc_pd_emul_1.vhd VHDL PATH ../../../enc_pd_emul/1/src/enc_pd_emul_1.vhd
|
||||
add_fileset_file pulse_conditioning_1.vhd VHDL PATH ../../../pulse_generator/1/src/pulse_conditioning_1.vhd
|
||||
add_fileset_file sync_fifo_1.vhd VHDL PATH ../../../pulse_generator/1/src/altera/sync_fifo_1.vhd
|
||||
add_fileset_file queue_and_delay_1.vhd VHDL PATH ../../../pulse_generator/1/src/queue_and_delay_1.vhd
|
||||
add_fileset_file simple_frac_div_1.vhd VHDL PATH ../../../pulse_generator/1/src/simple_frac_div_1.vhd
|
||||
add_fileset_file pulse_generator_1_pkg.vhd VHDL PATH ../../../pulse_generator/1/src/pulse_generator_1_pkg.vhd
|
||||
add_fileset_file pulse_generator_1.vhd VHDL PATH ../../../pulse_generator/1/src/pulse_generator_1.vhd
|
||||
add_fileset_file pof_rx_0.vhd VHDL PATH ../src/pof_rx_0.vhd
|
||||
add_fileset_file smb_diagnostics_0.vhd VHDL PATH ../src/smb_diagnostics_0.vhd
|
||||
add_fileset_file fire_pulse_0_pkg.vhd VHDL PATH ../src/fire_pulse_0_pkg.vhd
|
||||
add_fileset_file uart_regen_0.vhd VHDL PATH ../src/uart_regen_0.vhd
|
||||
add_fileset_file fire_pulse_ctrl_0.vhd VHDL PATH ../src/fire_pulse_ctrl_0.vhd
|
||||
add_fileset_file fire_pulse_manager_0.vhd VHDL PATH ../src/fire_pulse_manager_0.vhd
|
||||
|
||||
|
||||
#
|
||||
# parameters
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# display items
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# connection point clock
|
||||
#
|
||||
add_interface clock clock end
|
||||
set_interface_property clock clockRate 0
|
||||
set_interface_property clock ENABLED true
|
||||
set_interface_property clock EXPORT_OF ""
|
||||
set_interface_property clock PORT_NAME_MAP ""
|
||||
set_interface_property clock CMSIS_SVD_VARIABLES ""
|
||||
set_interface_property clock SVD_ADDRESS_GROUP ""
|
||||
|
||||
add_interface_port clock clk clk Input 1
|
||||
|
||||
|
||||
#
|
||||
# connection point reset
|
||||
#
|
||||
add_interface reset reset end
|
||||
set_interface_property reset associatedClock clock
|
||||
set_interface_property reset synchronousEdges DEASSERT
|
||||
set_interface_property reset ENABLED true
|
||||
set_interface_property reset EXPORT_OF ""
|
||||
set_interface_property reset PORT_NAME_MAP ""
|
||||
set_interface_property reset CMSIS_SVD_VARIABLES ""
|
||||
set_interface_property reset SVD_ADDRESS_GROUP ""
|
||||
|
||||
add_interface_port reset reset_n reset_n Input 1
|
||||
|
||||
|
||||
#
|
||||
# connection point avs
|
||||
#
|
||||
add_interface avs avalon end
|
||||
set_interface_property avs addressUnits WORDS
|
||||
set_interface_property avs associatedClock clock
|
||||
set_interface_property avs associatedReset reset
|
||||
set_interface_property avs bitsPerSymbol 8
|
||||
set_interface_property avs burstOnBurstBoundariesOnly false
|
||||
set_interface_property avs burstcountUnits WORDS
|
||||
set_interface_property avs explicitAddressSpan 0
|
||||
set_interface_property avs holdTime 0
|
||||
set_interface_property avs linewrapBursts false
|
||||
set_interface_property avs maximumPendingReadTransactions 1
|
||||
set_interface_property avs maximumPendingWriteTransactions 0
|
||||
set_interface_property avs readLatency 0
|
||||
set_interface_property avs readWaitTime 1
|
||||
set_interface_property avs setupTime 0
|
||||
set_interface_property avs timingUnits Cycles
|
||||
set_interface_property avs writeWaitTime 0
|
||||
set_interface_property avs ENABLED true
|
||||
set_interface_property avs EXPORT_OF ""
|
||||
set_interface_property avs PORT_NAME_MAP ""
|
||||
set_interface_property avs CMSIS_SVD_VARIABLES ""
|
||||
set_interface_property avs SVD_ADDRESS_GROUP ""
|
||||
|
||||
add_interface_port avs avs_address address Input 15
|
||||
add_interface_port avs avs_write write Input 1
|
||||
add_interface_port avs avs_writedata writedata Input 32
|
||||
add_interface_port avs avs_read read Input 1
|
||||
add_interface_port avs avs_readdatavalid readdatavalid Output 1
|
||||
add_interface_port avs avs_readdata readdata Output 32
|
||||
set_interface_assignment avs embeddedsw.configuration.isFlash 0
|
||||
set_interface_assignment avs embeddedsw.configuration.isMemoryDevice 0
|
||||
set_interface_assignment avs embeddedsw.configuration.isNonVolatileStorage 0
|
||||
set_interface_assignment avs embeddedsw.configuration.isPrintableDevice 0
|
||||
|
||||
|
||||
#
|
||||
# connection point conduit_end
|
||||
#
|
||||
add_interface conduit_end conduit end
|
||||
set_interface_property conduit_end associatedClock clock
|
||||
set_interface_property conduit_end associatedReset reset
|
||||
set_interface_property conduit_end ENABLED true
|
||||
set_interface_property conduit_end EXPORT_OF ""
|
||||
set_interface_property conduit_end PORT_NAME_MAP ""
|
||||
set_interface_property conduit_end CMSIS_SVD_VARIABLES ""
|
||||
set_interface_property conduit_end SVD_ADDRESS_GROUP ""
|
||||
|
||||
add_interface_port conduit_end pof_rx pof_rx Input 1
|
||||
add_interface_port conduit_end pof_tx pof_tx Output 1
|
||||
add_interface_port conduit_end pof_iso_en pof_iso_en Output 1
|
||||
add_interface_port conduit_end fire_pulse fire_pulse Output 1
|
||||
add_interface_port conduit_end mon_pt mon_pt Output 4
|
||||
|
||||
|
||||
#
|
||||
# connection point rx_clk
|
||||
#
|
||||
add_interface rx_clk clock end
|
||||
set_interface_property rx_clk clockRate 0
|
||||
set_interface_property rx_clk ENABLED true
|
||||
set_interface_property rx_clk EXPORT_OF ""
|
||||
set_interface_property rx_clk PORT_NAME_MAP ""
|
||||
set_interface_property rx_clk CMSIS_SVD_VARIABLES ""
|
||||
set_interface_property rx_clk SVD_ADDRESS_GROUP ""
|
||||
|
||||
add_interface_port rx_clk rx_clk clk Input 1
|
||||
|
||||
|
||||
#
|
||||
# connection point irq_0
|
||||
#
|
||||
add_interface irq_0 interrupt end
|
||||
set_interface_property irq_0 associatedAddressablePoint ""
|
||||
set_interface_property irq_0 associatedClock clock
|
||||
set_interface_property irq_0 bridgedReceiverOffset ""
|
||||
set_interface_property irq_0 bridgesToReceiver ""
|
||||
set_interface_property irq_0 ENABLED true
|
||||
set_interface_property irq_0 EXPORT_OF ""
|
||||
set_interface_property irq_0 PORT_NAME_MAP ""
|
||||
set_interface_property irq_0 CMSIS_SVD_VARIABLES ""
|
||||
set_interface_property irq_0 SVD_ADDRESS_GROUP ""
|
||||
|
||||
add_interface_port irq_0 ins_fpm_irq_0 irq Output 1
|
||||
|
||||
#
|
||||
# connection point irq_1
|
||||
#
|
||||
add_interface irq_1 interrupt end
|
||||
set_interface_property irq_1 associatedAddressablePoint ""
|
||||
set_interface_property irq_1 associatedClock clock
|
||||
set_interface_property irq_1 bridgedReceiverOffset ""
|
||||
set_interface_property irq_1 bridgesToReceiver ""
|
||||
set_interface_property irq_1 ENABLED true
|
||||
set_interface_property irq_1 EXPORT_OF ""
|
||||
set_interface_property irq_1 PORT_NAME_MAP ""
|
||||
set_interface_property irq_1 CMSIS_SVD_VARIABLES ""
|
||||
set_interface_property irq_1 SVD_ADDRESS_GROUP ""
|
||||
|
||||
add_interface_port irq_1 ins_fpm_irq_1 irq Output 1
|
||||
|
||||
#
|
||||
# connection point irq_2
|
||||
#
|
||||
add_interface irq_2 interrupt end
|
||||
set_interface_property irq_2 associatedAddressablePoint ""
|
||||
set_interface_property irq_2 associatedClock clock
|
||||
set_interface_property irq_2 bridgedReceiverOffset ""
|
||||
set_interface_property irq_2 bridgesToReceiver ""
|
||||
set_interface_property irq_2 ENABLED true
|
||||
set_interface_property irq_2 EXPORT_OF ""
|
||||
set_interface_property irq_2 PORT_NAME_MAP ""
|
||||
set_interface_property irq_2 CMSIS_SVD_VARIABLES ""
|
||||
set_interface_property irq_2 SVD_ADDRESS_GROUP ""
|
||||
|
||||
add_interface_port irq_2 ins_fpm_irq_2 irq Output 1
|
||||
|
||||
#
|
||||
# connection point irq_3
|
||||
#
|
||||
add_interface irq_3 interrupt end
|
||||
set_interface_property irq_3 associatedAddressablePoint ""
|
||||
set_interface_property irq_3 associatedClock clock
|
||||
set_interface_property irq_3 bridgedReceiverOffset ""
|
||||
set_interface_property irq_3 bridgesToReceiver ""
|
||||
set_interface_property irq_3 ENABLED true
|
||||
set_interface_property irq_3 EXPORT_OF ""
|
||||
set_interface_property irq_3 PORT_NAME_MAP ""
|
||||
set_interface_property irq_3 CMSIS_SVD_VARIABLES ""
|
||||
set_interface_property irq_3 SVD_ADDRESS_GROUP ""
|
||||
|
||||
add_interface_port irq_3 ins_fpm_irq_3 irq Output 1
|
||||
|
||||
241
generic_ip/fire_pulse_manager/0/doc/fire_pulse_ctrl_0.json
Normal file
241
generic_ip/fire_pulse_manager/0/doc/fire_pulse_ctrl_0.json
Normal file
|
|
@ -0,0 +1,241 @@
|
|||
[{
|
||||
"ip_name": "fire_pulse_ctrl_0",
|
||||
"bus": "csr",
|
||||
"description": "Fire-Pulse Controller",
|
||||
"registers": {
|
||||
"src_sel": {
|
||||
"address": "0",
|
||||
"width": "2",
|
||||
"description": "Controls signal selection",
|
||||
"fields": {
|
||||
"fire_pulse_sel": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "0 => Use External fire pulses, 1 => Use FPM fire pulses"
|
||||
},
|
||||
"enc_pd_emul_en": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "0 => Use POF RX, 1 => Use internal enc/PD emulator"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pof_rx_ctrl": {
|
||||
"address": "1",
|
||||
"width": "8",
|
||||
"description": "Controls POF receiver",
|
||||
"fields": {
|
||||
"pof_rx_enable": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "0 => Disable POF RX, 1 => Enable POF RX"
|
||||
},
|
||||
"uart_regeneration_bypass": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "0 => Use UART Regeneration, 1 => Bypass UART Regeneration"
|
||||
},
|
||||
"clear_max": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "0 => Disabled, 1 => Load the current value of Absolute Position as new maximum"
|
||||
},
|
||||
"clear_min": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "0 => Disabled, 1 => Load the current value of Absolute Position as new miniumum"
|
||||
},
|
||||
"uart_rx_div": {
|
||||
"type": "w",
|
||||
"bit_len": "4",
|
||||
"reset": "0x4",
|
||||
"description": "Defines the number of 200 MHz clock cycles per UART data bit"
|
||||
}
|
||||
}
|
||||
},
|
||||
"monitoring_point_selection": {
|
||||
"address": "2",
|
||||
"width": "16",
|
||||
"description": "Selects monitoring points for external header",
|
||||
"fields": {
|
||||
"mp0": {
|
||||
"type": "w",
|
||||
"bit_len": "4",
|
||||
"reset": "0x0",
|
||||
"description": "Selects first monitoring point"
|
||||
},
|
||||
"mp1": {
|
||||
"type": "w",
|
||||
"bit_len": "4",
|
||||
"reset": "0x0",
|
||||
"description": "Selects second monitoring point"
|
||||
},
|
||||
"mp2": {
|
||||
"type": "w",
|
||||
"bit_len": "4",
|
||||
"reset": "0x0",
|
||||
"description": "Selects third monitoring point"
|
||||
},
|
||||
"mp3": {
|
||||
"type": "w",
|
||||
"bit_len": "4",
|
||||
"reset": "0x0",
|
||||
"description": "Selects fourth monitoring point"
|
||||
}
|
||||
}
|
||||
},
|
||||
"coarse_time_init": {
|
||||
"type": "w",
|
||||
"address": "3",
|
||||
"reset": "0x00000000",
|
||||
"width": "32",
|
||||
"description": "Defines coarse time counter value"
|
||||
},
|
||||
"fine_time_init": {
|
||||
"address": "4",
|
||||
"width": "29",
|
||||
"description": "Fine time counter value/Load counter enable",
|
||||
"fields": {
|
||||
"fine_time_init": {
|
||||
"type" :"w",
|
||||
"bit_len": "28",
|
||||
"reset": "0x0000000",
|
||||
"description": "Defines fine time counter value"
|
||||
},
|
||||
"time_load_en": {
|
||||
"type" :"w",
|
||||
"bit_len" : "1",
|
||||
"reset": "0x0",
|
||||
"description" : "Writting 1 loads the coarse and fine time counters"
|
||||
}
|
||||
}
|
||||
},
|
||||
"fine_time_status": {
|
||||
"type": "r",
|
||||
"address": "5",
|
||||
"reset": "0x0000000",
|
||||
"width": "28",
|
||||
"description": "Current fine time counter value"
|
||||
},
|
||||
"coarse_time_status": {
|
||||
"type": "r",
|
||||
"address": "6",
|
||||
"reset": "0x00000000",
|
||||
"width": "32",
|
||||
"description": "Current coarse time counter value"
|
||||
},
|
||||
"pof_rx_error_status": {
|
||||
"address": "7",
|
||||
"width": "32",
|
||||
"description": "Status of POF receiver",
|
||||
"fields": {
|
||||
"parity_bit_error_count": {
|
||||
"type": "r",
|
||||
"bit_len": "16",
|
||||
"reset": "0x0000",
|
||||
"description": "Counts number of parity errors"
|
||||
},
|
||||
"skipped_position_error_count": {
|
||||
"type": "r",
|
||||
"bit_len": "16",
|
||||
"reset": "0x0000",
|
||||
"description": "Counts position skipped type errors"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pof_rx_error_ctrl": {
|
||||
"address": "8",
|
||||
"width": "12",
|
||||
"description": "POF receiver error control",
|
||||
"fields": {
|
||||
"error_rate_thres": {
|
||||
"type" : "w",
|
||||
"bit_len": "8",
|
||||
"reset": "0x0A",
|
||||
"description": "Defines RX error rate threshold"
|
||||
},
|
||||
"rx_watchdog_en": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x1",
|
||||
"description": "0 => Disable RX watchdog, 1 => Enable RX Watchdog"
|
||||
},
|
||||
"rx_watchdog_clr": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "0 => RX watchdog counter running, 1 => Clear RX watchdog counter"
|
||||
},
|
||||
"rx_watchdog": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "0 => RX watchdog not triggered, 1 => RX watchdog triggered"
|
||||
},
|
||||
"rx_error_flag": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "0 => Error rate below threshold, 1 => Error rate above threshold"
|
||||
}
|
||||
}
|
||||
},
|
||||
"fpm_irq": {
|
||||
"address": "9",
|
||||
"width": "16",
|
||||
"description": "FPM Interrupt control",
|
||||
"fields": {
|
||||
"irq_en": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "0 => Disable IRQ, 1 => Enable IRQ"
|
||||
},
|
||||
"reserved1": {
|
||||
"type": "rsv",
|
||||
"bit_len": "3",
|
||||
"description": "Reserved"
|
||||
},
|
||||
"irq_clr": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "0 => Don't clear pending IRQ, 1 => Clear pending IRQ"
|
||||
},
|
||||
"reserved2": {
|
||||
"type": "rsv",
|
||||
"bit_len": "3",
|
||||
"description": "Reserved"
|
||||
},
|
||||
"irq_mask": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "0 => IRQ not masked, 1 => IRQ masked"
|
||||
},
|
||||
"reserved3": {
|
||||
"type": "rsv",
|
||||
"bit_len": "3",
|
||||
"description": "Reserved"
|
||||
},
|
||||
"irq_status": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "0 => IRQ not active, 1 => IRQ active"
|
||||
},
|
||||
"reserved4": {
|
||||
"type": "rsv",
|
||||
"bit_len": "3",
|
||||
"description": "Reserved"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}]
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
[{
|
||||
"ip_name" : "fire_pulse_manager_0",
|
||||
"bus" : "csr",
|
||||
"addr_hi_bit" : "14",
|
||||
"addr_lo_bit" : "11",
|
||||
"description" : "Single-Channel Fire-Pulse-Manager",
|
||||
"sub_blocks" : {
|
||||
"fire_pulse_ctrl_0" : {
|
||||
"instance" : "",
|
||||
"process" : "enabled",
|
||||
"offset" : "0x0000"
|
||||
},
|
||||
"pulse_generator_1" : {
|
||||
"instance" : "",
|
||||
"process" : "enabled",
|
||||
"offset" : "0x0800"
|
||||
},
|
||||
"smb_diagnostics_0" : {
|
||||
"instance" : "",
|
||||
"process" : "enabled",
|
||||
"offset" : "0x1800"
|
||||
},
|
||||
"enc_pd_emul_1" : {
|
||||
"instance" : "",
|
||||
"process" : "enabled",
|
||||
"offset" : "0x2800"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
468
generic_ip/fire_pulse_manager/0/doc/smb_diagnostics_0.json
Normal file
468
generic_ip/fire_pulse_manager/0/doc/smb_diagnostics_0.json
Normal file
|
|
@ -0,0 +1,468 @@
|
|||
[{
|
||||
"ip_name": "smb_diags",
|
||||
"bus": "csr",
|
||||
"description": "SMB diagnostics",
|
||||
"registers": {
|
||||
"init": {
|
||||
"address": "0",
|
||||
"width": "7",
|
||||
"description": "Diagnostic reset",
|
||||
"fields": {
|
||||
"init": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "initialize the full diagnostic block"
|
||||
},
|
||||
"rst_counters": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "reset only edge counters"
|
||||
},
|
||||
"rst_measur": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "reset only time-based velocity/acceleration measurement registers"
|
||||
},
|
||||
"rst_dir": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "reset only the logic for direction detection"
|
||||
},
|
||||
"rst_enc_fifo": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "reset only the encoder fifo"
|
||||
},
|
||||
"rst_pos": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "reset only the position detection register"
|
||||
},
|
||||
"rst_pd_fifo": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "reset only the PD fifo"
|
||||
}
|
||||
}
|
||||
},
|
||||
"input_status": {
|
||||
"address": "1",
|
||||
"width": "17",
|
||||
"description": "Instantaneous status of input signals",
|
||||
"fields": {
|
||||
"rs422_p1": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "0x00",
|
||||
"description": "RS422 encoder phase-1"
|
||||
},
|
||||
"rs422_p2": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "0x00",
|
||||
"description": "RS422 encoder phase-2"
|
||||
},
|
||||
"rs422_zp": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "0x00",
|
||||
"description": "RS422 encoder zero-phase"
|
||||
},
|
||||
"rs422_pd": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "0x00",
|
||||
"description": "RS422 Product Detect"
|
||||
},
|
||||
"ttl_p1": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "0x00",
|
||||
"description": "TTL encoder phase-1"
|
||||
},
|
||||
"ttl_p2": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "0x00",
|
||||
"description": "TTL encoder phase-2"
|
||||
},
|
||||
"ttl_zp": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "0x00",
|
||||
"description": "TTL encoder zero-phase"
|
||||
},
|
||||
"ttl_pd_pnp": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "0x00",
|
||||
"description": "TTL (PNP) Product Detect"
|
||||
},
|
||||
"ttl_pd_npn": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "0x00",
|
||||
"description": "TTL (NPN) Product Detect"
|
||||
},
|
||||
"filt_p1": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "0x00",
|
||||
"description": "EMS filtered p1"
|
||||
},
|
||||
"filt_p2": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "0x00",
|
||||
"description": "EMS filtered p2"
|
||||
},
|
||||
"filt_zp": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "0x00",
|
||||
"description": "EMS filtered zp"
|
||||
},
|
||||
"filt_pd": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "0x00",
|
||||
"description": "EMS filtered pd"
|
||||
},
|
||||
"enc_pulse": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "0x00",
|
||||
"description": "enc_pulse (after jitter removal)"
|
||||
},
|
||||
"pd_out": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "0x00",
|
||||
"description": "PD output"
|
||||
},
|
||||
"drop_watch_": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "0x00",
|
||||
"description": "drop watch)"
|
||||
},
|
||||
"fire_req": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "0x00",
|
||||
"description": "fire request"
|
||||
}
|
||||
}
|
||||
},
|
||||
"phase1_counter": {
|
||||
"type": "r",
|
||||
"address": "2",
|
||||
"reset": "0x0",
|
||||
"width": "32",
|
||||
"description": "Encoder Phase-1 (filtered) edge counter"
|
||||
},
|
||||
"phase2_counter": {
|
||||
"type": "r",
|
||||
"address": "3",
|
||||
"reset": "0x0",
|
||||
"width": "32",
|
||||
"description": "Encoder Phase-2 (filtered) edge counter"
|
||||
},
|
||||
"zero_phase_counter": {
|
||||
"type": "r",
|
||||
"address": "4",
|
||||
"reset": "0x0",
|
||||
"width": "32",
|
||||
"description": "Encoder Zero-Phase (filtered) edge counter"
|
||||
},
|
||||
"pd_counter": {
|
||||
"type": "r",
|
||||
"address": "5",
|
||||
"reset": "0x0",
|
||||
"width": "32",
|
||||
"description": "PD (filtered) edge counter"
|
||||
},
|
||||
"enc_pulse_counter": {
|
||||
"type": "r",
|
||||
"address": "6",
|
||||
"reset": "0x0",
|
||||
"width": "32",
|
||||
"description": "encoder pulse counter (after jitter removal)"
|
||||
},
|
||||
"pd_output_counter": {
|
||||
"type": "r",
|
||||
"address": "7",
|
||||
"reset": "0x0",
|
||||
"width": "32",
|
||||
"description": "PD output edge counter"
|
||||
},
|
||||
"fire_request_counter": {
|
||||
"type": "r",
|
||||
"address": "8",
|
||||
"reset": "0x0",
|
||||
"width": "32",
|
||||
"description": "Fire-Request counter"
|
||||
},
|
||||
"delta_time_meas": {
|
||||
"type": "r",
|
||||
"address": "12",
|
||||
"reset": "0x0",
|
||||
"width": "32",
|
||||
"description": "Delta-time measurement"
|
||||
},
|
||||
"deltamin_time_meas": {
|
||||
"type": "r",
|
||||
"address": "13",
|
||||
"reset": "0x0",
|
||||
"width": "32",
|
||||
"description": "Delta-time-min measurement"
|
||||
},
|
||||
"deltamax_time_meas": {
|
||||
"type": "r",
|
||||
"address": "14",
|
||||
"reset": "0x0",
|
||||
"width": "32",
|
||||
"description": "Delta-time-max measurement"
|
||||
},
|
||||
"delta_time_prev_meas": {
|
||||
"type": "r",
|
||||
"address": "15",
|
||||
"reset": "0x0",
|
||||
"width": "32",
|
||||
"description": "Previous delta-time measurement"
|
||||
},
|
||||
"delta_time_meas_step": {
|
||||
"type": "w",
|
||||
"address": "16",
|
||||
"reset": "0x0",
|
||||
"width": "16",
|
||||
"description": "Delta-time measurement step"
|
||||
},
|
||||
"abs_pos": {
|
||||
"type": "r",
|
||||
"address": "17",
|
||||
"reset": "0x0",
|
||||
"width": "32",
|
||||
"description": "Detected absolution position (DEPRECATED)"
|
||||
},
|
||||
"dir_thres": {
|
||||
"address": "18",
|
||||
"width": "32",
|
||||
"description": "Direction detection control",
|
||||
"fields": {
|
||||
"pos_dir_thres": {
|
||||
"type": "w",
|
||||
"bit_len": "16",
|
||||
"reset": "0x007F",
|
||||
"description": "threshold for positive direction detection"
|
||||
},
|
||||
"neg_dir_thres": {
|
||||
"type": "w",
|
||||
"bit_len": "16",
|
||||
"reset": "0xFF81",
|
||||
"description": "threshold for negative direction detection"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dir_cnt": {
|
||||
"address": "19",
|
||||
"width": "32",
|
||||
"description": "Direction status",
|
||||
"fields": {
|
||||
"dir_cnt": {
|
||||
"type": "r",
|
||||
"bit_len": "16",
|
||||
"reset": "0x0",
|
||||
"description": "direction count"
|
||||
},
|
||||
"dir_change_cnt": {
|
||||
"type": "r",
|
||||
"bit_len": "16",
|
||||
"reset": "0x0",
|
||||
"description": "direction change count"
|
||||
}
|
||||
}
|
||||
},
|
||||
"enc_sampling_period": {
|
||||
"type": "w",
|
||||
"address": "20",
|
||||
"reset": "0x0",
|
||||
"width": "28",
|
||||
"description": "Encoder sampling period (encoder FIFO)"
|
||||
},
|
||||
"enc_fifo_mng": {
|
||||
"address": "21",
|
||||
"width": "32",
|
||||
"description": "encoder FIFO management",
|
||||
"fields": {
|
||||
"irq_gen_thres": {
|
||||
"type": "w",
|
||||
"bit_len": "10",
|
||||
"reset": "0x0",
|
||||
"description": "FIFO IRQ threshold"
|
||||
},
|
||||
"reserved-0" : {
|
||||
"type" : "rsv",
|
||||
"bit_len" : "6",
|
||||
"description" : "Reserved bits"
|
||||
},
|
||||
"fifo_level": {
|
||||
"type": "r",
|
||||
"bit_len": "10",
|
||||
"reset": "0x0",
|
||||
"description": "fifo level"
|
||||
},
|
||||
"reserved-1" : {
|
||||
"type" : "rsv",
|
||||
"bit_len" : "5",
|
||||
"description" : "Reserved bits"
|
||||
},
|
||||
"fifo_overflow": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "fifo overflow flag"
|
||||
}
|
||||
}
|
||||
},
|
||||
"enc_fifo_output": {
|
||||
"type": "r",
|
||||
"address": "22",
|
||||
"reset": "0x0",
|
||||
"width": "32",
|
||||
"description": "Encoder FIFO output"
|
||||
},
|
||||
"pd_fifo_mng": {
|
||||
"address": "23",
|
||||
"width": "32",
|
||||
"description": "encoder FIFO management",
|
||||
"fields": {
|
||||
"irq_gen_thres": {
|
||||
"type": "w",
|
||||
"bit_len": "10",
|
||||
"reset": "0x0",
|
||||
"description": "FIFO IRQ threshold"
|
||||
},
|
||||
"reserved-0" : {
|
||||
"type" : "rsv",
|
||||
"bit_len" : "6",
|
||||
"description" : "Reserved bits"
|
||||
},
|
||||
"fifo_level": {
|
||||
"type": "r",
|
||||
"bit_len": "10",
|
||||
"reset": "0x0",
|
||||
"description": "fifo level"
|
||||
},
|
||||
"reserved-1" : {
|
||||
"type" : "rsv",
|
||||
"bit_len" : "5",
|
||||
"description" : "Reserved bits"
|
||||
},
|
||||
"fifo_overflow": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "fifo overflow flag"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pd_fifo_output": {
|
||||
"type": "r",
|
||||
"address": "24",
|
||||
"reset": "0x0",
|
||||
"width": "32",
|
||||
"description": "PD FIFO output"
|
||||
},
|
||||
"pd_watchdog_ctrl": {
|
||||
"address": "25",
|
||||
"width": "5",
|
||||
"description": "PD watchdog control",
|
||||
"fields": {
|
||||
"watchdog_en": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "PD watchdog enable"
|
||||
},
|
||||
"watchdog_clr": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "PD watchdog clear"
|
||||
},
|
||||
"reserved" : {
|
||||
"type" : "rsv",
|
||||
"bit_len" : "2",
|
||||
"description" : "Reserved bits"
|
||||
},
|
||||
"watchdog_status": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "watchdog status"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pd_watchdog_thres": {
|
||||
"type": "w",
|
||||
"address": "26",
|
||||
"reset": "0x0",
|
||||
"width": "32",
|
||||
"description": "PD watchdog threshold"
|
||||
},
|
||||
"irq_mng": {
|
||||
"address": "27",
|
||||
"width": "15",
|
||||
"description": "Diagnostic block IRQ management",
|
||||
"fields": {
|
||||
"irq_en": {
|
||||
"type": "w",
|
||||
"bit_len": "3",
|
||||
"reset": "0x0",
|
||||
"description": "IRQ enable"
|
||||
},
|
||||
"reserved-0" : {
|
||||
"type" : "rsv",
|
||||
"bit_len" : "1",
|
||||
"description" : "Reserved bits"
|
||||
},
|
||||
"irq_clr": {
|
||||
"type": "w",
|
||||
"bit_len": "3",
|
||||
"reset": "0x0",
|
||||
"description": "IRQ clear"
|
||||
},
|
||||
"reserved-1" : {
|
||||
"type" : "rsv",
|
||||
"bit_len" : "1",
|
||||
"description" : "Reserved bits"
|
||||
},
|
||||
"irq_mask": {
|
||||
"type": "w",
|
||||
"bit_len": "3",
|
||||
"reset": "0x0",
|
||||
"description": "IRQ mask"
|
||||
},
|
||||
"reserved-2" : {
|
||||
"type" : "rsv",
|
||||
"bit_len" : "1",
|
||||
"description" : "Reserved bits"
|
||||
},
|
||||
"irq_val": {
|
||||
"type": "w",
|
||||
"bit_len": "3",
|
||||
"reset": "0x0",
|
||||
"description": "IRQ value"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}]
|
||||
59
generic_ip/fire_pulse_manager/0/sim/com_fpm.do
Normal file
59
generic_ip/fire_pulse_manager/0/sim/com_fpm.do
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
# Single-Channel FPM compilation macro
|
||||
|
||||
.main clear
|
||||
|
||||
# Cleanup libraries
|
||||
foreach lib [list work OSVVM] {
|
||||
file delete -force -- $lib
|
||||
vlib $lib
|
||||
}
|
||||
|
||||
# Path variables
|
||||
set SRC_PATH ../src
|
||||
set COMMON_PATH ../../../common/0/src
|
||||
set SEQUENCER_PATH ../../../generic_sequencer/15/src
|
||||
set PULSE_GEN_PATH ../../../pulse_generator/1/src
|
||||
set EMUL_PATH ../../../enc_pd_emul/1/src
|
||||
|
||||
set WORKLIB work
|
||||
|
||||
vlib ./work
|
||||
vmap work ./work
|
||||
|
||||
# common
|
||||
vcom -2008 -work $WORKLIB $COMMON_PATH/sync_reset.vhd
|
||||
vcom -2008 -work $WORKLIB $COMMON_PATH/common_pkg.vhd
|
||||
vcom -2008 -work $WORKLIB $COMMON_PATH/sync_wire.vhd
|
||||
vcom -2008 -work $WORKLIB $COMMON_PATH/sync_wire_rEdge.vhd
|
||||
vcom -2008 -work $WORKLIB $COMMON_PATH/altera/sync_fifo.vhd
|
||||
|
||||
# Generic Sequencer
|
||||
vcom -2008 -work $WORKLIB $SEQUENCER_PATH/dpram_sclk_15.vhd
|
||||
vcom -2008 -work $WORKLIB $SEQUENCER_PATH/generic_sequencer_15_pkg.vhd
|
||||
vcom -2008 -work $WORKLIB $SEQUENCER_PATH/generic_sequencer_15.vhd
|
||||
|
||||
# Pulse Generator
|
||||
vcom -2008 -work $WORKLIB $PULSE_GEN_PATH/altera/sync_fifo_1.vhd
|
||||
vcom -2008 -work $WORKLIB $PULSE_GEN_PATH/queue_and_delay_1.vhd
|
||||
vcom -2008 -work $WORKLIB $PULSE_GEN_PATH/pulse_conditioning_1.vhd
|
||||
vcom -2008 -work $WORKLIB $PULSE_GEN_PATH/simple_frac_div_1.vhd
|
||||
vcom -2008 -work $WORKLIB $PULSE_GEN_PATH/pulse_generator_1_pkg.vhd
|
||||
vcom -2008 -work $WORKLIB $PULSE_GEN_PATH/pulse_generator_1.vhd
|
||||
|
||||
# Emulator
|
||||
vcom -2008 -work $WORKLIB $EMUL_PATH/enc_pd_emul_1_pkg.vhd
|
||||
vcom -2008 -work $WORKLIB $EMUL_PATH/enc_pd_emul_1.vhd
|
||||
|
||||
# Fire-Pulse-Manager
|
||||
vcom -2008 -work $WORKLIB $COMMON_PATH/cs_bus_itf.vhd
|
||||
vcom -2008 -work $WORKLIB $COMMON_PATH/uart_rx.vhd
|
||||
vcom -2008 -work $WORKLIB $SRC_PATH/pof_rx_0.vhd
|
||||
vcom -2008 -work $WORKLIB $SRC_PATH/smb_diagnostics_0.vhd
|
||||
vcom -2008 -work $WORKLIB $SRC_PATH/fire_pulse_0_pkg.vhd
|
||||
vcom -2008 -work $WORKLIB $SRC_PATH/uart_regen_0.vhd
|
||||
vcom -2008 -work $WORKLIB $SRC_PATH/fire_pulse_ctrl_0.vhd
|
||||
vcom -2008 -work $WORKLIB $SRC_PATH/fire_pulse_manager_0.vhd
|
||||
|
||||
|
||||
|
||||
|
||||
37
generic_ip/fire_pulse_manager/0/src/fire_pulse_0_pkg.vhd
Normal file
37
generic_ip/fire_pulse_manager/0/src/fire_pulse_0_pkg.vhd
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
-------------------------------------------------------------------------------
|
||||
-- Title : fire_pulse_0_pkg
|
||||
-- Project : HMB/EMB/SMB
|
||||
-------------------------------------------------------------------------------
|
||||
-- File : fire_pulse_0_pkg.vhd
|
||||
-- Author : Gianmarco Girau
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2017-09-08
|
||||
-- Last update: 2019-01-03
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'08
|
||||
-------------------------------------------------------------------------------
|
||||
-- Description:
|
||||
-- Package for fire_pulse_manager block
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
package fire_pulse_0_pkg is
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Inner block mapping
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
constant blk_num : integer := 6; -- number of sub-blocks with dedicated
|
||||
-- C&S registers
|
||||
|
||||
constant fp_ctrl_id : natural := 0; -- Block ID for the Fire-Pulse-Mang Controller
|
||||
constant pg_ch_id : natural := 1; -- Block ID for Pulse-Generator
|
||||
constant net_snk_id : natural := 2; -- Block ID for Net-Sync Sink
|
||||
constant diag_blk_id : natural := 3; -- Block ID for the Diagnostic Block
|
||||
constant log_blk_id : natural := 4; -- Block ID for the Event Logger
|
||||
constant int_enc_id : natural := 5; -- Block ID for the Internal Encoder Block
|
||||
|
||||
end package fire_pulse_0_pkg;
|
||||
253
generic_ip/fire_pulse_manager/0/src/fire_pulse_ctrl_0.vhd
Normal file
253
generic_ip/fire_pulse_manager/0/src/fire_pulse_ctrl_0.vhd
Normal file
|
|
@ -0,0 +1,253 @@
|
|||
-------------------------------------------------------------------------------
|
||||
-- Title : fire_pulse_ctrl_0
|
||||
-- Project : HMB/EMB/SMB
|
||||
-------------------------------------------------------------------------------
|
||||
-- File : fire_pulse_ctrl_0.vhd
|
||||
-- Author : Gianmarco Girau
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2017-09-06
|
||||
-- Last update: 2019-01-03
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'08
|
||||
-------------------------------------------------------------------------------
|
||||
-- Description:
|
||||
-- Control service logic for the Fire-Controller-Manager
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
entity fire_pulse_ctrl_0 is
|
||||
port(
|
||||
reset_n : in std_logic;
|
||||
clk : in std_logic;
|
||||
src_sel : out std_logic_vector( 1 downto 0);
|
||||
uart_regen_bypass : out std_logic;
|
||||
upd_max_pos : out std_logic;
|
||||
upd_min_pos : out std_logic;
|
||||
enable_rx : out std_logic;
|
||||
uart_bit_div : out std_logic_vector( 3 downto 0);
|
||||
error_rate_thres : out std_logic_vector( 7 downto 0);
|
||||
max_error_flag : in std_logic;
|
||||
rx_watchdog : in std_logic;
|
||||
rx_watchdog_en : out std_logic;
|
||||
rx_watchdog_clr : out std_logic;
|
||||
parity_err_cnt : in std_logic_vector(15 downto 0);
|
||||
skip_pos_cnt : in std_logic_vector(15 downto 0);
|
||||
mon_point_src : in std_logic_vector(15 downto 0);
|
||||
mon_points : out std_logic_vector( 3 downto 0);
|
||||
coarse_time : out std_logic_vector(31 downto 0);
|
||||
fine_time : out std_logic_vector(27 downto 0);
|
||||
one_pps : out std_logic;
|
||||
-- Interrupt Senders
|
||||
ins_fpm_irq_0 : out std_logic;
|
||||
-- Avalon MM Interface
|
||||
avs_address : in std_logic_vector( 3 downto 0);
|
||||
avs_write : in std_logic;
|
||||
avs_writedata : in std_logic_vector(31 downto 0);
|
||||
avs_read : in std_logic;
|
||||
avs_readdatavalid : out std_logic;
|
||||
avs_readdata : out std_logic_vector(31 downto 0));
|
||||
end entity fire_pulse_ctrl_0;
|
||||
|
||||
architecture rtl of fire_pulse_ctrl_0 is
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Control & Status Registers Map
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
constant SRC_SEL_REG : std_logic_vector( 3 downto 0) := b"0000";
|
||||
constant POF_RX_CTRL : std_logic_vector( 3 downto 0) := b"0001";
|
||||
constant MON_PT_CTRL_REG : std_logic_vector( 3 downto 0) := b"0010";
|
||||
constant COARSE_TIME_INIT_REG : std_logic_vector( 3 downto 0) := b"0011";
|
||||
constant FINE_TIME_INIT_REG : std_logic_vector( 3 downto 0) := b"0100";
|
||||
constant FINE_TIME_REG : std_logic_vector( 3 downto 0) := b"0101";
|
||||
constant COARSE_TIME_REG : std_logic_vector( 3 downto 0) := b"0110";
|
||||
constant RX_ERROR_STATUS : std_logic_vector( 3 downto 0) := b"0111";
|
||||
constant RX_ERROR_CSR : std_logic_vector( 3 downto 0) := b"1000";
|
||||
constant IRQ_MNG_REG : std_logic_vector( 3 downto 0) := b"1001";
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Constants, Signals
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
constant FINE_TIME_TC : integer := 100000000-1; -- clk must be 100MHz to
|
||||
-- make it right
|
||||
|
||||
signal enable_rx_i : std_logic;
|
||||
signal fine_time_wrap, time_ld_en : std_logic;
|
||||
signal rx_watchdog_en_i, rx_watchdog_clr_i : std_logic;
|
||||
signal uart_regen_bypass_i : std_logic;
|
||||
signal upd_min_pos_i, upd_max_pos_i : std_logic;
|
||||
signal irq, irq_src, irq_src_d : std_logic_vector( 0 downto 0);
|
||||
signal irq_en, irq_mask, irq_val, irq_clr : std_logic_vector( 0 downto 0);
|
||||
signal src_sel_i : std_logic_vector( 1 downto 0);
|
||||
signal mp_sel0, mp_sel1, mp_sel2, mp_sel3 : std_logic_vector( 3 downto 0);
|
||||
signal bit_div : std_logic_vector( 3 downto 0);
|
||||
signal error_rate_thres_i : std_logic_vector( 7 downto 0);
|
||||
signal fine_time_init, fine_time_i : std_logic_vector(27 downto 0);
|
||||
signal coarse_time_init, coarse_time_i : std_logic_vector(31 downto 0);
|
||||
|
||||
begin
|
||||
|
||||
pCTRL_REGs : process(reset_n, clk)
|
||||
begin -- process
|
||||
if(reset_n = '0') then
|
||||
fine_time_i <= (others => '0');
|
||||
coarse_time_i <= (others => '0');
|
||||
elsif(clk = '1' and clk'event) then
|
||||
if(time_ld_en = '1') then
|
||||
fine_time_i <= fine_time_init;
|
||||
elsif(fine_time_wrap = '1') then
|
||||
fine_time_i <= (others => '0');
|
||||
else
|
||||
fine_time_i <= std_logic_vector(unsigned(fine_time_i)+1);
|
||||
end if;
|
||||
if(time_ld_en = '1') then
|
||||
coarse_time_i <= coarse_time_init;
|
||||
elsif(fine_time_wrap = '1') then
|
||||
coarse_time_i <= std_logic_vector(unsigned(coarse_time_i)+1);
|
||||
end if;
|
||||
one_pps <= fine_time_wrap;
|
||||
end if;
|
||||
end process pCTRL_REGs;
|
||||
|
||||
fine_time_wrap <= '1' when unsigned(fine_time_i) = FINE_TIME_TC else '0';
|
||||
|
||||
coarse_time <= coarse_time_i;
|
||||
fine_time <= fine_time_i;
|
||||
|
||||
-- MOnitoring Point selection
|
||||
mon_points(0) <= mon_point_src(to_integer(unsigned(mp_sel0)));
|
||||
mon_points(1) <= mon_point_src(to_integer(unsigned(mp_sel1)));
|
||||
mon_points(2) <= mon_point_src(to_integer(unsigned(mp_sel2)));
|
||||
mon_points(3) <= mon_point_src(to_integer(unsigned(mp_sel3)));
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- IRQ generation and management
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
pIRQ : process(reset_n, clk)
|
||||
begin
|
||||
if(reset_n = '0') then
|
||||
ins_fpm_irq_0 <= '0';
|
||||
irq <= "0";
|
||||
irq_src_d <= "0";
|
||||
elsif(clk = '1' and clk'event) then
|
||||
irq_src_d <= irq_src;
|
||||
for n in 0 to irq'left loop
|
||||
if(irq_clr(n) = '1') then
|
||||
irq(n) <= '0';
|
||||
elsif(irq_en(n) = '1' and irq_src(n) = '1' and irq_src_d(n) = '0') then
|
||||
irq(n) <= '1';
|
||||
end if;
|
||||
end loop; -- n
|
||||
ins_fpm_irq_0 <= irq_val(0);
|
||||
end if;
|
||||
end process pIRQ;
|
||||
|
||||
irq_val <= irq and not irq_mask;
|
||||
irq_src <= "1" when max_error_flag = '1' or rx_watchdog = '1' else "0";
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- C&S registers
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
src_sel <= src_sel_i;
|
||||
enable_rx <= enable_rx_i;
|
||||
uart_regen_bypass <= uart_regen_bypass_i;
|
||||
|
||||
uart_bit_div <= bit_div;
|
||||
upd_max_pos <= upd_max_pos_i;
|
||||
upd_min_pos <= upd_min_pos_i;
|
||||
|
||||
error_rate_thres <= error_rate_thres_i;
|
||||
rx_watchdog_en <= rx_watchdog_en_i;
|
||||
rx_watchdog_clr <= rx_watchdog_clr_i;
|
||||
|
||||
pCTRL_STATUS : process(reset_n, clk)
|
||||
begin
|
||||
if(reset_n = '0') then
|
||||
avs_readdatavalid <= '0';
|
||||
src_sel_i <= "00";
|
||||
enable_rx_i <= '0';
|
||||
uart_regen_bypass_i <= '0';
|
||||
upd_max_pos_i <= '0';
|
||||
upd_min_pos_i <= '0';
|
||||
bit_div <= "0100";
|
||||
error_rate_thres_i <= X"0A";
|
||||
rx_watchdog_en_i <= '1';
|
||||
rx_watchdog_clr_i <= '0';
|
||||
mp_sel0 <= X"0";
|
||||
mp_sel1 <= X"0";
|
||||
mp_sel2 <= X"0";
|
||||
mp_sel3 <= X"0";
|
||||
coarse_time_init <= (others => '0');
|
||||
fine_time_init <= (others => '0');
|
||||
time_ld_en <= '0';
|
||||
elsif(clk = '1' and clk'event) then
|
||||
-- CTRL registers
|
||||
if(avs_write = '1') then
|
||||
case avs_address is
|
||||
when SRC_SEL_REG =>
|
||||
src_sel_i <= avs_writedata( 1 downto 0);
|
||||
when POF_RX_CTRL =>
|
||||
enable_rx_i <= avs_writedata(0);
|
||||
uart_regen_bypass_i <= avs_writedata(1);
|
||||
upd_max_pos_i <= avs_writedata(2);
|
||||
upd_min_pos_i <= avs_writedata(3);
|
||||
bit_div <= avs_writedata( 7 downto 4);
|
||||
when MON_PT_CTRL_REG =>
|
||||
mp_sel0 <= avs_writedata( 3 downto 0);
|
||||
mp_sel1 <= avs_writedata( 7 downto 4);
|
||||
mp_sel2 <= avs_writedata(11 downto 8);
|
||||
mp_sel3 <= avs_writedata(15 downto 12);
|
||||
when COARSE_TIME_INIT_REG =>
|
||||
coarse_time_init <= avs_writedata;
|
||||
when FINE_TIME_INIT_REG =>
|
||||
time_ld_en <= avs_writedata(28);
|
||||
fine_time_init <= avs_writedata(27 downto 0);
|
||||
when RX_ERROR_CSR =>
|
||||
error_rate_thres_i <= avs_writedata( 7 downto 0);
|
||||
rx_watchdog_en_i <= avs_writedata(8);
|
||||
rx_watchdog_clr_i <= avs_writedata(9);
|
||||
when IRQ_MNG_REG =>
|
||||
irq_en <= avs_writedata( 0 downto 0);
|
||||
irq_clr <= avs_writedata( 4 downto 4);
|
||||
irq_mask <= avs_writedata( 8 downto 8);
|
||||
when others => null;
|
||||
end case;
|
||||
end if;
|
||||
-- Read Ctrl & Status registers
|
||||
avs_readdatavalid <= avs_read;
|
||||
if(avs_read = '1') then
|
||||
case avs_address is
|
||||
when SRC_SEL_REG =>
|
||||
avs_readdata <= (0 => src_sel_i(0), 1 => src_sel_i(1), others => '0');
|
||||
when POF_RX_CTRL =>
|
||||
avs_readdata <= X"000000" & bit_div & upd_min_pos_i & upd_max_pos_i & uart_regen_bypass_i & enable_rx_i;
|
||||
when MON_PT_CTRL_REG =>
|
||||
avs_readdata <= X"0000" & mp_sel3 & mp_sel2 & mp_sel1 & mp_sel0;
|
||||
when COARSE_TIME_INIT_REG =>
|
||||
avs_readdata <= coarse_time_init;
|
||||
when FINE_TIME_INIT_REG =>
|
||||
avs_readdata <= b"000" & time_ld_en & fine_time_init;
|
||||
when RX_ERROR_STATUS =>
|
||||
avs_readdata <= skip_pos_cnt & parity_err_cnt;
|
||||
when FINE_TIME_REG =>
|
||||
avs_readdata <= X"0" & fine_time_i;
|
||||
when COARSE_TIME_REG =>
|
||||
avs_readdata <= coarse_time_i;
|
||||
when RX_ERROR_CSR =>
|
||||
avs_readdata <= X"00000" & max_error_flag & rx_watchdog & rx_watchdog_clr_i & rx_watchdog_en_i & error_rate_thres_i;
|
||||
when IRQ_MNG_REG =>
|
||||
avs_readdata <= X"0000" & "000" & irq_val & "000" & irq_mask & "000" & irq_clr & "000" & irq_en;
|
||||
when others =>
|
||||
avs_readdata <= X"BAD1BAD0";
|
||||
end case;
|
||||
end if;
|
||||
end if;
|
||||
end process pCTRL_STATUS;
|
||||
|
||||
end architecture rtl;
|
||||
438
generic_ip/fire_pulse_manager/0/src/fire_pulse_manager_0.vhd
Normal file
438
generic_ip/fire_pulse_manager/0/src/fire_pulse_manager_0.vhd
Normal file
|
|
@ -0,0 +1,438 @@
|
|||
-------------------------------------------------------------------------------
|
||||
-- Title : fire_pulse_manager_0
|
||||
-- Project : HMB/EMB/SMB
|
||||
-------------------------------------------------------------------------------
|
||||
-- File : fire_pulse_manager_0.vhd
|
||||
-- Author : Gianmarco Girau
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2017-09-06
|
||||
-- Last update: 2019-01-23
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'08
|
||||
-------------------------------------------------------------------------------
|
||||
-- Description:
|
||||
-- Generates fire request from the EMS output data, transferred either via POF
|
||||
-- or through NetSync
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
library work;
|
||||
use work.fire_pulse_0_pkg.all;
|
||||
|
||||
entity fire_pulse_manager_0 is
|
||||
port(
|
||||
reset_n : in std_logic;
|
||||
clk : in std_logic; -- 100MHz
|
||||
rx_clk : in std_logic; -- 200MHz
|
||||
-- Datapath I/Os
|
||||
pof_rx : in std_logic;
|
||||
pof_tx : out std_logic;
|
||||
pof_iso_en : out std_logic;
|
||||
fire_pulse : out std_logic;
|
||||
mon_pt : out std_logic_vector(3 downto 0); -- Monitoring Points
|
||||
-- on header J7
|
||||
-- Interrupt Senders
|
||||
ins_fpm_irq_0 : out std_logic;
|
||||
ins_fpm_irq_1 : out std_logic;
|
||||
ins_fpm_irq_2 : out std_logic;
|
||||
ins_fpm_irq_3 : out std_logic;
|
||||
-- Avalon MM (Slave) Interface
|
||||
avs_address : in std_logic_vector(14 downto 0);
|
||||
avs_write : in std_logic;
|
||||
avs_writedata : in std_logic_vector(31 downto 0);
|
||||
avs_read : in std_logic;
|
||||
avs_readdatavalid : out std_logic;
|
||||
avs_readdata : out std_logic_vector(31 downto 0));
|
||||
end entity fire_pulse_manager_0;
|
||||
|
||||
architecture rtl of fire_pulse_manager_0 is
|
||||
|
||||
constant PD_QUEUE_SIZE : natural := 512;
|
||||
|
||||
signal reset_n_i : std_logic;
|
||||
--
|
||||
signal cs_addr : std_logic_vector(10 downto 0);
|
||||
signal cs_write_en : std_logic_vector(blk_num - 1 downto 0);
|
||||
signal cs_write_data : std_logic_vector(31 downto 0);
|
||||
signal cs_read_en : std_logic_vector(blk_num - 1 downto 0);
|
||||
signal cs_read_valid : std_logic_vector(blk_num - 1 downto 0);
|
||||
signal cs_read_data : std_logic_vector(32*blk_num - 1 downto 0);
|
||||
--
|
||||
signal cs_ctrl_write_en : std_logic;
|
||||
signal cs_ctrl_read_en : std_logic;
|
||||
signal cs_ctrl_read_valid : std_logic;
|
||||
signal cs_ctrl_read_data : std_logic_vector(31 downto 0);
|
||||
--
|
||||
signal cs_pg_write_en : std_logic;
|
||||
signal cs_pg_read_en : std_logic;
|
||||
signal cs_pg_read_valid : std_logic;
|
||||
signal cs_pg_read_data : std_logic_vector(31 downto 0);
|
||||
--
|
||||
signal cs_nsnk_write_en : std_logic;
|
||||
signal cs_nsnk_read_en : std_logic;
|
||||
signal cs_nsnk_read_valid : std_logic;
|
||||
signal cs_nsnk_read_data : std_logic_vector(31 downto 0);
|
||||
--
|
||||
signal cs_diag_write_en : std_logic;
|
||||
signal cs_diag_read_en : std_logic;
|
||||
signal cs_diag_read_valid : std_logic;
|
||||
signal cs_diag_read_data : std_logic_vector(31 downto 0);
|
||||
--
|
||||
signal cs_log_write_en : std_logic;
|
||||
signal cs_log_read_en : std_logic;
|
||||
signal cs_log_read_valid : std_logic;
|
||||
signal cs_log_read_data : std_logic_vector(31 downto 0);
|
||||
--
|
||||
signal cs_ie_write_en : std_logic;
|
||||
signal cs_ie_read_en : std_logic;
|
||||
signal cs_ie_read_valid : std_logic;
|
||||
signal cs_ie_read_data : std_logic_vector(31 downto 0);
|
||||
--
|
||||
signal enable_rx : std_logic;
|
||||
signal uart_regen_bypass : std_logic;
|
||||
signal upd_max_pos : std_logic;
|
||||
signal upd_min_pos : std_logic;
|
||||
signal max_error_flag : std_logic;
|
||||
signal rx_watchdog : std_logic;
|
||||
signal rx_watchdog_en : std_logic;
|
||||
signal rx_watchdog_clr : std_logic;
|
||||
signal bit_div : std_logic_vector( 3 downto 0);
|
||||
signal error_rate_thres : std_logic_vector( 7 downto 0);
|
||||
signal parity_err_cnt : std_logic_vector(15 downto 0);
|
||||
signal skip_pos_cnt : std_logic_vector(15 downto 0);
|
||||
signal mon_point_src : std_logic_vector(15 downto 0);
|
||||
signal fine_time : std_logic_vector(27 downto 0);
|
||||
signal coarse_time : std_logic_vector(31 downto 0);
|
||||
--
|
||||
signal init, remote_init : std_logic;
|
||||
signal dp_dir : std_logic;
|
||||
signal enc_pulse : std_logic;
|
||||
signal enc_pulse_pof : std_logic;
|
||||
signal enc_pulse_ie : std_logic;
|
||||
signal pd_pulse_pof : std_logic;
|
||||
signal pd_pulse_ie : std_logic;
|
||||
signal pd_pulse : std_logic;
|
||||
signal set_pos_ie : std_logic;
|
||||
signal inc_pos_ie : std_logic;
|
||||
signal dec_pos_ie : std_logic;
|
||||
signal inc_pos_pof : std_logic;
|
||||
signal dec_pos_pof : std_logic;
|
||||
signal inc_pos : std_logic;
|
||||
signal dec_pos : std_logic;
|
||||
signal abs_pos_pof : std_logic_vector(31 downto 0);
|
||||
signal abs_pos_ie : std_logic_vector(39 downto 0);
|
||||
signal abs_pos : std_logic_vector(31 downto 0);
|
||||
--
|
||||
signal filtered_pd : std_logic;
|
||||
signal ch_pd, ch_pulse_out : std_logic;
|
||||
signal ch_raw_pulse, ch_mask : std_logic;
|
||||
signal fire_pulse_i : std_logic;
|
||||
signal fire_req : std_logic;
|
||||
signal src_sel : std_logic_vector( 1 downto 0);
|
||||
--
|
||||
signal one_pps : std_logic;
|
||||
|
||||
begin
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Synchronize the input reset (h2f_reset) to the clock (from PLL)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
iSyncReset : entity work.sync_reset
|
||||
port map(
|
||||
async_rstN => reset_n,
|
||||
clk => clk,
|
||||
sync_rstN => reset_n_i);
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- C&S Register Interface Splitting
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
iCS_BUS_ITF : entity work.cs_bus_ift
|
||||
generic map(
|
||||
blk_num => blk_num)
|
||||
port map(
|
||||
rstN => reset_n_i,
|
||||
clk => clk,
|
||||
avs_address => avs_address(14 downto 0),
|
||||
avs_write => avs_write,
|
||||
avs_writedata => avs_writedata,
|
||||
avs_read => avs_read,
|
||||
avs_readdatavalid => avs_readdatavalid,
|
||||
avs_readdata => avs_readdata,
|
||||
cs_addr => cs_addr,
|
||||
cs_we => cs_write_en,
|
||||
cs_wr_data => cs_write_data,
|
||||
cs_re => cs_read_en,
|
||||
cs_rv => cs_read_valid,
|
||||
cs_rd_data => cs_read_data);
|
||||
|
||||
cs_ctrl_write_en <= cs_write_en(fp_ctrl_id);
|
||||
cs_pg_write_en <= cs_write_en(pg_ch_id);
|
||||
cs_nsnk_write_en <= cs_write_en(net_snk_id);
|
||||
cs_diag_write_en <= cs_write_en(diag_blk_id);
|
||||
cs_log_write_en <= cs_write_en(log_blk_id);
|
||||
cs_ie_write_en <= cs_write_en(int_enc_id);
|
||||
|
||||
cs_ctrl_read_en <= cs_read_en(fp_ctrl_id);
|
||||
cs_pg_read_en <= cs_read_en(pg_ch_id);
|
||||
cs_nsnk_read_en <= cs_read_en(net_snk_id);
|
||||
cs_diag_read_en <= cs_read_en(diag_blk_id);
|
||||
cs_log_read_en <= cs_read_en(log_blk_id);
|
||||
cs_ie_read_en <= cs_read_en(int_enc_id);
|
||||
|
||||
cs_read_valid(fp_ctrl_id) <= cs_ctrl_read_valid;
|
||||
cs_read_valid(pg_ch_id) <= cs_pg_read_valid;
|
||||
cs_read_valid(net_snk_id) <= cs_nsnk_read_valid;
|
||||
cs_read_valid(diag_blk_id) <= cs_diag_read_valid;
|
||||
cs_read_valid(log_blk_id) <= cs_log_read_valid;
|
||||
cs_read_valid(int_enc_id) <= cs_ie_read_valid;
|
||||
|
||||
cs_read_data(31+32*fp_ctrl_id downto 32*fp_ctrl_id) <= cs_ctrl_read_data;
|
||||
cs_read_data(31+32*pg_ch_id downto 32*pg_ch_id) <= cs_pg_read_data;
|
||||
cs_read_data(31+32*net_snk_id downto 32*net_snk_id) <= cs_nsnk_read_data;
|
||||
cs_read_data(31+32*diag_blk_id downto 32*diag_blk_id) <= cs_diag_read_data;
|
||||
cs_read_data(31+32*log_blk_id downto 32*log_blk_id) <= cs_log_read_data;
|
||||
cs_read_data(31+32*int_enc_id downto 32*int_enc_id) <= cs_ie_read_data;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Fire-Pulse-Manager Controller
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
iCTRL : entity work.fire_pulse_ctrl_0
|
||||
port map(
|
||||
reset_n => reset_n_i,
|
||||
clk => clk,
|
||||
src_sel => src_sel,
|
||||
uart_regen_bypass => uart_regen_bypass,
|
||||
upd_max_pos => upd_max_pos,
|
||||
upd_min_pos => upd_min_pos,
|
||||
enable_rx => enable_rx,
|
||||
uart_bit_div => bit_div,
|
||||
error_rate_thres => error_rate_thres,
|
||||
max_error_flag => max_error_flag,
|
||||
rx_watchdog => rx_watchdog,
|
||||
rx_watchdog_en => rx_watchdog_en,
|
||||
rx_watchdog_clr => rx_watchdog_clr,
|
||||
parity_err_cnt => parity_err_cnt,
|
||||
skip_pos_cnt => skip_pos_cnt,
|
||||
mon_point_src => mon_point_src,
|
||||
mon_points => mon_pt,
|
||||
coarse_time => coarse_time,
|
||||
fine_time => fine_time,
|
||||
one_pps => one_pps,
|
||||
ins_fpm_irq_0 => ins_fpm_irq_0,
|
||||
avs_address => cs_addr(3 downto 0),
|
||||
avs_write => cs_ctrl_write_en,
|
||||
avs_writedata => cs_write_data,
|
||||
avs_read => cs_ctrl_read_en,
|
||||
avs_readdatavalid => cs_ctrl_read_valid,
|
||||
avs_readdata => cs_ctrl_read_data);
|
||||
|
||||
-- Output multiplexer
|
||||
fire_pulse_i <= ch_pulse_out when src_sel(0) = '1' else pof_rx;
|
||||
fire_pulse <= fire_pulse_i;
|
||||
|
||||
pd_pulse <= pd_pulse_pof when src_sel(1) = '0' else pd_pulse_ie;
|
||||
enc_pulse <= enc_pulse_pof when src_sel(1) = '0' else enc_pulse_ie;
|
||||
abs_pos <= abs_pos_pof when src_sel(1) = '0' else abs_pos_ie(31 downto 0);
|
||||
inc_pos <= inc_pos_pof when src_sel(1) = '0' else inc_pos_ie;
|
||||
dec_pos <= dec_pos_pof when src_sel(1) = '0' else dec_pos_ie;
|
||||
|
||||
pINIT_GEN : process(clk)
|
||||
begin
|
||||
if(clk = '1' and clk'Event) then
|
||||
if(src_sel(1) = '0') then
|
||||
init <= not enable_rx or remote_init;
|
||||
else
|
||||
init <= set_pos_ie;
|
||||
end if;
|
||||
end if;
|
||||
end process pINIT_GEN;
|
||||
|
||||
mon_point_src(0) <= init;
|
||||
mon_point_src(1) <= dp_dir;
|
||||
mon_point_src(2) <= pd_pulse;
|
||||
mon_point_src(3) <= enc_pulse;
|
||||
mon_point_src(4) <= ch_pd;
|
||||
mon_point_src(5) <= ch_pulse_out;
|
||||
mon_point_src(6) <= ch_raw_pulse;
|
||||
mon_point_src(7) <= ch_mask;
|
||||
mon_point_src(8) <= pof_rx;
|
||||
mon_point_src(9) <= fire_pulse_i;
|
||||
mon_point_src(10) <= inc_pos;
|
||||
mon_point_src(11) <= dec_pos;
|
||||
--
|
||||
mon_point_src(15 downto 12) <= (others => '0');
|
||||
|
||||
pof_iso_en <= enable_rx;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Pulse Generator
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
iCH_PG : entity work.pulse_generator_1
|
||||
generic map(
|
||||
pd_queue_size => PD_QUEUE_SIZE,
|
||||
out_pulse_condition => true)
|
||||
port map(
|
||||
clk => clk,
|
||||
reset_n => reset_n_i,
|
||||
init => init,
|
||||
pd_in => pd_pulse,
|
||||
abs_position => abs_pos,
|
||||
dp_dir => dp_dir,
|
||||
pulse_out => ch_pulse_out,
|
||||
filtered_pd => filtered_pd,
|
||||
ch_pd => ch_pd,
|
||||
ch_mask => ch_mask,
|
||||
raw_pulse_out => ch_raw_pulse,
|
||||
enc_pulse => open,
|
||||
avs_address => cs_addr(9 downto 0),
|
||||
avs_write => cs_pg_write_en,
|
||||
avs_writedata => cs_write_data,
|
||||
avs_read => cs_pg_read_en,
|
||||
avs_readdatavalid => cs_pg_read_valid,
|
||||
avs_readdata => cs_pg_read_data);
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- POF Interface
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
-- POF Receiver
|
||||
iPOF_RX : entity work.pof_rx_0
|
||||
port map(
|
||||
reset_n => reset_n_i,
|
||||
clk => clk,
|
||||
init => '0',
|
||||
rx_clk => rx_clk,
|
||||
rx_data => pof_rx,
|
||||
init_out => remote_init,
|
||||
dp_dir => dp_dir,
|
||||
enc_out => enc_pulse_pof,
|
||||
pd_out => pd_pulse_pof,
|
||||
inc_pos => inc_pos_pof,
|
||||
dec_pos => dec_pos_pof,
|
||||
abs_pos => abs_pos_pof,
|
||||
enable => enable_rx,
|
||||
bit_div => bit_div,
|
||||
error_rate_thres => error_rate_thres,
|
||||
one_pps => one_pps,
|
||||
upd_max_pos => upd_max_pos,
|
||||
upd_min_pos => upd_min_pos,
|
||||
max_error_flag => max_error_flag,
|
||||
rx_watchdog => rx_watchdog,
|
||||
rx_watchdog_en => rx_watchdog_en,
|
||||
rx_watchdog_clr => rx_watchdog_clr,
|
||||
parity_err_cnt => parity_err_cnt,
|
||||
skip_pos_cnt => skip_pos_cnt);
|
||||
|
||||
-- UART signal regeneration
|
||||
iUART_REGEN : entity work.uart_regen_0
|
||||
generic map(
|
||||
data_width => 8)
|
||||
port map(
|
||||
reset_n => reset_n,
|
||||
clk => rx_clk,
|
||||
bit_div => bit_div,
|
||||
enable => enable_rx,
|
||||
bypass_en => uart_regen_bypass,
|
||||
uart_rx => pof_rx,
|
||||
uart_tx => pof_tx);
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Diagnostic block
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
iDiagnostic : entity work.smb_diagnostics_0
|
||||
port map(
|
||||
clk => clk,
|
||||
reset_n => reset_n_i,
|
||||
ext_diag_rst => init,
|
||||
rs422_phase0 => '0',
|
||||
rs422_phase1 => '0',
|
||||
rs422_zero_ph => '0',
|
||||
rs422_prod_det => '0',
|
||||
ttl_phase0 => '0',
|
||||
ttl_phase1 => '0',
|
||||
ttl_zero_ph => '0',
|
||||
ttl_prod_det => '0',
|
||||
ttl_prod_det_npn => '0',
|
||||
filt_phase0 => '0',
|
||||
filt_phase1 => '0',
|
||||
filt_zero_ph => '0',
|
||||
filt_prod_det => pd_pulse,
|
||||
--filt_prod_det => filtered_pd,
|
||||
enc_out => enc_pulse,
|
||||
pd_out => ch_pd,
|
||||
pos_step => inc_pos,
|
||||
neg_step => dec_pos,
|
||||
drop_watch => '0',
|
||||
fire_req => fire_req,
|
||||
fine_time => fine_time,
|
||||
coarse_time => coarse_time,
|
||||
abs_position => open,
|
||||
ins_diag_irq_0 => ins_fpm_irq_1,
|
||||
ins_diag_irq_1 => ins_fpm_irq_2,
|
||||
ins_diag_irq_2 => ins_fpm_irq_3,
|
||||
avs_address => cs_addr(5 downto 0),
|
||||
avs_write => cs_diag_write_en,
|
||||
avs_writedata => cs_write_data,
|
||||
avs_read => cs_diag_read_en,
|
||||
avs_readdatavalid => cs_diag_read_valid,
|
||||
avs_readdata => cs_diag_read_data);
|
||||
|
||||
fire_req <= ch_pulse_out;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Internal encoder generator
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
iEMUL: entity work.enc_pd_emul_1
|
||||
generic map (
|
||||
SEQ_ENABLE => false)
|
||||
port map (
|
||||
clk => clk,
|
||||
reset_n => reset_n_i,
|
||||
ttl_pd => open,
|
||||
ttl_enc_p1 => open,
|
||||
ttl_enc_p2 => open,
|
||||
ttl_enc_zp => open,
|
||||
rs422_pd => pd_pulse_ie,
|
||||
rs422_enc_p1 => open,
|
||||
rs422_enc_p2 => open,
|
||||
rs422_enc_zp => open,
|
||||
abs_pos_out => abs_pos_ie,
|
||||
set_pos_out => set_pos_ie,
|
||||
inc_pos_out => inc_pos_ie,
|
||||
dec_pos_out => dec_pos_ie,
|
||||
avs_address => cs_addr(9 downto 0),
|
||||
avs_write => cs_ie_write_en,
|
||||
avs_writedata => cs_write_data,
|
||||
avs_read => cs_ie_read_en,
|
||||
avs_readdatavalid => cs_ie_read_valid,
|
||||
avs_readdata => cs_ie_read_data);
|
||||
|
||||
enc_pulse_ie <= inc_pos_ie when dp_dir = '0' else dec_pos_ie;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- NetSync Sink
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
-- Not instantiated yet
|
||||
cs_nsnk_read_valid <= '1';
|
||||
cs_nsnk_read_data <= X"DEAD_BEEF";
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Event Logger
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
-- Not instantiated yet
|
||||
cs_log_read_valid <= '1';
|
||||
cs_log_read_data <= X"DEAD_BEEF";
|
||||
|
||||
end architecture rtl;
|
||||
357
generic_ip/fire_pulse_manager/0/src/pof_rx_0.vhd
Normal file
357
generic_ip/fire_pulse_manager/0/src/pof_rx_0.vhd
Normal file
|
|
@ -0,0 +1,357 @@
|
|||
-------------------------------------------------------------------------------
|
||||
-- Title : pof_rx_0
|
||||
-- Project : SMB
|
||||
-------------------------------------------------------------------------------
|
||||
-- File : pof_rx_0.vhd
|
||||
-- Author : Gianmarco Girau
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2017-08-23
|
||||
-- Last update: 2019-01-03
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'08
|
||||
-------------------------------------------------------------------------------
|
||||
-- Description:
|
||||
-- Deserializes and decodes the EMS (SMB) output, received from the POF.
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
entity pof_rx_0 is
|
||||
port(
|
||||
reset_n : in std_logic;
|
||||
clk : in std_logic;
|
||||
--
|
||||
init : in std_logic;
|
||||
rx_clk : in std_logic;
|
||||
rx_data : in std_logic;
|
||||
init_out : out std_logic;
|
||||
dp_dir : in std_logic;
|
||||
enc_out : out std_logic;
|
||||
pd_out : out std_logic;
|
||||
inc_pos : out std_logic;
|
||||
dec_pos : out std_logic;
|
||||
abs_pos : out std_logic_vector(31 downto 0);
|
||||
-- C&S
|
||||
enable : in std_logic;
|
||||
bit_div : in std_logic_vector( 3 downto 0);
|
||||
error_rate_thres : in std_logic_vector( 7 downto 0);
|
||||
one_pps : in std_logic;
|
||||
upd_max_pos : in std_logic;
|
||||
upd_min_pos : in std_logic;
|
||||
max_error_flag : out std_logic;
|
||||
rx_watchdog : out std_logic;
|
||||
rx_watchdog_en : in std_logic;
|
||||
rx_watchdog_clr : in std_logic;
|
||||
parity_err_cnt : out std_logic_vector(15 downto 0);
|
||||
skip_pos_cnt : out std_logic_vector(15 downto 0));
|
||||
end entity pof_rx_0;
|
||||
|
||||
architecture rtl of pof_rx_0 is
|
||||
|
||||
-- check the parity bit (odd parity)
|
||||
function odd_parity_check(data : std_logic_vector) return std_logic is
|
||||
variable parity_bit : std_logic := '0';
|
||||
begin
|
||||
for n in 0 to data'length-1 loop
|
||||
parity_bit := parity_bit xor data(n);
|
||||
end loop; -- n
|
||||
return parity_bit;
|
||||
end function odd_parity_check;
|
||||
|
||||
-- Gray-to-Binary coding
|
||||
function gray2bin(gray : std_logic_vector) return std_logic_vector is
|
||||
variable bin : std_logic_vector(gray'range);
|
||||
begin
|
||||
bin(gray'length-1) := gray(gray'length-1);
|
||||
for i in gray'length-2 downto 0 loop
|
||||
bin(i) := bin(i+1) xor gray(i);
|
||||
end loop; -- n
|
||||
return bin;
|
||||
end function gray2bin;
|
||||
|
||||
signal clear, symbol_ok, inc_pos_i, dec_pos_i : std_logic;
|
||||
signal sync_gen, pd_gen, symbol_error, sync_d : std_logic;
|
||||
signal symbol_valid, symbol_valid_i, symbol_valid_d : std_logic;
|
||||
signal toggle_sync, sync_confirmed, sync_toggle_test, sync : std_logic;
|
||||
signal toggle_pd, pd_confirmed, pd_toggle_test, pd : std_logic;
|
||||
signal valid_pos, upd_pos, corr_done, corr_sign : std_logic;
|
||||
signal skip_pos, apply_corr, inc_pos_ii, dec_pos_ii : std_logic;
|
||||
signal new_max, new_min, rx_error, rx_error_i : std_logic;
|
||||
signal rx_symbol_val, clear_i, skip_pos_d, pos_recovery : std_logic;
|
||||
signal dp_dir_d, dp_dir_change, max_error_flag_i : std_logic;
|
||||
--
|
||||
signal clk_cnt : std_logic_vector( 1 downto 0);
|
||||
signal dist, abs_dist, skip_cnt : std_logic_vector( 3 downto 0);
|
||||
signal next_pos_lsb, curr_pos_lsb : std_logic_vector( 3 downto 0);
|
||||
signal pos_corr, max_dist, rx_error_v : std_logic_vector( 3 downto 0);
|
||||
signal gray_pos, rx_symbol_val_v : std_logic_vector( 3 downto 0);
|
||||
signal symbol, symbol_i, rx_symbol : std_logic_vector( 7 downto 0);
|
||||
signal rx_wd_cnt : std_logic_vector( 9 downto 0);
|
||||
signal parity_err_cnt_i, skip_pos_cnt_i : std_logic_vector(15 downto 0);
|
||||
signal error_rate_cnt, error_rate : std_logic_vector(15 downto 0);
|
||||
signal abs_pos_i, pos_max, pos_min : std_logic_vector(31 downto 0);
|
||||
signal dist_pos, dist_neg : std_logic_vector(31 downto 0);
|
||||
|
||||
begin
|
||||
|
||||
clear <= not enable or init;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- De-serialize symbols (Serial clock at 200 MHz)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
iRX_SYMBOL : entity work.uart_rx
|
||||
generic map (
|
||||
data_width => 8)
|
||||
port map (
|
||||
reset_n => reset_n,
|
||||
clk => rx_clk,
|
||||
bit_div => bit_div,
|
||||
init => clear_i,
|
||||
data_out => rx_symbol,
|
||||
data_out_valid => rx_symbol_val,
|
||||
rx_error => rx_error,
|
||||
rx_data => rx_data);
|
||||
|
||||
-- Synchronize to the local clock
|
||||
pLATCH_RX_DATA : process(rx_clk)
|
||||
begin
|
||||
if(rx_clk = '1' and rx_clk'event) then
|
||||
if(rx_symbol_val = '1') then
|
||||
symbol <= rx_symbol;
|
||||
end if;
|
||||
if(rx_symbol_val = '1') then
|
||||
rx_symbol_val_v <= "1111";
|
||||
else
|
||||
rx_symbol_val_v <= '0' & rx_symbol_val_v(3 downto 1);
|
||||
end if;
|
||||
if(rx_error = '1') then
|
||||
rx_error_v <= "1111";
|
||||
else
|
||||
rx_error_v <= '0' & rx_error_v(3 downto 1);
|
||||
end if;
|
||||
end if;
|
||||
end process pLATCH_RX_DATA;
|
||||
|
||||
iSYNC_SYMBOL_VAL : entity work.sync_wire_rEdge
|
||||
generic map (rst_val => '0', sync_stages => 3)
|
||||
port map (rstN => reset_n, clk => clk, async_in => rx_symbol_val_v(0), sync_out => symbol_valid);
|
||||
|
||||
iSYNC_RX_ERROR : entity work.sync_wire_rEdge
|
||||
generic map (rst_val => '0', sync_stages => 3)
|
||||
port map (rstN => reset_n, clk => clk, async_in => rx_error_v(0), sync_out => rx_error_i);
|
||||
-- synchronize clear to tx_clk
|
||||
iSYNC_CLEAR: entity work.sync_wire
|
||||
generic map (rst_val => '1', sync_stages => 2)
|
||||
port map (
|
||||
rstN => reset_n, clk => rx_clk, async_in => clear, sync_out => clear_i);
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Toggle-Bits Decoding
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
pTOGGLE_DEC : process(clk)
|
||||
begin
|
||||
if(clk = '1' and clk'event) then
|
||||
-- Toggle Bits
|
||||
if(clear = '1') then
|
||||
toggle_sync <= '0';
|
||||
elsif(sync_confirmed = '1') then
|
||||
toggle_sync <= not toggle_sync;
|
||||
end if;
|
||||
if(clear = '1' or sync_confirmed = '1' or (symbol_valid_i = '1' and symbol_i(0) = toggle_sync)) then
|
||||
sync_toggle_test <= '0';
|
||||
elsif(sync_gen = '1') then
|
||||
sync_toggle_test <= '1';
|
||||
end if;
|
||||
sync <= sync_confirmed;
|
||||
sync_d <= sync;
|
||||
if(clear = '1') then
|
||||
toggle_pd <= '0';
|
||||
elsif(pd_confirmed = '1') then
|
||||
toggle_pd <= not toggle_pd;
|
||||
end if;
|
||||
if(clear = '1' or pd_confirmed = '1' or (symbol_valid_i = '1' and symbol_i(2) = toggle_pd)) then
|
||||
pd_toggle_test <= '0';
|
||||
elsif(pd_gen = '1') then
|
||||
pd_toggle_test <= '1';
|
||||
end if;
|
||||
pd <= pd_confirmed;
|
||||
--
|
||||
symbol_valid_i <= symbol_valid and symbol_ok;
|
||||
symbol_error <= symbol_valid and not symbol_ok;
|
||||
if(clear = '1') then
|
||||
parity_err_cnt_i <= (others => '0');
|
||||
elsif(symbol_error = '1') then
|
||||
parity_err_cnt_i <= std_logic_vector(unsigned(parity_err_cnt_i)+1);
|
||||
end if;
|
||||
end if;
|
||||
end process pTOGGLE_DEC;
|
||||
|
||||
symbol_i <= symbol;
|
||||
|
||||
-- The received symbol is assumed to be vaild when there is not parity error
|
||||
-- and when the two bits with the PD-toggle bit are equal
|
||||
symbol_ok <= '1' when odd_parity_check(symbol) = '1' and (symbol(1) = symbol(2)) else '0';
|
||||
|
||||
sync_gen <= '1' when symbol_valid_i = '1' and symbol_i(0) /= toggle_sync else '0';
|
||||
pd_gen <= '1' when symbol_valid_i = '1' and symbol_i(2) /= toggle_pd else '0';
|
||||
--
|
||||
sync_confirmed <= sync_gen and sync_toggle_test;
|
||||
pd_confirmed <= pd_gen and pd_toggle_test;
|
||||
--
|
||||
init_out <= sync;
|
||||
pd_out <= pd;
|
||||
|
||||
parity_err_cnt <= parity_err_cnt_i;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Position management & Error Recovery
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
gray_pos <= symbol_i(6 downto 3);
|
||||
next_pos_lsb <= gray2bin(gray_pos);
|
||||
curr_pos_lsb <= abs_pos_i(3 downto 0);
|
||||
|
||||
--dist <= std_logic_vector(signed(next_pos_lsb)-signed(curr_pos_lsb));
|
||||
abs_dist <= dist when dist(3) = '0' else std_logic_vector(unsigned(not dist)+1);
|
||||
|
||||
pPOS_MNG : process(clk)
|
||||
begin
|
||||
if(clk = '1' and clk'event) then
|
||||
dist <= std_logic_vector(signed(next_pos_lsb)-signed(curr_pos_lsb));
|
||||
symbol_valid_d <= symbol_valid_i;
|
||||
if(clear = '1' or (symbol_valid_d = '1' and signed(dist) = 0) or pos_recovery = '1') then
|
||||
max_dist <= "0001";
|
||||
elsif(skip_pos = '1' or rx_error_i = '1') then
|
||||
max_dist <= std_logic_vector(unsigned(max_dist) + 1);
|
||||
end if;
|
||||
if(symbol_valid_d = '1' and valid_pos = '1') then
|
||||
pos_corr <= abs_dist;
|
||||
elsif(apply_corr = '1') then
|
||||
pos_corr <= std_logic_vector(unsigned(pos_corr)-1);
|
||||
end if;
|
||||
if(clear = '1' or corr_done = '1') then
|
||||
upd_pos <= '0';
|
||||
elsif(symbol_valid_d = '1' and valid_pos = '1') then
|
||||
upd_pos <= '1';
|
||||
end if;
|
||||
if(upd_pos = '0' or unsigned(clk_cnt) = 2) then
|
||||
clk_cnt <= (others => '0');
|
||||
else
|
||||
clk_cnt <= std_logic_vector(unsigned(clk_cnt)+1);
|
||||
end if;
|
||||
if(symbol_valid_d = '1' and valid_pos = '1') then
|
||||
corr_sign <= dist(3);
|
||||
end if;
|
||||
inc_pos_i <= inc_pos_ii;
|
||||
dec_pos_i <= dec_pos_ii;
|
||||
inc_pos <= inc_pos_i;
|
||||
dec_pos <= dec_pos_i;
|
||||
if(clear = '1' or sync = '1') then
|
||||
abs_pos_i <= (others => '0');
|
||||
elsif(inc_pos_ii = '1') then
|
||||
abs_pos_i <= std_logic_vector(signed(abs_pos_i)+1);
|
||||
elsif(dec_pos_ii = '1') then
|
||||
abs_pos_i <= std_logic_vector(signed(abs_pos_i)-1);
|
||||
end if;
|
||||
abs_pos <= abs_pos_i;
|
||||
skip_pos_d <= skip_pos;
|
||||
if(clear = '1' or (symbol_valid_d = '1' and valid_pos = '1')) then
|
||||
skip_cnt <= (others => '0');
|
||||
elsif(skip_pos = '1' and skip_pos_d = '0') then
|
||||
skip_cnt <= std_logic_vector(unsigned(skip_cnt)+1);
|
||||
end if;
|
||||
if(clear = '1') then
|
||||
skip_pos_cnt_i <= (others => '0');
|
||||
elsif(skip_pos_d = '1') then
|
||||
skip_pos_cnt_i <= std_logic_vector(unsigned(skip_pos_cnt_i)+1);
|
||||
end if;
|
||||
end if;
|
||||
end process pPOS_MNG;
|
||||
|
||||
skip_pos <= '1' when (symbol_valid = '1' and symbol_ok = '0') or (symbol_valid_d = '1' and valid_pos = '0' ) else '0';
|
||||
|
||||
pos_recovery <= '1' when unsigned(skip_cnt) >= 3 else '0';
|
||||
valid_pos <= '1' when unsigned(abs_dist) <= unsigned(max_dist) or pos_recovery = '1' else '0';
|
||||
|
||||
apply_corr <= '1' when upd_pos = '1' and clk_cnt = "01" else '0';
|
||||
corr_done <= '1' when signed(dist) = 0 else '0';
|
||||
|
||||
inc_pos_ii <= '1' when apply_corr = '1' and corr_sign = '0' else '0';
|
||||
dec_pos_ii <= '1' when apply_corr = '1' and corr_sign = '1' else '0';
|
||||
|
||||
skip_pos_cnt <= skip_pos_cnt_i;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Additional logic for error reporting
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
pERROR_REPORTING : process(clk)
|
||||
begin
|
||||
if(clk = '1' and clk'event) then
|
||||
if(clear = '1' or one_pps = '1') then
|
||||
error_rate_cnt <= (others => '0');
|
||||
elsif(symbol_error = '1') then
|
||||
error_rate_cnt <= std_logic_vector(unsigned(error_rate_cnt)+1);
|
||||
end if;
|
||||
if(clear = '1') then
|
||||
error_rate <= (others => '0');
|
||||
elsif(one_pps = '1') then
|
||||
error_rate <= error_rate_cnt;
|
||||
end if;
|
||||
max_error_flag <= not clear and max_error_flag_i;
|
||||
if(clear = '1' or symbol_valid_i = '1' or rx_watchdog_clr = '1') then
|
||||
rx_wd_cnt <= (others => '0');
|
||||
else
|
||||
rx_wd_cnt <= std_logic_vector(unsigned(rx_wd_cnt)+1);
|
||||
end if;
|
||||
if(clear = '1' or rx_watchdog_clr = '1' or rx_watchdog_en = '0' or sync = '1') then
|
||||
rx_watchdog <= '0';
|
||||
elsif(unsigned(rx_wd_cnt) > 1000) then
|
||||
rx_watchdog <= '1';
|
||||
end if;
|
||||
end if;
|
||||
end process pERROR_REPORTING;
|
||||
|
||||
max_error_flag_i <= '1' when unsigned(error_rate) > unsigned(error_rate_thres) else '0';
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Encoder Pulse management
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
-- Encoder pulses are generated only when there is an increment of the
|
||||
-- position in the intended direction, which exceeds the previous maximum.
|
||||
-- The value of the maximum is reset in the following situations:
|
||||
-- 1. After a Init/Sync pulse
|
||||
-- 2. After a direction change
|
||||
-- 3. When the distance between the current position and the previous maximum
|
||||
-- exceeds a programmable threshold, where the threshold is a 32 bit signed
|
||||
-- number. Only the 16 MSBs of this threshold can be configured. The threshold
|
||||
-- is set to the maximum value by default (e.g.: (2^23 = 8388608)
|
||||
|
||||
pENC_MNG : process(clk)
|
||||
begin
|
||||
if(clk = '1' and clk'event) then
|
||||
dp_dir_d <= dp_dir;
|
||||
if(sync_d = '1' or dp_dir_change = '1' or new_max = '1' or upd_max_pos = '1') then
|
||||
pos_max <= abs_pos_i;
|
||||
end if;
|
||||
if(sync_d = '1' or dp_dir_change = '1' or new_min = '1' or upd_min_pos = '1') then
|
||||
pos_min <= abs_pos_i;
|
||||
end if;
|
||||
enc_out <= new_min or new_max;
|
||||
end if;
|
||||
end process pENC_MNG;
|
||||
|
||||
dp_dir_change <= dp_dir xor dp_dir_d;
|
||||
|
||||
dist_pos <= std_logic_vector(signed(abs_pos_i)-signed(pos_max));
|
||||
dist_neg <= std_logic_vector(signed(pos_min)-signed(abs_pos_i));
|
||||
|
||||
new_max <= '1' when inc_pos_i = '1' and dp_dir = '0' and dist_pos(31) = '0' and unsigned(dist_pos(3 downto 0)) /= 0 else '0';
|
||||
new_min <= '1' when dec_pos_i = '1' and dp_dir = '1' and dist_neg(31) = '0' and unsigned(dist_neg(3 downto 0)) /= 0 else '0';
|
||||
|
||||
end architecture rtl;
|
||||
701
generic_ip/fire_pulse_manager/0/src/smb_diagnostics_0.vhd
Normal file
701
generic_ip/fire_pulse_manager/0/src/smb_diagnostics_0.vhd
Normal file
|
|
@ -0,0 +1,701 @@
|
|||
-------------------------------------------------------------------------------
|
||||
-- Title : smb diagnostic block
|
||||
-- Project : SMB-1
|
||||
-------------------------------------------------------------------------------
|
||||
-- File : smb_diagnostics_0.vhd
|
||||
-- Author : Gianmarco Girau
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2016-08-02
|
||||
-- Last update: 2019-01-03
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'2008
|
||||
-------------------------------------------------------------------------------
|
||||
-- Description: This block includes all the SMB diagnostic functionalities
|
||||
-- except the event logger.
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
entity smb_diagnostics_0 is
|
||||
port (
|
||||
clk : in std_logic;
|
||||
reset_n : in std_logic := '1';
|
||||
-- External sync reset (via daisy-chain)
|
||||
ext_diag_rst : in std_logic;
|
||||
-- diagnostic inputs
|
||||
rs422_phase0 : in std_logic;
|
||||
rs422_phase1 : in std_logic;
|
||||
rs422_zero_ph : in std_logic;
|
||||
rs422_prod_det : in std_logic;
|
||||
ttl_phase0 : in std_logic;
|
||||
ttl_phase1 : in std_logic;
|
||||
ttl_zero_ph : in std_logic;
|
||||
ttl_prod_det : in std_logic;
|
||||
ttl_prod_det_npn : in std_logic;
|
||||
filt_phase0 : in std_logic;
|
||||
filt_phase1 : in std_logic;
|
||||
filt_zero_ph : in std_logic;
|
||||
filt_prod_det : in std_logic;
|
||||
enc_out : in std_logic;
|
||||
pd_out : in std_logic;
|
||||
pos_step : in std_logic;
|
||||
neg_step : in std_logic;
|
||||
drop_watch : in std_logic;
|
||||
fire_req : in std_logic;
|
||||
-- local timer
|
||||
fine_time : in std_logic_vector(27 downto 0);
|
||||
coarse_time : in std_logic_vector(31 downto 0);
|
||||
-- Absolute Position
|
||||
abs_position : out std_logic_vector(31 downto 0);
|
||||
-- Interrupt Senders
|
||||
ins_diag_irq_0 : out std_logic;
|
||||
ins_diag_irq_1 : out std_logic;
|
||||
ins_diag_irq_2 : out std_logic;
|
||||
-- Avalon MM Interface
|
||||
avs_address : in std_logic_vector( 5 downto 0);
|
||||
avs_write : in std_logic;
|
||||
avs_writedata : in std_logic_vector(31 downto 0);
|
||||
avs_read : in std_logic;
|
||||
avs_readdatavalid : out std_logic;
|
||||
avs_readdata : out std_logic_vector(31 downto 0));
|
||||
end entity smb_diagnostics_0;
|
||||
|
||||
architecture rtl of smb_diagnostics_0 is
|
||||
|
||||
constant ADDR_WIDTH : integer := avs_address'length;
|
||||
|
||||
constant DIAG_INIT_REG : std_logic_vector(5 downto 0) := b"000000";
|
||||
constant DIAG_IN_STATUS_REG : std_logic_vector(5 downto 0) := b"000001";
|
||||
constant PHASE0_CNT_REG : std_logic_vector(5 downto 0) := b"000010";
|
||||
constant PHASE1_CNT_REG : std_logic_vector(5 downto 0) := b"000011";
|
||||
constant ZERO_PH_CNT_REG : std_logic_vector(5 downto 0) := b"000100";
|
||||
constant PD_CNT_REG : std_logic_vector(5 downto 0) := b"000101";
|
||||
constant ENC_OUT_CNT_REG : std_logic_vector(5 downto 0) := b"000110";
|
||||
constant PD_OUT_CNT_REG : std_logic_vector(5 downto 0) := b"000111";
|
||||
constant FIRE_REQ_CNT_REG : std_logic_vector(5 downto 0) := b"001000";
|
||||
constant UNUSED_REG_0 : std_logic_vector(5 downto 0) := b"001001";
|
||||
constant UNUSED_REG_1 : std_logic_vector(5 downto 0) := b"001010";
|
||||
constant UNUSED_REG_2 : std_logic_vector(5 downto 0) := b"001011";
|
||||
constant ENC_D_TIME_REG : std_logic_vector(5 downto 0) := b"001100";
|
||||
constant ENC_DMIN_TIME_REG : std_logic_vector(5 downto 0) := b"001101";
|
||||
constant ENC_DMAX_TIME_REG : std_logic_vector(5 downto 0) := b"001110";
|
||||
constant ENC_D_TIME_PREV_REG : std_logic_vector(5 downto 0) := b"001111";
|
||||
constant ENC_D_TIME_MEAS_STEP : std_logic_vector(5 downto 0) := b"010000";
|
||||
constant POSITION_CNT_REG : std_logic_vector(5 downto 0) := b"010001";
|
||||
constant DIR_COUNT_THRES_REG : std_logic_vector(5 downto 0) := b"010010";
|
||||
constant DIR_COUNT_REG : std_logic_vector(5 downto 0) := b"010011";
|
||||
constant ENC_SAMPL_PER_REG : std_logic_vector(5 downto 0) := b"010100";
|
||||
constant ENC_FIFO_CS_REG : std_logic_vector(5 downto 0) := b"010101";
|
||||
constant ENC_FIFO_OUT_REG : std_logic_vector(5 downto 0) := b"010110";
|
||||
constant PD_FIFO_CS_REG : std_logic_vector(5 downto 0) := b"010111";
|
||||
constant PD_FIFO_OUT_REG : std_logic_vector(5 downto 0) := b"011000";
|
||||
constant PD_WATCH_DOG_CTRL : std_logic_vector(5 downto 0) := b"011001";
|
||||
constant PD_WATCH_DOG_THRES : std_logic_vector(5 downto 0) := b"011010";
|
||||
constant IRQ_MNG_REG : std_logic_vector(5 downto 0) := b"011011";
|
||||
|
||||
-- signals
|
||||
type fsm_status_t is (idle, wait_ph1_ris, wait_ph0_ris);
|
||||
signal fsm_status_curr,fsm_status_next : fsm_status_t;
|
||||
--
|
||||
signal filt_phase0_d, filt_phase1_d, filt_zero_ph_d, filt_prod_det_d : std_logic;
|
||||
signal enc_out_d, pd_out_d, filt_phase0_p, filt_phase1_p, init_i : std_logic;
|
||||
signal filt_zero_ph_p, filt_prod_det_p, enc_out_p, pd_out_p : std_logic;
|
||||
signal init, rst_counters_i, rst_counters, rst_measur_i, rst_measur : std_logic;
|
||||
signal rst_dir, rst_dir_i, enable_diff_measur, meas_enc_p : std_logic;
|
||||
signal ph0_rising, ph0_falling, ph1_rising, ph1_falling : std_logic;
|
||||
signal set_dir_forward, set_dir_backward, dir_pos_sat, dir_neg_sat : std_logic;
|
||||
signal direction, direction_d, direction_change : std_logic;
|
||||
signal sampling_time, fifo_rd_en, fifo_wr_en, fifo_full, fifo_error : std_logic;
|
||||
signal rst_fifo_i, rst_fifo, rst_pos, rst_pos_i, avs_read_i : std_logic;
|
||||
signal pd_fifo_error, pd_fifo_wr_en, pd_fifo_rd_en, pd_fifo_full : std_logic;
|
||||
signal pd_p, pd_log_src, pd_fifo_alarm, enc_fifo_alarm : std_logic;
|
||||
signal clr_pd_pos, pd_wd_en, pd_wd_alarm, rst_pd_fifo, rst_pd_fifo_i : std_logic;
|
||||
signal fire_req_d, fire_req_p : std_logic;
|
||||
--
|
||||
signal enable_diff_measur_cnt : std_logic_vector( 1 downto 0);
|
||||
signal irq_en, irq_clr, irq_src, irq_src_d : std_logic_vector( 2 downto 0);
|
||||
signal irq, irq_val, irq_mask, pd_data_sel : std_logic_vector( 2 downto 0);
|
||||
signal meas_enc_pulse : std_logic_vector( 3 downto 0);
|
||||
signal pd_fifo_usedw, pd_fifo_thres : std_logic_vector( 7 downto 0);
|
||||
signal fifo_thres, fifo_usedw : std_logic_vector( 9 downto 0);
|
||||
signal dir_cnt, dir_change_cnt : std_logic_vector(15 downto 0);
|
||||
signal pos_dir_thres, neg_dir_thres : std_logic_vector(15 downto 0);
|
||||
signal meas_pulse_cnt, meas_step : std_logic_vector(15 downto 0);
|
||||
signal input_status : std_logic_vector(16 downto 0);
|
||||
signal sampling_period, sampling_time_cnt : std_logic_vector(27 downto 0);
|
||||
signal fine_time_l : std_logic_vector(27 downto 0);
|
||||
signal filt_phase0_cnt, filt_phase1_cnt : std_logic_vector(31 downto 0);
|
||||
signal filt_zero_ph_cnt, filt_prod_det_cnt : std_logic_vector(31 downto 0);
|
||||
signal enc_out_cnt, pd_out_cnt : std_logic_vector(31 downto 0);
|
||||
signal enc_delta_time, enc_delta_time_prev : std_logic_vector(31 downto 0);
|
||||
signal enc_delta_time_cnt : std_logic_vector(31 downto 0);
|
||||
signal enc_delta_time_min, enc_delta_time_max : std_logic_vector(31 downto 0);
|
||||
signal fifo_d, fifo_q, pos_cnt : std_logic_vector(31 downto 0);
|
||||
signal pd_fifo_d, pd_fifo_q : std_logic_vector(31 downto 0);
|
||||
signal pd_pos, coarse_time_l, pd_wd_thres : std_logic_vector(31 downto 0);
|
||||
signal pd_delta_pos, pd_delta_pos_abs : std_logic_vector(31 downto 0);
|
||||
signal fire_req_cnt : std_logic_vector(31 downto 0);
|
||||
|
||||
|
||||
begin
|
||||
|
||||
pInit : process(clk)
|
||||
begin
|
||||
if(clk = '1' and clk'event) then
|
||||
init <= init_i or ext_diag_rst;
|
||||
end if;
|
||||
end process pInit;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Input Status
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
pInputStatus : process(clk)
|
||||
begin
|
||||
if(clk = '1' and clk'event) then
|
||||
input_status( 0) <= rs422_phase0;
|
||||
input_status( 1) <= rs422_phase1;
|
||||
input_status( 2) <= rs422_zero_ph;
|
||||
input_status( 3) <= rs422_prod_det;
|
||||
input_status( 4) <= ttl_phase0;
|
||||
input_status( 5) <= ttl_phase1;
|
||||
input_status( 6) <= ttl_zero_ph;
|
||||
input_status( 7) <= ttl_prod_det;
|
||||
input_status( 8) <= ttl_prod_det_npn;
|
||||
input_status( 9) <= filt_phase0;
|
||||
input_status(10) <= filt_phase1;
|
||||
input_status(11) <= filt_zero_ph;
|
||||
input_status(12) <= filt_prod_det;
|
||||
input_status(13) <= enc_out;
|
||||
input_status(14) <= pd_out;
|
||||
input_status(15) <= drop_watch;
|
||||
input_status(16) <= fire_req;
|
||||
end if;
|
||||
end process pInputStatus;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Edge detection and counting
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
pEdgeDetect_Cnt : process(clk)
|
||||
begin
|
||||
if(clk = '1' and clk'event) then
|
||||
filt_phase0_d <= filt_phase0;
|
||||
filt_phase1_d <= filt_phase1;
|
||||
filt_zero_ph_d <= filt_zero_ph;
|
||||
filt_prod_det_d <= filt_prod_det;
|
||||
enc_out_d <= enc_out;
|
||||
pd_out_d <= pd_out;
|
||||
fire_req_d <= fire_req;
|
||||
if(rst_counters = '1') then
|
||||
filt_phase0_cnt <= (others => '0');
|
||||
elsif(filt_phase0_p = '1') then
|
||||
filt_phase0_cnt <= std_logic_vector(unsigned(filt_phase0_cnt)+1);
|
||||
end if;
|
||||
if(rst_counters = '1') then
|
||||
filt_phase1_cnt <= (others => '0');
|
||||
elsif(filt_phase1_p = '1') then
|
||||
filt_phase1_cnt <= std_logic_vector(unsigned(filt_phase1_cnt)+1);
|
||||
end if;
|
||||
if(rst_counters = '1') then
|
||||
filt_zero_ph_cnt <= (others => '0');
|
||||
elsif(filt_zero_ph_p = '1') then
|
||||
filt_zero_ph_cnt <= std_logic_vector(unsigned(filt_zero_ph_cnt)+1);
|
||||
end if;
|
||||
if(rst_counters = '1') then
|
||||
filt_prod_det_cnt <= (others => '0');
|
||||
elsif(filt_prod_det_p = '1') then
|
||||
filt_prod_det_cnt <= std_logic_vector(unsigned(filt_prod_det_cnt)+1);
|
||||
end if;
|
||||
if(rst_counters = '1') then
|
||||
enc_out_cnt <= (others => '0');
|
||||
elsif(enc_out_p = '1') then
|
||||
enc_out_cnt <= std_logic_vector(unsigned(enc_out_cnt)+1);
|
||||
end if;
|
||||
if(rst_counters = '1') then
|
||||
pd_out_cnt <= (others => '0');
|
||||
elsif(pd_out_p = '1') then
|
||||
pd_out_cnt <= std_logic_vector(unsigned(pd_out_cnt)+1);
|
||||
end if;
|
||||
if(rst_counters = '1') then
|
||||
fire_req_cnt <= (others => '0');
|
||||
elsif(fire_req_p = '1') then
|
||||
fire_req_cnt <= std_logic_vector(unsigned(fire_req_cnt)+1);
|
||||
end if;
|
||||
end if;
|
||||
end process pEdgeDetect_Cnt;
|
||||
|
||||
filt_phase0_p <= filt_phase0 and not filt_phase0_d;
|
||||
filt_phase1_p <= filt_phase1 and not filt_phase1_d;
|
||||
filt_zero_ph_p <= filt_zero_ph and not filt_zero_ph_d;
|
||||
filt_prod_det_p <= filt_prod_det and not filt_prod_det_d;
|
||||
enc_out_p <= enc_out and not enc_out_d;
|
||||
pd_out_p <= pd_out and not pd_out_d;
|
||||
fire_req_p <= fire_req and not fire_req_d;
|
||||
|
||||
rst_counters <= rst_counters_i or init;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Speed and acceleration measurements
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
pMeasure : process(clk)
|
||||
begin
|
||||
if(clk = '1' and clk'event) then
|
||||
if(rst_measur = '1' or meas_enc_p = '1') then
|
||||
meas_pulse_cnt <= (others => '0');
|
||||
elsif(enc_out_d = '1') then
|
||||
meas_pulse_cnt <= std_logic_vector(unsigned(meas_pulse_cnt)+1);
|
||||
end if;
|
||||
if(rst_measur = '1') then
|
||||
meas_enc_pulse <= (others => '0');
|
||||
else
|
||||
meas_enc_pulse <= meas_enc_pulse(meas_enc_pulse'high-1 downto 0) & meas_enc_p;
|
||||
end if;
|
||||
if(rst_measur = '1' or meas_enc_pulse(0) = '1') then
|
||||
enc_delta_time_cnt <= (others => '0');
|
||||
else
|
||||
enc_delta_time_cnt <= std_logic_vector(unsigned(enc_delta_time_cnt)+1);
|
||||
end if;
|
||||
if(rst_measur = '1') then
|
||||
enc_delta_time <= (others => '0');
|
||||
enc_delta_time_prev <= (others => '0');
|
||||
elsif(meas_enc_pulse(0) = '1') then
|
||||
enc_delta_time <= enc_delta_time_cnt;
|
||||
enc_delta_time_prev <= enc_delta_time;
|
||||
end if;
|
||||
if(rst_measur = '1' or rst_counters = '1') then
|
||||
enable_diff_measur_cnt <= (others => '0');
|
||||
elsif(meas_enc_p = '1') then
|
||||
enable_diff_measur_cnt <= std_logic_vector(unsigned(enable_diff_measur_cnt)+1);
|
||||
end if;
|
||||
if(rst_measur = '1' or rst_counters = '1') then
|
||||
enable_diff_measur <= '0';
|
||||
elsif(enable_diff_measur_cnt = "11") then
|
||||
enable_diff_measur <= '1';
|
||||
end if;
|
||||
if(enable_diff_measur = '0') then
|
||||
enc_delta_time_min <= (others => '1');
|
||||
elsif(meas_enc_pulse(2) = '1' and unsigned(enc_delta_time) < unsigned(enc_delta_time_min)) then
|
||||
enc_delta_time_min <= enc_delta_time;
|
||||
end if;
|
||||
if(enable_diff_measur = '0') then
|
||||
enc_delta_time_max <= (others => '0');
|
||||
elsif(meas_enc_pulse(2) = '1' and unsigned(enc_delta_time) > unsigned(enc_delta_time_max)) then
|
||||
enc_delta_time_max <= enc_delta_time;
|
||||
end if;
|
||||
end if;
|
||||
end process pMeasure;
|
||||
|
||||
meas_enc_p <= '1' when enc_out_p = '1' and unsigned(meas_pulse_cnt) = unsigned(meas_step) else '0';
|
||||
|
||||
rst_measur <= rst_measur_i or init;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Direction detection & Position Tracking
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
-- Direction is detected by checking the order of rising and falling edged
|
||||
-- between phase-0 and phase-1.
|
||||
-- Forward direction => Phase-0 is anticipated w.r.t. Phase-1
|
||||
-- Backward direction => Phase-0 is delayed w.r.t. Phase-1
|
||||
|
||||
ph0_rising <= filt_phase0_p;
|
||||
ph0_falling <= not filt_phase0 and filt_phase0_d;
|
||||
ph1_rising <= filt_phase1_p;
|
||||
ph1_falling <= not filt_phase1 and filt_phase1_d;
|
||||
|
||||
rst_dir <= rst_dir_i or init;
|
||||
|
||||
-- Use a FSM to detect the sequence of events:
|
||||
-- FSM Status Register
|
||||
pFSM_SR : process(clk)
|
||||
begin
|
||||
if(clk = '1' and clk'event) then
|
||||
if(rst_dir = '1') then
|
||||
fsm_status_curr <= idle;
|
||||
else
|
||||
fsm_status_curr <= fsm_status_next;
|
||||
end if;
|
||||
end if;
|
||||
end process pFSM_SR;
|
||||
|
||||
-- FSM Combinational Logic
|
||||
pFSM_CL : process(fsm_status_curr, ph0_rising, ph0_falling, ph1_rising, ph1_falling)
|
||||
begin
|
||||
-- default assignments
|
||||
set_dir_forward <= '0';
|
||||
set_dir_backward <= '0';
|
||||
--
|
||||
fsm_status_next <= fsm_status_curr;
|
||||
|
||||
case fsm_status_curr is
|
||||
when idle =>
|
||||
if(ph0_rising = '1') then
|
||||
fsm_status_next <= wait_ph1_ris;
|
||||
elsif(ph1_rising = '1') then
|
||||
fsm_status_next <= wait_ph0_ris;
|
||||
end if;
|
||||
|
||||
when wait_ph1_ris =>
|
||||
if(ph1_rising = '1') then
|
||||
set_dir_forward <= '1';
|
||||
fsm_status_next <= idle;
|
||||
elsif(ph0_falling = '1') then
|
||||
fsm_status_next <= idle;
|
||||
end if;
|
||||
|
||||
when wait_ph0_ris =>
|
||||
if(ph0_rising = '1') then
|
||||
set_dir_backward <= '1';
|
||||
fsm_status_next <= idle;
|
||||
elsif(ph1_falling = '1') then
|
||||
fsm_status_next <= idle;
|
||||
end if;
|
||||
|
||||
when others => null;
|
||||
end case;
|
||||
end process pFSM_CL;
|
||||
|
||||
pDirRegs : process(clk)
|
||||
begin
|
||||
if(clk = '1' and clk'event) then
|
||||
if(rst_dir = '1') then
|
||||
dir_cnt <= (others => '0');
|
||||
elsif(set_dir_forward = '1' and dir_pos_sat = '0') then
|
||||
dir_cnt <= std_logic_vector(signed(dir_cnt)+1);
|
||||
elsif(set_dir_backward = '1' and dir_neg_sat = '0') then
|
||||
dir_cnt <= std_logic_vector(signed(dir_cnt)-1);
|
||||
end if;
|
||||
direction_d <= direction;
|
||||
if(rst_dir = '1') then
|
||||
dir_change_cnt <= (others => '0');
|
||||
elsif(direction_change = '1') then
|
||||
dir_change_cnt <= std_logic_vector(unsigned(dir_change_cnt)+1);
|
||||
end if;
|
||||
end if;
|
||||
end process pDirRegs;
|
||||
|
||||
direction <= dir_cnt(dir_cnt'high);
|
||||
direction_change <= direction xor direction_d;
|
||||
|
||||
-- Positive/Negative saturation for the direction counter
|
||||
dir_pos_sat <= '1' when signed(dir_cnt) > signed(pos_dir_thres) else '0';
|
||||
dir_neg_sat <= '1' when signed(dir_cnt) < signed(neg_dir_thres) else '0';
|
||||
|
||||
-- Position Tracking
|
||||
pPOS_TRACK : process(clk)
|
||||
begin
|
||||
if(clk = '1' and clk'event) then
|
||||
if(rst_pos = '1') then
|
||||
pos_cnt <= (others => '0');
|
||||
elsif(pos_step = '1') then
|
||||
pos_cnt <= std_logic_vector(signed(pos_cnt)+1);
|
||||
elsif(neg_step = '1') then
|
||||
pos_cnt <= std_logic_vector(signed(pos_cnt)-1);
|
||||
end if;
|
||||
abs_position <= pos_cnt;
|
||||
end if;
|
||||
end process pPOS_TRACK;
|
||||
|
||||
rst_pos <= init or rst_pos_i;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- PD logging
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
pPD_log : process(clk)
|
||||
begin
|
||||
if(clk = '1' and clk'event) then
|
||||
if(init = '1') then
|
||||
pd_fifo_error <= '0';
|
||||
elsif(pd_fifo_wr_en = '1' and pd_fifo_full = '1') then
|
||||
pd_fifo_error <= '1';
|
||||
end if;
|
||||
if(init = '0' and pd_p = '1') then
|
||||
pd_data_sel <= "001";
|
||||
else
|
||||
pd_data_sel <= pd_data_sel(1 downto 0) & '0';
|
||||
end if;
|
||||
if(init = '1') then
|
||||
fine_time_l <= (others => '0');
|
||||
coarse_time_l <= (others => '0');
|
||||
pd_pos <= (others => '0');
|
||||
elsif(pd_p = '1') then
|
||||
fine_time_l <= fine_time;
|
||||
coarse_time_l <= coarse_time;
|
||||
pd_pos <= pos_cnt;
|
||||
end if;
|
||||
end if;
|
||||
end process pPD_log;
|
||||
|
||||
pd_p <= pd_out_p when pd_log_src = '1' else filt_prod_det_p;
|
||||
|
||||
iPD_log_fifo : entity work.sync_fifo
|
||||
generic map(
|
||||
FIFO_WIDTH => 32,
|
||||
FIFO_DEPTH => 256)
|
||||
port map (
|
||||
clock => clk,
|
||||
data => pd_fifo_d,
|
||||
rdreq => pd_fifo_rd_en,
|
||||
sclr => rst_pd_fifo,
|
||||
wrreq => pd_fifo_wr_en,
|
||||
empty => open,
|
||||
full => pd_fifo_full,
|
||||
q => pd_fifo_q,
|
||||
usedw => pd_fifo_usedw);
|
||||
|
||||
pd_fifo_rd_en <= '1' when avs_read = '1' and avs_address = PD_FIFO_OUT_REG else '0';
|
||||
|
||||
pd_fifo_alarm <= '1' when unsigned(pd_fifo_usedw) >= unsigned(pd_fifo_thres) else '0';
|
||||
|
||||
-- FIFO write logic
|
||||
pd_fifo_wr_en <= pd_data_sel(2) or pd_data_sel(1) or pd_data_sel(0);
|
||||
|
||||
-- select the input for the pd fifo
|
||||
with pd_data_sel select
|
||||
pd_fifo_d <=
|
||||
X"0" & fine_time_l when "001",
|
||||
coarse_time_l when "010",
|
||||
pd_pos when others;
|
||||
|
||||
rst_pd_fifo <= rst_pd_fifo_i or init;
|
||||
|
||||
-- PD Positional Watch-Dog
|
||||
pPD_WatchDog : process(clk)
|
||||
begin
|
||||
if(clk = '1') then
|
||||
if(init = '1' or clr_pd_pos = '1' or filt_prod_det_p = '1') then
|
||||
pd_delta_pos <= (others => '0');
|
||||
elsif(pos_step = '1') then
|
||||
pd_delta_pos <= std_logic_vector(signed(pd_delta_pos)+1);
|
||||
elsif(neg_step = '1') then
|
||||
pd_delta_pos <= std_logic_vector(signed(pd_delta_pos)-1);
|
||||
end if;
|
||||
-- compare the absolute value of the delta position against the
|
||||
-- threshold. Use the 1's complement to save some logic.
|
||||
if(pd_wd_en = '1' and unsigned(pd_delta_pos_abs) > unsigned(pd_wd_thres)) then
|
||||
pd_wd_alarm <= '1';
|
||||
else
|
||||
pd_wd_alarm <= '0';
|
||||
end if;
|
||||
end if;
|
||||
end process pPD_WatchDog;
|
||||
|
||||
pd_delta_pos_abs <= '0' & pd_delta_pos(30 downto 0) when pd_delta_pos(31) = '0' else '0' & not pd_delta_pos(30 downto 0);
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Encoder pulse count buffering (ACTUALLY NOW IS POSITION COUNT SAMPLING!!!)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
-- The encoder pulse count is periodically sampled. The samples are stored in
|
||||
-- a dedicated FIFO and they can be used to generate a speed/acceleration
|
||||
-- profile. => CHANGED: JUST using the position count, because it is more
|
||||
-- it is independent of the encoder directionality settings
|
||||
|
||||
pEncPulseSample : process(clk)
|
||||
begin
|
||||
if(clk = '1' and clk'event) then
|
||||
if(rst_fifo = '1' or sampling_time = '1') then
|
||||
sampling_time_cnt <= (others => '0');
|
||||
else
|
||||
sampling_time_cnt <= std_logic_vector(unsigned(sampling_time_cnt)+1);
|
||||
end if;
|
||||
if(rst_fifo = '1') then
|
||||
fifo_error <= '0';
|
||||
elsif(fifo_wr_en = '1' and fifo_full = '1') then
|
||||
fifo_error <= '1';
|
||||
end if;
|
||||
fifo_wr_en <= sampling_time;
|
||||
--fifo_d <= enc_out_cnt;
|
||||
fifo_d <= pos_cnt;
|
||||
end if;
|
||||
end process pEncPulseSample;
|
||||
|
||||
sampling_time <= '1' when unsigned(sampling_time_cnt) = unsigned(sampling_period) else '0';
|
||||
|
||||
iEncPulseFifo : entity work.sync_fifo
|
||||
generic map(
|
||||
FIFO_WIDTH => 32,
|
||||
FIFO_DEPTH => 1024)
|
||||
port map (
|
||||
clock => clk,
|
||||
data => fifo_d,
|
||||
rdreq => fifo_rd_en,
|
||||
sclr => rst_fifo,
|
||||
wrreq => fifo_wr_en,
|
||||
empty => open,
|
||||
full => fifo_full,
|
||||
q => fifo_q,
|
||||
usedw => fifo_usedw);
|
||||
|
||||
fifo_rd_en <= '1' when avs_read = '1' and avs_address = ENC_FIFO_OUT_REG else '0';
|
||||
|
||||
enc_fifo_alarm <= '1' when unsigned(fifo_usedw) >= unsigned(fifo_thres) else '0';
|
||||
|
||||
rst_fifo <= init or rst_fifo_i or rst_counters_i;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- IRQ generation and management
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
pIRQ : process(reset_n, clk)
|
||||
begin
|
||||
if(reset_n = '0') then
|
||||
ins_diag_irq_0 <= '0';
|
||||
ins_diag_irq_1 <= '0';
|
||||
ins_diag_irq_2 <= '0';
|
||||
irq <= "000";
|
||||
irq_src_d <= "000";
|
||||
elsif(clk = '1' and clk'event) then
|
||||
irq_src_d <= irq_src;
|
||||
for n in 0 to 2 loop
|
||||
if(irq_clr(n) = '1') then
|
||||
irq(n) <= '0';
|
||||
elsif(irq_en(n) = '1' and irq_src(n) = '1' and irq_src_d(n) = '0') then
|
||||
irq(n) <= '1';
|
||||
end if;
|
||||
end loop; -- n
|
||||
ins_diag_irq_0 <= irq_val(0);
|
||||
ins_diag_irq_1 <= irq_val(1);
|
||||
ins_diag_irq_2 <= irq_val(2);
|
||||
end if;
|
||||
end process pIRQ;
|
||||
|
||||
irq_val <= irq and not irq_mask;
|
||||
irq_src <= pd_wd_alarm & pd_fifo_alarm & enc_fifo_alarm;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- C&S registers (Avalon-MM I/F)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
pCTRL_STATUS : process(reset_n, clk)
|
||||
begin
|
||||
if(reset_n = '0') then
|
||||
avs_read_i <= '0';
|
||||
avs_readdatavalid <= '0';
|
||||
avs_readdata <= (others => '0');
|
||||
--
|
||||
init_i <= '0';
|
||||
rst_counters_i <= '0';
|
||||
rst_measur_i <= '0';
|
||||
rst_dir_i <= '0';
|
||||
rst_fifo_i <= '0';
|
||||
rst_pos_i <= '0';
|
||||
rst_pd_fifo_i <= '0';
|
||||
pd_log_src <= '0';
|
||||
pd_wd_en <= '0';
|
||||
clr_pd_pos <= '0';
|
||||
irq_en <= "000";
|
||||
irq_clr <= "000";
|
||||
irq_mask <= "000";
|
||||
meas_step <= (0 => '1', others => '0');
|
||||
sampling_period <= (others => '0');
|
||||
pos_dir_thres <= X"007F"; -- +127
|
||||
neg_dir_thres <= X"FF81"; -- -127
|
||||
elsif(clk = '1' and clk'event) then
|
||||
-- CTRL registers
|
||||
if(avs_write = '1') then
|
||||
case avs_address is
|
||||
when DIAG_INIT_REG =>
|
||||
init_i <= avs_writedata( 0);
|
||||
rst_counters_i <= avs_writedata( 1);
|
||||
rst_measur_i <= avs_writedata( 2);
|
||||
rst_dir_i <= avs_writedata( 3);
|
||||
rst_fifo_i <= avs_writedata( 4);
|
||||
rst_pos_i <= avs_writedata( 5);
|
||||
rst_pd_fifo_i <= avs_writedata( 6);
|
||||
when ENC_D_TIME_MEAS_STEP =>
|
||||
meas_step <= avs_writedata(meas_step'range);
|
||||
when DIR_COUNT_THRES_REG =>
|
||||
pos_dir_thres <= avs_writedata(15 downto 0);
|
||||
neg_dir_thres <= avs_writedata(31 downto 16);
|
||||
when ENC_SAMPL_PER_REG =>
|
||||
sampling_period <= avs_writedata(sampling_period'range);
|
||||
when ENC_FIFO_CS_REG =>
|
||||
fifo_thres <= avs_writedata(fifo_thres'range);
|
||||
when PD_FIFO_CS_REG =>
|
||||
pd_fifo_thres <= avs_writedata(pd_fifo_thres'range);
|
||||
pd_log_src <= avs_writedata(15);
|
||||
when PD_WATCH_DOG_CTRL =>
|
||||
pd_wd_en <= avs_writedata( 0);
|
||||
clr_pd_pos <= avs_writedata( 1);
|
||||
when PD_WATCH_DOG_THRES =>
|
||||
pd_wd_thres <= avs_writedata;
|
||||
when IRQ_MNG_REG =>
|
||||
irq_en <= avs_writedata( 2 downto 0);
|
||||
irq_clr <= avs_writedata( 6 downto 4);
|
||||
irq_mask <= avs_writedata(10 downto 8);
|
||||
when others => null;
|
||||
end case;
|
||||
end if;
|
||||
|
||||
-- Read Ctrl & Status registers
|
||||
avs_read_i <= avs_read;
|
||||
-- Read valid is delayed of an additional clock cycle to take into
|
||||
-- account for the FIFO latency
|
||||
avs_readdatavalid <= avs_read_i;
|
||||
if(avs_read_i = '1') then
|
||||
case avs_address is
|
||||
when DIAG_INIT_REG =>
|
||||
avs_readdata <= X"000000" & b"0" & rst_pd_fifo_i & rst_pos_i & rst_fifo_i & rst_dir_i & rst_measur_i & rst_counters_i & init_i;
|
||||
when DIAG_IN_STATUS_REG =>
|
||||
avs_readdata(input_status'range) <= input_status;
|
||||
avs_readdata(31 downto input_status'length) <= (others => '0');
|
||||
when PHASE0_CNT_REG =>
|
||||
avs_readdata <= filt_phase0_cnt;
|
||||
when PHASE1_CNT_REG =>
|
||||
avs_readdata <= filt_phase1_cnt;
|
||||
when ZERO_PH_CNT_REG =>
|
||||
avs_readdata <= filt_zero_ph_cnt;
|
||||
when PD_CNT_REG =>
|
||||
avs_readdata <= filt_prod_det_cnt;
|
||||
when ENC_OUT_CNT_REG =>
|
||||
avs_readdata <= enc_out_cnt;
|
||||
when PD_OUT_CNT_REG =>
|
||||
avs_readdata <= pd_out_cnt;
|
||||
when FIRE_REQ_CNT_REG =>
|
||||
avs_readdata <= fire_req_cnt;
|
||||
when ENC_D_TIME_REG =>
|
||||
avs_readdata <= enc_delta_time;
|
||||
when ENC_DMIN_TIME_REG =>
|
||||
avs_readdata <= enc_delta_time_min;
|
||||
when ENC_DMAX_TIME_REG =>
|
||||
avs_readdata <= enc_delta_time_max;
|
||||
when ENC_D_TIME_PREV_REG =>
|
||||
avs_readdata <= enc_delta_time_prev;
|
||||
when ENC_D_TIME_MEAS_STEP =>
|
||||
avs_readdata <= X"0000" & meas_step;
|
||||
when POSITION_CNT_REG =>
|
||||
avs_readdata <= pos_cnt;
|
||||
when DIR_COUNT_THRES_REG =>
|
||||
avs_readdata <= neg_dir_thres & pos_dir_thres;
|
||||
when DIR_COUNT_REG =>
|
||||
avs_readdata <= dir_change_cnt & dir_cnt;
|
||||
when ENC_SAMPL_PER_REG =>
|
||||
avs_readdata <= X"0" & sampling_period;
|
||||
when ENC_FIFO_CS_REG =>
|
||||
avs_readdata <= fifo_error & b"00000" & fifo_usedw & b"000000" & fifo_thres;
|
||||
when ENC_FIFO_OUT_REG =>
|
||||
avs_readdata <= fifo_q;
|
||||
when PD_FIFO_CS_REG =>
|
||||
avs_readdata <= pd_fifo_error & b"0000000" & pd_fifo_usedw & pd_log_src & b"0000000" & pd_fifo_thres;
|
||||
when PD_FIFO_OUT_REG =>
|
||||
avs_readdata <= pd_fifo_q;
|
||||
when PD_WATCH_DOG_CTRL =>
|
||||
avs_readdata <= (0 => pd_wd_en, 1 => clr_pd_pos, 4 => pd_wd_alarm, others => '0');
|
||||
when PD_WATCH_DOG_THRES =>
|
||||
avs_readdata <= pd_wd_thres;
|
||||
when IRQ_MNG_REG =>
|
||||
avs_readdata <= X"0000" & '0' & irq_val & '0' & irq_mask & '0' & irq_clr & '0' & irq_en;
|
||||
when others =>
|
||||
avs_readdata <= X"BAD1BAD0";
|
||||
end case;
|
||||
end if;
|
||||
end if;
|
||||
end process pCTRL_STATUS;
|
||||
|
||||
end architecture rtl;
|
||||
169
generic_ip/fire_pulse_manager/0/src/uart_regen_0.vhd
Normal file
169
generic_ip/fire_pulse_manager/0/src/uart_regen_0.vhd
Normal file
|
|
@ -0,0 +1,169 @@
|
|||
-------------------------------------------------------------------------------
|
||||
-- Title : uart_regen_0
|
||||
-- Project : EMB-1
|
||||
-------------------------------------------------------------------------------
|
||||
-- File : uart_regen_0.vhd
|
||||
-- Author : Gianmarco Girau
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2017-10-31
|
||||
-- Last update: 2019-01-03
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'08
|
||||
-------------------------------------------------------------------------------
|
||||
-- Description:
|
||||
-- Regenerate the UART signal
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
entity uart_regen_0 is
|
||||
generic(
|
||||
data_width : natural range 1 to 31);
|
||||
port(
|
||||
reset_n : in std_logic;
|
||||
clk : in std_logic;
|
||||
bit_div : in std_logic_vector(3 downto 0); -- number of clock cycles per tx bit
|
||||
enable : in std_logic;
|
||||
bypass_en : in std_logic;
|
||||
uart_rx : in std_logic;
|
||||
uart_tx : out std_logic);
|
||||
end entity uart_regen_0;
|
||||
|
||||
architecture rtl of uart_regen_0 is
|
||||
|
||||
component sync_wire
|
||||
generic (
|
||||
rst_val : std_logic;
|
||||
sync_stages : positive);
|
||||
port (
|
||||
rstN : in std_logic;
|
||||
clk : in std_logic;
|
||||
async_in : in std_logic;
|
||||
sync_out : out std_logic);
|
||||
end component;
|
||||
|
||||
type fsm_state_t is (s_init, s_idle, s_regen);
|
||||
|
||||
signal fsm_state_curr, fsm_state_next : fsm_state_t;
|
||||
--
|
||||
signal uart_rx_i, ld_data, rst_bit_cnt, inc_bit_cnt : std_logic;
|
||||
signal rst_clk_cnt, end_of_bit, end_of_rx : std_logic;
|
||||
signal uart_regen, uart_regen_i : std_logic;
|
||||
--
|
||||
signal clk_cnt : std_logic_vector(3 downto 0);
|
||||
signal bit_cnt : std_logic_vector(5 downto 0);
|
||||
|
||||
begin
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Input Synchronization
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
iSYNC_IN : sync_wire
|
||||
generic map (
|
||||
rst_val => '1',
|
||||
sync_stages => 3)
|
||||
port map (
|
||||
rstN => reset_n,
|
||||
clk => clk,
|
||||
async_in => uart_rx,
|
||||
sync_out => uart_rx_i);
|
||||
|
||||
-- NOTE : No NEED TO SYNCHRONIZE TO THE LOCAL CLOCK inputs enable, bypass_en
|
||||
-- and bit_biv BECAUSE THOSE SIGNALS ARE PREDOMINANTLY STATIC
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- UART registers and sequential logic
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
pREGs : process(clk)
|
||||
begin
|
||||
if(clk ='1' and clk'event) then
|
||||
if(rst_bit_cnt = '1') then
|
||||
bit_cnt <= (others => '0');
|
||||
elsif(inc_bit_cnt = '1') then
|
||||
bit_cnt <= std_logic_vector(unsigned(bit_cnt)+1);
|
||||
end if;
|
||||
if(rst_clk_cnt = '1' or end_of_bit = '1') then
|
||||
clk_cnt <= (others => '0');
|
||||
else
|
||||
clk_cnt <= std_logic_vector(unsigned(clk_cnt)+1);
|
||||
end if;
|
||||
if(enable = '0') then
|
||||
uart_regen_i <= '1';
|
||||
elsif(ld_data = '1') then
|
||||
uart_regen_i <= uart_rx_i;
|
||||
end if;
|
||||
uart_regen <= uart_regen_i;
|
||||
end if;
|
||||
end process pREGs;
|
||||
|
||||
end_of_bit <= '1' when unsigned(clk_cnt) = (unsigned(bit_div)-1) else '0';
|
||||
end_of_rx <= '1' when unsigned(bit_cnt) = data_width+1 else '0';
|
||||
|
||||
-- output mux
|
||||
uart_tx <= uart_rx when bypass_en = '1' else uart_regen;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- FSM
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
-- FSM state register
|
||||
pFSM_SR : process(clk)
|
||||
begin
|
||||
if(clk = '1' and clk'event) then
|
||||
if(enable = '0' or bypass_en = '1') then
|
||||
fsm_state_curr <= s_init;
|
||||
else
|
||||
fsm_state_curr <= fsm_state_next;
|
||||
end if;
|
||||
end if;
|
||||
end process pFSM_SR;
|
||||
|
||||
-- FSM Combinational Logic
|
||||
pFSM_CL : process(fsm_state_curr, uart_rx_i, end_of_bit, end_of_rx, clk_cnt, bit_div)
|
||||
begin
|
||||
--default assignments
|
||||
rst_clk_cnt <= '0';
|
||||
rst_bit_cnt <= '0';
|
||||
inc_bit_cnt <= '0';
|
||||
ld_data <= '0';
|
||||
--
|
||||
fsm_state_next <= fsm_state_curr;
|
||||
|
||||
case fsm_state_curr is
|
||||
when s_init =>
|
||||
if(uart_rx_i = '1') then
|
||||
fsm_state_next <= s_idle;
|
||||
end if;
|
||||
|
||||
when s_idle =>
|
||||
if(uart_rx_i = '0') then
|
||||
rst_clk_cnt <= '1';
|
||||
rst_bit_cnt <= '1';
|
||||
fsm_state_next <= s_regen;
|
||||
end if;
|
||||
|
||||
when s_regen =>
|
||||
if(unsigned(clk_cnt) = (unsigned(bit_div(bit_div'high downto 1))-1)) then
|
||||
ld_data <= '1';
|
||||
end if;
|
||||
if(end_of_bit = '1') then
|
||||
inc_bit_cnt <= '1';
|
||||
if(end_of_rx = '1') then
|
||||
if(uart_rx_i = '1') then
|
||||
fsm_state_next <= s_idle;
|
||||
else
|
||||
fsm_state_next <= s_init;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
|
||||
when others => null;
|
||||
end case;
|
||||
end process pFSM_CL;
|
||||
|
||||
|
||||
end architecture rtl;
|
||||
|
|
@ -162,40 +162,40 @@ add_interface_port reset reset_n reset_n Input 1
|
|||
|
||||
|
||||
#
|
||||
# connection point avalon_slave
|
||||
# connection point avs
|
||||
#
|
||||
add_interface avalon_slave avalon end
|
||||
set_interface_property avalon_slave addressUnits WORDS
|
||||
set_interface_property avalon_slave associatedClock clock
|
||||
set_interface_property avalon_slave associatedReset reset
|
||||
set_interface_property avalon_slave bitsPerSymbol 8
|
||||
set_interface_property avalon_slave burstOnBurstBoundariesOnly false
|
||||
set_interface_property avalon_slave burstcountUnits WORDS
|
||||
set_interface_property avalon_slave explicitAddressSpan 0
|
||||
set_interface_property avalon_slave holdTime 0
|
||||
set_interface_property avalon_slave linewrapBursts false
|
||||
set_interface_property avalon_slave maximumPendingReadTransactions 0
|
||||
set_interface_property avalon_slave maximumPendingWriteTransactions 0
|
||||
set_interface_property avalon_slave readLatency 0
|
||||
set_interface_property avalon_slave readWaitTime 1
|
||||
set_interface_property avalon_slave setupTime 0
|
||||
set_interface_property avalon_slave timingUnits Cycles
|
||||
set_interface_property avalon_slave writeWaitTime 0
|
||||
set_interface_property avalon_slave ENABLED true
|
||||
set_interface_property avalon_slave EXPORT_OF ""
|
||||
set_interface_property avalon_slave PORT_NAME_MAP ""
|
||||
set_interface_property avalon_slave CMSIS_SVD_VARIABLES ""
|
||||
set_interface_property avalon_slave SVD_ADDRESS_GROUP ""
|
||||
add_interface avs avalon end
|
||||
set_interface_property avs addressUnits WORDS
|
||||
set_interface_property avs associatedClock clock
|
||||
set_interface_property avs associatedReset reset
|
||||
set_interface_property avs bitsPerSymbol 8
|
||||
set_interface_property avs burstOnBurstBoundariesOnly false
|
||||
set_interface_property avs burstcountUnits WORDS
|
||||
set_interface_property avs explicitAddressSpan 0
|
||||
set_interface_property avs holdTime 0
|
||||
set_interface_property avs linewrapBursts false
|
||||
set_interface_property avs maximumPendingReadTransactions 0
|
||||
set_interface_property avs maximumPendingWriteTransactions 0
|
||||
set_interface_property avs readLatency 0
|
||||
set_interface_property avs readWaitTime 1
|
||||
set_interface_property avs setupTime 0
|
||||
set_interface_property avs timingUnits Cycles
|
||||
set_interface_property avs writeWaitTime 0
|
||||
set_interface_property avs ENABLED true
|
||||
set_interface_property avs EXPORT_OF ""
|
||||
set_interface_property avs PORT_NAME_MAP ""
|
||||
set_interface_property avs CMSIS_SVD_VARIABLES ""
|
||||
set_interface_property avs SVD_ADDRESS_GROUP ""
|
||||
|
||||
add_interface_port avalon_slave avs_address address Input 6
|
||||
add_interface_port avalon_slave avs_write write Input 1
|
||||
add_interface_port avalon_slave avs_writedata writedata Input 32
|
||||
add_interface_port avalon_slave avs_read read Input 1
|
||||
add_interface_port avalon_slave avs_readdata readdata Output 32
|
||||
set_interface_assignment avalon_slave embeddedsw.configuration.isFlash 0
|
||||
set_interface_assignment avalon_slave embeddedsw.configuration.isMemoryDevice 0
|
||||
set_interface_assignment avalon_slave embeddedsw.configuration.isNonVolatileStorage 0
|
||||
set_interface_assignment avalon_slave embeddedsw.configuration.isPrintableDevice 0
|
||||
add_interface_port avs avs_address address Input 6
|
||||
add_interface_port avs avs_write write Input 1
|
||||
add_interface_port avs avs_writedata writedata Input 32
|
||||
add_interface_port avs avs_read read Input 1
|
||||
add_interface_port avs avs_readdata readdata Output 32
|
||||
set_interface_assignment avs embeddedsw.configuration.isFlash 0
|
||||
set_interface_assignment avs embeddedsw.configuration.isMemoryDevice 0
|
||||
set_interface_assignment avs embeddedsw.configuration.isNonVolatileStorage 0
|
||||
set_interface_assignment avs embeddedsw.configuration.isPrintableDevice 0
|
||||
|
||||
|
||||
#
|
||||
|
|
@ -50,7 +50,7 @@
|
|||
"minor_number" : {
|
||||
"type" : "c",
|
||||
"bit_len" : "8",
|
||||
"reset" : "0x01",
|
||||
"reset" : "0x02",
|
||||
"description" : "Minor number"
|
||||
},
|
||||
"major_number" : {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
-- Author : Gianmarco Girau
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2016-10-24
|
||||
-- Last update: 2018-12-20
|
||||
-- Last update: 2019-01-17
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'93
|
||||
-------------------------------------------------------------------------------
|
||||
|
|
@ -67,7 +67,7 @@ architecture rtl of pulse_generator_1 is
|
|||
-- constants
|
||||
|
||||
constant CSR_IP_ID : std_logic_vector(31 downto 0) := x"0000FF13";
|
||||
constant CSR_IP_VER : std_logic_vector(31 downto 0) := x"00000101";
|
||||
constant CSR_IP_VER : std_logic_vector(31 downto 0) := x"00000102";
|
||||
|
||||
|
||||
signal init_de, init_qd, enable, loc_pd, pd_queue_error : std_logic;
|
||||
|
|
@ -407,7 +407,7 @@ begin
|
|||
wave_out => retimed_pulse,
|
||||
ovf_error => de_queue_error);
|
||||
|
||||
init_de <= not enable;
|
||||
init_de <= (not enable) or bypass_delay_equal;
|
||||
|
||||
end generate gPULSE_DELAY_EQUAL;
|
||||
|
||||
|
|
@ -415,6 +415,8 @@ begin
|
|||
|
||||
retimed_pulse <= gated_pulse;
|
||||
|
||||
de_queue_error <= '0';
|
||||
|
||||
end generate gNOT_PULSE_DELAY_EQUAL;
|
||||
|
||||
p_delay_equal_switch : process(clk)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue