From 251b169427b6b7b3dd025594ce3a9e244b623ea9 Mon Sep 17 00:00:00 2001 From: Staf Verhaegen Date: Thu, 22 Apr 2021 10:55:33 +0200 Subject: [PATCH] Double empty lines between top level definitions. --- c4m/cocotb/jtag/c4m_jtag.py | 3 +++ c4m/cocotb/jtag/c4m_jtag_svfcocotb.py | 1 + c4m/cocotb/jtag/c4m_jtag_svfgrammar.py | 20 ++++++++++++++++++++ test/nmigen/gen/controller/generate.py | 2 ++ 4 files changed, 26 insertions(+) diff --git a/c4m/cocotb/jtag/c4m_jtag.py b/c4m/cocotb/jtag/c4m_jtag.py index 2cf9981..ac97ce3 100644 --- a/c4m/cocotb/jtag/c4m_jtag.py +++ b/c4m/cocotb/jtag/c4m_jtag.py @@ -2,9 +2,11 @@ import cocotb from cocotb.triggers import Timer from cocotb.binary import BinaryValue + class JTAGException(Exception): pass + class JTAG_Clock(object): """ Class for the JTAG clock, run cycle by cycle @@ -28,6 +30,7 @@ class JTAG_Clock(object): self.signal <= 0 yield self.t + class JTAG_Master(object): """ Class that will run JTAG commands, shift in and out data diff --git a/c4m/cocotb/jtag/c4m_jtag_svfcocotb.py b/c4m/cocotb/jtag/c4m_jtag_svfcocotb.py index ff51077..9028961 100755 --- a/c4m/cocotb/jtag/c4m_jtag_svfcocotb.py +++ b/c4m/cocotb/jtag/c4m_jtag_svfcocotb.py @@ -5,6 +5,7 @@ from cocotb.binary import BinaryValue from .c4m_jtag_svfgrammar import * + def decodescanspec(node): length = int(str(node[2])) fstr = "{:0"+str(node[2])+"b}" diff --git a/c4m/cocotb/jtag/c4m_jtag_svfgrammar.py b/c4m/cocotb/jtag/c4m_jtag_svfgrammar.py index 8bc949d..e09c793 100644 --- a/c4m/cocotb/jtag/c4m_jtag_svfgrammar.py +++ b/c4m/cocotb/jtag/c4m_jtag_svfgrammar.py @@ -3,25 +3,31 @@ from modgrammar import * grammar_whitespace_mode = 'explicit' grammar_whitespace = WS_NOEOL + class SVFEol(Grammar): grammar = (OPTIONAL(SPACE), EOL) grammar_collapse = True + class SemicolonEol(Grammar): grammar = (OPTIONAL(SPACE), L(";"), SVFEol) grammar_collapse = True + class Integer(Grammar): grammar = WORD("0-9") grammar_collapse = True + class Float(Grammar): grammar = (Integer, (L("."), OPTIONAL(Integer)), OPTIONAL(L("E"), Integer)) + class Hexadecimal(Grammar): grammar = (L("("), WORD("0-9A-Fa-f"), L(")")) grammar_collapse = True + class StableState(Grammar): grammar = (L("IRPAUSE") | L("DRPAUSE") | L("RESET") | L("IDLE")) grammar_collapse = True @@ -41,26 +47,34 @@ class ScanSpec(Grammar): class EmptyLine(Grammar): grammar = SVFEol + class Comment(Grammar): grammar = (L("!"), REST_OF_LINE, SVFEol) + class EndDR(Grammar): grammar = (L("ENDDR"), SPACE, StableState, SemicolonEol) + class EndIR(Grammar): grammar = (L("ENDIR"), SPACE, StableState, SemicolonEol) + class Frequency(Grammar): grammar = (L("FREQUENCY"), OPTIONAL(SPACE, Float, OPTIONAL(SPACE), L("HZ")), OPTIONAL(SPACE), SemicolonEol) + class HDR(Grammar): grammar = (L("HDR"), ScanSpec, SemicolonEol) + class HIR(Grammar): grammar = (L("HIR"), ScanSpec, SemicolonEol) + #TODO: PIO, PIOMAP + class Runtest(Grammar): grammar = ( L("RUNTEST"), @@ -72,22 +86,28 @@ class Runtest(Grammar): SemicolonEol ) + class SDR(Grammar): grammar = (L("SDR"), ScanSpec, SemicolonEol) + class SIR(Grammar): grammar = (L("SIR"), ScanSpec, SemicolonEol) + class State(Grammar): # TODO: Path to reach state grammar = (L("STATE"), SPACE, StableState, SemicolonEol) + class TDR(Grammar): grammar = (L("TDR"), ScanSpec, SemicolonEol) + class TIR(Grammar): grammar = (L("TIR"), ScanSpec, SemicolonEol) + class Trst(Grammar): grammar = (L("TRST"), SPACE, (L("ON") | L("OFF") | L("Z") | L("ABSENT")), SemicolonEol) diff --git a/test/nmigen/gen/controller/generate.py b/test/nmigen/gen/controller/generate.py index fbd724a..e66a227 100755 --- a/test/nmigen/gen/controller/generate.py +++ b/test/nmigen/gen/controller/generate.py @@ -5,6 +5,7 @@ from nmigen.build import Platform from c4m.nmigen.jtag import TAP + class DummyPlatform(Platform): resources = [] connectors = [] @@ -13,6 +14,7 @@ class DummyPlatform(Platform): def toolchain_prepare(self, fragment, name, **kwargs): raise NotImplementedError + tap = TAP(ir_width=2) f = open("top.v", "w") f.write(convert(tap, platform=DummyPlatform())) -- 2.30.2