Subject: [rohc] Problem with COPY-OFFSET Torture Test

From: chitrak gupta <[email-masked]>
Date: Wed, 8 Dec 2004 15:24:13 +0530

Dear All,

I am implementing the UDVM. I am nearing finish but I am stuck at one
particular instruction, which is COPY-OFFSET. The COPY-OFFSET as I
understood I implemented but I am not getting the desired result from
the torture test. I am attaching below the group of instructions in
the torture test followed by the Memory dump after executing my UDVM.
 
------------------------------------------------------------------------------------------------------------------------
 
3.7.  COPY-LITERAL and COPY-OFFSET 
    
   This section gives assembly code to test the COPY-LITERAL and COPY-
   OFFSET instructions. The code is designed to test similar boundary 
   cases to the code for the COPY instruction, as well as the following 
   condition specific to COPY-LITERAL and COPY-OFFSET: 
    
   1. The COPY-LITERAL or COPY-OFFSET instruction overwrites the value 
   of its destination or offset operand. 
    
   at (64) 
    
   :byte_copy_left                  pad (2) 
   :byte_copy_right                 pad (2) 
   :destination                     pad (2) 
   :offset                          pad (2) 
    
   at (128) 
    
   LOAD (32, 16384) 
   LOAD (byte_copy_left, 64) 
   LOAD (byte_copy_right, 128) 
   LOAD (destination, 33) 

UDVM MEMORY DUMP (Start + 32)
0x0043FD70 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 

0x0043FD80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 

0x0043FD90 00 40 00 80 00 21 00 00 00 00 00 00 00 00 00 00 

0x0043FDA0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 

   COPY-LITERAL (32, 128, $destination) 
   COPY-LITERAL (68, 8, $destination) 

>> MEMORY DUMP (Start + 32)

0x0043FD70 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 

0x0043FD80 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 

0x0043FD90 40 40 40 40 00 69 40 40 40 40 40 40 40 40 40 40 

0x0043FDA0 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 

0x0043FDB0 40 00 61 40 40 40 40 40 40 40 40 40 40 40 40 40 

0x0043FDC0 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 

   LOAD (byte_copy_left, 66) 
   LOAD (byte_copy_right, 74) 

>> Memory Dump (Start + 32)
0x0043FD70 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 

0x0043FD80 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 

0x0043FD90 00 42 00 4a 00 69 40 40 40 40 40 40 40 40 40 40 

0x0043FDA0 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 

0x0043FDB0 40 00 61 40 40 40 40 40 40 40 40 40 40 40 40 40 

0x0043FDC0 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 

   COPY-OFFSET (8, 6, $destination) 

>>UDVM Memory Dump: (Start + 32)

0x0043FD70 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 

0x0043FD80 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 

0x0043FD90 00 42 00 4a 00 6f 40 40 40 40 40 40 40 40 40 40 

0x0043FDA0 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 

0x0043FDB0 40 00 61 40 40 40 40 40 40 00 61 40 40 40 40 40 

0x0043FDC0 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 

   LOAD ($offset, 1) 
    
   COPY-OFFSET ($offset, 5 ,$destination) 

>>UDVM Memory Dump: (Start + 32)

0x0043FD70 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 

0x0043FD80 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 

0x0043FD90 00 42 00 4a 00 74 40 40 40 40 40 40 40 40 40 40 

0x0043FDA0 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 

0x0043FDB0 40 00 61 40 40 40 40 40 40 00 61 40 40 40 40 40 

0x0043FDC0 40 40 00 4a 40 40 40 40 40 40 40 40 40 40 40 40 

   OUTPUT (32, 48) 
    
   END-MESSAGE (0, 0, 0, 0, 0, 0, 0) 
    
   The expected output of the code is 32 instances of 0x40 followed by 
   0x0042 004a 0074 4040 4040 004a 0074 4040. The expected cost of 
   executing the code is 208 UDVM cycles. 

__________________________________________________________________________________________________________________________
 
I have marked the mismatched location in red. 
I want to know the following,
 
i)  at which step I am going wrong
ii) if it is at COPY_OFFSET can you please explain the steps I should
follow in COPY-OFFSET.
I am using the following algorithm for COPY-OFFSET:
 
-----------------------------------------------------------------------------------------------------------------------
STEP 1) Get the value offset, length and destination. 
 
STEP 2) Read the bytecopy registers and get the values of bytecopyleft
and bytecopyright.
 
STEP 3) Get the position (source) value by the following code;
 
while(offset>0)
{
    if(position==bytecopyleft)
        position = (bytecopyright -1)% 0xffff;
    else
        position --;
    offset--;
}
 
STEP 4) Copy the content of position to destination byte by byte and
increment the addresses following the byte copy rule of Section 8.4 of
RFC 3320.
 
bdestination = destination // save the value of destination.
for(i = 0; i<length;i++)
{
    UDVMMEMORY[destination] = UDVMMEMORY[position];
    position = respectboundaryandincrement(position);
    destination = respectboundaryandincrement(destination);
}
bdestination +=length;   //to reflect the destination address for the
next copy instruction
 
STEP 5: Save bdestination into the destination operand. 
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 
Please help!!!

Sincerely,
Chitrak Gupta.

_______________________________________________
Rohc mailing list
[email-masked]
https://www1.ietf.org/mailman/listinfo/rohc