FIT1047丨INTRO CSN&SEC
password
icon
TOC
Week 1Workshop W11. Convert numbers in different bases2. Represent negative numbers in binary form3. Represent text using ASCII codeApplied W1Week 3Workshop1. Von Neumann Architecture2. Machine and Assembly CodeMARIE – InstructionsOpcodeRegisters3. Register Transfer Language (RTL)4. Write simple assembly code programs using MARIEHardcoded Addresses → Label Example of MarieExample of Marie (using input)Example of Marie (Output)Example of Marie (using clear)Example of Marie (Jump & Skipcond)Week 5WorkshopHow does CPU access I/O devices?When does CPU access I/O devices? DMA: Direct Memory AccessOS: Operating System
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.

- 1’s Complement notation: 1. Flip all bits to get negative numbers. 2. Extra step for mathematic computation.

- 2’s Complement notation: Negative: 1’s + 1

- ALL


3. Represent text using ASCII code



Operation of Basic Gates (Homework)




Applied W1
Week 3
Workshop
1. Von Neumann Architecture

2. Machine and Assembly Code
- What are the differences between machine code and assembly language?



MARIE – Instructions

Opcode
This is table of Opcode (4 bits)

- Example


Registers

- 图例

- 注意,每个Register 拥有的bits 是不同的

对于像PC, MAR 这些只针对Address的,只有12bits.
3. Register Transfer Language (RTL)
- What is RTL

- 🌟Analyze RTL fetch-decode-execute using the following MARIE code:

- For example, Load A:




- 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

- 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.


- 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.

- AC can only hold one input.

Example of Marie (Output)
- Using MARIE.js, write a program to output “FIT1047”.
We need the ASCII as following

- Define the ASCII characters with Hex or Dec

- Use the output mode UNICODE for a correct display.

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


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”.


- Define variables using ASCII


Week 5
Workshop
How does CPU access I/O devices?
- MMIO vs PMIO

When does CPU access I/O devices?
- Programmed vs Interrupt - Based I/O

DMA: Direct Memory Access

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...