Re: [myhdl-list] Driving constants
Brought to you by:
jandecaluwe
From: Jan D. <ja...@ja...> - 2011-09-03 20:16:45
|
On 09/03/2011 12:39 PM, Sébastien Bourdeauducq wrote: > Hi, > > I need to create instances that only drive their output to some constant > level, e.g. the equivalent of: > > module foo(output bar); > assign bar = 1'b1; > endmodule > > I have tried doing: > def ImplementControl(self): > @always_comb > def logic(): > self.control.ack_o.next[0] = 1 > return logic > > but MyHDL doesn't cope with the empty sensitivity list. > > Setting the value at signal creation (e.g. things like > self.control.ack_o = Signal(intbv(1))) is not an option because it would > become very messy with my object-oriented approach. Besides, I would > find it surprising that describing something as basic as a constant > driver is an intractable problem in MyHDL. > > Any solutions? A signal that you don't drive in your code gives you a warning and the expected assign. To me, that is exactly what "constant" means. I don't see what's messy about it. Of course, one could use such a signal in an always_comb and assign it to another signal. Such an approach would be meaningful for parametrization (a signal which is sometimes a constant, in other cases driven in code). Jan -- Jan Decaluwe - Resources bvba - http://www.jandecaluwe.com Python as a HDL: http://www.myhdl.org VHDL development, the modern way: http://www.sigasi.com World-class digital design: http://www.easics.com |