From 081ccb5fb073a41ee51380129c88a604500c0c24 Mon Sep 17 00:00:00 2001
From: Leon Hiemstra <hiemstra@astron.nl>
Date: Thu, 13 Nov 2014 08:31:45 +0000
Subject: [PATCH] extra

---
 .../unb1_test/tb/python/tc_unb1_test.py       | 32 +++++++++++++------
 1 file changed, 23 insertions(+), 9 deletions(-)

diff --git a/boards/uniboard1/designs/unb1_test/tb/python/tc_unb1_test.py b/boards/uniboard1/designs/unb1_test/tb/python/tc_unb1_test.py
index bba8c038f8..8645a2890a 100644
--- a/boards/uniboard1/designs/unb1_test/tb/python/tc_unb1_test.py
+++ b/boards/uniboard1/designs/unb1_test/tb/python/tc_unb1_test.py
@@ -96,10 +96,14 @@ def test_BG_to_DB(tc,io,cmd,use_pps=False):
     Bg = pi_diag_block_gen.PiDiagBlockGen(tc,io,nofChannels=nof_streams, ramSizePerChannel=blocksize)
     #Bg.write_block_gen_settings(samplesPerPacket=700, blocksPerSync=781250, gapSize=300, memLowAddr=0, memHighAddr=701, BSNInit=42)
     Db = pi_diag_data_buffer.PiDiagDataBuffer(tc,io,nofStreams=nof_streams,ramSizePerStream=blocksize)
-    resetptrn = [0xffffffff]*samples_per_packet + [0]*(blocksize-samples_per_packet)
+    resetptrn = [0xc1ea1ed1]*blocksize #samples_per_packet + [0]*(blocksize-samples_per_packet)
     for s in tc.spNrs:
         Db.overwrite_data_buffer(resetptrn,streamNr=s,vLevel=9)
 
+    db_ram = []
+    for s in tc.spNrs:
+        db_ram.append(Db.read_data_buffer(streamNr=s,vLevel=5))
+
     if use_pps==True:
         Bg.write_enable_pps()
         ppsh.wait_until_pps(vLevel=6)
@@ -114,10 +118,22 @@ def test_BG_to_DB(tc,io,cmd,use_pps=False):
         for r in ram: rram.append(list(r)) # () -> []
         bg_ram.append(rram)
 
+
     db_ram = []
     for s in tc.spNrs:
         db_ram.append(Db.read_data_buffer(streamNr=s,vLevel=5))
 
+
+    # truncate: in 10GbE the data is only sized 700
+    for s in tc.spNrs:
+        bg_ram[s][0] = bg_ram[s][0][:-(blocksize-700)]
+        db_ram[s][0] = db_ram[s][0][:-(blocksize-700)]
+        #bg_ram[s][0] = bg_ram[s][0][:-(blocksize-samples_per_packet)]
+        #db_ram[s][0] = db_ram[s][0][:-(blocksize-samples_per_packet)]
+
+    #print 'bg_ram=',bg_ram
+    #print 'db_ram=',db_ram
+
     tc.set_section_id('Compare (BG==DB) - ')
     compared = (bg_ram == db_ram)
     tc.append_log(3, '')
@@ -175,8 +191,7 @@ def test_info(tc,io,cmd):
     tc.append_log(3, '>>>')
 
     #with node_io.NodeIO(tc.nodeImages, tc.base_ip) as temp_io:
-    temp_io = node_io.NodeIO(tc.nodeImages, tc.base_ip)
-    info = pi_system_info.PiSystemInfo(tc, temp_io)
+    info = pi_system_info.PiSystemInfo(tc, io)
     tc.append_log(1, '>>> reading REGMAPs')
     info.make_register_info()
     tc.append_log(3, '')
@@ -253,11 +268,10 @@ def test_remu(tc,io,cmd):
     tc.append_log(3, '>>>')
 
     dummy_tc = test_case.Testcase('Dummy TB - ', '')
-    #with node_io.NodeIO(tc.nodeImages, tc.base_ip) as temp_io:
-    temp_io = node_io.NodeIO(tc.nodeImages, tc.base_ip)
     dummy_tc.set_result('PASSED')
     
-    Remu = pi_remu.PiRemu(dummy_tc, temp_io)
+    #with pi_remu.PiRemu(dummy_tc, io) as Remu:
+    Remu = pi_remu.PiRemu(dummy_tc, io)
     try:
             Remu.write_user_reconfigure()
     except:
@@ -266,7 +280,6 @@ def test_remu(tc,io,cmd):
     if dummy_tc.get_result() == 'FAILED':
             tc.append_log(1, 'Result=%s but ignoring this' % dummy_tc.get_result())
 
-    del dummy_tc
     tc.append_log(3, '')
 
 
@@ -382,7 +395,7 @@ tc.append_log(3, '>>>')
     
 
 # Create access object for nodes
-io = node_io.NodeIO(tc.nodeImages, tc.base_ip)
+#io = node_io.NodeIO(tc.nodeImages, tc.base_ip)
 
 
 
@@ -398,7 +411,8 @@ while rep < tc.repeat:
         if cmd > len(Cmd): cmd = 100 # default to help_text
         tc.append_log(3, 'Next command: %d : %s: %s' % (cmd,Cmd[cmd][0],Cmd[cmd][2]))
 
-        Cmd[cmd][1](tc,io,cmd)
+        with node_io.NodeIO(tc.nodeImages, tc.base_ip) as temp_io:
+            Cmd[cmd][1](tc,temp_io,cmd)
 
 
 
-- 
GitLab