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

Subversion Repositories lxp32

[/] [lxp32/] [trunk/] [verify/] [lxp32/] [src/] [firmware/] [test012.asm] - Rev 2

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

/*
 * Test multiplication
 */

        lc r100, 0x10000000 // test result output pointer
        lc r101, halt
        lc r102, failure
        lc r103, 0x10000004
        
// Check multiplication table

        lc r32, op1
        lc r33, op2
        lc r34, product
        
        lc r35, loop
        mov r10, 100
        
loop:
        lw r0, r32
        lw r1, r33
        mul r3, r0, r1
        lw r2, r34
        cjmpne r102, r2, r3 // failure
        add r32, r32, 4
        add r33, r33, 4
        add r34, r34, 4
        sub r10, r10, 1
        cjmpug r35, r10, 0 // loop
        
// Simulate a linear congruent random number generator
// as described in ISO/IEC 9899:1999 ("C99" standard)

        mov r64, 1 // initial value
        lc r65, 1103515245 // multiplier
        lc r66, 12345 // addition constant
        lc r67, 32767 // mask
        
        mov r10, 100
        lc r32, rand
        lc r35, rnd_loop
        
rnd_loop:
        call r32 // rand
        sw r103, r0
        sub r10, r10, 1
        cjmpug r35, r10, 0 // rnd_loop
        
        lc r1, 26521
        cjmpne r102, r0, r1 // failure
        
        sw r100, 1
        jmp r101 // halt
        
failure:
        sw r100, 2
        
halt:
        hlt
        jmp r101 // halt

rand:
        mul r64, r64, r65
        add r64, r64, r66
        sru r0, r64, 16
        and r0, r0, r67
        ret

op1:
        .word 5
        .word 1021028019
        .word 3360494259
        .word 4241216605
        .word 3998259744
        .word 4061417389
        .word 2643534582
        .word 3313401900
        .word 2127959231
        .word 517066081
        .word 971560706
        .word 2765397972
        .word 1972360008
        .word 5267214
        .word 3667030040
        .word 3641602966
        .word 297473786
        .word 3637724660
        .word 3268423030
        .word 2775202737
        .word 2509905173
        .word 3885678420
        .word 820072030
        .word 1177172069
        .word 1047341530
        .word 1826819693
        .word 1694831631
        .word 4270696691
        .word 1299413127
        .word 2817552511
        .word 2675818186
        .word 231984537
        .word 65817694
        .word 3640600522
        .word 545754317
        .word 2973624217
        .word 2669208735
        .word 1079210895
        .word 660979290
        .word 738800690
        .word 1631093128
        .word 489263629
        .word 4116157872
        .word 3178886821
        .word 2324324955
        .word 2982397572
        .word 3365621776
        .word 2764926001
        .word 1498466135
        .word 1012944436
        .word -246837166
        .word 470638116
        .word 2103051039
        .word 176753939
        .word -164476654
        .word -1221540757
        .word 43633328
        .word -859182414
        .word 1230499715
        .word -266475918
        .word 1949507090
        .word -856415694
        .word 737657061
        .word 118818171
        .word 359218821
        .word 1246427092
        .word -615317895
        .word 1029267653
        .word 628714057
        .word -2029278762
        .word -1700206210
        .word -785893232
        .word -492445025
        .word -1032292742
        .word -1506164940
        .word 63097629
        .word -1909659707
        .word 1003528447
        .word 1095156443
        .word 325606314
        .word 1750055165
        .word 861103782
        .word -1441910348
        .word 1113139065
        .word -1337158265
        .word -381613907
        .word 567364862
        .word -808095798
        .word -1503281503
        .word -1646541226
        .word -405777159
        .word -98798373
        .word -1948683123
        .word -1889476128
        .word 994740197
        .word 57636334
        .word -1628834166
        .word -15689588
        .word 1568614403
        .word 722317890

op2:
        .word 3
        .word 2570980487
        .word 2794175299
        .word 994440598
        .word 4248205376
        .word 3496362052
        .word 3659500513
        .word 2162808217
        .word 1720638509
        .word 1914084509
        .word 3385545516
        .word 3476389465
        .word 706599398
        .word 3196936660
        .word 2983089252
        .word 1751592726
        .word 2284105389
        .word 4111191592
        .word 3563638217
        .word 2361468945
        .word 3236010945
        .word 1439769561
        .word 1910111900
        .word 2038606217
        .word 311877730
        .word 538878248
        .word 3378587675
        .word 1911288510
        .word 3196239568
        .word 2503116372
        .word 457280137
        .word 3023717616
        .word 98988876
        .word 4098692253
        .word 2797102115
        .word 2159140448
        .word 637551125
        .word 2125433411
        .word 2902980138
        .word 395247949
        .word 1645373547
        .word 1922640262
        .word 1835827423
        .word 3088444407
        .word 4150011791
        .word 273297575
        .word 673792897
        .word 2743197342
        .word 656195007
        .word 2550324965
        .word -337003535
        .word -565725434
        .word 522532873
        .word 850320156
        .word -599163490
        .word 580991794
        .word 1235055289
        .word -697843885
        .word -1888878751
        .word 2001358724
        .word -705426274
        .word 764466127
        .word 1149731192
        .word 528626491
        .word 74073848
        .word 1986549712
        .word 1021657893
        .word 1502226327
        .word 339763464
        .word -248542057
        .word -1245542745
        .word 1721855193
        .word 1203018508
        .word -551112349
        .word -245462721
        .word -2079899329
        .word -603441594
        .word 2123105909
        .word 821726251
        .word -167975413
        .word 343634678
        .word 279038731
        .word -1328164947
        .word -121529220
        .word 760122714
        .word -710590105
        .word -1288727804
        .word -829054509
        .word 1774242228
        .word 198747848
        .word 2017990513
        .word -1246218417
        .word 135357763
        .word -193250194
        .word 1080138546
        .word -278225361
        .word 1216454983
        .word -808631398
        .word 1236885385
        .word -1142156106

product:
        .word 15
        .word 3187625061
        .word 4060456409
        .word 3720114046
        .word 2133166080
        .word 2956880372
        .word 39144502
        .word 4048238156
        .word 3781675411
        .word 2552762493
        .word 2186320472
        .word 2004478132
        .word 1215814320
        .word 1967719832
        .word 961259872
        .word 3218110692
        .word 808743666
        .word 1758021152
        .word 3653971878
        .word 1641193153
        .word 1749066709
        .word 2447944244
        .word 1085998408
        .word 3424443149
        .word 1143260532
        .word 542297608
        .word 3545920917
        .word 820648538
        .word 131342256
        .word 3650446252
        .word 3798859290
        .word 1641505648
        .word 3270043112
        .word 2203660002
        .word 2262848519
        .word 3335948128
        .word 301711115
        .word 853759085
        .word 1108457156
        .word 3991332106
        .word 3268240344
        .word 4293625806
        .word 2556650576
        .word 2577362995
        .word 2650590677
        .word 1310146588
        .word 247957520
        .word 2454471742
        .word 1425274089
        .word 39783556
        .word -2091990222
        .word -1969753896
        .word 1297343511
        .word -32067820
        .word -824646884
        .word -1038744090
        .word -615130832
        .word 1160766902
        .word -878690909
        .word -1535377208
        .word -1071814884
        .word -139010962
        .word 18403416
        .word 2137375833
        .word 2082402008
        .word 1027762240
        .word 1775596157
        .word 1957173043
        .word 1934687048
        .word -1391708870
        .word 1441023282
        .word 897888784
        .word -2134317964
        .word 1520184110
        .word -123674164
        .word -464692957
        .word -481104418
        .word -946631029
        .word 55606985
        .word -2060538802
        .word 1653304606
        .word 1163987746
        .word -2138299740
        .word 1903549084
        .word 1936321654
        .word -455120229
        .word 1931283960
        .word 617295230
        .word -470388172
        .word -522275024
        .word -1465917207
        .word 541793429
        .word -1975377433
        .word 1462865472
        .word 1922773434
        .word 1925941938
        .word 1115302470
        .word 604268600
        .word -32471397
        .word 948036332

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

powered by: WebSVN 2.1.0

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