Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - Bit Reset

 
Thread Tools Search this Thread
Old 10-21-2004, 08:45 PM   #1
Default Bit Reset


Hi

This problem is a bit hard to explain, but I'll try anyway.

I have a register in my system, which contains a bit. When the user writes
a 1 to this bit, it signals to the system that it should perform a task.
Once the task is complete I would like to clear the bit. If the bit isn't
cleared the system will get stuck in an endless loop.

Does anyone know any good techniques for clearing a bit, which is settable
by the user? Or in other words, how can I set the bit in one process and
then clear it in another?

Surely this is a common problem.

Thanks for any help.




Hans
  Reply With Quote
Old 10-21-2004, 09:23 PM   #2
rickman
 
Posts: n/a
Default Re: Bit Reset
Hans wrote:
>
> Hi
>
> This problem is a bit hard to explain, but I'll try anyway.
>
> I have a register in my system, which contains a bit. When the user writes
> a 1 to this bit, it signals to the system that it should perform a task.
> Once the task is complete I would like to clear the bit. If the bit isn't
> cleared the system will get stuck in an endless loop.
>
> Does anyone know any good techniques for clearing a bit, which is settable
> by the user? Or in other words, how can I set the bit in one process and
> then clear it in another?


You want a finite state machine (FSM). You need at least three states
and possibly four. I'll draw a diagram. Use a non-proportional font to
view.

~TRIGGER ~DONE TRIGGER
--- ----- ------
| | | | | |
V | TRIGGER V | DONE V | ~TRIGGER
+--> IDLE -------> START -------> FINISHED -------+
| |
+------------------------------------------------------+

If your trigger is short enough that it is guaranteed to be gone by the
time the task is done, then you can eliminate the FINISHED state.
Otherwise you will need more than one bit.

--

Rick "rickman" Collins


Ignore the reply address. To email me use the above address with the XY
removed.

Arius - A Signal Processing Solutions Company
Specializing in DSP and FPGA design URL http://www.arius.com
4 King Ave 301-682-7772 Voice
Frederick, MD 21701-3110 301-682-7666 FAX


rickman
  Reply With Quote
Old 10-21-2004, 09:38 PM   #3
rickman
 
Posts: n/a
Default Re: Bit Reset
rickman wrote:
>
> Hans wrote:
> >
> > Hi
> >
> > This problem is a bit hard to explain, but I'll try anyway.
> >
> > I have a register in my system, which contains a bit. When the user writes
> > a 1 to this bit, it signals to the system that it should perform a task.
> > Once the task is complete I would like to clear the bit. If the bit isn't
> > cleared the system will get stuck in an endless loop.
> >
> > Does anyone know any good techniques for clearing a bit, which is settable
> > by the user? Or in other words, how can I set the bit in one process and
> > then clear it in another?

>
> You want a finite state machine (FSM). You need at least three states
> and possibly four. I'll draw a diagram. Use a non-proportional font to
> view.
>
> ~TRIGGER ~DONE TRIGGER
> --- ----- ------
> | | | | | |
> V | TRIGGER V | DONE V | ~TRIGGER
> +--> IDLE -------> START -------> FINISHED -------+
> | |
> +------------------------------------------------------+
>
> If your trigger is short enough that it is guaranteed to be gone by the
> time the task is done, then you can eliminate the FINISHED state.
> Otherwise you will need more than one bit.


I sort of goofed up. Just like you need to make sure your TRIGGER
signal is gone before you return to the IDLE state, you need to make
sure your DONE signal is gone before you reach the START state. I guess
you could combine these conditions and still only have a single bit
FSM. But this will depend on the timing of the TRIGGER and DONE signals
and the particulars of your design. For the most general case where you
know nothing about the TRIGGER and DONE signals, you need a four state
machine which will require 2 bits minimum.

--

Rick "rickman" Collins


Ignore the reply address. To email me use the above address with the XY
removed.

Arius - A Signal Processing Solutions Company
Specializing in DSP and FPGA design URL http://www.arius.com
4 King Ave 301-682-7772 Voice
Frederick, MD 21701-3110 301-682-7666 FAX


rickman
  Reply With Quote
Old 10-22-2004, 01:02 PM   #4
Tom Verbeure
 
Posts: n/a
Default Re: Bit Reset
How about something like this:
- Trigger is a signal from the user
- TaskDone is a signal from the task


process(Clk)
begin
if rising_edge(Clk)
if Trigger = '1' then
ActiveBit <= '1';
end if;

if TaskDone = '1' then
ActiveBit <= '0';
end if;
end process;
This seems to be too straightforward.
Did I miss something?


Tom



Tom Verbeure
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Reset / Recover Forgotten Windows NT / 2000 / XP / 2003 Administrator Password wskaihd Software 2 11-17-2009 02:01 AM
Linksys Srw2008p Reset sja Hardware 0 02-03-2009 07:53 PM
Marantz dv4300 factory reset rufus DVD Video 0 02-15-2004 01:12 AM
Any way to reset an Apex DVD to factory default? Paul Soderman DVD Video 1 11-23-2003 01:48 AM
Beeping during boot, reset to boot correctly Richard A+ Certification 1 08-15-2003 03:39 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46