UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Explorer
Explorer
218 Views
Registered: ‎04-01-2016

Synthesize for two FPGA vendors

Hi all,

usually I use Xilinx FPGAs but from time to time I also have to use Lattice FPGAs, in this case for a project where the customer asked for Lattice iCE40. I mainly use Verilog HDL.

To be able to use Xilinx as well as Lattice I want to make my source code very generic. This works already but for every file in which I use IPs I have to keep two files, one for Xilinx, one for Lattice.

What I want to do is the following, but I don't know if this is good style.

#ifdef XILINX
       // Xilinx module instantiation
#else if LATTICE
// Lattice module instantiation
#endif

Does someone of you already use such a construct to synthesize for two FPGA vendors? Are there predefined compiler defines which I can use? Else I would think about defining a global define for the whole project in Vivado toolchain and doing exactly the described method above.

Thanks for helping!

Kind regards

Sebastian

0 Kudos
7 Replies
Scholar drjohnsmith
Scholar
209 Views
Registered: ‎07-09-2009

Re: Synthesize for two FPGA vendors

They are expensive, but have you seen
https://www.mentor.com/products/fpga/synthesis/

( others do exist , but I use these )

0 Kudos
Moderator
Moderator
195 Views
Registered: ‎03-16-2017

Re: Synthesize for two FPGA vendors

Hi @sebastian_z,

 

Did you face any errors after using this method? 

I am not sure it will work or not after adding lattice module instantiation. But, give it a try with it since ifdef method is supported. 

Regards,
hemangd

Don't forget to give kudos and mark it as accepted solution if your issue gets resolved.
0 Kudos
Moderator
Moderator
191 Views
Registered: ‎11-04-2010

Re: Synthesize for two FPGA vendors

Hi, @sebastian_z ,

I have seen the method you mentioned used properly in my customer's real design.

I think the method is reasonable.

-------------------------------------------------------------------------
Don't forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------
0 Kudos
Explorer
Explorer
167 Views
Registered: ‎04-01-2016

Re: Synthesize for two FPGA vendors

Hi all,

Thank you very much for your answer. I tried it with the ifdef because I think it is reasonable too, but I do have an error message which I received 6 months ago and then stopped trying. But now I need that solution.

The problem is that as soon as I add the ifdef around the module instantiation I get the error message that the module is not found. As soon as I remove the ifdef, all steps go fine and at the end I do have a valid bitfile.

So please have a look at the error message.

Kind regards

Sebastian

 ifdef.png

 

0 Kudos
Moderator
Moderator
98 Views
Registered: ‎11-04-2010

Re: Synthesize for two FPGA vendors

Using report_compile_order command to check whether the define.v(the header file with macro define) is compiled earlier than your source code with `ifdef.

-------------------------------------------------------------------------
Don't forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------
0 Kudos
Contributor
Contributor
92 Views
Registered: ‎01-27-2008

Re: Synthesize for two FPGA vendors

Hi Sebastian,

You might add a $display in there with some text to show that the `ifdef was used ... or not.

 

Alternatively, it might be better to use parameters and generate statements.

For instance set the parameters at the top level module, something like

module sebastians_scalable_module #(
parameter ISLATTICE = 0

)(
interfaces

); ... generate if (ISLATTICE == 1) begin RTL to adapt to lattice primitive Lattice primitive end endgenerate generate if (ISLATTICE == 0) begin RTL to adapt to xilinx primitive xilinx primitive end endgenerate

So that's another option that allows use of generics (VHDL) / parameters (vlog) in a hierarchical deisgn...

 

 

 

 

Explorer
Explorer
57 Views
Registered: ‎04-01-2016

Re: Synthesize for two FPGA vendors

Hi @olupj

thank you very much. I thought about that method too and I really like it. Just one question about that: is it possible to use global verilog_defines as described above and not parameters? The advantage of defines would be that I don't need to add them to the generic list (VHDL) / parameter list (Verilog).

Kind regards

Sebastian

0 Kudos