Problem with my counter

Discussion in 'VHDL' started by twinkle, Feb 9, 2009.

  1. twinkle

    twinkle

    Joined:
    Feb 9, 2009
    Messages:
    3
    Problem with my Demux design

    library ieee;
    use ieee.std_logic_1164.all;
    use ieee.std_logic_unsigned.all;
    use work.poly_pack.all;

    entity DeMUX is
    port(clk, rst : in std_logic;
    input : in std_logic_vector(INPUT_WIDTH-1 downto 0);
    out1_dmux : out std_logic_vector(INPUT_WIDTH-1 downto 0);
    out2_dmux : out std_logic_vector(INPUT_WIDTH-1 downto 0)
    );
    end DeMUX;

    architecture behavior of DeMUX is
    signal sel : std_logic;
    begin

    process(sel,input)
    begin

    case sel is
    when '1'=>
    out1_dmux <= input;
    out2_dmux <= "00000000";

    when '0' =>
    out2_dmux <= input;
    out1_dmux <= "00000000";

    when others =>
    out1_dmux <= "00000000";
    out1_dmux <= "00000000";
    end case;

    end process;


    process (clk, rst)
    begin
    if (rst = '0') THEN
    sel <= '1';
    else
    if (clk'event and clk = '1')then
    sel <= sel + 1;
    end if;
    end if;
    end process;
    end behavior;

    I get the following two errors when am incrementing my 'sel'. i.e., the problem is shown in sel <= sel+1. Please some one help me in resolving this problem.

    Errors shown:

    No feasible entries for infix operator "+"
    Type error resolving infix expression "+" as type ieee.std_logic_1164.std_logic

    Thanking you!!


    /Twinkle
     
    Last edited: Feb 9, 2009
    twinkle, Feb 9, 2009
    #1
    1. Advertising

  2. twinkle

    eliascm

    Joined:
    Jan 30, 2009
    Messages:
    42
    Counter Problem

    sel is type std_logic so "sel + 1" is not defined. You could use "sel <= not sel" to alternate the state of sel (you should first set sel to a default state of '1' or '0' since "not sel" will not work for the other possible states of sel.
     
    eliascm, Feb 11, 2009
    #2
    1. Advertising

  3. twinkle

    twinkle

    Joined:
    Feb 9, 2009
    Messages:
    3
    Yaa now I realize the mistake...Thank you very much!!
     
    twinkle, Feb 12, 2009
    #3
    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. The Eeediot
    Replies:
    3
    Views:
    2,239
    =?Utf-8?B?UnVsaW4gSG9uZw==?=
    Dec 22, 2004
  2. jvn
    Replies:
    1
    Views:
    633
  3. Test3456

    problem with counter

    Test3456, Mar 19, 2007, in forum: C++
    Replies:
    4
    Views:
    331
    Stuart Redmann
    Mar 19, 2007
  4. David Barr
    Replies:
    9
    Views:
    308
    Dennis Lee Bieber
    Sep 7, 2007
  5. George2
    Replies:
    1
    Views:
    804
    Alf P. Steinbach
    Jan 31, 2008
Loading...

Share This Page