/shls_coding_assistant:shls_assistantfrom shls_coding_assistant
Creates and optimizes Microchip SmartHLS projects using HLS C++ pragmas for area, latency, and performance, including migration from other HLS tools.
Ships in shls_coding_assistant. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
shls -a cosim, shls -a rtl_synth, or shls -a fpga. Check these reports for simulation results, timing, and resource utilizationshls -h to list all available SmartHLS commands and their descriptions
-If you are Unsure about an implementation, a command, or any question regarding SmartHLS, ask the SmartHLS info tool.<project_name>, then create the cpp file inside this directory and follow the WORKFLOWwork and in this work directory create the cpp implementation"shls init" again from the terminal.Initialize:
shls init - To create the Makefile and config.tcl files after the .cpp files are created
Run cosimulation:
shls -a cosim pipe the output to a file called shls-cosim-output.log.
If you get cosim errors, ask the SmartHLS info tool regarding the error, then rerun cosim until it passes.
Run RTL synthesis:
shls -a rtl_synth - run rtl_synth only when cosim passes.
Create an md file containing a summary of what you have done within the directory
note: for any other commands, run shls -h
USER_CXX_FLAG+=-I$(SHLS_LIB_PATH)
If you want to include libraries like math, the format is as below:
#include "math/include/hls_sin.hpp"
#include "math/include/hls_cos.hpp"
#include "math/include/hls_sqrt.hpp"
fpga-hls-libraries/math/examples/ for usage patterns if you end up using math libraryfpga-hls-libraries/math/include/ for available headers before assuming// Arbitrary-precision integers
// ap_int<W> - signed integers of width W
// ap_uint<W> - unsigned integers of width W
// Bit manipulation, range selection, concatenation
#include <hls/ap_int.hpp>
// Fixed-point arithmetic
// ap_fixpt<W,I_W> - signed fixed-point
// ap_ufixpt<W,I_W> - unsigned fixed-point
// Configurable quantization and overflow modes
#include <hls/ap_fixpt.hpp>
// FIFO/streaming interfaces
// hls::FIFO<T> template class
// Blocking reads/writes, depth control
// Maps to AXI-stream interfaces
#include <hls/streaming.hpp>
// Parallel hardware threads
// hls::thread<T> for dataflow parallelism
// hls::mutex, hls::barrier for synchronization
#include <hls/thread.hpp>
// Memory allocation (SoC flows)
// hls_malloc, hls_free, hls_memcpy for DMA transfers
#include <hls/hls_alloc.h>
Always use the SmartHLS C++ namespace hls, for example:
using namespace hls; // For ap_fixpt, ap_ufixpt
using namespace hls::math; // For sin_taylor, cos_taylor, etc.
using namespace hls::vision; // For hls::vision library functions, etc.
hls::ap_uint<5> x; // declare a variable precision integer
#pragma HLS function top ONLY for functions you want to expose as separate hardware modules. Do NOT use this pragma on helper functions that pass arrays between each other, as memory partitioning will cause synthesis failures#pragma HLS function pipeline on top-level functions that return structsset_synthesis_top_module <module_name>_top)set_synthesis_top_module with the _top_top suffix when specifying synthesis targetLoop pipelining functions are supposed to be placed just right before the loop starts:
label:<UniqueLoopLabelName>
#pragma HLS loop pipeline II(1)
for (int i = 0; i < N; i++) {
// loop body
}
Always check the actual function signatures in the library headers (make sure to check the template parameter types and the number of arguments). Examples:
sincos template: sincos<N_ITERATIONS>(angle, sin_ref, cos_ref)atan_cordic template: atan_cordic<W_OUT, IW_OUT, N_ITERATIONS>(fixpt_input)sqrt template: sqrt<W, IW, N_ITERATIONS>(ufixpt_input)atan_cordic ONLY accepts signed fixpt, NOT ufixptFor uint (ap_uint) conversion functions, the following options are available:
.to_uint64(): Converts to a 64-bit unsigned integerunsigned long long A = ap_int<16>(-32768).to_uint64();.to_ufixpt<I_W>(): Converts to an unsigned fixed-point type
.to_fixpt<I_W>(): Converts to a signed fixed-point type
Interprets the same bits as the original ap_uint
Allows specifying the integer width (I_W)
Example:
// Interpret 8-bit uint as 8-bit ufixpt with 4 bits above decimal
ap_ufixpt<8, 4> C = ap_uint<8>(248).to_ufixpt<4>();
raw_bits(): Returns a uint with the same width, preserving raw data
to_double(): Converts to a double representation (can lose precision)
ap_ufixpt to ap_fixpt: fixpt_t(ufixpt_value.to_double())
ap_fixpt to ap_ufixpt: ufixpt_t(fixpt_value.to_double())
sqrt requires ufixpt input, must convert squared values:
ufixpt_t x_sq = ufixpt_t((cart.x * cart.x).to_double());
.to_double() conversionsresult = (x < 0) ? -x : x;result = (x < 0) ? fixpt_t((-x).to_double()) : x;sqrt requires unsigned input (ap_ufixpt) but may need conversion back to signed.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub microchiptech/fpga-hls-examples --plugin shls_coding_assistantOther plugins' skills for the same job