Help with advanced generic model

Discussion in 'VHDL' started by Brandon, Jul 11, 2005.

  1. Brandon

    Brandon Guest

    Hello,

    I've designed a complex MAC with generic word size. I'd like to now be
    able to parameterize the precision of the fixed point inputs to the
    accumulator. Unfortunately, I'm having some difficulty implementing
    this, since I haven't been able to find any advanced (advanced for me,
    at least) examples on generics.

    I assume that the real and imaginary inputs to the MAC are between -1
    and +1. The result of the complex multiply is therefore bound between
    -2 and +2. This is then connected to the inputs of the accumulators:

    [2*dwidth][2*dwidth-1 : 2*dwidth-2][2*dwidth-3 downto 0]

    [ sign ][ whole bits ][ fraction bits ]

    So I added accumwholewidth and accumfractwidth to denote the bit widths
    so that the user may use to constrain the inputs and outputs of the
    MAC.

    <SNIP>
    -------------------------------------------------------------------------------
    -- ENTITY
    -------------------------------------------------------------------------------
    entity maccplx_g is
    generic (
    -- Bit widths
    dwidth : integer;
    accumwhwidth : integer; -- number of whole bits of accumulator
    i/o
    accumfrwidth : integer; -- number of fraction bits of
    accumulator i/o
    );
    ..
    ..
    ..
    end entity maccplx_g;
    -------------------------------------------------------------------------------
    -- ARCHITECTURE
    -------------------------------------------------------------------------------
    architecture structural_ar of maccplx_g is
    ..
    ..
    ..

    ---------------------------------------------------------------------------
    -- accumulator input mapping process

    ---------------------------------------------------------------------------
    accum_map_proc: process(pre_r,pim_r)
    begin
    -- Sign extension of complex products
    for i in 0 to accumwhwidth-2 loop
    accumre_signext(i) <= pre_r(pre_r'high);
    accumim_signext(i) <= pim_r(pim_r'high);
    end loop;
    -- Accumulator for Re{p}
    accumre_ain(accumfrwidth-1 downto 0)
    <= pre_r(2*dwidth-3 downto 2*dwidth-3-accumfrwidth+1);
    accumre_ain(accumwhwidth+accumfrwidth downto accumfrwidth)
    <= accumre_signext & pre_r(2*dwidth-1 downto 2*dwidth-2);
     
    Brandon, Jul 11, 2005
    #1
    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. Murat Tasan
    Replies:
    1
    Views:
    8,050
    Chaitanya
    Feb 3, 2009
  2. Replies:
    2
    Views:
    437
  3. Replies:
    1
    Views:
    488
    Andreas Wollschlaeger
    Oct 6, 2006
  4. Michele Simionato
    Replies:
    1
    Views:
    602
    Lacrima
    Mar 27, 2010
  5. john

    Datatable generic model ?

    john, Nov 22, 2010, in forum: Java
    Replies:
    2
    Views:
    240
    markspace
    Nov 22, 2010
Loading...

Share This Page