Académique Documents
Professionnel Documents
Culture Documents
Function Description
The C8254 programmable interval timer/counter megafunction is a highperformance device designed to solve the common timing control problems in microcomputer system design. It provides three independent 16-bit counters, and each counter may operate in a different mode. All modes are software programmable. The C8254 solves one of the most common problems in any microcomputer system, the generation of accurate time delays under software control. Instead of setting up timing loops in software, the C8254 can be programmed to match the requirements by programming one of the counters for the desired delay.
Features
Status Read-Back Command Counter Latch Command Read/Write LSB only or MSB only or LSB first then MSB Six Programmable Counter Modes: - Interrupt on Terminal Count - Hardware Retriggerable One-Shot - Rate Generator - Square Wave Mode - Software Triggered Strobe - Hardware Triggered Strobe (Retriggerable) Binary or BCD Counting The C8254 is available in VHDL or Verilog and synthesizes to approximately 5,000 gates depending on the technology used Functionality based on the INTEL 82C54
Symbol
A[1:0] CSn RDn WRn CLK0 GATE0 CLK1 GATE1 CLK2 GATE2 RESETn
CAST, Inc.
1/1
Pin Description
Name D_IN[7:0] A[1:0] CSn RDn WRn RESETn CLK0 GATE0 CLK1 GATE1 CLK2 GATE2 D_OUT[7:0] OUT0 OUT1 OUT2 Type In In In In In In In In In In In In Out Out Out Out Polarity Low Low Low Low Falling Falling Falling Description Input Data Bus Address Chip Select Read Control Write Control Reset internal Registers Clock input of Counter 0 Gate input of Counter 0 Clock input of Counter 1 Gate input of Counter 1 Clock input of Counter 2 Gate input of Counter 2 Output Data Bus Output of Counter 0 Output of Counter 1 Output of Counter 2
Block Diagram
RDn WRn CSn A[1:0] RESETn Program Read/ Write Logic CLK1 Counter 1 GATE1 OUT1
Figure 2: Counter
CLK2
Diagram
Counter 2
GATE2 OUT2
CAST, Inc.
2/2
Functional Description
The C8254 megafunction is partitioned into modules as shown in figures 1 & 2 and described below:
Read/Write Logic
The Read/Write Logic accepts inputs from the system bus and generates control signals for the other functional blocks of the C8254. A1 and A0 select one of the three counters or the control word register to be read from /written into. A low on RDn tells the C8254 that the CPU is reading one of the counters. A low on the WRn input tells the C8254 that the CPU is writing either a Control Word or an initial count. Both RDn and WRn are qualified by CSn. RDn and WRn are ignored unless the C8254 has been selected by holding CSn low.
RW1 RW0 0 0 Counter Latch Command 0 1 Read/Write LSB only 1 0 Read/Write MSB only 1 1 Read/Write LSB first, then MSB M2 0 0 X X 1 1 BCD 0 1 M1 0 0 1 1 0 0 M0 0 1 0 1 0 1
CAST, Inc.
3/3
READ/WRITE CONTROL
16-Bit Counter CE16 Control Logic 8-Bit Status Register 16-Bit Output Latch OLREG
READ COUNTER
Control Logic
This block controls the 16-bit counter for all counting modes and the Null flag of the counter.
Counter Registers
There are two 8-bit registers called CRM and CRL. Both are normally referred to as one unit and called just CR. When a new count is written to the Counter, the count is stored in the CR and later transferred to the CAST, Inc. 4/4
16-Bit Counter
This block contains a 16-bit Binary or BCD presettable synchronous down counter.
Bits D5 through D0 contain the counters programmed Mode. Output bit D7 contains the current state of the OUT pin. This allows the user to monitor the counters output via software. Null Count bit D6 indicates when the last count written to the counter register has been loaded into the counting element (CE16). The exact time this happens depends on the Mode of the counter.
Read Counter
If both the count and the status of a counter are latched, the first read operation of that counter will return the latched status, regardless of which was latched first. The next one or two reads (depending on whether the counter is programmed for one or two byte counts) returns the latched count. Subsequent reads return the unlatched count. If the counter is programmed for two byte counts, it will read the LSB first then the MSB at the next read cycle.
Applications
The six programmable timer modes allow the C8254 to be used in applications requiring event counters, elapsed time indicators, and programmable one-shots among others.
Megafunction Assumptions
Counter During programming the counter outputs are undefined. The C8254 will stop counting while the counter is being programmed or during a write control word until it loads the initial count from the counter register to the counting element (CE16). If there is a read cycle after the programming, it will read the last counter output data before the start of the programming.
Verification Methods
The C8254 megafunctions functionality was verified by means of a proprietary hardware modeler. The same stimulus was applied to a hardware model that contained the original Intel 82C54 chip, and the results compared with the megafunctions simulation outputs.
CAST, Inc.
5/5
Deliverables
Encrypted Licenses Post-synthesis AHDL Assignment & Configuration Symbol file Include file Vectors for testing the functionality of the megafunction HDL Source Licenses VHDL or Verilog RTL source code Testbench Example testbench wrapper for post-route simulation Vectors for testbench Simulation script Synthesis script Expected results for testbench
Megafunction Modifications
The C8254 megafunction can be customized to include additional counters. Please contact CAST for any required modifications.
CAST, Inc.
11 Stonewall Court Woodcliff Lake, New Jersey 07677 USA Phone: Fax: E-Mail: URL : +1 845-353-6160 +1 845-727-7607 info@cast-inc.com www.cast-inc.com
CAST, Inc.
6/6