home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / arch / 11735 < prev    next >
Encoding:
Text File  |  1992-12-17  |  2.4 KB  |  62 lines

  1. Newsgroups: comp.arch
  2. Path: sparky!uunet!noc.near.net!meiko.com!richard
  3. From: richard@meiko.com (Richard Cownie)
  4. Subject: Re: RISC assemblers question
  5. Message-ID: <1992Dec17.173930.3235@meiko.com>
  6. Organization: Meiko Scientific Corp.
  7. References: <Dec.17.10.16.36.1992.17493@cadenza.rutgers.edu>
  8. Date: Thu, 17 Dec 1992 17:39:30 GMT
  9. Lines: 51
  10.  
  11. masticol@cadenza.rutgers.edu (Steve Masticola) writes:
  12. : Hi,
  13. : I've met a couple of people who have attempted to write assemblers for
  14. : RISC machines, who say that it's a difficult job. Can someone give me
  15. : an inkling as to why?
  16. : I'm not saying that it isn't; the reason just isn't obvious to me
  17. : right now.
  18. : Thanks,
  19. : - Steve (masticol@cs.rutgers.edu).
  20.  
  21. Writing a basic assembler for most RISC machines must surely be easy,
  22. because the instruction formats are few and simple.  However, I can
  23. think of several things which can make it harder:
  24.  
  25.   1) For a processor like the original MIPS, the assembler is responsible
  26.      for identifying pipeline hazards and re-ordering the code and
  27.      inserting no-ops to avoid them.
  28.  
  29.   2) For machines with delayed branches and suchlike, the assembler
  30.      often tries to optimise by filling the delay slot.  I've just
  31.      been looking at the Sun SPARC assembler, and it has a huge pile
  32.      of peephole optimization code.
  33.  
  34.   3) In the quest for simplicity of the instruction set, some things
  35.      usually get swept under the carpet and become difficult, e.g.
  36.      loading immediate constants into registers.  Most RISC's implement
  37.      the common cases of small +ve and -ve integer constants simply
  38.      and efficiently, but loading a random 32-bit constant may be hard.
  39.      On the SPARC, this takes 2 instructions, on the ARM, which is what
  40.      I'm thinking of in particular, it could take up to 4 instructions,
  41.      as immediate constants were only 8 bits shifted by any even number!
  42.      Sounds bizarre, but actually it catches most of the common cases.
  43.      Anyway, it's nice for the assembler writer to hide these kinds of
  44.      architectural warts with pseudo-instructions.
  45.  
  46.      And then if the things you're loading is a relocatable address ...
  47.  
  48. So I guess the answer is, as for most software, you can get 80% of
  49. the functionality with 20% of the work, but getting the last 20% is
  50. hard.
  51.  
  52.  
  53.  
  54. -- 
  55. Richard Cownie (a.k.a. Tich), Meiko Scientific Corp 
  56. email: richard@meiko.com
  57. phone: 617-890-7676
  58. fax:   617-890-5042       
  59.