A few question about vhdl(clk,signal,etc..)

Discussion in 'VHDL' started by natiben27@gmail.com, Jun 2, 2013.

  1. Guest

    hi,
    i want to know two things about vhdl signal...
    why to use signal count: STD_LOGIC_VECTOR(3 downto 0);
    when i use a clock and do counting+1 in the state machine?
    and for what to configure it 3 downto 0...
    in addtion for what i use signal at all?
    thank's
    nati
     
    , Jun 2, 2013
    #1
    1. Advertising

  2. Gabor Guest

    On 6/2/2013 3:57 AM, wrote:
    > hi,
    > i want to know two things about vhdl signal...
    > why to use signal count: STD_LOGIC_VECTOR(3 downto 0);
    > when i use a clock and do counting+1 in the state machine?
    > and for what to configure it 3 downto 0...
    > in addtion for what i use signal at all?
    > thank's
    > nati
    >

    It sounds like you could use some quality time with a VHDL
    textbook.

    Basically you must use a signal if you need to use the value
    of count outside the process with your state machine. If you
    don't need to use its value outside this process, you could
    use a variable instead of a signal, but then you need to
    understand the difference in the way variables are updated.

    There's no real reason to use standard_logic_vector for a
    counter unless you're also placing this on a port of the entity,
    where you generally avoid other problems by sticking with
    standard logic / vectors. Otherwise you'd normally use
    a ranged natural or integer.

    --
    Gabor
     
    Gabor, Jun 3, 2013
    #2
    1. Advertising

  3. Am Sonntag, 2. Juni 2013 09:57:57 UTC+2 schrieb :
    > why to use signal count: STD_LOGIC_VECTOR(3 downto 0);
    >
    > when i use a clock and do counting+1 in the state machine?
    >
    > and for what to configure it 3 downto 0...


    a vector(3 downto 0) means you have 4 bit width. This is easy to adopt on your hardware needs. YOu could for instance use integer instead and have theproblem, that you could end up with a 32 bit width counter while needing only 4 bit. If you detect later that you need not 4 bit width but 400 bit width, it is easy to change in vector, but impossible in integer. Plus the issue that integer is quite special in VHDL concerning covered range (see lrm, or google for details).

    bye Thomas
     
    Thomas Stanka, Jun 9, 2013
    #3
  4. Andy Guest

    Gabor,

    I would say "top level" entity. Lower level entities (whose ports are not those of the FPGA) are fine for other data types.

    The top level is special, because the gate level model produced after synthesis and/or place & route will always use std_logic and std_logic_vector for the ports, regardless of what types the RTL used. If you want to use bothRTL and post-S/P&R models in the same testbench (without constructing a wrapper for the latter), then only use std_logic and std_logic_vector data types for the ports on the top level entity.

    Andy
     
    Andy, Jun 10, 2013
    #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. Rakesh Sharma
    Replies:
    2
    Views:
    2,954
    Thomas Rudloff
    Oct 22, 2004
  2. Wojtek

    Signal Set-up Before CLK Rise

    Wojtek, Jul 2, 2006, in forum: VHDL
    Replies:
    12
    Views:
    1,544
    Pascal Peyremorte
    Jul 5, 2006
  3. martin.wahlstedt
    Replies:
    1
    Views:
    1,664
    scottcarl
    May 15, 2007
  4. Replies:
    18
    Views:
    6,652
  5. neilmac
    Replies:
    2
    Views:
    719
    neilmac
    Jan 11, 2008
Loading...

Share This Page