3.6.3.40 SHLS-99
(Ask a Question)Message
Error: (SHLS-99) SW/HW co-simulation for function pipelining with arrays as top-level inputs/outputs is not supported. The program uses the array '{array}' in function '{function}' as a top-level input/output. Please create a custom RTL testbench to simulate this hardware.
/***************************************************************** * This example is expected to result in * - Code : SHLS-99 * - Type : Error * - Command : SW/HW Co-Simulation (shls cosim) * - Cause : Co-simulation is attempted on function pipelined * design that includes top-level interface I/O * derived from global array variables. *****************************************************************/ #include "hls/streaming.hpp" hls::FIFO<int> in_fifo; hls::FIFO<int> out[2]; void DUT() { #pragma HLS function top pipeline int r = in_fifo.read(); out[0].write(r+2); out[1].write(r*3); } int main() { int in = 2; in_fifo.write(in); DUT(); int out0 = out[0].read(); int out1 = out[1].read(); return (out0 != in+2) || (out1 != in*3); }
To prevent this error, users are advised to pass the affected global array variables as
function arguments. For example, to avoid encountering code SHLS-99 in the
example above, the code can be rewritten as follows:
#include "hls/streaming.hpp" hls::FIFO<int> in_fifo; void DUT(hls::FIFO<int> out[2]) { #pragma HLS function top pipeline int r = in_fifo.read(); out[0].write(r+2); out[1].write(r*3); } int main() { hls::FIFO<int> out[2]; int in = 2; in_fifo.write(in); DUT(out); int out0 = out[0].read(); int out1 = out[1].read(); return (out0 != in+2) || (out1 != in*3); }
Related to: Simulate HLS Hardware (SW/HW Co-Simulation), Pipeline Function
