diff --git a/fpgalib/dac.py b/fpgalib/dac.py index b6d2f69d..db825547 100644 --- a/fpgalib/dac.py +++ b/fpgalib/dac.py @@ -1203,8 +1203,7 @@ class DAC_Build15(DAC_Build8): COUNTER_BYTES = 4 IDLE_BITS = 15 JUMP_TABLE_ENTRY_BYTES = 8 - JUMP_TABLE_COUNT = (JUMP_TABLE_PACKET_LEN - (NUM_COUNTERS * COUNTER_BYTES) - ) / JUMP_TABLE_ENTRY_BYTES + JUMP_TABLE_COUNT = 64 JT_FROM_ADDR_OFFSET = -2 JT_END_ADDR_OFFSET = JT_FROM_ADDR_OFFSET - 1 JT_IDLE_OFFSET = -0 @@ -1516,8 +1515,9 @@ def make_jump_table(cls, jt_entries, counters=None, start_address_ns=0): :rtype: jump_table.JumpTable """ - if len(jt_entries) > cls.JUMP_TABLE_COUNT: - raise ValueError("Jump table too long: {} > {}" + # -1 hardcoded due to issue #325 + if len(jt_entries) + 1 > cls.JUMP_TABLE_COUNT: + raise ValueError("Jump table too long: {} + starting NOP > {}" .format(len(jt_entries), cls.JUMP_TABLE_COUNT)) # no two opcodes executed within JT_MIN_CLK_CYCLES_BETWEEN_OPCODES @@ -1547,7 +1547,7 @@ def make_jump_table(cls, jt_entries, counters=None, start_address_ns=0): start_addr=cls.convert_to_address(start_address_ns), jumps=jt_entries, counters=counters, - PACKET_LEN=cls.JUMP_TABLE_PACKET_LEN, + packet_len=cls.JUMP_TABLE_PACKET_LEN, ) @classmethod diff --git a/fpgalib/jump_table.py b/fpgalib/jump_table.py index 612b0afc..549509eb 100644 --- a/fpgalib/jump_table.py +++ b/fpgalib/jump_table.py @@ -275,19 +275,19 @@ class JumpTable(object): NUM_COUNTERS = 4 def __init__(self, start_addr=None, jumps=None, counters=None, - PACKET_LEN=528): + packet_len=528): """ :param start_addr: start address :param list[JumpEntry] jumps: the jump table entries :param list[int] counters: the counter values - :param int PACKET_LEN: Number of packets in a JT write + :param int packet_len: Number of byes in jump table write packet """ self._startAddr = 0 self.counters = self._initialize_counters(counters=counters) self.start_addr = start_addr self.jumps = jumps - self.PACKET_LEN = PACKET_LEN + self.packet_len = packet_len @classmethod def _initialize_counters(cls, counters=None): @@ -323,7 +323,7 @@ def __str__(self): def toString(self): """Serialize jump table to a byte string for the FPGA""" - data = np.zeros(self.PACKET_LEN, dtype='