Dev Team,

Question for you. I've tried implementing a couple examples with migen and
I am running into two consistent problems. I am sure I am just missing
something simple.

One module I am implementing is the Blinker module from your tutorial
document and the other is a popular D Flipflop tutorial that is going
around. Each have a call in the do_simulation method calling s.rd and s.wr
respectivly. I get the following error (with the Blinker module
specifically):

Traceback (most recent call last):
  File "Blinker.py", line 27, in <module>
    sim.run(200)
  File
"/usr/local/lib/python3.3/dist-packages/migen-unknown-py3.3.egg/migen/sim/generic.py",
line 119, in run
    s(self)
  File
"/usr/local/lib/python3.3/dist-packages/migen-unknown-py3.3.egg/migen/sim/upper.py",
line 101, in do_simulation
    simf(proxy)
  File "Blinker.py", line 17, in do_simulation
    v_led = s.rd(led) # read the current signal value
  File
"/usr/local/lib/python3.3/dist-packages/migen-unknown-py3.3.egg/migen/sim/upper.py",
line 40, in __getattr__
    return self.__process_get(getattr(self._simproxy_obj, name))
  File
"/usr/local/lib/python3.3/dist-packages/migen-unknown-py3.3.egg/migen/fhdl/module.py",
line 135, in __getattr__
    raise AttributeError("'"+self.__class__.__name__+"' object has no
attribute '"+name+"'")
AttributeError: 'Blinker' object has no attribute 'rd'

Any idea of what I could be doing wrong? I have attached the two source
files I am using.

Thanks for any help you can provide!

Cheers!
Brian


-- 
Brian McLaughlin

Twitter <http://twitter.com/bjmclaughlin> |
Google+<https://plus.google.com/u/0/108481953499321887963/>|
GeekDad <http://www.geekdad.com> | About
Me<http://www.makersassemble.com/about-me/>
from migen.sim.generic import Simulator, TopLevel
from migen.fhdl.std import *

class Blinker(Module):
	def __init__(self, led, maxperiod):
		counter = Signal(max=maxperiod+1)
		period = Signal(max=maxperiod+1)
		self.comb += period.eq(maxperiod)
		self.sync += If(counter == 0,
						led.eq(led),
						counter.eq(period)
					).Else(
						counter.eq(counter - 1)
					)

	def do_simulation(self, s):
		v_led = s.rd(led) # read the current signal value
		if v_led != self.v_led_old:
			print("{old}->{new} cycle={cycle}".format(
				old=self.v_led_old, new=v_led, cycle=s.cycle_counter))
			self.v_led_old = v_led

led = Signal()
my_blinker = Blinker(led, 30000000)

sim = Simulator(my_blinker, TopLevel("ledblinker.vcd"))
sim.run(200)
from migen.fhdl.std import *
from migen.fhdl import verilog
from migen.sim.generic import Simulator, TopLevel
from random import randrange

class Dflipflop(Module):
  def __init__(self, D, Q, Qi):
    self.sync += Q.eq(D)
    self.comb += Qi.eq(~Q)

  def do_simulation(self,s):
    s.wr(D,randrange(2))

#Simulation and verilog conversion
D  = Signal()
Q  = Signal()
Qi = Signal()

#print(verilog.convert(Dflipflop(D, Q, Qi), ios={D,Q,Qi}))

sim = Simulator(Dflipflop(D,Q,Qi), TopLevel("Dff.vcd"))
sim.run(100)
_______________________________________________
Devel mailing list
[email protected]
https://ssl.serverraum.org/lists/listinfo/devel

Reply via email to