Vhdl operations

Discussion in 'VHDL' started by cally_cally, Apr 27, 2011.

  1. cally_cally

    cally_cally

    Joined:
    Apr 27, 2011
    Messages:
    2
    hello, i'm new here and i'm asking you how can i create an arithmetic unit that operates addition, substraction, multiplication and division. I have numbers on 4 bits and the result will be maximum on 8 bits. I've tried using "+" , "-" and "*" operators but I get the error:
    Code:
    Operator "+" is not defined for such operands.

    I use the following syntax:
    Code:
    when "00" => y <= A + B;

    Thanks in advance!

    Cally
    cally_cally, Apr 27, 2011
    #1
    1. Advertising

  2. cally_cally

    eliascm

    Joined:
    Jan 30, 2009
    Messages:
    42
    You do not give the type of your operands. "+" is not defined for standard_logic_vector. There are several ways around this. One is to use Unsigned type from the ieee numeric_std library.
    eliascm, Apr 27, 2011
    #2
    1. Advertising

  3. cally_cally

    cally_cally

    Joined:
    Apr 27, 2011
    Messages:
    2
    how should i declare the 2 operands and what library must i use?

    Thanks for your quick response.
    cally_cally, Apr 27, 2011
    #3
  4. cally_cally

    joris

    Joined:
    Jan 29, 2009
    Messages:
    152
    You have A and B in scope, so they must be declared somewhere: as signals or variables, or inputs to the entity.
    joris, Apr 27, 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. MtnSurf8

    Mathematical Operations in VHDL

    MtnSurf8, Apr 25, 2004, in forum: VHDL
    Replies:
    1
    Views:
    5,838
    Egbert Molenkamp
    Apr 25, 2004
  2. Divyang M
    Replies:
    3
    Views:
    593
    David Bishop
    Feb 4, 2005
  3. Jesus M. Salvo Jr.
    Replies:
    2
    Views:
    4,133
    robert
    Feb 11, 2006
  4. afd
    Replies:
    1
    Views:
    8,301
    Colin Paul Gloster
    Mar 23, 2007
  5. Amal
    Replies:
    1
    Views:
    1,745
    vipinlal
    Mar 4, 2010
Loading...

Share This Page