Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

bank/description: modify reg/mem in-place

  • Loading branch information...
commit 52d13959f2eac08c129da014298960c0d40caf6b 1 parent c99cc93
Sébastien Bourdeauducq authored

Showing 1 changed file with 8 additions and 14 deletions. Show diff stats Hide diff stats

  1. 22  migen/bank/description.py
22  migen/bank/description.py
... ...
@@ -1,5 +1,3 @@
1  
-from copy import copy
2  
-
3 1
 from migen.fhdl.structure import *
4 2
 from migen.fhdl.specials import Memory
5 3
 from migen.fhdl.tracer import get_obj_var_name
@@ -53,20 +51,12 @@ def __init__(self, size=1, access_bus=READ_WRITE, access_dev=READ_ONLY, reset=0,
53 51
 		RegisterFields.__init__(self, self.field, name=name)
54 52
 
55 53
 def regprefix(prefix, registers):
56  
-	r = []
57 54
 	for register in registers:
58  
-		c = copy(register)
59  
-		c.name = prefix + c.name
60  
-		r.append(c)
61  
-	return r
  55
+		register.name = prefix + register.name
62 56
 
63 57
 def memprefix(prefix, memories):
64  
-	r = []
65 58
 	for memory in memories:
66  
-		c = copy(memory)
67  
-		c.name_override = prefix + c.name_override
68  
-		r.append(c)
69  
-	return memories
  59
+		memory.name_override = prefix + memory.name_override
70 60
 
71 61
 class AutoReg:
72 62
 	def get_memories(self):
@@ -75,7 +65,9 @@ def get_memories(self):
75 65
 			if isinstance(v, Memory):
76 66
 				r.append(v)
77 67
 			elif hasattr(v, "get_memories") and callable(v.get_memories):
78  
-				r += memprefix(k + "_", v.get_memories())
  68
+				memories = v.get_memories()
  69
+				memprefix(k + "_", memories)
  70
+				r += memories
79 71
 		return sorted(r, key=lambda x: x.huid)
80 72
 
81 73
 	def get_registers(self):
@@ -84,7 +76,9 @@ def get_registers(self):
84 76
 			if isinstance(v, _Register):
85 77
 				r.append(v)
86 78
 			elif hasattr(v, "get_registers") and callable(v.get_registers):
87  
-				r += regprefix(k + "_", v.get_registers())
  79
+				registers = v.get_registers()
  80
+				regprefix(k + "_", registers)
  81
+				r += registers
88 82
 		return sorted(r, key=lambda x: x.huid)
89 83
 
90 84
 (ALIAS_NON_ATOMIC, ALIAS_ATOMIC_HOLD, ALIAS_ATOMIC_COMMIT) = range(3)

0 notes on commit 52d1395

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