From: Ludwig Maier Date: Wed, 26 Aug 2015 18:13:03 +0000 (+0200) Subject: added RICH ADCM Project X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=c177720b61735edcdf9b0ae7de4b2e56405d150d;p=trb3.git added RICH ADCM Project --- diff --git a/adcm b/adcm new file mode 160000 index 0000000..5eb394d --- /dev/null +++ b/adcm @@ -0,0 +1 @@ +Subproject commit 5eb394df43c0c0e662178527d0ecd2596b44e01b diff --git a/scaler/nodelist.txt b/scaler/nodelist.txt index 5f6232f..3754493 100755 --- a/scaler/nodelist.txt +++ b/scaler/nodelist.txt @@ -1,10 +1,10 @@ -[pbs1] +[pbs2] system = linux corenum = 2 env = /usr/local/opt/lattice_diamond/diamond/3.4/bin/lin64/diamond_env workdir = /home/rich/TRB/nXyter/trb3/scaler/workdir/ -[pbs2] +[pbs1] system = linux corenum = 2 env = /usr/local/opt/lattice_diamond/diamond/3.4/bin/lin64/diamond_env diff --git a/scaler/source/scaler_channel.vhd b/scaler/source/scaler_channel.vhd index 33cc7ed..4a67842 100644 --- a/scaler/source/scaler_channel.vhd +++ b/scaler/source/scaler_channel.vhd @@ -83,7 +83,8 @@ architecture Behavioral of scaler_channel is signal slv_no_more_data_o : std_logic; signal slv_unknown_addr_o : std_logic; signal slv_ack_o : std_logic; - signal counter_latched_offset : std_logic_vector(15 downto 0); + signal counter_latched_offset_sign : std_logic; -- 1 = + + signal counter_latched_offset : unsigned(15 downto 0); ----------------------------------------------------------------------------- @@ -212,28 +213,22 @@ begin counter_low_ovfl <= '0'; latch <= '0'; else - counter_low <= (others => '0'); - counter_low_ovfl <= '0'; - latch <= '0'; + counter_low <= (others => '0'); + counter_low_ovfl <= '0'; + latch <= '0'; if (fifo_data_clk = '1') then - counter_low <= (others => '0'); - counter_low_ovfl <= '0'; - latch <= '0'; + counter_low <= fifo_data(2 downto 0); + counter_low_ovfl <= fifo_data(3); + latch <= fifo_data(4); -- High Bit Counter if (fifo_data(5) = '1') then -- in case of Reset Counters counter_high <= (others => '0'); else if (fifo_data(3) = '1') then -- in case of overflow - counter_low <= fifo_data(2 downto 0); - counter_low_ovfl <= fifo_data(3); counter_high <= counter_high + 1; end if; - - if (fifo_data(4) = '1') then - latch <= '1'; - end if; end if; end if; end if; @@ -241,6 +236,7 @@ begin end process PROC_FIFO_OUTPUT_HANDLER; PROC_LATCH: process(CLK_IN) + variable counter_latched_new : unsigned(47 downto 0); begin if (rising_edge(CLK_IN)) then if (RESET_IN = '1') then @@ -249,8 +245,16 @@ begin else data_clk <= '0'; if (latch = '1') then - counter_latched(2 downto 0) <= counter_low; - counter_latched(47 downto 3) <= counter_high; + counter_latched_new(2 downto 0) := unsigned(counter_low); + counter_latched_new(47 downto 3) := unsigned(counter_high); + if (counter_latched_offset_sign = '0') then + counter_latched_new := + counter_latched_new - resize(counter_latched_offset, 47); + else + counter_latched_new := + counter_latched_new + resize(counter_latched_offset, 47); + end if; + counter_latched <= std_logic_vector(counter_latched_new); data_clk <= '1'; end if; end if; @@ -265,26 +269,29 @@ begin begin if( rising_edge(CLK_IN) ) then if( RESET_IN = '1' ) then - slv_data_out_o <= (others => '0'); - slv_no_more_data_o <= '0'; - slv_unknown_addr_o <= '0'; - slv_ack_o <= '0'; + slv_data_out_o <= (others => '0'); + slv_no_more_data_o <= '0'; + slv_unknown_addr_o <= '0'; + slv_ack_o <= '0'; - counter_latched_offset <= (others => '0'); - data_reg <= (others => '0'); + counter_latched_offset <= (others => '0'); + counter_latched_offset_sign <= '0'; + data_reg <= (others => '0'); else - slv_unknown_addr_o <= '0'; - slv_no_more_data_o <= '0'; - slv_data_out_o <= (others => '0'); + slv_unknown_addr_o <= '0'; + slv_no_more_data_o <= '0'; + slv_data_out_o <= (others => '0'); if (data_clk = '1') then - data_reg <= counter_latched; + data_reg <= counter_latched; end if; if (SLV_WRITE_IN = '1') then case SLV_ADDR_IN is when x"0000" => - counter_latched_offset <= SLV_DATA_IN(15 downto 0); + counter_latched_offset(15 downto 0) <= + unsigned(SLV_DATA_IN(15 downto 0)); + counter_latched_offset_sign <= SLV_DATA_IN(31); slv_ack_o <= '1'; when others => @@ -295,8 +302,10 @@ begin elsif (SLV_READ_IN = '1') then case SLV_ADDR_IN is when x"0000" => - slv_data_out_o(15 downto 0) <= counter_latched_offset; - slv_data_out_o(31 downto 16) <= (others => '0'); + slv_data_out_o(15 downto 0) <= + std_logic_vector(counter_latched_offset); + slv_data_out_o(30 downto 16) <= (others => '0'); + slv_data_out_o(31) <= counter_latched_offset_sign; slv_ack_o <= '1'; when x"0001" => diff --git a/scaler/trb3_periph_scaler.p2t b/scaler/trb3_periph_scaler.p2t index 50c73f9..9f1cba2 100644 --- a/scaler/trb3_periph_scaler.p2t +++ b/scaler/trb3_periph_scaler.p2t @@ -1,7 +1,7 @@ -w -i 2 -l 5 --n 4 +-n 2 -t 10 -s 1 -c 1