Calling custom defined hardware in a process

J

joseph

Guest
Hi,

I am a fairly novice into VHDL. I have written the code of a barrel
shifter and now i wish to use the barrel shifter in a larger
application.

However VHDL does not allow an entity to be created during a process.
I want to use the barrel shifter to shift a bit in Booth's
multiplication algorithm. How can i do it? I am using Xilinx ISE 9.2i
to generate the circuit.

Also i have the book by Zwolinski for introduction to VHDl. Can some
please suggest a fairly more advanced text about synthesizable VHDL.

Thanks a lot

Joseph
 
joseph wrote:

However VHDL does not allow an entity to be created during a process.
True, but it is easy to wrap an architecture around
a process and add an entity to the top.
A related example:
http://home.comcast.net/~mike_treseler/barrel.vhd

-- Mike Treseler
 
joseph pisze:
Hi,

I am a fairly novice into VHDL. I have written the code of a barrel
shifter and now i wish to use the barrel shifter in a larger
application.

However VHDL does not allow an entity to be created during a process.
I want to use the barrel shifter to shift a bit in Booth's
multiplication algorithm. How can i do it? I am using Xilinx ISE 9.2i
to generate the circuit.

Also i have the book by Zwolinski for introduction to VHDl. Can some
please suggest a fairly more advanced text about synthesizable VHDL.

Thanks a lot

Joseph

I don't know if I understood you correctly, because my english isn't so
good but try:


You have to have e.g 2 files. In the first one you have your shifter and
in the second one as follows:


library IEEE;
use IEEE.STD_LOGIC_1164.all;

entity Booth is
port(
-- here your ports
);
end Booth;


architecture Booth of Booth is

-- declaration of components:
component shifter
port(
--here your ports copied from Shifter's entity
);
end component;
-- declaation of signals, e.g.
signal In1, Out1 : std_logic_vector (n-1 downto 0); -- this vectors'

-- length should be exacly the same as your in/out ports of shifter

begin

-- here you put your shifter e.g. in this way:

My_shifter: shifter port map (In1,IN2); -- <= this is only example, you
have to map here your shifter ports with some signals... which have been
declared above



process (.....)
-- your process
end process;
end Booth;

It should looks similar to what I have written.
And read more about comoponent instatiation
It would help you
 
Mike Treseler wrote:

However VHDL does not allow an entity to be created during a process.
Besides an instance,
another way to reuse the barrel shifter code
in another process is to extract and merge the
init, update and output procedures from the
working entity into the target process.

I could merge "copy and paste" using a text editor
or I could add parameters and package the subprograms
that I use frequently.


-- Mike Treseler
____________
procedure update_regs is -- distilled functional description
begin
if strobe='1' then
reg_v := d;
reg_v := shift_left(reg_v,to_integer(n));
end if;
end procedure update_regs;
 

Welcome to EDABoard.com

Sponsor

Back
Top