Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Shifting and rotating

867 views
Skip to first unread message

Thomas Reinemann

unread,
Nov 6, 2000, 3:00:00 AM11/6/00
to
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.

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!

Srinivasan Venkataramanan

unread,
Nov 6, 2000, 11:44:21 PM11/6/00
to

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.

Thomas Reinemann

unread,
Nov 7, 2000, 2:28:42 AM11/7/00
to

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!

Srinivasan Venkataramanan

unread,
Nov 7, 2000, 3:00:00 AM11/7/00
to
Hi,
The message from ModelSim is not very clear (atleast to me).
I tried a similar example, and got the same error, and the fix is:

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

Andy Peters n o a o [.] e d u>

unread,
Nov 7, 2000, 3:00:00 AM11/7/00
to
Thomas Reinemann 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.
>
> 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.

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."

Thomas Reinemann

unread,
Nov 8, 2000, 3:00:00 AM11/8/00
to

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!

0 new messages