Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > multiplier

Reply
Thread Tools

multiplier

 
 
power_hf2005 power_hf2005 is offline
Junior Member
Join Date: Sep 2009
Posts: 7
 
      09-23-2009
hi all,
I design a multiplier but I have a mistake that I can not understand why. It always reports this sentence:"Can't determine definition of operator ""sll""--found posible definition".I think because I use "sll" keyword in a wrong way but I don't know how to correct.Help me plz!
Here is my code:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
use ieee.numeric_std.all;
--------------------------
entity nhan is
port(a: in std_logic_vector(3 downto 0);
b: in std_logic_vector(3 downto 0);
kq: out std_logic_vector( 7 downto 0));
end nhan;
--------------------------
architecture nhan of nhan is
type mang is array( 0 to 3) of std_logic_vector(7 downto 0);
begin
process(a,b)
variable x: mang;
variable t: std_logic_vector(7 downto 0);
begin
for j in 0 to 3 loop
if b(j)='1' then
x(j):=("0000"& a) sll j;
else
x(j):=(others =>'0');
end if;
t:=t+x(j);
end loop;
kq<=t;
end process;
end nhan;
 
Reply With Quote
 
 
 
 
StuartHobday StuartHobday is offline
Junior Member
Join Date: Sep 2009
Location: Dorset
Posts: 7
 
      09-24-2009
Try this

x(j):= std_logic_vector( unsigned("0000"& a) sll j );


You need to check the data types that the functions require.
 
Reply With Quote
 
 
 
 
power_hf2005 power_hf2005 is offline
Junior Member
Join Date: Sep 2009
Posts: 7
 
      09-24-2009
Thanks, but It's not better.
 
Reply With Quote
 
StuartHobday StuartHobday is offline
Junior Member
Join Date: Sep 2009
Location: Dorset
Posts: 7
 
      09-26-2009
The following code compiles OK in Lattice tools but unfortunately I don't have the Xilinx tools on this laptop, will check when back in the office. See if this helps!!

I have added brief comments to the code detailing specific changes.

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.all;

-- !!! DON'T USE THESE LIBRARIES - NON STANDARD IEEE LIBS !!!
--use IEEE.STD_LOGIC_ARITH.ALL;
--use IEEE.STD_LOGIC_UNSIGNED.ALL;


entity nhan is
port( a: in std_logic_vector(3 downto 0);
b: in std_logic_vector(3 downto 0);
kq: out std_logic_vector(7 downto 0)
);
end nhan;


architecture Behavioural of nhan is

type mang is array( 0 to 3) of std_logic_vector(7 downto 0);

begin

process(a,b)
variable x: mang;
-- changed type from std_logic_vector to integer as std_logic_vector increments
-- are not possible with the above ieee library standards...
variable t: integer range 0 to 255;
variable y : std_logic_vector(7 downto 0);
begin
for j in 0 to 3 loop
if b(j)='1' then
-- concatenation on std_logic_vectors
y:= "0000" & a;

-- sll takes unsigned arguments, hence convert y to unsigned type.
-- x storage is in std_logic_vector, hence convert std_logic_vector.
x(j) := std_logic_vector(unsigned(y) sll j);
else
x(j):= (others =>'0');
end if;

-- Integer counter, convert std_logic_vector to natural(integer) type..
t := t + to_integer( unsigned( x(j) ) );
end loop;
-- convert integer counter 't' to std_logic_vector
kq<= std_logic_vector( to_unsigned(t, );
end process;

end;
 
Reply With Quote
 
power_hf2005 power_hf2005 is offline
Junior Member
Join Date: Sep 2009
Posts: 7
 
      09-29-2009
oh my god!!! I'm really happy and...I can't express my emotion. Thank you very muchhhhhhhhhhhhhhhhhhhhhh!!!!.
StuartHobday, you are very pro. I have just study VHDL for 2 weeks so very noob.
I'm from Vietnam and you?
 
Reply With Quote
 
StuartHobday StuartHobday is offline
Junior Member
Join Date: Sep 2009
Location: Dorset
Posts: 7
 
      09-29-2009
Your welcome....

Located in Dorset, England. Have been working with FPGA's for over ten years now.
 
Reply With Quote
 
canito canito is offline
Junior Member
Join Date: Oct 2009
Posts: 1
 
      10-09-2009
can somebody helme, I have to produce a revervaration or eco to a digital voice input (USB port) in a PC and then send it to te audio output.

cank´s
 
Reply With Quote
 
 
 
Reply

Thread Tools

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
clock multiplier sunil VHDL 7 04-01-2010 01:19 PM
fixed point multiplier in VHDL Viswan VHDL 9 02-11-2004 09:00 PM
Multiplier Quinnie VHDL 4 11-07-2003 02:29 PM
complex generate usage in multiplier Ahmad VHDL 0 09-29-2003 10:43 AM
4527 (bcd rate multiplier) vhdl code Markus Fuchs VHDL 0 09-17-2003 02:18 PM



Advertisments