FPGARelated.com
Forums

DSP48 Inference Template for XST

Started by Kevin Neilson May 6, 2008
I'd like to infer a DSP48 in XST and can't find a template that will 
infer all of these opmodes:

P=M
P=M+C
P=P+M
P=P-M

   (where M=A*B)

I can get XST to do any of these, one or two at a time, but when I try 
to do all at once it adds a bunch of fabric.  Any suggestions?  The code 
below, for example, properly connects up the ALUMODE pins (in a V5) for 
the add/subtract function, but the mux that should be inferred as the 
the DSP48's Z mux gets put in fabric instead, so P gets routed through a 
fabric mux which feeds into C.
-Kevin

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.numeric_std.ALL;
entity xst_mac is
   port (clk, reset, sel, add_sub: in  std_logic;
         A, B                    : in  signed(17 downto 0);
         C                       : in  signed(47 downto 0);
         P                       : out signed(47 downto 0));
end xst_mac;
architecture synth of xst_mac is
   signal   mult    : signed(35 downto 0);
   signal   accum   : signed(47 downto 0);
begin
   process (clk)
   begin
     if (clk'event and clk='1') then
       if (reset = '1') then
         accum <= (others => '0');
         mult  <= (others => '0');
       else
         if (sel='0') then
           accum <= C + mult;
         elsif (add_sub='1') then
           accum <= accum + mult;
         else
           accum <= accum - mult;
         end if;
         mult <= A * B;
       end if;
     end if;
   end process;
   P <= accum;
end synth;
Kevin Neilson wrote:
> I'd like to infer a DSP48 in XST and can't find a template that will > infer all of these opmodes: >
... Never mind--I don't think this type of inference is supported at the time. -Kevin