URL
https://opencores.org/ocsvn/lxp32/lxp32/trunk
Subversion Repositories lxp32
[/] [lxp32/] [trunk/] [verify/] [lxp32/] [src/] [firmware/] [test011.asm] - Rev 12
Go to most recent revision | Compare with Previous | Blame | View Log
/*
* Coroutine switching test
*
* There are two coroutines in this test. The main coroutine calculates
* CRC32 of the 1024-byte data block. The secondary coroutine simulates
* a linear-feedback shift register (LFSR) with a polynom 1+x^6+x^7.
* It is invoked by the timer interrupt.
*/
lc r100, 0x10000000 // test result output pointer
lc r101, halt
lc r102, failure
lc r103, 0x20000000 // timer: number of pulses (0xFFFFFFFF - infinite)
lc r104, 0x20000004 // timer: delay between pulses (in cycles)
// Set up secondary routine (invoked by timer)
mov r200, 127 // initial value
lc r201, 250 // counter (number of LFSR iterations)
mov r204, 0 // result
lc r210, 0x10000008 // secondary routine output pointer
lc iv0, timer_handler
mov cr, 1 // enable interrupt 0
sw r104, 100
lc r0, 0xFFFFFFFF
sw r103, r0 // activate timer, unlimited pulses
// Main routine
lc r16, 0x10000004 // output pointer
lc r17, 0xFFFFFFFF // initial CRC value
lc r18, 0xEDB88320 // polynom
lc r19, data // input pointer
lc r20, 256 // data block size in words
lc r32, word_loop
lc r33, bit_loop
lc r34, dont_xor
mov r64, 0 // word counter
word_loop:
lw r0, r19
mov r65, 0 // bit counter
bit_loop:
and r1, r0, 1
and r2, r17, 1
sru r17, r17, 1
xor r3, r1, r2
cjmpe r34, r3, 0 // dont_xor
xor r17, r17, r18
dont_xor:
sru r0, r0, 1
add r65, r65, 1
cjmpul r33, r65, 32 // bit_loop
sw r16, r17
add r19, r19, 4
add r64, r64, 1
cjmpul r32, r64, r20 // word_loop
not r17, r17
sw r16, r17
// Check main routine result
lc r0, 0x501860E6
cjmpne r102, r0, r17
// Wait until secondary routine finishes its job
lc r0, wait_secondary
wait_secondary:
cjmpe r0, r204, 0
// Check secondary routine result
cjmpne r102, r204, 0x57
sw r103, 0 // deactivate timer
sw r100, 1
jmp r101
failure:
sw r100, 2
halt:
hlt
jmp r101
timer_handler:
sru r202, r200, 5
sru r203, r200, 6
xor r202, r202, r203
and r202, r202, 1
sl r200, r200, 1
or r200, r200, r202
and r200, r200, 0x7f
sub r201, r201, 1
cjmpug irp, r201, 0 // exit interrupt handler if r201>0
mov r204, r200
sw r210, r204
mov cr, 0 // disable further interrupts
iret
.align
data:
.byte 0x00, 0x90, 0x31, 0xCF, 0x95, 0x7A, 0x59, 0xE5, 0xD2, 0xBF, 0x2C, 0xDB, 0xB5, 0x83, 0x4D, 0x03
.byte 0x17, 0x5D, 0x25, 0x2A, 0xFD, 0x72, 0x1E, 0x01, 0x02, 0x60, 0x88, 0x92, 0x9A, 0x9B, 0x2A, 0xA9
.byte 0x73, 0x5A, 0x0E, 0x9B, 0xC8, 0xCD, 0x85, 0x4D, 0xE0, 0xBA, 0xF4, 0xEC, 0x8A, 0x24, 0x76, 0x3C
.byte 0xDC, 0x35, 0xC7, 0xD7, 0xFF, 0xFF, 0x9C, 0x64, 0x44, 0x4C, 0xD7, 0x06, 0x60, 0x17, 0xAD, 0x0E
.byte 0x02, 0xEB, 0x46, 0x45, 0x96, 0xB0, 0xD6, 0xB9, 0x7C, 0x34, 0xBE, 0x77, 0x75, 0xF2, 0xBE, 0x1B
.byte 0x99, 0x62, 0xBC, 0x9B, 0x92, 0x5C, 0x26, 0x39, 0x6C, 0xCD, 0x84, 0xFD, 0xC0, 0x58, 0x2B, 0xA8
.byte 0x7D, 0x10, 0xB3, 0x81, 0x25, 0xF3, 0x24, 0xE7, 0xB1, 0x4D, 0x6D, 0x12, 0xF7, 0xAE, 0x27, 0xE0
.byte 0xD2, 0x95, 0x30, 0x2D, 0xD1, 0x79, 0x27, 0x81, 0xBB, 0x67, 0x47, 0x91, 0xAE, 0xC1, 0xB8, 0x79
.byte 0x1F, 0x5E, 0xD5, 0x08, 0x84, 0xA9, 0x6D, 0x1A, 0xF3, 0xEB, 0x8C, 0x58, 0x78, 0x5F, 0xD8, 0x51
.byte 0x74, 0x45, 0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 0xFE, 0x09, 0x40, 0x30, 0x3F, 0x27, 0x9E, 0xE2, 0xF0, 0x32, 0xC7, 0xA5, 0xA8
.byte 0xE8, 0x74, 0xEB, 0xAA, 0x26, 0xA2, 0x91, 0x6C, 0xF1, 0x8A, 0x94, 0x89, 0x41, 0x65, 0x59, 0x09
.byte 0xCB, 0x32, 0x11, 0x63, 0x97, 0x12, 0x32, 0x27, 0xA4, 0x74, 0x9A, 0xB2, 0x70, 0xAF, 0x65, 0xD5
.byte 0x97, 0x33, 0xF3, 0xE0, 0x64, 0xFC, 0x2F, 0xE5, 0x93, 0x71, 0xA0, 0xB5, 0x0C, 0x49, 0x42, 0x68
.byte 0xE5, 0xB5, 0xBA, 0xE5, 0x64, 0x65, 0xE7, 0x4F, 0x63, 0x92, 0x5A, 0xBB, 0xBE, 0xBC, 0xBD, 0x23
.byte 0x33, 0x45, 0xAE, 0xE9, 0x5E, 0x84, 0x1C, 0xE8, 0x33, 0x84, 0xA7, 0x70, 0xB0, 0x17, 0x14, 0x13
.byte 0x07, 0x5A, 0x4E, 0xB2, 0x24, 0x65, 0x11, 0xAC, 0xB9, 0x32, 0xB1, 0x9D, 0xA7, 0x8B, 0x19, 0x8B
.byte 0x0C, 0xF9, 0x76, 0xF8, 0xBA, 0x87, 0xAE, 0xB1, 0x5F, 0x63, 0x0C, 0xCF, 0x2B, 0x0F, 0x4F, 0xC8
.byte 0x36, 0x52, 0x7C, 0x02, 0x70, 0x82, 0x9B, 0xC2, 0x66, 0x59, 0xD7, 0xF1, 0x9F, 0xFF, 0x0D, 0x90
.byte 0xDD, 0x63, 0x4E, 0x48, 0x06, 0x9C, 0x64, 0x04, 0x07, 0x74, 0xDB, 0xEF, 0x66, 0xBA, 0x9C, 0xCE
.byte 0xE0, 0x95, 0x98, 0x14, 0xCB, 0x76, 0x97, 0x96, 0x91, 0xD0, 0xAC, 0x57, 0x02, 0x44, 0x57, 0x3B
.byte 0xC5, 0x5F, 0xDE, 0x1D, 0xB9, 0xA1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are with Previous | Blame | View Log