Homework Reading Machine Projects Labs

Slides:



Advertisements
Similar presentations
Parul Polytechnic Institute
Advertisements

1 Homework Reading –Intel 8254 Programmable Interval Timer (PIT) Data Sheet Machine Projects –Continue on MP3 Labs –Continue in labs with your assigned.
Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati I/O + Timer 8155 I/O + Timer 8255 I/O 8255 I/O 8253/54 Timer 8253/54 Timer 2 Port (A,B), No Bidirectional.
Programmable Interval Timer
8253/54 Timer Section /54 Timer Description and Initialization
The 8085 Microprocessor Architecture
Microprocessor and Microcontroller
I/O Unit.
CSCI 4717/5717 Computer Architecture
1 Homework Reading –Review previous material on “interrupts” Machine Projects –MP4 Due today –Starting on MP5 (Due at start of Class 28) Labs –Continue.
Interrupts What is an interrupt? What does an interrupt do to the “flow of control” Interrupts used to overlap computation & I/O – Examples would be console.
1 Computer System Overview OS-1 Course AA
Homework / Exam Return and Review Exam #1 Reading Machine Projects
Counters and Registers
Interrupts. What Are Interrupts? Interrupts alter a program’s flow of control  Behavior is similar to a procedure call »Some significant differences.
8254 Programmable Interval Timer
ENEE 440 Chapter Timer 8254 Register Select The 8254 timer is actually 3 timers in one. It is an upgraded version of the 8253 timer which was.
8253 TIMER. Engr 4862 Microprocessors 8253 / 8254 Timer A.k.a. PIT (programmable Interval Timer), used to bring down the frequency to the desired level.
PIT: Programmable Interval Timer
8254 Counter/Timer Counter Each of the three counter has 3 pins associated CLK: input clock frequency- 8 MHz OUT GATE: Enable (high) or disable.
Computer System Overview Chapter 1. Operating System Exploits the hardware resources of one or more processors Provides a set of services to system users.
The 8253 Programmable Interval Timer
MICROPROCESSOR INPUT/OUTPUT
Timers.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
8254 Timer.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
Introduction to Microprocessors - chapter3 1 Chapter 3 The 8085 Microprocessor Architecture.
Chapter 3 : Top Level View of Computer Functions Basic CPU function, Interconnection, Instruction Format and Interrupt.
Structure and Role of a Processor
The 8085 Microprocessor Architecture. What 8085 meant for? 80 - year of invention bit processor 5 - uses +5V for power.
Homework Reading Machine Projects
Homework / Exam Return and Review Exam #1 Reading Machine Projects
Homework Reading Machine Projects Labs
The 8085 Microprocessor Architecture
68HC11 Interrupts & Resets.
Timer and Interrupts.
Introduction An interrupt is an event which informs the CPU that its service (action) is needed. Sources of interrupts: Internal fault (e.g.. divide by.
Discussions on hw5 Objectives:
8254 – SOFTWARE PROGRAMMABLE TIMER
The 8085 Microprocessor Architecture
Homework Reading Labs S&S Extracts ,
Programmable Interval Timer
Programmable Interval Timer
Programmable Interval Timer
Programmable Interval Timer 8254 LECTURE 3
Homework Reading Machine Projects Labs
Dr. Michael Nasief Lecture 2
8085 Microprocessor Architecture
The 8085 Microprocessor Architecture
Homework Reading Continue work on mp1
Instructions at the Lowest Level
8259 Chip The Intel 8259 is a family of Programmable Interrupt Controllers (PIC) designed and developed for use with the Intel 8085 and Intel 8086 microprocessors.
8253 Timer In software programming of 8085, it has been shown that a delay subroutine can be programmed to introduce a predefined time delay. The delay.
An Introduction to Microprocessor Architecture using intel 8085 as a classic processor
Interrupt Driven I/O References Text: Tanenbaum ch.1.4.3, ch Receiver Interrupt Program Example:
8254 Timer and Counter (8254 IC).
Discussions on hw5 Objectives:
Instruction cycle Instruction: A command given to the microprocessor to perform an operation Program : A set of instructions given in a sequential.
Morgan Kaufmann Publishers Computer Organization and Assembly Language
Programmable Interval timer 8253 / 8254
8085 Microprocessor Architecture
Programmable Interval timer 8253 / 8254
The 8085 Microprocessor Architecture
8253 – PROGRAMMABLE INTERVAL TIMER (PIT). What is a Timer? Timer is a specialized type of device that is used to measure timing intervals. Timers can.
8085 Microprocessor Architecture
Computer System Overview
Programmable Interrupt Controller (PIC)
Programmable Interval Timer
Computer Operation 6/22/2019.
Presentation transcript:

Homework Reading Machine Projects Labs Intel 8254 Programmable Interval Timer (PIT) Data Sheet http://www.cs.umb.edu/~cheungr/cs341/I8254PIT.pdf Machine Projects Continue on MP3 Labs Continue in labs with your assigned section

Programmable Interval Timer This is just an overview – Read data sheet 8254 VLSI chip with three 16 bit counters Each counter: Is decremented based on an input clock (for PC, the clock’s frequency is 1.193 MHz) Is only decremented while its gate is active Generates its own output clock = input clock / count length Generates an interrupt when count value reaches zero Automatically reloads initial value when it reaches zero

PIT Device (Timer 0) Simplest device: always is interrupting, every time it down counts to zero Can’t disable interrupts in this device! Can mask them off in the PIC We can control how often it interrupts Timer doesn’t keep track of interrupts in progress—just keeps sending them in We don’t need to interact with it in the ISR (but we do need to send an EOI to the PIC)

Use of PIT in MP3 For a count=0, PIT counter0 will generate an interrupt every 55 millisecs(or 18.2 times/sec ) ISR increments “tickcount” each time We read the 16 bit counter to get value of the counter at 55 millisec / 64K resolution This gives us resolution of ____ microsecs (You have to figure that out as a part of mp3)

Use of PIT in MP3 MP3 gives you a start for the required C code in timepack_sapc.c. You add to it. You do not need to write the code for the PIT initialization or the interrupt service routine However, you should study the C code to understand how it works: Find where code disables and enables interrupts Find the PIT initialization code Find the PIT ISR code and see what it does Figure out how to read the count in progress to get the improved resolution required for mp3

Timer Interrupt Software Initialization Disallow interrupts in CPU (cli) Unmask IRQ0 in the PIC by ensuring bit 0 is 0 in the Interrupt Mask Register accessible via port 0x21 Set up interrupt gate descriptor in IDT, using irq0inthand Set up timer downcount to determine tick interval Allow interrupts (sti) Shutdown Disallow interrupts (cli) Disallow timer interrupts by masking IRQ0 in the PIC by making bit 0 be 1 in the Mask Register (port 0x21)

Timer Interrupts: Interrupt Handler (Two Parts) irq0inthand – the outer assembly language interrupt handler Save registers Calls C function irq0inthandc Restore registers Iret irq0inthandc - the C interrupt handler Issues EOI Increase the tick count, or whatever is wanted

PIT Characteristics PIT chip has four I/O ports assigned to it: A1 A0 Timer 0 assigned port 40 = 0100 0000 Timer 1 assigned port 41 = 0100 0001 Timer 2 assigned port 42 = 0100 0010 Control assigned port 43 = 0100 0011 Chip selected by “chip select” and A1-A0 Other signals include read, write, and data

Control Word Format Actually only a byte: SC1-SC0 select which counter to write/read RW1-RW0 to latch value or select which byte of count value M2-M0 determines which operating mode BCD specifies whether binary or BCD count Command formats found in datasheet SC1 SC0 RW1 RW0 M2 M1 M0 BCD

Using the PIT in C Refer to timer.h #define TIMER0_COUNT_PORT 0X40 #define TIMER_CNTRL_PORT 0X43 /* bits 6-7: */ #define TIMER0 (O<<6) #define TIMER1 (1<<6) /* Bits 4-5 */ #define TIMER_LATCH (0<<4) #define TIMER_SET_ALL (3<<4) /* Bits 1-3 */ #define TIMER_MODE_RATEGEN (2<<1) /* Bit 0 */ #define TIMER_BINARY_COUNTER 0

Programming the PIT Bits to initialize Output to the timer I/O port TIMER0 | TIMER_SET_ALL | TIMER_RATEGEN |TIMER_BINARY_COUNTER Output to the timer I/O port outpt(TIMER_CNTRL_PORT, …); Then load the downcount outpt(TIMER0_COUNT_PORT, count & 0xFF); // LSByte outpt(TIMER0_COUNT_PORT, count >> 8); // MSByte

What Are the PIT Modes? Mode 0: Count value loaded and countdown occurs on every clock signal; Out from counter remains low until count reaches 0 when it goes high Mode 2: Counts down from loaded value; when count has decremented to 1, OUT goes low for one clock pulse and then goes high again; count is reloaded and process repeats Count = 1 Count = 0

What Are the PIT Modes? (Cont’d) Mode 3: Functions as a divide by n square wave generator, where n is the count value; OUT starts high and alternates between low and high.

PIT Interface to Processor Internal counters are 16 bits (2 bytes) Only 8 pins connected to the data bus Must use a sequence of two one-byte “in” or “out” instructions to transfer full 16 bits Must “latch” count in progress to read a valid 16 bit value only 8 bits at a time Borrow Input Clock Output Clock 8 8 Two 1 byte reads (Borrow between?)

Reading the Count Values Want to read the count value without disturbing the count in progress Have to consider that the counter is changing while we are attempting to read it Best way to read the count is to use the counter latch command to temporarily latch the count outpt(TIMER_CNTRL_PORT, TIMER0 |TIMER_LATCH); count = inpt(TIMER0_COUNT_PORT); count |= (inpt(TIMER0_COUNT_PORT) << 8); Reading the count lets the latch again follow the count

Converting Counts to Real Time Can count from 1 to 64K, that is from approximately one microsecond to 55 milliseconds What if we want something longer than that? Have to perform repeated counts Example: 200 milliseconds = 3 * 55 +35 Would need three full counts (called ticks) plus a partial count (called downcounts) But how do you know when a tick has occurred? Could poll the device Better to use an interrupt If interrupt occurs on every tick, which is counted, then the elapsed time in microseconds is approximately: [#ticks * 65536 + (startcount - stopcount)]/1.193

Measuring the Time Interval Given Event A happens 35K downcounts before tick 201 Event B happens 43K downcounts before tick 203 How much time has elapsed? Graphically: 35K down counts left 43K down counts left Tick 200 Tick 201 Tick 202 Tick 203 Elapsed time = 202 ticks + (65K – 43K) downcounts - (200 ticks + (65K – 35K) downcounts) = 2 ticks – 8K down counts (where 1 tick = 64 * 1K down counts)

Main Memory Access One bus cycle per memory read or write Calculating bus cycles: Instructions fetched 8 bytes at a time Average: one eighth of a bus cycle per byte of an instruction Data reads/writes – byte, word, or long word at a time movl %eax, %edx reg/reg instruction (2 bytes) .25R movl %eax, total reg/mem instruction* (5 bytes) 0.625R+1W movl %edx, total reg/mem instruction (6 bytes) 0.75R+1W *eax as accumulator is special case

Cache Memory Located between CPU and main memory Holds a copy of most recently accessed data L1 cache implemented with “hidden” registers Not visible to assembly language programmer L2 cache implemented with SRAM memory Faster access than DRAM main memory Typically larger than L1 cache Either cache speeds up access to most recently and frequently accessed memory locations Reduces a bus cycle to main memory when data is found in cache (“cache hit”)

Cache Memory Control Bus (M/IO#, W/R# and D/C# Signals) Processor Fetch and Execute Control Address Bus L2 Cache (SRAM) Main Memory (DRAM) I/O Devices “Regular” Registers L1 Cache (“Hidden” Registers) Data Bus