Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

error during synthesize VHDL code in xilinx

Status
Not open for further replies.

gani

Newbie level 6
Joined
Sep 26, 2007
Messages
14
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,403
to_unsigned

hi all
can anybody help me out with this code..
i generated the below code using matlab..i'm able to simulate this code using modelsim...but when i'm trying synthesizing the same code using xilinx its giving some errors....or can anyone plz convert this code to verilog...

thanx in advance


LIBRARY IEEE;
USE IEEE.std_logic_1164.all;
USE IEEE.numeric_std.ALL;

ENTITY poly_int IS
PORT( clk : IN std_logic;
clk_enable : IN std_logic;
reset : IN std_logic;
filter_in : IN real; -- double
filter_out : OUT real; -- double
ce_out : OUT std_logic
);

END poly_int;

ARCHITECTURE rtl OF poly_int IS
-- Local Functions
-- Type Definitions
TYPE delay_pipeline_type IS ARRAY (NATURAL range <>) OF real; -- double
-- Constants
CONSTANT coeffphase1_1 : real := 2.5000000000000000E-001; -- double
CONSTANT coeffphase1_2 : real := 7.5000000000000000E-001; -- double
CONSTANT coeffphase2_1 : real := 5.0000000000000000E-001; -- double
CONSTANT coeffphase2_2 : real := 5.0000000000000000E-001; -- double
CONSTANT coeffphase3_1 : real := 7.5000000000000000E-001; -- double
CONSTANT coeffphase3_2 : real := 2.5000000000000000E-001; -- double
CONSTANT coeffphase4_1 : real := 1.0000000000000000E+000; -- double
CONSTANT coeffphase4_2 : real := 0.0000000000000000E+000; -- double
-- Signals
SIGNAL cur_count : unsigned(1 DOWNTO 0); -- ufix2
SIGNAL phase_3 : std_logic; -- boolean
SIGNAL ce_out_reg : std_logic; -- boolean
SIGNAL delay_pipeline : delay_pipeline_type(0 TO 1) := (0.0, 0.0); -- double
SIGNAL product : real := 0.0; -- double
SIGNAL product_mux : real := 0.0; -- double
SIGNAL product_1 : real := 0.0; -- double
SIGNAL product_mux_1 : real := 0.0; -- double
SIGNAL sum1 : real := 0.0; -- double
SIGNAL output_register : real := 0.0; -- double


BEGIN

ce_output : PROCESS (clk, reset)
BEGIN
IF reset = '1' THEN
cur_count <= to_unsigned(0, 2);
ELSIF clk'event AND clk = '1' THEN
IF clk_enable = '1' THEN
IF cur_count = to_unsigned(3, 2) THEN
cur_count <= to_unsigned(0, 2);
ELSE
cur_count <= cur_count + 1;
END IF;
END IF;
END IF;
END PROCESS ce_output;

phase_3 <= '1' WHEN cur_count = to_unsigned(3, 2) AND clk_enable = '1' ELSE '0';

-- ------------------ CE Output Register ------------------

ce_output_register : PROCESS (clk, reset)
BEGIN
IF reset = '1' THEN
ce_out_reg <= '0';
ELSIF clk'event AND clk = '1' THEN
ce_out_reg <= phase_3;

END IF;
END PROCESS ce_output_register;

-- ---------------- Delay Registers ----------------

Delay_Pipeline_process : PROCESS (clk, reset)
BEGIN
IF reset = '1' THEN
delay_pipeline(0 TO 1) <= (OTHERS => 0.0000000000000000E+000);
ELSIF clk'event AND clk = '1' THEN
IF phase_3 = '1' THEN
delay_pipeline(0) <= filter_in;
delay_pipeline(1) <= delay_pipeline(0);
END IF;
END IF;
END PROCESS Delay_Pipeline_process;


product_mux <= coeffphase1_2 WHEN ( cur_count=to_unsigned(0, 2) ) ELSE
coeffphase2_2 WHEN ( cur_count=to_unsigned(1, 2) ) ELSE
coeffphase3_2 WHEN ( cur_count=to_unsigned(2, 2) ) ELSE
coeffphase4_2;
product <= delay_pipeline(1) * product_mux;

product_mux_1 <= coeffphase1_1 WHEN ( cur_count=to_unsigned(0, 2) ) ELSE
coeffphase2_1 WHEN ( cur_count=to_unsigned(1, 2) ) ELSE
coeffphase3_1 WHEN ( cur_count=to_unsigned(2, 2) ) ELSE
coeffphase4_1;
product_1 <= delay_pipeline(0) * product_mux_1;

sum1 <= product_1 + product;

Output_Register_process : PROCESS (clk, reset)
BEGIN
IF reset = '1' THEN
output_register <= 0.0000000000000000E+000;
ELSIF clk'event AND clk = '1' THEN
IF clk_enable = '1' THEN
output_register <= sum1;
END IF;
END IF;
END PROCESS Output_Register_process;

-- Assignment Statements
ce_out <= ce_out_reg;
filter_out <= output_register;
END rtl;
 

to_unsigned vhdl

I'll bet the error message was something like, ". . . Signal <filter_in> of type real is not supported."

Your code contains "real" (floating-point) data type, which isn't supported by Xilinx XST, the HDL synthesizer. That's a common limitation of today's HDL synthesis tools.

Try modifying your MATLAB project so it generates integer or fixed-point arithmetic.
 

vhdl code for xilinx

thank you for ur reply....
yes that is true..i'm got the same error as you mentioned..i tried changing ieee standards now i'm facing problem with to_unsigned..is there any libraries for to_unsigned in hdl....

and i generated even verilog code using matlab..can i synthesize $bitstoreal in xilinx???? i've already changed my code using fixed point...but i want to synthesize the same code using xilinx if there is no such option i'll continue with fixed point only...
 

floating point unit vhdl code for xilinx

Hello,

the conversion functions provided in ieee.std_logic_arith are UNSIGNED(x) for bitvector to unsigned "type casting" and CONV_UNSIGNED(x,length) for integer to unsigned conversion, similar with SIGNED type.

Verilog $bitstoreal ends up in the same issue as discussed. It's useless without a real data type in synthesizable code. However, some IP for real arithmetic is available (don't know particularly with Xilinx), but it uses bitvectors at the interface. Porting matlab code to use such IP (e.g. float multipliers) would imply specialized conversion functions. Thus it's a good idea to make matlab design the fixed point aritmetics as suggested.

Regards,
Frank
 

to_unsigned with two arguments vhdl

U havent quantized ur design in Matlab
check the filter design user guide
after u design a filter u have to quantize it to fixed point so tat u can genrate ur synthesizable HDL.

Regards
 
  • Like
Reactions: alex12

    alex12

    Points: 2
    Helpful Answer Positive Rating
steps to synthesize a vhdl code in xilinx

Just one more point to add, converting your code to Verilog wont help you either. You will still have the issue of floating point numbers to deal with.

E
 

xilinx + real

HI gani, this is M & M HRU?
I m requesting to u plz tell me a procedure how to convert matlab code to VHDL code, becoz i written matlab code but i want to convert that to VHDL code. So kindly i request u plz reply me with astep by step procedure for conversion of VHDL code. so i m waiting for ur reply, advance thanking u.

Regards
M & M
 

Re: to_unsigned

i am having the same problelm in xilinx for to_unsigned and to_integer -----


use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
USE IEEE.numeric_std.ALL;
---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;

-- use package
USE work.procmem_definitions.ALL;
ENTITY alu IS
PORT (
a, b : IN STD_ULOGIC_VECTOR(width-1 DOWNTO 0);
opcode : IN STD_ULOGIC_VECTOR(2 DOWNTO 0);
result : OUT STD_ULOGIC_VECTOR(width-1 DOWNTO 0);
zero : OUT STD_ULOGIC);
END alu;


architecture Behavioral of alu is

BEGIN
PROCESS(a, b, opcode)
-- declaration of variables
VARIABLE a_uns : UNSIGNED(width-1 DOWNTO 0);
VARIABLE b_uns : UNSIGNED(width-1 DOWNTO 0);
VARIABLE r_uns : UNSIGNED(width-1 DOWNTO 0);
VARIABLE z_uns : UNSIGNED(0 DOWNTO 0);
BEGIN
-- initialize values
a_uns := UNSIGNED(a);
b_uns := UNSIGNED(b);
r_uns := (OTHERS => '0');
z_uns(0) := '0';
-- select desired operation
CASE opcode IS
-- add
WHEN "010" =>
r_uns := a_uns + b_uns;
-- sub
WHEN "110" =>
r_uns := a_uns - b_uns;
-- and
WHEN "000" =>
r_uns := a_uns AND b_uns;
-- or
WHEN "001" =>
r_uns := a_uns OR b_uns;
-- slt
WHEN "111" =>
r_uns := a_uns - b_uns;
IF SIGNED(r_uns) < 0 THEN
r_uns := TO_UNSIGNED(1, r_uns'LENGTH);
ELSE
r_uns := (OTHERS => '0');
END IF;

-- others
WHEN OTHERS => r_uns := (OTHERS => 'X');
END CASE;
-- set zero bit if result equals zero
IF TO_INTEGER(r_uns) = 0 THEN
z_uns(0) := '1';
ELSE
z_uns(0) := '0';
END IF;
-- assign variables to output signals
result <= STD_ULOGIC_VECTOR(r_uns);
zero <= z_uns(0);
END PROCESS;


end Behavioral;

its showing
Line 74. Type of r_uns is incompatible with type of TO_UNSIGNED.
Line 83. TO_INTEGER can not have such operands in this context.

plz help me out with this
 

The problem is to mix IEEE.STD_LOGIC_ARITH and IEEE.NUMERIC_STD. Use either one or the other.
 

Re: to_unsigned with two arguments vhdl

U havent quantized ur design in Matlab
check the filter design user guide
after u design a filter u have to quantize it to fixed point so tat u can genrate ur synthesizable HDL.

Regards

hi,
I SYNTHESIZED the filter and introduce fixed point, but when I convert it to verilog code still it produce signed input/output which is not synthesizebale with desigin_vision.
Do you have any idea?

I have tried to give only unsigned input/output but the toolbox dose not allow me to determine it.

Thanks in advance
Alex
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top