Can a datapath ALU result be stored in D0?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
ChRe_4711096
Level 4
Level 4
50 replies posted 25 replies posted 25 sign-ins

I'd like to implement the following calculation with a datapath:

t = (t0+t1)/2 * n, where n is set during runtime - it's not a constant that I could build into the state machine.

The first step is pretty simple and - as I understand it - can be done in one instruction:

preconditions: A0 = t0, A1 = t1, D1 = n

A0 = (A0+A1) >> 1 | 0

Now I can load n from D1, and need to get A0 into D0 so I can create a multiplication loop:

A1 = n

while A1 > 0:

  A0 = A0+D0

  A1--

How can I store A0 in D0? Or is there another way to do this calculation?

Edit: There are datapath inputs to load F0 with A0, and D0 with F0. is it possible to use these, wrapped in one state machine state that is executed twice? Maybe in single buffer mode?

0 Likes
6 Replies
RodolfoGL
Employee
Employee
250 solutions authored 250 sign-ins 5 comments on KBA

Yes, you can. There is an input signal called d0_load. It loads A0 to D0.

0 Likes

I can't find it, neither in the datasheet nor in the datapath input confguration dialog. It only shows these:

Anmerkung 2020-08-13 075311.png

0 Likes
lock attach
Attachments are accessible only for community members.

I managed to copy ALUout to F0 at the end of the first calculation step (which is probably as fast and easy as it gets), but copying to D0 doesn't want to show the desired result. Current state of the experiment is attached.

0 Likes

It might be easier to have the UDB trigger a DMA transfer from A0 to D0 and wait for that to finish before resuming the calculation, but that would introduce additional delay and uncertainty.

0 Likes

I'm sorry, actually the d0_load signal loads F0 to D0, which means you would need to load the ALU to F0 first, then F0 to D0. Using DMAs will take way longer.

0 Likes
lock attach
Attachments are accessible only for community members.

Do you have an example of that? I guess the FIFO would need to be in single buffer mode (no problem in my application), but A0 -> F0 and F0 -> D0 have reversed FIFO direction. If that matters at all in single buffer mode, I don't know.

In the meantime I got it to work with DMA, as attached. So if we can replace the DMA transfer with something more straight forward, that'd be great.

0 Likes