From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,XPRIO autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,78b2880bc7e78e39,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-03-14 12:30:03 PST Path: supernews.google.com!sn-xit-03!supernews.com!newsswitch.lcs.mit.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!colt.net!newspeer.clara.net!news.clara.net!news5-gui.server.ntli.net!ntli.net!news2-win.server.ntlworld.com.POSTED!not-for-mail From: "chris.danx" Newsgroups: comp.lang.ada Subject: RISC X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Message-ID: Date: Wed, 14 Mar 2001 20:23:02 -0000 NNTP-Posting-Host: 62.253.12.61 X-Complaints-To: abuse@ntlworld.com X-Trace: news2-win.server.ntlworld.com 984601385 62.253.12.61 (Wed, 14 Mar 2001 20:23:05 GMT) NNTP-Posting-Date: Wed, 14 Mar 2001 20:23:05 GMT Organization: ntlworld News Service Xref: supernews.google.com comp.lang.ada:5733 Date: 2001-03-14T20:23:02+00:00 List-Id: Hi, I'm simulating a RISC machine in Ada. Eventually the instructions will be mapped to native architecture (x86, m68xxx, SPARC, etc), but for now i want to simulate a machine, to limit the possibility of doing something nasty to anyone's machine. I've decided to provide byte, word and long word modes for most instructions. The problem comes when clearing or setting byte or word portions of a register (the machine is loosely based on M68000). The register is long word (32bit) and i want to set the lower 16bits or 8bits. I've managed to get this to work, problem is it's not very efficient. The register is of type 'mod', so i divided by 2**8 or 2**16 then multiplied by it. I know multiplication and division are costly and really i'm looking for something more efficient. If this were Pascal i'd use 'shift left/right' which is quite fast. What should i do to speed it up? Does Ada have a shift L/R operation? Is there another way to do it? I have another problem with memory. I thought about allocating one big block of memory (as an array) and accessing it by index. The problem? I do plan to dynamically allocate the memory, but i'll still be limited by the amount of memory allocable in a single array. I've thought of a few ways of doing this but can't seem to avoid problems! Anyone know of a solution? I don't like using C, but i 'd run in to a similar problem binding with C anyway. Thanks, Chris Campbell p.s. This isn't a homework assignment!!!