Intel® High Level Synthesis Compiler Standard Edition: Reference Manual

ID 683310
Date 12/18/2019
Public
Document Table of Contents

10.5. Intel® HLS Compiler Standard Edition Simulation API (Testbench Only)

Table 22.   Intel® HLS Compiler Standard Edition Simulation API (Testbench only) Summary
Function Description
ihc_hls_enqueue This function enqueues one invocation of an HLS component.
ihc_hls_enqueue_noret This function enqueues one invocation of an HLS component. This function should be used when the return type of the HLS component is void.
ihc_hls_component_run_all This function pushes all enqueued invocations of a component into the component in the HDL simulator as quickly as the component can accept new invocations.
ihc_hls_sim_reset This function sends a reset signal to the component during automated simulation.

ihc_hls_enqueue Function

Syntax
ihc_hls_enqueue(void* retptr, void* funcptr, /*function arguments*/)
Description
This function enqueues one invocation of an HLS component. The return value is stored in the first argument which should be a pointer to the return type. The component is not run until the ihc_hls_component_run_all() is invoked.

To learn more, review the tutorial: <quartus_installdir>/hls/examples/tutorials/usability/enqueue_call.

ihc_hls_enqueue_noret Function

Syntax
ihc_hls_enqueue_noret(void* funcptr, /*function arguments*/)
Description
This function enqueues one invocation of an HLS component. This function should be used when the return type of the HLS component is void. The component is not run until the ihc_hls_component_run_all() is invoked.

To learn more, review the tutorial: <quartus_installdir>/hls/examples/tutorials/usability/enqueue_call.

ihc_hls_component_run_all Function

Syntax
ihc_hls_component_run_all (void* funcptr)
Description
This function accepts a pointer to the HLS component function. When run, all enqueued invocations of the component will be pushed into the component in the HDL simulator as quickly as the component can accept new invocations.

To learn more, review the tutorial: <quartus_installdir>/hls/examples/tutorials/usability/enqueue_call.

ihc_hls_sim_reset Function

Syntax
int ihc_hls_sim_reset(void)
Description
This function sends a reset signal to the component during automated simulation. It returns 1 if the reset was exercised or 0 otherwise.

To learn more, review the tutorial: <quartus_installdir>/hls/examples/tutorials/component_memories/static_var_init.

Simulation API Code Example

component int foo(int val) {
  // function definition
}
									
component void bar (int val) {
  // function definition
}
int main() {
  // ……. 
  int input = 0;
  int res[5];
  ihc_hls_enqueue(&res, &foo, input);
  ihc_hls_enqueue_noret(&bar, input);
  input = 1;
  ihc_hls_enqueue(&res, &foo, input);
  ihc_hls_enqueue_noret(&bar, input);
  ihc_hls_component_run_all(&foo);
  ihc_hls_component_run_all(&bar);
}