2110793  Advanced Topics in Digital Systems   2017 

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.


homework            20%
midterm project   20%
project                 30%
final                     30%


  14 Jan 2017    S21 instruction set  and  tools S21-0.zip  are updated
  20 Jan 2017    s21-3.zip   and  rz361-1.zip  are updated
    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
            It 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

previous lecture 2016  2015  2013


Low power programming
Multi-core processor


The development of modern processor.
Performance metrics.
We discuss Instruction Level Parallelism based on Chapter 3 of CAQA, Hennessy & Pattern (5th Ed).
Processors:     S2 version 1: 32-bit processor
Rz compiler 3.6.1

Programming with Interrupt
    Low power programming


Operating systems and task scheduling  basic OS concepts
    Multitask:     Multitask OS   mos2.txt
    semaphore:  flash demo from William Stallings, U. of Queensland
    lecture from Matt Welsh, Harvard,   semaphores.pdf  
    semaphore in MOS and examples   
    process synchronization
Cooperative Processes
Cooperative Multitask OS (CMOS)

Multicore processor:     S30 multicore   (update 22 Mar)
    instruction set sheet  S30
Parallel programming:  wiki   lecture slide at Cornell
    example of striping   suma-rz.txt
Graphics processing unit (GPU)
Implementing a processor


1)  Practice assembly language programming by writing several simple programs.
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 last result

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):
C:\iot-rz\test>sim21 mos-rz-s.obj
load program, last address 200
*1 interrupt0
1 2 3 4 interrupt0
*2 *3 *4 *5 *6 interrupt0
5 6 7 8 9 interrupt0
*7 *8 *9 *10 interrupt0
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 multicore S30.
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:
     trap r1 #4        ;  input returns pointer to string (default at String Segment)
     trap r1 #3        ;  print string
     trap r1 #19      ;  malloc,  memory allocation from heap

Rz interface to these functions by :

asm(s)             // 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
di(n)              // diable int n
ei(n)              // enable int n
doze()             // sleep wait int
x = readport(k)    // read iot-board ports
x = input()        // input returns string
x = malloc(n)      // allocate mem n words from heap


Recommended 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  s21-3.zip (update)
Rz 3.6.1 compiler with compatible s21  rz361.zip    rz361-1.zip (update, fix set command)
Compiler, assembler and simulator for lowpower programming  (IoT board)
    iot-rz-10.zip    (s21 works with mos2.txt )
    iot-rz-12.zip    (s21 works with mos-rz.txt )
    iot-rz-14.zip    (with semaphore as trap instructions)
    iot-rz-15.zip     (works with mos-rz2.txt)
    iot-rz-16.zip     (update 28 Feb 2017)

S3.0  Multicore simulator 
   s30-3.zip         with assembler and tracer. 
   s30-4.zip         (update with wfi/intx, 22 Mar 2017)

LogicWork 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 choice is to use javascript).
Please prepare your demonstration and write a short report (2-3 pages) describes your work and some sample run.

Final project:   implementing 4B processor
   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