1 Reply Latest reply on Sep 13, 2017 3:28 AM by geon

    DFB Compactifier problem


      Here's a simple DFB assembler content I try to compile with the Compactifier (a.k.a. "Optimize Assembler States) turned on:






          acu(clear, clear) dmux(sa, sa) alu(set0) mac(hold)

          acu(unsetmod, unsetmod) dmux(sa, sa) alu(hold) mac(clra) jmp(eob, csb_check_sdr_channel)




          acu(hold, hold) dmux(sa, sa) alu(hold) mac(hold) jmp(eob, csb_xx)




          acu(hold, hold) dmux(sa, sa) alu(hold) mac(hold) jmp(in2, csa_process_sdr_data)




          acu(hold, hold) dmux(sa, sa) alu(hold) mac(hold) jmp(eob, csa_initial)




      But the assembler fails with the following message:



      *** DFB Assembly Compactor v1.2


      *** Contents of CyRam A

      00 | CyRam:A [00, 01] State: "csa_initial" Source Instruction: [00, 01]

      01 | CyRam:A [02, 02] State: "csb_xx" Source Instruction: [04, 04]

      *** Contents of CyRam B

      00 | CyRam:B [00, 00] State: "csb_check_sdr_channel" Source Instruction: [03, 03]

      01 | CyRam:B [01, 01] State: "csb_xx" Source Instruction: [04, 04]


      *** CFSM content description

      *** Note: Execution starts at ram:A0 state:0

      *** Branch bits in order are:

      *** g2 g1 acubeq acuaeq dpeq dpthres dpsign eob

      State            | Jump if true        | Jump if false        | Branch

      csa_initial       | csb_check_sdr_channel Ram:B 00    |                 |

      csa_process_sdr_data    | csb_xx         Ram:A 02    |                 |

      csb_check_sdr_channel    | csa_process_sdr_data Ram:A -01    |                 |

      10: error: Jump from state "csb_check_sdr_channel" to state "csa_process_sdr_data" cannot be mapped.

      csb_xx            | csa_initial    Ram:B -01    |                 |

      14: error: Jump from state "csb_xx" to state "csa_initial" cannot be mapped.


      *** ERROR: Unable to map to split RAMs.

      *** Found 2 states that cannot be mapped.

      *** Analyze results and verify code can be mapped.

      error: Optimization failed.



      The code above is meant to follow Mr. Keeser's rule (stated here: http://www.cypress.com/forum/psoc-community-components/dfb-assembler-and-significantly-improved-simulator-component in Memo_DFB_CodeOptimizer.pdf) exactly:


      "It is this basic rule that we have to understand when we want to get access to all 128 instructions.

      All false conditions must stay in the same instruction memory.

      All true conditions must switch to the other instruction memory."


      So, csa_initial is in CSRAMA (by definition): OK. Then it jumps via true condition to csb_check_sdr_channel, which switches the CSRAM and thus should be placed in CSRAMB -- OK. Then it (conditionally) jumps to csa_process_sdr_data, switching CSRAM again, so csa_process_sdr_data should go to CSRAMA, and it goes. Then the intention is to make a cycle to csa_initial (in CSRAMA), which is not directly possible, because the jump would cause a CSRAM clash and violate the Kees' rule. Hence the csb_xx intermediate state, intended to switch from CSRAMA to CSRAMB and then get back to CSRAMA, finishing the cycle. But the tool puts csb_xx into both RAMs and then fails:


      01 | CyRam:A [02, 02] State: "csb_xx" Source Instruction: [04, 04]


      Why is that?

        • 1. Re: DFB Compactifier problem

          DFB program cannot perform a jump within the same control store. In a normal situation, jumps between program states go from one control store to another. Jump within the same control store causes an error at assembly. To resolve this issue, you can place additional dummy state into your program at the cost of a single dummy state and a single instruction. Instead of jumping directly to csa_process_sdr_data, you can bypass via dummy1. The assembly instructions would look like:



          acu(hold,hold) dmux(sa,sa) alu(hold) mac(hold) jmp(eob, csa_process_sdr_data)


          You can go through section DFB Compactor of DFB Assembler datasheet for further details.