OpenCores
URL https://opencores.org/ocsvn/lxp32/lxp32/trunk

Subversion Repositories lxp32

[/] [lxp32/] [trunk/] [verify/] [lxp32/] [src/] [firmware/] [test008.asm] - Blame information for rev 9

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 9 ring0_mipt
/*
2
 * This test calculates a CRC-32 checksum of a small byte array
3
 * CRC32("123456789")=0xCBF43926
4
 */
5
 
6
        lc r100, 0x10000000 // test result output pointer
7
        lc r101, halt
8
        lc r102, failure
9
 
10
        lc r16, 0x10000004 // output pointer
11
        lc r17, 0xFFFFFFFF // initial CRC value
12
        lc r18, 0xEDB88320 // polynom
13
        lc r19, data // input pointer
14
 
15
        lc r32, byte_loop
16
        lc r33, bit_loop
17
        lc r34, dont_xor
18
 
19
        mov r20, 0 // byte counter
20
 
21
byte_loop:
22
        lub r0, r19
23
        mov r21, 0 // bit counter
24
 
25
bit_loop:
26
        and r1, r0, 1
27
        and r2, r17, 1
28
        sru r17, r17, 1
29
        xor r3, r1, r2
30
        cjmpe r34, r3, 0
31
        xor r17, r17, r18
32
 
33
dont_xor:
34
        sru r0, r0, 1
35
        add r21, r21, 1
36
        cjmpul r33, r21, 8
37
 
38
        add r19, r19, 1
39
        add r20, r20, 1
40
        cjmpul r32, r20, 9
41
 
42
        not r17, r17
43
        sw r16, r17
44
 
45
        lc r0, 0xCBF43926
46
        cjmpne r102, r0, r17
47
 
48
        sw r100, 1
49
        jmp r101
50
 
51
failure:
52
        sw r100, 2
53
 
54
halt:
55
        hlt
56
        jmp r101
57
 
58
data:
59
        .byte "123456789"

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.