Hi.
I have three questions regarding the TMS570LS31x devices, module N2HET.
First question:
Assume that the following N2HET instruction is part of an N2HET program.
... ; edge counter L02: ECNT { next = END, cond_addr = END, reqnum = 0, reg = none, request = GENREQ, event = FALL, pin = 0, data = 0 } ...
Assume that the following two actions should be executed in the SAME VCLK2-cycle:
*) This ECNT instruction should be executed by the N2HET time micromachine.
*) The CPU wants to do a write access to the Data Field of this ECNT instruction.
Since in spnu499b.pdf, page 773, is stated “N2HET accesses to its own internal RAM are given priority over accesses from an external host ...” it follows that the execution sequence is:
1. The micromachine executes the instruction. 2. The CPU does the write access.
Question 1: Is this correct?
Second and third question:
Assume that the following N2HET instructions are part of an N2HET program.
... ; count up Q09: CNT { next = END, reg = NONE, max = 0x1FFFFFF, data = 0} ; count down Q10: SUB { next = END, src1 = REM, src2 = IMM, dest = NONE, rdest = REM, remote = Q09, data = 0x1 } ...
The idea of this program: The Data Field of the CNT instruction is modified in two ways:
*) It’s incremented by the CNT instruction itself.
*) It’s decremented by the SUB instruction.
Assume that the following two actions should be executed in the SAME VCLK2-cycle:
*) The SUB instruction should be executed by the N2HET time micromachine.
*) The CPU wants to do a write access to the Data Field of the CNT instruction.
From spnu499b.pdf, page 841, Table 20-56, I get the information that the SUB instruction with this configuration needs 3 VCLK2-cycles (Since no line in this table matches the above configuration, I think that line 6 most likely matches.).
Since the SUB instruction needs 3 VCLK2-cycles, there are IMHO two possibilities how this situation will be handled by the TMS:
First possibility:
It’s not important how many cycles an N2HET instruction needs. I.e. an N2HET instruction is always atomically executed. In this case the execution sequence is:
1. The micromachine executes the complete SUB instruction (i.e. all 3 cycles). 2. The CPU does the write access.
Second possibility:
N2HET instructions are not atomically. In this case the following question arises: Which parts of the SUB instruction are done in which of the 3 cycles? I assume the following partition (referring to spnu499b.pdf, pages 842 to 844):
1st cycle: SOURCE OPERAND DECODING STAGE
2nd cycle: ARITHMETIC / LOGICAL OPERATION STAGE and SHIFT STAGE
3rd cycle: WRITE REGISTER DESTINATION STAGE, WRITE REMOTE DESTINATION STAGE, and UPDATE FLAGS STAGE
From this partition follows, that the SUB instruction is a read-modify-write access.
Assume that the 2nd cycle of the SUB instruction and the CPU write access are executed in
the SAME VCLK2-cycle. In this case the execution sequence is:
1. SUB instruction, 1st cycle: The value of the Data Field of the CNT instruction is read. Let’s call it OLD value. 2. SUB instruction, 2nd cycle: The OLD value is decremented. 3. The CPU does the write access: The Data Field of the CNT instruction will be updated with the NEW value. 4. SUB instruction, 3rd cycle: The Data Field of the CNT instruction will be updated with the decremented OLD value. I.e. the NEW value was overwritten.
Question 2: Is this correct?
In case it is correct: Question 3: Do you have a solution for this overwrite problem?
Thank you and regards
Oliver.