Calling custom defined hardware in a process

Discussion in 'VHDL' started by joseph, Sep 13, 2007.

  1. joseph

    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, Sep 13, 2007
    #1
    1. Advertising

  2. 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
    Mike Treseler, Sep 13, 2007
    #2
    1. Advertising

  3. joseph

    Guffi Guest

    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
    Guffi, Sep 13, 2007
    #3
  4. 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;
    Mike Treseler, Sep 19, 2007
    #4
  5. joseph

    avimit

    Joined:
    Sep 19, 2007
    Messages:
    1
    create a function and call it inside the process

    You can create a function for barrel shifter, and call that function inside a process.
    An example of writing a function, and calling it can be found here:
    http://www.vlsiip.com/dc_shell/counter.vhd
    This file includes a function called 'incr_vec' and then calls this function inside a process.
    Hope it helps,
    Kr,
    Avi
    http://www.vlsiip.com
    avimit, Sep 19, 2007
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Suresh
    Replies:
    2
    Views:
    1,077
  2. Suresh
    Replies:
    2
    Views:
    2,448
    Alan Balmer
    Jul 14, 2004
  3. Oodini
    Replies:
    1
    Views:
    1,762
    Keith Thompson
    Sep 27, 2005
  4. Angel Tsankov
    Replies:
    1
    Views:
    863
    Victor Bazarov
    Apr 5, 2006
  5. Replies:
    1
    Views:
    494
    Sion Arrowsmith
    Jul 10, 2008
Loading...

Share This Page