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

Subversion Repositories zipcpu

[/] [zipcpu/] [trunk/] [sw/] [lib/] [mpy32u.S] - Blame information for rev 45

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 45 dgisselq
mpy32u: ; unsigned R0 * unsigned R1 -> unsigned R0:R1
2
        PUSH    R2
3
        PUSH    R3
4
        PUSH    R4
5
        MOV     R0,R2
6
        MULU    R1,R2   ; R2 = Low order bits, low(R0) * low(R1)
7
        MOV     R0,R3
8
        LSR     16,R3   ; Put high order bits in lower half of R3
9
        MULU    R1,R3   ; R3 = Mid order bits, high(R0) * low(R1)
10
        LSR     16,R1   ; R1 = High order bits of R1, being done w/ low order
11
        MOV     R1,R4   ;
12
        MUL     R0,R4   ; R4 = Mid order bits, low(R0) * high(R1)
13
        LSR     16,R0
14
        MULU    R1,R0   ; R0 = High order bits, high(R0) * high(R1)
15
        ADD     R3,R4   ; R4 = sum of mid order bits
16
        ADD.C   0x010000,R0     ; Add in the carry (if it happened)
17
        MOV     R4,R3
18
        LSR     16,R3
19
        ADD     R3,R0   ; R0 = high order bits plus high order mid-bits
20
        LSL     16,R4
21
        ADD     R4,R2   ; R2 = low order bits plus low order mid-bits
22
        ADD.C   1,R0    ; Add in the carry to R0 (if it happened)
23
        MOV     R2,R1   ; Place low order bits into R1
24
        POP     R4
25
        POP     R3
26
        POP     R2
27
        RET

powered by: WebSVN 2.1.0

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