]> jspc29.x-matter.uni-frankfurt.de Git - trb5sc.git/commitdiff
update mimosis standalone design: add missing I2C port, reduce buffer size master
authorJan Michel <michel@physik.uni-frankfurt.de>
Fri, 10 Jan 2025 11:35:23 +0000 (12:35 +0100)
committerJan Michel <michel@physik.uni-frankfurt.de>
Fri, 10 Jan 2025 11:37:58 +0000 (12:37 +0100)
mimosis/code/MimosisInput.vhd
mimosis/trb5sc_mimosis.vhd
mimosis_standalone/config.vhd
mimosis_standalone/trb5sc_mimosis.vhd

index 5935f82df494f195229eb33952108b39ed71cf82..33c8f05e97ff7e4488e33562eac7ab3831b65ecb 100644 (file)
@@ -25,7 +25,7 @@ end entity;
 
 architecture arch of MimosisInput is
   constant HDR_WORD  : std_logic_vector(15 downto 0) := x"FE00";
-  constant WORD_LIMIT : integer := 8500;
+  constant WORD_LIMIT : integer := 4000;
   signal input_active_i : std_logic;
   signal data_i : std_logic_vector(15 downto 0);
   signal inp_i  : std_logic_vector(7 downto 0);
@@ -205,7 +205,7 @@ THE_FIFO :  entity work.fifo_36x8k_oreg
     WrEn                   =>  buffer_write,
     RdEn                   =>  buffer_read,
     Reset                  =>  RESET,
-    AmFullThresh           =>  "1000000000000",
+    AmFullThresh           =>  "0010000000000",
     Q(31 downto 0)         =>  buffer_dout,
     WCNT                   =>  buffer_fill,
     Empty                  =>  buffer_empty,
index a8c2792aca07ca8fe3ccf15111ce4d7bc9a1ab3c..e842da21e02a5e616c31e2b3535b6d30246dc082 100644 (file)
@@ -455,8 +455,8 @@ begin
 \r
   PIN(4) <= MIMOSIS_SDA;\r
   PIN(3) <= MIMOSIS_SCL;\r
-  MIMOSIS_SDA <= '0' when (mimosis_sda_drv = '0') else 'Z';\r
-  MIMOSIS_SCL <= '0' when (mimosis_scl_drv = '0') else 'Z';\r
+  MIMOSIS_SDA <= '0' when (mimosis_sda_drv = '0' or i2c_reg_1(31) = '1') else 'Z';\r
+  MIMOSIS_SCL <= '0' when (mimosis_scl_drv = '0' or i2c_reg_1(30) = '1') else 'Z';\r
 \r
   H3(1)  <= i2c_reg_5_40(0);  --MIMOSIS_SYNC\r
   PIN(1) <= i2c_reg_5_40(4);  --MIMOSIS_START\r
index ea83682153f29296d44b59165cb296369ad431d9..c8cf18cb433993169d536438f07aa09d98305f98 100644 (file)
@@ -36,8 +36,8 @@ package config is
 --   -- 14: Debug - single fine time and the ROM addresses for the two transitions
 --   -- 15: Debug - complete carry chain dump
 
-  constant EVENT_BUFFER_SIZE        : integer range 9 to 15 := 10; -- size of the event buffer, 2**N
-  constant EVENT_MAX_SIZE           : integer := 500;             --maximum event size. Must not exceed EVENT_BUFFER_SIZE/2
+  constant EVENT_BUFFER_SIZE        : integer range 9 to 15 := 13; -- size of the event buffer, 2**N
+  constant EVENT_MAX_SIZE           : integer := 4095;             --maximum event size. Must not exceed EVENT_BUFFER_SIZE/2
   constant USE_GBE                  : integer := c_YES;
 
 --Runs with 120 MHz instead of 100 MHz     
@@ -47,13 +47,13 @@ package config is
     constant USE_RXCLOCK            : integer := c_NO;
    
 --Address settings   
-    constant INIT_ADDRESS           : std_logic_vector := x"F586";
-    constant BROADCAST_SPECIAL_ADDR : std_logic_vector := x"86";
+    constant INIT_ADDRESS           : std_logic_vector := x"F575";
+    constant BROADCAST_SPECIAL_ADDR : std_logic_vector := x"82";
    
     constant INCLUDE_UART           : integer  := c_NO;
     constant INCLUDE_SPI            : integer  := c_YES;
     constant INCLUDE_ADC            : integer  := c_YES; 
-    constant INCLUDE_I2C            : integer  := c_NO;
+    constant INCLUDE_I2C            : integer  := c_YES;
     constant INCLUDE_DEBUG_INTERFACE: integer  := c_NO;
 
     --input monitor and trigger generation logic
@@ -74,6 +74,7 @@ package config is
     constant PERIPH_TRIGGER_COUNT    : integer := 0;
     constant ADDON_LINE_COUNT        : integer := 1;  --36 with Padiwa, 22 with RJ-adapter
     constant CTS_OUTPUT_MULTIPLEXERS : integer := 0;
+    constant CTS_NOREADOUT           : integer := 1;  --no data in readout from CTS
 --TODO:
 --     constant INCLUDE_MBS_MASTER : integer range c_NO to c_YES := c_NO;
 --Which external trigger module (ETM) to use?
index a7d2d58423e6f6f16914ab241a48498b6b9f986f..ac0c67bdaf514c2574bb4abb24cd5a015a09c82b 100644 (file)
@@ -43,7 +43,7 @@ entity trb5sc_mimosis is
     H6 : inout std_logic_vector(4 downto 0);\r
     H7 : inout std_logic_vector(4 downto 0);\r
 \r
-    PIN : out std_logic_vector(8 downto 1);\r
+    PIN : inout std_logic_vector(8 downto 1);\r
 \r
     MIMOSIS_SCL, MIMOSIS_SDA : inout std_logic;\r
 \r
@@ -294,6 +294,7 @@ begin
       UP_DOWN_MODE              => 0,\r
       UP_DOWN_LIMIT             => 100,\r
       FIXED_DELAY               => 100,\r
+      SLOWCTRL_BUFFER_SIZE      => 1,\r
 \r
       NUMBER_OF_GBE_LINKS       => 1,\r
       LINKS_ACTIVE              => "0001",\r
@@ -382,7 +383,8 @@ begin
       RDO_DATA_BUFFER_DEPTH         => EVENT_BUFFER_SIZE,\r
       RDO_DATA_BUFFER_FULL_THRESH   => 2**EVENT_BUFFER_SIZE-EVENT_MAX_SIZE,\r
       RDO_HEADER_BUFFER_DEPTH       => 9,\r
-      RDO_HEADER_BUFFER_FULL_THRESH => 2**9-16\r
+      RDO_HEADER_BUFFER_FULL_THRESH => 2**9-16,\r
+      RDO_SKIP_FIRST_BUFFER         => CTS_NOREADOUT\r
       )\r
     port map (\r
       CLK    => clk_sys,\r
@@ -670,8 +672,8 @@ begin
       SPI_CLK_OUT       => spi_clk,\r
       --Header\r
       --HEADER_IO         => open,\r
-      -- HEADER_IO(7) => HDR_IO(6),\r
-      -- HEADER_IO(8) => HDR_IO(7),\r
+      HEADER_IO(7) => HDR_IO(6),\r
+      HEADER_IO(8) => HDR_IO(7),\r
       ADDITIONAL_REG    => add_reg,\r
       --ADC\r
       ADC_CS            => ADC_NCS,\r
@@ -739,11 +741,15 @@ begin
 -- PIN(4) <= '0' when (mimosis_sda_drv = '0') else 'Z';\r
 -- PIN(3) <= '0' when (mimosis_scl_drv = '0') else 'Z';\r
 \r
-  PIN(4) <= MIMOSIS_SDA;\r
-  PIN(3) <= MIMOSIS_SCL;\r
-  MIMOSIS_SDA <= '0' when (mimosis_sda_drv = '0') else 'Z';\r
-  MIMOSIS_SCL <= '0' when (mimosis_scl_drv = '0') else 'Z';\r
+  -- PIN(4) <= MIMOSIS_SDA;\r
+  -- PIN(3) <= MIMOSIS_SCL;\r
+  -- MIMOSIS_SDA <= '0' when (mimosis_sda_drv = '0' or i2c_reg_1(31) = '1') else 'Z';\r
+  -- MIMOSIS_SCL <= '0' when (mimosis_scl_drv = '0' or i2c_reg_1(30) = '1') else 'Z';\r
 \r
+PIN(4) <= '0' when (mimosis_sda_drv = '0' or i2c_reg_1(31) = '1') else 'Z';\r
+PIN(3) <= '0' when (mimosis_scl_drv = '0' or i2c_reg_1(30) = '1') else 'Z';\r
+  \r
+  \r
   H3(1)  <= i2c_reg_5_40(0);  --MIMOSIS_SYNC\r
   PIN(1) <= i2c_reg_5_40(4);  --MIMOSIS_START\r
   PIN(2) <= i2c_reg_5_40(8);  --MIMOSIS_RESET\r