I wanted something similar but could not get the synthesis tool to generate the circuit, so I instantiated my own.. here it is, you can change the INIT values of the LUT to get what you want.
-- MUX_ADD_VECTOR - when ADD = '1' add O = A + B else O = C
----------------------------------------------------------- library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; library UNISIM; use UNISIM.vcomponents.all;
port (A : in std_logic_vector (WIDTH-1 downto 0); B : in std_logic_vector (WIDTH-1 downto 0); C : in std_logic_vector (WIDTH-1 downto 0); ADD : in std_logic; O : out std_logic_vector (WIDTH-1 downto 0));
end MUX_ADD_VECTOR;
architecture XILINX_virtex of MUX_ADD_VECTOR is component LUT4_L generic(INIT : bit_vector); port (LO : out STD_ULOGIC; I0 : in STD_ULOGIC; I1 : in STD_ULOGIC; I2 : in STD_ULOGIC; I3 : in STD_ULOGIC); end component;
component MUXCY_L port(LO : out STD_ULOGIC; CI : in STD_ULOGIC; DI : in STD_ULOGIC; S : in STD_ULOGIC); end component;
component XORCY port(O : out STD_ULOGIC; CI : in STD_ULOGIC; LI : in STD_ULOGIC); end component;
component MULT_AND port(LO : out STD_ULOGIC; I0 : in STD_ULOGIC; I1 : in STD_ULOGIC); end component;
signal otemp : std_logic_vector (WIDTH-1 downto 0); signal mando : std_logic_vector (WIDTH-1 downto 0); signal carry : std_logic_vector (WIDTH downto 0);
attribute BEL : string;
begin -- XILINX_virtex
carry(0) X"7B48") port map (I0 => A(i), I1 => ADD, I2 => B(i), I3 => C(i), LO => otemp(i));
mux_add_mand_inst : MULT_AND port map (I0 => A(i), I1 => ADD, LO => mando(i));
mux_add_mxcy_inst : MUXCY_L port map (DI => mando(i), CI => carry(i), S => otemp(i), LO => carry(i+1));
mux_add_xorc_inst : XORCY port map (CI => carry(i), LI => otemp(i), O => O(i)); end generate mux_add;
end XILINX_virtex;
Quark....
J
John_H
Following diagram modified for useA and useB above:
S
Sylvain Munaut
Yeah, I confused the two choices of CYMUX ... My bad. The two representation works just fine.
But XST doesn't understand yours either ... it also uses two level with useA and useB ...
Sylvain
J
John_H
that
for
the
S
Sylvain Munaut
yup, I created a "test" entity just for that (to avoid long synthesis of the whole stuff each time I test a thing).
John_H wrote:
K
Kolja Sulimma
Jan Gray wrote about this a couple of times on
formatting link
Apparently the mapper tries many (or even all) factorizations of your logic but it does not reorder the circuit. Therefore, if you have an adder followed by a mux you get two levels of logic. You need to write down a formulation were the adder follows the remining logic:
result
Join the Discussion
Have something to add? Share your thoughts — no account required.
Didn't find your answer?
Ask the community — no account required
Report Content
You are reporting this content to the moderators. They will look at it
ASAP.