Department of Electrical and Computer Engineering
Dalhousie University

ECED 3403: Computer Architecture

Summer 2018

Assignment 1

Last updated: 23 May 2018


  • For a copy of assignment 1, click here.
    Notes:
    18 05 15 - Typo in table 1 fixed.

  • Pre-assembler error - clarification:
    Section 2.2 of Assignment 1 states, "If errors are detected, they should be flagged; however, pre-assembly should continue for the remaining records".
    The pre-assembler is looking for pre-assembler instructions only. Any record that does not have a pre-assembler instruction should be written to the output file unchanged.

    Pre-assembler instructions have either no arguments or one argument.

    A no-argument instruction, such as CLRC, should be converted to BIC #1,R6. For example:
    Input record: CLRC ; Clear carry bit
    Output record: BIC #1,R6 ; Clear carry bit
    However, if the no-argument instruction has an argument, an error has occurred:
    Input record: CLRC R4 ; Clear carry bit
    In this case, the pre-assembler could simply convert the CLRC and let the assembler deal with the problem:
    Output record: BIC #1,R6 R4 ; Clear carry bit
    Alternatively, the pre-assembler can handle it (the preferred method), by indicating that a no-argument instruction has an argument and is therefore in error.

    A one-argument instruction such as JUMP Rx should have an argument (a user-supplied register name - you are not required to check the register name). For example, JUMP R1, should be converted to MOV R1,R7.
    Three possible one-argument scenarios are:

    1. No argument is supplied with the emulated instruction; for example:
      JUMP ; over the lazy dog!
      JUMP

      This is an error that can be detected by the pre-assembler.
    2. One argument is supplied with the emulated instruction; for example:
      JUMP R5
      Jump R6 ; Jump to address in PSW

    3. More than one argument is supplied with the emulated instruction; for example:
      Jump right now ; Okay?
      Jump to the left and a step to the right

      This is another error that can be detected by the pre-assembler.
  • Some emulated instructions refer to the equated registers SP (R5), PSW (R6), and PC (R7). If the following records are not added to the output file, the assembler could produce errors:

    PSW EQU R6
    SP EQU R5
    PC EQU R7

    To avoid requiring the input file including these equates or the pre-assembler adding them, simply change the equated records to include the unequated registers:

    CLRC BIC #1,R6
    CLRN BIC #4,R6
    CLRZ BIC #2,R6
    JUMP Rx MOV Rx,R7
    NOP MOV R6,R6
    PULL Rx LD R5+,Rx
    PUSH Rx ST Rx,-R5
    RET MOV R4,R7
    SETC BIS #1,R6
    SETN BIS #4,R6
    SETZ BIS #2,R6
    SPL0MOVLZ #$0,R6
    SPL1MOVLZ #$20,R6
    SPL2MOVLZ #$40,R6
    SPL3MOVLZ #$60,R6
    SPL4MOVLZ #$80,R6
    SPL5MOVLZ #$a0,R6
    SPL6MOVLZ #$c0,R6
    SPL7MOVLZ #$e0,R6

  • A file containing examples of input records for your pre-assembler is available here.

  • Other examples of X-Makina assembly files can be found on the X-Makina Documentation and Software page.

  • Design notes:

  • Information on the X-Makina assembler can be found in the The X-Makina Assembler User's Guide (24 May 2018)

  • Important dates:
    Available: 14 May 2018
    Design document submission (3pm, at start of class): 24 May 2018
    Demonstrations (during lab): 5 June 2018
    Software and testing submission (3pm, at start of lab): 5 June 2018

    If the software deviates from the original design, the design document must be updated and resubmitted.

    Late submissions for this assignment will not be accepted.