Four questions about xls rtl generation

17 views
Skip to first unread message

ray ic

unread,
Apr 5, 2024, 4:02:02 AM4/5/24
to xls...@googlegroups.com
Hi,
I am trying several examples for xlarrSeems xls is excellent. Now I have 3 questions:
1. how to rewrite the c++ types, such as the type of "arr", arr is the pointer to array.
int *arr , int p, int beg[300]...
L=beg[p]
p=arr[L]

And another is "short Anum[]", here Anum is the matrix, each element in it is short type ,I want to use std::vector<short> Anum which I find the similar form in xls example directory this can not work. 
2. how to use standard c/c++ include library, such as math lib, vector lib...;
3.  I try the unroll functiin with pipeline 5, actually the operation is done is one clock cycle, and in later 4 clock cycles the output is just pipelined. support retiming function so that some logics  can be splitted from the first clock cycle to the later 4 clock cycles.
4. in c model, there is only one return which means only one output(ooutputs ) can be realized in rtl code. But rtl design is multi-inputs-multi-outputs architecture. So how to write the c model for more outputs with different functions. 
Sorry for I am still newbie for hls.
Any feedback is appreciated!
Thanks!

Leary, Chris

unread,
Apr 5, 2024, 2:19:04 PM4/5/24
to ray ic, xls...@googlegroups.com
Hi, these are all pretty XLS[cc] specific (the C++ frontend) which is not what I work on, but just to try to give some high level answers that might help point you in the right direction.

On Fri, Apr 5, 2024 at 1:02 AM ray ic <icra...@gmail.com> wrote:
Hi,
I am trying several examples for xlarrSeems xls is excellent. Now I have 3 questions:
1. how to rewrite the c++ types, such as the type of "arr", arr is the pointer to array.
int *arr , int p, int beg[300]...
L=beg[p]
p=arr[L]

In general if you have the array available in your scope and you pass around an index into the array instead of a pointer to the interior of the array, then you can access the index being referred to on demand. Pointers can alias (point at) multiple objects in non-trivial ways, which is non-ideal for dataflow analysis and optimization, which I believe is part of why XLS[cc] avoids them. By indexing into an array, where the array is explicitly known/named, you avoid aliasing multiple entities together.
 

And another is "short Anum[]", here Anum is the matrix, each element in it is short type ,I want to use std::vector<short> Anum which I find the similar form in xls example directory this can not work. 
2. how to use standard c/c++ include library, such as math lib, vector lib...;

You cannot use standard libraries like this out of the box -- consider that things like vector have calls to things like malloc/realloc in their implementation. There's no such thing in hardware. Part of good dataflow hardware construction is building things well with fixed space requirements instead of having a giant heap memory space like we do on standard CPUs. XLS[cc] has the synth_only headers that give some subset of stdlib-like functionality: https://github.com/google/xls/tree/main/xls/contrib/xlscc/synth_only
 
3.  I try the unroll functiin with pipeline 5, actually the operation is done is one clock cycle, and in later 4 clock cycles the output is just pipelined. support retiming function so that some logics  can be splitted from the first clock cycle to the later 4 clock cycles.

The XLS scheduler tries to balance slack in the pipe stages while minimizing the number of pipe stages. If it puts it all in one pipe stage it's because it believes, based on the delay model, that everything fits in a single pipe stage. You might consider characterizing a delay model for the platform you're targeting. You can also specify clock margining ( https://google.github.io/xls/scheduling/#step-1-determine-the-effective-clock-period ) or just change your target frequency to a higher target, leaving fewer picoseconds available per stage.
 
4. in c model, there is only one return which means only one output(ooutputs ) can be realized in rtl code. But rtl design is multi-inputs-multi-outputs architecture. So how to write the c model for more outputs with different functions. 

I think similar to a proc in DSLX you can have multiple channels in XLS[cc], e.g. this example: https://github.com/google/xls/blob/main/xls/contrib/xlscc/examples/simple_pipelined_loop.cc#L15
 
Sorry for I am still newbie for hls.
Any feedback is appreciated!
Thanks!

--
You received this message because you are subscribed to the Google Groups "xls-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xls-dev+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/xls-dev/CAOpLr9x5vF34cuw05-86E4Orqf%2BfxVQNHN0QuXQ_TW7RD1pMDw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

ray ic

unread,
Apr 6, 2024, 4:02:49 AM4/6/24
to xls...@googlegroups.com
Leary,
Thanks a lot!
Another thing is:
I try to use xlscc to compile the simple_pipelined_loop.cc (c++ code) below and it crashed.  I do not know what happened. Need to dig more.



------------------------------
To unsubscribe from this group and stop receiving emails from it, send an email to xls-dev+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages