COMP2300/6300 Computer Organisation & Program Execution Dr Uwe - - PowerPoint PPT Presentation

comp2300 6300
SMART_READER_LITE
LIVE PREVIEW

COMP2300/6300 Computer Organisation & Program Execution Dr Uwe - - PowerPoint PPT Presentation

COMP2300/6300 Computer Organisation & Program Execution Dr Uwe Zimmer Dr Charles Martin Semester 1, 2019 1 Dr Charles P Martin Thats me! Just started at ANU in mid-semester break. PhD (computer science) at ANU in 2016 PostDoc at


slide-1
SLIDE 1

COMP2300/6300

Computer Organisation & Program Execution Dr Uwe Zimmer Dr Charles Martin Semester 1, 2019

1

slide-2
SLIDE 2

Dr Charles P Martin

That’s me! Just started at ANU in mid-semester break. PhD (computer science) at ANU in 2016 PostDoc at University of Oslo, Norway 2016-2019. Previous/Parallel lives as computer musician and percussionist.

2

slide-3
SLIDE 3

Week 7: Interrupts; Digital Synthesis

3

slide-4
SLIDE 4

info

Assignment 1 marks are out on . Mid-semester exam marks are out. Assignment 2 is out, please get started! Push Early, Push Oten! No lecture this Thursday (25 April, ANZAC day public holiday) No tutorials this Thursday, go to another session this week. streams (see stats)

4

slide-5
SLIDE 5

talk

What’s an interrupt? Explain like I’m 5. What could interrupts be used for? Can you prevent an interrupt?

5

slide-6
SLIDE 6

You’ve probably experienced an interrupt (exception) already! What about “Usage Fault”?

6

slide-7
SLIDE 7

Connecting to the world!

7

slide-8
SLIDE 8

How do we congure an interrupt?

  • 1. Need to enable the interrupt.
  • 2. Need to dene the handler function.
  • 3. Need to congure hardware (if using MCU features).

8

slide-9
SLIDE 9

Where are interrupt vectors dened?

Have a look in startup_stm32l476xx.S: All the interrupt vectors are named here, and linked to a default handler.

g_pfnVectors: .word _estack .word Reset_Handler .word NMI_Handler .word HardFault_Handler .word MemManage_Handler ...

9

slide-10
SLIDE 10

How do we take over an interrupt handler?

Need to redene one of the handler functions. E.g. for EXTI0_IRQHandler:

.global EXTI0_IRQHandler .type EXTI0_IRQHandler, %function EXTI0_IRQHandler: @ do something! bx lr .size EXTI0_IRQHandler, .-EXTI0_IRQHandler

10

slide-11
SLIDE 11

So I want to use the joystick… Isn’t that similar to activating the LEDs?

11

slide-12
SLIDE 12

A map to the joystick…

The joystick centre button is connected to pin PA0 on your disco board.

12

slide-13
SLIDE 13

Connecting it all up

We need to congure GPIOA0 as an input, congure the external interrupt controller (EXTI), and congure the NVIC to make this happen. This is a bit fussy! Enable GPIOA and SYSCFG clocks. Set PA0 to input, and activate pull-down resistor Set PA0 as source for EXTI0 interrupt. Enable EXTI0 interrupts and set EXTI0 to rising edge trigger. Enable EXTI0 interrupts in the NVIC. Let’s do it.

13

slide-14
SLIDE 14

Interrupt archaeology

What about the interrupt handler function and the ? let’s look at an interrupt handler and do some digging… lr? cpsr? caller-save registers (r0-r3)? AAPCS link register status register

14

slide-15
SLIDE 15

talk

What’s the relationship between the concepts of interrupts and concurrency?

15

slide-16
SLIDE 16

Using Synchronisation Primitives

What’s the deal with ldrex and strex?

16

slide-17
SLIDE 17

LDREX

ldrex loads r1 with the memory that r0 is pointing to, and sets that memory

address in the “local exclusive monitor”. It doesn’t do any checking of the exclusive monitor before doing so! Multi-processor systems also have a “global exclusive monitor”… not covered here!

ldr r0, =label_in_data_section ldrex r1, [r0]

17

slide-18
SLIDE 18

STREX

strex tries to store r1 in the memory that r0 is pointing to, but checks the

exclusive monitor rst. If the store is allowed, r2 is set to 0, if it fails then r2 is set to 1. Then what should we do?

ldr r0, =label_in_data_section mov r1, 5 strex r2, r1, [r0] cmp r2, 0 bne do_something_to_recover

18

slide-19
SLIDE 19

When can a strex actually fail?

Need to look in the ARMv7-M reference manual (Section A3.4 “Synchronisation and Semaphores”)

  • 1. If address of strex is tagged exclusive in the local monitor; then store takes

place (woo hoo!)

  • 2. If address of strex is NOT tagged exclusive; then it is “implementation

dened” whether the store takes place (????).

19

slide-20
SLIDE 20

Local Exclusive Monitor

“Any ldrex operation updates the tagged address to the most signicant bits of the address… used for the operation.” (ARMv7-M reference manual) Note that clrex always clears the monitor, and that interrupt handlers run

clrex!

20

slide-21
SLIDE 21

Let's experiment to see how this works.

21

slide-22
SLIDE 22
  • Pt. 2: What do all these synth words

mean?

22

slide-23
SLIDE 23

Sounds?

How do we make interesting sounds with the disco boards?

23

slide-24
SLIDE 24

Digital Synthesis Approaches

Additive synthesis Subtractive synthesis FM (frequency modulation) synthesis Envelopes and ADSR Drums: noise and non-pitched sounds Wavetable synthesis

24

slide-25
SLIDE 25

What’s an Oscillator?

A module (physical or code) that outputs a waveform. In synth lingo, sometimes a VCO (voltage controlled oscillator).

25

slide-26
SLIDE 26

Additive Synthesis

Take multiple oscillators and add them together!

26

slide-27
SLIDE 27

Subtractive Synthesis

Use one oscillator and take sound away.

27

slide-28
SLIDE 28

FM synthesis

“frequency modulation”

28

slide-29
SLIDE 29

talk

So far we’ve made “sounds”, but we want to make “notes”. How can we do that?

29

slide-30
SLIDE 30

Amplitude Envelope

Amplitude is the “volume” of our note.

30

slide-31
SLIDE 31

ADSR Envelope

The adsr shape is oten used for pitched sounds.

31

slide-32
SLIDE 32

Drums and Percussion

Are drums all “non-pitched” sounds?

32

slide-33
SLIDE 33

Wavetable Synthesis

33

slide-34
SLIDE 34

More

Fun “analogue” synth simulation: Powerful “digital” synthesis: Too many oscillators: VCV Rack Pure Data Look Mum No Computer

34

slide-35
SLIDE 35

questions?

35