OpenCores
no use no use 1/1 no use no use
Xilnx HLS for Huffman coding
by mankaijon on Aug 19, 2016
mankaijon
Posts: 7
Joined: Aug 11, 2016
Last seen: Nov 3, 2016
Hello all,
I am trying to use xilinx HlS tool to convert the C code to Verilog for Huffman coding for text file.
I can easily implement the algorithm in C, but have difficult to modify my code to satisfy the C requirement for HLS tools(like the dynamic memory allocation).

Can anyone have experience with HLS with Xilinx Vivado HLS can help me to finish this project?(paid)
you can also contact me via email: mankaijon@gmail.com
RE: Xilnx HLS for Huffman coding
by dgisselq on Aug 20, 2016
dgisselq
Posts: 247
Joined: Feb 20, 2015
Last seen: Oct 24, 2024
Do you have any more specifics you can share about your "project"?

Is this a school project? What school, class, professor?

Does it need to use the Xilinx HLS tool? How about an open source tool/core?

Does it use a particular board/chipset? Is there anything else going on within the hardware that this solution would need to compete with?

I noticed the RAR file you posted on Xilinx's forums. Can you offer the same file in a non-proprietary format?

Any other questions I failed to ask?

Dan

RE: Xilnx HLS for Huffman coding
by mankaijon on Aug 20, 2016
mankaijon
Posts: 7
Joined: Aug 11, 2016
Last seen: Nov 3, 2016
Hi Dan
Yes,it is the school project.
I have try some many way to modify my code, but it still didn't work.I am desperate.
No particular board, any I can send you more detail of the project. Can I get your email address?
Or you can contract me via mankaijon@gmail.com
Thank you
RE: Xilnx HLS for Huffman coding
by jdoin on Aug 21, 2016
jdoin
Posts: 51
Joined: Sep 1, 2009
Last seen: Sep 27, 2024
Hi Dan
Yes,it is the school project.
I have try some many way to modify my code, but it still didn't work.I am desperate.


Maybe you can describe the aspects in your C code that are triggering errors in the HLS compilation.
Remember, you must describe "static logic" in your C code. One obvious unfriendly example to hardware synthesis is dynamic memory allocation. That is really simple to fix: declare everything as static variables, i.e., pre-allocate all memory statically.

Another aspect that will not synthesize is pointer-based memory accesses with huge unbounded memory spaces. Try to constrain that using arrays with known size.

It would help you to learn Verilog/VHDL to grasp the concepts of signals and registers, and try to visualize the hardware structures in your C code.

- Jonny
RE: Xilnx HLS for Huffman coding
by mankaijon on Aug 22, 2016
mankaijon
Posts: 7
Joined: Aug 11, 2016
Last seen: Nov 3, 2016
Do you have any more specifics you can share about your "project"?

Is this a school project? What school, class, professor?

Does it need to use the Xilinx HLS tool? How about an open source tool/core?

Does it use a particular board/chipset? Is there anything else going on within the hardware that this solution would need to compete with?

I noticed the RAR file you posted on Xilinx's forums. Can you offer the same file in a non-proprietary format?

Any other questions I failed to ask?

Dan



Hi Dan
Yes,it is the school project.
I have try some many way to modify my code, but it still didn't work.I am desperate.
No particular board, any I can send you more detail of the project. Can I get your email address?
Or you can contract me via mankaijon@gmail.com
Thank you
RE: Xilnx HLS for Huffman coding
by mankaijon on Aug 22, 2016
mankaijon
Posts: 7
Joined: Aug 11, 2016
Last seen: Nov 3, 2016
Hi Dan
Yes,it is the school project.
I have try some many way to modify my code, but it still didn't work.I am desperate.


Maybe you can describe the aspects in your C code that are triggering errors in the HLS compilation.
Remember, you must describe "static logic" in your C code. One obvious unfriendly example to hardware synthesis is dynamic memory allocation. That is really simple to fix: declare everything as static variables, i.e., pre-allocate all memory statically.

Another aspect that will not synthesize is pointer-based memory accesses with huge unbounded memory spaces. Try to constrain that using arrays with known size.

It would help you to learn Verilog/VHDL to grasp the concepts of signals and registers, and try to visualize the hardware structures in your C code.

- Jonny


Hi Jonny,
Attachement is my C code. And the error I get

@E [SYNCHK-11] huff.c:17: Constant 'temp' has an unsynthesizable type '[13 x %struct.tnode.0.2.4]*' (possible cause(s): structure variable cannot be decomposed due to unsupported type conversion or memory copy operation).
@E [SYNCHK-11] huff.c:21: Constant 'ptemp' has an unsynthesizable type '[13 x %struct.tnode.0.2.4*]*' (possible cause(s): pointer to pointer or global pointer).
@E [SYNCHK-72] huff.c:24: unsupported c/c++ library function 'qsort'.
@E [SYNCHK-41] huff.c:38: unsupported pointer reinterpretation from type '%struct.tnode.0.2.4 = type { %struct.tnode.0.2.4*, %struct.t...' to type 'i8*' on variable 'ptemp'.
@E [SYNCHK-42] huff.c:47: pointer comparison is not supported.
@I [SYNCHK-10] 5 error(s), 0 warning(s).
@E [HLS-70] Synthesizability check failed.

Could you help me to fix these errors as an example for me? I understand what you talk about pointer-based memory accesses with huge unbounded memory spaces. I edited my original C code(with dynamic memory allocation)like what you suggest, and get this C code. And I still have no idea how to fix the errors.
Thank you.
RE: Xilnx HLS for Huffman coding
by dgisselq on Aug 22, 2016
dgisselq
Posts: 247
Joined: Feb 20, 2015
Last seen: Oct 24, 2024
I can repeat my questions if you would like.

Dan

RE: Xilnx HLS for Huffman coding
by mankaijon on Aug 22, 2016
mankaijon
Posts: 7
Joined: Aug 11, 2016
Last seen: Nov 3, 2016
Do you have any more specifics you can share about your "project"?

Is this a school project? What school, class, professor?

Does it need to use the Xilinx HLS tool? How about an open source tool/core?

Does it use a particular board/chipset? Is there anything else going on within the hardware that this solution would need to compete with?

I noticed the RAR file you posted on Xilinx's forums. Can you offer the same file in a non-proprietary format?

Any other questions I failed to ask?

Dan



This project was the school work for me last semester, It required me to did a research and present about Huffman coding algorithm and some hardware implement about it, like the ASIC design or FPGA implementation. But I have submitted all the report at the end of April. What I am doing now is nothing with the course. And the reason why I want to finish this project is to earn some experience about the automated High-Level Synthesis methodology.
As I said before, I am not a experienced C programmer, I spent this summer learning C programming by myself, and also want to try the HLS tool. I was stuck with the errors for about 2 weeks and asked for help online.

I think it better for me to provide more information about what I have done.
1. implement the huffman coding for a simple string with the pre-defined frequency of each character(C language)
2. implement the huffman coding for a large txt file.(calculate the actual frequency of each character inside the file)
3. modify the first C program for Vivado HLS tools(fail with errors)
(see the attachments, and the pdf file is the tutorial I get from Xilinx website )

And what I want is to finish:
1.use the HLS tool to get the verilog code from C.
2.simulated (using Verilator) the verilog with the same test cases as C.

Looking forward to your reply.

Thank you
RE: Xilnx HLS for Huffman coding
by dgisselq on Aug 22, 2016
dgisselq
Posts: 247
Joined: Feb 20, 2015
Last seen: Oct 24, 2024
Okay, we're getting closer here. But, you need to understand, .rar files are (to my knowledge) a proprietary format. As such, I have no means of pulling the files out of your archive. Can you post your files in a non-proprietary format? .tar.gz is a well-known favorite ...

Dan

RE: Xilnx HLS for Huffman coding
by dgisselq on Aug 22, 2016
dgisselq
Posts: 247
Joined: Feb 20, 2015
Last seen: Oct 24, 2024
Oh, yeah, one other question: you mention that you are getting "desparate". What is your timeline?

Dan

RE: Xilnx HLS for Huffman coding
by mankaijon on Aug 22, 2016
mankaijon
Posts: 7
Joined: Aug 11, 2016
Last seen: Nov 3, 2016
Oh, yeah, one other question: you mention that you are getting "desparate". What is your timeline?

Dan



maybe this Friday or next Monday.
RE: Xilnx HLS for Huffman coding
by mankaijon on Aug 22, 2016
mankaijon
Posts: 7
Joined: Aug 11, 2016
Last seen: Nov 3, 2016
Okay, we're getting closer here. But, you need to understand, .rar files are (to my knowledge) a proprietary format. As such, I have no means of pulling the files out of your archive. Can you post your files in a non-proprietary format? .tar.gz is a well-known favorite ...

Dan



The .tar.gz file
Huffman.tar.gz (219 kb)


RE: Xilnx HLS for Huffman coding
by aikijw on Aug 22, 2016
aikijw
Posts: 76
Joined: Oct 21, 2011
Last seen: Jul 8, 2023
(shaking my head) No comment... Good luck, Dan...
RE: Xilnx HLS for Huffman coding
by jdoin on Aug 23, 2016
jdoin
Posts: 51
Joined: Sep 1, 2009
Last seen: Sep 27, 2024
Hello mankaijon,

Look at the nature of the errors you are getting.
You are trying to compile an unmodified C program into hardware. This will, at the very least, be very inefficient and result in large hardware structures.
Some points in your code (jdging from the error messages, I haven't looked into your source code):
- You are trying to synthesize library calls (qsort). You have to provide an algorithm for the library call;
- Pointer comparison. Try to visualize what a "pointer" is in hardware. It may just be synthesized as a local register block with register select / data bus. Comparing "pointers" only make sense if they can be reduced exactly to the same semantics. Try to translate the pointers into array subscripts, for an array of fixed types.
- Pointer to pointers. This also may need to be translated into a specific, static array of type.
- Pointer type translation. Passing "void" pointers and re-casting is not the best thing to do. Try to pass pointer-to-type instead. Also, do not translate pointers to different types along the algorithm.

Remember you are describing hardware. Try to see the structures you will end up creating.

- Jonny
RE: Xilnx HLS for Huffman coding
by bhagesh on Jul 7, 2017
bhagesh
Posts: 1
Joined: Oct 8, 2013
Last seen: Jul 7, 2017
Hello,

I think you problem would have been solved by now. If not you can ask me.

Thanks,
Regards
Bhagesh
bhagesh_choudhary@yahoo.com
no use no use 1/1 no use no use
© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.