mirror of
https://github.com/YosysHQ/yosys
synced 2025-07-24 13:18:56 +00:00
Gowin. BUGFIX. Fix multi-line descriptions.
If let's say the enumeration of inputs took several lines, then all after the first one were ignored. Since the first line ended with a comma, an error was generated when trying to use the resulting file. Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
This commit is contained in:
parent
e0747b71b7
commit
85e7c68fc6
2 changed files with 585 additions and 26 deletions
|
@ -11,6 +11,7 @@ import re
|
|||
class State(Enum):
|
||||
OUTSIDE = auto()
|
||||
IN_MODULE = auto()
|
||||
IN_MODULE_MULTILINE = auto()
|
||||
IN_PARAMETER = auto()
|
||||
|
||||
_skip = { # These are already described, no need to extract them from the vendor files
|
||||
|
@ -47,12 +48,20 @@ def xtract_cells_decl(dir, fout):
|
|||
fout.write(l)
|
||||
if l[-1] != '\n':
|
||||
fout.write('\n')
|
||||
if l.rstrip()[-1] != ';':
|
||||
state = State.IN_MODULE_MULTILINE
|
||||
elif l.startswith('parameter') and state == State.IN_MODULE:
|
||||
fout.write(l)
|
||||
if l.rstrip()[-1] == ',':
|
||||
state = State.IN_PARAMETER
|
||||
if l[-1] != '\n':
|
||||
fout.write('\n')
|
||||
elif l and state == State.IN_MODULE_MULTILINE:
|
||||
fout.write(l)
|
||||
if l[-1] != '\n':
|
||||
fout.write('\n')
|
||||
if l.rstrip()[-1] == ';':
|
||||
state = State.IN_MODULE
|
||||
elif state == State.IN_PARAMETER:
|
||||
fout.write(l)
|
||||
if l.rstrip()[-1] == ';':
|
||||
|
@ -65,6 +74,7 @@ def xtract_cells_decl(dir, fout):
|
|||
if l[-1] != '\n':
|
||||
fout.write('\n')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = ArgumentParser(description='Extract Gowin blackbox cell definitions.')
|
||||
parser.add_argument('gowin_dir', nargs='?', default='/opt/gowin/')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue