Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > Problem with SLL: "sll can not have such operands in this context" and bit-testing

Reply
Thread Tools

Problem with SLL: "sll can not have such operands in this context" and bit-testing

 
 
Frank Buss
Guest
Posts: n/a
 
      07-01-2006
I've defined this signals:

signal accu : std_logic_vector(31 downto 0) := (others => '0');
signal data : integer range 0 to 255 := 0;

Within a process, which is triggered with like this:

if clk'event and clk = '0' then

I try to shift the accu (I'm trying to build a CPU) :

accu <= accu sll data;

But WebPACK ISE 8.1, with the service pack 3, says:

"sll can not have such operands in this context"

Even for this line it reports the same error:

accu <= accu sll 1;

How can I rotate the signal?


I have a similiar problem with my bit-test instruction:

z_flag <= accu(x_register);

This produces "Wrong index type for accu.", with the same definition for
x_register like for accu:

signal x_register : std_logic_vector(31 downto 0) := (others => '0');

--
Frank Buss,
http://www.frank-buss.de, http://www.it4-systems.de
 
Reply With Quote
 
 
 
 
Mike Treseler
Guest
Posts: n/a
 
      07-01-2006
Frank Buss wrote:

> How can I rotate the signal?


I would use numeric_std.rotate_left.

Here's a usage example:
http://home.comcast.net/~mike_tresel...c_template.vhd

> I have a similiar problem with my bit-test instruction:
>
> z_flag <= accu(x_register);
>
> This produces "Wrong index type for accu.", with the same definition for
> x_register like for accu:
>
> signal x_register : std_logic_vector(31 downto 0) := (others => '0');


To test a bit, you need a natural index.

-- Mike Treseler
 
Reply With Quote
 
 
 
 
Frank Buss
Guest
Posts: n/a
 
      07-01-2006
Mike Treseler wrote:

> I would use numeric_std.rotate_left.
>
> Here's a usage example:
> http://home.comcast.net/~mike_tresel...c_template.vhd


This doesn't work. The full VHDL code:

http://www.frank-buss.de/tmp/displaytest.vhd

ISE WebPack says:

Line 748. rotate_left can not have such operands in this context.

if I use the rotate_left. As a workaround I have used a counter and sliced
vector access to simulate sll and the bit test function, which works, but
which is slow.

It is my first VHDL program, so I would appreciate any other idea how to
improve it as well. It needs about 20,000 gates, which is nearly as much as
the 6809 implementation from OpenCores, so I think there is much to
improve, because my CPU has much less functionality than the 6809

> To test a bit, you need a natural index.


What is a natural index and how can I convert a signal to a natural index?

Another problem with my code: Looks like "char <= conv_integer(accu(7
downto 0));" or "accu <= accu + 1;" limits the range to 0..127, because the
charset, which is printed by the assembler program, displays the first 128
characters twice.

--
Frank Buss,
http://www.frank-buss.de, http://www.it4-systems.de
 
Reply With Quote
 
Mike Treseler
Guest
Posts: n/a
 
      07-01-2006
Frank Buss wrote:
> Mike Treseler wrote:
>
>> I would use numeric_std.rotate_left.
>>
>> Here's a usage example:
>> http://home.comcast.net/~mike_tresel...c_template.vhd

>
> This doesn't work. The full VHDL code:
>
> http://www.frank-buss.de/tmp/displaytest.vhd


It works if you declare unsigned types.

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;

http://ghdl.free.fr/ghdl/IEEE-library-pitfalls.html

> What is a natural index and how can I convert a signal to a natural index?


0, 1, 2 ...

This is a FAQ. Google a bit.

>
> Another problem with my code: Looks like "char <= conv_integer(accu(7
> downto 0));" or "accu <= accu + 1;" limits the range to 0..127, because the
> charset, which is printed by the assembler program, displays the first 128
> characters twice.


use IEEE.NUMERIC_STD.ALL;

http://www.csee.umbc.edu/help/VHDL/p...umeric_std.vhd


-- Mike Treseler
 
Reply With Quote
 
Frank Buss
Guest
Posts: n/a
 
      07-01-2006
Mike Treseler wrote:

> It works if you declare unsigned types.
>
> 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;
>
> http://ghdl.free.fr/ghdl/IEEE-library-pitfalls.html


Thanks, I've corrected it, now rotate_left and rotate_right works.

>> What is a natural index and how can I convert a signal to a natural index?

>
> 0, 1, 2 ...
>
> This is a FAQ. Google a bit.


I've corrected this, too, with a subtype of the form "subtype byte is
natural range 0 to 255;" for all signals which needs this type, now the
program looks more clear and I can access a bit of a signal with a signal
as index.

>> Another problem with my code: Looks like "char <= conv_integer(accu(7
>> downto 0));" or "accu <= accu + 1;" limits the range to 0..127, because the
>> charset, which is printed by the assembler program, displays the first 128
>> characters twice.

>
> use IEEE.NUMERIC_STD.ALL;
>
> http://www.csee.umbc.edu/help/VHDL/p...umeric_std.vhd


Thanks, but the problem was, that the vdu module, which I used, has only
128 characters, but the characters above 128 are calculated block graphics,
if the 7th bit in the attribute RAM is set

The new version:

http://www.frank-buss.de/tmp/displaytest2.vhdl

Now the last problem is to optimize it to synthesize not so many gates. Any
ideas?

--
Frank Buss,
http://www.frank-buss.de, http://www.it4-systems.de
 
Reply With Quote
 
Duane Clark
Guest
Posts: n/a
 
      07-01-2006
Frank Buss wrote:
>
> I have a similiar problem with my bit-test instruction:
>
> z_flag <= accu(x_register);
>
> This produces "Wrong index type for accu.", with the same definition for
> x_register like for accu:
>
> signal x_register : std_logic_vector(31 downto 0) := (others => '0');
>


Assuming you are using the numeric_std package, you could write that as:
z_flag <= accu(to_integer(unsigned(x_register)));
A bit cumbersome perhaps. If you are using x_register in many places for
a similar purpose, create an intermediate integer variable.
 
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
error about 'can not have such operands in this context' Zhi VHDL 3 02-25-2008 05:58 PM
Conversion rules between unsigned operands and signed operand somenath C Programming 11 07-30-2007 10:37 AM
operators requiring lvalue/rvalue operands and resulting in rvalue/lvalue Kavya C Programming 9 10-28-2006 01:45 AM
Modulus and negative operands August Karlstrom C Programming 4 01-12-2006 07:56 PM
to_integer can not have such operands in this contex A. Kong VHDL 3 10-11-2004 09:28 AM



Advertisments
 



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 47 48 49 50 51 52 53 54 55 56 57