![]() |
|
|
|
#1 |
|
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 |
|
|
|
|
#2 |
|
Posts: n/a
|
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 |
|
|
|
#3 |
|
Posts: n/a
|
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 |
|
![]() |
| Thread Tools | Search this Thread |
|
|
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 |