2110793 Advanced Topics in Digital
Class meet on Wed and Fri 9:30-11:00, Eng 3 room 324
This course concentrates on the components and architecture of modern
computers. The emphasizes are Low Power, Multicore and Concurrency.
The role of concurrency in Operating systems will be discussed.
midterm project 20%
14 Jan 2017 S21
instruction set and tools S21-0.zip
20 Jan 2017 s21-3.zip
4 Feb 2017 mos2.txt
now works properly with iot-rz-10.zip
11 Feb 2017 iot-rz-12.zip now works with MOS
25 Feb 2017 mos-rz2.txt
now works iot-rz-15.zip
please note that timer0 is set to 300 for it to work
28 Feb 2017 a more robust mos-rz2.txt
is updated. it works with iot-rz-16.zip.
works correctly with any timer setting > 300. See also new lecture
on process synchronization
8 Mar 2017 multicore simulator works,
s30-3.zip, cid, sync
22 Mar 2017 update multicore package for wfi/intx
Low power programming
The development of modern processor.
We discuss Instruction Level Parallelism based on Chapter 3 of CAQA,
Hennessy & Pattern (5th Ed).
version 1: 32-bit processor
Programming with Interrupt
Operating systems and task scheduling basic
semaphore: flash demo from
William Stallings, U. of Queensland
lecture from Matt Welsh, Harvard, semaphores.pdf
semaphore in MOS and
Cooperative Multitask OS (CMOS)
Multicore processor: S30
multicore (update 22 Mar)
set sheet S30
Parallel programming: wiki
slide at Cornell
example of striping suma-rz.txt
processing unit (GPU)
Implementing a processor
1) Practice assembly language programming by writing several simple
2) Write in Rz, a program to add 1 into all elements of an array of
size 10. Then compile, assemble and run it.
3) Write in Rz, the example program to check membership of a
list. Then compile, assemble and run it.
4) Write a calculator program in Rz (use read-input-string).
Here is the specification of the calculator:
(use iot-rz-6.zip to do this work)
This is two-function calculator. It accepts "input"
as string. There are two kinds of input (from console): number or
operators (+,-,=). Here is an example of interaction:
<25> here is the
First, make everything works in main(), then, add display of the last result
in an interrupt service routine. Notice the problem with "blocking"
input. (we will learn to solve this with concurrency later).
5) Compile mos-rz.txt
and run. Change timer0 to different value. Try to write
semaphore with Rz and run it in MOS.
Example output from my run (set timer0 to 150):
load program, last address 200
1 2 3 4 interrupt0
*2 *3 *4 *5 *6 interrupt0
5 6 7 8 9 interrupt0
*7 *8 *9 *10 interrupt0
stop, clock 1168, execute 1168 instructions
6) Implement semaphore in Rz (
newsem(), wait(), signal())
and make this demo-sync work:
i = 0
while(i < 5)
cnt = cnt + 1
i = i + 1
i = 0
while( i < 5 )
i = i + 1
sem1 = newsem(1) // init value 1
sem2 = newsem(0) // init value 0
p = createp(&p1)
p = createp(&p2)
7) Try using sim30 to run count.txt
8) Think of some simple parallel program that can be implemented using
9) Design a semaphore that works with multicore.
10) Run suma-rz.txt with quad
core. You need to configure and recompile sim30 for quad core.
Internet of Things board and Rz
Iot board has the following functions for input/output:
#4 ; input returns pointer
to string (default at String Segment)
#3 ; print string
trap r1 #19 ;
malloc, memory allocation from heap
Rz interface to these functions by :
// insert assembly string into asm source
print() // print
int and constant string "..."
printc(c) // print char
prints(s) // print string
settimer0(t) // set timer0 to t
settimer1(t) // set timer1 to t
// diable int n
// enable int n
sleep wait int
x = readport(k) // read iot-board ports
x = input() // input returns string
x = malloc(n) // allocate mem n words from heap
free C compiler for Windows lcc-win32 . (for Windows 7, 8, 8.1 and
10). Please also download and install "User Manual". You need it to
look up the library function of this C.
S2.1 assembler and simulator s21-0.zip
Rz 3.6.1 compiler with compatible s21 rz361.zip
(update, fix set command)
Compiler, assembler and simulator for lowpower programming (IoT board)
(s21 works with mos2.txt )
(s21 works with mos-rz.txt )
(with semaphore as trap instructions)
(works with mos-rz2.txt)
(update 28 Feb 2017)
S3.0 Multicore simulator
with assembler and tracer.
(update with wfi/intx, 22 Mar 2017)
5 (tool for implementing a processor, no
installation required, just unzip)
Mid term projects
1) Modify MOS so that it can create and run a dynamic process. That
is, a process can be created and started with a process. Currently,
MOS can create a process only in the main().
2) Modify the simulator so that an interrupt can be nested. That is,
another interrupt can occurs while the first interrupt has not finished yet
(not reti). If it can handle two nested interrupt, then suggest the
idea how to make it three.
3) Develop an application on Android to run the simulator.
4) Develop an application to run the simulator on a web browser (obvious
Please prepare your demonstration and write a short report (2-3 pages)
describes your work and some sample run.
Final project: implementing 4B
1) on FPGA
2) simulation with microprogramming (my
chapter on microprogramming)
3) physical design with LogicWork
Hennessy and Patterson, Computer Architecture: A Quantitative Approach, 5th
ed., Elsevier, 2012.
Transistor level simulation of an antique CPU. 6502 is used in the
iconic Apple II machine.
last update 24 Mar 2017