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

Reply

VHDL - How can I avoid multiple execution when handshaking operations?

 
Thread Tools Search this Thread
Old 04-17-2007, 04:13 PM   #1
Default How can I avoid multiple execution when handshaking operations?


As a newbie I would like to know what the code would look like for an
entity that behaves in the following manner:

1) It has an integer/enumeration input that is used by clients
to tell it the type of operation to perform.
2) The clients set an 'Start' bit to indicate that the entity
should perform the operation.
3) The clients then wait on a 'Ready' bit which is set by the
entity when it has completed the operation.

My main concern is how to code this in such a manner that the entity
doesn't repeat the operation ad nauseum, due to the fact that there
doesn't seem to be any clean way for the 'Start' bit to be cleared (and
hence stop the entity from repeating the operating as soon as it
completes one cycle).

I suspect that the solution relies somehow on only triggering the
operation on the transition on the Execute bit, but I'm not sure what
the code would look like.

Thanks for any info.


Anon Anon
  Reply With Quote
Old 04-17-2007, 04:25 PM   #2
canadianJaouk
 
Posts: n/a
Default Re: How can I avoid multiple execution when handshaking operations?
If you fire off a transition, then you'll need to make sure that the
clients generate a transition the next time they want the process to
run. From you post, it seemed there was no plan to clear that start
bit. If you don't clear it, you won't be able to generate a new
transition, leaving you with the same problem. That bit needs to be
cleared either by the client or the unit.




canadianJaouk
  Reply With Quote
Old 04-17-2007, 04:35 PM   #3
Anon Anon
 
Posts: n/a
Default Re: How can I avoid multiple execution when handshaking operations?
canadianJaouk wrote:
> If you fire off a transition, then you'll need to make sure that the
> clients generate a transition the next time they want the process to
> run. From you post, it seemed there was no plan to clear that start
> bit. If you don't clear it, you won't be able to generate a new
> transition, leaving you with the same problem. That bit needs to be
> cleared either by the client or the unit.
>
>


Sorry - I should have made that clearer: please assume that the client
clears the 'Start' bit as soon as it detects that the 'Ready' bit has
been set. It then modifies the operation code and sets the Start bit
once more to repeat the process all over again.

What I really want to know is, what does the internal code of the entity
look like to make it execute the command once only?


Anon Anon
  Reply With Quote
Old 04-17-2007, 04:57 PM   #4
canadianJaouk
 
Posts: n/a
Default Re: How can I avoid multiple execution when handshaking operations?
> What I really want to know is, what does the internal code of the entity
> look like to make it execute the command once only?


then firing off the rising edge of the start signal should be the way
to go, like you suggested in your first post. You need to code a
simple edge detector for that. I assume you have a main clock in your
unit. What you need to do goes like this

signal start_rise : std_logic;
signal start_ff : std_logic;

....

process(reset, clk)
begin
if reset = '1' then
start_ff <= '0';
elsif rising_edge(sysClk) then
start_ff <= start;
end if;
end process;

start_rise <= not (start_ff) and start;

Basically the idea is to check when the signal is 1 but was 0 the
cycle before. Run those through an AND gate and it will tell you
everytime that condition happens

this will get you a one clock cycle pulse (start_rise) everytime start
transitions from 0 to 1. You can use that signal to fire off the
process in your module instead of using start



canadianJaouk
  Reply With Quote
Old 04-17-2007, 04:59 PM   #5
canadianJaouk
 
Posts: n/a
Default Re: How can I avoid multiple execution when handshaking operations?
> process(reset, clk)
> begin
> if reset = '1' then
> start_ff <= '0';
> elsif rising_edge(sysClk) then
> start_ff <= start;
> end if;
> end process;
>
> start_rise <= not (start_ff) and start;



sorry sysClk was meant to be clk... rising_edge(clk)



canadianJaouk
  Reply With Quote
Old 04-18-2007, 12:40 PM   #6
Brian Drummond
 
Posts: n/a
Default Re: How can I avoid multiple execution when handshaking operations?
On Tue, 17 Apr 2007 16:35:08 +0100, Anon Anon <> wrote:

>canadianJaouk wrote:
>> If you fire off a transition, then you'll need to make sure that the
>> clients generate a transition the next time they want the process to
>> run. From you post, it seemed there was no plan to clear that start
>> bit. If you don't clear it, you won't be able to generate a new
>> transition, leaving you with the same problem. That bit needs to be
>> cleared either by the client or the unit.
>>
>>

>
>Sorry - I should have made that clearer: please assume that the client
>clears the 'Start' bit as soon as it detects that the 'Ready' bit has
>been set. It then modifies the operation code and sets the Start bit
>once more to repeat the process all over again.


This means that, after you set "Ready", you can watch for the Start bit
to be cleared. When it is, you can safely clear Ready, and watch for
Start to be set again.

>What I really want to know is, what does the internal code of the entity
>look like to make it execute the command once only?


A state machine.
(You can find plenty of information on state machines)

- Brian


Brian Drummond
  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




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