Why doesn't this produce the logic I expect?

Discussion in 'VHDL' started by Shannon, Feb 10, 2011.

  1. Shannon

    Shannon Guest

    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.
     
    Shannon, Feb 10, 2011
    #1
    1. Advertising

  2. Shannon

    Daniel Leu Guest

    On Feb 10, 10:18 am, Shannon <> 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
     
    Daniel Leu, Feb 10, 2011
    #2
    1. Advertising

  3. Shannon

    Shannon Guest

    On Feb 10, 10:41 am, Daniel Leu <> wrote:
    > On Feb 10, 10:18 am, Shannon <> 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)
     
    Shannon, Feb 10, 2011
    #3
  4. Shannon

    Andy Guest

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

    Andy
     
    Andy, Feb 11, 2011
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mr. SweatyFinger
    Replies:
    2
    Views:
    2,268
    Smokey Grindel
    Dec 2, 2006
  2. Replies:
    5
    Views:
    495
    Luc The Perverse
    Oct 27, 2006
  3. Trygve Laugstøl
    Replies:
    0
    Views:
    723
    Trygve Laugstøl
    Feb 11, 2011
  4. Simon Strandgaard

    how to expect eof with expect+pty

    Simon Strandgaard, Dec 20, 2006, in forum: Ruby
    Replies:
    4
    Views:
    393
    Simon Strandgaard
    Dec 20, 2006
  5. Phil
    Replies:
    0
    Views:
    183
Loading...

Share This Page