Annotation of qemu/roms/SLOF/board-js2x/slof/memory.fs, revision 1.1.1.1

1.1       root        1: \ *****************************************************************************
                      2: \ * Copyright (c) 2004, 2008 IBM Corporation
                      3: \ * All rights reserved.
                      4: \ * This program and the accompanying materials
                      5: \ * are made available under the terms of the BSD License
                      6: \ * which accompanies this distribution, and is available at
                      7: \ * http://www.opensource.org/licenses/bsd-license.php
                      8: \ *
                      9: \ * Contributors:
                     10: \ *     IBM Corporation - initial implementation
                     11: \ ****************************************************************************/
                     12: 
                     13: \ The /memory node.
                     14: 
                     15: \ See 3.7.6.
                     16: new-device
                     17: 
                     18: s" memory" 2dup device-name device-type
                     19: 
                     20: : mem-size-u3  20000000 ;
                     21: : (mem-size-u4) ( # -- size )
                     22:   4 lshift f8002200 + rl@ dup 1 and 0= IF drop 0 EXIT THEN
                     23:   dup c000 and e rshift over 3000 and c rshift + 10000000 swap lshift
                     24:   swap 2 and 0= IF 2* THEN ;
                     25: : mem-size-u4  0 4 0 DO i (mem-size-u4) + LOOP ;
                     26: : mem-size   u3? IF mem-size-u3 THEN  u4? IF mem-size-u4 THEN ;
                     27: : mem-speed-u4  f8000800 rl@ 12 rshift 7 and 4 + d# 200 * 3 / ;
                     28: : mem-speed-u3  f8000f60 rl@ c rshift f and d# 100 * 3 / ;
                     29: : mem-speed  u3? IF mem-speed-u3 THEN  u4? IF mem-speed-u4 THEN ;
                     30: 
                     31: 
                     32: : encode-our-reg
                     33:   0 encode-int 0 encode-int+
                     34:   mem-size dup >r 80000000 > IF
                     35:   0 encode-int+ 80000000 encode-int+
                     36:   1 encode-int+ 0 encode-int+ r> 80000000 - >r THEN
                     37:   r@ 20 rshift encode-int+ r> ffffffff and encode-int+ ;
                     38: encode-our-reg s" reg" property
                     39: 0  mem-size release    \ Make our memory available
                     40: 
                     41: 
                     42: : mem-report
                     43:   base @ decimal mem-size 1e rshift 0 .r
                     44:   mem-size 3fffffff and IF ." .5" THEN ."  GB of RAM @ "
                     45:   mem-speed . ." MHz" base ! ;
                     46: 
                     47: get-node memnode !
                     48: 
                     49: : open  true ;
                     50: : close ;
                     51: 
                     52: finish-device

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.