>Hi,
>I'm new to verilog and i wanted to know, what would happen if i were
>to increment a 1-bit register over and over? would it just toggle
>between 0 and 1?
Yes exactly.
> or would i produce some kind of error during
>synthesis?
No, what you want is well-defined and would work the way you imagine.
On Aug 30, 12:52 pm, Muzaffer Kal <k...@dspia.com> wrote:
> On Sat, 30 Aug 2008 09:27:18 -0700 (PDT), laserbeak43
>
> It would also pay it one hell of a nice complement.
<groan>
That was going a "bit" too far! ;)
Regards,
--
Mark McDougall, Engineer
Virtual Logic Pty Ltd, <http://www.vl.com.au>
21-25 King St, Rockdale, 2216
Ph: +612-9599-3255 Fax: +612-9599-3266
Ok follow up question...would doing that be the best way of toggling a
bit, or would using the ! operator or the ~ operator be better? Can
never tell with these cells being the way they are...I implemented a
half-adder using gates just to see if it was actually more efficient
(i.e. used fewer "equivalent gates" or what have you) than just using
the + operator. Of course, the + operator was more effective in that
regard and far easier to read. Thoughts?
> + operator was more effective in that
>regard and far easier to read. Thoughts?
huh? If your design intent is to toggle a
register, then surely
R <= ~R;
is much clearer and easier to read than
R <= R + 1;
The former looks like flipping a bit; the latter
looks like arithmetic. Arithmetic on single-bit
operands is somewhat un-intuitive for many folk,
me included, and I usually try to avoid it. YMMV.
--
Jonathan Bromley, Consultant
DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services
Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
jonathan...@MYCOMPANY.com
http://www.MYCOMPANY.com
The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.
> Ok follow up question...would doing that be the best way of toggling a
> bit, or would using the ! operator or the ~ operator be better? Can
> never tell with these cells being the way they are...
You could always implement each and look at the resulting equations
produced by the synthesizer. That way you wouldn't have to rely on our
"opinions" and an added benefit is that you might accidently learn more
than you originally intended! ;)
wow had no idea this thread was still going. thanks a lot for your
help.
these are all things i'll be sure to consider.
a bit too far LOL!! i'm glad to see it's not illegal to have a sense
of
humor here :)