I'm using Modelsim, there is a package ieee.numeric_std, which contains
functions for shifting and rotating, but always if I use them I've got a
compiler error.
No feasible entries for subprogram shift_right
In the function declaration (in mti_numeric_std.vhd) a type "unsigned"
or "signed" is used, but I never found a declaration for it.
I want to shift a std_logic_vector.
Bye Tom!
In article <3A06BC19...@mb.uni-magdeburg.de>,
Thomas Reinemann <thomas.r...@mb.uni-magdeburg.de> wrote:
> Hello,
>
> I'm using Modelsim, there is a package ieee.numeric_std, which
contains
> functions for shifting and rotating, but always if I use them I've
got a
> compiler error.
>
Hi,
The shit & rotate operators are supported in the Language itself (not
via a separate package) - from VHDL'93 onwards. Of-course you will need
these packages to overload the functions to different data types.
The syntax is
destination_reg <= source_reg SRL <integer> ;
e.g.
cntrl_reg <= cntrl_reg SRL 1 ;
If you just give negative integers, you get the reverse!
Hope this helps.
> No feasible entries for subprogram shift_right
>
> In the function declaration (in mti_numeric_std.vhd) a type "unsigned"
> or "signed" is used, but I never found a declaration for it.
>
Strange, in the same file I see
Line nno: 67 & 68 as (right after the comments)
type UNSIGNED is array (NATURAL range <>) of STD_LOGIC;
type SIGNED is array (NATURAL range <>) of STD_LOGIC;
> I want to shift a std_logic_vector.
>
You will have to do "Explicit type conversion" from and to UNSIGNED,
if you wish to stick to standard libraries. A example is below (not
fully tested)
Hope this helps,
Srini
--==============================
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity top is
end entity top;
architecture a of top is
signal s1,s2,s3: std_logic_vector(3 DOWNTO 0);
begin
process
begin
s2 <= STD_LOGIC_VECTOR( UNSIGNED(s1) SLL 1 );
wait;
end PROCESS;
end architecture a;
-- =====================
--
Srinivasan Venkataramanan
ASIC Design Engineer
Chennai, India
Sent via Deja.com http://www.deja.com/
Before you buy.
Srinivasan Venkataramanan schrieb:
>
> In article <3A06BC19...@mb.uni-magdeburg.de>,
> Thomas Reinemann <thomas.r...@mb.uni-magdeburg.de> wrote:
> > Hello,
> >
> > I'm using Modelsim, there is a package ieee.numeric_std, which
> contains
> > functions for shifting and rotating, but always if I use them I've
> got a
> > compiler error.
> >
>
> Hi,
> The shit & rotate operators are supported in the Language itself (not
> via a separate package) - from VHDL'93 onwards. Of-course you will need
> these packages to overload the functions to different data types.
>
> The syntax is
>
> destination_reg <= source_reg SRL <integer> ;
>
> e.g.
>
> cntrl_reg <= cntrl_reg SRL 1 ;
I tried it already, but I've got a comnpiler error"
No feasible entries for infix op: "srl"
Where can I find the declaration of these operators? Which types are
they declareted for?
Here comes a part of my code. I have deleted some stuff, therefore it is
not very useful.
error_cor_sign2 :
process(clk, reset)
variable ZSpeicher : std_logic_vector (WORD_WIDTH - 1 downto
1);
begin
if reset = '1' then
ZSpeicher := (others => '0');
elsif (clk'event) and (clk = '1') then
ZSpeicher := ZSpeicher srl 1;
end process;
Bye Tom!
Instead of
> ZSpeicher := ZSpeicher srl 1;
Use
ZSpeicher := std_logic_vector( UNSIGNED(ZSpeicher) srl 1 );
-- i.e. convert ZSpei.. to UNSIGNED and back again
-- B'cos ieee.numeric_std overloads SRL for UNSIGNED & SIGNED and NOT
for STD_LOGIC_VECTOR
Hope this helps,
Bye
Srini
Make sure you've set the -93 switch. It's one of the compiler options
in the GUI, and you can also specify it on the command line.
-- a
----------------------------
Andy Peters
Sr. Electrical Engineer
National Optical Astronomy Observatory
950 N Cherry Ave
Tucson, AZ 85719
apeters (at) n o a o [dot] e d u
"It is better to be silent and thought a fool,
than to send an e-mail to the entire company
and remove all doubt."
Andy Peters wrote:
>
> Thomas Reinemann wrote:
> >
> > I want to shift a std_logic_vector.
>
> Make sure you've set the -93 switch. It's one of the compiler options
> in the GUI, and you can also specify it on the command line.
I set it.
Bye Tom!