cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Participant
Participant
9,904 Views
Registered: ‎07-28-2015

Latch function outputs after valid

Jump to solution

I've got a function that returns multiple outputs (12 outputs, but I've shown three below as example):

 

void function(int24 din, int32 *dout_A, int32 *dout_B, int32 *dout_C)

This synthesizes to the following VHDL port map:

...
    dout_A : OUT STD_LOGIC_VECTOR (31 downto 0);
    dout_A_ap_vld : OUT STD_LOGIC;
    dout_B : OUT STD_LOGIC_VECTOR (31 downto 0);
    dout_B_ap_vld : OUT STD_LOGIC;
    dout_C : OUT STD_LOGIC_VECTOR (31 downto 0);
    dout_C_ap_vld : OUT STD_LOGIC;
...

With many outputs, the number of valid signals to manage gets cumbersome.  Also I notice that dout_A is only valid when dout_A_ap_vld is high, but immediately after that the dout_A value can change to something meaningless.  So I must be very careful to latch exactly when the valid goes high, not a few clocks later.

 

The following would make my life much easier.  Possible with HLS using directives or otherwise?

 

  1.  Have dout_* signal maintain the previously valid value until a new valid value is ready.   Effectively adds another latch stage for each output, but I'd like to avoid writing a VHDL wrapper for for all my HLS functions to do this.
  2.  Have multiple outputs share an *_ap_vld valid signal.  Can HLS be directed to use a single shared valid signal for dout_A,B,C which does not assert until all three are valid?

 

For #2, I could do this by concatenating the three int32 outputs to a single int96 port - this would require a single valid signal, but also a bit cumbersome to deal with combining on C-side and splitting on VHDL side.  I thought perhaps joining the three outputs into a struct would accomplish this:  struct result {dout_A, dout_B, dout_C}.  But HLS treats these no differently, creating three independent outputs with three valid signals.

 

Thoughts?

 

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Teacher
Teacher
18,543 Views
Registered: ‎03-31-2012

Re: Latch function outputs after valid

Jump to solution
for 1) you can try register option with ap_vld and see if it does what you need.
- Please mark the Answer as "Accept as solution" if information provided is helpful.
Give Kudos to a post which you think is helpful and reply oriented.

View solution in original post

0 Kudos
9 Replies
Highlighted
Participant
Participant
9,903 Views
Registered: ‎07-28-2015

Re: Latch function outputs after valid

Jump to solution
#3 question, similar idea -- is there a way to use the "ap_done" signal to indicate that all outputs are valid?
0 Kudos
Highlighted
Teacher
Teacher
18,544 Views
Registered: ‎03-31-2012

Re: Latch function outputs after valid

Jump to solution
for 1) you can try register option with ap_vld and see if it does what you need.
- Please mark the Answer as "Accept as solution" if information provided is helpful.
Give Kudos to a post which you think is helpful and reply oriented.

View solution in original post

0 Kudos
Highlighted
Participant
Participant
9,861 Views
Registered: ‎07-28-2015

Re: Latch function outputs after valid

Jump to solution

Looks like that will probably work:

 

set_directive_interface -mode ap_vld -register foo OutData
#pragma HLS interface ap_vld register port=OutData

 

0 Kudos
Observer
Observer
2,872 Views
Registered: ‎10-25-2014

Re: Let multiple outputs share one *_ap_vld valid signal

Jump to solution

  1. ...
  2. Have multiple outputs share an *_ap_vld valid signal.  Can HLS be directed to use a single shared valid signal for dout_A,B,C which does not assert until all three are valid?

I know it's a rather old thread, however, I would like two know if there is a solution for the original question number 2?

0 Kudos
Highlighted
Observer
Observer
2,809 Views
Registered: ‎10-25-2014

Re: Let multiple outputs share one *_ap_vld valid signal

Jump to solution

Bump

Still need an answer to the question if multiple output vectors can share one valid signal (without DATA_PACK).

0 Kudos
Highlighted
Observer
Observer
2,713 Views
Registered: ‎10-25-2014

Re: Let multiple outputs share one *_ap_vld valid signal

Jump to solution

Bump

0 Kudos
Highlighted
Adventurer
Adventurer
2,693 Views
Registered: ‎01-14-2008

Re: Let multiple outputs share one *_ap_vld valid signal

Jump to solution

I would welcome an answer to this question, too.

Seems a useful feature.

0 Kudos
Highlighted
Observer
Observer
2,538 Views
Registered: ‎10-25-2014

Re: Let multiple outputs share one *_ap_vld valid signal

Jump to solution

Bump

0 Kudos
Highlighted
Observer
Observer
2,403 Views
Registered: ‎10-25-2014

Re: Let multiple outputs share one *_ap_vld valid signal

Jump to solution

Bump

0 Kudos