ISA Parser: runtime read, write conditions for registers
Review Request #1154 - Created April 16, 2012 and discarded
| Information | |
|---|---|
| Nilay Vaish | |
| gem5 | |
| default | |
| Reviewers | |
| Default | |
Changeset 8959:c261b42c18bf --------------------------- ISA Parser: runtime read, write conditions for registers This patch allows for operands to make run time decision, whether they should be read/written at all.
Issue Summary
3
3
0
0
| Description | From | Last Updated | Status |
|---|---|---|---|
| What's preventing _numSrcRegs from already including this register? Also, there's a mapping between the operand number and this array. If ... | Gabe Black | April 21, 2012, 1:08 p.m. | Open |
| Here and below, I'm fine with dropping the braces after the generated "if" to avoid the second python "if" clause. ... | Steve Reinhardt | April 22, 2012, 11:21 a.m. | Open |
| I'm sure there's a cleaner way to do this (not Nilay's fault, but the first I've really seen this code, ... | Steve Reinhardt | April 22, 2012, 11:21 a.m. | Open |
Review request changed
Updated (April 21, 2012, 6:11 a.m.)
Summary: |
|
||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description: |
|
||||||||||||||||||||||||||||||||||||||||||||||||
Diff: |
Revision 2 (+21 -3) |
Review request changed
Updated (April 21, 2012, 6:11 a.m.)
Summary: |
|
||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description: |
|
||||||||||||||||||||||||
Diff: |
Revision 3 (+21 -3) |
Posted (April 21, 2012, 1:08 p.m.)
In concept this is ok, but I don't think it will work for reasons I've mentioned inline. Even if it's a really artificial test, you should be sure to try out these sorts of things and make sure they do what you expect. There are lots of intricacies in the parser that are easy to miss.
-
src/arch/isa_parser.py (Diff revision 3) -
What's preventing _numSrcRegs from already including this register? Also, there's a mapping between the operand number and this array. If the numbering is off because something got skipped, then you'll read the wrong registers.
Posted (April 22, 2012, 11:21 a.m.)
Looks reasonable to me. There might be better names than "read_condition" and "write_condition" though... particularly in the context of the current discussion, it sounds like there's some tie-in with condition codes that doesn't exist. What about "read_test" or "read_predicate"?
-
src/arch/isa_parser.py (Diff revision 3) -
Here and below, I'm fine with dropping the braces after the generated "if" to avoid the second python "if" clause. I'm not so wedded to the style guide that I think auto-generated code has to follow it even when it makes the generator more complex. Alternatively, something like: c = '\n\t_srcRegIdx[] = ...;' if self.read_condition: c = 'if (%s) {\n %s\n}' % (self.reg_spec, c) would be IMO a cleaner way to put braces around the code. Or as a third alternative, make the generated "if" unconditional, but default read_condition to "true" rather than None. Any of these would be preferable to me. The meta point is that simplicity & readability of the code generator should trump simplicity & readability of the generated code. -
src/arch/isa_parser.py (Diff revision 3) -
I'm sure there's a cleaner way to do this (not Nilay's fault, but the first I've really seen this code, and Nilay is just making it worse). If None is the default value for all the optional attributes, you could do: val += [None]*4 # pad in case optional args are missing base_cls_name, dflt_ext, reg_spec, flags, sort_pri, \ read_code, write_code, read_condition, write_condition = val[:9] and get rid of all the "if"s. Or put parens around the LHS and you wouldn't need the backslash.
