6 Replies Latest reply on Aug 13, 2020 11:21 PM by ChRe_4711096

    Can a datapath ALU result be stored in D0?


      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



      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?