summaryrefslogtreecommitdiff
path: root/src/mem/slicc/parser
diff options
context:
space:
mode:
authorDerek Hower <drh5@cs.wisc.edu>2009-08-04 12:52:52 -0500
committerDerek Hower <drh5@cs.wisc.edu>2009-08-04 12:52:52 -0500
commit33b28fde7aca9bf1ae16b9db09e71ccd44d3ae76 (patch)
treefe2a4aee5517aed63f95e56ce4f085793826bdd4 /src/mem/slicc/parser
parentc1e0bd1df4cf107bd543bcde9c9ab7be41d6dce3 (diff)
downloadgem5-33b28fde7aca9bf1ae16b9db09e71ccd44d3ae76.tar.xz
slicc: added MOESI_CMP_directory, DMA SequencerMsg, parameterized controllers
This changeset contains a lot of different changes that are too mingled to separate. They are: 1. Added MOESI_CMP_directory I made the changes necessary to bring back MOESI_CMP_directory, including adding a DMA controller. I got rid of MOESI_CMP_directory_m and made MOESI_CMP_directory use a memory controller. Added a new configuration for two level protocols in general, and MOESI_CMP_directory in particular. 2. DMA Sequencer uses a generic SequencerMsg I will eventually make the cache Sequencer use this type as well. It doesn't contain an offset field, just a physical address and a length. MI_example has been updated to deal with this. 3. Parameterized Controllers SLICC controllers can now take custom parameters to use for mapping, latencies, etc. Currently, only int parameters are supported.
Diffstat (limited to 'src/mem/slicc/parser')
-rw-r--r--src/mem/slicc/parser/parser.py28
-rw-r--r--src/mem/slicc/parser/parser.yy10
2 files changed, 14 insertions, 24 deletions
diff --git a/src/mem/slicc/parser/parser.py b/src/mem/slicc/parser/parser.py
index 1c7d582ec..95e8d25e5 100644
--- a/src/mem/slicc/parser/parser.py
+++ b/src/mem/slicc/parser/parser.py
@@ -76,7 +76,7 @@ tokens = [ 'EQ', 'NE', 'LT', 'GT', 'LE', 'GE',
'NOT', 'AND', 'OR',
'PLUS', 'DASH', 'STAR', 'SLASH',
'DOUBLE_COLON', 'SEMICOLON',
- 'ASSIGN', 'DOT', 'LATENCY',
+ 'ASSIGN', 'DOT',
'IDENT', 'LIT_BOOL', 'FLOATNUMBER', 'NUMBER', 'STRING' ]
tokens += reserved.values()
@@ -190,19 +190,8 @@ def p_decl(p):
| d_func_def"""
p[0] = p[1]
-def p_latency(p):
- """latency : LATENCY"""
- pass
-
-def p_latencies(p):
- """latencies : latency latencies
- | empty"""
- return []
-
def p_d_machine(p):
- """d_machine : MACHINE '(' ident pair_l ')' '{' decl_l '}'
- | MACHINE '(' ident pair_l ')' ':' type_members '{' decl_l '}'
- | MACHINE '(' ident pair_l ')' ':' latencies '{' decl_l '}'"""
+ """d_machine : MACHINE '(' ident pair_l ')' ':' param_l '{' decl_l '}'"""
if len(p) == 9:
decl_l = p[7]
@@ -542,10 +531,19 @@ def scan(filenames):
for filename in filenames:
lex.lexer.lineno = 1
try:
+ print "parsing ",filename
results = yacc.parse(file(filename, 'r').read())
- except (TokenError, ParseError), e:
- raise type(e), tuple([filename] + [ i for i in e ])
+ except (ParseError,TokenError), e:
+ print "File ",filename," ",e
+ raise e
+ #except ParseError, e:
+ # print "File ",filename," "e
+ # raise e, tuple([filename] + [ i for i in e ])
+
+ #except ParseError, e:
+ # print e
+
for result in results:
result.add(hh, cc)
diff --git a/src/mem/slicc/parser/parser.yy b/src/mem/slicc/parser/parser.yy
index fa5a3b355..c8cef3b21 100644
--- a/src/mem/slicc/parser/parser.yy
+++ b/src/mem/slicc/parser/parser.yy
@@ -111,8 +111,6 @@ extern "C" int yylex();
%type <expr_ptr> expr literal enumeration
%type <expr_vector_ptr> expr_list
-%type <stdstring_vector_ptr> myrule
-
%type <pair_ptr> pair
%type <pair_list_ptr> pair_list pairs
@@ -148,9 +146,7 @@ decls: decl decls { $2->insertAtTop($1); $$ = $2; }
| { $$ = new Vector<DeclAST*>; }
;
-decl: MACHINE_DECL '(' ident pair_list ')' ':' myrule '{' decl_list '}' { $$ = new MachineAST($3, $4, NULL, $7, $9); }
-// | MACHINE_DECL '(' ident pair_list ')' ':' type_members '{' decl_list '}' { $$ = new MachineAST($3, $4, $7, string_vector, $9); }
- | MACHINE_DECL '(' ident pair_list ')' '{' decl_list '}' { $$ = new MachineAST($3, $4, NULL, new vector<string*>(), $7); }
+decl: MACHINE_DECL '(' ident pair_list ')' ':' formal_param_list '{' decl_list '}' { $$ = new MachineAST($3, $4, $7, $9); }
| ACTION_DECL '(' ident pair_list ')' statement_list { $$ = new ActionDeclAST($3, $4, $6); }
| IN_PORT_DECL '(' ident ',' type ',' var pair_list ')' statement_list { $$ = new InPortDeclAST($3, $5, $7, $8, $10); }
| OUT_PORT_DECL '(' ident ',' type ',' var pair_list ')' SEMICOLON { $$ = new OutPortDeclAST($3, $5, $7, $8); }
@@ -336,10 +332,6 @@ var: ident { $$ = new VarExprAST($1); }
field: ident { $$ = $1; }
;
-myrule: myrule IDENT { $1->push_back($2); }
- | IDENT { $$ = new vector<string*>(1, $1); }
- ;
-
%%
extern FILE *yyin;