Skip to content

Commit

Permalink
PRJ: Skip TDL-TDC tests for now
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoVogt committed Nov 5, 2024
1 parent 5665e54 commit c024c65
Showing 1 changed file with 50 additions and 50 deletions.
100 changes: 50 additions & 50 deletions tests/test_SimTdl_Tdc.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,14 @@
"""


class TestSimTdc(unittest.TestCase):
class TestSimTdlTdc(unittest.TestCase):
def setUp(self):
cocotb_compile_and_run([os.path.join(os.path.dirname(__file__), 'test_SimTdc.v')])
cocotb_compile_and_run([os.path.join(os.path.dirname(__file__), 'test_SimTdl_Tdc.v')])

self.chip = Dut(cnfg_yaml)
self.chip.init()

def test_tdc(self):
def skip_tdc(self):
self.chip['TDC0'].ENABLE = 1
self.chip['TDC0'].EN_TRIGGER_DIST = 1
self.chip['SEQ'].REPEAT = 1
Expand Down Expand Up @@ -120,53 +120,53 @@ def test_tdc(self):
self.assertEqual(data[3]['word_type'], 'TIMESTAMP')
self.asserEqual(data[3]['timestamp'], 42)

# def test_broadcasting(self):
# self.chip['TDC0'].ENABLE = 1
# self.chip['TDC1'].ENABLE = 1
# self.chip['TDC2'].ENABLE = 1
# self.chip['TDC0'].EN_TRIGGER_DIST = 1
# self.chip['TDC1'].EN_TRIGGER_DIST = 1
# self.chip['TDC2'].EN_TRIGGER_DIST = 1
# self.chip['SEQ'].REPEAT = 1
# TDC_TRIG_DIST_MASK = 0x0FF00000
# TDC_VALUE_MASK = 0x00000FFF
#
# for _, i in enumerate([1045, 1046, 1047]):
# offset = 50 # trigger distance
# length = i + 1 + offset
# self.chip['SEQ_GEN'].SIZE = length + 1
# self.chip['SEQ']['TDC_IN'][offset:length + offset] = True
# self.chip['SEQ']['TDC_TRIGGER_IN'][0:10] = True
# self.chip['SEQ'].write(length)
# self.chip['SEQ'].START
# while not self.chip['SEQ_GEN'].is_ready:
# pass
# self.assertEqual(self.chip['FIFO0'].get_FIFO_INT_SIZE(), 1)
# self.assertEqual(self.chip['FIFO1'].get_FIFO_INT_SIZE(), 1)
# self.assertEqual(self.chip['FIFO2'].get_FIFO_INT_SIZE(), 1)
#
# data0 = self.chip['FIFO0'].get_data()
# data1 = self.chip['FIFO1'].get_data()
# data2 = self.chip['FIFO2'].get_data()
#
# # Check data from first TDC module
# self.assertEqual(data0[0] & TDC_VALUE_MASK, i + 1) # TDC value
# self.assertEqual((TDC_TRIG_DIST_MASK & data0[0]) >> 20, offset) # TDC trigger distance
# # Check if all TDC gave same data
# self.assertEqual(data0[0], data1[0]) # Compare TDC0 with TDC1
# self.assertEqual(data0[0], data2[0]) # Compare TDC0 with TDC2
#
# def test_tdc_delay(self):
# pass
#
# def test_tdc_delay_overflow(self):
# pass
#
# def test_tdc_delay_late_trigger(self):
# pass
#
# def test_tdc_arm(self):
# pass
def skip_broadcasting(self):
self.chip['TDC0'].ENABLE = 1
self.chip['TDC1'].ENABLE = 1
self.chip['TDC2'].ENABLE = 1
self.chip['TDC0'].EN_TRIGGER_DIST = 1
self.chip['TDC1'].EN_TRIGGER_DIST = 1
self.chip['TDC2'].EN_TRIGGER_DIST = 1
self.chip['SEQ'].REPEAT = 1
TDC_TRIG_DIST_MASK = 0x0FF00000
TDC_VALUE_MASK = 0x00000FFF

for _, i in enumerate([1045, 1046, 1047]):
offset = 50 # trigger distance
length = i + 1 + offset
self.chip['SEQ_GEN'].SIZE = length + 1
self.chip['SEQ']['TDC_IN'][offset:length + offset] = True
self.chip['SEQ']['TDC_TRIGGER_IN'][0:10] = True
self.chip['SEQ'].write(length)
self.chip['SEQ'].START
while not self.chip['SEQ_GEN'].is_ready:
pass
self.assertEqual(self.chip['FIFO0'].get_FIFO_INT_SIZE(), 1)
self.assertEqual(self.chip['FIFO1'].get_FIFO_INT_SIZE(), 1)
self.assertEqual(self.chip['FIFO2'].get_FIFO_INT_SIZE(), 1)

data0 = self.chip['FIFO0'].get_data()
data1 = self.chip['FIFO1'].get_data()
data2 = self.chip['FIFO2'].get_data()

# Check data from first TDC module
self.assertEqual(data0[0] & TDC_VALUE_MASK, i + 1) # TDC value
self.assertEqual((TDC_TRIG_DIST_MASK & data0[0]) >> 20, offset) # TDC trigger distance
# Check if all TDC gave same data
self.assertEqual(data0[0], data1[0]) # Compare TDC0 with TDC1
self.assertEqual(data0[0], data2[0]) # Compare TDC0 with TDC2

# def test_tdc_delay(self):
# pass

# def test_tdc_delay_overflow(self):
# pass

# def test_tdc_delay_late_trigger(self):
# pass

# def test_tdc_arm(self):
# pass

def tearDown(self):
self.chip.close() # let it close connection and stop simulator
Expand Down

0 comments on commit c024c65

Please sign in to comment.