Subject: Re: [vhdl-200x] Corrections to Minutes for VHDL-200X-FT meeting, San Jose Dec 4, 2003
From: Andy D Jones (andy.d.jones@lmco.com)
Date: Wed Dec 17 2003 - 13:00:02 PST
Actually, it will support "if rising_edge(clk) and enable = '1' then"
In 1076.6-1999 and P1076.6-200X (VHDL RTL Synthesis Coding Styles
Standard), it was decided that it would
be either difficult or impossible to get synthesis tool
vendors to evaluate the process based on the sensitivity list.
As a result all portable coding styles specified by the standard
must some how imply a clock edge inside the process, indepdendent
of the sensitivity lsit.
Hence, to do what you want, P1076.6-200X (comming soon) supports:
if rising_edge(Clk) and enable then
Agreed, and good.
Rising_edge returns boolean. Hence we need the overloaded logic
operators. As Steve corrected me, the overloaded logic
operators allow mixed boolean and std_ulogic and return std_ulogic.
Hence, using std_logic rather than explicit boolean expressions
will either produce the same result or produce a result that
is more accurate.
BTW, if you want a gated clock, P1076.6-200X has an attribute
that can be set on a clock signal to transfor the above code
into a gated clock:
attribute GATE_CLK : boolean;
attribute GATE_CLK of Clk : signal is true;
. . .
GatedClockProc : process(Clk)
begin
if rising_edge(Clk) and LoadEn='1' then
Q <= D ;
end if ;
end process ;
For signed math:
signal A, B, Y : integer range -8 to 7 ;
-- What do you need to add here to get Y in the correct range?
Should it clip or should it modulo?
Y <= A + B ;
I've got a better question: arithmetically, what will the above, using vector addition do?
There is nothing to debate about integers. There is a desire
to make them more useful for design.
My point above,Seldom is a rollover in signed arithmetic really what you wanted. But vector arithmetic will do that happily and silently for you. When the algorithms are developed, they assume correct arithmetic, and integers deliver that, or warn you that it isn't happening.
is that unsigned math is easy. Signed math takes some work
to make it work well as an integer.
Vectors always does modulo:My example was poorly constructed to illustrate this, but integers allow different sizes of addends and results, so you could have a result that cannot overflow (8bit + 8bit = 9bit) without resorting to extra signals, concatenation and subranges.
signal A, B, Y : signed (3 downto 0) ;
Y <= A + B ;
Vectors do allow different sizes.
The largest array needs argument needs to match the size of the result.
The other one gets extended by the rules of the type (signed, unsigned).
So, your accumulator:
signal Y : unsigned (7 downto 0) ;
signal B : unsigned (5 downto 0) ;
Y <= Y + B ;
Need a carry out (unsigned), no problem:
signal cY : unsigned (8 downto 0) ;
cY <= ('0' & Y) + B ;
Y <= cY(Y'range) ;
And this is supposed to be easier to understand than the following equivalent using integers?
. . .
if cY(cY'left) = '1' then -- detecting carry out
I've only tried this on the two synthesis tools we have (synplicity and synopsys), and both are identical in their optimization of this construct.
With vectors, I know I am going to get the same quality
optimization on every synthesis tool.
With integers, I would be concerned about how well the
synthesis tool optimized the expressions to effect the sharing:
Y <= (Y + B) mod 256 ;
if (Y+B) > 255 then
With this coding, I would expect synthesis to take longer.
I prefer a little more explicit control over synthesis.
Amen!
> I just wish support for 64 bit unsigned integers was standard.
Hopefully we can either add this or some arbitrarily large integer
(because 64 bit will tap out also).
I have no doubt that what you and others want to do will function "correctly" in all test cases. But I still believe it removes necessary clarity, and will inevitably lead to the inclusion of boolean equivalency everywhere (expressions, etc.)
I maintain that there is no way to "do it right" without flying in the face of the main strength of vhdl.So far as I can see the proposal has stood up to all testcases.
Regards,
Jim
This archive was generated by hypermail 2b28 : Wed Dec 17 2003 - 13:02:56 PST