Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - SRL and ROL

 
Thread Tools Search this Thread
Old 08-03-2004, 10:29 AM   #1
Default SRL and ROL


Please excuse the probable simplicity of this question.

I'm trying to use ROL and SRL logical operators and I can't seem to
find the correct syntax.

I have a bit_vector(31 downto 0) called 'tx' , now all I want to do is
rotate the vector to the left and pick of bit(0).
As I said I've tried a few arrangements ie. tx ROL 1 and ROL tx but
nothing seems to work.

Can someone let me know what the syntax is to do this simple task.

TIA

Chris


Chris Connelly
  Reply With Quote
Old 08-03-2004, 12:58 PM   #2
Egbert Molenkamp
 
Posts: n/a
Default Re: SRL and ROL
entity test is
port (A : in bit_vector(31 downto 0);
p : in integer;
B : out bit_vector(31 downto 0));
end test;

architecture behavior of test is

begin
B <= A Rol p;
end behavior;

Egbert Molenkamp

"Chris Connelly" <> wrote in message
news: om...
> Please excuse the probable simplicity of this question.
>
> I'm trying to use ROL and SRL logical operators and I can't seem to
> find the correct syntax.
>
> I have a bit_vector(31 downto 0) called 'tx' , now all I want to do is
> rotate the vector to the left and pick of bit(0).
> As I said I've tried a few arrangements ie. tx ROL 1 and ROL tx but
> nothing seems to work.
>
> Can someone let me know what the syntax is to do this simple task.
>
> TIA
>
> Chris





Egbert Molenkamp
  Reply With Quote
Old 08-03-2004, 03:19 PM   #3
Ralf Hildebrandt
 
Posts: n/a
Default Re: SRL and ROL
Chris Connelly wrote:


> I'm trying to use ROL and SRL logical operators and I can't seem to
> find the correct syntax.
>
> I have a bit_vector(31 downto 0) called 'tx' , now all I want to do is
> rotate the vector to the left and pick of bit(0).
> As I said I've tried a few arrangements ie. tx ROL 1 and ROL tx but
> nothing seems to work.


tx_rolled(31 downto 0) <= tx(0) & tx (31 downto 1);

works indipendent from used libraries, but is fixed as can bee seen.


Ralf


Ralf Hildebrandt
  Reply With Quote
Old 08-03-2004, 08:11 PM   #4
Mike Treseler
 
Posts: n/a
Default Re: SRL and ROL
(Chris Connelly) wrote in message news:<. com>...
> Please excuse the probable simplicity of this question.
>
> I'm trying to use ROL and SRL logical operators and I can't seem to
> find the correct syntax.
>
> I have a bit_vector(31 downto 0) called 'tx' , now all I want to do is
> rotate the vector to the left and pick of bit(0).
> As I said I've tried a few arrangements ie. tx ROL 1 and ROL tx but
> nothing seems to work.


Consider using rotate_left from the
ieee.numeric_std library as shown below.

-- Mike Treseler

-----------------------------------------------

library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;

entity rotate is
-- Mike Treseler Tue Aug 3 09:52:10 2004

generic (len : positive := 32);

port (clk : in std_ulogic;
rst : in std_ulogic;
rot : in std_ulogic; -- rotate or init
tx : out std_ulogic);

end entity rotate;

architecture synth of rotate is

begin -- architecture sim
sh : process (clk, rst) is
variable tx_v : unsigned(len-1 downto 0);
begin -- process sh
if rst = '1' then
tx_v := (others => '0');
tx <= tx_v(0);
elsif rising_edge(clk) then
if rot = '1' then
tx_v := rotate_left(tx_v, 1); -- rotate data
tx <= tx_v(0); -- pick off bit 0
else
tx_v := x"13701248"; -- init data
end if;
end if;
end process sh;

end architecture synth;


Mike Treseler
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

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




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

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