Exemplo n.º 1
0
 def visit_Slice(self, node):
     if not isinstance(node.value, Signal):
         slice_proxy = Signal(value_bits_sign(node.value))
         if self.target_context:
             a = _Assign(node.value, slice_proxy)
         else:
             a = _Assign(slice_proxy, node.value)
         self.comb.append(self.visit_Assign(a))
         node = _Slice(slice_proxy, node.start, node.stop)
     return NodeTransformer.visit_Slice(self, node)
Exemplo n.º 2
0
	def visit_Assign(self, node):
		if isinstance(node.l, _ArrayProxy):
			k = self.visit(node.l.key)
			cases = {}
			for n, choice in enumerate(node.l.choices):
				assign = self.visit_Assign(_Assign(choice, node.r))
				cases[n] = [assign]
			return Case(k, cases).makedefault()
		else:
			return NodeTransformer.visit_Assign(self, node)
Exemplo n.º 3
0
 def visit_Slice(self, node):
     if not isinstance(node.value, Signal):
         slice_proxy = Signal(value_bits_sign(node.value))
         if self.target_context:
             a = _Assign(node.value, slice_proxy)
         else:
             a = _Assign(slice_proxy, node.value)
         self.comb.append(self.visit_Assign(a))
         node = _Slice(slice_proxy, node.start, node.stop)
     return NodeTransformer.visit_Slice(self, node)
Exemplo n.º 4
0
 def visit_Part(self, node):
     value_proxy = node.value
     offset_proxy = node.offset
     if not isinstance(node.value, Signal):
         value_proxy = Signal(value_bits_sign(node.value))
         if self.target_context:
             a = _Assign(node.value, value_proxy)
         else:
             a = _Assign(value_proxy, node.value)
         self.comb.append(self.visit_Assign(a))
     if not isinstance(node.offset, Signal):
         offset_proxy = Signal(value_bits_sign(node.offset))
         if self.target_context:
             a = _Assign(node.offset, offset_proxy)
         else:
             a = _Assign(offset_proxy, node.offset)
         self.comb.append(self.visit_Assign(a))
     node = _Part(value_proxy, offset_proxy, node.width)
     return NodeTransformer.visit_Part(self, node)
Exemplo n.º 5
0
 def visit_Part(self, node):
     value_proxy = node.value
     offset_proxy = node.offset
     if not isinstance(node.value, Signal):
         value_proxy = Signal(value_bits_sign(node.value))
         if self.target_context:
             a = _Assign(node.value, value_proxy)
         else:
             a = _Assign(value_proxy, node.value)
         self.comb.append(self.visit_Assign(a))
     if not isinstance(node.offset, Signal):
         offset_proxy = Signal(value_bits_sign(node.offset))
         if self.target_context:
             a = _Assign(node.offset, offset_proxy)
         else:
             a = _Assign(offset_proxy, node.offset)
         self.comb.append(self.visit_Assign(a))
     node = _Part(value_proxy, offset_proxy, node.width)
     return NodeTransformer.visit_Part(self, node)