Quadruple assignment

M

Merciadri Luca

-----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-----
 
J

Jonathan Bromley

==
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?

Only you can answer that :)
 
M

Merciadri Luca

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

Jonathan Bromley said:
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.
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-----
 
R

rickman

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.


Only you can answer that :)

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
 
M

Mike Treseler

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
 
R

rickman

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

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
 
M

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?

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
 
R

rickman

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.

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top