That's part of what he was trying to convey.
In a previous post I made the point that Verilog and VHDL are hardware modeling languages. As part of that discussion, I tried to convey to you the need to understand that the syntax of HDLs is designed for simulation, and not for synthesis. This means that for the synthesizer to determine what physical circuits are desired, it must limit the syntax of the language that it can accept. Now that it has a smaller syntax to evaluate, it is still faced with a monumental task of trying to determine your actual circuit. On top of that, the synthesizer and the simulator need to be able to provide equivalent results for the same code.
Ken's main point is that the synthesizer analyzes the RTL source in a certain order, and that order is determined by the priorities of the fundamental circuit components of its physical FPGA. The highest priority physical feature of a Xilinx CLB FF is its reset feature. The synthesizer parses your source, and if the first portion of your code that it parses can be decomposed into something that can be connected to its reset feature, then that signal is connected to the reset feature of the FF. If it can not be connected in that manner, then the reset feature is tied off, and the synthesizer goes on to the next part of your source to determine if it appears something that can be used to gate the clock. If it can, then that signal is connected to the clock enable feature of the FF. This process repeats for each feature supported by the CLB FF. When all fundamental features have been determined, the remaining logic is implemented in the attached LUTs.
The key takeaway is that the synthesizer is expecting you to write your code in a specific manner in order for it to be able to parse it to use the built-in features of the CLBs. If you review some of the code that I've posted on GitHUB, you'll see that I've taken Ken's admonitions to heart, and I develop my source in a very regular manner. If I want the FF to be initialized, I always use a reset. If I want the clock enable to be used, then I always terminate the logic in a final
else if (CE) to ensure the clock enable feature of the FF is used. For example, the following code fragment reverses the priorities of reset and clock enable, which means that the synthesizer will only be able to implement the reset logic with a multiplexer in the LUTs instead of using the built-in features of the CLBs.
Code:
// Reversed Priorities Clock Enable and Reset
always @(posedge Clk)
begin
if(CE)
D <= #1 D + 1;
else if(Rst)
D <= #1 0;
end
The same result applies if you code a horizontal line counter as follows:
Code:
// RST of FF not used either
always @(posedge Clk50)
begin
if(pclk)
D <= #1 ((hstart | hend)) ? 0 : D + 1);
end
Neither of these two examples are designed to change a coding style. In most cases, the performance of the FPGA far exceeds your requirements, and the results would be equivalent to one which took into consideration the lessons from Ken Chapman's White Paper:
Code:
// RST and CE of FF is used in this example
assign Rst_D = (hstart | hend) & pclk;
always @(posedge Clk50)
begin
if(Rst_D)
D <= #1 0;
if(pclk)
D <= #1 (D + 1);
end
Furthermore, the Spartan 6, with its 6 input LUTs, is much more capable of merging a simple 2:1 multiplexer into the LUT without overflowing the input limits and expanding the required logic into another LUT. All that being said, its been my experience that if you choose a coding style early that adheres to the lessons of Ken's white paper, then your code will be more efficient and generally have better performance. In addition, when you run out of resources in some future application, it will not be as a result of poor resource utilization but because you truly have exceeded the capabilities of the part.
I will make the point that the reset input of the FF is used to determine the initial state of the FF after configuration. In the configuration process, the bit stream configures whether the FF is initialized as a 1 or a 0. Further during configuration, an internal reset is asserted, and the FFs are initialized in accordance to their assigned initial values. You have been initializing your FFs by assigning them an initial value when you declare them. In simulation, this value is loaded into the FFs when the simulation starts or restarts. In this manner, all of your FFs have a known value, and you can run a simulation.
However, FF reset can be used to initialize the FF to a known value, and this value is inherent in the configuration of the FPGA and not found in the LUTs. In the last example above, the Rst_D signal reinitialized the counter to its initial condition without using an extra LUT input to merge in a multiplexer. But as I said above, the enhanced capabilities of the 6-input Spartan 6 LUTs make some of these optimizations moot. The logic for the lower bits of the counter will fit within a single LUT, and the effect of the extra input bit will not have a significant affect on the size or speed of the example counter.