HLS getting started with hulusi

Source: Internet
Author: User
Tags vivado

HLS getting started with hulusi
HLS ProblemsEvaluate the exponent function exp (x)

Use exp (x) in HLS, that is, the exponential function. You cannot export RTL to EDK, that is, Pcore can only be exported to vivado ip. For more information, see the official forum.

Http://forums.xilinx.com/t5/High-Level-Synthesis-HLS/pow-function-in-Pcore-Export/td-p/470178

 

Work und can only be done via vivado: http://www.xilinx.com/support/documentation/sw_manuals/xilinx2013_2/ug994-vivado-ip-subsystems.pdf http://www.xilinx.com/support/documentation/sw_manuals/xilinx2013_2/ug902-vivado-high-level-synthesis.pdf

My solution is non-Inbound: I use VS2010 or matlab to calculate the exponential function result from 0 to 30000, and then save it to the file, then, access the expected exponential function compute results in HLS using the Table query method. This method requires you to predict the expected range in advance. This method simplifies the time from the computing point of view.

wxFillExpLut(float *lut, int size) {                       for (int i=0; i< size; i++)              {                      lut[i]=   expf( - (float) i / LUTPRECISION);                      //debug_lut[i] = lut[i];             }}

The size is the interval we need to calculate, And the LUT is a table.

Unsupported C Constructs (HLS can be integrated) UG902 page326

Although HLS supports most of the C language prototypes, some of them are still not supported. In general, the following requirements are required for integration:

To be synthesized:

• The C function must contain the entire functionality ofthe design. • None of the functionality can be saved med by system callto the operatingsystem.

The operating system cannot be called • The C constructs must be of a fixed or bounded size.

The construction of C must be fixed or bounded • The implementation of those constructs must be unambiguous

Must be a clear structure

The following operations are not supported:

You cannot call system functions in function implementation, such as printf, getc, time, and so on. You can use macro _ SYNTHESIS _ to process code that can be integrated and cannot be integrated. Included in the following procedures

Include sums sumsub_func (din_t * in1, din_t * in2, dint_t * outSum, dint_t * outSub) {* outSum = * in1 + * in2; * outSub = * in1-* in2 ;} int shift_func (dint_t * in1, dint_t * in2, dout_t * outA, dout_t * outB) {* outA = * in1> 1; * outB = * in2> 2 ;} void hier_func4 (din_t A, din_t B, dout_t * C, dout_t * D) {dint_t apb, amb; sumsub_func (& A, & B, & apb, & amb ); # ifndef _ SYNTHESIS _ // you can use a macro to process code that can be integrated or cannot be integrated, but it is It works !! FILE * fp1; // The following code is ignored for synthesis char filename [0, 255]; sprintf (filename, Out_apb _ % 03d. dat, apb); fp1 = fopen (filename, w); fprintf (fp1, % d \ n, apb); fclose (fp1); # endif shift_func (& apb, & amb, C, D );}

 

Dynamic MemoryUsage

Any system callsthat manage memory allocation within the system, for example, malloc (), alloc (), and free () are using resources that exist in the memory of the operating systemand are created and released during run time: to be able to synthesize ahardware implementation the design must be fully self-contained, specifying allrequired resources. memory allocation system CILS mustbe removed from the design code before synthesis. because dynamic memoryoperations are used to define the functionality of the design, they must betransformed into equivalent bounded representations. the following code exampleshows how a design using malloc () can be transformed into asynthesizableversion and highlights two useful coding style techniques:

HLS does not support dynamic memory allocation, that is, it does not support memory allocation only when the program is running. On the other hand, it only supports code that needs to be determined during program compilation.

. The design doesnot use the _ SYNTHESIS _ macro.

Theuser-defined macro NO_SYNTH is used to select between the synthesizable andnon-synthesizable versions. This ensures that the same code is simulated in Cand synthesized in Vivado HLS.

. The pointers inthe original design using malloc () do not need to be rewritten towork withfixed sized elements.

Fixed sizedresources can be created and the existing pointer can simply be made to pointto the fixed sized resource. This technique can prevent manual re-coding of theexisting design.

Transformingmalloc () to Fixed Resources (modify the method to replace the malloc function)

# Include malloc_removed.h # include <stdlib. h> // # define NO_SYNTHdout_t malloc_removed (din_t din [N], dsel_t width) {# ifdef NO_SYNTH // codes that cannot be integrated, including the malloc function long * out_accum = malloc (sizeof (long); int * array_local = malloc (64 * sizeof (int); # else long _ out_accum; long * out_accum = & _ out_accum; // the pointer must point to the variable int _ array_local [64]; // only the array int * array_local = & _ array_local [0]; # endif int I, j; LOOP_SHIFT: for (I = 0; I <N-1; I ++) {if (I <width) * (array_local + I) = din [I]; else * (array_local + I) = din [I]> 2;} * out_accum = 0; LOOP_ACCUM: for (j = 0; j <N-1; j ++) {* out_accum + = * (array_local + j);} return * out_accum ;}

 

Because thecoding changes here impact the functionality of the design, Xilinx does notrecommend using the _ SYNTHESIS _ macro. Xilinx recommends that you:

1. Add the user-defined macro NO_SYNTH to the code and modify thecode.

2. Enable macro NO_SYNTH, execute the C simulation and saves the results.

3. disable the macro NO_SYNTH (for example comment out, as in Example 50), execute the C simulation to verify that the results are identical. 4. perform synthesis with the user-defined macro disabled.

XILINX recommends using Conditional compilation to modify the code that can be integrated and cannot be integrated, making it easier to update programs.

 

As withrestrictions on dynamic memory usage in C, Vivado HLS does not support (forsynthesis) C ++ objects that are dynamically created or destroyed. This parameter desdynamic polymorphism and dynamic virtual function CILS.

Dynamic creation and destruction of classes in C ++ are not supported, and the following C ++ Code is included: Unsynthesizable Code Coding Example

Class A {public:virtual void bar() {…};};void fun(A* a) {       a->bar();}A* a = 0;if (base)       a = new A();else       a = new B();foo(a);

 

 

PointerLimitations (Pointer restriction) General Pointer Casting

Vivado HLS does not support general pointer casting, but supports pointer casting between native C types. For more information onpointer casting, see Example 3-36.

Pointer Arrays (Pointer array)

Vivado HLSsupports pointer arrays for synthesis, provided that each pointer points toa scalar or an array of scalars. Arrays of pointers cannot point toadditional pointers.

Pointer arrays are supported, but pointer arrays must point to an array with a fixed length or scalar. They cannot be used to point to another pointer.

Recursive Functions (Recursive function)

Recursive functions are not supported.

Standard TemplateLibraries (Standard template class)

Not supported (due to dynamic memory allocation)

 

 

 

Refer:

Http://shakithweblog.blogspot.com/2012/12/getting-sobel-filter-application.html

Http://www.zedboard.org/content/implementing-xapp1167-application-note-example-zedboard

Http://www.zedboard.org/content/accelerating-opencv-zynq-zedboard-xilinx-appnote-1167

Http://www.zedboard.org/node/830

Http://www.logicbricks.com/logicBRICKS/Reference-logicBRICKS-Design/Xylon-Reference-Designs-Navigation-Page.aspx

Https://www.google.com.hk/#newwindow=1&q=XAPP890&safe=strict

Https://www.google.com.hk/#newwindow=1&q=xapp1167++zedboard&safe=strict

VDMA driver: https://ez.analog.com/message/70323#70323

Ug871 is an open HLS tutorial provided by xilinx. 11 examples are provided: C ValidationInterface validation Precision TypesDesignAnalysisDesign OptimizationRTL VerificationUsing hls ip in IP addresses in a challenge Q Processor DesignUsing hls ip in System Generator forDSP ug871: http://www.xilinx.com/support/documentation/sw_manuals/xilinx2013_1/ug871-vivado-high-level-synthesi...

Reference Design source code: http://www.xilinx.com/cgi-bin/docs/rdoc?v=2013.2;t=vivado+tutorials Third, a video of 13 Xilinx experts, including the lecture and demonstration address: www.xilinx.com/training/vivado 1. getting Started withVivado High-Level monitoring your hybrid Vivado HLSIP for use from Vivado IP routing Vivado HLSblock for use in System Generator for DSP5.Generating Vivado HLSpcore for use in Xilinx Platform monitoring your VivadoHLS hybrid regression your Vivado HLS hybrid Vivado HLSC/C ++/SystemC block in System Hybrid Vivado HLSC/C ++/SystemC based pcores in XPS10.Floating-Point Designwith Vivado hybrid Vivado HLS SWlibraries in your C, C ++, SystemC code12.Using the Vivado HLSTcl interface13.Leveraging OpenCV and High LevelSynthesis with Vivado fourth, continuously updating martial arts cheats including javaseconessorcontrol of Vivado HLS Designs XAPP793 structured ures for Video Processing in the Vivado HLS Tool without Floating Point Design with Vivado HLS without Q challenge SoC Sobel Filter Implementation Using the Vivado HLS Tool XAPP1163-Floating-Point PID Controller Design with Vivado HLS and System Generatorfor DSP XAPP1167 Accelerating OpenCVApplications with challenge q using Vivado HLS Video Libraries


How can I learn about Huludao for beginners?

I. self-taught.
1. purchase a guide book on Huludao. With the teaching material, you can learn about hulusi, scale fingering, and practice methods. There will also be targeted exercises and a considerable number of hulusi songs. There are many teaching material versions. We recommend that you choose Li Chunhua's green teaching material "hulusi Bawu practical teaching material", which is currently the most commonly used one. This version is also used when I take students to practice.
2. Master the scale fingering method. That is to say, you will remember how to press your fingers and blow them for several days.
3. From the very beginning, we have developed the correct playing habits: body posture, hand shape, and mouth position.
4. Start basic breath training immediately: first, the bass should be replayed, And the treble should be gently blown. Second, start the changyin exercise. That is to say, take a deep breath and blow the sound. In the process, we should try our best to keep the sound stable, continue until the gas is used up, and then change the sound and then blow the long sound, this not only improves the pronunciation stability, but also helps you increase the vital volume quickly.
5. Start playing simple exercise songs. We do not recommend that you use Huludao as soon as you start.
6. Perform vibrato and manual exercises. It makes your fingers flexible and helps you deal with the fast board in the future.
7. Now, you can go to intermediate and advanced training. At this time, you can train various fingering skills: Playing, playing, uploading, stacking, Boeing, etc, higher-standard training breath requirements: strong and weak sounds, weak tail sound reception, residual gas release, Gas Shock sound, cyclic ventilation, etc.
2. If you want to learn more than just learning, but want to blow it up, we suggest you find a teacher.
Iii. Suggestions:
1. Whether you are a self-study or a teacher, you must choose a major for your first Huludao. Do not buy dozens of Yuan in scenic spots or plastic products. We recommend that you buy a gourd silk made of gourd and bamboo at a price between 200 and 300 yuan. Otherwise, it will affect your formation of a correct atmosphere.
2. Try to use as much time as possible. The learning process of Huludao should be well-known and should be more important. The exercise time is proportional to your technology.
The above suggestions are for your reference. Hope to help you.

[Beginner of hulusi] Confused, for fingering

There are two reasons for the popularity and popularity of Huludao:

1. It's really nice to hear about it.
2. It's too easy to get started.

The reason why hulusi is eager to learn is that the sound domain is narrow and the technique is simple. People who have a basic playing instrument can learn it in just a few days.

The narrow range of music is also a disadvantage of Huludao. It has limitations in playing. Generally, it can only play some of the Huludao's own music, but there are still a lot of Huludao's own music.
For example, what I like most: "The Phoenix in the moonlight", "the passionate Bamboo", "The Love Song of Bamboo", "the depth of Bamboo", "the night of the village", "the oath", "the Pastoral", etc.

You have learned these songs for years.

First, I want to buy a gourd silk tutorial. I want to buy a Li Chunhua version with a green cover and a price of 22 RMB.

First buy and practice, usually there will be a lot of changes in a year. If you want to continue, you can buy and make celebrity products better, probably between 500-800, it is made by hand and has a very elegant taste.

In the middle of the night, I answered the question very seriously. I am also a master of hulusi. If you don't understand it, please ask me. Come on, take it ~~~

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.