]> jspc29.x-matter.uni-frankfurt.de Git - trbnet.git/commitdiff
Include I2C to hub, add onewire monitor for old designs
authorJan Michel <j.michel@gsi.de>
Thu, 19 Nov 2020 09:31:56 +0000 (10:31 +0100)
committerJan Michel <j.michel@gsi.de>
Thu, 19 Nov 2020 16:33:46 +0000 (17:33 +0100)
trb_net16_hub_base.vhd
trb_net16_hub_streaming_port_sctrl_accel.vhd

index f126196e23a563eec6a496462ba667da5c449cf6..7b3f0c40a7694372b5250376022feab5568c3095 100644 (file)
@@ -33,7 +33,7 @@ entity trb_net16_hub_base is
     USE_VAR_ENDPOINT_ID     : integer range c_NO to c_YES := c_NO;
     HARDWARE_VERSION        : std_logic_vector(31 downto 0) := x"12345678";
     CLOCK_FREQUENCY         : integer range 1 to 200 := 100;
-    USE_ONEWIRE             : integer range 0 to 2 := c_YES;
+    USE_ONEWIRE             : integer range 0 to 3 := c_YES;
     BROADCAST_SPECIAL_ADDR  : std_logic_vector(7 downto 0) := x"FF";
   --media interfaces
     MII_NUMBER              : integer range 0 to c_MAX_MII_PER_HUB := 4;
@@ -81,6 +81,8 @@ entity trb_net16_hub_base is
     INT_REPLY_PACKET_NUM_IN   : in  std_logic_vector (INT_NUMBER*c_NUM_WIDTH downto 0) := (others => '0');
     INT_REPLY_READ_OUT        : out std_logic_vector (INT_NUMBER downto 0);
     ONEWIRE                      : inout std_logic;
+    I2C_SCL                      : inout std_logic;
+    I2C_SDA                      : inout std_logic;    
     ONEWIRE_MONITOR_IN           : in  std_logic := '0';
     ONEWIRE_MONITOR_OUT          : out std_logic;
     COMMON_STAT_REGS             : in  std_logic_vector (std_COMSTATREG*32-1 downto 0) := (others => '0');  --Status of common STAT regs
@@ -1260,6 +1262,32 @@ THE_BUS_HANDLER : trb_net16_regio_bus_handler
         );
   end generate;
 
+  gen_i2c : if USE_ONEWIRE = c_I2C generate
+    ONEWIRE_MONITOR_OUT <= '0';
+    ONEWIRE       <= '0';
+    i2c_interface : trb_net_i2cwire
+      generic map(
+        USE_TEMPERATURE_READOUT => c_YES,
+        CLK_PERIOD => 10
+        )
+      port map(
+        CLK               => CLK,
+        RESET             => reset_i,
+        READOUT_ENABLE_IN => '1',
+        --connection to I2C interface
+        SCL_INOUT         => I2C_SCL,
+        SDA_INOUT         => I2C_SDA,
+        --connection to id ram, according to memory map in TrbNetRegIO
+        DATA_OUT          => ONEWIRE_DATA,
+        ADDR_OUT          => ONEWIRE_ADDR,
+        WRITE_OUT         => ONEWIRE_WRITE,
+        TEMP_OUT          => TEMP_OUT,
+        ID_OUT            => UNIQUE_ID_OUT,                
+        STAT              => open
+        );
+  end generate;  
+  
+  
 -------------------------------------------------
 -- Include variable Endpoint ID
 -------------------------------------------------
index c969f0546e927cb7b845387eba1ff0feb2cb68be..b93a2cd0573790a79205ca3baaff8408adef0f53 100644 (file)
@@ -86,6 +86,7 @@ entity trb_net16_hub_streaming_port_sctrl_record is
     COMMON_STAT_REGS             : out std_logic_vector (std_COMSTATREG*32-1 downto 0);  --Status of common STAT regs
     COMMON_CTRL_REGS             : out std_logic_vector (std_COMCTRLREG*32-1 downto 0);  --Status of common STAT regs
     ONEWIRE                      : inout std_logic;
+    ONEWIRE_MONITOR_OUT          : out std_logic;
     MY_ADDRESS_OUT               : out std_logic_vector(15 downto 0);
     UNIQUE_ID_OUT                : out std_logic_vector (63 downto 0);
     EXTERNAL_SEND_RESET          : in  std_logic := '0';
@@ -175,7 +176,8 @@ signal HUB_MED_CTRL_OP   : std_logic_vector(mii*16-1 downto 0);
 signal reset_i_mux_io    : std_logic;
 
 signal hub_make_network_reset : std_logic := '0';
-signal hub_got_network_reset  : std_logic;
+signal hub_got_network_reset  : std_logic;\r
+signal timer_i                : TIMERS;
 signal timer_ticks            : std_logic_vector(1 downto 0);
 signal hub_ctrl_debug         : std_logic_vector(31 downto 0);
 signal buf_HUB_STAT_GEN       : std_logic_vector(31 downto 0);
@@ -333,11 +335,11 @@ end generate;
       REGIO_UNKNOWN_ADDR_IN     => hubbus_tx.unknown,
       REGIO_TIMEOUT_OUT         => hubbus_rx.timeout,
 
-      TIMER_TICKS_OUT(0)        => TIMER.tick_us,
-      TIMER_TICKS_OUT(1)        => TIMER.tick_ms,
+      TIMER_TICKS_OUT(0)        => timer_i.tick_us,
+      TIMER_TICKS_OUT(1)        => timer_i.tick_ms,
       ONEWIRE            => ONEWIRE,
       ONEWIRE_MONITOR_IN => '0',
-      ONEWIRE_MONITOR_OUT=> open,
+      ONEWIRE_MONITOR_OUT=> ONEWIRE_MONITOR_OUT,
       MY_ADDRESS_OUT     => my_address,
       UNIQUE_ID_OUT      => UNIQUE_ID_OUT,
       COMMON_CTRL_REGS   => common_ctrl,
@@ -354,7 +356,8 @@ end generate;
   hub_ctrl_debug(2 downto 0) <= not io_error_in;
   hub_ctrl_debug(31 downto 3) <= (others => '0');
   HUB_STAT_GEN <= buf_HUB_STAT_GEN;
-  timer_ticks <= TIMER.tick_ms & TIMER.tick_us;
+  timer_ticks <= timer_i.tick_ms & timer_i.tick_us;\r
+  TIMER <= timer_i;
   
 ---------------------------------------------------------------------
 -- I/O Buffers