Porting GNU Assembler RISC Question

I'm trying to write an assembler function, but first I need to understand how this works.  For example

CSEM RS                  0  0  0  0  0      RS      1   1  1   1  0   0 0 1

RS may be any of the 7 general purpose registers but how can their address only be 3 bits long?

Table summarizes all XGATE instructions in the order of their machine coding.
                          Table 4-2 Instruction Set Summary
          Functionality             15 14 13 12 11 10    9  8   7   6  5   4  3   2 1 0
Return to Scheduler and others
              BRK                    0  0  0  0  0   0   0  0   0   0  0   0  0   0 0 0
              NOP                    0  0  0  0  0   0   0  1   0   0  0   0  0   0 0 0
              RTS                    0  0  0  0  0   0   1  0   0   0  0   0  0   0 0 0
               SIF                   0  0  0  0  0   0   1  1   0   0  0   0  0   0 0 0
   Semaphore Instructions
          CSEM IMM3                  0  0  0  0  0     IMM3     1   1  1   1  0   0 0 0
            CSEM RS                  0  0  0  0  0      RS      1   1  1   1  0   0 0 1
           SSEM IMM3                 0  0  0  0  0     IMM3     1   1  1   1  0   0 1 0
            SSEM RS                  0  0  0  0  0      RS      1   1  1   1  0   0 1 1
 Single Register Instructions
         ......................................
sean-keysAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

shajithchandranCommented:
i am not sure if i understood your question properly.

>>RS may be any of the 7 general purpose registers  but how can their address only be 3 bits long?
2^3 is 8. That means 3 bits can be used to represent 8 registers.

000 - R0
001 - R1
...
110 - R6

Also in
Semaphore Instructions
          CSEM IMM3                  0  0  0  0  0     IMM3     1   1  1   1  0   0 0 0
            CSEM RS                  0  0  0  0  0      RS      1   1  1   1  0   0 0 1
           SSEM IMM3                 0  0  0  0  0     IMM3     1   1  1   1  0   0 1 0
            SSEM RS                  0  0  0  0  0      RS      1   1  1   1  0   0 1 1

IMM3 is the immediate value ... it can be just 3 bits.
RS is the register. any of the seven
0
sean-keysAuthor Commented:
Right, so maybe there is an alias address in the documentation? I thought I looked though....

http://powerefi.com/files/S12XGATEV2.pdf
0
shajithchandranCommented:
i think from sections we can conclude that the address for R1 - R7 is 001 tp 111.
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

sean-keysAuthor Commented:
Or is it high to low?
0
shajithchandranCommented:
Its low to high : R1 - 001 .... R7 -- 111
http://www.freescale.com/files/soft_dev_tools/doc/ref_manual/CW_Assembler_XGATE_RM.pdf
I  looked at the above doc. and decoded couple of instructions to extract the bits for the register. and is low to high.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sean-keysAuthor Commented:
I owe you one! Thanks!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Embedded Hardware

From novice to tech pro — start learning today.