]> jspc29.x-matter.uni-frankfurt.de Git - trbnet.git/commitdiff
*** empty log message ***
authorhadeshyp <hadeshyp>
Wed, 26 Aug 2009 15:09:42 +0000 (15:09 +0000)
committerhadeshyp <hadeshyp>
Wed, 26 Aug 2009 15:09:42 +0000 (15:09 +0000)
trb_net16_hub_ipu_logic.vhd

index 8d7d015f1c6f6daf1c4170dd304c531bfdb18c63..9563b571527384292550cdaf5a39b7d584cd1d3b 100644 (file)
@@ -54,6 +54,8 @@ architecture trb_net16_hub_ipu_logic_arch of trb_net16_hub_ipu_logic is
   -- for whole architecture
   attribute HGROUP of trb_net16_hub_ipu_logic_arch : architecture  is "HUBIPULOGIC_group";
 
+  constant DISABLE_PACKING : integer := 1;
+
 --signals init_pool
   signal INIT_POOL_DATAREADY                 : std_logic;
   signal INIT_POOL_READ                      : std_logic;
@@ -109,7 +111,7 @@ architecture trb_net16_hub_ipu_logic_arch of trb_net16_hub_ipu_logic is
   signal REPLY_MUX_reading                   : std_logic_vector(POINT_NUMBER-1 downto 0);
   signal reply_arbiter_result                : std_logic_vector(POINT_NUMBER-1 downto 0);
 
-  type state_type is (IDLE, WAIT_FOR_REPLY, WAIT_FOR_HDR_DATA, GEN_LENGTH, CHECK_DHDR, SENDING_DATA, SENDING_REPLY_TRM, SEND_PADDING, WAITING_FOR_INIT);
+  type state_type is (IDLE, WAIT_FOR_REPLY, CHECK_EVENT_INFO, WAIT_FOR_HDR_DATA, GEN_LENGTH, CHECK_DHDR, SENDING_DATA, SENDING_REPLY_TRM, SEND_PADDING, WAITING_FOR_INIT);
   signal current_state, next_state           : state_type;
   signal packet_counter                      : std_logic_vector(c_NUM_WIDTH-1 downto 0);
   signal reply_data_counter                  : unsigned(15 downto 0);
@@ -454,7 +456,7 @@ begin
       end process;
 
     current_reply_packet_type((i+1)*3-1 downto i*3) <= REPLY_DATA_IN(i*c_DATA_WIDTH+2 downto i*c_DATA_WIDTH)
-                  when (REPLY_PACKET_NUM_IN(i*c_NUM_WIDTH+2 downto i*c_NUM_WIDTH) = c_H0)
+                  when (REPLY_PACKET_NUM_IN(i*c_NUM_WIDTH+2 downto i*c_NUM_WIDTH) = c_H0 and REPLY_DATAREADY_IN(i) = '1')
                   else saved_reply_packet_type((i+1)*3-1 downto i*3);
 
     current_reply_reading_HDR(i)  <= '1' when current_reply_packet_type((i+1)*3-1 downto i*3) = TYPE_HDR else '0';
@@ -499,7 +501,7 @@ begin
         if reg_current_reply_reading_HDR(i) = '1' then
           reg_current_reply_auto_reading_DHDR(i) <= '1';
         elsif reg_current_reply_reading_DHDR(i) = '1' then
---           if enable_packing = '0' then
+          if enable_packing = '0' or DISABLE_PACKING = 1 then
             if    last_REPLY_PACKET_NUM_IN(i*3+2 downto i*3) = c_F1
                or last_REPLY_PACKET_NUM_IN(i*3+2 downto i*3) = c_F2
                or last_REPLY_PACKET_NUM_IN(i*3+2 downto i*3) = c_F3 then
@@ -507,13 +509,13 @@ begin
             else
               reg_current_reply_auto_reading_DHDR(i) <= '1';
             end if;
---           else
---             if last_REPLY_PACKET_NUM_IN(i*3+2 downto i*3) = c_F3 then
---               reg_current_reply_auto_reading_DHDR(i) <= '0';
---             else
---               reg_current_reply_auto_reading_DHDR(i) <= '1';
---             end if;
---           end if;
+          else
+            if last_REPLY_PACKET_NUM_IN(i*3+2 downto i*3) = c_F3 then
+              reg_current_reply_auto_reading_DHDR(i) <= '0';
+            else
+              reg_current_reply_auto_reading_DHDR(i) <= '1';
+            end if;
+          end if;
         end if;
       end process;
 
@@ -920,16 +922,16 @@ begin
           next_waiting_for_DHDR_word <= not (locking_point or not real_activepoints);
           next_current_waiting_for_reply <= not (locking_point or not real_activepoints);
           if locked = '1' then
-            next_state <= WAIT_FOR_REPLY; --WAIT_FOR_HDR_DATA;
+            next_state <= WAIT_FOR_REPLY;
           end if;
 
         when WAIT_FOR_REPLY =>
-          if got_all_reply_starts = '1' then
+          if got_all_DHDR = '1'  then  --got_all_reply_starts = '1'
             next_state <= WAIT_FOR_HDR_DATA;
           end if;
 
         when WAIT_FOR_HDR_DATA =>  --start writing HDR when first reply is received, stop waiting for length
-          dhdr_addr <= "010";
+          dhdr_addr <= "100";
           case packet_counter is
             when c_H0 =>
               comb_REPLY_POOL_DATA <= (others => '0');
@@ -943,20 +945,29 @@ begin
               comb_REPLY_POOL_DATAREADY <= REPLY_POOL_next_read;
             when c_F2 =>
               comb_REPLY_POOL_DATAREADY <= '0';
-              if not_reading_HDR = '1' and got_all_DHDR = '1' then --implicit not waiting_for_reply
-                next_state <= GEN_LENGTH;
-                next_reply_adder_start <= '1';
-              end if;
+              next_reply_compare_start <= '1';
+--              if not_reading_HDR = '1' and got_all_DHDR = '1' then --implicit not waiting_for_reply
+              next_state <= CHECK_EVENT_INFO;
+--              end if;
             when others => null;
           end case;
 
+        when CHECK_EVENT_INFO =>
+          dhdr_addr <= "100";
+          if reply_compare_finished = '1' then
+            dhdr_addr <= "010";
+            next_reply_adder_start <= '1';
+            next_state <= GEN_LENGTH;
+          end if;
+
+
         when GEN_LENGTH =>  --now, all HDR are stored, calc sum of HDR lengths
           dhdr_addr <= "010";
---           if enable_packing = '0' then
+          if enable_packing = '0' or DISABLE_PACKING = 1 then
             next_reply_adder_final_result <= std_logic_vector(unsigned(reply_adder_result) - number_of_replies + 2);
---           else
---             next_reply_adder_final_result <= std_logic_vector(unsigned(reply_adder_result) - number_of_replies - number_of_replies + 2);
---           end if;
+          else
+            next_reply_adder_final_result <= std_logic_vector(unsigned(reply_adder_result) - number_of_replies - number_of_replies + 2);
+          end if;
           comb_REPLY_POOL_DATAREADY <= '0';
 
           case packet_counter is
@@ -999,11 +1010,11 @@ begin
               end if;
             when c_F2 =>
               dhdr_addr <= "110";
---               if enable_packing = '0' then
+              if enable_packing = '0' or DISABLE_PACKING = 1 then
                 next_reply_adder_final_result <= std_logic_vector(unsigned(reply_adder_result) + number_of_replies);
---               else
---                 next_reply_adder_final_result <= std_logic_vector(unsigned(reply_adder_result));
---               end if;
+              else
+                next_reply_adder_final_result <= std_logic_vector(unsigned(reply_adder_result));
+              end if;
               if last_reply_adder_ready = '1' then
                 comb_REPLY_POOL_DATA <= reply_adder_final_result;
                 comb_REPLY_POOL_DATAREADY <= REPLY_POOL_next_read;