source: trunk/softs/tests_ccvcache_v4/common/subr.S @ 237

Last change on this file since 237 was 232, checked in by alain, 12 years ago

Introducing the elementary tests for a TSAR mono-cluster
mono-processor platform with MMU using the vci_cc_vcache_v4
such as the "tsarv4_mono_mmu".
(assemby level tests written by Manuel Bouyer)

File size: 780 bytes
Line 
1#include <registers.h>
2/* test common subroutines
3
4        .text
5/*
6 * void print(char *): print a string to the multitty.
7 * assumes k0 points to the tty base.
8 */
9        .globl print
10print:
11        .set noreorder
12        move    t0, a0
131:
14        lb      t1, 0(t0);
15        beq     t1, zero, end
16        nop
17        sb      t1, 0(k0)
18        addiu   t0, t0, 1
19        j       1b
20        nop
21end:
22        jr      ra
23        nop
24
25/*
26 * void printx(uint32_t): print a number in hex to the multitty
27 * assumes points to the tty base.
28 */
29        .globl printx
30printx:
31        .set noreorder
32        move    t0, a0
33        li      t1, '0'
34        sb      t1, 0(k0)
35        li      t1, 'x'
36        sb      t1, 0(k0)
37        li      t1, 8
381:
39        lui     t2, 0xf000;
40        and     t2, t0, t2
41        srl     t2, t2, 28
42        slti    t3, t2, 0xa
43        beq     t3, zero, 2f /* in range A-F */
44        nop
45        addi    t2, t2, '0'
46        j       3f
47        nop
482:
49        addi    t2, t2, 'A' - 0xa
503:
51        sb      t2, 0(k0)
52        addi    t1, t1, -1
53        bgtz    t1, 1b
54        sll     t0, t0, 4
55        jr      ra
56        nop
Note: See TracBrowser for help on using the repository browser.