Intel® High Level Synthesis Compiler Pro Edition: Reference Manual

ID 683349
Date 6/02/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

13.5. Intel® HLS Compiler Pro Edition Simulation API (Testbench Only)

Table 41.   Intel® HLS Compiler Pro 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_set_component_wait_cycle This function tells the simulation process to continue running for a specified number of additional cycles (beyond the default wait period of 100 cycles) after the done signal for the specified component is observed.

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.

ihc_hls_set_component_wait_cycle Function

Syntax
ihc_hls_set_component_wait_cycle(<component function name>, <# of wait cycles>)
Description
This function tells the simulation process to continue running for a specified number of additional cycles (beyond the default wait period of 100 cycles) after the done signal for the specified component is observed. This delay can enable task functions with a higher latency than the component function to successfully return their output during simulation.

Use this function when you simulate a design that uses a system of tasks where the completion of a task function is not synchronized with an ihc::collect call.

By default, the simulation process simulates an additional 100 cycles after a component asserts the done signal to ensure all operations have propagated back to the testbench. This function tells the simulation process for the specified component to continue running for the specified number of cycles in addition to the default wait period of 100 cycles.

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);
}