courses:system_design:synthesis:combinational_logic:start

Combinational Logic

architecture EXAMPLE of FEEDBACK is
 
  signal B, X : integer range 0 to 99;
 
begin
 
  process (X, B)
  begin
   X <= X + B;
  end process;
 
...
 
end EXAMPLE;

Feedback Loops

Do not create combinational feedback loops!

Notes

When modelling purely combinational logic, it is necessary to avoid combinational feedback loops. A feedback loop triggers itself all the time, i.e. the corresponding process is always active. In the example, this results in a perpetual addition, i.e. X is increased to its maximum value. So simulation quits at time 0 ns with an error message because X exceeds its range. In general, synthesis is possible, yet the hardware is not useable.

Code Hardware realization
Direct implementation
EXAMPLE1:
process (SEL, A, B, C)
begin
   if SEL =1then
     Z <= A + B;
   else
     Z <= A + C;
   end if;
end process EXAMPLE1;
Direct Implementation
Manual resource sharing
EXAMPLE2:
process (SEL, A, B, C)
  variable TMP : bit;
begin
   if SEL =1then
     TMP := B;
   else
     TMP := C;
   end if;
Z <= A+ TMP;
end process EXAMPLE2;
Manual Resource Sharing

Notes

An IF statement is synthesized to a multiplexer with eventual additional logic. That is the reason why the direct implementation of example 1 results in two adders as this is exactly what the VHDL code describes. But it is obvious that one adder is sufficient to implement the desired functionality and good synthesis tools will detect this during their optimization cycles.

In example 2 a temporal variable is used to implement a functionally equivalent description which requires only one adder. Manual resource sharing is recommended as it leads to a better starting point for the synthesis process.

The structure of the generated hardware, at least in the first synthesis iteration, is determined by the VHDL code itself. Consequently, the coding style has a rather big impact on the optimization algorithms. As not all synthesis tools are able to optimize the design structure itself, it is reasonable to ease their task, e.g. by structuring the code for minimum critical paths.

  • An operation can be described very efficiently for synthesis, e.g.:
OUT1 <= IN1+IN2+IN3+IN4+IN5+IN6
OUT2 <= ((IN1+IN2)+(IN3+IN4))+(IN5+IN6)
Long Path Short Path
  • In one description the longest path goes via five, in the other description via three addition components - some optimization tools automatically change the description according to the given constraints.

Chapters of System Design > Synthesis > Combinational Logic