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.

why is it not synthesizable?

Status
Not open for further replies.

trurl

Junior Member level 2
Joined
Mar 14, 2006
Messages
20
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,436
Hi,

Can anybody tell why the following code can not be synthesized?

Xilinx says signal acc can not be synthesized.

Code:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;

entity mac is
    Port( in1 : in  signed(11 downto 0);
            in2 : in  signed(11 downto 0);
            clk : in  std_logic;
            rst : in  std_logic;
            acc : out signed(23 downto 0));
end mac;

architecture behavioural of mac is
	signal prod, reg : signed(23 downto 0);
begin
	process(clk,rst,in1,in2)
		variable sum : signed(23 downto 0);
        begin
		prod <= in1 * in2;
                if (rst'event and rst = '0') then
		       reg <= (OTHERS=>'0');
		elsif (clk'event and clk='0') then
			sum := prod + reg;
		        reg <= sum;
			acc <= reg;
		end if;
	end process;
end behavioural;


Thanks in advance.

Regards.
 

Describe type of the Xilinx device is used. The following statement:
Code:
...
if (rst'event and rst = '0') then 
...
may be the problem. Edge triggered reset is rather not implementet in most of the Xilinx devices. Your design requires two, edge triggered inputs to the register (rst and clk). Try with async reset.

bis
 

    trurl

    Points: 2
    Helpful Answer Positive Rating
Bis, thank you.

Since I'm a beginner, could you explain what is "async reset"
is it something like this
...
if (rst = '0') then
...
 

Bring this line
Code:
acc <= reg;
under end if ( out of the if module) and try to synthesis again.
May be the problem that you have to assign the value of acc for both conditions.
 

    trurl

    Points: 2
    Helpful Answer Positive Rating
I have tried it, it did not work in my experiment at least :-(
 

change all the (signed) signals , to (std_logic and std_logic_vector) signals .. and use the IEEE signed package in the begining of the file ..
Try to synthesize and feed me baq with what u get ..
 

    trurl

    Points: 2
    Helpful Answer Positive Rating
I think bis_ is correct. Most flops, including Xilinx FPGA flops, don't have an edge-triggered reset input.

I changed your edge-triggered reset: if (rst'event and rst = '0') then
to an ordinary level-sensitive (asynchronous) reset: if (rst = '0') then
and now it synthesizes in ISE 9.1i.
 

    trurl

    Points: 2
    Helpful Answer Positive Rating
To echo47:

I have already tried it, it synthesizes, but with this I get wrong waveforms in my design. Thanks anyway.
 

trurl said:
Hi,

Can anybody tell why the following code can not be synthesized?

Xilinx says signal acc can not be synthesized.

Code:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;

entity mac is
    Port( in1 : in  signed(11 downto 0);
            in2 : in  signed(11 downto 0);
            clk : in  std_logic;
            rst : in  std_logic;
            acc : out signed(23 downto 0));
end mac;

architecture behavioural of mac is
	signal prod, reg : signed(23 downto 0);
begin
	process(clk,rst,in1,in2)
		variable sum : signed(23 downto 0);
        begin
		prod <= in1 * in2;
                if (rst'event and rst = '0') then
		       reg <= (OTHERS=>'0');
		elsif (clk'event and clk='0') then
			sum := prod + reg;
		        reg <= sum;
			acc <= reg;
		end if;
	end process;
end behavioural;


Thanks in advance.

Regards.


You have a problem in ur sensitivity list .. for the clocked processes, remove everythign from the sensitivity list except the clock and the reset ..
Also you shouldn't have 2 edge triggered signals in your design .. keep the clock edge triggered and make the reset asynchronous to it like this :

Code:
if reset=0 then
   blablabla
elsif rising_edge(clk) then
   blablabla ..
endif
 

    trurl

    Points: 2
    Helpful Answer Positive Rating
here is corrected code!
Code:
library IEEE; 
use IEEE.STD_LOGIC_1164.ALL; 
use IEEE.STD_LOGIC_ARITH.ALL; 

entity mac is 
    Port( in1 : in  signed(11 downto 0); 
          in2 : in  signed(11 downto 0); 
          clk : in  std_logic; 
          rst : in  std_logic; 
          acc : out signed(23 downto 0)); 
end mac;    

architecture behavioural of mac is 
   signal prod, reg : signed(23 downto 0); 
begin
  prod <= in1 * in2;
  acc <= reg; 
   process (clk,rst) 
   begin   
     if (rst = '0') then 
         reg <= (OTHERS=>'0'); 
     elsif (clk'event and clk='0') then 
       reg <= prod + reg; 
     end if; 
   end process; 
end behavioural;
 

    trurl

    Points: 2
    Helpful Answer Positive Rating
nand_gates said:
here is corrected code!
Code:
library IEEE; 
use IEEE.STD_LOGIC_1164.ALL; 
use IEEE.STD_LOGIC_ARITH.ALL; 

entity mac is 
    Port( in1 : in  signed(11 downto 0); 
          in2 : in  signed(11 downto 0); 
          clk : in  std_logic; 
          rst : in  std_logic; 
          acc : out signed(23 downto 0)); 
end mac;    

architecture behavioural of mac is 
   signal prod, reg : signed(23 downto 0); 
begin
  prod <= in1 * in2;
  acc <= reg; 
   process (clk,rst) 
   begin   
     if (rst = '0') then 
         reg <= (OTHERS=>'0'); 
     elsif (clk'event and clk='0') then 
       reg <= prod + reg; 
     end if; 
   end process; 
end behavioural;

True .. that's exactly what I have mentioned in the my previous message
 

To omara007:

Thank you. I added in1 and in2 to the sensitivity list, because Xilinx was giving warnings about them missing in the list.
 

trurl said:
To omara007:

Thank you. I added in1 and in2 to the sensitivity list, because Xilinx was giving warnings about them missing in the list.

ignore these warnings .. try removing these inputs ..
 

if (rst'event and rst = '0') then
and
elsif (clk'event and clk='0') then
can't be used in one process !!
 

    trurl

    Points: 2
    Helpful Answer Positive Rating
Please try the code nand_gates has posted and ignore any warning you get .. then tell us about the wave results
 

To vfdff:

Thanks. Why is that?
 

I think Xilinx allways synthesize xx in statement "if (xx'event and xx = '0/1') " as a clk pin of the FlipFlop, there is only one clk pin in a FF cell. So there should not be two such statements in one process. One process one clock domain.
 

    trurl

    Points: 2
    Helpful Answer Positive Rating
To omara007:

I have tried the code that you mentioned. The waves are wrong, the mac unit does not work properly.

The reason I use my (rst'event and rst= '0') statement is that I need to generate automatically reset pulse. Since my code is not synthesizable, may be you could advise how to generate a short rst pulse between 2 clk pulses periodically after some number of clk pulses. Thank you.
 

trurl said:
To omara007:

I have tried the code that you mentioned. The waves are wrong, the mac unit does not work properly.

The reason I use my (rst'event and rst= '0') statement is that I need to generate automatically reset pulse. Since my code is not synthesizable, may be you could advise how to generate a short rst pulse between 2 clk pulses periodically after some number of clk pulses. Thank you.

Try designing a simple counter (cnt) .. when this counter counts 2 clock cycles, assert a certain signal, let's call it (xyz) ..

You can use the combinational "when" statement to assign a value of '1' to the (xyz) when (cnt) counter is equal to (2) ..

After that you can use this signal in an "if" statement to force all other signals in the design to be ZERO .. but don't call it reset ..
 

    trurl

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top