]> jspc29.x-matter.uni-frankfurt.de Git - trb5sc.git/commitdiff
Mimosis: Add new common I2C interface, change buffer blocking
authorJan Michel <michel@physik.uni-frankfurt.de>
Thu, 15 Dec 2022 15:56:05 +0000 (16:56 +0100)
committerJan Michel <michel@physik.uni-frankfurt.de>
Thu, 15 Dec 2022 15:56:05 +0000 (16:56 +0100)
mimosis/code/MimosisInput.vhd
mimosis/config.vhd
mimosis/par.p2t
mimosis/trb5sc_mimosis.prj
mimosis/trb5sc_mimosis.vhd
pinout/trb5sc_hdmi.lpf

index 1c5a83f6699649ad110db2673b76bf6e4df3ef44..f05f45dfc48e6a565c01e896e68ee65dcb76eb92 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 := 3990;
+  constant WORD_LIMIT : integer := 8500;
   
   signal input_active_i : std_logic;
   signal data_i : std_logic_vector(15 downto 0);
@@ -151,8 +151,8 @@ PROC_FRAMES : process begin
       if ct_fifo_valid = '1' and ct_fifo_data_out(31 downto 24) = x"FE" then
         frame_state <= HDR1;
         frame_number(15 downto 0) <= ct_fifo_data_out(7 downto 0) & ct_fifo_data_out(23 downto 16);
-        buffer_write   <= not buffer_full;
-        buffer_blocked <= buffer_full;
+        buffer_write   <= '1' when buffer_full = '0' and state = IDLE else '0';
+        buffer_blocked <= '0' when buffer_full = '0' and state = IDLE else '1';
         count_header   <= count_header + 1;
       end if;
     when HDR1 =>
index 4b4a76ae833ea57ebb399a9707cfda45f17edc08..376e941afb9bdb802309b563c2f00f3a079e1e98 100644 (file)
@@ -53,6 +53,7 @@ package config is
     constant INCLUDE_SPI            : integer  := c_NO; --300 slices
     constant INCLUDE_ADC            : integer  := c_YES; 
     constant INCLUDE_LCD            : integer  := c_NO;  --800 slices
+    constant INCLUDE_I2C            : integer  := c_YES;
     constant INCLUDE_DEBUG_INTERFACE: integer  := c_NO; --300 slices
 
     --input monitor and trigger generation logic
index 2c43fcd3957d759fcf9654b2e6f42ae8c23fa3e4..f9898477d58fb4e982d3e657cb048d8d1e3db24f 100644 (file)
@@ -4,7 +4,7 @@
 #-m nodelist.txt       # Controlled by the compile.pl script.
 #-n 1                          # Controlled by the compile.pl script.
 -s 10
--t 4
+-t 6
 -c 2
 -e 2
 -i 10
index da91664df1446c9043ca2702e797aa800b782af4..ccbecb75caa8999eb9cba25c220b565ca1023bce 100644 (file)
@@ -106,6 +106,7 @@ add_file -vhdl -lib work "../../trbnet/special/spi_slim.vhd"
 add_file -vhdl -lib work "../../trbnet/special/spi_databus_memory.vhd"
 add_file -vhdl -lib work "../../trbnet/special/fpga_reboot.vhd"
 add_file -vhdl -lib work "../../trb3sc/code/trb3sc_tools.vhd"
+add_file -vhdl -lib work "../../trb3sc/code/common_i2c.vhd"
 add_file -vhdl -lib work "../../trb3sc/code/lcd.vhd"
 add_file -vhdl -lib work "../../trb3sc/code/debuguart.vhd"
 add_file -vhdl -lib work "../../trbnet/special/uart.vhd"
@@ -203,6 +204,10 @@ add_file -vhdl -lib work "../../vhdlbasics/interface/i2c_gstart.vhd"
 add_file -vhdl -lib work "../../vhdlbasics/interface/i2c_sendb.vhd"
 add_file -vhdl -lib work "../../vhdlbasics/interface/i2c_slim.vhd"
 
+add_file -vhdl -lib work "../../vhdlbasics/interface/i2c_gstart2.vhd"
+add_file -vhdl -lib work "../../vhdlbasics/interface/i2c_sendb2.vhd"
+add_file -vhdl -lib work "../../vhdlbasics/interface/i2c_slim2.vhd"
+
 add_file -vhdl -lib work "./cores/mimosis_inp.vhd"
 add_file -vhdl -lib work "./cores/testout.vhd"
 add_file -vhdl -lib work "./code/MimosisInput.vhd"
index 71218f640a9e8d5c6ee1b5316bc044229a3e7ea9..78967c0f0ab8ae42c732ca3a93c6c99ed9804d10 100644 (file)
@@ -48,7 +48,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 : inout std_logic_vector(8 downto 1);\r
+    PIN : out std_logic_vector(8 downto 1);\r
     \r
     MIMOSIS_SCL, MIMOSIS_SDA : inout std_logic;\r
    \r
@@ -81,7 +81,8 @@ entity trb5sc_mimosis is
     \r
     --Other Connectors\r
     TEST    : inout std_logic_vector(14 downto 1); --on v1 only\r
-    HDR_IO  : inout std_logic_vector(23 downto 0)  --23..16 on v2 only\r
+    --COMMON_SDA, COMMON_SCL : inout std_logic\r
+    HDR_IO  : inout std_logic_vector(15 downto 0)  --23..16 on v2 only\r
     );\r
 \r
 \r
@@ -151,7 +152,7 @@ architecture arch of trb5sc_mimosis is
   signal mimosis_scl_drv, mimosis_sda_drv : std_logic;\r
   signal i2c_go_100, i2c_go : std_logic;\r
   signal i2c_reg_5_40       : std_logic_vector(31 downto 0);\r
-\r
+  signal counter : unsigned(23 downto 0);\r
   --signal fwd_dst_mac  : std_logic_vector(47 downto 0);\r
   --signal fwd_dst_ip   : std_logic_vector(31 downto 0);\r
   --signal fwd_dst_port : std_logic_vector(15 downto 0);\r
@@ -375,7 +376,9 @@ RJ(0) <= clk_40;
       SPI_MISO_IN       => spi_miso,\r
       SPI_CLK_OUT       => spi_clk,\r
       --Header\r
-      HEADER_IO         => open, --HDR_IO(9 downto 0),\r
+      --HEADER_IO         => open,\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
@@ -399,15 +402,20 @@ RJ(0) <= clk_40;
       DEBUG_OUT         => debug_tools\r
       );\r
 \r
+--counter <= counter + '1' when rising_edge(clk_sys);\r
+--HDR_IO <= std_logic_vector(counter(15 downto 0));\r
+--LED    <= std_logic_vector(counter(23 downto 16));\r
 \r
-\r
+  --COMMON_SDA(6) <= '0' when (add_reg(31) = '1') else 'Z';\r
+  --COMMON_SCL(7) <= '0' when (add_reg(30) = '1') else 'Z';\r
+  \r
   FLASH_HOLD <= '1';\r
   FLASH_WP   <= '1';\r
     \r
 ---------------------------------------------------------------------------\r
 -- I2C\r
 ---------------------------------------------------------------------------\r
-THE_I2C : entity work.i2c_slim \r
+THE_I2C : entity work.i2c_slim2 \r
  port map(\r
   CLOCK            => clk_40,\r
   RESET            => reset_i,\r
@@ -415,6 +423,7 @@ THE_I2C : entity work.i2c_slim
   I2C_GO_IN       => i2c_go,\r
   ACTION_IN       => i2c_reg_1(8),           -- '0' -> write, '1' -> read\r
   WORD_IN         => i2c_reg_1(0),           -- '0' -> byte, '1' -> word\r
+  DIRECT_IN       => i2c_reg_1(4),           -- don't send command\r
   I2C_SPEED_IN    => i2c_reg_0(5 downto 0),  -- speed adjustment (to be defined)\r
   I2C_ADDR_IN     => i2c_reg_2(7 downto 0),  -- I2C address byte (R/W bit is ignored)\r
   I2C_CMD_IN      => i2c_reg_2(15 downto 8), -- I2C command byte (sent after address byte)\r
@@ -430,12 +439,18 @@ THE_I2C : entity work.i2c_slim
   SCL_IN          => PIN(3),\r
   SCL_OUT         => mimosis_scl_drv,\r
   -- Debug\r
-  BSM_OUT         => i2c_reg_4(28 downto 24)\r
+  BSM_OUT         => i2c_reg_4(27 downto 24)\r
 );\r
 \r
 -- I2C signal open collector driver\r
-PIN(4) <= '0' when (mimosis_sda_drv = '0') else 'Z';\r
-PIN(3) <= '0' when (mimosis_scl_drv = '0') else 'Z';\r
+-- 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
+\r
 H5(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
index fc4791eb5899dd9b679052fb8177973450fd41b0..ac445dca016eba3f7e0f92c817ae77d80bbb1a3b 100644 (file)
@@ -88,8 +88,8 @@ LOCATE COMP "H5[3]" SITE "R32" ;    #was "FE_DIFF[6]"
 LOCATE COMP "H7[3]" SITE "W30" ;    #was "FE_DIFF[7]" 
 #LOCATE COMP "H5[4]" SITE "T32" ;    #was "FE_DIFF[8]" 
 
-LOCATE COMP "MIMOSIS_SCL" SITE "T32" ;    #was "FE_DIFF[8]" 
-LOCATE COMP "MIMOSIS_SDA" SITE "U32" ;    #was "FE_DIFF[8]" 
+LOCATE COMP "MIMOSIS_SCL" SITE "U32" ;    #was "FE_DIFF[8]" 
+LOCATE COMP "MIMOSIS_SDA" SITE "T32" ;    #was "FE_DIFF[8]" 
 IOBUF  PORT  "MIMOSIS_SCL"      IO_TYPE=LVCMOS25 ;
 IOBUF  PORT  "MIMOSIS_SDA"      IO_TYPE=LVCMOS25 ;
 
@@ -284,9 +284,14 @@ LOCATE COMP  "HDR_IO_22"    SITE "F22";  #on HDR_15
 LOCATE COMP  "HDR_IO_23"    SITE "F20";  #on HDR_14
 
 DEFINE PORT GROUP "HDR_group" "HDR*" ;
-IOBUF GROUP  "HDR_group" IO_TYPE=LVCMOS25 PULLMODE=DOWN ;
+IOBUF GROUP  "HDR_group" IO_TYPE=LVCMOS25 PULLMODE=UP ;
 
 
+LOCATE COMP  "COMMON_SDA"     SITE "B22";  #on HDR_2
+LOCATE COMP  "COMMON_SCL"     SITE "D24";  #on HDR_9
+DEFINE PORT GROUP "COMMON_group" "COMMON*" ;
+IOBUF GROUP  "COMMON_group" IO_TYPE=LVCMOS25 PULLMODE=UP ;
+
 #################################################################
 # Test & Other IO - from version 1 boards (TEST pins have not been reassigned)
 #################################################################