Gabe Black has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/56328 )
(
9 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the
submitted one.
)Change subject: arch: Switch to a new state to process macrocoop headers.
......................................................................
arch: Switch to a new state to process macrocoop headers.
The "header" of a macroop definition is the part after "def rom" but
before the "{". This is pretty minimal now, but will be more complex
once macros are introduced.
Change-Id: I002d6501a015f46be6ae28b8d2a5e6064438da32
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/56328
Reviewed-by: Matt Sinclair <mattdsincl...@gmail.com>
Maintainer: Gabe Black <gabe.bl...@gmail.com>
Tested-by: kokoro <noreply+kok...@google.com>
---
M src/arch/micro_asm.py
1 file changed, 35 insertions(+), 7 deletions(-)
Approvals:
Matt Sinclair: Looks good to me, approved
Gabe Black: Looks good to me, approved
kokoro: Regressions pass
diff --git a/src/arch/micro_asm.py b/src/arch/micro_asm.py
index 60d7216..1eb82b5 100644
--- a/src/arch/micro_asm.py
+++ b/src/arch/micro_asm.py
@@ -197,6 +197,7 @@
states = (
('asm', 'exclusive'),
('params', 'exclusive'),
+ ('header', 'exclusive'),
)
reserved_map = { }
@@ -244,17 +245,27 @@
t.lexer.push_state('params')
return t
+def t_header_ID(t):
+ r'[A-Za-z_]\w*'
+ return t
+
# If there is a label and you're -not- in the assembler (which would be
caught
# above), don't start looking for parameters.
def t_ANY_ID(t):
r'[A-Za-z_]\w*'
t.type = reserved_map.get(t.value, 'ID')
+ if t.type == 'MACROOP':
+ t.lexer.push_state('asm')
+ t.lexer.push_state('header')
+ elif t.type == 'ROM':
+ t.lexer.push_state('asm')
+ t.lexer.push_state('header')
return t
# Braces enter and exit micro assembly
-def t_INITIAL_LBRACE(t):
+def t_header_LBRACE(t):
r'\{'
- t.lexer.push_state('asm')
+ t.lexer.pop_state()
return t
def t_asm_RBRACE(t):
@@ -262,11 +273,6 @@
t.lexer.pop_state()
return t
-# At the top level, keep track of newlines only for line counting.
-def t_INITIAL_NEWLINE(t):
- r'\n+'
- t.lineno += t.value.count('\n')
-
# In the micro assembler, do line counting but also return a token. The
# token is needed by the parser to detect the end of a statement.
def t_asm_NEWLINE(t):
@@ -287,6 +293,11 @@
t.lexer.pop_state()
return t
+# Unless handled specially above, track newlines only for line counting.
+def t_ANY_NEWLINE(t):
+ r'\n+'
+ t.lineno += t.value.count('\n')
+
# Basic regular expressions to pick out simple tokens
t_ANY_LPAREN = r'\('
t_ANY_RPAREN = r'\)'
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/56328
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I002d6501a015f46be6ae28b8d2a5e6064438da32
Gerrit-Change-Number: 56328
Gerrit-PatchSet: 11
Gerrit-Owner: Gabe Black <gabe.bl...@gmail.com>
Gerrit-Reviewer: Gabe Black <gabe.bl...@gmail.com>
Gerrit-Reviewer: Matt Sinclair <mattdsincl...@gmail.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s