Why doesn't this produce the logic I expect?

S

Shannon

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.
 
D

Daniel Leu

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
 
S

Shannon

How about


                                    ^^^^

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)
 
A

Andy

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

Andy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top