(hls backend with ram) clean code and add comments