Verilog Xilinx wont synthesize

  • Thread starter freezer
  • Start date
In summary, the conversation discusses an issue with a BCD driver for a BASYS2 board that is currently hard coded to display numbers. The issue is that when trying to synthesize the code with Xilinx software, there is an Unsupported Control Statement error. The conversation also includes suggestions for using standard flop templates and including a reset term for simulation purposes. It is recommended to use nonblocking assignment for synchronous elements to avoid simulation problems in the future.
  • #1
freezer
76
0
I am trying to build a BCD driver for my BASYS2 board that i can supply a 16bit data stream and will display the number on the four 7 segment LED.

In this module, i have just hard coded the numbers to display. It does not currently have the 16bit input. It scans across each of the four 7 segment led and will display 1 2 3 4.

The module tests fine in the test bench but when i go to synthesize it with the zilinx software, i get an Unsupported Control Statement error.

I have read through my verilog book and everything seems to be in order.

I have annotated the code where xilinx point to the issue.

Here is the verilog code:

Code:
module scanner(AN, BCD, segments, scan, clk);
  
  input wire clk;
  
  output reg [1:0] scan;
  output reg [3:0] AN;
  output reg [3:0] BCD;
  output reg [6:0] segments;
  
  initial scan = 2'b00;
  
  always
    begin
      @(posedge clk)   //<<<<<<<Error points here
        scan = scan + 1'b1;
  
           case(scan)
//Turns on or off each of the 4 7 seg LEDs  
// AN0 1 on,  0 off
// AN1 1 off, 0 on
// AN2 1 off, 0 on
// AN3 1 on,  0 off
                         //LED     3210
              2'b00 : AN <= 4'b0111;   //AN0 ON
              2'b01 : AN <= 4'b0100;   //AN1 ON
              2'b10 : AN <= 4'b0010;   //AN2 ON
              2'b11 : AN <= 4'b1110;   //AN3 ON  
          endcase
          
          case(AN)
              //Temp to give BCD input some values
              2'b00 : BCD <= 4'b0100;   
              2'b01 : BCD <= 4'b0011;  
              2'b10 : BCD <= 4'b0010; 
              2'b11 : BCD <= 4'b0001;   
          endcase
          
          case(BCD)
              //Due to the physical FPGA 7 Seg LED, the segments is inverted
              //to drive the correct segments on the display.
              //                                abcdefg
              4'b0000 : segments = 7'b0000001; //zero
              4'b0001 : segments = 7'b1001111; //one
              4'b0010 : segments = 7'b0010010; //two
              4'b0011 : segments = 7'b0000110; //three
              4'b0100 : segments = 7'b1001100; //four
              4'b0101 : segments = 7'b0100100; //five
              4'b0110 : segments = 7'b0100000; //six
              4'b0111 : segments = 7'b0001111; //seven
              4'b1000 : segments = 7'b0000000; //eight
              4'b1001 : segments = 7'b0001100; //nine
              4'b1010 : segments = 7'b0001000; //a
              4'b1011 : segments = 7'b1100000; //b
              4'b1100 : segments = 7'b0110001; //c
              4'b1101 : segments = 7'b1000010; //d
              4'b1110 : segments = 7'b0110000; //e
              4'b1111 : segments = 7'b0111000; //f
              default : segments = 7'b0110000; //e
            
            
          endcase
  end  
endmodule
 
Engineering news on Phys.org
  • #2
Found out that the @(posedge clk) needed to be before the begin...
 
  • #3
A good habit when writing synthesizable verilog is to use the standard flop template and to include a reset term.
The reset term is most important for simulation (since everything starts as X and X+1 = X). The flops all start at zero in Xilinx unless you set them to 1 during the reset, but that's not true for simulation.

Also, you should use nonblocking assignment (<=) for synchronous elements (flip-flops) or you will have huge simulation problems in the future and will be throwing around #1's to get your sim to work.
Code:
//async reset flop
always @ (posedge clk or posedge reset) begin
   if(reset == 1) begin
       scan <= 0;
   else begin
       scan <= scan+1;
   end
end

//sync reset flop
always @ (posedge clk) begin
   if(reset == 1) begin
       scan <= 0;
   else begin
       scan <= scan+1;
   end
end
 

1. Why won't my Verilog code synthesize on Xilinx?

There could be several reasons for this. Some potential issues to check include syntax errors in your code, clocking issues, and unsupported constructs or features in Verilog that are not supported by Xilinx. It is also possible that your code may not meet timing requirements or that the design is too complex for the Xilinx tool to handle. It is important to carefully review your code and consult the Xilinx documentation for help in troubleshooting the issue.

2. How can I fix my Verilog code so that it will synthesize on Xilinx?

If your code is not synthesizing on Xilinx, it is important to carefully review and debug your code to identify the specific issue. You may need to make changes to your code, such as simplifying complex logic or using Xilinx-specific coding conventions. It is also helpful to refer to Xilinx's documentation and seek help from online forums or communities for assistance with troubleshooting your code.

3. What are some common mistakes that can prevent Verilog code from synthesizing on Xilinx?

Some common mistakes that can prevent Verilog code from synthesizing on Xilinx include syntax errors, unsupported constructs or features in Verilog, and timing violations. It is important to carefully review your code and consult the Xilinx documentation to ensure that your code adheres to Xilinx's requirements and guidelines.

4. Can I use Verilog code from other tools or vendors on Xilinx?

In most cases, Verilog code written for other tools or vendors should be compatible with Xilinx. However, it is possible that there may be slight differences in the way that certain constructs or features are implemented, which could cause issues with synthesis on Xilinx. It is always best to refer to Xilinx's documentation and guidelines to ensure compatibility with their tools.

5. How can I avoid issues with Verilog code not synthesizing on Xilinx in the future?

To avoid issues with Verilog code not synthesizing on Xilinx, it is important to follow Xilinx's coding guidelines and standards. These can be found in their documentation and online resources. It is also helpful to regularly test and debug your code throughout the development process to catch any issues early on. Additionally, staying up to date on the latest versions of Xilinx's tools and keeping your code organized and well-documented can help prevent issues with synthesis on Xilinx in the future.

Similar threads

  • Electrical Engineering
Replies
6
Views
4K
Replies
2
Views
6K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
20K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
13K
Back
Top