Ports and interfaces are playing a crucial role in HLS. 1
Now the question is, What are the suitable interfaces for the ports in our simple input/output example? 2
In the next lecture, 3
I am going to handle this question. 4
Let's develop the C function that connects switches to LEDs in our simple input/output example. First, 5
as we are going to read and write 8 bits of data, 6
let's consider the unsigned char as our data type. 7
Also, we use function arguments to receive and send data. 8
So the function looks like this. 9
It has two arguments. The argument that returns data is defined as a pointer. Now, the function body 10
is as simple as a single assignment. 11
The synthesis tool translates this individual assignment into a set of wires that connect the inputs 12
to the outputs. Before adding interface pragmas to this code, 13
let's talk about the function hierarchy in HLS. 14
Each hardware module described in C/C++ can have multiple functions calling each other. 15
However, only one function is called top-function. 16
Other functions should be invoked through this top-function, directly or by other functions under the top- 17
function. 18
This diagram shows the function call graph, which has only one root, that is the top function. 19
The top-function arguments are the hardware ports through which the module communicate with the rest of 20
the systems. 21
Therefore, these arguments should be synthesised into digital circuits that provide suitable signalling 22
for the communication considered for each port. Such as serial communication, synchronise communication 23
and accessing an external memory with a specific communication protocol, just to name a few. 24
This synthesis process is called interface synthesis. 25
The Vivado-HLS tool performs this interface synthesis automatically. Users should only mention 26
the type of the protocol which should be supported by the synthesised interface. 27
An interface assigned to a port can have different modes. Each mode defines a protocol and its associated 28
signaling for data exchange. 29
Here it is the list of modes of an interface available in vivado-HLS. 30
I will explain some of them throughout this course. 31
And these figures show the signalling associated with three modes, 32
as can be seen, a port can have a simple or a sophisticated hardware implementation. If the communication 33
is very naive via simple wires without any specific signalling, which is the case in combinational 34
circuits, the interface mode (or type) would be ap_none. 35
The HLS tool packages the synthesised hardware into an IP (intellectual property). This IP can have a 36
few block-level signals to control the functionality of the modules such as start, done, clock, reset, 37
etc.. 38
This should be defined as an interface assigned to the top-function in the C description. 39
As for a combinational circuit, we don't have such signals 40
the type (or mode) of this interface is ap_ctrl_none. Other block-level interface modes add more 41
signals to the design to control its activation states. 42
Ok, let's go back to our design and add the interface related directives to our top-function. 43
We need an interface for each function argument and one for the function itself. Whereas the argument names 44
are used as the name of their related ports, the port name of the function, in vivado-HLS, is the return keyword. 45
Another way to implement our example is by using a function with one argument and a return value. 46
Here is the function with its interfaces directives. 47
Notice that a top-function in HLS cannot return a pointer value. That's not synthesisable. 48
In the next lecture, I will explain how to implement our design C function in vivado-HLS. 49
These are our takeaway messages. Each HLS hardware description can have only one top-function, 50
Only an argument in the top function requires an associated interface 51
There is also a block-level interface assigned to the top-function 52
Now the quiz of this lecture. Add interfaces pragmas to this top-level function.