Skip to content
Snippets Groups Projects
Commit 68b0446e authored by Magnus Rentsch Ersdal's avatar Magnus Rentsch Ersdal
Browse files

fixed commit error

parent 0894173c
No related branches found
No related tags found
No related merge requests found
...@@ -27,6 +27,7 @@ def get_configuration_variables(filename): ...@@ -27,6 +27,7 @@ def get_configuration_variables(filename):
variables = {} variables = {}
print("cfg file read") print("cfg file read")
# abs minimum cfg options...
try: try:
for section, option in zip(sect,opt): for section, option in zip(sect,opt):
print(section,option, config.get(section,option)) print(section,option, config.get(section,option))
...@@ -34,8 +35,14 @@ def get_configuration_variables(filename): ...@@ -34,8 +35,14 @@ def get_configuration_variables(filename):
except (NameError, cp.NoOptionError) as e: except (NameError, cp.NoOptionError) as e:
print("Name/NoOptionError !, name \'{}\' is not defined.\ print("Name/NoOptionError !, name \'{}\' is not defined.\
Please check the config file".format(option)) Please check the config file".format(option))
print e.message print (e.message)
raise raise
# get any items in JTAG section:
if config.has_section('JTAG'):
for option, val in config.items('JTAG'):
variables[option] = val
print("got JTAG variable \'{}\' = {}".format(option, val))
print("cfg dict:") print("cfg dict:")
print(variables) print(variables)
......
svf project svf project
requires from pip requires from pip
* fire
* pyzmq * pyzmq
* numpy
The purpose of this code is to program the ITS RU Microsemi ProAsic3 FPGA. The purpose of this code is to program the ITS RU Microsemi ProAsic3 FPGA.
It communicates from a FLP/(a server) with the CRU card and libReadoutCard driver from O² It communicates from a FLP/(a server) with the CRU card and libReadoutCard driver from O²
The IO is using the SCA.py read and write methods. This file is slightly modified from the original ITS version. The IO is using the SCA.py read and write methods. This file is slightly modified from the original ITS version.
The driver communicates with the CRU FW. In the CRU FW there is a hardware HDLC wrapper that sends the data down the GBT links EC field. The driver communicates with the CRU FW. In the CRU FW there is a hardware HDLC wrapper that sends the data down the GBT links EC field.
\ No newline at end of file
#Procedure to start programming the PA3 chip:#
requirements:
* FLP with CRU/Altera dev-board programmed.
* everything CRU set-up.
* No other programmers plugged in to the PA3 board
* GBT chips set up, either with dongle or fusing (don't fuse until we know final config)
* Jumpers should be in correct positions:
(reference: with the backplane connector to the top/north/up)
J33 always to the right
J34 to the right for ONLY PA3 in the chain
J34 to the left for production configuration
J39 *must* be disconnected
Then it should be as simple as to change the configuration of the script to target your specific board and .svf file, then launch the tool.
...@@ -13,17 +13,19 @@ import sys ...@@ -13,17 +13,19 @@ import sys
from components.get_cfg import get_configuration_variables from components.get_cfg import get_configuration_variables
# opt = ['id_card','board','gbt_ch','svf_filename'] # opt = ['id_card','board','gbt_ch','svf_filename']
def configure_PA3(cfgfile_name) def configure_PA3(cfgfile_name):
""" Worker that programs a PA3 """
print("got cfgfile_name {}".format(cfgfile_name))
cfg = get_configuration_variables(cfgfile_name) cfg = get_configuration_variables(cfgfile_name)
instruction_list = read_svf(cfg[svf_filename]) instruction_list = read_svf(cfg['svf_filename'])
sw1 = Stopwatch() sw1 = Stopwatch()
sca = Sca(cfg[id_card], 2, cfg[gbt_ch], cfg[board]) sca = Sca(cfg["id_card"], 2, cfg["gbt_ch"], cfg["board"])
try: try:
svf = interpreter.svfinterpreter(sca) svf = interpreter.svfinterpreter(sca, cfg)
print("") print("")
for vect in instruction_list: for vect in instruction_list:
svf.caller(vect) svf.caller(vect)
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
Created on Wed Mar 21 14:01:43 2018 Created on Wed Mar 21 14:01:43 2018
@author: Magnus Rentsch Ersdal (magnus.ersdal@uib.no) @author: Magnus Rentsch Ersdal (magnus.ersdal@uib.no)
to be used for list.pop() feed, eventually constructing bigger stuff.. .
""" """
...@@ -63,7 +62,7 @@ class jbus(): ...@@ -63,7 +62,7 @@ class jbus():
class bussequencer(): class bussequencer():
"""Hold the state of the bus, sequence the bus, this is more jtag than SVF""" """Hold the state of the bus, sequence the bus, this is more jtag than SVF"""
def __init__(self, sequencer, j_bus=None):#, jtag_interface=None): def __init__(self, sequencer, j_bus=None, cfg = None):#, jtag_interface=None):
if j_bus == None: if j_bus == None:
self.bus = jbus() self.bus = jbus()
else: else:
...@@ -72,6 +71,14 @@ class bussequencer(): ...@@ -72,6 +71,14 @@ class bussequencer():
print("wrong parameter to bussequencer") print("wrong parameter to bussequencer")
else: else:
self.jtg_seq = sequencer self.jtg_seq = sequencer
if cfg == None:
pass
else:
if ("hdrlen" in cfg) and ("hirlen" in cfg): #mutually inclusive options
print("setting JTAG header options")
# this is the jtag chain setting
self.setheader(int(cfg[hirlen]), int(cfg[hdrlen]))
# TODO : trailer NOT IMPLEMENTED, because it is not in the RU hardware.
self.ENDDR = '' self.ENDDR = ''
self.ENDIR = '' self.ENDIR = ''
...@@ -100,8 +107,6 @@ class bussequencer(): ...@@ -100,8 +107,6 @@ class bussequencer():
tms_end, tms_end_l = get_int_and_b_len(jtg_tp.state_change(self.ENDDR)) tms_end, tms_end_l = get_int_and_b_len(jtg_tp.state_change(self.ENDDR))
# list of tuples with (data,length) # list of tuples with (data,length)
#tms_tuples= [(tms_start, tms_start_l),(0,(tdi_d_len-1)),(tms_end , tms_end_l)]
#tdi_tuples= [(0, tms_start_l), tdi_d_a, tdi_d_b, tdi_d_c, (0,(tms_end_l-1))]
tms_tuples= [(tms_start, tms_start_l),(0,(tdi_d_len-1)),(tms_end , tms_end_l)] tms_tuples= [(tms_start, tms_start_l),(0,(tdi_d_len-1)),(tms_end , tms_end_l)]
tdi_tuples= [(0, tms_start_l), tdi_d_a, tdi_d_b, tdi_d_c, (0,(tms_end_l-1))] tdi_tuples= [(0, tms_start_l), tdi_d_a, tdi_d_b, tdi_d_c, (0,(tms_end_l-1))]
deltal =sum([item[1] for item in tms_tuples]) - sum([item[1] for item in tdi_tuples]) deltal =sum([item[1] for item in tms_tuples]) - sum([item[1] for item in tdi_tuples])
...@@ -109,7 +114,6 @@ class bussequencer(): ...@@ -109,7 +114,6 @@ class bussequencer():
assert deltal == 0 assert deltal == 0
except ValueError: except ValueError:
print("error! deltal =", deltal) print("error! deltal =", deltal)
#tdi_tuples= [(0, tms_start_l+1), tdi_d_a, tdi_d_b, tdi_d_c, (0,(tms_end_l-2))]
self.jtg_seq.tqueue(tms_tuples,tdi_tuples) self.jtg_seq.tqueue(tms_tuples,tdi_tuples)
...@@ -138,16 +142,13 @@ class bussequencer(): ...@@ -138,16 +142,13 @@ class bussequencer():
def set_enddr(self, enddr): def set_enddr(self, enddr):
assert enddr in valid_svf_end_states assert enddr in valid_svf_end_states
# print("changing enddr to", enddr)
self.ENDDR = enddr self.ENDDR = enddr
def set_endir(self, endir): def set_endir(self, endir):
assert endir in valid_svf_end_states assert endir in valid_svf_end_states
# print("changing endir to", endir)
self.ENDIR = endir self.ENDIR = endir
def reverse(self, tp): def reverse(self, tp):
#print("reversing", hex(tp[0]), "to", hex(reverse_int(tp[0],tp[1]) ))
return reverse_int(tp[0],tp[1]), tp[1] return reverse_int(tp[0],tp[1]), tp[1]
...@@ -155,20 +156,21 @@ class svfinterpreter(): ...@@ -155,20 +156,21 @@ class svfinterpreter():
"""Interpret svf commands into something that can run on JTAG""" """Interpret svf commands into something that can run on JTAG"""
global svfcommands global svfcommands
def __init__(self, sca): def __init__(self, sca, cfg = None):
# self.jtg = jtag.interface() # self.jtg = jtag.interface()
global jtg_c global jtg_c
self.jtg_c = jtag_if.jtag_ctrl.Control(sca) self.jtg_c = jtag_if.jtag_ctrl.Control(sca)
self.jtg_seq = jtag_if.jtag_sequencer.Seq(sca) self.jtg_seq = jtag_if.jtag_sequencer.Seq(sca)
self.jtg_c.insertseq(self.jtg_seq) self.jtg_c.insertseq(self.jtg_seq)
self.bus = jbus() self.bus = jbus()
self.seq = bussequencer(sequencer = self.jtg_seq, j_bus = self.bus)#, self.jtg) self.seq = bussequencer(sequencer = self.jtg_seq,
j_bus = self.bus,
cfg = cfg )#, self.jtg)
self.func = "" self.func = ""
def set_jtag_frequency(self, arg = []): def set_jtag_frequency(self, arg = []):
if len(arg) != 0: if len(arg) != 0:
hz = int(float(arg.pop(0))) hz = int(float(arg.pop(0)))
# self.jtg.setf(hz)
self.jtg_c.setf(hz) self.jtg_c.setf(hz)
pass pass
else: else:
...@@ -178,7 +180,6 @@ class svfinterpreter(): ...@@ -178,7 +180,6 @@ class svfinterpreter():
def set_state(self, arg = None): # arg not optional. def set_state(self, arg = None): # arg not optional.
"""Force the JTAG bus to a stable state""" """Force the JTAG bus to a stable state"""
#print("called set_state")
if arg is None: if arg is None:
assert arg != None assert arg != None
print("error, set_state() requires at least one argument") print("error, set_state() requires at least one argument")
...@@ -236,9 +237,7 @@ class svfinterpreter(): ...@@ -236,9 +237,7 @@ class svfinterpreter():
self.data_parse(arg, 'TIR', self.bus.TIR) self.data_parse(arg, 'TIR', self.bus.TIR)
def data_parse(self, arg= None, mode='', sig=None): def data_parse(self, arg= None, mode='', sig=None):
#print("data called in mode:",mode,"with arg",arg)
sig.cleardata() # might introduce bugs !! sig.cleardata() # might introduce bugs !!
# print(mode,"called")
length = int(arg.pop(0)) length = int(arg.pop(0))
#[[TDI, 123], [TDO, 123]] #[[TDI, 123], [TDO, 123]]
if len(arg) != 0: if len(arg) != 0:
...@@ -247,7 +246,6 @@ class svfinterpreter(): ...@@ -247,7 +246,6 @@ class svfinterpreter():
def _data_sub_parse(self, arg, sequence=None, mode='', sig=None, length=0): def _data_sub_parse(self, arg, sequence=None, mode='', sig=None, length=0):
"""parses an argument into the correct signal bin""" """parses an argument into the correct signal bin"""
#print("datasubparse: {}".format(arg)) #print("datasubparse: {}".format(arg))
#print("data_sub called in mode:",mode,"with arg, seq, len:",arg,sequence, length)
# the alternatives for "sig" variable are self.bus.TDI # the alternatives for "sig" variable are self.bus.TDI
if isinstance(arg, str): if isinstance(arg, str):
sig.length = length sig.length = length
......
...@@ -41,7 +41,7 @@ def space(): ...@@ -41,7 +41,7 @@ def space():
def littlespace(): def littlespace():
print("------") print("------")
listone = read_svf("program_pa3.svf") #("idcode.svf")#("../p_400klines.svf")#("../p_reduced.svf") listone = read_svf("idcode.svf")#("program_pa3.svf") #("idcode.svf")#("../p_400klines.svf")#("../p_reduced.svf")
# operation completed in 4 minutes 27.190409 seconds for 200klines with delays. # operation completed in 4 minutes 27.190409 seconds for 200klines with delays.
# operation completed in 4 minutes 56.811993 seconds for 400klines with delays. # operation completed in 4 minutes 56.811993 seconds for 400klines with delays.
# operation completed in 8 minutes 8.541882 seconds # operation completed in 8 minutes 8.541882 seconds
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment