Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - procedure

 
Thread Tools Search this Thread
Old 09-30-2003, 05:00 PM   #1
Default procedure


What is wrong with this?

procedure gen_s (
variable si, di : in std_logic_vector(z_width downto 0);
variable so : out std_logic_vector(z_width downto 0)) is
begin
if si(z_width) = '1' then
so := (si(z_width-1 downto 0) & '0') + di;
else
so := (si(z_width-1 downto 0) & '0' - di);
end if;
end gen_s;


I get errors about the + and - being infix operators in Modelsim, below.

# ** Error: C:/dividers/div_uu.vhd(72): No feasible entries for infix op: "+"
# ** Error: C:/dividers/div_uu.vhd(72): Bad right hand side in assignment.
# ** Error: C:/dividers/div_uu.vhd(74): No feasible entries for infix op: "-"
# ** Error: C:/dividers/div_uu.vhd(74): Bad right hand side in assignment.


Thanks.

Salman


Salman Sheikh
  Reply With Quote
Old 09-30-2003, 05:24 PM   #2
Yves Deweerdt
 
Posts: n/a
Default Re: procedure
Salman Sheikh wrote:
> What is wrong with this?
>
> procedure gen_s (
> variable si, di : in std_logic_vector(z_width downto 0);
> variable so : out std_logic_vector(z_width downto 0)) is
> begin
> if si(z_width) = '1' then
> so := (si(z_width-1 downto 0) & '0') + di;
> else
> so := (si(z_width-1 downto 0) & '0' - di);
> end if;
> end gen_s;
>
>
> I get errors about the + and - being infix operators in Modelsim, below.
>
> # ** Error: C:/dividers/div_uu.vhd(72): No feasible entries for infix op: "+"
> # ** Error: C:/dividers/div_uu.vhd(72): Bad right hand side in assignment.
> # ** Error: C:/dividers/div_uu.vhd(74): No feasible entries for infix op: "-"
> # ** Error: C:/dividers/div_uu.vhd(74): Bad right hand side in assignment.
>
>
> Thanks.
>
> Salman
>


Salman,

You can't do calculations on a std_logic_vector. Try using signed or
unsigned in stead.

Kind regards,

Yves



Yves Deweerdt
  Reply With Quote
Old 09-30-2003, 05:39 PM   #3
Mike Treseler
 
Posts: n/a
Default Re: procedure
Salman Sheikh wrote:
> What is wrong with this?
>
> procedure gen_s (
> variable si, di : in std_logic_vector(z_width downto 0);
> variable so : out std_logic_vector(z_width downto 0)) is
> begin
> if si(z_width) = '1' then
> so := (si(z_width-1 downto 0) & '0') + di;
> else
> so := (si(z_width-1 downto 0) & '0' - di);
> end if;
> end gen_s;


Not too much.

Add this to the top of your entity:

library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;

and change std_logic_vector to unsigned.

-- Mike Treseler



Mike Treseler
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
MCITP and stored procedure permissions Darrilgibson@gmail.com MCITP 5 06-07-2008 12:37 PM
SHA1 hash MohammedNgum Software 0 01-29-2008 03:36 PM
DVDV The newer DVD type bobs.auto.service@coldmail.com DVD Video 0 01-02-2006 03:56 PM
Blockbuster: Standard Operating Procedure? Shinner DVD Video 28 01-21-2004 03:57 AM
sony s7700 - Can not play this disc Randall DVD Video 12 01-12-2004 02:59 AM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46