Calling custom defined hardware in a process

J

joseph

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
 
G

Guffi

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
 
M

Mike Treseler

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;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top