CSCE 3612 ch5-1

CSCE 3612 ch5-1 - Program design and analysis Software...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon
© 2008 Wayne Wolf Overheads for Computers as Components 2 nd ed. Program design and analysis Software components. Representations of programs. Assembly and linking.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
© 2008 Wayne Wolf Overheads for Computers as Components 2 nd ed. Software state machine State machine keeps internal state as a  variable, changes state based on inputs. Uses: control-dominated code; reactive systems.
Background image of page 2
© 2008 Wayne Wolf Overheads for Computers as Components 2 nd ed. State machine example idle buzzer seated belted no seat/- seat/timer on no belt and no timer/- no belt/timer on belt/- belt/ buzzer off Belt/buzzer on no seat/- no seat/ buzzer off
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
© 2008 Wayne Wolf Overheads for Computers as Components 2 nd ed. C implementation #define IDLE 0 #define SEATED 1 #define BELTED 2 #define BUZZER 3 switch (state) { case IDLE: if (seat) { state = SEATED; timer_on = TRUE; } break; case SEATED: if (belt) state = BELTED; else if (timer) state = BUZZER; break; }
Background image of page 4
© 2008 Wayne Wolf Overheads for Computers as Components 2 nd ed. Signal processing and circular buffer Commonly used in signal processing: new data constantly arrives; each datum has a limited lifetime. Use a circular buffer to hold the data  stream. d1 d2 d3 d4 d5 d6 d7 time t ime t+1
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
© 2008 Wayne Wolf Overheads for Computers as Components 2 nd ed. Circular buffer x1 x2 x3 x4 x5 x6 t 1 t 2 t 3 Data stream x1 x2 x3 x4 Circular buffer x5 x6 x7
Background image of page 6
© 2008 Wayne Wolf Overheads for Computers as Components 2 nd ed. Circular buffers Indexes locate currently used data,  current input data: d1 d2 d3 d4 time t1 use input d5 d2 d3 d4 time t1+1 use input
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
© 2008 Wayne Wolf Overheads for Computers as Components 2 nd ed. Circular buffer implementation: FIR filter int circ_buffer[N], circ_buffer_head = 0; int c[N]; /* coefficients */ int ibuf, ic; for (f=0, ibuff=circ_buff_head, ic=0; ic<N; ibuff=(ibuff==N-1?0:ibuff++), ic++) f = f + c[ic]*circ_buffer[ibuf];
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 33

CSCE 3612 ch5-1 - Program design and analysis Software...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online