M
Mike Treseler
Guest
Andy wrote:
But once on top of the "variable" hill,
I can write a sequential description
that is easy for me to understand a year from now.
Let say I want to describe a phase accumulator
in the traditional manner.
With a mult-process design, I might
say something like:
accum_s <= '0' & accum_s(accum_s'length - 2 downto 0)
+ ('0' & addend_c);
in one process and pick up the
output msb in another process:
msb <= accum_s(accum_s'length - 1);
Thats not too bad, but it's pretty easy
to get a count or length off by one.
I prefer a single process description
like this that does exactly the same thing.
...
accum_v := accum_v + addend_c; -- add magic number
msb_v := accum_v(accum_v'length-1); -- save the carry bit
accum_v(accum_v'length-1) := '0'; -- clear carry for next time
...
-- Now use msb_v however I like down here ...
To me, there is no comparison.
It's like calculus vs Laplace transforms.
-- Mike Treseler
Yes, it is a big hill to climb in either case.When I first started flirting with variables in VHDL synthesis,
understanding how they mapped to hardware took some time. OTOH, when I
first started coding VHDL at all, understanding the non-sequential
nature of signal assignment statements in sequential code took a while
too.
But once on top of the "variable" hill,
I can write a sequential description
that is easy for me to understand a year from now.
Let say I want to describe a phase accumulator
in the traditional manner.
With a mult-process design, I might
say something like:
accum_s <= '0' & accum_s(accum_s'length - 2 downto 0)
+ ('0' & addend_c);
in one process and pick up the
output msb in another process:
msb <= accum_s(accum_s'length - 1);
Thats not too bad, but it's pretty easy
to get a count or length off by one.
I prefer a single process description
like this that does exactly the same thing.
...
accum_v := accum_v + addend_c; -- add magic number
msb_v := accum_v(accum_v'length-1); -- save the carry bit
accum_v(accum_v'length-1) := '0'; -- clear carry for next time
...
-- Now use msb_v however I like down here ...
To me, there is no comparison.
It's like calculus vs Laplace transforms.
-- Mike Treseler