FIT1047丨INTRO CSN&SEC

password
icon
TOC

Week 1

Workshop W1

1. Convert numbers in different bases

Decimal (Base 10)
0 1 2 3 4 5 6 7 8 9
Binary (Base 2)
0 1
Octal (Base 8)
0 1 2 3 4 5 6 7
Hex-academical (Base 16)
0 1 2 3 4 5 6 7 8 9 A B C D E F
  • Multiplication method:
  • Base 2 → Base 10
  • Base 2 → Base 16
  • Base 10 → Base 2 1. (as mush as possible). 2. 对于小数, (as much as possible) 3. 整数取余数,小数取整数
  • Base 10 → Base 16 1. (as much as possible). 2. 对于小数, (as much as possible)
  • Base 16 → Base 2
  • Base 16 → Base 10
Q1: Convert number into the number in base 4 system.
  • Base 5 ⇒ Base 10 ⇒ Base 4
Q2: Convert the decimal number 12.45 into binary number.

    2. Represent negative numbers in binary form

    • Unsigned binary notation: Only represent positive numbers
    • Sign-magnitude notation: 1. MSB = Signed bit (0→ Positive; 1→ Negative) 2. Not suitable for mathematic computation.
    notion image
    • 1’s Complement notation: 1. Flip all bits to get negative numbers. 2. Extra step for mathematic computation.
    notion image
    • 2’s Complement notation: Negative: 1’s + 1
    notion image
    • ALL
    notion image
    notion image

    3. Represent text using ASCII code

    notion image
    notion image
    notion image
    Operation of Basic Gates (Homework) 
    notion image
    notion image
    notion image
    notion image

    Applied W1

    Week 3

    Workshop

    1. Von Neumann Architecture

    notion image

    2. Machine and Assembly Code

    • What are the differences between machine code and assembly language?
    notion image
    notion image
    notion image

    MARIE – Instructions

    notion image

    Opcode

    This is table of Opcode (4 bits)
    notion image
    • Example
    notion image
    notion image

    Registers

    notion image
    • 图例
    notion image
    • 注意,每个Register 拥有的bits 是不同的
    notion image
    对于像PC, MAR 这些只针对Address的,只有12bits.

    3. Register Transfer Language (RTL)

    • What is RTL
    notion image
    • 🌟Analyze RTL fetch-decode-execute using the following MARIE code:
    notion image
    • For example, Load A:
    notion image
    notion image
    notion image
    notion image
    • PC: Hold the current ADDRESS of instruction 存当前instruction的地址
    • MAR: 存储所存数据的地址或者从内存中取出数据的地址

    4. Write simple assembly code programs using MARIE

    • CPU only understand the machine code
    • CPU reads from TOP to BOTTOM 1. Our program MUST start in instruction 2. Define variables AFTER halt (Main program) 3. Main program MUST end with a halt
    • CPU acc no idea the data fetched is an instruction or variable

    Hardcoded Addresses → Label

    notion image
    • Here, A and B are labels of addresses of 004 and 005 Value of A = 004 Value of B = 005 Content of A = M[A] = 0001 Content of B = M[B] = 0002

    Example of Marie

    • Using MARIE.js, write a program to subtract 16 (DEC) from 30 (DEC) and subsequently add 1 (DEC). Store the result in memory and output the value on the MARIE output screen.
    notion image
    notion image
    • Every value used MUST be defined, A, B, C, Ans

    Example of Marie (using input)

    • Using MARIE.js, write a program to output the addition of two decimal numbers which are input by the user.
    notion image
    • AC can only hold one input.
    notion image

    Example of Marie (Output)

    • Using MARIE.js, write a program to output “FIT1047”.
    We need the ASCII as following
    notion image
    • Define the ASCII characters with Hex or Dec
    notion image
    • Use the output mode UNICODE for a correct display.
    notion image
     

    Example of Marie (using clear)

    • Using MARIE.js, write a program to output the positive and negative forms of a input decimal value.
    Negate Input = 0 – Input
    notion image
    notion image

    Example of Marie (Jump & Skipcond)

    • Using MARIE.js, write a program to input a decimal value. If the value if greater than zero, print “>0”, otherwise, print “<=0”.
    notion image
    notion image
    • Define variables using ASCII
    notion image
     
    notion image

    Week 5

    Workshop

    How does CPU access I/O devices?

    • MMIO vs PMIO
    notion image

    When does CPU access I/O devices?

    • Programmed vs Interrupt - Based I/O
    notion image

    DMA: Direct Memory Access

    notion image

    OS: Operating System

    What dose OS do?
    • A program that provides an abstraction layer between hardware and user
    • Make the computer easier to be used by end users and programmers
    • Create illusion of multiple processes running simultaneously
    Loading...

    © Vince 2022-2025