Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

genlib/record: support passing params in same object

  • Loading branch information...
commit 018afe57ef52b8040934319cac848437a2ba0163 1 parent 4fb3e97
Sébastien Bourdeauducq authored

Showing 1 changed file with 12 additions and 2 deletions. Show diff stats Hide diff stats

  1. 14  migen/genlib/record.py
14  migen/genlib/record.py
@@ -56,11 +56,21 @@ def layout_partial(layout, *elements):
56 56
 		insert_ref.append(layout_get(copy_ref, last))
57 57
 	return r
58 58
 
  59
+class LayoutP:
  60
+	def __init__(self, layout, **layout_dict):
  61
+		self.layout = layout
  62
+		self.layout_dict = layout_dict
  63
+
59 64
 class Record:
60 65
 	def __init__(self, layout, name=None, **layout_dict):
61 66
 		self.name = get_obj_var_name(name, "")
62  
-		self.layout = layout
63  
-		self.layout_dict = layout_dict
  67
+		if isinstance(layout, LayoutP):
  68
+			self.layout = layout.layout
  69
+			self.layout_dict = layout.layout_dict
  70
+			assert(not layout_dict)
  71
+		else:
  72
+			self.layout = layout
  73
+			self.layout_dict = layout_dict
64 74
 
65 75
 		if self.name:
66 76
 			prefix = self.name + "_"

0 notes on commit 018afe5

Please sign in to comment.
Something went wrong with that request. Please try again.