Simple Computing System(SCS)

  1. To start with, the Simple Computing System has an assembly-level programming language. The program in this language is converted into bits, which are used by the Operating System to get the things done. The following instruction set defines the language.

    Source Code

    Meaning

    Source Code

    Meaning

    DIRECT MODE

    Retrieval from and storage to memory

    LDAD xxx ACC1 = Mem[xxx] STAD xxx Mem[xxx] = ACC1

    Operations on accumulator

    ADAD xxx ACC1 = ACC1 + Mem[xxx] SBAD xxx ACC1 = ACC1 - Mem[xxx]
    MULD xxx ACC1 = ACC1 * Mem[xxx] DIVD xxx ACC1 = ACC1 / Mem[xxx]
    MODD xxx ACC1 = ACC1 % Mem[xxx] NEGA ACC1 = -ACC1
    SHRA Shift ACC1 bits to right SHLA Shift ACC1 bits to right
    RTRA Rotate ACC1 bits to right RTLA Rotate ACC1 bits to left

    Operations on memory

    CLRM xxx Mem[xxx] = 0 INCM xxx Mem[xxx] = Mem[xxx]+1
    DECM xxx Mem[xxx] = Mem[xxx]-1 NEGM xxx Mem[xxx] = -Mem[xxx]

    Jump Instructions

    JUMP xxx IP = xxx JMEQ xxx If EQ = 1 then IP = xxx
    JMNE xxx If EQ = 0 then IP = xxx JMLT xxx If LT = 1 then IP = xxx
    JMGE xxx If LT = 0 then IP = xxx JMLE xxx If(LT = 1 or EQ = 1) then IP = xxx
    JMGT xxx If(LT = 0 and EQ = 0) then IP = xxx
    JMOV xxx If OV = 1 then IP = xxx JMNO xxx If OV = 0 then IP = xxx

    Setting and Clearing bits

    STOV OV = 1 CLOV OV = 0
    STEQ EQ = 1 CLEQ EQ = 0
    STLT LT = 1 CLLT LT = 0

    Miscellaneous

    NOPN No operation HALT Halt

    Input/Output

    INAC Get input into ACC1 OUTA Show ACC1
    INPD xxx Get input into Mem[xxx] OUTD xxx Show Mem[xxx]

    Compare accumulator

    CMPA xxx If ACC1 = Mem[xxx] then EQ = 1, else EQ = 0;
    If ACC1 < Mem[xxx] then LT = 1, else LT = 0

    INDIRECT MODE

    Retrieval from memory

    LDAI xxx ACC1 = xxx    

    Operations on accumulator

    ADAI xxx ACC1 = ACC1 + xxx SBAI xxx ACC1 = ACC1 - xxx
    MULI xxx ACC1 = ACC1 * xxx DIVI xxx ACC1 = ACC1 / xxx
    MODI xxx ACC1 = ACC1 % xxx    

    Input/Output

    OUTI xxx Show xxx    

    Compare accumulator

    CMAI xxx If ACC1 = xxx then EQ = 1, else EQ = 0;
    If ACC1 < xxx then LT = 1, else LT = 0
    (One can give single line comments, beginning with a single quote)

    The Registers used are: 6 Accumulators(ACC1 for the user's immediate use, ACC2, ACC3, ACC4, ACC5, ACC6 for internal binary arithmetic of CPU), Instruction Pointer(IP), Instruction Register(IR), Operand part register(OPNDW), 6 bits(EQ: equal bit, LT: less than bit, OV: overflow bit, INFLAG: input flag, OUTFLAG: output flag; and NEGATE bit for internal binary arithmetic of CPU).

  2. The user has to enter all the numbers in the decimal format for the ease of use. All the opcodes and operands are then converted into bits. the memory is also organized into bits. All the arithmetic is binary arithmetic, so when the memory or the accumulators are required to be seen by the user, their contents are shown in equivalent hexadecimal and decimal format. The complete project can thus be used to make the working of computer clear to the students of Assembly Language Programming, Logic Design and even Computer Architecture. The program code for the conversion of source code into object code can also be used for basic Compiler Design courses.

  3. The following are the usual steps taken to run a program:
    1. Enter the program in the Program TextBox.
    2. Enter the starting address, that is the address in the primary memory where the first line of the code should be placed. Hit "Compile" button. Check in the Progress TextBox if there are any compile errors, fix them and redo step 2. (It is advisable to clear the primary memory before compiling a program.)
    3. Enter the starting address of the program in the primary memory. Hit "Run" button
    4. Hit "Run Single Step" or "Run in One Go" button. If any runtime errors, like division by zero, memory out of bound, etc., are encountered, they are displayed in the Progress TextBox.

  4. Other features:
    1. You can stop running in between "Run Single Step" by hitting "Stop Running" button.
    2. You can see the values of registers at any time.
    3. You can see the values in primary memory at any time.
    4. In the "Equivalent Values" section, you can see the last instruction in assembly-level language, the value of next instruction pointer and accumulator in decimals.You can also see the old and new value at a primary memory address, if it is changed in the last instruction.

An important tip regarding running a program: An addition or multiplication may lead to overflow, that is a number may cross the limit assigned to it, leading to erroneous results. To avoid this, always clear the OV bit (using CLOV) before an addition or multiplication and JUMP to a safe position if OV is set (using JMOV xxx)

SEE SAMPLE PROGRAMS:

  1. dividebyzero
  2. centitofah
  3. averageofnumbers

 

|X| Close this Window