I
info_
Guest
Hello,
I stumbled on something weird while fitting one of my
Tornado exercises on a Xilinx board...
Worked fine with other synthesis tools, but wouldn't
with XST. By dichotomy, I think I caught the culprit :
a simple signed adder !?
IMO, it should sign-extend the 6 bits into 7 bits,
then add and produce a 7 bits vector. Having a look
at the RTL view didn't look too good to me :-(
I used ISE 6.3.03i.
Anyone any idea ?
I may have missed something obvious.
-- Bert
-- ----------------------------------------
-- XSR synthesis bug ?
-- (simplified code for debug purpose)
-- contact : info at alse-fr dot com
-- Author : Bert Cuzeau
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE ieee.numeric_std.ALL;
-- ---------------------------------------
Entity XST_BUG is
-- ---------------------------------------
Port ( Clk : In std_logic; -- Main System Clock
Rst : In std_logic; -- Asynchronous reset, active high
Addr1 : in unsigned (5 downto 0); -- for simple test
(std_logic_vector)
Addr2 : in unsigned (5 downto 0); -- for simple test
(std_logic_vector)
ToneV : out signed (6 downto 0) ); --for simple test
(std_logic_vector)
end;
-- ---------------------------------------
Architecture RTL of XST_BUG is
-- ---------------------------------------
subtype s6_t is integer range -32 to 31;
subtype s7_t is integer range -64 to 63;
type Sinewave_t is array (0 to 63) of s6_t; -- (natural range <> in fact
constant Sinewave : Sinewave_t := (
0, 3, 6, 8, 11, 14, 17, 19,
21, 23, 25, 27, 28, 29, 30, 30,
31, 30, 30, 29, 28, 27, 25, 23,
21, 19, 17, 14, 11, 8, 6, 3,
0, -3, -6, -8, -11, -14, -17, -19,
-21, -23, -25, -27, -28, -29, -30, -30,
-31, -30, -30, -29, -28, -27, -25, -23,
-21, -19, -17, -14, -11, -8, -6, -3 );
-- Note : This table could be optimized (4 times shorter...)
signal Tone1 : s6_t;
signal Tone2 : s6_t;
signal Tone : s7_t;
begin
ToneV <= to_signed(Tone,ToneV'length);
-- F1 / F2 Tone
process (Rst,Clk)
begin
if Rst='1' then
Tone <= 0;
elsif rising_edge (Clk) then
-- PROBLEM MIGHT BE LOCATED BELOW :
Tone <= Sinewave(to_integer(Addr1)) + Sinewave(to_integer(Addr2));
-- note : 6 bits + 6 bits -> 7 bits (... but not for XST ???)
-- for some reason, the Adder's Carry Out seems lost...
-- works fine with Quartus, Precision synthesis...
end if;
end process;
end RTL;
I stumbled on something weird while fitting one of my
Tornado exercises on a Xilinx board...
Worked fine with other synthesis tools, but wouldn't
with XST. By dichotomy, I think I caught the culprit :
a simple signed adder !?
IMO, it should sign-extend the 6 bits into 7 bits,
then add and produce a 7 bits vector. Having a look
at the RTL view didn't look too good to me :-(
I used ISE 6.3.03i.
Anyone any idea ?
I may have missed something obvious.
-- Bert
-- ----------------------------------------
-- XSR synthesis bug ?
-- (simplified code for debug purpose)
-- contact : info at alse-fr dot com
-- Author : Bert Cuzeau
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE ieee.numeric_std.ALL;
-- ---------------------------------------
Entity XST_BUG is
-- ---------------------------------------
Port ( Clk : In std_logic; -- Main System Clock
Rst : In std_logic; -- Asynchronous reset, active high
Addr1 : in unsigned (5 downto 0); -- for simple test
(std_logic_vector)
Addr2 : in unsigned (5 downto 0); -- for simple test
(std_logic_vector)
ToneV : out signed (6 downto 0) ); --for simple test
(std_logic_vector)
end;
-- ---------------------------------------
Architecture RTL of XST_BUG is
-- ---------------------------------------
subtype s6_t is integer range -32 to 31;
subtype s7_t is integer range -64 to 63;
type Sinewave_t is array (0 to 63) of s6_t; -- (natural range <> in fact
constant Sinewave : Sinewave_t := (
0, 3, 6, 8, 11, 14, 17, 19,
21, 23, 25, 27, 28, 29, 30, 30,
31, 30, 30, 29, 28, 27, 25, 23,
21, 19, 17, 14, 11, 8, 6, 3,
0, -3, -6, -8, -11, -14, -17, -19,
-21, -23, -25, -27, -28, -29, -30, -30,
-31, -30, -30, -29, -28, -27, -25, -23,
-21, -19, -17, -14, -11, -8, -6, -3 );
-- Note : This table could be optimized (4 times shorter...)
signal Tone1 : s6_t;
signal Tone2 : s6_t;
signal Tone : s7_t;
begin
ToneV <= to_signed(Tone,ToneV'length);
-- F1 / F2 Tone
process (Rst,Clk)
begin
if Rst='1' then
Tone <= 0;
elsif rising_edge (Clk) then
-- PROBLEM MIGHT BE LOCATED BELOW :
Tone <= Sinewave(to_integer(Addr1)) + Sinewave(to_integer(Addr2));
-- note : 6 bits + 6 bits -> 7 bits (... but not for XST ???)
-- for some reason, the Adder's Carry Out seems lost...
-- works fine with Quartus, Precision synthesis...
end if;
end process;
end RTL;