@@ -130,9 +130,9 @@ module mkBench (Bench);
130
130
131
131
// Connect I2C busses since TriStates cannot be simulated
132
132
mkConnection( controller.pins.scl.out, periph.scl_i) ;
133
- mkConnection( controller.pins.scl.in, periph.scl_o ) ;
133
+ mkConnection( periph.scl_o , controller.pins.scl.in) ;
134
134
mkConnection( controller.pins.sda.out, periph.sda_i) ;
135
- mkConnection( controller.pins.sda.in, periph.sda_o ) ;
135
+ mkConnection( periph.sda_o , controller.pins.sda.in) ;
136
136
137
137
// We need the ability to simulate the bus losing its pull-ups when a module has not been
138
138
// inserted since that is how the design behaves. We only apply power to the module (and by the
@@ -745,4 +745,44 @@ module mkI2CSclStretchTimeoutTest (Empty);
745
745
endseq ) ;
746
746
endmodule
747
747
748
+ // mkUninitializationAfterRemovalTest
749
+ //
750
+ // This test ensures that a previously initialized module is uninitialized when
751
+ // the module is removed regardless of `ResetL`'s status. That way when it is
752
+ // reinserted, the initialization process happens again.
753
+ module mkSclStretchTimeoutAfterRemovalAndReinsertionTest ( Empty ) ;
754
+ Bench bench < - mkBench() ;
755
+
756
+ Command read_cmd = Command {
757
+ op : Read,
758
+ i2c_addr : i2c_test_params.peripheral_addr,
759
+ reg_addr : 8'h00 ,
760
+ num_bytes : 1
761
+ } ;
762
+
763
+ mkAutoFSM( seq
764
+ add_and_initialize_module( bench) ;
765
+ bench.command( read_cmd, False , False ) ;
766
+ await( ! bench.i2c_busy()) ;
767
+ assert_eq( unpack( bench.registers.port_status.error[ 2 : 0 ] ) ,
768
+ NoError,
769
+ " NoError should be present when attempting to communicate after t_init has elapsed." ) ;
770
+
771
+ remove_and_power_down_module( bench) ;
772
+
773
+
774
+ insert_and_power_module( bench) ;
775
+
776
+ bench.command( read_cmd, False , False ) ;
777
+ await( ! bench.i2c_busy()) ;
778
+ delay( 3 ) ;
779
+ assert_eq( unpack( bench.registers.port_status.error[ 2 : 0 ] ) ,
780
+ NotInitialized,
781
+ " NotInitialized error should be present when a module has been reseated but not initialized." ) ;
782
+ assert_eq( unpack( bench.registers.port_status.stretching_seen) ,
783
+ False ,
784
+ " Should not have observed and SCL stretching." ) ;
785
+ endseq ) ;
786
+ endmodule
787
+
748
788
endpackage : QsfpModuleControllerTests
0 commit comments