Help with advanced generic model

B

Brandon

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);
 

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,733
Messages
2,569,440
Members
44,830
Latest member
ZADIva7383

Latest Threads

Top