This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMDSCNCD28035ISO: Understanding Assembly Load versus Store Command

Part Number: TMDSCNCD28035ISO

Hi!

I currently have this Piccolo TMS320F28035 Isolated controlCARD.

Card:

http://www.ti.com/tool/TMDSCNCD28035ISO

Docking Station:

https://www.ti.com/tool/TMDSDOCK28035

Micro Inverter Baseboard:

http://www.ti.com/tool/TMDSSOLARUINVKIT

I am using the Solar Micro Inverter sample code located in ".../controlSUITE/development_kits/TMDSSOLARUINVKIT_v100/MicroInv_F2803x". 

I disassembled the executable from this project using dis2000 tool located in the CCS folder. I am now writing a script that goes through the assembly code and keeps track of all the arithmetic instructions, branches, loads, and stores.

I used:

http://www.ti.com/lit/ug/spru430f/spru430f.pdf

to help me understand the available instructions starting from page 116. 

The first two operations are pretty straightforward to collect. I am having trouble differentiating between stores and loads. I noticed that commands like "MOV" and "MOVL" can be utilized to either store or load. Is there a way to tell which way the command is being used for?

From page 155 of the manual is a sample code that confuses me:

MOV AL,@VarA ; Load AL with contents of VarA

ADD AL,@VarB ; Add to AL contents of VarB

ANDB AL,#0xFF ; AND contents of AL with 0x00FF

MOV @VarC,AL ; Store result in VarC

The  "MOV command is used as a load and a store.

I also see instructions like "MOVL XAR4, XAR6"           

I don't see how one is able to differentiate between them? Any suggestions would be appreciated! Thanks! 

  • In terms of the C28x instruction set there is no difference between load and store; both are simply treated as data moves. The difference is in the source and destination addresses.

    If you want to look for instructions which load and store registers, you will need to parse the disassembly for register names. CPU registers are in chapter 2.2 of the document you mentioned. 

    On C28x, the first operand after the instruction is the destination and the second is the source, so

    MOVx destination, source

    In general, you can say when a register name is the destination, it's a load. If not, and a register name is the source, it's a store. I think this covers all possibilities with MOVx.  BTW, PREAD is another instruction which could perform a load/store.

    Hope this helps.

    Regards,

    Richard

  • Thanks for the response Richard. 

    Just like you mentioned, I have been counting an instruction as a load if I see the register in the destination location and as a store if it's in the source location. 

    However, I am still unsure about cases when I get registers in both locations?

    MOVL XAR5, XAR4

     

    I have a few cases like above in my assembly code, and I'm curious if there's a way to differentiate these cases? 

  • I'm calling that a load since data goes into a register.  If you want to define a load as only when data comes from memory into a register, I suppose you could exclude the above case by checking that when the first operand is a register, the second is not.

    i.e. when a register name is the destination and the source is not a register name, it's a load. Otherwise, and a register name is the source, it's a store.  

    Then the above case is neither a load nor a store.  It depends how you are defining a load.

    Regards,

    Richard