Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: GlasgowEmbedded/glasgow
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 29019ca9bf39
Choose a base ref
...
head repository: GlasgowEmbedded/glasgow
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 0bb059b3408d
Choose a head ref
  • 3 commits
  • 1 file changed
  • 1 contributor

Commits on Dec 12, 2019

  1. protocol.jesd3: accept whitespace before *.

    This isn't strictly permitted by JESD3-C, but real JED files use it,
    and there's no harm in always allowing it.
    whitequark committed Dec 12, 2019
    Copy the full SHA
    75aea17 View commit details
  2. protocol.jesd3: accept whitespace in L payload.

    This is required by JESD3-C.
    whitequark committed Dec 12, 2019
    Copy the full SHA
    1985133 View commit details
  3. Copy the full SHA
    0bb059b View commit details
Showing with 6 additions and 4 deletions.
  1. +6 −4 software/glasgow/protocol/jesd3.py
10 changes: 6 additions & 4 deletions software/glasgow/protocol/jesd3.py
Original file line number Diff line number Diff line change
@@ -34,7 +34,7 @@ class JESD3Lexer:
(r"QP", r"([0-9]+)"),
(r"QV", r"([0-9]+)"),
(r"F", r"([01])"),
(r"L", r"([0-9]+)[ \r\n]+([01 ]+)"),
(r"L", r"([0-9]+)[ \r\n]+([01 \r\n]+)"),
(r"C", r"([0-9A-F]{4})"),
(r"EH", r"([0-9A-F]+)"),
(r"E", r"([01]+)"),
@@ -55,7 +55,7 @@ class JESD3Lexer:
_stx_quirk_re = re.compile(r"\x02()[ \r\n]*", re.A|re.S)
_etx_re = re.compile(r"\x03([0-9A-F]{4})", re.A|re.S)
_ident_re = re.compile(r"|".join(ident for ident, args in _fields), re.A|re.S)
_field_res = {ident: re.compile(ident + args + r"\*[ \r\n]*", re.A|re.S)
_field_res = {ident: re.compile(ident + args + r"[ \r\n]*\*[ \r\n]*", re.A|re.S)
for ident, args in _fields}

def __init__(self, buffer, quirk_no_design_spec=False):
@@ -190,7 +190,7 @@ def _on_L(self, index, values):
if self.fuse is None:
self._parse_error("fuse list specified before fuse count")
index = int(index, 10)
values = bitarray(values.replace(" ", ""), endian="little")
values = bitarray(re.sub(r"[ \r\n]", "", values), endian="little")
if index + len(values) > len(self.fuse):
self._parse_error("fuse list specifies range [%d:%d] beyond last fuse %d"
% (index, index + len(values), len(self.fuse)))
@@ -276,6 +276,8 @@ def _on_A(self, subfield, delay):
def _on_end(self, checksum):
"""End marker and checksum"""
expected_checksum = int(checksum, 16)
if expected_checksum == 0x0000:
return
actual_checksum = self._lexer.checksum & 0xffff
if expected_checksum != actual_checksum:
self._parse_error("transmission checksum mismatch: expected %04X, actual %04X"
@@ -290,7 +292,7 @@ def _on_end(self, checksum):
if __name__ == "__main__":
import sys
with open(sys.argv[1], "r") as f:
parser = JESD3Parser(f.read(), quirk_no_design_spec=True)
parser = JESD3Parser(f.read(), quirk_no_design_spec=False)
parser.parse()
for i in range(0, len(parser.fuse) + 63, 64):
print("%08x: %s" % (i, parser.fuse[i:i + 64].to01()))