HOME       UP       PREV       NEXT (Multiplier Answer (2))  

A Simple Worked Example: Classical HLS of Multiply

Take a non-rentrant function:

that achieves the same behaviour.
int multiply(int A, int B)    // A simple long multiplier with variable latency.
{ RA=A;                       // Not RTL: The while loop trip count is data-dependent.
  RB=B;                       // 
  RC=0;                       //
  while(RA>0)                 // Let's make a naive HLS of this program...
  {
    if odd(RA) RC = RC + RB;
    RA = RA >> 1;
    RB = RB << 1;
  }
  return RC;
}
Long multiplier viewed as datapath and sequencer.

This simple example has no multi-cycle primitives and a 1-to-1 mapping of ALUs to the source code text, so no schedulling was needed from the HLS tool.

Each register has a multiplexor that ranges over all the places it is loaded from.

We followed a syntax-directed approach (also known as a constructive approach) with no search in the solution space for minimum clock cycles or minium area or maximum clock frequency.

The resulting block could serve as a primitive to be instantiated by an HLS tool. This example is not fully-pipelined and so typically would not be used for that purpose.


11: (C) 2012-18, DJ Greaves, University of Cambridge, Computer Laboratory.