Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > Why doesn't this produce the logic I expect?

Reply
Thread Tools

Why doesn't this produce the logic I expect?

 
 
Shannon
Guest
Posts: n/a
 
      02-10-2011
This seems trivial. I'm clearly missing something very basic. Here
is the code:

process(reset, clk) is
begin
if(reset = '1') then
output <= FALSE;
elsif(rising_edge(clk)) then
if set = '0' then
output <= TRUE;
elsif trig <= '1' then
output <= FALSE;
end if;
end if;
end process;

What I expected this to produce was a type of priority mux feeding a
flip-flop. If set is '0' then output goes true (i.e highest
priority). If set is anything else then we check trig (i.e lower
priority). If trig is '1' then output goes false. Any other
conditions output should hold it's state.

The code produces the required flip-flop but completely ignores the
trig signal. The only signal feeding the input to the flip-flop is
set. I'm missing something fundamental here. Please help.
 
Reply With Quote
 
 
 
 
Daniel Leu
Guest
Posts: n/a
 
      02-10-2011
On Feb 10, 10:18*am, Shannon <sgo...@sbcglobal.net> wrote:
> This seems trivial. *I'm clearly missing something very basic. *Here
> is the code:
>
> * * * * process(reset, clk) is
> * * * * begin
> * * * * * * * * if(reset = '1') then
> * * * * * * * * * * * * output <= FALSE;
> * * * * * * * * elsif(rising_edge(clk)) then
> * * * * * * * * * * * * if set = '0' then
> * * * * * * * * * * * * * * * * output <= TRUE;
> * * * * * * * * * * * * elsif trig <= '1' then
> * * * * * * * * * * * * * * * * output <= FALSE;
> * * * * * * * * * * * * end if;
> * * * * * * * * end if;
> * * * * end process;
>
> What I expected this to produce was a type of priority mux feeding a
> flip-flop. *If set is '0' then output goes true (i.e highest
> priority). *If set is anything else then we check trig (i.e lower
> priority). *If trig is '1' then output goes false. *Any other
> conditions output should hold it's state.
>
> The code produces the required flip-flop but completely ignores the
> trig signal. *The only signal feeding the input to the flip-flop is
> set. *I'm missing something fundamental here. *Please help.


How about

> * * * * * * * * * * * * elsif trig = '1' then

^^^^


Cheers,
Daniel
 
Reply With Quote
 
 
 
 
Shannon
Guest
Posts: n/a
 
      02-10-2011
On Feb 10, 10:41*am, Daniel Leu <daniel....@gmail.com> wrote:
> On Feb 10, 10:18*am, Shannon <sgo...@sbcglobal.net> wrote:
>
>
>
> > This seems trivial. *I'm clearly missing something very basic. *Here
> > is the code:

>
> > * * * * process(reset, clk) is
> > * * * * begin
> > * * * * * * * * if(reset = '1') then
> > * * * * * * * * * * * * output <= FALSE;
> > * * * * * * * * elsif(rising_edge(clk)) then
> > * * * * * * * * * * * * if set = '0' then
> > * * * * * * * * * * * * * * * * output <= TRUE;
> > * * * * * * * * * * * * elsif trig <= '1' then
> > * * * * * * * * * * * * * * * * output <= FALSE;
> > * * * * * * * * * * * * end if;
> > * * * * * * * * end if;
> > * * * * end process;

>
> > What I expected this to produce was a type of priority mux feeding a
> > flip-flop. *If set is '0' then output goes true (i.e highest
> > priority). *If set is anything else then we check trig (i.e lower
> > priority). *If trig is '1' then output goes false. *Any other
> > conditions output should hold it's state.

>
> > The code produces the required flip-flop but completely ignores the
> > trig signal. *The only signal feeding the input to the flip-flop is
> > set. *I'm missing something fundamental here. *Please help.

>
> How about
>
> > * * * * * * * * * * * * elsif trig = '1' then

>
> * * * * * * * * * * * * * * * * * * ^^^^
>
> Cheers,
> Daniel


It's just not fair! I just saw the typo about 30 seconds ago. Daniel
I guess I still owe you the +1 for finding it but I want it on the
internet's permanent record that I DID in fact see my typo BEFORE I
saw your reply. Is there a posting undo button? (going to hide under
a rock now)
 
Reply With Quote
 
Andy
Guest
Posts: n/a
 
      02-11-2011

It is a well known fact that posting unsolved problems on the internet
improves vision. ;^)

Andy
 
Reply With Quote
 
 
 
Reply

Thread Tools

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Why doesn't this produce the logic I expect? Trygve Laugstøl VHDL 0 02-11-2011 12:32 PM
Python Logic Map/Logic Flow Chart. (Example Provided) spike Python 8 02-09-2010 12:31 PM
Asynchronous Logic Gates and Analog Logic Gates Jyoti Ballabh Software 3 11-26-2009 06:48 PM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM
can java produce .exe? if it can produce jar,how do you do? aungkopyay@gmail.com Java 5 10-27-2006 02:07 AM



Advertisments
 



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 47 48 49 50 51 52 53 54 55 56 57