Re: [myhdl-list] Signal initialization
Brought to you by:
jandecaluwe
From: Martin T. <mar...@tr...> - 2012-12-03 09:57:08
|
Angel Ezquerra <ang...@gm...> writes: > I was thinking of the behavior of the code when some signals are still > not initialized (i.e. undefined). The "stdl" and "bool" functions on > the pck_myhdl helper file use comparions with 0 and '1' > (respectively), and I am unsure as to how those will behave when fed > and undefined value: > > function stdl (arg: integer) return std_logic is > begin > if arg /= 0 then > return '1'; > else > return '0'; > end if; > end function stdl; You can't feed that an uninitalised value - it takes an integer :) > > function bool (arg: std_logic) return boolean is > begin > return arg = '1'; > end function bool; > That'll return false for everything other than a '1', so a 'U' (and 'X', and 'Z'...). Also, 'H' will return false which may or may not be regarded as a bug? > In addition I wonder if this will not make VHDL simulations slower > unnecessarily? I don't know... it just feels a bit unnecessary. > I imagine this is a case of correctness-first, performance later (and only if a proven benefit can be demonstrated) Cheers, Martin -- mar...@tr... TRW Conekt - Consultancy in Engineering, Knowledge and Technology http://www.conekt.co.uk/capabilities/39-electronic-hardware |