Download presentation

Presentation is loading. Please wait.

Published byKenia Rover Modified over 2 years ago

1
slider param_definition( minVal, maxVal, increment, pageIncrement, paramName ) { statements } param_definitionParameter description that is printed on the slider object. minVal An integer constant specifying the value to be passed to the function when the position of the slider is at its lowest level. maxVal An integer constant specifying the value to be passed to the function when the position of the slider is at its highest level. increment An integer constant specifying the increment added to the value each time the slider is moved one position. pageIncrement An integer constant specifying the increment added to the value each time the slider is moved by one page. paramName Parameter definition that is used inside the function. The following example uses the slider keyword to add a volume control slider. menuitem "My Functions"; slider VolumeControl(0, 10, 1, 1, volume) { /* initialize the target variable with the parameter passed by the slider object. */ targVarVolume = volume; } GEL

2
Homework (solution) 1. Functional Units a. How many can perform an ADD? Name them. a. How many can perform an ADD? Name them. b. Which support memory loads/stores? b. Which support memory loads/stores?.M.S.D.L six;.L1,.L2,.D1,.D2,.S1,.S2 2. Memory Map a. How many external ranges exist on ‘C6201? Four

3
3. Conditional Code a.Which registers can be used as cond’l registers? b.Which instructions can be conditional? 4. Performance a.What is the 'C6711 instruction cycle time? b.How can the 'C6711 execute 1200 MIPs? A0, A1, A2, B0, B1, B2 All of them CLKOUT1 1200 MIPs = 8 instructions (units) x 150 MHz

4
5. Coding Problems a. Move contents of A0-->A1 a. Move contents of A0-->A1 MV.L1A0, A1 orADD.S1A0, 0, A1 orMPY.M1A0, 1, A1 (what’s the problem with this?)

5
5. Coding Problems a. Move contents of A0-->A1 a. Move contents of A0-->A1 b. Move contents of CSR-->A1 b. Move contents of CSR-->A1 c. Clear register A5 MV.L1A0, A1 orADD.S1A0, 0, A1 orMPY.M1A0, 1, A1 ZERO.S1A5 orSUB.L1A5, A5, A5 orMPY.M1A5, 0, A5 orCLR.S1A5, 0, 31, A5 orMVK.S10, A5 orXOR.L1A5,A5,A5 (A0 can only be a (A0 can only be a 16-bit value) MVCCSR, A1

6
5. Coding Problems (cont’d) d. A2 = A0 2 + A1 d. A2 = A0 2 + A1 e. If (B1 0) then B2 = B5 * B6 e. If (B1 0) then B2 = B5 * B6 f. A2 = A0 * A1 + 10 g. Load an unsigned constant (19ABCh) into register A6. MPY.M1A0, A0, A2 ADD.L1A2, A1, A2 [B1] MPY.M2B5, B6, B2 mvkl.s10x00019abc,a6 mvkh.s10x00019abc,a6 value.equ0x00019abc mvkl.s1value,a6 mvkh.s1value,a6 MPYA0, A1, A2 ADD10, A2, A2

7
5. Coding Problems (cont’d) h.Load A7 with contents of mem1 and post- increment the selected pointer. h.Load A7 with contents of mem1 and post- increment the selected pointer. x16 mem mem1 10h A7 load_mem1:MVKL.S1mem1,A6 load_mem1:MVKL.S1mem1,A6 MVKH.S1mem1,A6 LDH.D1*A6++,A7

8
Pointers and Double Pointers Pointers – a variable that holds an address Short int *Ptr, x[3]; Ptr = &x[1]; Function (ptr); Void Function ( short *ptr) {}

9
Pointers and Double Pointers Pointers – a variable that holds an address Short int *Ptr, x[3]; Ptr = &x[1]; Function (ptr); Void Function ( short *ptr) {}

10
Pointer is passed A-reg = &x[1]

11
Pointer Example Memory 0x100Ptr = 0x102 0x101X[0] 0x102X[1] 0x103X[2] The value in the A-Reg =0x102

12
Pointer address is passed Pointers – a variable that holds an address Short int *Ptr, x[3]; Ptr = &x[1]; Function (&ptr); Void Function ( short **ptr) {}

13
Address of pointer is passed A-Reg = &ptr (not value in pointer)

14
Example Double Pointer Memory 0x100Ptr = 0x102 0x101X[0] 0x102X[1] 0x103X[2] The value in the A-Reg =0x100

15
Example Void function (short *ptr) { *ptr = 2; } // This means memory location 0x102 has a 2 in that location Void function (short **ptr) { **ptr = 2; // This means memory location 0x102 has a 2 in that location *ptr = 2; // this means memory location 0x100 has a 2 in its location }

16
Examples Memory 0x100Ptr = &x[1] = 0x102 0x101X[0] 0x102X[1] = 2 0x103X[2] Memory 0x100Ptr = &x[1] = 0x102 0x101X[0] 0x102X[1] = 2 Memory 0x1002 0x101X[0] 0x102X[1]

17
Sine Wave Generation Function Call to standard library Taylor Series Table Look-up Algorithm

18
Table LookUp Create a table of values for 1 cycle of a sine wave Create a function that takes table values and places them in an output array The higher the number of table entries, the higher the precision of the sine wave

19
Table LookUp A Table of 128 values from 0 to 2Pi is –Table[I] = sin (2*PI*I/128) Let Sampling Rate = 8000 hz, (Period=125 usec) If OutputArray[I] = Table[I] –1cycle / (125usec*128) = 62.5 hz. If OutputArray[I] = Table[2*I] –1 cycle / (125usec*64) = 125 hz.

20
Continued If OutputArray[I] = Table[128*I] –1 cycle / (125usec * 1) = 8000 hz. –OutputArray[I] = 0 (DC) Resolution = 62 hz. For Higher resolution increase Table Size

21
Frequency as a function of step size and table size 641285121024 1 125 hz62.5 hz15.625 hz7.8125 hz 2 250 hz125 hz31.25 hz15.625 hz 32 4000 hz2000 hz500 hz250 hz 128 x8000 hz2000 hz1000 hz stepsize Table size

22
SineWave Oscillator H(z) = 1 / (1-a*z^-1 + z^-2) Y[n] = x[n] + a*y[n-1] + y[n-2]

23
SineWave Oscillator Y[n] = A * sin (2PI * n * f / f s ) Variables –frequency – f –Sampling frequency – f s –Amplitude - A

24
Z-Transform

25
SineWave Oscillator Y[n] is produced by treating Y[z] as a product of H(z)X(z), where X(z) = 1 X[n] is an Impulse Function, x[0]=1, 0 elsewhere Now find the difference equation

26
SineWave Oscillator

27
Example Let A=1, f=1476Hz, f s =8000hz W= 2Pi*1476/8000=1.1592 Sin(w)= 0.9165 Cos(w)=0.8

28
Homework Add to “sine.gel” an Amplitude Controlled slider Verify it’s operation Page 115 –Problem 1 –Problem 2

Similar presentations

OK

Fundamentals of C and C++ Programming. EEL 3801 – Lotzi Bölöni Sub-Topics Basic Program Structure Variables - Types and Declarations Basic Program.

Fundamentals of C and C++ Programming. EEL 3801 – Lotzi Bölöni Sub-Topics Basic Program Structure Variables - Types and Declarations Basic Program.

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google