# How to read an NGC netlist file

For the occasions that you find yourself with a netlist file and you don’t know where it came from or what version it is, etc. this post is about how you can interpret the netlist file (ie. convert it into something readable).

Today I found myself with two netlists and I needed to know if they were the same. Yes of course you can try comparing the two files with a program such as Beyond Compare, but if the netlists were compiled on separate dates, you will have trouble recognizing this from the raw binary data. The best thing to do in this case is to convert the netlists to EDIF files, a readable, text file version of the netlist. Another option is to convert the netlists into VHDL or Verilog code. Here is how you can do this:

#### To convert a netlist (.ngc) to an EDIF file (.edf)

1. Get a command window open by typing cmd in the Start->Run menu option in Windows. If you use Linux, open up a terminal window.
2. Use the cd command to move to the folder in which you keep your netlist.
3. Type ngc2edif infilename.ngc outfilename.edf where infilename and outfilename correspond to the input and output filenames respectively.
4. Open the .edf file with any text editor to view the netlist.

#### To reverse engineer a netlist with ISE versions older than 6.1i

1. Convert the netlist to an EDIF file using the above instructions.
2. Type edif2ngd filename.edf filename.ngd to convert the EDIF file into an NGD file (Xilinx Native Generic Database file).
3. To convert the netlist into VHDL type ngd2vhdl filename.ngd filename.vhd.
4. To convert the netlist into Verilog type ngd2ver filename.ngd filename.v.

#### To reverse engineer a netlist with ISE versions 6.1i and up

1. To convert the netlist into VHDL type netgen -ofmt vhdl filename.ngc. Netgen will create a filename.vhd file.
2. To convert the netlist into Verilog type netgen -ofmt verilog filename.ngc. Netgen will create a filename.v file.

Now you should have all the tools you need to read an NGC netlist file.