Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix monitor/generate.py to support macros besides RISCV_FORMAL_COMPRE… #16

Merged
merged 1 commit into from Nov 5, 2018
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -596,6 +596,8 @@ def print_rewrite_file(filename):
flag_compressed_ifndef = False
flag_aligned_ifdef = False
flag_aligned_ifndef = False
flag_ifdef = False
flag_ifndef = False

for line in f:
if line.startswith("`ifdef RISCV_FORMAL_COMPRESSED"):
@@ -618,16 +620,29 @@ def print_rewrite_file(filename):
flag_aligned_ifndef = True
continue

if line.startswith("`ifdef "):
flag_ifdef = True
flag_ifndef = False
continue

if line.startswith("`ifndef "):
flag_ifdef = False
flag_ifndef = True
continue

if line.startswith("`else"):
flag_compressed_ifdef, flag_compressed_ifndef = flag_compressed_ifndef, flag_compressed_ifdef
flag_aligned_ifdef, flag_aligned_ifndef = flag_aligned_ifndef, flag_aligned_ifdef
flag_ifdef, flag_ifndef = flag_ifndef, flag_ifdef
continue

if line.startswith("`endif"):
flag_compressed_ifdef = False
flag_compressed_ifndef = False
flag_aligned_ifdef = False
flag_aligned_ifndef = False
flag_ifdef = False
flag_ifndef = False
continue

if flag_compressed_ifdef and not compressed:
@@ -642,6 +657,12 @@ def print_rewrite_file(filename):
if flag_aligned_ifndef and aligned:
continue

if flag_ifdef and True:
continue

if flag_ifndef and False:
continue

for a, b in replace_db:
line = line.replace(a, b)

ProTip! Use n and p to navigate between commits in a pull request.