Quadruple assignment

  • Follow


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

Say you define

==
signal sig1, sig2, sig3, sig4: natural range 0 to MAX_VALUE := 0;
==

where MAX_VALUE is a constant. My ghdl compiler will be okay with this
statement, but what is its result? I would like to define sig1, sig2,
sig3 and sig4 to be, initially, 0. But does that actually achieve what
I want?

Thanks.
- -- 
Merciadri Luca
See http://www.student.montefiore.ulg.ac.be/~merciadri/
- -- 

Men are more moral than they think, and far more immoral than they can imagine. (Sigmund Freud)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>

iEYEARECAAYFAkzOmmMACgkQM0LLzLt8MhwCsgCeL5Wyg61PIBrvIrfWdgo3DWwg
Ks8An2MDR1ZI1eg94AnABFWHDWlAIQX4
=kd8P
-----END PGP SIGNATURE-----
0
Reply Merciadri 11/1/2010 10:45:56 AM

On Nov 1, 10:45=A0am, Merciadri Luca wrote:

> =3D=3D
> signal sig1, sig2, sig3, sig4: natural range 0 to MAX_VALUE :=3D 0;
> =3D=3D
>
> where MAX_VALUE is a constant. My ghdl compiler will be okay with this
> statement, but what is its result?

Each of your four signals has the same subtype
(0 to MAX_VALUE).  The explicit initialization ":=3D0"
is redundant, because any VHDL variable or signal is
initialized to the left-most value in its value set;
in your case that value is 0 anyway.  All four
signals will have 0 as their initialization value.

Note that the initial value is associated with
the subtype part of the declaration.  It is not
attached to each individual data object; it
applies to all four of them.

> But does that actually achieve what I want?

Only you can answer that :-)
--
Jonathan Bromley
0
Reply Jonathan 11/1/2010 12:09:38 PM


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jonathan Bromley <spam@oxfordbromley.plus.com> writes:

> On Nov 1, 10:45 am, Merciadri Luca wrote:
>
>> ==
>> signal sig1, sig2, sig3, sig4: natural range 0 to MAX_VALUE := 0;
>> ==
>>
>> where MAX_VALUE is a constant. My ghdl compiler will be okay with this
>> statement, but what is its result?
>
> Each of your four signals has the same subtype
> (0 to MAX_VALUE).  The explicit initialization ":=0"
> is redundant, because any VHDL variable or signal is
> initialized to the left-most value in its value set;
> in your case that value is 0 anyway.  All four
> signals will have 0 as their initialization value.
>
> Note that the initial value is associated with
> the subtype part of the declaration.  It is not
> attached to each individual data object; it
> applies to all four of them.
>
>> But does that actually achieve what I want?
Thanks. I did not know it! :-)


- -- 
Merciadri Luca
See http://www.student.montefiore.ulg.ac.be/~merciadri/
- -- 

In matters of style, swim with the current; in matters of principle, stand like a rock. (Thomas Jefferson)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>

iEYEARECAAYFAkzOwNgACgkQM0LLzLt8MhxJwACeKXQNuw9b/r6HNoEuvLaCpStI
NRAAn3Qn6Csb4hEWtME0lXKaXPrQik/m
=gThP
-----END PGP SIGNATURE-----
0
Reply Merciadri 11/1/2010 1:30:00 PM

On Nov 1, 8:09=A0am, Jonathan Bromley <s...@oxfordbromley.plus.com>
wrote:
> On Nov 1, 10:45=A0am, Merciadri Luca wrote:
>
> > =3D=3D
> > signal sig1, sig2, sig3, sig4: natural range 0 to MAX_VALUE :=3D 0;
> > =3D=3D
>
> > where MAX_VALUE is a constant. My ghdl compiler will be okay with this
> > statement, but what is its result?
>
> Each of your four signals has the same subtype
> (0 to MAX_VALUE). =A0The explicit initialization ":=3D0"
> is redundant, because any VHDL variable or signal is
> initialized to the left-most value in its value set;
> in your case that value is 0 anyway. =A0All four
> signals will have 0 as their initialization value.
>
> Note that the initial value is associated with
> the subtype part of the declaration. =A0It is not
> attached to each individual data object; it
> applies to all four of them.
>
> > But does that actually achieve what I want?
>
> Only you can answer that :-)
> --
> Jonathan Bromley

That may be true for simulation, but for synthesis the initialization
is often used for the initial value set during configuration.  If the
explicit assignment is omitted, will the synthesis tool match the
simulation?

Rick
0
Reply rickman 11/5/2010 10:04:56 AM

On 11/5/2010 3:04 AM, rickman wrote:

> That may be true for simulation, but for synthesis the initialization
> is often used for the initial value set during configuration.  If the
> explicit assignment is omitted, will the synthesis tool match the
> simulation?

I would consider it unsafe to count on value of an internal register 
between power up configuration and system reset, for any target device.
So I guess I see no reason to simulate it.


          -- Mike Treseler
0
Reply Mike 11/6/2010 10:14:44 PM

On Nov 6, 5:14=A0pm, Mike Treseler <mtrese...@gmail.com> wrote:
> On 11/5/2010 3:04 AM, rickman wrote:
>
> > That may be true for simulation, but for synthesis the initialization
> > is often used for the initial value set during configuration. =A0If the
> > explicit assignment is omitted, will the synthesis tool match the
> > simulation?
>
> I would consider it unsafe to count on value of an internal register
> between power up configuration and system reset, for any target device.
> So I guess I see no reason to simulate it.
>
> =A0 =A0 =A0 =A0 =A0 -- Mike Treseler

I'm not sure what your point is.  Are you saying that you don't make
use of the built in global reset function?  That value matches the
configuration reset value.  Of course if you use logic to generate
your own system reset you can set it to whatever you want independent
of the configuration value.  But that is out of context to what
Jonathan was saying which is what I was replying to.

Rick
0
Reply rickman 11/8/2010 4:53:43 PM

On 11/8/2010 8:53 AM, rickman wrote:

> I'm not sure what your point is.  Are you saying that you don't make
> use of the built in global reset function?

I use Altera parts, and the internal "reset" logic is fixed.
Pins go to Z and flops go to 0.

> Of course if you use logic to generate
> your own system reset you can set it to whatever you want independent
> of the configuration value.

This is what I have have always done.
Otherwise, the only way to force a "reset"
is to reload the configuration.

       -- Mike Treseler
0
Reply Mike 11/9/2010 6:13:38 PM

On Nov 9, 1:13=A0pm, Mike Treseler <mtrese...@gmail.com> wrote:
> On 11/8/2010 8:53 AM, rickman wrote:
>
> > I'm not sure what your point is. =A0Are you saying that you don't make
> > use of the built in global reset function?
>
> I use Altera parts, and the internal "reset" logic is fixed.
> Pins go to Z and flops go to 0.

I thought they had dropped that long ago.  I have used some pretty old
Altera parts and what they do to provide a preset condition is to
reset the FF and treat the signal as a low true.  Otherwise there are
things you couldn't do properly.


> > Of course if you use logic to generate
> > your own system reset you can set it to whatever you want independent
> > of the configuration value.
>
> This is what I have have always done.
> Otherwise, the only way to force a "reset"
> is to reload the configuration.

I am pretty sure Altera parts have the exact same functionality of a
system reset that the Xilinx and Lattice parts do, but it has been
years since I have used their tools.  One of us needs to check the
docs... I'll do that when I get some time.

Rick
0
Reply rickman 11/10/2010 12:49:52 PM

7 Replies
53 Views

(page loaded in 0.094 seconds)

Similiar Articles:





7/16/2012 8:55:42 AM


Reply: