Author: lwalter
Date: Tue Aug 9 20:23:58 2011
New Revision: 2441
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2441
Log:
Add mfgtest support
Added:
cpu/x86/pc/alex/yuv2rgb.fth
Added: cpu/x86/pc/alex/yuv2rgb.fth
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ cpu/x86/pc/alex/yuv2rgb.fth Tue Aug 9 20:23:58 2011 (r2441)
@@ -0,0 +1,174 @@
+purpose: YUY2 to RGB-565 conversion
+\ See license at end of file
+
+\ B = 1.164(Y - 16) + 2.018(U - 128)
+\ G = 1.164(Y - 16) - 0.813(V - 128) - 0.391(U - 128)
+\ R = 1.164(Y - 16) + 1.596(V - 128)
+
+[ifdef] 386-assembler
+
+\ This code operates on pixel values in memory using scaler of 128
+\ Src bytes are Y0 U Y1 V
+\ Dst bytes are 565RGB 565RGB (2 16-bit pixels)
+
+code yuv2>rgb ( src dst count -- )
+ 4 [sp] di xchg \ di: dst
+ 8 [sp] si xchg \ si: src
+
+ ax push ax push ax push \ Save space on stack for V U Y0
+
+ begin
+ \ Get Y0, make signed, multiply by 1.164 * 128, save on stack
+ ax ax xor al lods d# 16 # ax sub d# 149 # ax ax imul-imm ax 0 [sp] mov
+ ax ax xor al lods d# 128 # ax sub ax 4 [sp] mov \ Get U, make signed, save on stack
+ \ Get Y1, make signed, multiply by 1.164 * 128, save in BX
+ ax ax xor al lods d# 16 # ax sub d# 149 # ax bx imul-imm
+ ax ax xor al lods d# 128 # ax sub ax 8 [sp] mov \ Get V, make signed, save on stack
+
+ \ Generate R
+ d# 204 # 8 [sp] ax imul-imm \ Multiply V by 1.596 * 128
+ bx ax add \ Add Y1
+ d# 7 # ax sar \ Scale down by 128
+
+ 0< if ax ax xor then \ Clip to 0
+ d# 255 # ax cmp > if d# 255 # ax mov then \ Clip to 255
+
+ h# f8 # ax and \ Use upper 5 bits only
+ d# 8 # ax shl \ Shift R into position
+ ax cx mov \ Save it
+
+ \ Generate B
+ d# 258 # 4 [sp] ax imul-imm \ Multiply U by 2.018 * 128
+ bx ax add \ Add Y1
+ d# 7 # ax sar \ Scale down by 128
+
+ 0< if ax ax xor then \ Clip to 0
+ d# 255 # ax cmp > if d# 255 # ax mov then \ Clip to 255
+
+ h# f8 # ax and \ Use upper 5 bits only
+ d# 3 # ax shr \ Shift B into position
+ ax cx or \ Save it
+
+ \ Generate G
+ d# -104 # 8 [sp] dx imul-imm \ Multiply V by -0.813 * 128
+ d# -50 # 4 [sp] ax imul-imm \ Multiply U by -0.391 * 128
+ dx ax add \ Add
+ ax dx mov \ Save to be used for the 2nd RGB
+ bx ax add \ Add Y1
+ d# 7 # ax sar \ Scale down by 128
+
+ 0< if ax ax xor then \ Clip to 0
+ d# 255 # ax cmp > if d# 255 # ax mov then \ Clip to 255
+
+ h# fc # ax and \ Use upper 6 bits only
+ d# 3 # ax shl \ Shift G into position
+ ax cx or \ Save it
+ d# 16 # cx shl \ Save second RGB
+
+ \ Generate 2nd R
+ 0 [sp] bx mov \ Work on Y0
+ d# 204 # 8 [sp] ax imul-imm \ Multiply V by 1.596 * 128
+ bx ax add \ Add Y0
+ d# 7 # ax sar \ Scale down by 128
+
+ 0< if ax ax xor then \ Clip to 0
+ d# 255 # ax cmp > if d# 255 # ax mov then \ Clip to 255
+
+ h# f8 # ax and \ Use upper 5 bits only
+ d# 8 # ax shl \ Shift R into position
+ ax cx or \ Save it
+
+ \ Generate 2nd B
+ d# 258 # 4 [sp] ax imul-imm \ Multiply U by 2.018 * 128
+ bx ax add \ Add Y0
+ d# 7 # ax sar \ Scale down by 128
+
+ 0< if ax ax xor then \ Clip to 0
+ d# 255 # ax cmp > if d# 255 # ax mov then \ Clip to 255
+
+ h# f8 # ax and \ Use upper 5 bits only
+ d# 3 # ax shr \ Shift B into position
+ ax cx or \ Save it
+
+ \ Generate 2nd G
+ dx ax mov \ v*0.813+u*0.391
+ bx ax add \ Add Y-
+ d# 7 # ax sar \ Scale down by 128
+
+ 0< if ax ax xor then \ Clip to 0
+ d# 255 # ax cmp > if d# 255 # ax mov then \ Clip to 255
+
+ h# fc # ax and \ Use upper 6 bits only
+ d# 3 # ax shl \ Shift G into position
+ cx ax or \ Save it
+
+ ax stos \ Output both RGB
+
+ d# 4 # h# c [sp] sub
+ 0= until
+
+ d# 16 [sp] sp lea \ Clean stack
+ di pop
+ si pop
+c;
+[then]
+
+[ifndef] yuv2>rgb
+
+\ Forth code: no division; use scaler of 128
+0 value y1
+0 value v 0 value v*0.813+u*0.391 0 value v*1.596
+0 value u 0 value u*2.018
+
+: do-uv-comp ( -- )
+ u d# 258 * to u*2.018
+ v d# -104 * u d# -50 * + to v*0.813+u*0.391
+ v d# 204 * to v*1.596
+;
+: y>rgb ( y -- rgb )
+ d# 16 - d# 149 * ( 1.164 ) ( y' )
+ dup u*2.018 + 7 >>a 0 max d# 255 min h# f8 and 3 >> ( y b )
+ over v*0.813+u*0.391 + 7 >>a 0 max d# 255 min h# fc and 3 << or ( y gb )
+ swap v*1.596 + 7 >>a 0 max d# 255 min h# f8 and 8 << or ( rgb )
+;
+: yuyv>rgb ( y0uy1v -- rgb0 rgb1 )
+ lbsplit ( v y1 u y0 )
+ swap d# 128 - to u rot d# 128 - to v ( y1 y0 )
+ do-uv-comp ( y1 y0 )
+ y>rgb ( y1 rgb0 )
+ swap y>rgb ( rgb0 rgb1 )
+;
+
+: yuv2>rgb ( src dst len -- )
+ 4 / 0 do ( src dst )
+ over i la+ be-l@ yuyv>rgb ( src dst rgb0 rgb1 )
+ wljoin over i la+ le-l! ( src dst )
+ loop 2drop
+;
+
+[then]
+
+\ LICENSE_BEGIN
+\ Copyright (c) 2011 FirmWorks
+\
+\ Permission is hereby granted, free of charge, to any person obtaining
+\ a copy of this software and associated documentation files (the
+\ "Software"), to deal in the Software without restriction, including
+\ without limitation the rights to use, copy, modify, merge, publish,
+\ distribute, sublicense, and/or sell copies of the Software, and to
+\ permit persons to whom the Software is furnished to do so, subject to
+\ the following conditions:
+\
+\ The above copyright notice and this permission notice shall be
+\ included in all copies or substantial portions of the Software.
+\
+\ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+\ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+\ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+\ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+\ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+\ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+\ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+\
+\ LICENSE_END
+
Author: lwalter
Date: Tue Aug 9 20:23:31 2011
New Revision: 2439
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2439
Log:
Add mfgtest support
Added:
cpu/x86/pc/alex/disptest.fth
Added: cpu/x86/pc/alex/disptest.fth
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ cpu/x86/pc/alex/disptest.fth Tue Aug 9 20:23:31 2011 (r2439)
@@ -0,0 +1,236 @@
+purpose: Display test
+\ See license at end of file
+
+\needs final-test? 0 value final-test?
+\needs smt-test? 0 value smt-test?
+
+dev /display
+
+d# 100 constant bar-int
+h# 7 constant test-colors16-mask
+create test-colors16
+\ white magenta yellow red green blue cyan black
+ ffff w, f81f w, ffe0 w, f800 w, 07e0 w, 001f w, 07ff w, 0000 w,
+
+: fill-rect ( -- ) " fill-rectangle" $call-screen ;
+: dimens ( -- w h ) " dimensions" $call-screen ;
+: ht ( -- h ) " height" $call-screen ;
+: wth ( -- w ) " width" $call-screen ;
+
+: whole-screen ( -- x y w h ) 0 0 dimens ;
+
+: black-screen ( -- ) 0 whole-screen fill-rect ;
+
+: test-color16 ( n -- color )
+ test-colors16 swap bar-int / test-colors16-mask and wa+ w@
+;
+: .horizontal-bars16 ( -- )
+ dimens ( width height )
+ 0 ?do ( width )
+ i test-color16 0 i 3 pick bar-int fill-rect
+ bar-int +loop drop
+;
+: .vertical-bars16 ( -- )
+ dimens ( width height )
+ swap 0 ?do ( height )
+ i test-color16 i 0 bar-int 4 pick fill-rect
+ bar-int +loop drop
+;
+
+instance variable rn \ Random number
+d# 5,000 constant burnin-time \ 5 seconds
+
+: random ( -- n )
+ rn @ d# 1103515245 * d# 12345 + h# 7FFFFFFF and dup rn !
+;
+
+: randomize-color ( -- c )
+ random h# 1f and d# 11 <<
+ random h# 3f and d# 5 << or
+ random h# 1f and or
+;
+: randomize-xy ( -- x y )
+ dimens ( width height )
+ random 3ff and min swap ( y width )
+ random 7ff and min swap ( x y )
+;
+: randomize-wh ( x y -- w h )
+ dimens ( x y width height )
+ rot - -rot ( max-h x width )
+ swap - swap ( max-w max-h )
+ randomize-xy ( max-w max-h w h )
+ rot min -rot min swap ( w' h' )
+;
+: .random-rect ( -- )
+ randomize-color ( c )
+ randomize-xy ( c x y )
+ 2dup randomize-wh ( c x y w h )
+ " fill-rectangle" $call-screen ( )
+;
+
+: random-selftest ( -- )
+ get-msecs rn !
+ get-msecs burnin-time + ( limit )
+ begin
+ get-msecs over u< ( limit reached? )
+ while ( limit )
+ .random-rect ( limit )
+ key? if key 2drop exit then
+ repeat ( limit )
+ drop
+;
+
+0 value xbias
+0 value ybias
+0 value hstripe
+0 value vstripe
+: set-stripes ( -- )
+ wth d# 256 / to hstripe
+ ht d# 256 / to vstripe
+ wth hstripe d# 256 * - to xbias
+ ht vstripe d# 256 * - to ybias
+;
+: half-bias ( -- ) xbias 2/ to xbias ybias 2/ to ybias ;
+: gvsr ( -- )
+ set-stripes half-bias black-screen ( )
+ d# 256 0 do ( )
+ d# 256 0 do ( )
+ i j 0 rgb>565 ( color )
+ hstripe i * xbias + ( color x )
+ vstripe j * ybias + ( color x y )
+ hstripe vstripe ( color x y w h )
+ fill-rect
+ loop
+ loop
+;
+: gvsb ( -- )
+ set-stripes half-bias black-screen ( )
+ d# 256 0 do ( )
+ d# 256 0 do ( )
+ 0 j i rgb>565 ( color )
+ hstripe i * xbias + ( color x )
+ vstripe j * ybias + ( color x y )
+ hstripe vstripe ( color x y )
+ fill-rect
+ loop
+ loop
+;
+: hgradient ( -- )
+ set-stripes black-screen ( )
+ d# 256 0 do ( )
+ i i i rgb>565 ( color )
+ hstripe i * xbias + 0 ( color x y )
+ hstripe ht ( color x y sw h )
+ fill-rect ( )
+ loop ( )
+;
+
+: vgradient ( -- )
+ set-stripes black-screen ( )
+ d# 256 0 do ( )
+ i i i rgb>565 ( color )
+ 0 vstripe i * ybias + ( color x y )
+ wth vstripe ( color x y w sh )
+ fill-rect ( )
+ loop ( )
+;
+
+
+h# ff h# ff h# ff rgb>565 constant white-color
+
+: hline ( y -- ) >r white-color 0 r> wth 1 fill-rect ;
+: vline ( y -- ) >r white-color r> 0 1 ht fill-rect ;
+
+: crosshatch ( -- )
+ black-screen
+ ht 0 do i hline d# 10 +loop
+ wth 0 do i vline d# 10 +loop
+;
+: short-wait ( -- ) smt-test? if d# 250 ms else d# 500 ms then ;
+: brightness-ramp ( -- )
+ 0 h# 0f do i bright! short-wait -1 +loop
+ backlight-off short-wait backlight-on
+ h# f bright!
+;
+
+: red-screen ( -- )
+ load-base whole-screen " read-rectangle" $call-screen
+ h# ff 00 00 rgb>565 whole-screen fill-rect
+ d# 1000 ms
+ load-base whole-screen fill-rect
+;
+: hold-time ( -- )
+ smt-test? if
+ d# 500 ms
+ else
+ final-test? if d# 500 ms else d# 1000 ms then
+ then
+;
+
+: hold-time2 ( -- )
+ smt-test? if
+ d# 500 ms
+ else
+ final-test? if key drop then
+ d# 1000 ms
+ then
+;
+: wait ( -- )
+ hold-time
+\ 0 set-source \ Freeze image
+ hold-time
+\ 1 set-source \ Unfreeze image
+ hold-time2
+;
+
+warning @ warning off
+: selftest ( -- error? )
+ depth d# 16 < if false exit then
+ smt-test? 0= if
+ .horizontal-bars16 wait
+ .vertical-bars16 wait
+ then
+ gvsr wait
+ gvsb wait
+ hgradient wait
+ vgradient wait
+ crosshatch wait
+ brightness-ramp
+
+ smt-test? 0= if
+ burnin-time d# 5000 > if
+ ." Press a key to stop early." cr
+ d# 1000 ms
+ then
+ random-selftest
+ then
+
+ confirm-selftest?
+;
+warning !
+
+device-end
+
+\ LICENSE_BEGIN
+\ Copyright (c) 2007 FirmWorks
+\
+\ Permission is hereby granted, free of charge, to any person obtaining
+\ a copy of this software and associated documentation files (the
+\ "Software"), to deal in the Software without restriction, including
+\ without limitation the rights to use, copy, modify, merge, publish,
+\ distribute, sublicense, and/or sell copies of the Software, and to
+\ permit persons to whom the Software is furnished to do so, subject to
+\ the following conditions:
+\
+\ The above copyright notice and this permission notice shall be
+\ included in all copies or substantial portions of the Software.
+\
+\ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+\ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+\ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+\ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+\ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+\ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+\ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+\
+\ LICENSE_END
Author: lwalter
Date: Tue Aug 9 20:17:04 2011
New Revision: 2435
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2435
Log:
Add random test
Modified:
cpu/x86/memtest.fth
Modified: cpu/x86/memtest.fth
==============================================================================
--- cpu/x86/memtest.fth Tue Aug 9 06:29:27 2011 (r2434)
+++ cpu/x86/memtest.fth Tue Aug 9 20:17:04 2011 (r2435)
@@ -1,3 +1,17 @@
+purpose: Memory test primitives in assembly language
+\ See license at end of file
+
+headers
+\needs mask nuser mask mask on
+headerless
+
+\ Report the progress through low-level tests
+0 0 2value test-name
+: (quiet-show-status) ( adr len -- ) to test-name ;
+
+defer show-status
+' type to show-status
+
: bits-run ( adr len pattern -- fail? )
dup .x ." pattern ... "
3dup lfill ( adr len pattern )
@@ -13,6 +27,7 @@
then
;
: mem-bits-test ( membase memsize -- fail-status )
+ " Data bits test" show-status
2dup h# aaaaaaaa bits-run if true exit then
h# 55555555 bits-run
;
@@ -41,7 +56,7 @@
c;
: address=data-test ( membase memsize -- fail-status )
- ." Address=data test ..."
+ " Address=data test" show-status
2dup inc-fill ( membase memsize )
inc-check ( false | adr data true )
if
@@ -52,3 +67,220 @@
false
then
;
+
+\ random-fill uses registers where possible to minimize memory accesses.
+\ Stack use by random-fill: register usage:
+\ 0 /l* push esi
+\ 1 /l* pop polynomial; push edi ebx = polynomial
+ 2 /l* constant rf-idx \ edi = idx/4
+ 3 /l* constant rf-dta \ eax = data
+ 4 /l* constant rf-len \ esi = len/4, ecx = counter
+ 5 /l* constant rf-adr \ edx = adr
+
+code random-fill ( adr len data index polynomial -- )
+ ebx pop \ ebx: polynomial
+ edi push esi push \ Save esi and edi
+
+ rf-len [esp] ecx mov \ Convert to 32-bit word count
+ 2 # ecx shr \ ecx: remaining count
+
+ 0<> if
+ ecx esi mov \ esi: index upper limit
+ ecx dec
+
+ rf-dta [esp] eax mov \ eax: data
+ rf-idx [esp] edi mov \ edi: index
+ rf-adr [esp] edx mov \ edx: base address
+
+ begin
+ \ Compute new data value with an LFSR step
+ 1 # eax shr
+ carry? if h# 8020.0003 # eax xor then
+
+ \ Compute new address index, discarding values >= len
+ begin
+ 1 # edi shr
+ carry? if ebx edi xor then
+ esi edi cmp
+ u< until
+
+ \ Write the "random" value to the "random" address (adr[index])
+ eax 0 [edx] [edi] *4 mov
+ loopa
+
+ then
+ esi pop edi pop
+ 4 /l* # esp add \ Remove the remaining arguments on the stack
+c;
+
+\ random-check uses registers where possible to minimize memory accesses.
+\ Stack use by random-check: register usage:
+\ 0 /l* push esi
+\ 1 /l* pop polynomial; push edi ebx = polynomial
+ 2 /l* constant rc-rem \ ecx = remain (counter)
+ 3 /l* constant rc-idx \ edi = idx/4
+ 4 /l* constant rc-dta \ eax = data
+ 5 /l* constant rc-len \ esi = len/4
+ 6 /l* constant rc-adr \ edx = adr
+
+code random-check ( adr len data index remain polynomial -- false | adr len data index remain true )
+ 1 /l* [esp] ecx mov \ ecx: remain
+ ecx ecx or \ Check remain
+ 0= if
+ \ No more memory to check
+ 6 /l* # esp add \ Remove the arguments on the stack
+ 0 # push \ Return false
+ next
+ then
+
+ \ Check memory
+ ebx pop \ ebx: polynomial
+ edi push esi push \ Save esi and edi
+
+ rc-len [esp] esi mov \ esi: index upper limit
+ 2 # esi shr \ Convert to 32-bit word count
+ rc-dta [esp] eax mov \ eax: data
+ rc-idx [esp] edi mov \ edi: index
+ rc-adr [esp] edx mov \ edx: base address
+
+ begin
+ \ Compute new data value with an LFSR step
+ 1 # eax shr
+ carry? if h# 8020.0003 # eax xor then
+
+ \ Compute new address index, discarding values >= len
+ begin
+ 1 # edi shr
+ carry? if ebx edi xor then
+ esi edi cmp
+ u< until
+
+ \ Compare the "random" value to the "random" address (adr[index])
+ \ with the calculated data value
+ eax 0 [edx] [edi] *4 cmp
+ <> if
+ eax rc-dta [esp] mov \ Calculated data value
+ edi rc-idx [esp] mov \ Index where failure occurred
+ ecx dec
+ ecx rc-rem [esp] mov \ Update remain
+ esi pop edi pop
+ -1 # push \ Return true
+ next
+ then
+ loopa
+
+ esi pop edi pop
+ 5 /l* # esp add \ Remove the remaining arguments on the stack
+ 0 # push \ Return false
+c;
+
+\ Polynomials for maximal length LFSRs for different bit lengths
+\ The values come from the Wikipedia article for Linear Feedback Shift Register and from
+\ http://www.xilinx.com/support/documentation/application_notes/xapp052.pdf
+create polynomials \ #bits period
+h# 0 , \ 0 0
+h# 1 , \ 1 1
+h# 3 , \ 2 3
+h# 6 , \ 3 7
+h# c , \ 4 f
+h# 14 , \ 5 1f
+h# 30 , \ 6 3f
+h# 60 , \ 7 7f
+h# b8 , \ 8 ff
+h# 110 , \ 9 1ff
+h# 240 , \ 10 3ff
+h# 500 , \ 11 7ff
+h# e08 , \ 12 fff
+h# 1c80 , \ 13 1fff
+h# 3802 , \ 14 3fff
+h# 6000 , \ 15 7fff
+h# b400 , \ 16 ffff
+h# 12000 , \ 17 1ffff
+h# 20400 , \ 18 3ffff
+h# 72000 , \ 19 7ffff
+h# 90000 , \ 20 fffff
+h# 140000 , \ 21 1fffff
+h# 300000 , \ 22 3fffff
+h# 420000 , \ 23 7fffff
+h# e10000 , \ 24 ffffff
+h# 1200000 , \ 25 1ffffff
+h# 2000023 , \ 26 3ffffff
+h# 4000013 , \ 27 7ffffff
+h# 9000000 , \ 28 fffffff
+h# 14000000 , \ 29 1fffffff
+h# 20000029 , \ 30 3fffffff
+h# 48000000 , \ 31 7fffffff
+h# 80200003 , \ 32 ffffffff
+
+: round-up-log2 ( n -- log2 )
+ dup log2 ( n log2 )
+ tuck 1 swap lshift ( log2 n 2^log2 )
+ > - ( log2' )
+;
+
+defer .lfsr-mem-error
+: (.lfsr-mem-error) ( adr len data index remain -- adr len data index remain )
+ push-hex
+ ??cr
+ ." Error at address " 4 pick 2 pick la+ dup 8 u.r ( adr len data index remain err-adr )
+ ." - expected " 3 pick 8 u.r ( adr len data index remain err-adr )
+ ." got " l@ 8 u.r cr
+ pop-base
+;
+' (.lfsr-mem-error) to .lfsr-mem-error
+: throw-lfsr-error ( adr len data index remain -- <thrown> )
+ (.lfsr-mem-error) -1 throw
+;
+
+: (random-test) ( adr len -- )
+ dup /l <= if 2drop exit then ( adr len #bits )
+ dup /l / round-up-log2 ( adr len #bits )
+ polynomials swap la+ l@ ( adr len polynomial )
+
+ 3dup 1 1 rot random-fill ( adr len polynomial )
+
+ >r ( adr len r: polynomial )
+ 1 1 2 pick /l / 1- ( adr len data index remain r: polynomial )
+ begin ( adr len data index remain r: polynomial )
+ r@ random-check ( false | adr len data index remain true r: polynomial )
+ while ( adr len data index remain r: polynomial )
+ .lfsr-mem-error ( adr len data index remain r: polynomial )
+ repeat ( r: polynomial )
+ r> drop
+;
+
+\ Not truly random - uses LFSR sequences
+: random-test ( adr len -- error? )
+ " Random address and data test" show-status
+
+ ['] throw-lfsr-error to .lfsr-mem-error
+ ['] (random-test) catch if
+ 2drop true
+ else
+ false
+ then
+;
+
+\ LICENSE_BEGIN
+\ Copyright (c) 1997 FirmWorks
+\
+\ Permission is hereby granted, free of charge, to any person obtaining
+\ a copy of this software and associated documentation files (the
+\ "Software"), to deal in the Software without restriction, including
+\ without limitation the rights to use, copy, modify, merge, publish,
+\ distribute, sublicense, and/or sell copies of the Software, and to
+\ permit persons to whom the Software is furnished to do so, subject to
+\ the following conditions:
+\
+\ The above copyright notice and this permission notice shall be
+\ included in all copies or substantial portions of the Software.
+\
+\ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+\ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+\ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+\ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+\ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+\ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+\ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+\
+\ LICENSE_END
\ No newline at end of file