From: Jan Michel Date: Tue, 23 Aug 2022 15:24:56 +0000 (+0200) Subject: add adc reader to components, add new memory file X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=6271736cb401f87139736060800fb6510cb5bd65;p=trbnet.git add adc reader to components, add new memory file --- diff --git a/basics/ram_dp_19x8_preset.vhd b/basics/ram_dp_19x8_preset.vhd new file mode 100644 index 0000000..6725f1a --- /dev/null +++ b/basics/ram_dp_19x8_preset.vhd @@ -0,0 +1,44 @@ +LIBRARY IEEE; +USE IEEE.std_logic_1164.ALL; +USE IEEE.std_logic_ARITH.ALL; +USE IEEE.std_logic_UNSIGNED.ALL; + +library work; +use work.trb_net_std.all; + +entity ram_dp_19x8_preset is + generic( + depth : integer := 3; + width : integer := 20; + content : std_logic_vector_array_20(0 to 7) := (others => (others => '0')) + ); + port( + CLK : in std_logic; + wr1 : in std_logic; + a1 : in std_logic_vector(depth-1 downto 0); + dout1 : out std_logic_vector(width-1 downto 0); + din1 : in std_logic_vector(width-1 downto 0); + a2 : in std_logic_vector(depth-1 downto 0); + dout2 : out std_logic_vector(width-1 downto 0) + ); +end entity; + +architecture ram_dp_arch of ram_dp_19x8_preset is + --type ram_t is array(0 to 2**depth-1) of std_logic_vector(width-1 downto 0); + SIGNAL ram : std_logic_vector_array_20(0 to 7) := content; + +begin + + + process(CLK) + begin + if rising_edge(CLK) then + if wr1 = '1' then + ram(conv_integer(a1)) <= din1; + end if; + dout1 <= ram(conv_integer(a1)); + dout2 <= ram(conv_integer(a2)); + end if; + end process; + +end architecture; diff --git a/trb_net_components.vhd b/trb_net_components.vhd index 9dd5cb8..c0c81c0 100644 --- a/trb_net_components.vhd +++ b/trb_net_components.vhd @@ -7,7 +7,26 @@ use work.trb_net_std.all; package trb_net_components is - +component adc_controller is + generic ( + CH1_CMD : STD_LOGIC_VECTOR(19 downto 0) := x"1c3cb"; + CH2_CMD : STD_LOGIC_VECTOR(19 downto 0) := x"1d5cb"; + CH3_CMD : STD_LOGIC_VECTOR(19 downto 0) := x"2e3cb"; + CH4_CMD : STD_LOGIC_VECTOR(19 downto 0) := x"2f5cb"; + TMP_CMD : STD_LOGIC_VECTOR(19 downto 0) := x"1F393" + ); + port ( + CLK : in std_logic; + RST : in std_logic; + BUS_RX : in CTRLBUS_RX; + BUS_TX : out CTRLBUS_TX; + + ADC_CS : out std_logic; + ADC_MOSI : out std_logic; + ADC_MISO : in std_logic; + ADC_CLK : out std_logic + ); +end component; --This list of components is sorted alphabetically, ignoring the trb_net or trb_net16 prefix of some component names component gbe_wrapper is @@ -2850,7 +2869,22 @@ end component; end component; - + component ram_dp_19x8_preset is + generic( + depth : integer := 3; + width : integer := 20; + content : std_logic_vector_array_20(0 to 7) := (others => (others => '0')) + ); + port( + CLK : in std_logic; + wr1 : in std_logic; + a1 : in std_logic_vector(depth-1 downto 0); + dout1 : out std_logic_vector(width-1 downto 0); + din1 : in std_logic_vector(width-1 downto 0); + a2 : in std_logic_vector(depth-1 downto 0); + dout2 : out std_logic_vector(width-1 downto 0) + ); + end component; component trb_net16_regIO is generic ( diff --git a/trb_net_std.vhd b/trb_net_std.vhd index c442f05..5e5abf3 100644 --- a/trb_net_std.vhd +++ b/trb_net_std.vhd @@ -260,6 +260,7 @@ package trb_net_std is type std_logic_vector_array_32 is array (integer range <>) of std_logic_vector(31 downto 0); type std_logic_vector_array_31 is array (integer range <>) of std_logic_vector(30 downto 0); type std_logic_vector_array_24 is array (integer range <>) of std_logic_vector(23 downto 0); + type std_logic_vector_array_20 is array (integer range <>) of std_logic_vector(19 downto 0); type std_logic_vector_array_11 is array (integer range <>) of std_logic_vector(10 downto 0); type std_logic_vector_array_8 is array (integer range <>) of std_logic_vector(7 downto 0); type int_array_t is array(integer range <>) of integer;