Skip to content

Commit

Permalink
genlib/record: support passing params in same object
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastien Bourdeauducq committed Oct 21, 2013
1 parent 4fb3e97 commit 018afe5
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions migen/genlib/record.py
Expand Up @@ -56,11 +56,21 @@ def layout_partial(layout, *elements):
insert_ref.append(layout_get(copy_ref, last))
return r

class LayoutP:
def __init__(self, layout, **layout_dict):
self.layout = layout
self.layout_dict = layout_dict

class Record:
def __init__(self, layout, name=None, **layout_dict):
self.name = get_obj_var_name(name, "")
self.layout = layout
self.layout_dict = layout_dict
if isinstance(layout, LayoutP):
self.layout = layout.layout
self.layout_dict = layout.layout_dict
assert(not layout_dict)
else:
self.layout = layout
self.layout_dict = layout_dict

if self.name:
prefix = self.name + "_"
Expand Down

0 comments on commit 018afe5

Please sign in to comment.