Académique Documents
Professionnel Documents
Culture Documents
] [Tutoriales]
[Placas de prototipado] [Placas de expansión] [Data Sheets] [Application Notes] [Ejecutables] [Miscelánea]
Copias de transparencias
● Temario
❍ Tema 1. Diseño automático
■ Memorias SRAM.
■ Procesado de vídeo.
■ Comunicación ethernet.
● Temas adicionales
❍ Tema 7. Especificación a nivel RT de sistemas HW.
❍ Tema 8. Especificación a nivel RT-algorítmico de sistemas HW usando VHDL.
❍ Tema 9. Técnicas de diseño de nivel RT.
● VHDL
❍ VHDL'87 completo - Un repaso de las construcciones del lenguaje que presta especial atención a su
utilidad en modelado de sistemas digitales.
❍ VHDL'87, subconjunto sintetizable de nivel RT-lógico - Describe el subconjunto de construcciones VHDL
admisibles por una herramienta de síntesis lógica-RT, cómo se implementan y cómo deben ser
utilizadas para especificar sistemas digitales.
❍ VHDL'87, subconjunto sintetizable de alto nivel - Describe el subconjunto de construcciones VHDL
admisibles por una herramienta de síntesis de alto nivel, cómo se implementan y cómo deben ser
utilizadas para especificar sistemas digitales.
● Técnicas de diseño
❍ Especificación a nivel RT de sistemas HW - Describe las nociones de ASM y cómo usarlo para
❍ Fundamentos del diseño hardware - Repaso de nociones de electrónica, diseño hardware básico, etc.
● Synopsys
❍ Synopsys VHDL System Simulator - Arquitectura del simulador: herramientas y comandos.
❍ Synopsys Design Compiler - Arquitectura del sintetizador de nivel lógico-RT: ciclo de diseño,
herramientas y comandos.
❍ Synopsys Behavioral Compiler - Arquitectura del sintetizador de alto nivel: ciclo de diseño, herramientas
y comandos.
● Xilinx Foundation
❍ Xilinx Foundation - Arquitectura del entorno de síntesis.
❍ Diseño didáctico: SRAM1 (vhdl, ucf placa tipo A-B-C, ucf placa tipo D)
❍ Diseño didáctico: SRAM2 (vhdl, ucf placa tipo A-B-C, ucf placa tipo D)
❍ Diseño didáctico: SRAM3 (vhdl, ucf placa tipo A-B-C, ucf placa tipo D)
❍ Diseño didáctico: SRAM4 (vhdl, ucf placa tipo A-B-C, ucf placa tipo D)
■ Diseño didáctico: VGA (vhdl, ucf placa tipo A-B-C, ucf placa tipo D)
■ Diseño didáctico: graphic (vhdl, ucf placa tipo A-B-C, ucf placa tipo D)
■ Diseño didáctico: alphanum (vhdl, ucf placa tipo A-B-C, ucf placa tipo D)
■ Diseño didáctico: terminal (vhdl, ucf placa tipo A-B-C, ucf placa tipo D)
❍ Diseño didáctico: bipper (vhdl, ucf placa tipo A-B-C, ucf placa tipo D)
● Modulación de señales:
❍ Generador de formas de onda (estructura, vhdl).
❍ Generador de frecuencia (estructura, vhdl).
❍ Modulador de pulsos (estructura, vhdl).
● Conversión de código:
❍ Conversores entre códigos binario y Gray (estructura, vhdl).
● Varios:
❍ Multiplicador por constante (estructura, vhdl).
Tutoriales
● Foundation Series 2.1i In-Depth Tutorials - Tutorial de XILINX Foundation.
Placas de prototipado
● XS40-010XL Board:
❍ Características.
❍ Manual de usuario de los microcontroladores de la familia 8051 fabricados por OKI Semiconductor.
❍ Manual de usuario del ensamblador cruzado para los microcontroladores de la familia 8051.
● XSA-100 Board:
❍ Características.
● XStend Board:
❍ Características (v1.x, v2.x).
● XSV-800 Board
❍ Características.
● APS - V240
❍ Manual de usuario
❍ Esquemáticos
Placas de expansión
(diseñadas y contruídas por Carlos Roa Romero)
● Teclado numérico:
❍ Características.
❍ Esquemático (v1.0).
❍ Esquemático (v1.0).
● Matriz de leds:
❍ Características.
❍ Esquemático (v2.0).
● LCD
❍ Características.
❍ Esquemático (v1.0).
❍ Esquemático (v1.0).
● Zumbador y altavoz
❍ Características.
❍ Esquemático (v1.0).
Data Sheets
(componentes de las placas de prototipado y de expansión)
❍ AK4520A - Conversor A/D & D/A estéreo de 20 bits (Asahi Kasei Microsystems).
❍ AK4520A - Conversor A/D & D/A estéreo de 20 bits (Asahi Kasei Microsystems).
● XSV-800 v1.0 (Xess Corporation):
❍ XCV800 - FPGA de 800K puertas (Xilinx).
❍ SAA7113 - Procesador de video de 9 bits, sistemas NTSC, SECAM y PAL (Philips Semiconductors).
❍ AK4520A - Conversor A/D & D/A estéreo de 20 bits (Asahi Kasei Microsystems).
● Matriz de leds:
❍ 74HC594 - Registro de desplazamiento de 8 bits con salida registrada.
● LCD
❍ AC162B - LCD alfanumérico 16x2 (Ampire).
❍ KS0066U - Controlador de LCDs matriciales (Samsung Electronics).
❍ HD44580 - Controlador de LCDs matriciales (Hitachi).
Application Notes
● Xess Corporation:
❍ Microcontroller + FPLD Designs with the XS40 & XS95 Boards.
Generators.
❍ XAPP 057 July 7, 1996 - Usign Select-RAM Memory in XC4000 Series FPGAs.
❍ XAPP 107 August 6, 1998 - Synopsys/Xilinx High Density Design Methodology Usign FPGA Compiler.
❍ XBRF 014 June 30, 1997 - A Simple Method of Estimating Power in XC4000XL/EX/E FPGAs.
❍ XAPP 137 March 1, 1999 - Configuring Virtex FPGAs from Parallel EPROMs with a CPLD.
❍ XAPP 138 February 24, 2000 - Virtex FPGA Series Configuration and Readback.
❍ XAPP 151 February 22, 2000 - Virtex Series Configuration Architecture User Guide.
Ejecutables
● Placas de prototipado:
❍ Test para las placas de prototipado XS40+XStend (v1.2, v1.3).
❍ XStools (v1.5, v2.0.3, v3.0.0, v.4.0, v4.0.2, v4.0.3) - utilidades software para el manejo de las placas de
Miscelánea
● Especificaciones de interfaces estándar:
2
❍ I C - Especificación del Inter Integrated Circuit Bus.
ENTITY debouncer IS
PORT (
rst: IN std_logic;
clk: IN std_logic;
x: IN std_logic;
xDeb: OUT std_logic;
xDebFallingEdge: OUT std_logic;
xDebRisingEdge: OUT std_logic
);
END debouncer;
BEGIN
synchronizer:
PROCESS (rst, clk)
VARIABLE aux1: std_logic;
BEGIN
IF (rst='0') THEN
aux1 := '1';
xSync <= '1';
ELSIF (clk'EVENT AND clk='1') THEN
xSync <= aux1;
aux1 := x;
END IF;
END PROCESS synchronizer;
timer:
-- espera 50 ms para un reloj a 12.5 MHz
PROCESS (rst, clk)
CONSTANT timeOut: std_logic_vector (19 DOWNTO 0) := "10011000100101101000";
VARIABLE count: std_logic_vector (19 DOWNTO 0);
BEGIN
IF (count=timeOut) THEN
timerEnd <= '1';
ELSE
timerEnd <= '0';
END IF;
IF (rst='0') THEN
count := timeOut;
ELSIF (clk'EVENT AND clk='1') THEN
IF (startTimer='1') THEN
count := (OTHERS=>'0');
ELSIF (timerEnd='0') THEN
count := count + 1;
END IF;
END IF;
END PROCESS timer;
controller:
PROCESS (xSync, rst, clk)
TYPE states IS (waitingPression, pressionDebouncing, waitingDepression, depressionDebouncing);
VARIABLE state: states;
BEGIN
xDeb <= '1';
xDebFallingEdge <= '0';
xDebRisingEdge <= '0';
startTimer <= '0';
CASE state IS
WHEN waitingPression =>
IF (xSync='0') THEN
xDebFallingEdge <= '1';
startTimer <= '1';
END IF;
WHEN pressionDebouncing =>
xDeb <= '0';
WHEN waitingDepression =>
xDeb <= '0';
IF (xSync='1') THEN
xDebRisingEdge <= '1';
startTimer <= '1';
END IF;
WHEN depressionDebouncing =>
NULL;
END CASE;
IF (rst='0') THEN
state := waitingPression;
ELSIF (clk'EVENT AND clk='1') THEN
CASE state IS
WHEN waitingPression =>
IF (xSync='0') THEN
state := pressionDebouncing;
END IF;
WHEN pressionDebouncing =>
IF (timerEnd='1') THEN
state := waitingDepression;
END IF;
WHEN waitingDepression =>
IF (xSync='1') THEN
state := depressionDebouncing;
END IF;
WHEN depressionDebouncing =>
IF (timerEnd='1') THEN
state := waitingPression;
END IF;
END CASE;
END IF;
END PROCESS controller;
END debouncerArch;
NET rst LOC=P37;
NET clk LOC=P13;
ENTITY ps2KeyboardInterface IS
PORT (
clk: IN std_logic;
rst: IN std_logic;
ps2Clk: IN std_logic;
ps2Data: IN std_logic;
data: OUT std_logic_vector (7 DOWNTO 0);
newData: OUT std_logic;
newDataAck: IN std_logic
);
END ps2KeyboardInterface;
BEGIN
synchronizer:
PROCESS (rst, clk)
VARIABLE aux1: std_logic;
BEGIN
IF (rst='0') THEN
aux1 := '1';
ps2ClkSync <= '1';
ELSIF (clk'EVENT AND clk='1') THEN
ps2ClkSync <= aux1;
aux1 := ps2Clk;
END IF;
END PROCESS synchronizer;
edgeDetector:
PROCESS (rst, clk)
VARIABLE aux1, aux2: std_logic;
BEGIN
ps2ClkFallingEdge <= (NOT aux1) AND aux2;
IF (rst='0') THEN
aux1 := '1';
aux2 := '1';
ELSIF (clk'EVENT AND clk='1') THEN
aux2 := aux1;
aux1 := ps2ClkSync;
END IF;
END PROCESS edgeDetector;
ps2DataReg:
PROCESS (rst, clk)
BEGIN
IF (rst='0') THEN
ps2DataRegOut <= (OTHERS =>'1');
ELSIF (clk'EVENT AND clk='1') THEN
IF (lastBitRcv='1') THEN
ps2DataRegOut <= (OTHERS=>'1');
ELSIF (ps2ClkFallingEdge='1') THEN
ps2DataRegOut <= ps2Data & ps2DataRegOut(10 downto 1);
END IF;
END IF;
END PROCESS ps2DataReg;
oddParityCheker:
goodParity <=
((ps2DataRegOut(9) XOR ps2DataRegOut(8)) XOR (ps2DataRegOut(7) XOR ps2DataRegOut(6)))
XOR ((ps2DataRegOut(5) XOR ps2DataRegOut(4)) XOR (ps2DataRegOut(3) XOR ps2DataRegOut(2)))
XOR ps2DataRegOut(1);
dataReg:
PROCESS (rst, clk)
BEGIN
IF (rst='0') THEN
data <= (OTHERS=>'0');
ELSIF (clk'EVENT AND clk='1') THEN
IF (ldData='1') THEN
data <= ps2DataRegOut(8 downto 1);
END IF;
END IF;
END PROCESS dataReg;
controller:
PROCESS (validData, rst, clk)
TYPE states IS (waitingData, waitingNewDataAck);
VARIABLE state: states;
BEGIN
ldData <= '0';
newData <= '0';
CASE state IS
WHEN waitingData =>
IF (validData='1') THEN
ldData <= '1';
END IF;
WHEN waitingNewDataAck =>
newData <= '1';
WHEN OTHERS => NULL;
END CASE;
IF (rst='0') THEN
state := waitingData;
ELSIF (clk'EVENT AND clk='1') THEN
CASE state IS
WHEN waitingData =>
IF (validData='1') THEN
state := waitingNewDataAck;
END IF;
WHEN waitingNewDataAck =>
IF (newDataAck='1') THEN
state := waitingData;
END IF;
WHEN OTHERS => NULL;
END CASE;
END IF;
END PROCESS controller;
END ps2KeyboardInterfaceArch;
NET clk LOC=P13;
NET rst LOC=P37;
ENTITY VGAtiming IS
PORT (
rst: IN std_logic;
clk: IN std_logic;
hSync: OUT std_logic;
vSync: OUT std_logic;
RGB: OUT std_logic_vector(5 DOWNTO 0)
);
END VGAtiming;
BEGIN
pixelCnt:
PROCESS( rst, clk )
BEGIN
IF (rst='0') THEN
pixelCntOut <= (OTHERS=>'0');
ELSIF(clk'EVENT AND clk='1') THEN
IF (pixelCntOut=396) THEN
pixelCntOut <= (OTHERS=>'0');
ELSE
pixelCntOut <= pixelCntOut+1;
END IF;
END IF;
END PROCESS pixelCnt;
lineCnt:
PROCESS( rst, clk )
begin
IF (rst='0') THEN
lineCntOut <= (OTHERS=>'0');
ELSIF (clk'EVENT AND clk='1') THEN
IF (pixelCntOut=396) THEN
IF (lineCntOut=527) THEN
lineCntOut <= (others=>'0');
ELSE
lineCntOut <= lineCntOut+1;
END IF;
END IF;
END IF;
END PROCESS lineCnt;
hSync <= '0' WHEN (pixelCntOut > 325) AND (pixelCntOut < 373) ELSE '1';
vSync <= '0' WHEN (lineCntOut > 493) AND (lineCntOut < 496) ELSE '1';
blanking <= '1' WHEN (pixelCntOut > 313) OR (lineCntOut > 479) ELSE '0';
valor <= (pixelCntOut(3) XOR lineCntOut(4)) AND NOT blanking;
RGB <= valor & valor & valor & valor & valor & valor;
END VGAtimingArch;
NET rst LOC=P37;
NET clk LOC=P13;
Design Implementation
Timing Simulation
Additional Resources
For additional information, go to http://support.xilinx.com. The
following table lists some of the resources you can access from this
page. You can also directly access some of these resources using the
provided URLs.
Resource Description/URL
Tutorial Tutorials covering Xilinx design flows, from design entry to verification
and debugging
http://support.xilinx.com/support/techsup/tutorials/index.htm
Answers Current listing of solution records for the Xilinx software tools
Database Search this database using the search function at
http://support.xilinx.com/support/searchtd.htm
Application Descriptions of device-specific design techniques and approaches
Notes http://support.xilinx.com/apps/appsweb.htm
Resource Description/URL
Data Book Pages from The Programmable Logic Data Book, which describe device-
specific information on Xilinx device characteristics, including
readback, boundary scan, configuration, length count, and debugging
http://support.xilinx.com/partinfo/databook.htm
Xcell Journals Quarterly journals for Xilinx programmable logic users
http://support.xilinx.com/xcell/xcell.htm
Tech Tips Latest news, design tips, and patch information on the Xilinx design
environment
http://support.xilinx.com/support/techsup/journals/index.htm
Typographical
The following conventions are used for all documents.
• Courier font indicates messages, prompts, and program files
that the system displays.
speed grade: -100
• Courier bold indicates literal commands that you enter in a
syntactical statement. However, braces “{ }” in Courier bold are
not literal and square brackets “[ ]” in Courier bold are literal
only in the case of bus specifications, such as bus [7:0].
rpt_del_net=
Courier bold also indicates commands that you select from a
menu.
File → Open
• Italic font denotes the following items.
• Variables in a syntax statement for which you must supply
values
edif2ngd design_name
• References to other manuals
See the Development System Reference Guide for more informa-
tion.
• Emphasis in text
If a wire is drawn so that it overlaps the pin of a symbol, the
two nets are not connected.
• Square brackets “[ ]” indicate an optional entry or parameter.
However, in bus specifications, such as bus [7:0], they are
required.
edif2ngd [option_name] design_name
• Braces “{ }” enclose a list of items from which you must choose
one or more.
lowpwr ={on|off}
• A vertical bar “|” separates items in a list of choices.
lowpwr ={on|off}
• A vertical ellipsis indicates repetitive material that has been
omitted.
IOB #1: Name = QOUT’
IOB #2: Name = CLKIN’
.
.
.
• A horizontal ellipsis “. . .” indicates that an item can be repeated
one or more times.
allow block block_name loc1 loc2 ... locn;
Online Document
The following conventions are used for online documents.
• Red-underlined text indicates an interbook link, which is a cross-
reference to another book. Click the red-underlined text to open
the specified cross-reference.
• Blue-underlined text indicates an intrabook link, which is a cross-
reference within a book. Click the blue-underlined text to open
the specified cross-reference.
Schematic-Based Design
This chapter guides you through a typical FPGA schematic-based
design procedure using a design of a runner’s stopwatch called
“Watch”. The design example used in this tutorial demonstrates
many device features, software features, and design flow practices
that you can apply to your own design. The Watch design targets a
SpartanXL device; however, all of the principles and flows taught are
applicable to any Xilinx device family, unless otherwise noted.
For an example of how to design with CPLDs, see the online help by
selecting Help → Foundation Help Contents from the Project
Manager. Under Tutorials, select CPLD Design Flows.
In the first part of the tutorial, you will use the Foundation design
entry tools to complete the design. The design is composed of
schematic elements, a state machine, a LogiBLOX component, and an
HDL macro. After the design is successfully entered in the Schematic
Editor, it is ready for functional simulation with the Foundation
Logic Simulator, implementation with the Xilinx Implementation
Tools, timing simulation.
Note: If you use Verilog or VHDL to create an HDL macro, then you
must have Base Express or Foundation Express and a valid license.
Getting Started
The following subsections describe the basic requirements for
running the tutorial.
Nomenclature
In this tutorial, the following terms are used:
• “Spartan family” includes the Spartan and SpartanXL devices.
• “Right-click” means click the right mouse button. Unless
specified, all other mouse operations are performed with the left
mouse button.
Throughout this tutorial, file names, project names, and directory
names (paths) are specified in lower case, and the design is referred
to as “Watch”.
Required Software
The Xilinx Foundation Series package, Version 2.1i, is required to
perform this tutorial. The design requires that you install the
SpartanXL libraries and device files, as well as the XABEL interface.
These options are selected by default in the install program.
Design Description
Throughout this tutorial, the design is referred to as Watch.
The design used in this tutorial is a hierarchical, schematic-based
design, meaning that the top-level design file is a schematic sheet
which refers to several other lower-level macros. The lower-level
macros are a variety of different types of modules including
schematic-based modules, LogiBLOX modules, state machine
modules, and HDL modules.
The design begins as an unfinished design. Throughout the tutorial,
you will complete the design by creating some of the modules, and
by completing some others from existing files. After the design is
complete, you will simulate it to verify the functionality.
Inputs:
• CLK—System clock for the Watch design.
• STRTSTOP—Starts and stops the stopwatch. This is an active-low
signal which acts like the start/stop button on a runner’s stop-
watch.
• RESET—Resets the stopwatch to 00.0 after it has been stopped.
Outputs:
• TENSOUT[6:0]—7-bit bus which represents the Tens digit of the
stopwatch value. This bus is in 7-segment display format to be
viewable on the 7-segment LED display on the Xilinx
demonstration board.
• ONESOUT[6:0]—similar to TENSOUT bus above, but represents
the Ones digit of the stopwatch value.
• TENTHSOUT[9:0]—10-bit bus which represents the Tenths digit
of the stopwatch value. This bus is one-hot encoded.
The completed design consists of the following functional blocks.
Most of these blocks do not appear yet on the schematic sheet in the
tutorial project since they will be created during this tutorial.
Functional Blocks
• STMACH_A or STMACH_V
State Machine macro. This module uses the Foundation State
Editor to enter and implement the state machine. One is an ABEL
version; the other is a VHDL version.
• CNT60
Schematic-based module which counts from 0 to 59, decimal.
This macro has two 4-bit outputs, which represent the ‘ones’ and
‘tens’ digits of the decimal values, respectively.
• TENTHS
LogiBLOX 10-bit, one-hot encoded counter. This macro outputs
the ‘tenths’ digit of the watch value as a 10-bit one-hot encoded
value.
• HEX2LED
HDL-based macro. This macro decodes the ones and tens digit
values from hexadecimal to 7-segment display format to view on
the FPGA Demonstration Board.
• OUTS1, OUTS2, OUTS3
Schematic-based macros which define the external output pin
assignments for TENSOUT, ONESOUT, and TENTHSOUT
output buses.
Hierarchy Browser
The Hierarchy Browser displays the project source files in a
hierarchical tree. Within this display, you can quickly navigate to any
point in your design.
In the Files tab of the Hierarchy Browser, the design source files and
libraries are displayed. Next to each filename, an icon tells you the
file type (schematic, HDL file, state machine, library, text file). If a file
contains lower levels of hierarchy, the icon has a “+” in the lower
right corner. You can expand the tree by clicking this icon. You can
open a file to edit by simply double-clicking the filename in the
browser.
A Versions tab is also available behind the Files tab. This tab displays
a design’s implementation revisions. Because this is a new design
which has not yet been implemented, the Versions tab does not yet
contain any revision information. Versions are discussed in more
detail later in the tutorial during design implementation.
Design Entry
In this hierarchical design, you will create various types of macros,
including schematic-based macros, HDL-based macros, state
machine macros, and LogiBLOX macros. You will learn the process
for creating each of these types of macros, and then you will connect
them all together to create the completed Watch design. This tutorial
gives you experience with creating and using each type of design
macro so that you can apply this knowledge to your own design.
Executing Commands
There are three ways to execute commands within the Foundation
tools: pulldown menus, hotkeys, and toolbar buttons. In most cases,
this tutorial instructs you to use the pulldown menus.
Hotkeys
You can use the keyboard to execute various commands. These
“hotkeys” are listed next to the commands within the pulldown
menus. Some of the hotkeys are the function keys, some are single
letters, and some require the Ctrl or Alt keys. You cannot customize
them.
Toolbar Buttons
There are also toolbars that are located beneath the pulldown menus
and to the left of the main Schematic Editor window. Hold your
mouse over the buttons to see their function.
Connectivity—Hierarchy Connectors
Hierarchy Connectors logically connect the CNT60 symbol and its
underlying schematic. The name of each pin on the symbol must
have a corresponding connector in the underlying schematic.
When you save a macro, the Schematic Editor checks the hierarchy
connectors against the corresponding symbol. If there is a
discrepancy, you can let the software update the symbol
automatically, or you can modify the symbol manually. Hierarchy
connectors should only be used to connect signals between levels of
hierarchy. Never use hierarchy connectors on top-level schematic
sheets.
Project Libraries
When you create a new project in Foundation, three libraries are
automatically added to the project: the appropriate device family
library based on the target family you have chosen (for example,
SpartanXL), the project library (with the same name as the project),
and the SIMPRIMS library (for simulation). All libraries which are
part of the project are listed in the Files tab of the Project Manager.
You can double click on any of these libraries to see the contents of
the library.
Additionally, you can copy macros from other libraries into this
project library and vice versa using the Schematic Symbols Library
Manager which you can open with the Tools → Utilities menu
in the Project Manager.
To facilitate simulation with the Foundation Logic Simulator, the
SIMPRIMS is added to the project. This library contains the
simulation models for the Xilinx devices.
You can add more libraries to the project by choosing File →
Project Libraries from the Project Manager. After you add a
library to the project, you can use any component from that library in
the current project.
Correcting Mistakes
If you make a mistake when placing a component, you can easily
move or delete the component.
1. Press the Esc key on the keyboard to exit the Symbols Mode.
2. Select the component you want to move or delete. Make sure that
no other components are selected (clicking on a blank area of the
schematic deselects everything).
3. Click and drag to correctly place the component, or press the Del
key on the keyboard or the Cut icon in the toolbar to delete the
component.
Drawing Nets
You use the Draw Wires icon in the vertical toolbar to draw wires
(also called nets) between the various components on the schematic.
Use Nets to physically connect single bits together.
Signals can also logically be connected by naming multiple segments
identically. In this case, the nets do not need to be physically
connected on the schematic to make the logical connection. In the
CNT60 schematic, you will draw nets to connect the components
together. Do not yet worry about drawing the nets for the LSBSEC
and MSBSEC buses. These nets will be drawn in the next section.
Follow these steps to draw a net between the AND2 and the CB4RE
components on the CNT60 schematic.
2. Click the source symbol pin (output pin of the AND2), then click
on the destination pin (CE pin on the CB4RE). The net will
automatically be drawn between the two pins.
Note: You can specify the shape of the net by moving the mouse in
the direction you want to draw the net and then single-clicking to
create a 90-degree bend in the wire.
Draw the nets to connect the remaining components as shown in the
“Completed CNT60 Schematic” figure. To draw a net between an
already existing net and a pin, click once on the component pin and
once on the existing net. A junction point will be drawn on the
existing net.
You should now have all the nets drawn except those connected to
the LSBSEC and MSBSEC buses. You will draw these in the next
section.
Adding Buses
Sometimes it is convenient to draw a set of signals as a bus rather
than as several separate wires. You have the option to group signals
in the form of a bus and “tap” this bus off to use each signal
individually. In this CNT60 schematic, you will create two buses,
each comprised of the 4 output bits of each counter. These buses will
be named LSBSEC[3:0] and MSBSEC[3:0], and they will also be
connected to hierarchy connectors to connect them to the CNT60
symbol.
Add buses to the schematic as follows.
1. Select Mode → Draw Buses or click the Draw Buses button in the
vertical toolbar to get into the Draw Buses mode.
Click the end of the LSBSEC[3:0] stub, then move the mouse to a
new position. Click to make a corner in the bus.
3. Terminate the bus by either double clicking with the left mouse
button, or single-clicking with the right mouse button. This opens
the Add Bus Terminal/Label dialog box where you can define
the bus name, width, and the type of terminal you want to use.
4. In the Add Bus Terminal/Label dialog box, change the Terminal
Marker type to None by choosing this selection from the
pulldown menu. This sets the type of terminal for the point
where you are terminating the bus. Do not change any of the
other settings. Click Bus End (the bus name and width were
defined with the Symbol Wizard, so it is unnecessary to redo this
here).
7. After adding the two buses, press Esc or right-click to exit the
Draw Buses mode.
If there is an error with the labeling of the bus taps, double click
the bus tap net to edit the label.
5. Repeat Steps 1 through 4 for the MSBSEC[3:0] bus.
6. Press Esc twice or right-click to exit the Draw Bus Taps mode.
7. Complete the schematic by drawing the nets to connect the
MSBSEC bus taps to the INV and AND4 components. If
necessary, refer to the “Drawing Nets” section for guidance.
8. Compare your CNT60 schematic again with the “Completed
CNT60 Schematic” figure to ensure that all connections are
properly made.
Note: If you do not want to place the symbol at this time, you can
press the Esc key on the keyboard to get out of the Place Symbol
mode. You can then select it at any time from the SC Symbols
Toolbox to place on the schematic.
5. Place the newly created Tenths component on the Watch
schematic sheet, as shown below. You will connect this symbol to
the rest of the schematic later in the tutorial. The symbol is
labeled “L1” on the schematic sheet.
Adding a Transition
A transition defines the movement between states of the state
machine. Transitions are represented by arrows in the State Editor.
You will be adding a transition from the CLEAR state to the ZERO
state in the following steps. Because this transition is unconditional,
there is no Transition Condition associated with it.
1. Click the Transition icon in the vertical toolbar.
2. Click first on the CLEAR state, then on the ZERO state to draw
the transition arrow. The arrow’s shape can be manipulated by
clicking it and then dragging the mouse.
2. Move the mouse over the diagram so that the small round ball at
the end of the pointer is over the CLEAR state. After you are in
this position, click the mouse to place the State Action box.
3. When a cursor appears, type the following state action:
• For ABEL:
clkout = 0;
rst = 1;
• For VHDL:
clkout <= ‘0’;
rst <= ‘1’;
2. Place the Reset triangle onto the diagram near the CLEAR state,
as shown in the diagram below.
3. The cursor is automatically attached to the transition arrow for
this Reset. Move the cursor to the CLEAR state, and click the state
bubble.
2. Click the transition arrow which was drawn between the Reset
triangle and the CLEAR state.
3. When the cursor appears, type in the following condition:
• For ABEL:
reset
• For VHDL:
reset = ‘1’
4. Click in an empty space in the diagram to exit the Draw
Condition mode. The condition should now appear underlined
and in purple text.
Hierarchy Push/Pop
Descend into a lower-level of hierarchy to view the underlying file.
You will be pushing down into the OUTS1 macro, which is a
schematic-based user-created macro.
1. To push down into OUTS1, click the Hierarchy Push/Pop button.
The mouse cursor changes to the letter “H”. Double click the
OUTS1 symbol.
Labeling Nets
It is important to label nets and buses for several reasons. It aids in
debugging and simulation, as you will more easily trace nets back to
your original design. Any nets which remain unnamed in the design
will be given machine-generated names which will mean nothing to
you later in the implementation process. Naming nets also enhances
readability and aids in documenting your design.
Label the three input nets you just drew. When naming input and
output pins, it is advisable to label the net between the pad and the
buffer. This name is carried through the entire design flow including
place and route. If you label only the output of the buffer (in the case
of an input pin) or input of the buffer (in the case of an output pin),
you will not be able to easily trace your I/O pins in implementation
tools and reports.
1. Double click the RESET net.
2. In the Net Name field, type RESET as shown below.
Note: You may click and drag the attributes to position them where
you wish on the schematic.
1. Draw a net (see the “Drawing Nets” section) between the BUFG
and the CLK pin of the STMACH state machine macro. Label this
net CLK_INT.
2. Draw a net (see the “Drawing Nets” section) between the IBUF of
the RESET input and the RESET pin of the STMACH state
machine macro.
3. Place an INV (inverter) component (see the “Adding
Components to CNT60” section) from the SpartanXL library
between the IBUF of the STRTSTOP input and the STRTSTOP pin
of the STMACH state machine macro. Draw nets (see the
“Drawing Nets” section) to connect the INV to the both the IBUF
and the STMACH state machine macro.
4. Place an AND2 component (see the “Adding Components to
CNT60” section) to the left of the CNT60 macro.
5. Draw a net (see the “Drawing Nets” section) to connect the
output of the AND2 with the CE pin of the CNT60 macro.
6. Draw a net (see the “Drawing Nets” section) to connect the
TERM_CNT pin of the TENTHS macro to one of the inputs to the
AND2.
7. Draw a hanging net (see the “Drawing Nets” section) from the
CLKOUT pin of the STMACH macro. To terminate a hanging
wire, double click.
8. Press Esc to get back into point/select mode and then label the
net you drew in Step 7 CLKEN_INT.
9. Draw a hanging net at the CLK_EN input pin of the TENTHS
macro. Label this net CLKEN_INT (see the “Labeling Nets”
section).
10. Draw a hanging net (see the “Drawing Nets” section) at the other
input of the AND2 component. Label this net CLKEN_INT again
(see the “Labeling Nets” section).
11. Draw a hanging net (see the “Drawing Nets” section) from the
RST output pin of the STMACH macro. Label this net RST_INT.
12. Draw two more hanging nets (see the “Drawing Nets” section),
also named RST_INT, from the ASYNC_CTRL pin of the
TENTHS macro and from the CLR pin of the CNT60 macro.
13. Draw two hanging nets (see the “Drawing Nets” section), each
named CLK_INT, from the CLOCK pin of the TENTHS macro
and from the CLK pin of the CNT60 macro.
Note: Remember that nets are logically connected if their names are
the same, even if the net is not physically drawn as a connection in
the schematic. This method is used to make the logical connection of
the RST_INT, CLKEN_INT and CLK_INT signals.
14. Draw buses (see the “Adding Buses” section) to complete the
schematic. Label them as shown on the preceding schematic
diagram.
The schematic is now complete!
15. Save the design by selecting File → Save.
HDL-Based Design
This chapter guides you through a typical HDL-based design
procedure using a design of a runner’s stopwatch called Watch. The
design example used in this tutorial demonstrates many device
features, software features and design flow practices which you can
apply to your own design. This design targets an SpartanXL device;
however, all of the principles and flows taught are applicable to any
Xilinx device family, unless otherwise noted.
For an example of how to design with CPLDs, see the online help by
selecting Help → Foundation Help Contents from the Project
Manager. Under Tutorials, select CPLD Design Flows.
In the first part of the tutorial, you use the Foundation design entry
tools to complete the design. The design is composed of HDL
elements and a LogiBLOX macro; you will synthesize the design
using the Express tools.
Then, you will functionally simulate the design using the Foundation
Logic Simulator. In the third part, you will implement the design
using the Xilinx Implementation Tools. The simulation,
implementation, and bitstream generation are described in
subsequent chapters.
This chapter includes the following sections.
• “Getting Started”
• “Design Description”
• “The Project Manager”
• “Design Entry”
• “Synthesizing the Design”
• “The Express Constraints Editor (Foundation Express Only)”
Getting Started
The following subsections describe the basic requirements for
running the tutorial.
Nomenclature
In this tutorial, the following terms are used:
• “Spartan family” includes the Spartan and SpartanXL devices
only.
• “Right-click” means click the right mouse button. Unless
specified, all other mouse operations are performed with the left
mouse button.
Throughout this tutorial, file names, project names, and directory
names (paths) are specified in lower case, and the design is referred
to as Watch.
Required Software
The Xilinx Foundation Series package, Version 2.1i, is required to
perform this tutorial. The design requires that you have installed the
SpartanXL libraries and device files and are licensed for Foundation
Express or Base Express. You must also have the Watch projects
which are installed with the Sample Designs or which may be
downloaded from http://support.xilinx.com.
Note: A Foundation Express license is required to access the Express
Constraints GUI.
Directory Description
WTUT_VHD Incomplete Watch Tutorial - VHDL
WTUT_VER Incomplete Watch Tutorial - Verilog
WATCHVHD Solution for Watch - VHDL
WATCHVER Solution for Watch - Verilog
VHDL or Verilog?
This tutorial has been prepared for both VHDL and Verilog designs.
This document applies to both designs simultaneously, noting
differences where applicable. You will need to decide which HDL
language you would like to work through the tutorial when you open
the project.
Design Description
The design used in this tutorial is a hierarchical, HDL-based design,
meaning that the top-level design file is an HDL file that references
several other lower-level macros. The lower-level macros are either
HDL modules or LogiBLOX modules.
• HEX2LED
HDL-based macro. This macro decodes the ones and tens digit
values from hexadecimal to 7-segment display format for
viewing on the FPGA Demonstration Board.
• SMALLCNTR
A simple Counter.
Hierarchy Browser
In the Files tab of the Hierarchy Browser, design source files and
libraries are displayed. Next to each filename is an icon which tells
you the file type (HDL file, state machine, schematic, library, text file,
for example). If a file contains lower levels of hierarchy, the icon has a
+ to the left of the name. HDL files have this + to show the entities
(VHDL) or modules (Verilog) within the file. You can expand the tree
by clicking this icon. You can open a file to edit by double clicking the
filename in the browser.
A Versions tab is also available behind the Files tab. Since this is a
new design which has not yet been implemented, the Versions tab is
empty. This tab is discussed in more detail later in the tutorial during
design implementation.
Design Entry
In this hierarchical design, you will examine HDL files, correct syntax
errors, create an HDL macro, and add a LogiBLOX module. This
tutorial gives you experience with creating and using each type of
design macro so that you can apply these procedures to your own
design.
• A red X means errors have been found. Select this file and
examine the errors under the HDL Errors tab. Errors are also
given in the HDL Editor.
1. From the Flow tab in the Project Manager, click the HDL Editor
button.
2. A dialog box opens, asking if you want to create an empty HDL
file, select an existing HDL file, or use the HDL Wizard to create a
new file. Click the radio button next to Use HDL Design Wizard
and click OK.
3. Follow the instructions from the Wizard. When you are
prompted for a preferred HDL language, choose whichever one
you want, VHDL or Verilog.
4. When you are prompted for a file name, type HEX2LED and click
OK.
5. The HEX2LED component has a 4-bit input port named HEX and
a 7-bit output port named LED. To enter these ports, first click the
New button in the Ports dialog box. Select Input as the direction
and type HEX in the Name field. Then, click the arrow next to the
Bus field to select 3:0, which is the width of the bus. In the Name
field, you should now see HEX[3:0], and a corresponding pin
should appear on the symbol diagram on the left.
8. You now have complete and functional HDL code and can check
the syntax using Synthesis → Check Syntax.
9. After you successfully complete the syntax check, save the file by
selecting File → Save from the HDL Editor.
10. Add this HDL file to your current project by selecting Project
→ Add to Project.
11. Exit the HDL Editor.
• TENTHS.VHD or TENTHS.V
This is the HDL file to be used only for functional simulation.
Do not attempt to synthesize this file. Also do not add this
file to the Foundation project.
• TENTHS.MOD
This file stores the configuration information for the Tenths
module.
• LOGIBLOX.INI
This file stores the LogiBLOX configuration for the project.
VHDL Flow
1. Open STOPWATCH.VHD in the HDL Editor.
2. Place your cursor after the line that states:
“-- Place the LogiBLOX Component Declaration for Tenths here”
Select Edit → Insert File and choose Tenths.vhi. The VHDL
template file for the LogiBLOX instantiation is inserted.
The Component Declaration does not need to be modified.
3. Highlight the inserted code from “--Component Instantiation” to
“TERM_CNT=>);”. Select Edit → Cut.
Verilog Flow
1. Open STOPWATCH.V in the HDL Editor.
2. Place your cursor after the line that states:
“-- Place the LogiBLOX Module Declaration for Tenths here”
This line is at the end of the file.
Select Edit → Insert File and choose Tenths.vei. The Verilog
template file for the LogiBLOX instantiation is inserted.
The Component Declaration does not need to be modified.
Note: Alternatively, the remaining module declaration can be placed
in a new Verilog file (name it TENTHS.V) and added to the project.
Be careful not to overwrite the Verilog simulation model, also named
TENTHS.V, if one has been created. This module declaration is
required to define the port directions of the ports of the LogiBLOX
module.
• Ports
With the Ports tab, you set input and out delay requirements,
assign clock buffers, insert pullup or pulldown resistors in the I/
O, set delay properties for input registers, set slew rate, disable
the use of I/O registers, and assign pin locations. For all but the
pin locations, click in the box to use the pulldown menu. For pin
locations, type the pin number in the box.
• Modules
With the Modules tab, you to keep or eliminate hierarchy and
disable resource sharing. You can also override the default
settings for effort and area versus speed at the module level.
• Xilinx Options
The Ignore unlinked cells during GSR mapping option directs
Express to infer a global reset signal (and, therefore, insert the
STARTUP module), even if black boxes have been instantiated.
Express cannot know the reset characteristics of any logic in black
boxes, so it will not insert STARTUP unless you check this
option.
Although UCF files are provided for this tutorial, you will assign the
pin location constraints in the Express Constraints Editor.
1. In the Express Constraint Editor, click the Import Constraints
button. Select WATCHVHD.EXC or WATCHVER.EXC,
depending on the language you are using. These files are located
in the project directory.
This file has been created for you. The only difference you should
see between your initial constraints and the ones saved in the
.EXC file is the set of pin locations under the Ports tab.
You can save Constraint Editor settings for a design by selecting
File → Export Constraints. When this .EXC file is read in
for a later synthesis run, all constraints are re-established in the
GUI, as long as they can be matched to instances in the current
version.
2. Under the Paths tab, click in the box in Row 2 below the Req.
Delay header (from All Input Ports to RC-CLK). Change the
delay to 15. Under the Ports tab, the Input Delays for RESET and
STRTSTOP have changed to 15, as these represent all the Pad to
Setup delays.
You can change the values of individual Input or Output Delays
by clicking the value in the Ports tab and either editing the value
there or using the pulldown tab to select a value or define a new
one. Change the values on one of the output signals using one of
these methods.
3. Under the Paths tab, right click either RC-CLK or All Output
Ports in the third row and select New Subpath. The Create/
Edit Timing Subpath window opens.
Give this new subpath a name, Sub_flops_to_out, and a Delay
value, 18. On the left hand side, double click all four flip flops
that contain the name /ver1/sixty/lsbcount/QOUT*, to
determine the sources of this subpath. On the lower right hand
side, use the filter to select the destinations. Type ONE* in the
field and click the Select button. All the ports beginning with
ONESOUT will be highlighted. Click OK to see your new
subpath.
4. Under the Modules tab, you can examine the elements used to
synthesize this design. Click the box in the second row under
Area and select Details. This section summarizes all the design
elements used in the Stopwatch design that Express knows
about.
Since the Tenths module is a LogiBLOX component and has not
been synthesized by Express, it is UNLINKED and no summary
information is available.
Note: Black boxes (modules not read into the Express design
environment) are always noted as UNLINKED in the Express
reports. As long as the underlying netlist (.xnf, .ngo, .ngc or EDIF) for
a black box exists in the project directory, the Implementation tools
merge the netlist in during the Translate phase. Since the Tenths
module was built using LogiBLOX called from the project, the tenths
NGC file will be found.
5. Click OK to complete the Synthesis phase.
At this point, an XNF file exists for the Stopwatch design. See the
“Functional Simulation” chapter to perform a post-synthesis
simulation of this design or refer to the “Design Implementation”
chapter to place and route the design.
Functional Simulation
You can perform functional simulation before design implementation
to verify that the logic that you have created is correct. Foundation
provides a Logic Simulator, which is a gate-level simulator. You can
perform functional simulation on a schematic-based design
immediately after the design is captured in the Schematic Capture
tool. In the case of an HDL-based design, you can perform functional
simulation immediately following synthesis. In a later section, you
can perform timing simulation, which takes place after the design is
implemented (placed and routed) with the Xilinx Implementation
Tools.
This chapter contains the following sections.
• “Starting the Logic Simulator”
• “Performing Simulation”
• “Adding Signals”
• “Adding Stimulus”
• “Running the Simulation”
• “Saving the Simulation”
Performing Simulation
There are three basic steps to simulate your design:
1. Adding signals
2. Adding stimulus
3. Running the simulation
There are several different ways to perform each of these steps. These
methods are discussed briefly in the following sections. In this
tutorial, you use the simulator in various ways, and then you can
decide what is best for you with your own designs.
Adding Signals
In order to view signals during the simulation, you must first add
them to the Waveform Viewer in the Simulator. The signals are then
listed in the Waveform Viewer. You can view and monitor the
waveforms next to the corresponding signal names, as well as
monitor the state of these signals in the schematic during the
simulation.
There are two basic methods for adding signals to the Simulator
Waveform Viewer.
• Using Probes from the Schematic Capture tool
• Using the Component Selection window in the Simulator
This opens the SC Probes toolbox which has several buttons you
can use to control the simulation from within the Schematic
Capture tool.
Note: You can view the results of the simulation either in the
Simulator Waveform Viewer or by looking at the annotated values
that appear directly on the schematic. These methods are examined
more closely later in the tutorial.
You should now see all of the signals you just probed listed in the
Simulator Waveform Viewer.
Note: Because Express flattens the design during synthesis, you will
only see this OUTS1 component with the schematic version of the
design.
Deleting a Signal
To delete any of the signals from the Waveform Viewer, first select
the signal in the signal list in the Waveform Viewer, right-click, and
then select Delete Signals → Selected. This operation removes
the highlighted signal from the Waveform Viewer.
Adding Stimulus
To define the function of the input signals, you must add stimulus to
your simulation. There are many ways to define stimulus with the
Foundation Simulator. Some of these methods are listed below and
are discussed in more detail in the sections to follow.
• Keyboard stimulus
• Custom formulae
• Internal binary counter outputs
• Stimulator state selector
• Script file
• Waveform file
In this tutorial, you use the keyboard stimulus, custom formulae,
internal binary counter, and script file. The script file method is used
later in the tutorial when you are performing a timing simulation. All
of these stimulator methods may be used in both functional and
timing simulations.
Open the Stimulator Selection Window by clicking the Stimulator
icon in the toolbar or by selecting Signal → Add Stimulators...
Now create a custom formula and then assign that formula to the
STRTSTOP signal in the Watch design.
1. Click the Formula... button in the Stimulator Selection
Window to bring up the Set Formulas window.
Note: There are two sections of the Set Formulas window: Clocks and
Formulas. Any pattern that you specify for a Clock repeats forever.
Any pattern that you specify for a Formula executes just once, and
then holds the last specified value for the rest of the simulation.
2. Double click on F0 in the Formulas section. The Edit Formula
field at the bottom of the window should now be active.
3. Type the following formula into the Edit Formula field:
H200L100H2000L100H500L200H1000
This formula means “High for 200ns, then Low for 100ns, then
High for 2000ns, then Low for 100ns, etc...”. This defines the
stimulus pattern which you assign to STRTSTOP.
4. Click Accept. This assigns the formula you just entered to the F0
formula. You should now see it displayed next to the F0.
5 1
4 2
Decimal point
X8774
Design Implementation
Design Implementation is the process of translating, mapping,
placing, routing, and generating a BIT file for your design. The
Design Implementation tools are embedded into the Foundation
Project Manager for easy access and project management.
This chapter contains the following sections.
• “Project Management”
• “Starting Implementation”
• “Implementation Options”
• “Running Implementation — The Flow Engine”
• “Viewing Implementation Results”
• “Other Implementation Tools”
Project Management
Project management controls design versions and revisions. A
version represents an input design netlist. Each time a change is
made to the source design, such as logic being added to or removed
from the schematic or the HDL source being modified, a new version
is created. A revision represents an implementation on a given
version, usually with new implementation options, such as different
placement or router effort level.
Foundation maintains revision control, meaning that the resulting
files from each implementation revision are archived in the project
directory.
Note: In 2.1i, you can archive an entire project, design source files,
synthesis files, and implementation files.
Foundation manages and displays your design versions and
revisions graphically in the Versions tab of the Project Manager. Since
you have not yet implemented the design, the Versions tab is
currently empty.
Starting Implementation
This section describes how to begin implementation depending on
which tutorial you performed: HDL or schematic.
• If you performed the schematic tutorial, proceed to the
“Implementing the Schematic Design” section.
• If you performed the HDL tutorial, proceed to the
“Implementing the HDL Design” section.
If you are asked if you wish to update the EDIF netlist because the
schematic is newer, say Yes to update the EDIF netlist. This EDIF
netlist is the actual input file to the Design Implementation tools.
Next you will see the Implement Design dialog box.
Implementation Options
Click the Options button. The Options dialog box opens. A
summary of the options provided in this box follows.
Implementation Template
You enter and modify implementation options by using the
Implementation template.
1. Click the Edit Options button for the Implementation Program
Options. This opens the Spartan Implementation Options dialog
box.
There are four tabs to control various aspects of the design
implementation.
2. Click the Timing Reports tab.
3. Click the checkbox next to Produce Logic Level Timing
Report.
Control Files
By default, Foundation creates a blank UCF file in the project
directory. You can edit this UCF file from the Files view in the Project
Manager.
Because the name of this UCF file is the same as the project name, it is
loaded by default. If you have other UCF files that you want to use
instead, browse to find and select them.
You can also designate guide files or Floorplanner files to control the
current implementation. For details, refer to the “Setting Control
Files” section in the “Design Implementation” of Foundation Series 2.1i
User Guide.
Timing Simulation
Timing simulation uses the block and routing delay information from
the routed design to give a more accurate assessment of the behavior
of the circuit under worst-case conditions. For this reason, timing
simulation is performed after the design has been placed and routed.
This chapter includes the following sections.
• “Invoking Timing Simulation”
• “Simulating with Script Files”
The simulator used for timing simulation is the same one used for
functional simulation. The only difference is that the design which is
loaded into the simulator for timing simulation contains worst-case
routing delays based on the actual placed and routed design.
The simulator is now loaded and ready to simulate. For this
simulation, you use script files.
8. With the TENS vector selected, click the Radix pulldown menu
to change the radix of the vector to Binary. This determines how
the vector is displayed in the simulator.
9. Repeat Steps 6 through 8 to create vectors called ONES and
TENTHS for both the ONESOUT[6:0] and TENTHSOUT[9:0]
buses, respectively.
12. In the Component Selection window, scroll down the signal list
on the right-hand side, and locate the CLK signal. Select it and
click OK.
13. See the CLK signal listed in the Simulators and Watched Signals
list. Click the CLK signal and the Stimulator Type field now
becomes active. Use the pulldown menu in the Stimulator Type
field to select Clock.
14. In the Value field, set the pattern of the clock. By typing 0 1
(delimited by a space) in the value field, you define the clock as
having a pattern of low for one simulation step (previously
defined as 10ns), then high for one simulation step. This pattern
repeats indefinitely to produce the clock signal.
The Macro Assistant provides templates and help for the various
script file commands. Browse through the various templates to
see what is available.
XS40-010XL The XS40-010XL Board is perfect for experimenting with FPGA designs,
microcontroller programming, or hardware/software codesign. The 20,000-gate
XC4010XL FPGA operates at 3.3V but is 5V-tolerant so you can connect it to
● XC4010XL FPGA
commonly available TTL chips. Digital logic designs can be loaded into the
● 8031 microcontroller
FPGA. The microcontroller can use the FPGA as a coprocessor. The SRAM
● 32 KByte SRAM
can store microcontroller programs/data or serve as general-purpose storage
● 100 MHz programmable
for FPGA-based designs.
oscillator
● Parallel port
● mouse/keyboard PS/2 port The XC4000XL series of FPGAs is supported by Xilinx's Foundation and
● VGA monitor port Alliance Series software. The XC4000XL series has better routing and
● 7-segment LED compilation of designs for these FPGAs is much faster. If you use Win95 or
● 84-pin breadboard interface NT, then you must use the Foundation or Alliance tools.
● Serial EEPROM socket
● 9V DC power jack
● 5V / 3.3V regulators
● Downloading cable
● XSTOOLs utilities diskette
XS40, XSP, and XS95 Board Manual
XESS Corporation
All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or
transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise,
without the prior written permission of the publisher. Printed in the United States of America.
Limited Warranty
X Engineering Software Systems Corp. (XESS) warrants that the Product, in the course of its normal use,
will be free from defects in material and workmanship for a period of one (1) year and will conform to
XESS’s specification therefor. This limited warranty shall commence on the date appearing on your
purchase receipt.
XESS shall have no liability for any Product returned if XESS determines that the asserted defect a) is
not present, b) cannot reasonably be rectified because of damage occurring before XESS receives the
Product, or c) is attributable to misuse, improper installation, alteration, accident or mishandling while in
your possession. Subject to the limitations specified above, your sole and exclusive warranty shall be,
during the period of warranty specified above and at XESS’s option, the repair or replacement of the
product. The foregoing warranty of XESS shall extend to repaired or replaced Products for the balance of
the applicable period of the original warranty or thirty (30) days from the date of shipment of a repaired
or replaced Product, whichever is longer.
In the United States, some statutes do not allow exclusion or limitations of incidental or consequential
damages, so the limitations above may not apply to you. This warranty gives you specific legal rights,
and you may also have other rights which vary from state to state.
Getting Help!
If you follow the instructions in this manual and you encounter problems, here are some
places to get help:
• If you can't get the XS Board hardware to work, send an e-mail message describing
your problem to fpga-bugs@xess.com or check our web site at
http://www.xess.com/FPGA. Our web site also has
§ answers to frequently-asked-questions
(http://www.xess.com/FPGA/ho01000.html),
§ a place to sign-up for our email forum where you can post questions to other XS
Board users (http://www.xess.com/FPGA/list_reg.html).
• If you can't get your XILINX F1 software tools installed properly, send an e-mail
message describing your problem to hotline@xilinx.com or check their web
site at http://www.xilinx.com.
• an XS40, XS95 or XSP Board (note that your XSP Board will be labeled as an XS40
but the socket will contain a Xilinx Spartan FPGA with an "XCS" prefix);
• a floppy diskette with software utilities for using the XS40, XSP or XS95 Board and
documentation (you should be OK on this one).
Once the additional software tools are installed, you will see the following subdirectories:
XSTOOLS\BIN contains the executable programs for downloading to the XS Board and
for applying signals to the XS Board through the printer port. An assembler for the
microcontroller is also included.
XSTOOLS\DOCS contains the documentation and schematics for the XS40, XSP and
XS95 Boards.
Table 1: Power and ground connections for all types and versions of the XS Boards.
Off The shunt should be removed if the XS40 or XSP Board is being
configured from the on-board serial EEPROM (U7).
J7 1-2 The shunt should be installed on pins 1 and 2 (ext) if the 8031
(ext) microcontroller program is stored in the external 32 KByte RAM
(default) (U8) of the XS40 Board.
J10 On The shunt should be installed if the XS40 or XSP Board is being
configured from the on-board serial EEPROM.
Off The shunt should be removed if the XS40 or XSP Board is being
(default) downloaded from the PC parallel port.
J11 On The shunt should be installed if the XS40 or XSP Board is being
(default) downloaded from the PC parallel port.
Jumper Setting Purpose
Off The shunt should be removed if the XS40 or XSP Board is being
configured from the on-board serial EEPROM.
J7 1-2 The shunt should be installed on pins 1 and 2 (ext) if the 8031
(ext) microcontroller program is stored in the external 32 KByte RAM
(default) (U8) of the XS95 Board.
However, if the test program detects an error, then the LED digit displays an E or
remains blank. In this case, check the following items:
• Make sure the board is receiving power from a 9V DC power supply through jack J9
or through the VCC and GND pins.
• Check that the board is sitting upon a non-conducting surface and that there are no
connections to any of the pins (except for the VCC and GND pins if this is the way
you are powering the board).
• Make sure the downloading cable is securely attached to the XS Board and the PC
parallel port.
• Verify that the parallel port is in SPP mode. (The mode is usually set in the BIOS as
either SPP, EPP, or ECP. SPP is the safest and least ambitious mode.)
If all these checks are positive, then test the board using another PC. In our experience,
99.9% of all problems are due to the parallel port.
where CIRCUIT.BIT is an XC4000 bitstream file that contains the configuration for the
XC4000 or XCS FPGA. Make sure the file contains a bitstream for the type of FPGA
chip installed on your XS40 or XSP Board. This file is created using the XILINX F1
software tools.
You can download an XC9500-based design into the XS95 Board as follows:
where CIRCUIT.SVF is an XC9500 bitstream file that contains the configuration for the
XC9500 CPLD. Make sure the file contains a bitstream for the type of XC9500 chip
installed on your XS95 Board. This file is created using the XILINX F1 software tools.
Use one of the following commands if you need to configure the FPGA or CPLD and
also download an Intel-formatted HEX file into the RAM of the XS Board:
XSLOAD assumes the XS Board is connected to parallel port #1 of your PC. You can
use another port number like so:
This is easy with the XS95 Board. The XC9500 CPLD always stores its current
configuration in an on-chip Flash memory. This configuration is restored whenever
power is applied to the XS95 Board. So your design is always available even when the
board is not connected to a PC.
But the XC4000 or XCS FPGA on the XS40 or XSP Board stores its configuration in an
on-chip RAM which is erased whenever power is interrupted. However, an external
serial EEPROM (such as the Atmel AT17C65/128/256) can be placed in socket U7 to
store the FPGA configuration and reload it on power-up. You will have to perform
several manual steps to 1) load the FPGA configuration into the EEPROM and 2) enable
the configuration of the FPGA from the EEPROM.
Perform the following steps to load your design into the EEPROM:
2. Place a shunt on jumper J6. This enables the programming circuitry in the Atmel
EEPROM chip.
4. Use the following command to load the FPGA bitstream file into the EEPROM:
6. Remove the shunt on jumper J6. This disables the programming circuitry in the Atmel
EEPROM chip so your design cannot be overwritten.
Once your design is loaded into the EEPROM, you must do the following to make the
XS Board configure itself from the EEPROM instead of the PC parallel port interface:
2. Place a shunt on jumper J10. This sets the FPGA into the active-serial mode so it will
provide a clock signal to the EEPROM which sequences the loading of the
configuration from the EEPROM into the FPGA.
3. Remove the shunt on jumper J4. This prevents the PC interface circuitry from
interfering with the clock signal from the FPGA.
4. Remove the shunt on jumper J11. This prevents the PC interface circuitry from
interfering with the data coming from the EEPROM.
5. Apply power to the XS Board. The FPGA will be configured from the serial
EEPROM. You may reattach the downloading cable if you need to inject test signals
into your design using the XSPORT program.
At this point, you have to partition the functions of your system between the
microcontroller and the FPLD. Some of the input signals will go to the microcontroller,
some will go to the FPLD, and some will go to both. Likewise, some of the outputs will
be computed by the microcontroller and some by the FPLD. There will also be some new
intra-system inputs and outputs created by the need for the microcontroller and the FPLD
to cooperate.
In general, the FPLD will be used mainly for low-level functions where signal transitions
occur more frequently and the control logic is simpler. A specialized serial
transmitter/receiver would be a good example. Conversely, the microcontroller will be
used for higher-level functions where the responses occur less quickly and the control
logic is more complex. Reacting to commands passed in by the receiver is a good
example.
Figure 2: Microcontroller + FPLD design flow.
Once the design has been partitioned and you have assigned the various inputs, outputs,
and functions to the microcontroller and the FPGA, then you can begin doing detailed
design of the software and hardware. For the software, you can use your favorite editor
to create a .ASM assembly-language file and assemble it with ASM51 to create a .HEX
file for the 8031 microcontroller on the XS Board. For the FPLD hardware portion, you
will enter truth-tables and logic equations into a .ABL file and compile it into a .BIT or
.SVF bitstream file using the XILINX F1 programming software.
With the .HEX 8031-program file and the FPLD bitstream file in hand, you can download
them to the XS Board using the XSLOAD program. XSLOAD stores the contents of the
.HEX file into the 32 KByte RAM on the XS Board and then it reconfigures the FPLD
by loading it with the bitstream file.
When the XS Board is loaded with the hardware and software, you need to test it to see if
it really works. The answer usually starts as "No" so you need a method of injecting test
signals and observing the results. XSPORT is a simple program that lets you send test
signals to the XS Board through the PC parallel port. You can trace the reaction of your
system to signals from the parallel port by programming the microcontroller and the
FPLD to output status information on the LED digit (much like placing "printf"
statements in your C language programs). This is admittedly crude but will serve if you
don't have access to programmable stimulus generators and logic analyzers.
The 12 MHz oscillator output goes directly to a synchronous clock input of the FPLD.
The FPLD can control the clock it sends to the XTAL1 input of the microcontroller.
The 8031 multiplexes the lower eight bits of a memory address with eight bits of data and
outputs this on its P0 port. Both the RAM data lines and the FPLD are connected to P0.
The RAM uses this connection to send and receive data to and from the 8031. The
FPLD is programmed to latch the address from P0 under control of the ALE signal and
send the latched address bits to the lower eight address lines of the RAM.
Figure 3: Connections between the 8031 microcontroller, RAM, and FPLD of the XS
Board.
Meanwhile, the upper eight bits of the address are output on port P2 of the 8031. The
RAM uses the lower seven of these address bits. The FPLD also receives the upper eight
address bits and decodes these along with the PSEN and read/write control line (from pin
P3.6 of port P3 ) from the 8031 to generate the CS and OE signals that enable the RAM
and its output drivers, respectively. Either of the CS or OE signals can be pulled high to
disable the RAM and prevent it from having any effect on the rest of the XS Board
circuitry.
One of the outputs of the CPLD controls the reset line of the microcontroller. The 8031
can be prevented from having any effect on the rest of the circuitry by forcing the RST
pin high through the FPLD. (When RST is active, most of the 8031 pins are weakly
pulled high.)
Many of the I/O pins of ports P1 and P3 of the 8031 connect to the FPLD and can be
used for general-purpose I/O between the microcontroller and the FPLD. In addition to
being general-purpose I/O, the P3 pins also have special functions such as serial
transmitters, receivers, interrupt inputs, timer inputs, and external RAM read/write
control signals. If you aren't using a particular special function, then you can use the
associated pin for general-purpose I/O between the microcontroller and the FPLD. In
many cases, however, you will program the FPLD to make use of the special-purpose
8031 pins. (For example, the FPLD could generate 8031 interrupts.) If you want to use
the special-purpose pin with an external circuit, then the FPLD I/O pin connected to it
must be tristated.
An LED digit connects directly to the FPLD. (These same FPLD pins also drive the VGA
monitor connector on versions 1.2 and higher of the XS Board.) The FPLD can be
programmed so the microcontroller can control the LEDs either through P1 or P3 or by
memory-mapping a latch for the LED into the memory space of the 8031.
The PC can transmit signals to the XS Board through the eight data output bits of the
printer port. The FPLD has direct access to these signals. The microcontroller can also
access them by programming the FPLD to pass the data output bits onto the FPLD I/O
pins connected to the 8031. The printer port data bits are also passed through the
cascade header to the next XS Board in the chain (if there is one).
Communication from the XS Board back to the PC also occurs through the parallel port.
Four of the parallel port status pins are connected to three pins of P1 and one pin of P3 .
Either the microcontroller or the FPLD can drive the status pins. The PC can read the
status pins to fetch data from the XS Board.
2608 Sweetgum Drive
Apex NC 27502
Toll-free: 800-549-9377
International: 919-387-0076
FAX: 919-387-1302
All rights reserved. No part of this publication may be reproduced, stored in a retrieval
system, or transmitted, in any form or by any means, electronic, mechanical,
photocopying, recording, or otherwise, without the prior written permission of the publisher.
Printed in the United States of America.
Limited Warranty
X Engineering Software Systems Corp. (XESS) warrants that the Product, in the course of
its normal use, will be free from defects in material and workmanship for a period of one
(1) year and will conform to XESS’s specification therefor. This limited warranty shall
commence on the date appearing on your purchase receipt.
XESS shall have no liability for any Product returned if XESS determines that the asserted
defect a) is not present, b) cannot reasonably be rectified because of damage occurring
before XESS receives the Product, or c) is attributable to misuse, improper installation,
alteration, accident or mishandling while in your possession. Subject to the limitations
specified above, your sole and exclusive warranty shall be, during the period of warranty
specified above and at XESS’s option, the repair or replacement of the product. The
foregoing warranty of XESS shall extend to repaired or replaced Products for the balance
of the applicable period of the original warranty or thirty (30) days from the date of
shipment of a repaired or replaced Product, whichever is longer.
In the United States, some statutes do not allow exclusion or limitations of incidental or
consequential damages, so the limitations above may not apply to you. This warranty
gives you specific legal rights, and you may also have other rights which vary from state to
state.
Chapter
1
Preliminaries
Getting Help!
n If you can't get the XS Board hardware to work, send an e-mail message describing
your problem to fpga-bugs@xess.com or check our web site at
http://www.xess.com/FPGA. Our web site also has
n answers to frequently-asked-questions
(http://www.xess.com/FPGA/ho01000.html),
n a place to sign-up for our email forum where you can post questions to other XS
Board users (http://www.xess.com/FPGA/list_reg.html).
n If you can't get your XILINX Foundation software tools installed properly, send an e-
mail message describing your problem to hotline@xilinx.com or check their web site
at http://www.xilinx.com.
Take notice!!
n The XS Boards require an external power supply to operate! They do not draw power
through the downloading cable from the PC parallel port.
n If you are connecting a 9VDC power supply to your XS Board, please make sure the
center terminal of the plug is positive and the outer sleeve is negative.
n The V1.3 version of the XS40 and XSP Boards now use a programmable oscillator
with a default setting of 50 MHz. You must reprogram the oscillator if you want to use
another frequency. The procedure for doing this is described on page 9. The XS95
Board uses a 12 MHz fixed-frequency oscillator and does not need to be
programmed.
Packing List
n an XS40, XS95 or XSP Board (note that your XSP Board will be labeled as an XS40
but the socket will contain a Xilinx Spartan FPGA with an "XCS" prefix);
n a 3.5" floppy diskette or CDROM with software utilities for using the XS40, XSP or
XS95 Board and documentation.
3
Chapter
2
Installation
Installing the XSTOOLs Utilities and Documentation
XILINX currently provides the Foundation tools for programming their FPGAs and CPLDs.
Any recent version of XILINX software should generate bitstream configuration files that
are compatible with your XS40, XSP or XS95 Boards. Follow the directions XILINX
provides for installing their software.
XESS Corp. provides the additional XSTOOLs utilities for interfacing a PC to your XS
Board. Run the SETUP.EXE program on the 3.5" diskette or CDROM to install these
utilities.
Once the XSTOOLs are installed you will see the following subdirectories:
XSTOOLS\DOCS contains the documentation and schematics for the XS40, XSP
and XS95 Boards.
You can use your XS Board in two ways, distinguished by the method you use to apply
power to the board.
You can use your XS Board all by itself to experiment logic and microcontroller designs.
Just place the XS Board on a non-conducting surface as shown in Figure 1. Then apply
power to jack J9 of the XS Board from a 9V DC wall transformer with a 2.1 mm female,
center-positive plug. (See Figure 2 or Figure 3 for the location of jack J9 on your
XS40/XSP or XS95 Board, respectively.) The on-board voltage regulation circuitry will
create the voltages required by the rest of the XS Board circuitry.
Protoboard Installation
The two rows of pins from your XS Board can be plugged into a protoboard with holes
spaced at 0.1" intervals. (One of the A.C.E. protoboards from 3M is a good choice.)
4
Once plugged in, all the pins of the FPLD and microcontroller are accessible to other
circuits on the protoboard. (The numbers printed next to the rows of pins on your XS
Board correspond to the pin numbers of the FPGA or CPLD.) Power can still be supplied
to your XS Board though jack J9, or power can be applied directly through several pins on
the underside of the board. Just connect +5V, +3.3V, and ground to the following pins for
your particular type of XS Board. (You will need +3.3V only if your XS40 Board contains
an XC4000XL type of FPGA.)
XS40-005XL V1.3 52 2 54
5
• Figure 2: Arrangement of components on the XS40 and XSP Boards.
6
Connecting a PC to Your XS Board
The 6' cable included with your XS Board connects it to the parallel port of a PC. One end
of the cable attaches to the printer port and the other connects to the female DB-25
connector (J1) at the top of the XS Board as shown in Figure 1.
You can display images on a VGA monitor by connecting it to the 15-pin J2 connector at
the bottom of your XS Board (see Figure 1). You will have to download a VGA driver
circuit to your XS Board to actually display an image. You can find an example VGA driver
at www.xess.com/FPGA.
You can accept inputs from a keyboard or mouse by connecting it to the J5 PS/2
connector at the bottom of your XS40 or XSP Board (see Figure 1). The XS95 Board
does not have a PS/2 connector. You will have to download a mouse or keyboard driver
circuit to your XS Board to actually display an image. You can find an example keyboard
driver at www.xess.com/FPGA..
The default jumper settings shown in Table 2 and Table 3 configure your XS Board for use
in a logic design environment. You will need to change the jumper settings only if you are:
n using your XS40 or XSP Board in a stand-alone mode where it is unconnected from
the PC parallel port,
n executing microcontroller code from internal ROM instead of the external RAM on the
XS Board,
The procedures for performing the operations are described in the rest of this manual.
7
• Table 3: Jumper settings for XS40 and XSP Boards.
Off The shunt should be removed if the XS40 or XSP Board is being configured from the on-board serial
EEPROM (U7).
J6 On The shunt should be installed when the on-board serial EEPROM (U7) is being programmed.
Off The shunt should be removed during normal board use.
(default)
J7 1-2 (ext) The shunt should be installed on pins 1 and 2 (ext) if the 8031 microcontroller program is stored in the
(default) external 32 KByte RAM (U8) of the XS40 Board.
2-3 (int) The shunt should be installed on pins 2 and 3 (int) if the program is stored internally in the
microcontroller.
J8 On The shunt should be installed in XS40 or XSP Boards which use the 3.3V XC4000XL type of FPGAs.
Off The shunt should be removed on XS40 or XSP Boards which use the 5V XC4000E type of FPGAs.
J10 On The shunt should be installed if the XS40 or XSP Board is being configured from the on-board serial
EEPROM.
Off The shunt should be removed if the XS40 or XSP Board is being downloaded from the PC parallel
(default) port.
J11 On The shunt should be installed if the XS40 or XSP Board is being downloaded from the PC parallel port.
(default)
Off The shunt should be removed if the XS40 or XSP Board is being configured from the on-board serial
EEPROM.
J12 Off The shunt should be removed during normal operations when the programmable oscillator is
(default) generating a clock signal.
On The shunt should be installed when the programmable oscillator frequency is being set.
Once your XS Board is installed and the jumpers are in their default configuration, you can
test the board using one of the commands listed in Table 4. You must execute the
command in a DOS window and be in the XSTOOLS\BIN directory to run the XSTEST
command.
8
The test procedure programs the FPGA or CPLD, loads the RAM with a test program for
the microcontroller, and then the microcontroller executes this program. The total test
period (including programming the board) is about 15 seconds for an XS40 or XSP Board,
and about a minute for an XS95 Board. If the test completes successfully, then you will
see a O displayed on the LED digit.
However, if the test program detects an error, then the LED digit displays an E or remains
blank. In this case, check the following items:
n Make sure the board is receiving power from a 9V DC power supply through jack J9
or through the VCC and GND pins.
n Check that the board is sitting upon a non-conducting surface and that there are no
connections to any of the pins (except for the VCC and GND pins if this is the way you
are powering the board).
n Make sure the downloading cable is securely attached to the XS Board and the PC
parallel port.
n Verify that the parallel port is in ECP mode. (The mode is usually set in the BIOS as
either SPP, EPP, ECP, or bidirectional. ECP mode works most reliably while
bidirectional mode is not recommended.)
If all these checks are positive, then test the board using another PC. In our experience,
99.9% of all problems are due to the parallel port. If you cannot get your XS Board to pass
the test even after taking these steps, then contact XESS Corp. to get a replacement
board.
The XS40 and XSP Boards have a 100 MHz programmable oscillator (a Dallas
Semiconductor DS1075Z-100). The 100 MHz master frequency can be divided by factors
of 1, 2, ... up to 2048 to get clock frequencies of 100 MHz, 50 MHz, ... down to 48.8 KHz,
respectively. The divided frequency is sent to the rest of the circuitry as a clock signal.
The divisor is stored in non-volatile memory in the oscillator chip so it will resume
operation at its set frequency whenever power is applied to the board. These steps will
store a particular divisor into the oscillator chip memory:
1) In a DOS window, use the following command with arguments that list the type of XS
Board you are using and the particular clock divisor you want:
9
This example command will set the programmable oscillator on an XS40-005XL
Board to a frequency of 100 MHz / 8 = 12.5 MHz You may use any divisor between 1
and 2048 depending upon the clock frequency you want to use.
2) The XSSETCLK will prompt you to remove the power and download cables from your
XS Board. Then you should place a shunt on jumper J12. Then re-attach the
download cable. Then reattach the power cable only after the download cable is
attached!. When power is restored to the XS Board, the programmable oscillator will
power up in its programming mode instead of generating a clock signal.
3) Press RETURN and the clock divisor will be programmed into the oscillator chip. If
you wish to change the value of the divisor, you may re-issue the XSSETCLK
command at this point with a new divisor value without having to power-down the XS
Board.
Once again, remove the power and download cables from your XS Board. Then remove
the shunt from jumper J12. Then re-attach the download cable and the power cable.
When power is restored to the XS Board, the programmable oscillator will power up in its
active mode and output a clock signal at the set frequency.
10
Chapter
3
Programming
This section will show you how to download a logic design from a PC into your XS Board,
and how to store a design in non-volatile memory on your XS Board that will become
active when power is applied.
During the development and testing phases, you will usually connect the XS Board to the
parallel port of a PC and download your circuit each time you make changes to it. You
can download an FPGA design into your XS40 or XSP Board as follows:
where CIRCUIT.BIT is an XC4000 or Spartan bitstream file that contains the configuration
for the XC4000 or XCS FPGA. Make sure the file contains a bitstream for the type of
FPGA chip installed on your XS40 or XSP Board. This file is created using the XILINX
Foundation software tools.
You can download an XC9500-based design into the XS95 Board as follows:
where CIRCUIT.SVF is an XC9500 bitstream file that contains the configuration for the
XC9500 CPLD. Make sure the file contains a bitstream for the type of XC9500 chip
installed on your XS95 Board. This file is created using the XILINX Foundation software
tools.
Use one of the following commands if you need to configure the FPGA or CPLD and also
download an Intel-formatted HEX file into the static RAM of the XS Board:
where CIRCUIT.BIT is a bitstream file and FILE.HEX is a file containing hexadecimal data.
The HEX file could contain microcontroller object code generated by the ASM51
11
assembler, or it could be arbitrary data from some other source. Whatever its source, the
hexadecimal data is downloaded into the XS Board RAM.
XSLOAD assumes the XS Board is connected to parallel port #1 of your PC. You can
specify another port number using the -P option like so:
Once your design is finished, you may want to store the design on the XS Board so that it
is configured for operation as soon as power is applied.
This is easy with the XS95 Board. The XC9500 CPLD always stores its current
configuration in an on-chip Flash memory. This configuration is restored whenever power
is applied to the XS95 Board. So your design is always available even when the board is
not connected to a PC.
But the XC4000 or XCS FPGA on the XS40 or XSP Board stores its configuration in an
on-chip RAM which is erased whenever power is interrupted. You can place an external
serial EEPROM in socket U7 which stores the FPGA configuration and reloads it on
power-up. The XILINX XC1700 series of serial EEPROMs is a good choice for this, but
you will need an external programmer to load your bitstream into the XC1700 chip. Also
the XC1700 is one-time programmable (OTP), so you will need a new chip every time you
change your logic design. Table 5 lists the serial EEPROM chips you need for storing the
bitstream files for the various types of XS Boards.
You also have the option of storing your design into an AT17C256 Atmel reprogrammable
serial EEPROM if you have an XS40-005E, XS40-005XL, or XS40-010E Boards. The
XS40 Board can directly program the Atmel chip and the FPGAs on these boards have
bitstream files which are small enough to fit in the AT17C256. The following steps will
enable you to load your design into the Atmel EEPROM:
2) Place a shunt on jumper J6. This enables the programming circuitry in the Atmel
EEPROM chip.
12
3) Apply power to the XS Board.
4) Use the following command to load the FPGA bitstream file into the EEPROM:
It will take less than a minute to program the contents of the bitstream in CIRCUIT.BIT
into the Atmel EEPROM.
6) Remove the shunt on jumper J6. This disables the programming circuitry in the Atmel
EEPROM chip so your design cannot be overwritten.
Once you have your design loaded into a XILINX or Atmel EEPROM, you can place it in
socket U7 on the XS Board. Then the following steps will make the XS Board configure
itself from the EEPROM instead of the PC parallel port interface:
2) Place a shunt on jumper J10. This sets the FPGA into the active-serial mode so it will
provide a clock signal to the EEPROM which sequences the loading of the
configuration from the EEPROM into the FPGA.
3) Remove the shunts on jumpers J4 and J11. This prevents the PC interface circuitry
on the XS Board from interfering with the clock and data signals from the FPGA.
4) Apply power to the XS Board. The FPGA will be configured from the serial EEPROM.
You may reattach the downloading cable if you need to inject test signals into your
design using the XSPORT program.
13
Chapter
4
Programmer's
Models
This section discusses the organization of components on the XS Boards and introduces
the concepts required to create applications that use both the microcontroller and the
FPLD (field programmable logic device). Building FPLD-based designs is covered in
detail in the Practical Xilinx Designer by Prentice-Hall.
The basic design flow for building microcontroller+FPLD applications is shown in Figure 4.
Initially you have to get the specifications for the system you are trying to design. Then
you have to determine what inputs are available to your system and what outputs it will
generate.
At this point, you have to partition the functions of your system between the microcontroller
and the FPLD. Some of the input signals will go to the microcontroller, some will go to the
FPLD, and some will go to both. Likewise, some of the outputs will be computed by the
microcontroller and some by the FPLD. There will also be some new intra-system inputs
and outputs created by the need for the microcontroller and the FPLD to cooperate.
In general, the FPLD will be used mainly for low-level functions where signal transitions
occur more frequently and the control logic is simpler. A specialized serial
transmitter/receiver would be a good example. Conversely, the microcontroller will be
used for higher-level functions where the responses occur less quickly and the control
logic is more complex. Reacting to commands passed in by the receiver is a good
example.Once the design has been partitioned and you have assigned the various inputs,
outputs, and functions to the microcontroller and the FPLD, then you can begin doing
detailed design of the software and hardware. For the software, you can use your favorite
editor to create a .ASM assembly-language file and assemble it with ASM51 to create a
.HEX file for the 8031 microcontroller on the XS Board. For the FPLD hardware portion,
you will enter truth-tables and logic equations into a .ABL or .VHDL file and compile it into
a .BIT or .SVF bitstream file using the XILINX Foundation software.
With the .HEX 8031-program file and the FPLD bitstream file in hand, you can download
them to the XS Board using the XSLOAD program. XSLOAD stores the contents of the
.HEX file into the static RAM on the XS Board and then it reconfigures the FPLD by
loading it with the bitstream file.
When the XS Board is loaded with the hardware and software, you need to test it to see if
it really works. The answer usually starts as "No" so you need a method of injecting test
14
signals and observing the results. XSPORT is a simple program that lets you send test
signals to the XS Board through the PC parallel port. You can trace the reaction of your
system to signals from the parallel port by programming the microcontroller and the FPLD
to output status information on the LED digit (much like placing "printf" statements in your
C language programs). This is admittedly crude but will serve if you don't have access to
programmable stimulus generators and logic analyzers.
The microcontroller and the FPLD on the XS Board are already connected together.
These existing connections save you the effort of having to wire them yourself, but they
also impose limitations on how your program and the FPLD hardware will interact. High-
level views of how the microcontroller, RAM, and FPLD on the XS40, XSP, and XS95
Boards are connected are shown in Figure 5, Figure 6, and Figure 7, respectively. More
detailed schematics are presented at the end of this manual.
The oscillator output goes directly to a synchronous clock input of the FPLD. The FPLD
can control the clock it sends to the XTAL1 clock input of the microcontroller.
15
The microcontroller multiplexes the lower eight bits of a memory address with eight bits of
data and outputs this on its P0 port. Both the RAM data lines and the FPLD are
connected to P0. The RAM uses this connection to send and receive data to and from the
microcontroller. The FPLD is programmed to latch the address from P0 under control of
the ALE signal and send the latched address bits to the lower eight address lines of the
RAM.
Meanwhile, the upper eight bits of the address are output on port P2 of the microcontroller.
The RAM uses the lower seven of these address bits. The FPLD also receives the upper
eight address bits and decodes these along with the PSEN and read/write control line
(from pin P3.6 of port P3 ) from the microcontroller to generate the CE and OE signals that
enable the RAM and its output drivers, respectively. Either of the CE or OE signals can be
pulled high to disable the RAM and prevent it from having any effect on the rest of the XS
Board circuitry.
One of the outputs of the CPLD controls the reset line of the microcontroller. The
microcontroller can be prevented from having any effect on the rest of the circuitry by
forcing the RST pin high through the FPLD. (When RST is active, the microcontroller pins
are weakly pulled high.)
Many of the I/O pins of ports P1 and P3 of the microcontroller connect to the FPLD and
can be used for general-purpose I/O between the microcontroller and the FPLD. In
addition to being general-purpose I/O, the P3 pins also have special functions such as
serial transmitters, receivers, interrupt inputs, timer inputs, and external RAM read/write
control signals. If you aren't using a particular special function, then you can use the
associated pin for general-purpose I/O between the microcontroller and the FPLD. In
many cases, however, you will program the FPLD to make use of the special-purpose
microcontroller pins. (For example, the FPLD could generate microcontroller interrupts.) If
you want to use the special-purpose pin with an external circuit, then the FPLD I/O pin
connected to it must be tristated.
An LED digit connects directly to the FPLD. (These same FPLD pins also drive the VGA
monitor connector. The FPLD can be programmed so the microcontroller can control the
LEDs either through P1 or P3 or by memory-mapping a latch for the LED into the memory
space of the 8031.
The PC can transmit signals to the XS Board through the eight data output bits of the
printer port. The FPLD has direct access to these signals. The microcontroller can also
access them if you program the FPLD to pass the data bits onto the FPLD I/O pins
connected to the microcontroller.
Communication from the XS Board back to the PC also occurs through the parallel port.
The parallel port status pins are connected to pins of microcontroller ports P1 and P3 .
Either the microcontroller or the FPLD can drive the status pins. The PC can read the
status pins to fetch data from the XS Board.
The FPGAs on the XS40 and XSP Boards also have access to the clock and data lines of
a keyboard or mouse attached to the PS/2 port of the board.
16
• Table 6: XS40 Board pin descriptions.
17
• Figure 5: XS40 Board programmer's model.
18
• Table 7: XSP Board pin descriptions.
19
• Figure 6: XSP Board programmer's model.
20
• Table 8: XS95 Board pin descriptions.
21
76 FREE4
77 FREE5
22
• Figure 7: XS95 Board programmer's model.
23
XS40 and XSP Board Schematic
XS95 Board Schematic
2608 Sweetgum Drive
Apex NC 27502
Toll-free: 800-549-9377
International: 919-387-0076
FAX: 919-387-1302
All rights reserved. No part of this publication may be reproduced, stored in a retrieval
system, or transmitted, in any form or by any means, electronic, mechanical,
photocopying, recording, or otherwise, without the prior written permission of the publisher.
Printed in the United States of America.
Limited Warranty
X Engineering Software Systems Corp. (XESS) warrants that the Product, in the course of
its normal use, will be free from defects in material and workmanship for a period of one
(1) year and will conform to XESS’s specification therefor. This limited warranty shall
commence on the date appearing on your purchase receipt.
XESS shall have no liability for any Product returned if XESS determines that the asserted
defect a) is not present, b) cannot reasonably be rectified because of damage occurring
before XESS receives the Product, or c) is attributable to misuse, improper installation,
alteration, accident or mishandling while in your possession. Subject to the limitations
specified above, your sole and exclusive warranty shall be, during the period of warranty
specified above and at XESS’s option, the repair or replacement of the product. The
foregoing warranty of XESS shall extend to repaired or replaced Products for the balance
of the applicable period of the original warranty or thirty (30) days from the date of
shipment of a repaired or replaced Product, whichever is longer.
In the United States, some statutes do not allow exclusion or limitations of incidental or
consequential damages, so the limitations above may not apply to you. This warranty
gives you specific legal rights, and you may also have other rights which vary from state to
state.
n If you can't get the XS40 Board hardware to work, send an e-mail message describing
your problem to fpga-bugs@xess.com or check our web site at http://www.xess.com.
Our web site also has
n answers to frequently-asked-questions,
n a place to sign-up for our email forum where you can post questions to other XS
Board users.
n If you can't get your XILINX Foundation software tools installed properly, send an e-
mail message describing your problem to hotline@xilinx.com or check their web site
at http://support.xilinx.com.
Take notice!!
n The XS40 Board requires an external power supply to operate! It does not draw
power through the downloading cable from the PC parallel port.
n If you are connecting a 9VDC power supply to your XS40 Board, please make sure
the center terminal of the plug is positive and the outer sleeve is negative.
n The V1.4 version of the XS40 Board now uses a programmable oscillator with a
default frequency of 50 MHz. You must reprogram the oscillator if you want to use
another frequency. The procedure for doing this is described on page 7.
n an XS40 or XSP Board (note that your XSP Board will be labeled as an XS40 but the
socket will contain a Xilinx Spartan FPGA with an "XCS" prefix);
n a 3.5" floppy diskette or CDROM with software utilities and documentation for using
the XS40 Board.
XILINX currently provides the Foundation tools for programming their FPGAs and CPLDs.
Any recent version of XILINX software should generate bitstream configuration files that
are compatible with your XS40 Board. Follow the directions XILINX provides for installing
their software.
XESS Corp. provides the additional XSTOOLs utilities for interfacing a PC to your XS40
Board. Run the SETUP.EXE program on the 3.5" diskette or CDROM to install these
utilities.
Once the XSTOOLs are installed you will see the following subdirectories:
XSTOOLS\BIN contains the executable programs for downloading to the XS40 Board
and for applying signals to the XS40 Board through the printer port. An assembler for
the microcontroller on the XS40 Board is also included.
XSTOOLS\DOCS contains the documentation and schematics for the XS40 Board.
You can use your XS40 Board in two ways, distinguished by the method you use to apply
power to the board.
You can use your XS40 Board all by itself to experiment with logic and microcontroller
designs. Just place the XS40 Board on a non-conducting surface as shown in Figure 1.
Then apply power to jack J9 of the XS40 Board from a 9V DC wall transformer with a 2.1
mm female, center-positive plug. (See Figure 2 for the location of jack J9 on your XS40
Board.) The on-board voltage regulation circuitry will create the voltages required by the
rest of the XS40 Board circuitry.
The two rows of pins from your XS40 Board can be plugged into a solderless breadboard
with holes spaced at 0.1" intervals. (One of the A.C.E. protoboards from 3M is a good
choice.) Once plugged in, all the pins of the FPGA and microcontroller, and SRAM are
accessible to other circuits on the breadboard. (The numbers printed next to the rows of
pins on your XS40 Board correspond to the pin numbers of the FPGA.) Power can still be
XS40-005XL V1.4 52 2 54
XS40-010XL V1.4 52 2 54
J1
FPGA
U1
J10 U10
J7
Microcontroller
J2
J5
The 6' cable included with your XS40 Board connects it to a PC. One end of the cable
attaches to the parallel port on the PC and the other connects to the female DB-25
connector (J1) at the top of the XS40 Board as shown in Figure 1.
You can display images on a VGA monitor by connecting it to the 15-pin J2 connector at
the bottom of your XS40 Board (see Figure 1). You will have to download a VGA driver
circuit to your XS40 Board to actually display an image. You can find an example VGA
driver at http://www.xess.com.
You can accept inputs from a keyboard or mouse by connecting it to the J5 PS/2
connector at the bottom of your XS40 Board (see Figure 1). You can find an example
keyboard driver at http://www.xess.com.
The default jumper settings shown in Table 2 configure your XS40 Board for use in a logic
design environment. You will need to change the jumper settings only if you are:
n using your XS40 in a stand-alone mode where it is unconnected from the PC parallel
port (see page 10),
n reprogramming the clock frequency on your XS40 Board (see page 7),
n executing microcontroller code from internal ROM instead of the external SRAM on
the XS40 Board. (You will have to replace the ROMless microcontroller on the XS40
Board with a ROM version to use this feature.)
Once your XS40 Board is installed and the jumpers are in their default configuration, you
can test the board by typing one of the commands listed in Table 3 into a DOS window.
The test procedure programs the FPGA, loads the SRAM with a test program for the
microcontroller, and then the microcontroller executes this program. The total test period
(including programming the board) is about 15 seconds for an XS40 Board. If the test
completes successfully, then you will see a O displayed on the LED digit.
However, if the test program detects an error, then the LED digit displays an E or remains
blank. In this case, check the following items:
n Make sure the XS40 Board is receiving power from a 9V DC power supply through
jack J9 or through the VCC and GND pins.
n Check that the XS40 Board is sitting upon a non-conducting surface and that there
are no connections to any of the pins (except for the VCC and GND pins if this is the
way you are powering the board).
n Make sure the downloading cable is securely attached to the XS40 Board and the PC
parallel port.
n Verify that the parallel port is in ECP mode. (The mode is usually set in the BIOS as
either SPP, EPP, ECP, or bidirectional. ECP mode works most reliably while
bidirectional mode is not recommended.)
If all these checks are positive, then test the board using another PC. In our experience,
99.9% of all problems are due to the parallel port. If you cannot get your XS40 Board to
pass the test even after taking these steps, then contact XESS Corp. to get a replacement
board.
The XS40 Board has a 100 MHz programmable oscillator (a Dallas Semiconductor
DS1075Z-100). The 100 MHz master frequency can be divided by factors of 1, 2, ... up to
The divisor is stored in non-volatile memory in the oscillator chip so it will resume
operation at its programmed frequency whenever power is applied to the XS40 Board.
The following steps will store a particular divisor into the oscillator chip memory:
1) In a DOS window, use the following command with the type of XS40 Board and the
clock divisor you want listed as arguments:
The example shown above will set the programmable oscillator on an XS40-005XL
Board to a frequency of 100 MHz / 8 = 12.5 MHz You may use any divisor between 1
and 2052 depending upon the clock frequency you want to use.
2) The XSSETCLK program will prompt you to remove the power and download cables
from your XS40 Board. Then you should place a shunt on jumper J12. Then re-
attach the download cable. Then reattach the power cable only after the download
cable is attached!. When power is restored to the XS40 Board, the programmable
oscillator will power up in its programming mode instead of generating a clock signal.
3) Press RETURN and the clock divisor will be programmed into the oscillator chip. If
you wish to change the value of the divisor, you may re-issue the XSSETCLK
command at this point with a new divisor without having to power-down the XS40
Board.
4) Finally, remove the power and download cables from your XS40 Board. Then
remove the shunt from jumper J12. Then re-attach the download cable and the
power cable. When power is restored to the XS40 Board, the programmable
oscillator will power up in its active mode and output a clock signal at the programmed
frequency.
During the development and testing phases, you will usually connect the XS40 Board to
the parallel port of a PC and download your circuit each time you make changes to it. You
can download an FPGA design into your XS40 Board as follows:
where CIRCUIT.BIT is an XC4000 or Spartan bitstream file that contains the configuration
for the XC4000 or XCS FPGA. This file is created using the XILINX Foundation software
tools. Make sure the file contains a bitstream for the type of FPGA chip installed on your
XS40 Board.
Use one of the following commands if you need to configure the FPGA and also
download an Intel-formatted HEX file into the SRAM of the XS40 Board:
where CIRCUIT.BIT is a bitstream file and FILE.HEX is a file containing hexadecimal data.
The HEX file could contain microcontroller object code generated by the ASM51
assembler, or it could be arbitrary data from some other source. Whatever its source, the
hexadecimal data is downloaded into the XS40 Board SRAM.
XSLOAD assumes the XS40 Board is connected to parallel port #1 of your PC. You can
specify another port number using the -P option like so:
Once your design is finished, you may want to store the design on the XS40 Board so that
it is configured for operation as soon as power is applied.
The XC4000 or XCS FPGA on the XS40 Board stores its configuration in an on-chip
SRAM which is erased whenever power is removed. You can place an external serial
EEPROM in socket U7 which stores the FPGA configuration and reloads it on power-up.
The XILINX XC1700 series of serial EEPROMs is a good choice for this, but you will need
an external programmer to download your bitstream into the XC1700 chip. Also the
XC1700 is one-time programmable (OTP), so you will need a new chip every time you
change your logic design. Table 4 lists the serial EEPROM chip you need for storing the
bitstream files for each type of XS40 Board.
• Table 4: Recommended XILINX serial EEPROMS for various types of XS40 Boards.
You also have the option of storing your design into an AT17C256 Atmel reprogrammable
serial EEPROM if you have an XS40-005E, XS40-005XL, or XS40-010E Boards. The
XS40 Board can directly program the Atmel chip and the FPGAs on these boards have
bitstream files which are small enough to fit in the AT17C256. You can load your design
into the Atmel EEPROM by following these steps:
3) Place a shunt on jumper J6. This enables the programming circuitry in the Atmel
EEPROM chip.
5) Use the following command to load the FPGA bitstream file into the EEPROM:
It will take less than a minute to program the contents of the bitstream in CIRCUIT.BIT
into the Atmel EEPROM.
Once your design is loaded into an EEPROM, the following steps will make the XS40
Board configure itself from the EEPROM in socket U7 instead of the PC parallel port
interface:
1) Remove the downloading cable from connector J1 of the XS40 Board. (As an
alternative, you can use the command XSPORT 0 to make sure the upper two data
bits of the parallel port are at logic 0. These bits are connected to the mode pins of
the FPGA and must be at logic 0 or the FPGA will not power-up in the active-serial
mode.)
2) Place a shunt on jumper J10. This sets the FPGA into the active-serial mode so it will
provide a clock signal to the EEPROM which sequences the loading of the
configuration from the EEPROM into the FPGA.
3) Remove the shunts on jumpers J4 and J11. This prevents the PC interface circuitry
on the XS40 Board from interfering with the clock and data signals from the FPGA.
4) Apply power to the XS40 Board. The FPGA will be configured from the serial
EEPROM. You may reattach the downloading cable if you need to inject test signals
into your design using the XSPORT program.
The basic design flow for building microcontroller+FPGA applications is shown in Figure 3.
Initially you have to get the specifications for the system you are trying to design. Then
you have to determine what inputs are available to your system and what outputs it will
generate.
At this point, you have to partition the functions of your system between the microcontroller
and the FPGA. Some of the input signals will go to the microcontroller, some will go to the
FPGA, and some will go to both. Likewise, some of the outputs will be computed by the
microcontroller and some by the FPGA. There will also be some new intra-system inputs
and outputs created by the need for the microcontroller and the FPGA to cooperate.
In general, the FPGA will be used mainly for low-level functions where signal transitions
occur more frequently and the control logic is simpler. A specialized serial
transmitter/receiver would be a good example. Conversely, the microcontroller will be
used for higher-level functions where the responses occur less quickly and the control
logic is more complex. Reacting to commands passed in by the receiver is a good
example. Once the design has been partitioned and you have assigned the various
inputs, outputs, and functions to the microcontroller and the FPGA, then you can begin
doing detailed design of the software and hardware. For the software, you can use your
favorite editor to create a .ASM assembly-language file and assemble it with ASM51 to
create a .HEX file for the microcontroller on the XS40 Board. For the FPGA hardware
portion, you will enter truth-tables and logic equations into a .ABL or .VHDL file and
compile it into an .BIT bitstream file using the XILINX Foundation software.
You can download the .HEX program file and the .BIT bitstream file to the XS40 Board
using the XSLOAD program. XSLOAD stores the contents of the .HEX file into the
SRAM on the XS40 Board and then it reconfigures the FPGA by loading it with the
bitstream file.
When the XS40 Board is loaded with the hardware and software, you need to test it to see
if it really works. The answer usually starts as "No" so you need a method of injecting test
signals and observing the results. XSPORT is a simple program that lets you send test
The microcontroller and the FPGA on the XS40 Board are already connected together.
These pre-existing connections save you the effort of having to wire them yourself, but
they also impose limitations on how your microcontroller program and the FPGA hardware
will interact. A high-level view of how the microcontroller, SRAM, and FPGA on the XS40
Board are connected is shown on the following pages. A more detailed schematic is also
presented at the end of this manual.
The programmable oscillator output goes directly to a synchronous clock input of the
FPGA. The FPGA uses this clock to generate a clock that it sends to the XTAL1 clock
input of the microcontroller.
Meanwhile, the upper eight bits of the address are output on the P2 port of the
microcontroller. The 32 KByte SRAM on the XS40 Board uses the lower seven of these
address bits. The FPGA also receives the upper eight address bits and decodes these
along with the PSENB and read/write control line (from pin P3.6 of port P3 ) from the
microcontroller to generate the CEB and OEB signals that enable the SRAM and its output
drivers, respectively. Either of the CEB or OEB signals can be pulled high to disable the
SRAM and prevent it from having any effect on the rest of the XS40 Board circuitry.
One of the outputs of the FPGA controls the reset line of the microcontroller. The
microcontroller can be prevented from having any effect on the rest of the circuitry by
forcing the RST pin high through the FPGA. (When RST is active, the microcontroller pins
are weakly pulled high.)
Many of the I/O pins of ports P1 and P3 of the microcontroller connect to the FPGA and
can be used for general-purpose I/O between the microcontroller and the FPGA. In
addition to being general-purpose I/O, the P3 pins also have special functions such as
serial transmitters, receivers, interrupt inputs, timer inputs, and external SRAM read/write
control signals. If you aren't using a particular special function, then you can use the
associated pin for general-purpose I/O between the microcontroller and the FPGA. In
many cases, however, you will program the FPGA to make use of the special-purpose
microcontroller pins. (For example, the FPGA could generate microcontroller interrupts.)
If you want to drive the special-purpose pin from an external circuit, then the FPGA I/O pin
connected to it must be tristated.
A seven-segment LED digit connects directly to the FPGA. (These same FPGA pins can
also drive a VGA monitor.) The FPGA can be programmed so the microcontroller can
control the LEDs either through P1 or P3 or by memory-mapping a latch for the LED into
the memory space of the microcontroller.
The PC can transmit signals to the XS40 Board through the eight data output bits of the
parallel port. The FPGA has direct access to these signals. The microcontroller can also
access these signals if you program the FPGA to pass them onto the FPGA I/O pins
connected to the microcontroller.
Communication from the XS40 Board back to the PC also occurs through the parallel port.
The parallel port status pins are connected to pins of microcontroller ports P1 and P3 .
Either the microcontroller or the FPGA can drive the status pins. The PC can read the
status pins to fetch data from the XS40 Board.
The FPGA also has access to the clock and data lines of a keyboard or mouse attached to
the PS/2 port of the board.
VSYNC 21
VGA Inputs
37 XTAL1
HSYNC 36 10 RST
RED1 29 33 ALE
8031 uC
RED0 32
GREEN1 14 PSEN
GREEN0 67 9 P1.7
BLUE1 66 8 P1.6
BLUE0 70 7 P1.5
77 6 P1.4
6 5 P1.3
9 4 P1.2
8 3 P1.1
7 2 P1.0
S6
S6 19 27 19 P3.7 (RD)
S5 S3 S4 S5 18 18 P3.6 (WR)
S4 23 17
S3 20 P3.5 (T1)
S2 S1 S2 68 16 P3.4 (T0)
S0 24
S1 26 15 P3.3 (INT1)
S0 25 75 14 P3.2 (INT0)
69 13 P3.1 (TXD)
11 P3.0 (RXD)
7-Segment LED 10 36 P0.7 (A7/D7)
80 37 P0.6 (A6/D6)
81 38 P0.5 (A5/D5)
35 39 P0.4 (A4/D4)
38 40 P0.3 (A3/D3)
39 41 P0.2 (A2/D2)
40 42 P0.1 (A1/D1)
41 43 P0.0 (A0/D0)
28 31 P2.7 (A15)
FPGA
60 30 P2.6 (A14)
58 29 P2.5 (A13)
28
100 MHz 13
50
56 27
P2.4 (A12)
P2.3 (A11)
Prog. Osc. 51 26
25
P2.2 (A10)
57 P2.1 (A9)
59 24 P2.0 (A8)
13 D7
14
32K/128K** x 8 SRAM
D6
15 D5
21 D4
20 D3
19 D2
18 D1
17
PC Parallel Port
D0
Data Outputs
16 2 A16**
PC_D7* 34* 31
PC_D6* 32* A15**
6 A14
PC_D5 49 27
PC_D4 48 A13
4 A12
PC_D3 47 5
PC_D2 46 A11
3 A10
PC_D1 45 28
PC_D0 44 A9
26 A8
84 9 A7
83 23 A6
82 10 A5
79 11 A4
78 12 A3
5 7 A2
4 25 A1
3 8 A0
62 29 WE
* = not connected on XSP Board 24
61 OE
** = applies to XS40+ Board
65 22 CE
All rights reserved. No part of this publication may be reproduced, stored in a retrieval
system, or transmitted, in any form or by any means, electronic, mechanical,
photocopying, recording, or otherwise, without the prior written permission of the publisher.
Printed in the United States of America.
Limited Warranty
X Engineering Software Systems Corp. (XESS) warrants that the Product, in the course of
its normal use, will be free from defects in material and workmanship for a period of one
(1) year and will conform to XESS’s specification therefor. This limited warranty shall
commence on the date appearing on your purchase receipt.
XESS shall have no liability for any Product returned if XESS determines that the asserted
defect a) is not present, b) cannot reasonably be rectified because of damage occurring
before XESS receives the Product, or c) is attributable to misuse, improper installation,
alteration, accident or mishandling while in your possession. Subject to the limitations
specified above, your sole and exclusive warranty shall be, during the period of warranty
specified above and at XESS’s option, the repair or replacement of the product. The
foregoing warranty of XESS shall extend to repaired or replaced Products for the balance
of the applicable period of the original warranty or thirty (30) days from the date of
shipment of a repaired or replaced Product, whichever is longer.
In the United States, some statutes do not allow exclusion or limitations of incidental or
consequential damages, so the limitations above may not apply to you. This warranty
gives you specific legal rights, and you may also have other rights which vary from state to
state.
GXSTEST: This utility lets the user test an XS Board for proper functioning.
GXSSETCLK: this utility lets the user set the clock frequency of the programmable
oscillator on an XS Board.
GXSLOAD.EXE: This utility lets the user download FPGA and CPLD configuration files
and HEX files to an XS Board.
GXSPORT.EXE: This utility lets the user send logic inputs to an XS Board by toggling the
data pins of the PC parallel port.
Instructions for using these utilities are presented in the following sections.
GXSTEST
You start GXSTEST by clicking on the icon placed on the desktop during the
GXSTOOLs installation. This brings up the screen shown below.
Your next step is to select the parallel port that your XS Board is connected to from the
port pulldown list. GXSTEST starts with parallel port LPT1 as the default, but you can also
select LPT2 or LPT3 depending upon the configuration of your PC.
After selecting the parallel port, you select the type of XS Board you are testing from the
associated pulldown list. Then click on the TEST button to start the testing procedure.
GXSTEST will program the microcontroller and the FPGA or CPLD to perform a test
procedure. Status messages will be printed at the bottom of the GXSTEST window as the
testing proceeds. At the end of the test, you will receive a message informing you whether
your XS Board passed the test or not.
You start GXSSETCLK by clicking on the icon placed on the desktop during
the GXSTOOLs installation. This brings up the screen shown below.
Your next step is to select the parallel port that your XS Board is connected to from the
port pulldown list. GXSSETCLK starts with parallel port LPT1 as the default, but you can
also select LPT2 or LPT3 depending upon the configuration of your PC. After selecting
the parallel port, you select from the pulldown list the type of XS Board you have
connected to the PC parallel port.
Next you must enter a divisor between 1 and 2052 into the text box. Once programmed,
the oscillator will output a clock signal generated by dividing its 100 MHz master frequency
by the divisor. The divisor is stored in non-volatile storage in the oscillator chip so you only
need to use GXSSETCLK when you want to change the frequency.
An external clock signal can be substituted for the internal master frequency of the
programmable oscillator. Checking the external clock checkbox will enable this feature in
the programmable oscillator chip. Of course, you are then responsible for providing the
external clock to the XS Board.
Clicking on the SET button will start the oscillator programming procedure. Status
messages will be printed at the bottom of the GXSSETCLK window as the programming
proceeds. You will also receive instructions on how to set the shunts on the XS Board
jumpers to place the oscillator into its programming mode. At the end of the programming,
you will receive a message informing you that your XS Board clock has been set.
GXSLOAD
You start GXSLOAD by clicking on the icon placed on the desktop during the
GXSTOOLs installation. This brings up the screen shown below.
After setting the parallel port and EEPROM flag, you can download files to the XS Board
simply by dragging them to the GXSLOAD window as shown below. Once you release
the mouse left-button and drop the files, GXSLOAD will begin sending the files to the XS
Board through the parallel port connection. If you drag & drop a non-downloadable file
(one with a suffix other than .BIT, .SVF, or .HEX), GXSLOAD will ignore it.
Once the downloading is finished, the file names are added to the Recent Files window
and the Reload button is enabled. Now you can download these files to the XS Board just
by clicking on the Reload button. This is a useful shortcut to have as you make changes
to your design in Foundation and need to test the modifications.
Note that the Reload button is disabled if you do not select any files to be downloaded.
This situation is shown below.
Once you have loaded the XS Board with a configuration file using GXSLOAD, you can
then use GXSPORT to exercise the functions of your design. Click on the icon
to bring up the window shown below.
The window contains several controls which perform the following functions:
n The Port list box lets you select the parallel port that your XS Board is connected to
just like you did with the GXSLOAD program.
n There are eight buttons, each of which is associated with one of the eight data bits of
the parallel port. On startup, each button is labeled with the binary value currently
output on the associated data pin. When you click one of these buttons, the displayed
binary value toggles but this new value does not appear on the data pin until
you press the Strobe button (see below).
n The Strobe button transfers the bit values displayed on the data button to the data
pins of the parallel port. The Strobe button is enabled if at least one value on a data
button is different from the actual value output on its data pin. The Strobe button is
disabled if the value on each data pin matches the value on its associated button,
because then there is no need to transfer the values.
n Clicking the Exit button terminates GXSPORT without updating the data pins with any
new values that may have been entered.
OKI makes no warranty for the use of its products and assumes no
responsibility for any errors which may appear in this document nor
does it make a commitment to update the information contained
herein.
OKI retains the right to make changes to these specifications at
any time, without notice.
CONTENTS
1. INTRODUCTION
1.1 MSM80C154S/MSM83C154S/MSM85C154HVS Outline .................................. 3
1.2 MSM80C154S/MSM83C154S Features ............................................................. 5
1.3 Additional Features in MSM80C154S/MSM83C154S/MSM85C154HVS ........... 7
2. SYSTEM CONFIGURATION
2.1 MSM80C154S/MSM83C154S/MSM85C154HVS Logic Symbols .................... 11
2.2 MSM80C154S/MSM83C154S Pin Layout ........................................................12
2.2.1 MSM80C154S/MSM83C154S external dimensions .................................. 15
2.2.2 MSM85C154HVS pin layout and external dimensions .............................. 17
2.3 MSM80C154S Block Diagram ..........................................................................18
2.4 MSM83C154S Block Diagram ..........................................................................19
2.5 MSM85C154HVS Block Diagram .....................................................................20
2.6 Timing and Control ........................................................................................... 21
2.6.1 Outline of MSM80C154S/MSM83C154S timing ........................................21
2.6.2 Major synchronizing signals ......................................................................23
(1) ALE ......................................................................................................23
(2) PSEN ...................................................................................................23
(3) WR ...................................................................................................... 23
(4) RD ....................................................................................................... 23
2.6.3 MSM80C154S fundamental operation time charts .................................... 24
(1) External program memory read cycle timing chart ...............................24
(2) MOVX A, @Rr ......................................................................................24
(3) MOVX @Rr, A ......................................................................................25
(4) MOVX A, @DPTR ................................................................................25
(5) MOVX @DPTR, A ................................................................................26
(6) MOV direct, PORT[0, 1, 2, 3] execution ...............................................26
2.6.4 MSM83C154S fundamental operation time charts .................................... 27
(1) MOVX A, @Rr ......................................................................................27
(2) MOVX @Rr, A ..................................................................................... 27
(3) MOVX A, @DPTR ................................................................................28
(4) MOVX @DPTR, A ................................................................................28
(5) MOV direct, PORT[0, 1, 2, 3] execution ...............................................29
2.7 Instruction Register (IR) and Instruction Decoder (PLA) .................................. 30
2.8 Arithmetic Operation Section ............................................................................31
(1) Outline ..................................................................................................31
(2) Arithmetic operation instruction decoder .............................................. 31
(3) Arithmetic and logic unit (ALU) ............................................................. 31
2.9 Program Counter ..............................................................................................32
2.10 Program Memory and External Data Memory .................................................. 33
2.10.1 MSM80C154S/MSM83C154S program area and
external ROM connections ........................................................................33
2.10.2 Procedures and circuit connections used when external
data memory (RAM) is accessed by data pointer (DPTR) ........................35
2.10.3 Procedures and circuit connections used when external
data memory (RAM) is accessed by registers R0 and R1 ......................... 38
3. CONTROL
3.1 Oscillators [XTAL1 .2] .......................................................................................43
3.2 CPU Resetting ..................................................................................................45
3.2.1 Outline .......................................................................................................45
3.2.2 Reset Schmitt trigger circuit .......................................................................50
3.2.3 CPU internal status by reset ......................................................................51
3.3 EA(CPU Memory Separate) ..............................................................................52
3.3.1 Outline .......................................................................................................52
(1) Internal ROM mode ..............................................................................52
(2) External ROM mode ............................................................................. 52
4. INTERNAL SPECIFICATIONS
4.1 Internal Data Memory (RAM) and Special Function Registers ......................... 55
4.1.1 Outline ..........................................................................................................55
4.2 Internal Data Memory (RAM) ............................................................................57
4.2.1 Internal data memory (RAM) .....................................................................57
4.2.2 Internal data memory registers R0 thru R7 ...............................................59
4.2.3 Stack ..........................................................................................................60
4.3 Internal Data Memory (RAM) Operating Procedures ........................................61
4.3.1 Internal data memory indirect addressing .................................................61
4.3.2 Internal data memory register R0 thru R7 designation .............................. 62
4.3.3 Internal data memory 1-bit data designation ............................................. 63
4.4 Special Function Registers(TCON, SCON,...ACC, B) ...................................... 65
4.4.1 Outline .......................................................................................................65
4.4.2 Special function registers ..........................................................................67
4.4.2.1 Timer mode register (TMOD) ................................................................ 67
4.4.2.2 Power control register (PCON) ..............................................................68
4.4.2.3 Timer control register (TCON) ...............................................................69
4.4.2.4 Serial port control register (SCON) ........................................................70
4.4.2.5 Interrupt enable register (IE) .................................................................. 71
4.4.2.6 Interrupt priority register (IP) .................................................................. 72
4.4.2.7 Program status word register (PSW) .....................................................73
4.4.2.8 I/O control register (IOCON) .................................................................. 74
4.4.2.9 Timer 2 control register (T2CON) ..........................................................75
4.5 Timer/Counters 0, 1, and 2 ...............................................................................76
4.5.1 Outline .......................................................................................................76
4.5.2 Timer/counters 0 and 1 ..............................................................................76
4.5.2.1 Outline ...................................................................................................76
4.5.2.2 Timer/counter 0 and 1 counting control .................................................76
4.5.2.3 Timer/counter 0 and 1 count clock designation ..................................... 78
4.5.2.3.1 External clock detector circuit for timer/counters 0 and 1 ............... 79
4.5.2.4 Counting control of timer/counters 0 and 1 by INT pin ..........................80
4.5.2.5 Timer/counters 0/1 timer modes ............................................................82
4.5.2.5.1 Outline ............................................................................................82
4.5.2.5.2 Mode 0 ............................................................................................82
4.5.2.5.3 Mode 1 ............................................................................................84
4.5.2.5.4 Mode 2 ............................................................................................86
4.5.2.5.5 Mode 3 ............................................................................................88
4.5.2.5.6 32-bit timer mode ............................................................................89
4.5.2.5.7 Caution about use of timer counters 0 and 1 .................................. 90
4.5.2.5.8 Caution about use of timer counters 0 and 1 when setting software
power down mode........................................................................... 91
4.5.3 Timer/counter 2 .........................................................................................92
4.5.3.1 Outline ...................................................................................................92
4.5.3.2 Timer 2 control register (T2CON) ..........................................................92
4.5.3.3 Timer/counter 2 operation modes ..........................................................93
4.5.3.3.1 16-bit auto reload mode .................................................................. 93
4.5.3.3.2 16-bit capture mode ........................................................................94
4.5.3.3.3 16-bit baud rate generator mode .................................................... 95
4.5.3.4 Timer/counter 2 detector circuit ............................................................. 97
4.5.3.4.1 T2(timer/counter 2 external clock detector) .................................... 97
4.5.3.4.2 T2EX(timer/counter 2 external flag input detector) ......................... 97
4.5.3.5 Timer/counter carry signal detector circuit ............................................. 98
4.6 Serial Port .........................................................................................................99
4.6.1 Outline .......................................................................................................99
4.6.2 Special function registers for serial port .................................................. 101
4.6.2.1 SCON ..................................................................................................101
4.6.2.2 SBUF ...................................................................................................103
4.6.2.3 TCLK ...................................................................................................103
4.6.2.4 RCLK ...................................................................................................103
4.6.2.5 SMOD ..................................................................................................104
4.6.2.6 SERR ..................................................................................................105
4.6.3 Operating modes .....................................................................................106
4.6.3.1 Mode 0 .................................................................................................106
4.6.3.1.1 Outline........................................................................................... 106
4.6.3.1.2 Mode 0 baud rate ..........................................................................106
4.6.3.1.3 Mode 0 transmit operation ............................................................106
4.6.3.1.4 Mode 0 receive operation ............................................................. 106
4.6.3.2 Mode 1 ..................................................................................................110
4.6.3.2.1 Outline........................................................................................... 110
4.6.3.2.2 Mode 1 baud rate ..........................................................................110
4.6.3.2.3 Mode 1 transmit operation ............................................................111
4.6.3.2.4 Mode 1 receive operation ............................................................. 111
4.6.3.2.5 Mode 1 UART error detection ....................................................... 112
4.6.3.3 Mode 2 .................................................................................................115
4.6.3.3.1 Outline........................................................................................... 115
4.6.3.3.2 Mode 2 baud rate ..........................................................................115
4.6.3.3.3 Mode 2 transmit operation ............................................................115
4.6.3.3.4 Mode 2 receive operation ............................................................. 115
4.6.3.3.5 Mode 2 UART error detection ....................................................... 116
4.6.3.4 Mode 3 .................................................................................................119
4.6.3.4.1 Outline........................................................................................... 119
4.6.3.4.2 Mode 3 baud rate ..........................................................................119
4.6.3.4.3 Mode 3 transmit operation ............................................................120
4.6.3.4.4 Mode 3 receive operation. ............................................................120
4.6.3.4.5 Mode 3 UART error detection ....................................................... 121
4.6.4 Serial port application examples ..............................................................124
4.6.4.1 I/O extension .......................................................................................124
4.6.4.2 Multi-processor systems ......................................................................128
4.7 Interrupt .............................................................................................................129
4.7.1 Outline .....................................................................................................129
4.7.2 Interrupt enable register (IE) .................................................................... 131
4.7.3 Interrupt priority register (IP) .................................................................... 132
4.7.3.1 Priority interrupt routine flow ................................................................ 133
4.7.3.2 Interrupt routine flow when priority circuit is stopped ........................... 134
4.7.3.3 Interrupt priority when priority register (IP) contents are all “0” ........... 135
4.7.4 Detection of external interrupt signals INT0 and INT1 ............................. 136
4.7.4.1 Outline of INT signal detection............................................................. 136
4.7.4.2 External interrupt signal 0 and 1 level detection .................................. 136
4.7.4.3 External interrupt signal 0 and 1 trigger detection ...............................137
4.7.5 MSM80C154S/MSM83C154S interrupt response time charts ................ 138
4.7.5.1 Interrupt response time chart when interrupt conditions are satisfied
during execution of ordinary instruction in main routine ...................... 138
4.7.5.2 Interrupt response time chart when interrupt conditions are satisfied
during execution of IE or IP register operation instruction in main
routine ..................................................................................................140
4.7.5.3 Interrupt response time chart when an ordinary instruction is
executed after temporarily returning to the main routine from
continuous interrupt processing ........................................................... 142
4.7.5.4 Interrupt response time chart when an IE or IP manipulating
instruction is executed after temporarily returning to the main
routine from continuous interrupt processing ...................................... 144
4.8 CPU “Power Down” ........................................................................................146
4.8.1 Outline .....................................................................................................146
4.8.2 Idle mode (IDLE) setting ..........................................................................146
4.8.3 Soft power down mode (PD) setting ........................................................151
4.8.3.1 Caution about software power down mode setting ............................. 151
4.8.4 Hard power down mode (HPD) setting .................................................... 161
4.9 CPU Power Down Mode (IDLE, PD, and HPD) Cancellation (CPU Activation) 169
4.9.1 Outline .....................................................................................................169
4.9.2 Cancellation by CPU resetting (RESET pin) ........................................... 169
4.9.3 Cancellation of CPU power down mode(IDLE, PD)by interrupt signal .... 176
4.9.3.1 Cancellation of CPU power down mode (IDLE, PD) from interrupt
address ................................................................................................176
4.9.3.2 Cancellation of CPU power down mode (IDLE, PD) by interrupt
request signal and restart from next address of stop address ............. 182
4.10 MSM80C154S/83C154S Battery Backup with Hard Power Down Mode ....... 187
5. INPUT/OUTPUT PORTS
5.1 Outline ............................................................................................................192
5.2 Port 0 ..............................................................................................................192
5.3 Port 1 ..............................................................................................................195
5.4 Port 2 ..............................................................................................................201
5.5 Port 3 ..............................................................................................................203
5.6 Port 0, 1, 2, and 3 Output and Floating Status Settings in CPU Power Down
Mode (PD, HPD) .............................................................................................205
5.7 High Impedance Input Port Setting of Each Quasi-bidirectional
Port 1, 2, and 3 ...............................................................................................207
5.8 100 kW Pull-Up Resistance Setting for Quasi-bidirectional Input
Ports 1, 2, and 3 .............................................................................................207
5.9 Precautions When Driving External Transistors by Quasi-bidirectional
Port Output Signals .........................................................................................208
5.10 Port Output Timing ..........................................................................................210
1) One machine cycle instruction output timing .............................................. 210
2) Two machine cycle instruction output timing .............................................. 211
5.11 Port Data Manipulating Instructions ................................................................ 212
6. ELECTRICAL CHARACTERISTICS
6.1 Absolute Maximum Ratings ............................................................................216
6.2 Operational Ranges. .......................................................................................216
6.3 DC Characteristics ..........................................................................................217
6.4 External Program Memory Access AC Characteristics .................................. 221
6.5 External Data Memory Access AC Characteristics ......................................... 223
6.6 Serial Port (I/O Extension Mode) AC Characteristics ..................................... 225
6.7 AC Characteristics Measuring Conditions ......................................................227
6.8 XTAL1 External Clock Input Waveform Conditions ........................................228
7. DESCRIPTION OF INSTRUCTIONS
7.1 Outline ............................................................................................................231
7.2 Description of Instruction Symbols .................................................................232
7.3 List of Instructions. ..........................................................................................233
7.4 Simplified Description of Instructions ..............................................................234
7.5 Detailed Description of MSM80C154S/MSM83C154S Instructions ............... 246
1. INTRODUCTION
MSM80C154S/83C154S/85C154HVS
2
INTRODUCTION
1. INTRODUCTION
3
MSM80C154S/83C154S/85C154HVS
execution from the next address after the stop address where CPU power down mode was
activated.
Each of the quasi-bidirectional ports 1, 2, and 3 can be set independently as high impedance
input ports. And the 10 kW pull-up resistance for these input ports can be isolated from the
power supply (VCC), leaving only the 100 kW pull-up resistance and thereby enabling the
quasi-bidirectional ports to be driven by devices with low drive capacity. Furthermore, the
outputs of ports, 0, 1, 2, and 3 can be switched to floating status during CPU power down
modes (PD, HPD).
Three built-in 16-bit timer/counters capable of operating in a wide range of modes enable the
CPUs to be used in many different ways. And since timer/counters 0 and 1 can be operated
by external clock during CPU power down modes (PD, HPD) where the oscillator is stopped,
these two counters can also be used in cancelling CPU power down modes.
UART based serial communication can be executed at any baud rate by carry signal from
timer/counter 1 or timer/counter 2.
If an overrun or framing error is generated during data reception, the SERR bit in the I/O
control register is set. And by testing this SERR bit, the accuracy of the data can be checked
quite easily to ensure correct serial communication.
As can be seen, these CPUs are equipped with a very comprehensive range of functions. Also
note that EASE80C51mkII is available for use as the program development support system
for these CPUs.
Equipped with the MSM85C154E dedicated evachip, EASE80C51mkII is capable of pro-
gram area mapping, realtime tracing, generating breaks according to accumulator contents,
and various other functions designed for accurate and efficient support of program develop-
ment of these CPUs.
With this great line-up of functions and with EASE80C51mkII capable of developing
programs in a very short time, MSM80C154S/MSM83C154S/MSM85C154HVS give a highly
integrated high performance solution.
4
INTRODUCTION
5
MSM80C154S/83C154S/85C154HVS
6
INTRODUCTION
7
MSM80C154S/83C154S/85C154HVS
8
2. SYSTEM
CONFIGURATION
MSM80C154S/83C154S/85C154HVS
10
SYSTEM CONFIGURATION
2. SYSTEM CONFIGURATION
XTAL1 P0.0
P0.1
P0.2
P0.3 PORT 0
XTAL2 P0.4 (BUS PORT)
P0.5
P0.6
P0.7
RESET RESET
P1.0 T2
P1.1 T2EX
P1.2
P1.3
PORT 1
P1.4
ADDRESS LATCH ALE P1.5
ENABLE P1.6
PROGRAM STORE PSEN P1.7
ENABLE
P2.0
P2.1
CPU MEMORY EA P2.2
SEPARATE P2.3
PORT 2
P2.4
P2.5
+5(V) VCC P2.6
P2.7
P3.0 RXD
0(V) VSS P3.1 TXD
P3.2 INT0
P3.3 INT1
PORT 3
P3.4 T0
P3.5 T1/HPDI
P3.6 WR
P3.7 RD
11
MSM80C154S/83C154S/85C154HVS
MSM80C154SRS/MSM83C154SRS
(Top View) 40 Pin Plastic DIP
P1.0/T2 1 40 VCC
P1.1/T2EX 2 39 P0.0
P1.2 3 38 P0.1
P1.3 4 37 P0.2
MSM80C154SRS/MSM83C154SRS
P1.4 5 36 P0.3
P1.5 6 35 P0.4
P1.6 7 34 P0.5
P1.7 8 33 P0.6
RESET 9 32 P0.7
P3.0/RXD 10 31 EA
P3.1/TXD 11 30 ALE
P3.2/INT0 12 29 PSEN
P3.3/INT1 13 28 P2.7
P3.4/T0 14 27 P2.6
P3.5/T1/HPDI 15 26 P2.5
P3.6/WR 16 25 P2.4
P3.7/RD 17 24 P2.3
XTAL2 18 23 P2.2
XTAL1 19 22 P2.1
VSS 20 21 P2.0
MSM80C154SGS/MSM83C154SGS
(Top View) 44 Pin Plastic Package
P1.1/T2EX
P1.0/T2
O0.1
P1.4
P1.3
P1.2
P0.0
P0.2
P0.3
VCC
NC
44 43 42 41 40 39 38 37 36 35 34
P1.5 1 33 P0.4
P1.6 2 32 P0.5
P1.7 3 31 P0.6
MSM83C154SGS
MSM80C154SGS/
RESET 4 30 P0.7
P3.0/RXD 5 29 EA
NC 6 28 NC
P3.1/TXD 7 27 ALE
P3.2/INT0 8 26 PSEN
P3.3/INT1 9 25 P2.7
P3.4/T0 10 24 P2.6
P3.5/T1/HPDI 11 23 P2.5
12 13 14 15 16 17 18 19 20 21 22
P3.6/WR
P3.7/RD
XTAL2
XTAL1
VSS
VSS
P2.0
P2.1
P2.2
P2.3
P2.4
12
SYSTEM CONFIGURATION
MSM80C154SJS/MSM83C154SJS
(Top View) 44 Pin Plastic QFJ
P1.1/T2EX
P1.0/T2
P1.4
P1.3
P1.2
P0.0
P0.1
P0.2
P0.3
VCC
NC
6 5 4 3 2 1 44 43 42 41 40
P1.5 7 39 P0.4
MSM80C154SJS/MSM83C154SJS
P1.6 8 38 P0.5
P1.7 9 37 P0.6
RESET 10 36 P0.7
P3.0/RXD 11 35 EA
NC 12 34 NC
P3.1/TXD 13 33 ALE
P3.2/INT0 14 32 PSEN
P3.3/INT1 15 31 P2.7
P3.4/T0 16 30 P2.6
P3.5/T1/HPDI 17 29 P2.5
18 19 20 21 22 23 24 25 26 27 28
P3.6/WR
P3.7/RD
XTAL2
XTAL1
VSS
NC
P2.0
P2.1
P2.2
P2.3
P2.4
MSM80C154STS/MSM83C154STS
(Top View) 44 Pin Plastic Package
P1.1/T2EX
P1.0/T2
O0.1
P1.4
P1.3
P1.2
P0.0
P0.2
P0.3
VCC
NC
44 43 42 41 40 39 38 37 36 35 34
P1.5 1 33 P0.4
P1.6 2 32 P0.5
P1.7 3 31 P0.6
MSM83C154STS
MSM80C154STS/
RESET 4 30 P0.7
P3.0/RXD 5 29 EA
NC 6 28 NC
P3.1/TXD 7 27 ALE
P3.2/INT0 8 26 PSEN
P3.3/INT1 9 25 P2.7
P3.4/T0 10 24 P2.6
P3.5/T1/HPDI 11 23 P2.5
12 13 14 15 16 17 18 19 20 21 22
P3.6/WR
P3.7/RD
XTAL2
XTAL1
VSS
VSS
P2.0
P2.1
P2.2
P2.3
P2.4
13
MSM80C154S/83C154S/85C154HVS
Applicable Packages
MSM80C154S RS
40-Pin Plastic DIP (DIP40-P-600-2.54)
MSM83C154S-XXX RS
MSM80C154S JS
44-Pin Plastic QFJ (QFJ44-P-S650-1.27)
MSM83C154S-XXX JS
MSM80C154S GS-2K
44-Pin Plastic QFP (DFP44-P-910-0.80-2K)
MSM83C154S-XXX GS-2K
MSM80C154S TS-K
44-Pin Plastic TQFP (TQFP44-P-1010-0.80-K)
MSM83C154S-XXX TS-K
40-Pin Ceramic Piggy Back (ADIP40-C-600-2.54) MSM85C154HVS
14
SYSTEM CONFIGURATION
MSM80C154SRS/MSM83C154SRS
40-pin Plastic DIP (DIP40-P-600-2.54)
MSM80C154SGS/MSM83C154SGS
44-Pin Plastic QFP (QFP44-P-910-0.80-2K)
MSM80C154SJS/MSM83C154SJS
44-Pin Plastic QFJ (QFJ44-P-S650-1.27)
15
MSM80C154S/83C154S/85C154HVS
MSM80C154STS/MSM83C154STS
44-Pin Plastic TQFP (TQFP44-P-1010-0.80-K)
16
SYSTEM CONFIGURATION
M85C154H
2764/27128 OKI
JAPAN XXXX
* The MSM85C154HVS pin layout of bottom side is the same as the pin layout for
MSM83C154SRS.
17
2.3 MSM80C154S Block Diagram
MSM80C154S/83C154S/85C154HVS
P2.0
PORT 2
P2.7 CONTROL SIGNAL R/W SIGNAL
DPH
P0.0 SPECIAL
PORT 0
FUNCTION
DPL PLA REGISTER
Figure 2-5 MSM80C154S block diagram
P0.7 ADDRESS
DECODER
XTAL1
OSC AND TIMING
PCON
PCHL PCLL
XTAL2 SP
ALE IR AIR
PCH PCL
PSEN
IOCON
C-ROM
18
EA
RESET
T2CON TL2 TH2 R/W AMP ACC TR2 TR1
TIMER/
P1.0 COUNTER 2
PORT 1
P3.0
PORT 3
PORT 2
P2.7 CONTROL SIGNAL R/W SIGNAL
DPH
P0.0 SPECIAL
PORT 0
ROM FUNCTION
16KWORD DPL PLA REGISTER
Figure 2-6 MSM83C154S block diagram
PCON
PCHL PCLL
XTAL2 SENSE AMP SP
ALE IR AIR
PCH PCL
PSEN
IOCON
C-ROM
19
EA
RESET
T2CON TL2 TH2 R/W AMP ACC TR2 TR1
TIMER/
P1.0 COUNTER 2
PORT 1
SYSTEM CONFIGURATION
P1.7
P3.0
PORT 3
MSM80C154S/83C154S/85C154HVS
P2.0
PORT 2
SOCKET
P2.7 CONTROL SIGNAL R/W SIGNAL
DPH
A0
P0.0 EXTERNAL SPECIAL
PORT 0
ROM FUNCTION
Figure 2-7 MSM85C154HVS block diagram
PCON
PCHL PCLL
XTAL2 D0 ... D7 SP
ALE IR AIR
PCH PCL
PSEN
IOCON
C-ROM
20
EA
RESET
T2CON TL2 TH2 R/W AMP ACC TR2 TR1
TIMER/
P1.0 COUNTER 2
PORT 1
P3.0
PORT 3
S1 S2 S3 S4 S5 S6
DQ DQ DQ DQ DQ DQ
S I/O
S I/O & TIMER CONTROL
TIMER & INTERRUPT
XTAL2
XTAL1 CPU
CPU CONTROL
PLA
1/2 POWER DOWN
1/2 IDLE
RESET
INT PLA OUT
Figure 2-8 Oscillator, timing counter, and control stage block diagram
21
CYCLE M1 M1 M2 M1
STEP S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6
1
XTAL1
0
1
ALE
0
1
PSEN
0
1
RD/WR
0
DPL & Rr
1
PORT–0 PCL PCL PCL ACC & RAM PCL PCL PCL
0
MSM80C154S/83C154S/85C154HVS
1
PORT–2 PCH PCH PCH PCH DPH & PORT DATA PCH PCH PCH
0
DATA STABLE DATA STABLE
1
CPU←PORT
22
0
1
PORT←CPU PORT OLD DATA PORT NEW DATA
0
Instruction excecution Instruction excecution Instruction excecution
23
MSM80C154S/83C154S/85C154HVS
S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1
1
XTAL1
0
1
ALE
0
1
PSEN
0
INST IN INST IN INST IN INST IN INST IN
1 PCL PCL PCL PCL
PORT–0
0 OUT OUT OUT OUT
1
PORT–2 PCH OUT PCH OUT PCH OUT PCH OUT PCH OUT
0
Figure 2-10 MSM80C154S external program memory read cycle timing chart
S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1
1
XTAL1
0
1
ALE
0
1
PSEN
0
1
RD
0
INST IN RAM DATA IN INST IN
1 PCL Rr EXT RAM PCL
PORT–0
0 OUT OUT DATA OUT
1
PORT–2 PCH OUT PCH OUT PORT 2 LATCH DATA OUT PCH OUT
0
24
SYSTEM CONFIGURATION
M1 M2
S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1
1
XTAL1
0
1
ALE
0
1
PSEN
0
1
WR
0
INST IN INST IN
1 PCL Rr PCL
PORT–0 ACC DATA OUT
0 OUT OUT OUT
1
PORT–2 PCH OUT PCH OUT PORT 2 LATCH DATA OUT PCH OUT
0
S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1
1
XTAL1
0
1
ALE
0
1
PSEN
0
1
RD
0
INST IN RAM DATA IN INST IN
1 PCL DPL EXT RAM PCL
PORT–0
0 OUT OUT DATA OUT
1
PORT–2 PCH OUT PCH OUT DPH OUT PCH OUT
0
25
MSM80C154S/83C154S/85C154HVS
M1 M2
S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1
1
XTAL1
0
1
ALE
0
1
PSEN
0
1
WR
0
INST IN INST IN
1 PCL DPL PCL
PORT–0 ACC DATA OUT
0 OUT OUT OUT
1
PORT–2 PCH OUT PCH OUT DPH OUT PCH OUT
0
S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1
1
XTAL1
0
1
ALE
0
1
PSEN
0
PORT 0,1,2,3 1
PIN DATA 0
PIN DATA STABLE
CPU DATA 1
SAMPLED 0
26
SYSTEM CONFIGURATION
S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1
1
XTAL1
0
1
ALE
0
1
PSEN
0
1
RD
0
RAM DATA IN
1 Rr EXT RAM FLOATING
PORT–0 PORT 0 LATCH DATA
0 OUT DATA
1
PORT–2 PORT 2 LATCH DATA OUT
0
S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1
1
XTAL1
0
1
ALE
0
1
PSEN
0
1
WR
0
1 Rr FLOATING
PORT–0 PORT 0 LATCH DATA ACC DATA OUT
0 OUT
1
PORT–2 PORT 2 LATCH DATA OUT
0
27
MSM80C154S/83C154S/85C154HVS
M1 M2
S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1
1
XTAL1
0
1
ALE
0
1
PSEN
0
1
RD
0
RAM DATA IN
1 DPL EXT RAM FLOATING
PORT–0 PORT 0 LATCH DATA
0 OUT DATA
1 PORT 2 LATCH
PORT–2 PORT 2 LATCH DATA OUT DPH OUT
0 DATA OUT
S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1
1
XTAL1
0
1
ALE
0
1
PSEN
0
1
WR
0
1 DPL FLOATING
PORT–0 PORT 0 LATCH DATA ACC DATA OUT
0 OUT
1 PORT 2 LATCH
PORT–2 PORT 2 LATCH DATA OUT DPH OUT
0 DATA OUT
28
SYSTEM CONFIGURATION
M1 M2
S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1
1
XTAL1
0
1
ALE
0
1
PSEN
0
PORT 0,1,2,3 1
PIN DATA 0
PIN DATA STABLE
CPU DATA 1
SAMPLED 0
29
MSM80C154S/83C154S/85C154HVS
Timing
AND
Matrix Control signals
AIR
PLA
WAIR
Timing
AND
PLA
WIR
30
SYSTEM CONFIGURATION
(1) Outline
The MSM80C154S/MSM83C154S arithmetic operation section consists of
(1) an arithmetic operation instruction decoder, and
(2) an arithmetic and logic unit [ALU].
PSW(0D0H)
CY AC F0 RS1 RS0 OV F1 P
7 6 5 4 3 2 1 0
31
MSM80C154S/83C154S/85C154HVS
ENABLE ROM
CPU INTERNAL
DATA BUS
EXTERNAL
ROM MODE
PC+1
This program counter is a binary up-counter which is incremented by 1 each time one byte
of instruction code is fetched. When the program counter is counted by 1 after counter
contents have reached 0FFFFH, the counter is returned to 0000H. MSM83C154S is
automatically switched to external ROM mode when the counter contents exceed 3FFFH.
32
SYSTEM CONFIGURATION
65535 0FFFFH
Timer interrupt 2 start address 43 002BH
MSM83C154S external ROM area
44 002CH
43 002BH
External interrupt 0 start address 3 0003H
2 0002H
1 0001H
33
MSM80C154S/83C154S/85C154HVS
Figure 2-25 MSM80C154S/MSM83C154S external ROM connection diagram
P0.0 D0 Q0 A0 Q0 Q1 Q2 Q3 Q4 Q5 Q6 Q7
P0.1 D1 Q1 A1
MSM74HC373
P0.2 D2 Q2 A2
P0.3 D3 Q3 A3
P0.4 D4 Q4 A4
P0.5 D5 Q5 A5
MSM80C154S/MSM83C154S
P0.6 D6 Q6 A6
P0.7 D7 Q7 A7
34
ALE LATCH
ROM
P2.0 A8 64kW × 8BIT
P2.1 A9
P2.2 A10
P2.3 A11
P2.4 A12
P2.5 A13
P2.6 A14
P2.7 A15
CS
PSEN OUTPUT ENABLE
SYSTEM CONFIGURATION
2.10.2 Procedures and circuit connections used when external data memory (RAM)
is accessed by data pointer (DPTR)
35
MSM80C154S/83C154S/85C154HVS
Figure 2-26 Connection circuit for external data memory addressed by DPTR
I/O 0 1 2 3 4 5 6 7
P0.0 D0 Q0 A0
P0.1 D1 Q1 A1
MSM74HC373
P0.2 D2 Q2 A2
P0.3 D3 Q3 A3
P0.4 D4 Q4 A4
P0.5 D5 Q5 A5
MSM80C154S/MSM83C154S
P0.6 D6 Q6 A6
P0.7 D7 Q7 A7
36
ALE LATCH
ROM
P2.0 A8 64kW × 8BIT
P2.1 A9
P2.2 A10
P2.3 A11
P2.4 A12
P2.5 A13
P2.6 A14
P2.7 A15
WR R/W
RD CS
M1 M1 M2 M1
S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6
1
XTAL1
0
1
ALE
0
1
PSEN
0
INSTRUCTION IN
1
PORT–0 PCL PCL PCL PCL DPL ACC DATA PCL PCL PCL
0
1
PORT–2 PCH PCH PCH PCH DPH PCH PCH PCH
0
1
WR
0
MOVX @DPTR, A
37
M1 M1 M2 M1
S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6
1
XTAL1
0
1
ALE
0
1
PSEN
0
INSTRUCTION IN RAM DATA IN
1
PORT–0 PCL PCL PCL PCL DPL PCL PCL PCL
0
2.10.3 Procedures and circuit connections used when external data memory (RAM)
is accessed by registers R0 and R1
38
SYSTEM CONFIGURATION
7
6
5
256W × 8BIT
4
ROM
3
2
1 I/O 0
R/W
CS
A0
A1
A2
A3
A4
A5
A6
A7
Q0
Q1
Q2
Q3
Q4
Q5
Q6
Q7
LATCH
MSM74HC373
D0
D1
D2
D3
D4
D5
D6
D7
P0.0
P0.1
P0.2
P0.3
P0.4
P0.5
P0.6
P0.7
ALE
WR
RD
MSM80C154S/MSM83C154S
Figure 2-28 Connection circuit for external data memory addressed by register R0 or R1
39
M1 M1 M2 M1
S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6
1
XTAL1
0
1
ALE
0
1
PSEN
0
INSTRUCTION IN
1
PORT–0 PCL PCL PCL PCL Rr ACC DATA PCL PCL PCL
0
1
PORT–2 PCH PCH PCH PCH PORT 2 LATCH DATA PCH PCH PCH
0
MSM80C154S/83C154S/85C154HVS
1
WR
0
MOVX @Rr, A
40
M1 M1 M2 M1
S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6
1
XTAL1
0
1
ALE
0
1
PSEN
0
INSTRUCTION IN RAM DATA IN
1
PORT–0 PCL PCL PCL PCL Rr PCL PCL PCL
0
1
PORT–2 PCH PCH PCH PCH PORT 2 LATCH DATA PCH PCH PCH
0
42
CONTROL
3. CONTROL
An oscillator is formed by connecting a crystal or ceramic resonator between the XTAL1 and
XTAL2 pins of the MSM80C154S/MSM83C154S devices.
If an external clock is applied to XTAL1, the input should be at 50% duty and C-MOS level.
IDLE MODE
CPU CONTROL CLOCK
C XTAL1
*
XTAL 1MΩ
C XTAL2
*
MSM80C154S/MSM83C154S
43
MSM80C154S/83C154S/85C154HVS
IDLE MODE
CPU CONTROL CLOCK
C XTAL1
*
C 1MΩ
XTAL2
*
MSM80C154S/MSM83C154S
IDLE MODE
CPU CONTROL CLOCK
XTAL1
74HC04 1MΩ
XTAL2
*CLOCK
MSM80C154S/MSM83C154S
44
CONTROL
3.2.1 Outline
If a reset signal (kept at “1” level for at least 1µsec) is applied to the RESET pin when the
correct voltage (in respect to the various specifications) is applied to the MSM80C154S/
MSM83C154S VCC pin, a reset signal is stored in the CPU even if the XTAL1·2 oscillators
have been stopped.
The internally stored reset signal is used in direct initialization (setting to “1”) of ports 0, 1, 2,
and 3. All of the special function registers are then initialized (set to “0”) two machine cycles
after the XTAL1·2 oscillator commences regular operation.
When the reset is released, instruction execution is started in the third machine cycle if the
reset signal is changed from “1” level to “0” level before the M1·S1 signal leading edge, and
in the fifth machine cycle if the reset signal is changed from “1” to “0” after the leading edge.
The reset circuit block diagram is shown in Figure 3-4, the reset start time charts in Figures
3-5 and 3-6, and the reset release time charts in Figures 3-7 and 3-8.
VCC
+
– RESET
IN CPU RESET CONTROL
•
R=40KΩ
•
45
M1 or M2 M1 M2 M1
S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6
1
XTAL1
0
1
ALE
0
1
PSEN
0
1 PORT DATA FLOATING
PORT 0
0
1
PORT 1 PORT DATA PORT DATA = 1
0
MSM80C154S/83C154S/85C154HVS
1
PORT 2 PORT DATA PORT DATA = 1
0
1
PORT 3 PORT DATA PORT DATA = 1
46
0
1
RESET
0
CPU RESET 1
CONTROL 0
RESET 1
CPU RESET EXCECUTE CYCLE
EXCECUTE 0
S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6
1
XTAL1
0
1
ALE
0
1
PSEN
0
1 FLOATING
PORT 0 PCL
0
1
PORT 2 PCH PCH PORT DATA = 1
0
1
RESET
0
CPU RESET 1
47
CONTROL 0
RESET 1
CPU RESET EXCECUTE CYCLE
EXCECUTE 0
1
PORT 1 PORT DATA PORT DATA = 1
0
1
PORT 3 PORT DATA PORT DATA = 1
0
S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6
1
XTAL1
0
1
ALE
0
1
PSEN
0
1 FLOATING
PORT 0
0
1
PORT 1 PORT DATA = 1
0
MSM80C154S/83C154S/85C154HVS
1
PORT 2 PORT DATA = 1
0
1
PORT 3 PORT DATA = 1
48
0
1
RESET
0
CPU RESET 1
CONTROL 0
RESET 1
CPU RESET EXCECUTE CYCLE
EXCECUTE 0
EXCECUTE CYCLE
S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6
1
XTAL1
0
1
ALE
0
1
PSEN
0
1 FLOATING
PORT 0 PCL PCL PCL
0
1
PORT 2 PORT DATA = 1 PCH PCH PCH
0
1
RESET
0
CPU RESET 1
49
CONTROL 0
RESET 1
CPU RESET EXCECUTE CYCLE
EXCECUTE 0
1
PORT 1 PORT DATA = 1
0
1
PORT 3 PORT DATA = 1
0
EXCECUTE CYCLE
The Schmitt trigger circuit connected to the RESET pin shown in the MSM80C154S/ MSM-
83C154S reset circuit block diagram in Figure 3-4 operates in the following way when the VCC
power supply voltage is +5V.
If the voltage of the reset signal applied to the RESET pin exceeds 3V when the level of that
signal is changed from “0” to “1”, the Schmitt trigger output level is changed from “0” to “1”,
and the reset signal is set in the CPU reset control circuit, resulting in the reset operation being
started by the CPU.
The CPU reset state is released when the “1” level on the RESET pin is changed to “0”. An
input signal level below 1.5V is regarded as “0” level, and the Schmitt trigger output level is
changed from “1” to “0”. When the reset signal is changed to “0” level, the CPU reset control
circuit is ready for reset release. The Schmitt trigger circuit operation time chart for changes
in the reset input voltage is outlined in Figure 3-9.
5 [V]
VCC
0 [V]
5 [V]
Schmitt trigger gate output
0 [V]
CPU reset
control input
50
CONTROL
When a reset signal is applied to the CPU with normal voltage applied to the MSM80C154S/
MSM83C154S VCC power supply pin, ports 0, 1, 2, and 3 are set to “1” (input mode) even if
XTAL1·2 oscillation has been stopped. The output status of the ALE and PSEN pins also
becomes “1”. The CPU is then reset after normal XTAL1·2 oscillation has resumed. The
internal CPU status when the CPU is reset is shown in Table 3-1.
51
MSM80C154S/83C154S/85C154HVS
3.3.1 Outline
The function of the EA pin is to determine whether a CPU internal program memory (ROM)
instruction or an external program instruction is to be executed.
(1) Internal ROM mode
If the EA pin is connected to VCC and a “1” reset signal is applied to the RESET pin to
reset the CPU, an internal program memory (ROM) is executed from address 0.
(MSM83C154S, MSM85C154HVS)
(2) External ROM mode
If the EA pin is connected to VSS and a “1” reset signal is applied to the RESET pin to
reset the CPU, an external program memory is executed from address 0.
52
4. INTERNAL
SPECIFICATIONS
MSM80C154S/83C154S/85C154HVS
54
INTERNAL SPECIFICATIONS
4. INTERNAL SPECIFICATIONS
4.1.1 Outline
55
MSM80C154S/83C154S/85C154HVS
HEX
OFF IOCON 0FFH~0F8H 248 (0F8H)
B 0F7H~0F0H 240 (0F0H)
ACC 0E7H~0E0H 224 (0E0H)
PSW 0D7H~0D0H 208 (0D0H)
TH2 205 (0CDH)
TL2 204 (0CCH)
RCAP2H 203 (0CBH)
RCAP2L 202 (0CAH)
T2CON 0CFH~0C8H 200 (0C8H)
SPECIAL FUNCTION REGISTERS IP 0BFH~0B8H 184 (0B8H)
P3 0B7H~0B0H 176 (0B0H)
IE 0AFH~0A8H 168 (0A8H)
P2 0A7H~0A0H 160 (0A0H)
USER DATA RAM SBUF 153 (99H)
SCON 9FH~98H 152 (98H)
P1 97H~90H 144 (90H)
REGISTER INDIRECT ADDRESSING
30
2F 7F 78
BIT RAM
20 7 0
BIT ADDRESSING
1F R7
BANK 3
18 R0
17 R7
BANK 2
10 R0
0F R7 DATA ADDRESSING
BANK 1
08 R0
07 R7
BANK 0
00 R0
56
INTERNAL SPECIFICATIONS
The storage capacity of the MSM80C154S/MSM83C154S data memory is 256 words ¥ 8 bits.
The layout diagram is shown in Figure 4-2.
The data memory can be accessed (R/W) in four different ways - direct register designation,
indirect register designation, data addressing, and bit addressing.
Four banks of registers group (R0 thru R7 ¥ 4) exist within the data memory address range
from 00 to 1FH. Banks are specified by RS0 and RS1 data combinations within the PSW.
The data memory address range from 20 to 2FH is an area where bit addressing is possible.
One bit of data can be manipulated directly by bit manipulation instructions.
The data memory address range from 00 to 7FH is an area where data addressing is possible.
8-bit data manipulations can be handled directly by data address manipulation instructions.
The data memory address range from 80H to 0FFH is an area where data addressing is not
possible. To manipulate data in this data memory area, the contents of register R0 or R1 are
set in 80H thru 0FFH, then an indirect register instruction is used. (Indirect register
instructions can be used to specify the entire data memory from address 00 to 0FFH.)
In addition to data storage in the CPU, the data memory is used as the place for saving stack
data. This stack data storage area is addressed by a stack pointer (SP 81H).
Since the stack pointer can be set any desired value by software, the data memory can be
used as stack from any data memory address. Note that 07H data is set automatically in the
stack pointer when the CPU is reset.
57
MSM80C154S/83C154S/85C154HVS
0FFH 255
USER DATA RAM
80H 128
7FH 127
USER DATA RAM
30H 48
2FH 7F 7E 7D 7C 7B 7A 79 78 47
2EH 77 76 75 74 73 72 71 70 46
2DH 6F 6E 6D 6C 6B 6A 69 68 45
DATA ADDRESSING
2AH 57 56 55 54 53 52 51 50 42
BIT ADDRESSING
29H 4F 4E 4D 4C 4B 4A 49 48 41
28H 47 46 45 44 43 42 41 40 40
27H 3F 3E 3D 3C 3B 3A 39 38 39
26H 37 36 35 34 33 32 31 30 38
25H 2F 2E 2D 2C 2B 2A 29 28 37
24H 27 26 25 24 23 22 21 20 36
20H 07 06 05 04 03 02 01 00 32
1FH 31
BANK 3
18H 24
17H 23
BANK 2
10H 16
0FH 15
BANK 1
08H 8
07H 7
BANK 0
00H 0
58
INTERNAL SPECIFICATIONS
Four banks of registers group exist in the data memory (RAM) between memory addresses
00 thru 1FH. Banks are specified by RS0 and RS1 bit combinations within the program status
word (PSW). Note that the register area R0 thru R7 can also be used as normal data memory.
The PSW table is shown in Table 4-1, and the data memory register bank layout in Figure 4-
3.
Bit 7 6 5 4 3 2 1 0
Flag CY AC F0 RS1 RS0 OV F1 P
Set • •
OFF 255 D7 D6 D5 D4 D3 D2 D1 D0
STACK & DATA RAM
30 48 D7 D6 D5 D4 D3 D2 D1 D0
2F 47 D7 D6 D5 D4 D3 D2 D1 D0
BIT ADDRESSING RS1 RS0
20 32 D7 D6 D5 D4 D3 D2 D1 D0
1F 31 D7 D6 D5 D4 D3 D2 D1 D0 R7
BANK 3 1 1
18 24 D7 D6 D5 D4 D3 D2 D1 D0 R0
17 23 D7 D6 D5 D4 D3 D2 D1 D0 R7
BANK 2 1 0
10 16 D7 D6 D5 D4 D3 D2 D1 D0 R0
0F 15 D7 D6 D5 D4 D3 D2 D1 D0 R7
BANK 1 0 1
08 8 D7 D6 D5 D4 D3 D2 D1 D0 R0
07 7 D7 D6 D5 D4 D3 D2 D1 D0 R7
06 6 D7 D6 D5 D4 D3 D2 D1 D0 R6
05 5 D7 D6 D5 D4 D3 D2 D1 D0 R5
04 4 D7 D6 D5 D4 D3 D2 D1 D0 R4 BANK 0 0 0
03 3 D7 D6 D5 D4 D3 D2 D1 D0 R3
02 2 D7 D6 D5 D4 D3 D2 D1 D0 R2
01 1 D7 D6 D5 D4 D3 D2 D1 D0 R1
00 0 D7 D6 D5 D4 D3 D2 D1 D0 R0
59
MSM80C154S/83C154S/85C154HVS
4.2.3 Stack
The stack data save (storage) area is in the internal data memory (RAM), and is specified by
stack pointer (SP 81H).
Although 07H data is automatically set in the stack pointer when the CPU is reset, any desired
data can be set by software to enable the data memory to be used as stack from any address.
Two bytes of data memory are used when the stack is used by interrupt or CALL instruction,
and a single byte of data memory is used when the PUSH instruction is used. The status
where an interrupt is generated and the program counter contents are saved in the stack
when the stack pointer contents are 7FH, and the status where accumulator contents are
pushed during interrupt routine and are subsequently saved in the stack are shown in Table
4-2. The stack status up to completion of interrupt processing upon execution of POP and
RETI instructions is also included.
60
INTERNAL SPECIFICATIONS
Operation of the internal data memory indirect increment instruction is described here as an
example. This instruction (INC @Rr) is a 1-byte 1-machine cycle instruction (see Figure 4-
4). The indirect address register is specified by instruction code bit 0 data r where r denotes
either register 0 or 1 in the register group specified by PSW RS0 and RS1 bank data. Register
0 is specified when the r data is 0, and register 1 is specified when the data is 1.
When this instruction is executed, register data is read from the specified register 0 or 1, and
the read out register data is written into the data pointer for the data memory.
The data memory contents specified by the data pointer are read by the CPU into a temporary
register. Then a subsequent increment (+1) by the ALU is followed by a return to the data
memory at the address where the data were read out. In this way, the contents of the data
memory at the address specified by the contents of R0 or R1 are incremented.
61
MSM80C154S/83C154S/85C154HVS
Operation of the internal data memory register decrement instruction is described here as an
example. This instruction (DEC Rr) is a 1-byte 1-machine cycle instruction (see Figure 4-5).
Register R0 thru R7 is specified by r0, r1, and r2 data of instruction code bit 0, 1, and 2. The
r0, r1, and r2 data is represented in binary code, r0 being the LSB, and r2 the MSB. The code
is weighted 1, 2, and 4 from the LSB. Any one of the eight registers can be specified by
combinations of this code. See Table 4-3 for the register designation combinations.
When this instruction is executed, one of the registers R0 thru R7 from the register group
specified by the PSW RS0 and RS1 bank data is specified. The contents of the specified
register is read by the CPU into a temporary register. Then a subsequent decrement (–1) by
the ALU is followed by a return to the register where the data were read out. In this way, the
register contents specified by r0, r1, and r2 are decremented.
Register name r2 r1 r0
Register 0 0 0 0
Register 1 0 0 1
Register 2 0 1 0
Register 3 0 1 1
Register 4 1 0 0
Register 5 1 0 1
Register 6 1 1 0
Register 7 1 1 1
62
INTERNAL SPECIFICATIONS
b7 b6 b5 b4 b3 b2 b1 b0 Byte 2
7 6 5 4 3 2 1 0
63
MSM80C154S/83C154S/85C154HVS
Bit name b2 b1 b0
Bit 0 0 0 0
Bit 1 0 0 1
Bit 2 0 1 0
Bit 3 0 1 1
Bit 4 1 0 0
Bit 5 1 0 1
Bit 6 1 1 0
Bit 7 1 1 1
b7 b6 b5 b4 b3 RAM address
0 0 0 0 0 0 20H 32
1 0 0 0 0 1 21H 33
2 0 0 0 1 0 22H 34
3 0 0 0 1 1 23H 35
4 0 0 1 0 0 24H 36
5 0 0 1 0 1 25H 37
6 0 0 1 1 0 26H 38
7 0 0 1 1 1 27H 39
8 0 1 0 0 0 28H 40
9 0 1 0 0 1 29H 41
A 0 1 0 1 0 2AH 42
B 0 1 0 1 1 2BH 43
C 0 1 1 0 0 2CH 44
D 0 1 1 0 1 2DH 45
E 0 1 1 1 0 2EH 46
F 0 1 1 1 1 2FH 47
64
INTERNAL SPECIFICATIONS
4.4.1 Outline
As can be seen from the configuration shown in Table 4-6, the MSM80C154S/ MSM83C154S
special function registers consist of 27 8-bit registers.
Special function registers can be accessed (R/W) by either data addressing or bit addressing.
All 27 registers can be specified by data addressing. 13 registers (P0, P1, P2, P3, TCON,
T2CON, SCON, IE, IP, PSW, ACC, B, and IOCON) can be specified by bit addressing.
If a register which does not exist at the data address is accessed when a special function
register is used, the read data becomes 0FFH. And when data is written, none of the registers
in the CPU are effected at all. Note, however, that since a jump is always executed when a
bit test instruction which results in a relative jump at data condition “1” is executed, make sure
that no instruction is executed for a register which does not exist.
65
MSM80C154S/83C154S/85C154HVS
66
INTERNAL SPECIFICATIONS
MSB LSB
Name Address
7 6 5 4 3 2 1 0
TMOD 89H GATE C/T M1 M0 GATE C/T M1 M0
Bit location Flag Function
TMOD.0 M0 M1 M0 Timer/counter 0 mode setting
0 0 8-bit timer/counter with 5-bit prescalar
0 1 16-bit timer/counter
TMOD.1 M1 1 0 8-bit timer/counter with 8-bit auto reloading
1 1 Timer/counter 0 separated into TL0 (8-bit) timer/counter
and TH0 (8-bit) timer/counter. TF0 is set by TL0 carry,
and TF1 is set by TH0 carry.
TMOD.2 C/T Timer/counter 0 count clock designation control bit.
XTAL1·2 divided by 12 clock is the input applied to timer/counter 0
when C/T="0".
The external clock applied to the T0 pin is the input applied to
timer/counter 0 when C/T="1".
TMOD.3 GATE When this bit is "0", the TR0 bit of TCON (timer control register) is
used to control the start and stop of timer/counter 0 counting. If
this bit is "1", timer/counter 0 starts counting when both the TR0 bit
of TCON and INT0 pin input signal are "1", and stops counting
when either is changed to "0".
TMOD.4 M0 M1 M0 Timer/counter 1 mode setting
0 0 8-bit timer/counter with 5-bit prescalar
0 1 16-bit timer/counter
TMOD.5 M1 1 0 8-bit timer/counter with 8-bit auto reloading
1 1 Timer/counter 1 operation stopped
TMOD.6 C/T Timer/counter 1 count clock designation control bit.
XTAL1·2 divided by 12 clock is the input applied to timer/counter 1
when C/T="0".
The external clock applied to the T1 pin is the input applied to
timer/counter 1 when C/T="1".
TMOD.7 GATE When this bit is "0", the TR1 bit of TCON is used to control the
start and stop of timer/counter 1 counting.
If this bit is "1", timer/counter 1 starts counting when both the TR1
bit of TCON and INT1 pin input signal are "1", and stops counting
when either is changed to "0".
67
MSM80C154S/83C154S/85C154HVS
MSB LSB
Name Address
7 6 5 4 3 2 1 0
PCON 87H SMOD HPD RPD — GF1 GF0 PD IDL
Bit location Flag Function
PCON.0 IDL IDLE mode set when this bit is set to "1". CPU operations are
stopped when IDLE mode is set, but XTAL1·2, timer/counters 0, 1,
and 2, the interrupt circuits, and serial port remain active. IDLE
mode is cancelled when the CPU is reset or when an interrupt is
generated.
PCON.1 PD PD mode set when this bit is set to "1". CPU operations and
XTAL1·2 are stopped when PD mode is set. PD mode is cancelled
when the CPU is reset or when an interrupt is generated.
PCON.2 GF0 User flag. Testing this flag when IDLE mode is cancelled by an
interrupt shows whether the interrupt is a normal interrupt or an
IDLE mode release interrupt.
PCON.3 GF1 User flag. Testing this flag when PD mode is cancelled by an
interrupt shows whether the interrupt is a normal interrupt or a PD
mode release interrupt.
PCON.4 — Reserved bit. The output data is "1" if the bit is read.
PCON.5 RPD Bit used to specify cancellation of CPU power down mode (IDLE
or PD) by interrupt signal.
Power down mode cannot be cancelled by interrupt signal if
interrupt is not enabled by IE (interrupt enable register) when this
bit is "0".
If the interrupt flag is set to "1" by an interrupt request signal when
this bit is "1" (even if interrupt is disabled), the program is executed
from the next address of the power down mode setting instruction.
The flag is reset to "0" by software.
PCON.6 HPD The hard power down setting mode is enabled when this bit is set
to "1".
If the level of the power failure detect signal applied to the HPDI
pin (pin 3.5) is changed from "1" to "0" when this bit is "1",
XTAL1·2 oscillation is stopped and the system is put into hard
power down mode.
PCON.7 SMOD When the serial port is used in mode 1, 2 or 3, this bit has the
following functions. The serial port operation clock is reduced by
1/2 when the bit is "0" for delayed processing. And when the bit is
"1", the serial port operation clock is normal for faster processing.
68
INTERNAL SPECIFICATIONS
MSB LSB
Name Address
7 6 5 4 3 2 1 0
TCON 88H TF1 TR1 TF0 TR0 IE1 IT1 IE0 IT0
Bit location Flag Function
TCON.0 IT0 External interrupt 0 signal used in level detect mode when this bit
is "0", and in trigger detect mode when "1".
TCON.1 IE0 Interrupt request flag for external interrupt 0.
Bit is reset automatically when interrupt is serviced.
Bit can be set and reset by software when IT0="1".
TCON.2 IT1 External interrupt 1 signal used in level detect mode when this bit
is "0",and in trigger detect mode when "1".
TCON.3 IE1 Interrupt request flag for external interrupt 1 .
Bit is reset automatically when interrupt is serviced.
Bit can be set and reset by software when IT1="1".
TCON.4 TR0 Counting start and stop control bit for timer/counter 0.
Timer/counter 0 starts counting when this bit is "1", and stops
counting when "0".
TCON.5 TF0 Interrupt request flag for timer interrupt 0.
Bit is reset automatically when interrupt is serviced. Bit is set to "1"
when carry signal is generated from timer/counter 0.
TCON.6 TR1 Counting start and stop control bit for timer/counter 1.
Timer/counter 1 starts counting when this bit is "1", and stops
counting when "0".
TCON.7 TF1 Interrupt request flag for timer interrupt 1 .
Bit is reset automatically when interrupt is serviced. Bit is set to "1"
when carry signal is generated from timer/counter 1.
69
MSM80C154S/83C154S/85C154HVS
MSB LSB
Name Address
7 6 5 4 3 2 1 0
SCON 98H SM0 SM1 SM2 REN TB8 RB8 TI RI
Bit location Flag Function
SCON.0 RI "End of serial port reception" interrupt request flag. This flag must
be reset by software during interrupt service routine.
This flag is set after the eighth bit of data has been received when
in mode 0, or by the STOP bit when in any other mode. In mode 2
or 3, however, RI is not set if the RB8 data is "0" with SM2="1". RI
is set if STOP bit is received when SM2="1" in mode 1.
SCON.1 TI "End of serial port transmission" interrupt request flag. This flag
must be reset by software during interrupt service routine. This flag
is set after the eighth bit of data has been sent when in mode 0, or
after the last bit of data has been sent when in any other mode.
SCON.2 RB8 The ninth bit of data received in mode 2 or 3 is passed to RB8.
The STOP bit is applied to R88 if SM2="0" when in mode 1. RB8
cannot be used in mode 0.
SCON.3 TB8 The TB8 data is sent as the ninth data bit when in mode 2 or 3.
Any desired data can be set in TB8 by software.
SCON.4 REN Reception enable control bit.
No reception when REN="0".
Reception enabled when REN="1".
SCON.5 SM2 If the ninth bit of received data is "0" with SM2="1" in mode 2 or 3,
the "end of reception" signal is not set in the RI flag.
Nor is the "end of reception" signal set in the RI flag if the STOP bit
is not "1" when SM2="1" in mode 1.
SCON.6 SM1 SM0 SM1 MODE
0 0 0 8-bit shift register I/O
0 1 1 8-bit UART variable baud rate
SCON.7 SM0 9-bit UART 1/32 XTAL1, 1/64 XTAL1
1 0 2
baud rate
1 1 3 9-bit UART variable baud rate
70
INTERNAL SPECIFICATIONS
MSB LSB
Name Address
7 6 5 4 3 2 1 0
IE 0A8H EA — ET2 ES ET1 EX1 ET0 EX0
Bit location Flag Function
IE.0 EX0 Interrupt control bit for external interrupt 0.
Interrupt disabled when bit is "0".
Interrupt enabled when bit is "1".
IE.1 ET0 Interrupt control bit for timer interrupt 0.
Interrupt disabled when bit is "0".
Interrupt enabled when bit is "1".
IE.2 EX1 Interrupt control bit for external interrupt 1 .
Interrupt disabled when bit is "0".
Interrupt enabled when bit is "1".
IE.3 ET1 Interrupt control bit for timer interrupt 1 .
Interrupt disabled when bit is "0".
Interrupt enabled when bit is "1".
IE.4 ES Interrupt control bit for serial port.
Interrupt disabled when bit is "0".
Interrupt enabled when bit is "1".
IE.5 ET2 Interrupt control bit for timer interrupt 2.
Interrupt disabled when bit is "0".
Interrupt enabled when bit is "1".
IE.6 — Reserved bit. The output data is "1" if the bit is read.
IE.7 EA Overall interrupt control bit.
All interrupts are disabled when bit is "0".
All interrupts are enabled/disabled by IE.0 thru IE.5 when bit is "1".
71
MSM80C154S/83C154S/85C154HVS
MSB LSB
Name Address
7 6 5 4 3 2 1 0
IP 0B8H PCT — PT2 PS PT1 PX1 PT0 PX0
Bit location Flag Function
IP.0 PX0 Interrupt priority bit for external interrupt 0.
Priority is assigned when bit is "1".
IP.1 PT0 Interrupt priority bit for timer interrupt 0.
Priority is assigned when bit is "1".
IP.2 PX1 Interrupt priority bit for external interrupt 1 .
Priority is assigned when bit is " 1 ".
IP.3 PT1 Interrupt priority bit for timer interrupt 1 .
Priority is assigned when bit is "1".
IP.4 PS Interrupt priority bit for serial port.
Priority is assigned when bit is "1".
IP.5 PT2 Interrupt priority bit for timer interrupt 2.
Priority is assigned when bit is "1".
IP.6 — Reserved bit. The output data is "1" if the bit is read.
IP.7 PCT Priority interrupt circuit control bit.
The priority register contents are valid and priority assigned
interrupts can be processed when this bit is "0". When the bit is
"1", the priority interrupt circuit is stopped, and interrupts can only
be controlled by the interrupt enable register (IE).
72
INTERNAL SPECIFICATIONS
MSB LSB
Name Address
7 6 5 4 3 2 1 0
PSW 0D0H CY AC F0 RS1 RS0 OV F1 P
Bit location Flag Function
PSW.0 P Accumulator (ACC) parity indicator.
"1" when the "1" bit number in the accumulator is an odd number,
and "0" when an even number.
PSW.1 F1 User flag which may be set to "0" or "1" as desired by the user.
PSW.2 OV Overflow flag which is set if the carry C6 from bit 6 of the ALU or
CY is "1" as a result of an arithmetic operation. The flag is also set
to "1" if the resultant product of a multiplication instruction (MUL
AB) is greater than 0FFH, but is reset to "0" if the product is less
than or equal to 0FFH.
PSW.3 RS0 RAM register bank switch
RS1 RS0 BANK RAM ADDRESS
0 0 0 00H – 07H
PSW.4 RS1 0 1 1 08H – 0FH
1 0 2 10H – 17H
1 1 3 18H – 1FH
PSW.5 F0 User flag which ma be set to "0" or "1" as desired by the user.
PSW.6 AC Auxiliary carry flag.
This flag is set to "1" if a carry C3 is generated from bit 3 of the
ALU as a result of executing an arithmetic operation instruction. In
all other cases, the flag is reset to "0".
PSW.7 CY Main carry flag.
This flag is set to "1" if a carry C7 is generated from bit 7 of the
ALU as a result of executing an arithmetic operation instruction. In
all other cases, the flag is reset to "0".
73
MSM80C154S/83C154S/85C154HVS
MSB LSB
Name Address
7 6 5 4 3 2 1 0
IOCON 0F8H — T32 SERR IZC P3HZ P2HZ P1HZ ALF
Bit location Flag Function
IOCON.0 ALF If CPU power down mode (PD, HPD) is activated with this bit set
to "1", the outputs from ports 0, 1, 2, and 3 are switched to floating
status.
When this bit is "0", ports 0, 1, 2, and 3 are in output mode.
IOCON.1 P1HZ Port 1 becomes a high impedance input port when this bit is "1".
IOCON.2 P2HZ Port 2 becomes a high impedance input port when this bit is "1".
IOCON.3 P3HZ Port 3 becomes a high impedance input port when this bit is "1".
IOCON.4 IZC The 10 kohm pull-up resistance for ports 1, 2, and 3 is switched off
when this bit is "1", leaving only the 100 kohm pull-up resistance.
IOCON.5 SERR Serial port reception error flag.
This flag is set to "1" if an overrun or framing error is generated
when data is received at a serial port. The flag is reset by software.
IOCON.6 T32 Timer/counters 0 and 1 are connected serially to form a 32-bit
timer/counter when this bit is set to "1". TF1 of TCON is set if a
carry is generated in the 32-bit timer/counter.
IOCON.7 — The output data is "0" if the bit is read.
This bit should not be set to "1".
74
INTERNAL SPECIFICATIONS
MSB LSB
Name Address
7 6 5 4 3 2 1 0
TMOD 0C8H TF2 EXF2 RCLK TCLK EXEN2 TR2 C/T2 CP/RL2
Bit location Flag Function
T2CON.0 CP/RL2 Capture mode is set when TCLK+RCLK="0" and CP/RL2 16-bit
auto reload mode is set when TCLK+RCLK="0" and CP/RL2="0".
CP/RL2 is ignored when TCLK+RCLK="1".
T2CON.1 C/T2 Timer/counter 2 count clock designation control bit.
The internal clocks (XTAL1·2÷12, XTAL1·2÷2) are used when this
bit is "0", and the external clock applied to the T2 pin is passed to
timer/counter 2 when the bit is "1".
T2CON.2 TR2 Timer/counter 2 counting start and stop control bit.
Timer/counter 2 commences counting when this bit is "1" and
stops counting when "0".
T2CON.3 EXEN2 T2EX timer/counter 2 external control signal control bit. Input of the
T2EX signal is disabled when this bit is "0", and enabled when "1".
T2CON.4 TCLK Serial port transmit circuit drive clock control bit.
Timer/counter 2 is switched to baud rate generator mode when this
bit is "1", and the timer/counter 2 carry signal becomes the serial
Port transmit clock. Note, however, that the serial ports can only
use the timer/counter 2 carry signal in serial port modes 1 and 3.
T2CON.5 RCLK Serial port receive circuit drive clock control bit.
Timer/counter 2 is switched to baud rate generator mode when this
bit is "1", and the timer/counter 2 carry signal becomes the serial
Port receive clock. Note, however, that the serial ports can only
use the timer/counter 2 carry signal in serial port modes 1 and 3.
T2CON.6 EXF2 Timer/counter 2 external flag.
This bit is set to "1" when the T2EX timer/counter 2 external
control signal level is changed from "1" to "0" while EXEN2="1".
This flag serves as the timer interrupt 2 request signal. if an
interrupt is generated, it must be reset to "0" by software.
T2CON.7 TF2 Timer/counter 2 carry flag.
This bit is set to "1" by a carry signal when timer/counter 2 is in 16-
bit auto reload mode or in capture mode.
This flag serves as the timer interrupt 2 request signal. if an
interrupt is generated, it must be reset to "0" by software.
75
MSM80C154S/83C154S/85C154HVS
4.5.1 Outline
Timer/counters 0, 1 and 2 are all equipped with 16-bit binary up-counting and Read/Write
functions, and can be operated independently.
All control of timer/counters 0 and 1 is handled by the timer control register (TCON 88H) and
the timer mode register (TMOD 89H). And both timer/counters can be set independently to
modes 0 thru 3 for a diversity of applications.
Timer/counters 0 and 1 can be operated by an external clock applied to the T0 and T1 pins
(if external clock mode has been set) during soft power down mode (PD) and hard power
down mode (HPD) where XTAL1·2 are stopped. Therefore, CPU power down mode can be
cancelled by generating a timer/counter carry signal.
Timer/counter 2 can be fully controlled by timer 2 control register (T2CON 0C8H). There are
three operational modes for a wide range of applications. Note that counting is stopped when
XTAL1·2 are stopped.
4.5.2.1 Outline
Timer/counters 0 and 1 are both equipped with a 16-bit binary counting function which can
be operated independently.
All control of timer/counters 0 and 1 is handled by the timer control register (TCON) and the
timer mode register (TMOD). And both timer/counters can be set independently to modes 0
thru 3 for a diversity of applications. The overall control circuit for timer/counters 0 and 1 is
outlined in Figure 4-7 (excluding timer mode 3).
Counting start and stop in timer/counters 0 and 1 is controlled by bit 4, TR0, and bit 6, TR1,
in the timer control register (TCON 88H) as indicated in Table 4-7.
TR0 controls timer/counter 0, and TR1 controls timer/counter 1. Timer/counter operation is
stopped when the bit data is “0”, and enabled when “1”.
Timer 1 Timer 0
Bit 7 6 5 4 3 2 1 0
Flag TF1 TR1 TF0 TR0 IE1 IT1 IE0 IT0
Set • •
76
XTAL 1 ÷12 S3
TIMER 1
T1 PIN
DETECTOR
(PORT 3.5)
INT1 PIN
(PORT 3.3) DATA
Q
S5 LATCH
77
TIMER 0
T0 PIN
DETECTOR
(PORT 3.4)
INT0 PIN
(PORT 3.2) DATA
Q
S5 LATCH
Figure 4-7 Overall clock input control circuit for timer/counters 0 and 1
GATE C/T M1 M0 GATE C/T M1 M0 TF1 TR1 TF0 TR0 IE1 IT1 IE0 IT0
7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
Designation of count clock inputs to timer/counters 0 and 1 is controlled by bit 2 and 6, C/T,
in the timer mode register (TMOD 89H).
Timer/counter 0 is controlled by bit 2, C/T, and timer/counter 1 is controlled by bit 6, C/T.
The internal clock is passed to the timer/counter when the C/T bit is “0”. This internal clock
is the result of dividing XTAL1·2 by 12. The S3 timing signal (see Figure 2-9) becomes the
clock.
The external clock is applied to the timer/counter when the C/T bit is “1”. The external clock
applied to the T0 pin serves as the timer/counter 0 input, while the external clock applied to
the T1 pin serves as the timer/counter 1 input.
Timer 1 Timer 0
Bit 7 6 5 4 3 2 1 0
Flag GATE C/T M1 M0 GATE C/T M1 M0
Set • •
78
INTERNAL SPECIFICATIONS
The detector circuit shown in Figure 4-8 is inserted between the timer/counters and the
external clock pin.
This detector circuit operates in the following way. When the external clock applied to the T0
and T1 pins is changed from “1” to “0” level, that clock is fetched by F/Fl, and is then passed
to F/F2 when the S5 timing signal appears. This F/F2 output is subsequently ANDed (logical
product) with the S3 timing signal to form the timer/counter clock signal which then serves as
the F/Fl reset signal. The reset F/Fl then waits for the next external clock. The “0” and “1” signal
cycle widths of the respective external clocks applied to the T0 and T1 pins must have a
minimum of period 12 times (12T) the XTAL1·2 oscillator clock cycle T. However, when the
CPU is in PD mode or HPD mode the external clock applied to the T0 and T1 pins is input
to timer/counters 0 and 1 directly. The operational time chart for this detector circuit is outlined
in Figure 4-9.
TIMER 0
F/F1 F/F2
or
VCC D Q D Q TIMER 1
L
T0 or T1 R
S5 S3
1
RESET
12T 12T PD & HPD
79
MSM80C154S/83C154S/85C154HVS
M1 M1 or M2
S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2
1
XTAL1
0
1
ALE
0
T0 or T1 1
COUNT IN 0
1
F/F1Q
0
1
F/F2Q
0
1
TIMER COUNT
0
In addition to control by TR0 and TR1 bits of timer control register (TCON), timer/counter 0
and 1 counting start and stop can also be controlled by the signal level applied to the external
interrupt pin in accordance with the GATE data values of bits 3 and 7 in the timer mode register
(TMOD 89H) indicated in Table 4-9.
Timer/counter 0 is controlled by the bit 3, GATE bit. When the GATE bit is “0”, counting is
started and stopped only by TR0.
When the GATE bit is “1”, counting in timer/counter 0 is enabled if the TR0 bit and INT0 pin
input signal are both “1”. Counting is subsequently stopped if either is changed to “0” level.
Timer/counter 1 is controlled by the bit 7, GATE bit, the functional operation being the same
as timer/counter 0. The GATE - INT timer/counter counting control circuit is outlined in Figure
4-10, and the control table is given in Table 4-10.
Timer 1 Timer 0
Bit 7 6 5 4 3 2 1 0
Flag GATE C/T M1 M0 GATE C/T M1 M0
Set • •
80
INTERNAL SPECIFICATIONS
XTAL 1 ÷12 S3
TIMER 0
or
T0 or T1 DETECTOR TIMER 1
CLOCK
C/ T
INT0 or INT1 D Q
S5 L
✽ GATE
TR0 or TR1
TIMER 0 TIMER 1
GATE 0 0 1 1 1 GATE 0 0 1 1 1
TR0 0 1 0 1 1 TR1 0 1 0 1 1
INT0 × × 0 0 1 INT1 × × 0 0 1
RUN • • RUN • •
STOP • • • STOP • • •
81
MSM80C154S/83C154S/85C154HVS
4.5.2.5.1 Outline
The timer/counter 0 and 1 timer modes are set by combinations of M0 and M1 bit data in the
timer mode register (TMOD 89H) shown in Table 4-11. The timer modes which can be set
are 0, 1, 2, and 3.
Timer/counter 0 modes are specified by M0 and M1 of bits 0 and 1, and timer/counter 1 modes
are specified by M0 and M1 of bits 4 and 5.
4.5.2.5.2 Mode 0
M1 M0
0 0
In mode 0, timer/counters 0 and 1 both become 13-bit timer/counters by the circuit connection
shown in Figures 4-11 and 4-12. TL0 and TL1 in timer/counters 0 and 1 serve as the counter
for the five lower bits, and TH0 and TH1 serve as the counter for the eight upper bits.
TF0 of TCON is set by the timer/counter 0 carry signal, and TF1 of TCON is set by the timer/
counter 1 carry signal. Note that the timer/counter 1 carry signal can also be used as the serial
port transmission/reception clock.
Although the three upper bits of TL0 and TL1 are operative, they are invalid as signals.
82
INTERNAL SPECIFICATIONS
Q0------Q4 Q0------Q7
TL0 TH0 C
T0 PIN DETECTOR (5BITS) (8BITS)
(PORT 3.4)
C/ T
TR0
GATE
Q0------Q4 Q0------Q7
TL1 TH1 C
T1 PIN DETECTOR (5BITS) (8BITS)
(PORT 3.5)
C/ T
GATE
83
MSM80C154S/83C154S/85C154HVS
4.5.2.5.3 Mode 1
M1 M0
0 1
In mode 1, timer/counters 0 and 1 both become 16-bit timer/counters by the circuit connection
shown in Figures 4-13 and 4-14.
TL0 and TL1 in timer/counters 0 and 1 serve as the counter for the eight lower bits, and TH0
and TH1 serve as the counter for the eight upper bits.
TL0 is set by the timer/counter 0 carry signal, and TF1 is set by the timer/counter 1 carry
signal. Again note that the timer/counter 1 carry signal can also be used as the serial port
transmission/reception clock.
84
INTERNAL SPECIFICATIONS
Q0------Q7 Q0------Q7
TL0 TH0 C
T0 PIN DETECTOR (8BITS) (8BITS)
(PORT 3.4)
C/ T
TR0
GATE
Q0------Q7 Q0------Q7
TL1 TH1 C
T1 PIN DETECTOR (8BITS) (8BITS)
(PORT 3.5)
C/ T
GATE
85
MSM80C154S/83C154S/85C154HVS
4.5.2.5.4 Mode 2
M1 M0
1 0
In mode 2, timer/counters 0 and 1 both become 8-bit timer/counters with 8-bit auto reloader
registers by the circuit connection shown in Figures 4-15 and 4-16. TH0 and TH1 in timer/
counters 0 and 1 serve as the 8-bit auto reloader section, and TL0 and TL1 serve as the timer/
counter section.
If a carry signal is generated by the 8-bit timer/counter TL0 and TL1, the respective auto
reloader register data is preset into the timer/counter, and counting proceeds from the preset
value.
TF0 is set by the timer/counter 0 carry signal, and TF1 is set by the timer/counter 1 carry
signal. Note that the timer/counter 1 carry signal can also be used as the serial port
transmission/reception clock.
86
INTERNAL SPECIFICATIONS
Q0------Q7
TL0 C
T0 PIN DETECTOR (8BITS)
(PORT 3.4)
C/ T
TR0
GATE Q0------Q7
RELOAD
TH0
DATA
(8BITS)
INT0 PIN DATA
Q
(PORT 3.2) S5 LATCH
Figure 4-15 Timer/counter 0 mode 2
S I/O CLOCK
Q0------Q7
TL1 C
T1 PIN DETECTOR (8BITS)
(PORT 3.5)
C/ T
TR1
GATE Q0------Q7
RELOAD
TH1
DATA
(8BITS)
INT1 PIN DATA
Q
(PORT 3.3) S5 LATCH
87
MSM80C154S/83C154S/85C154HVS
4.5.2.5.5 Mode 3
M1 M0
1 1
In mode 3, timer/counter 0 TL0 and TH0 become independent 8-bit timer/counters by the
circuit connection shown in Figure 4-17. Timer/counter 1 does not operate when mode 3 is
set. The TL0 8-bit timer/counter is controlled in the same way as the regular timer/counter 0,
TF0 being set if a carry signal is generated by TL0.
The TH0 8-bit timer/counter is controlled only by TR1, and the control only covers count
starting and stopping. TF1 is set by a carry signal generated by TH0.
When timer/counter 0 is set to mode 3, timer/counter 1 can operate in modes 0, 1, or 2, and
be used by the serial port clock. Control of timer/counter 1 count starting and stopping in this
case is handled between operating mode and mode 3. If mode 3 is set, the timer/counter 1
counting operation is stopped.
Q0------Q7
TL0
T0 PIN DETECTOR (8BITS)
(PORT 3.4)
C/ T
TR0
GATE
XTAL 1 ÷12
Q0------Q7
TR1 TH0 C
(8BITS)
88
INTERNAL SPECIFICATIONS
When “1” is set in bit 6 (T32) of the I/O control register (IOCON 0F8H), timer/counters 0 and
1 are connected serially as indicated in Figure 4-18 to become a 32-bit timer/counter.
This 32-bit timer/counter is started by the following procedure. First, “0” is set in TR0, TR1,
TF0, and TF1 of the timer control register (TCON 88H) to stop the timer/counter and reset the
timer flag.
Next timer/counter preset data values are set in timer/counters 0 and 1, and a counter clock
designation is set in bit 2 (C/T) of the timer mode register (TMOD 89H).
If “1” is then set in bit 6 (T32) of the 1/0 control register (IOCON 0F8H) after completing the
above procedure, the 32-bit timer/counter is established and counting is commenced. This
32-bit timer/counter is especially useful in cancelling CPU power down mode. (See power
down mode cancellation.)
T0 PIN DETECTOR
(PORT 3.4) IOCON [0F8H]
7 6 5 4 3 2 1 0
XTAL 1 ÷12 — T32 SERR IZC P3HZ P2HZ P1HZ ALF
•
89
MSM80C154S/83C154S/85C154HVS
Since the internal clock stops operation during soft power down mode (PD), the auto-reload
operation is not executed if timer/counters 0 and 1 are set to mode 2 or mode 3.
If the power down mode is to be cancelled by the timer, timer/counters 0 and 1 must be set
to mode 0 or mode 1.
When timers 0 and 1 are set to external clock mode, the external clock is taken in as shown
in Figure 4-19 and the power down mode can be cancelled through the overflow of the timer.
If the external interrupt occurs when the T0 or T1 pin goes to “1” level and the soft power down
mode (PD) is cancelled, the gate output (A) changes from “1” level to “0” level and the counter
is incremented by 1.
In addition, “Q” of F/F1 is set on the trailing edge of T0 or T1.
Thus, the counter is incremented by additional 1.
The same event occurs not only by the external interrupt but also by the overflow of the timer.
This is because the overflow signal of the timer is made up of the timer count value “FF” and
the clock input signal “AND”. Therefore, the timer interrupt occurs when the T0 or T1 pin goes
to “1” level, and the power down mode is cancelled and the counter is incremented by
additional 1.
In cancelling the soft power down mode with the external interrupt, if the timer is set to external
clock mode, the T0 or T1 pin must be set to “0” level. If the T0 or T1 pin is at “1” level or if the
power down mode is cancelled by the overflow of the timer, the timer must be reset or the
counter must be decremented by 1.
"1" A
TIMER 0
F/F1 F/F2
or
VCC D Q D Q TIMER 1
F/F1 F/F2
"1"
L
T0 or T1 R
S5 S3
RESET
PD
90
INTERNAL SPECIFICATIONS
4.5.2.5.8 Caution about use of timer counters 0 and 1 when setting software power
down mode
When setting sofware power down mode, if the value of a timer counter by which a timer
interrupt is set is immediately before overflow, the software power down mode can not be set.
(Example)
If the above conditions all are established, the sofware power down mode cannot be set. This
is because the AND output, shown as (A) of Fig. 4-19, becomes "1" when the software power
down mode is set and timer interrupt is generated.
In this case, set the software power down mode after setting the TO pin to "0".
91
MSM80C154S/83C154S/85C154HVS
4.5.3 Timer/counter 2
4.5.3.1 Outline
Timer/counter 2 is equipped with 16-bit binary counting and Read/Write functions. This timer/
counter is controlled entirely by timer 2 control register (T2CON 0C8H).
The operating modes are 16-bit auto reload mode, capture mode, and baud rate generator
mode. Modes are specified by T2CON RCLK, TCLK, and CP/RL2 bits combinations.
The internal or external clock applied to the timer/counter 2 is specified by the C/T2 bit. And
starting and stopping of timer/counter 2 counting is controlled by the TR2 bit. Note that timer/
counter 2 counting is stopped in CPU power down mode where XTAL1·2 are stopped.
The timer 2 control register (T2CON 0C8H) consists of the timer/counter 2 control bits, timer
2 internal flag (TF2), and timer 2 external flag (EXF2). The T2CON contents are outlined in
Table 4-12.
Bit 7 6 5 4 3 2 1 0
Flag TF2 EXF2 RCLK TCLK EXEN2 TR2 C/ T2 CP/ RL2
CP/RL2 : Capture mode is set when TCLK+RCLK=0 and CP/RL2=1. The timer/counter
2 contents are passed to the capture register (RCAP2L/RCAP2H) when the
level o the signal applied to the T2EX pin (bit 1 of port 1) is changed from “1” to
“0” with EXEN2-1.
16-bit auto reload mode is set when TCLK+RCLK=0 and CP/RL2=0. The CP/
RL2 data is ignored when TCLK+RCLK=1.
C/T2 : Timer/counter 2 clock input designation bit.
The internal clock is specified when this bit is “0” and the external clock is
specified
when “1”.
TR2 : Timer/counter 2 counting start and stop control bit.
Timer/counter 2 operation is stopped when this bit is “0”, and enabled when “1”
EXEN2 : The T2EX pin control bit. The signal applied to the T2EX pin is invalid when this
bit is “0”, and valid when “1”.
TCLK : Serial port transmit clock control bit. When this bit is set to “1”, timer/counter 2
is set to 16-bit auto reload operation mode, and the timer/counter 2 carry signal
activates the serial port transmit circuit. This clock is only valid when serial port
mode 1 or 3 has been set.
RCLK : Serial port receive clock control bit. When this bit is set to “1”, timer/counter 2
is set to 16-bit auto reload operation mode, and the timer/counter 2 carry signal
activates the serial port receive circuit.
This clock is only valid when serial port mode 1 or 3 has been set.
92
INTERNAL SPECIFICATIONS
EXF2 : Timer/counter 2 external flag bit which is set when the T2EX pin level (bit 1 of
port 1) is changed from “1” to “0” at EXEN2=1. This flag serves as the timer
interrupt 2 request signal. When an interrupt is generated, this flag must be reset
to “0” by software.
TF2 : Timer/counter 2 internal flag bit which is set when a carry signal is generated by
timer/counter 2 in 16-bit auto reload mode or capture mode. This flag serves as
the timer interrupt 2 request signal. When an interrupt is generated, this flag
must be reset to “0” by software.
Timer/counter 2 operation modes are set by combinations of the CP/RL2, TCLK, and RCLK
bits in timer 2 control register (T2CON 0C8H) shown in Table 4-13. The timer modes are listed
in Table 4-14.
Bit 7 6 5 4 3 2 1 0
Flag TF2 EXF2 RCLK TCLK EXEN2 TR2 C/ T2 CP/ RL2
Set • • •
16-bit auto reload mode is set by making the circuit connection shown in Figure 4-20 by setting
RCLK=0, TCLK=0, and CP/RL2=0 as the bit conditions in timer 2 control register (T2CON).
Timer/counter 2 operates in the following way when 16-bit auto reload mode is set. When a
timer/counter 2 carry signal is generated, or when the signal applied to the T2EX pin (bit 1
of port 1) is changed from level “1” to “0”, the reload data in the RCAP2L and RCAP2H
registers is preset in L2 and TH2 of timer/counter 2. The timer/counter thus starts counting
from this preset value.
The timer/counter 2 carry signal is set in internal timer flag 2 (TF2), and the T2EX change is
set in external timer flag 2 (EXF2). The TF2 and EXF2 serve as the timer interrupt 2 request
signals with an interrupt call being made to address 43 (2BH) if the timer interrupt 2 has been
enabled. If an interrupt routine is commenced, the TF2 and EXF2 flags must be reset to “0”
by software.
93
MSM80C154S/83C154S/85C154HVS
S3
XTAL 1 ÷12
RCLK=0
TCLK=0
CP/ RL2=0
Q0------Q7 Q0------Q7
TL2 C TH2 C
C/ T2 8 BIT 8 BIT
TR2
T2
DETECTOR
[PORT 1.0] RCAP2L RCAP2H
DETECTOR TF2
T2EX
DETECTOR TIMER 2
[PORT 1.1] DETECTOR EXF2 INTERRUPT
EXEN2
The 16-bit capture mode is set by making the connections shown in Figure 4-21 with the
following timer 2 control register (T2CON) bit conditions, viz. RCLK=0, TCLK=0, and CP/
RL2=1.
Timer/counter 2 operates in the following way when 16-bit capture mode is set. When the
signal applied to the T2EX pin (bit 1 of port 1) is changed from level “1” to “0”, the TL2 and
TH2 count contents of timer/counter 2 are stored into capture registers RCAP2L and
RCAP2H. The T2EX signal change is set in external timer flag 2 (EXF2) at this time, and a
carry signal from timer/counter 2 is set in internal timer flag 2 (TF2). The EXF2 and TF2 serve
as the timer interrupt 2 request signals with an interrupt call being made to address 43 (2BH)
if timer interrupt 2 has been enabled. If an interrupt routine is commenced, the EXF2 and TF2
flags must be reset to “0” by software.
94
INTERNAL SPECIFICATIONS
S3
XTAL 1 ÷12
RCLK=0
TCLK=0
CP/ RL2=1
Q0------Q7 Q0------Q7
TL2 C TH2 C
C/ T2 8 BIT 8 BIT
TR2
T2
DETECTOR
[PORT 1.0] RCAP2L RCAP2H
DETECTOR TF2
T2EX TIMER 2
DETECTOR DETECTOR EXF2 INTERRUPT
[PORT 1.1]
EXEN2
The 16-bit baud rate generator mode is set by making the connections shown in Figure 4-22
with the following timer 2 control register (T2CON) bit conditions, viz.
RCLK+TCLK=1.
Timer/counter 2 commences to operate in the following way when 16-bit baud rate generator
mode is set.
Timer/counter 2 is put into 16-bit auto reload mode. When timer/counter 2 generates a carry
signal, the reload data in the RCAP2L and RCAP2H registers is preset in the timer/counter
2 TL2 and TH2 and the timer/counter commences to count from that preset value. The carry
signal is passed to a serial port.
The timer/counter 2 carry signal activates the serial port receive circuit when RCLK 1, and
activates the transmit circuit when TCLK=1. Note, however, that the serial port can use these
clocks only when the serial port is in mode 1 and 3.
When in this mode, the timer/counter 2 carry signal is not set in internal timer flag 2 (TF2).
But since the change in level (from “1” to “0”) of the signal applied to the T2EX pin (bit 1 of
port 1) is set in external timer flag 2, the T2EX pin can be used for ordinary external interrupt
input pin. If an interrupt routine is commenced, the EXF2 flag must be reset to “0” by software.
Since timer/counter 2 is operated at 1/2 of the XTAL1·2 clock if the internal clock is used in
this mode, only undefined data will be read from the timer/counter 2 TL2 and TH2 by software.
Correct data, however, is read from the RCAP2L and RCAP2H registers.
95
MSM80C154S/83C154S/85C154HVS
SMOD[PCON bit 7] *RCLK+TCLK=1
CP/ RL2=×
TIMER 1 OVERFLOW
Figure 4-22 Timer/counter 2 baud rate generator mode circuit
÷16 RX CLOCK
[MODE1, 3]
÷2
S3
XTAL 1 ÷2
RCLK
Q0------Q7 Q0------Q7
TL2 C TH2 C
C/ T2 8 BIT 8 BIT
96
TR2
÷16 TX CLOCK
[MODE1, 3]
T2 DETECTOR
[PORT 1.0] RCAP2L RCAP2H
TCLK
EXEN2
INTERNAL SPECIFICATIONS
The T2 detector circuit block diagram is shown in Figure 4-23. Operation of this circuit is
outlined below. When the level of the signal applied to T2 (bit 0 of port 1) is changed from “1”
to “0”, output of F/Fl becomes “1”. This output signal is then passed to F/F2 at S5 timing and
F/F2 output also becomes “1”. The T2 signal change passed to F/F2 is synchronized with the
S3 timing signal to become the external clock for timer/counter 2. At the same time, F/F1 is
reset and waits for the next external clock input. Note that the “0” and “1” level cycle times of
the external clock signal applied to the T2 pin must be at least 12 times (12T) the XTAL1·2
oscillator clock cycle time T.
1 F/F1 F/F2
VCC D Q D Q TIMER COUNTER 2
0
12T 12T CLOCK
S5 L
T2 R
[PORT 1.0] S3
RESET
T2EX detector circuit block diagram is shown in Figure 4-24. Operation of this circuit is
outlined below. When the level of the signal applied to T2EX (bit 1 of port 1) is changed from
“1” to “0”, output of F/F1 becomes “1”. This output signal is then passed to F/F2 at S2 timing
and F/F2 output also becomes “1”. The T2EX signal change passed to F/F2 Q is synchronized
with the S4 timing signal to become the T2EX signal for timer/counter 2. At the same time,
F/Fl is reset and waits for the next T2EX input. Note that the “0” and “1” level cycle times of
the external clock signal applied to the T2EX pin must be at least 12 times (12T) the XTAL1·2
oscillator clock cycle time T.
1 F/F1 F/F2
VCC D Q D Q TIMER COUNTER 2
0
12T 12T T2EX
S2 L
T2EX R
[PORT 1.0] S4
RESET
97
MSM80C154S/83C154S/85C154HVS
The detector circuit shown in Figure 4-25 is inserted between the MSM80C154S/ MSM83C154S
timer/counter carry output and the timer flag. The purpose of this detector is to prevent timer
flags being set by the timer carry signal during execution of OR, AND, EOR, RESET bit, SET
bit, or MOV bit instruction on the contents of the timer control register (TCON), and thereby
prevent loss of timer flags by manipulated data by the time execution of instruction has been
completed. Hence, even if a timer carry signal is generated during execution of an instruction,
that flag will not be set while the instruction is still being executed. The flag is set at M2·S1
during execution of the next instruction. If a timer carry is generated during M1 thru M3 when
executing a 4-machine cycle instruction, the timer flag is set during M3 or M4. See Figure 4-
26 for the time chart.
In case of driving the timer/counters 0 and 1 with the external clock in the power down mode
(PD, HPD), timer/counters 0 and 1 contents are incremented by falling edge of the external
clock. However, after counting the maximum value of timer/counters 0 and 1, carry signals
are generated and timer flags are set when the external clock level changes from “0” to “1“.
S I/O CLOCK
Timer/counter carry
S2
Timer flag
M2
S1
DETECTOR
PD & HPD
S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2
1
XTAL1
0
1
ALE
0
1
TIMER COUNT
0
1
TIMER CARRY
0
1
DETECTOR OUT
0
1
TIMER FLAG
0
98
INTERNAL SPECIFICATIONS
4.6.1 Outline
99
MSM80C154S/83C154S/85C154HVS
INTERNAL BUS
MULTIPLEXER
SBUF (T)
TXD (P3.1)
TIMER/COUNTER1 SHIFT CLOCK
OVERFLOW
TIMER/COUNTER2 TX CONTROL
OVERFLOW
1/2OSC.
(PCON.7) (T2CON.4) (T2CON.5) (IOCON.5)
Figure 4-27 Serial port
RX CONTROL
INPUT SHIFT
RXD (P3.0)
Note: REGISTER
: Internal bus connection MULTIPLEXER
: Control coupling
INTERNAL SPECIFICATIONS
SCON is an 8-bit special function register consisting of control bits for specifying serial port
operation modes and enabling/disabling data reception, storage bits for the ninth data bit
transmitted and received during 11-bit frame UART mode, and the serial port status flag.
In addition to specifying SCON by data address 98H, each bit can be specified by bit
addresses.
The functions of each SCON bit are listed in Table 4-15, and the functions of each operational
mode specified by SCON are indicated in Table 4-16.
101
MSM80C154S/83C154S/85C154HVS
102
INTERNAL SPECIFICATIONS
SBUF is an 8-bit special function register used to store transmitting and receiving data.
Although the SBUF is specified by the same data address 99H for both writing and reading,
physically separate registers are specified. That is, the sending circuit SBUF is specified by
instructions where SBUF is used as a destination operand, and the receiving circuit SBUF
is specified by instructions where SBUF is used as a source operand.
4.6.2.3 TCLK
TCLK controls selection of the baud rate clock source for the transmitting circuit when in mode
1 or 3.
The timer/counter 2 overflow becomes the transmitting circuit baud rate clock source when
TCLK is set in mode 1 or 3. And the timer/counter 1 overflow becomes the transmitting circuit
baud rate clock source if TCLK is cleared.
TCLK has no effect on the baud rate clock source when in mode 0 or 2. TCLK is located at
bit 4 of T2CON (timer/counter 2 control register) specified by data address 0C8H. This bit can
also be specified by bit address 0CCH.
4.6.2.4 RCLK
RCLK controls selection of the baud rate clock source for the receiving circuit when in mode
1 or 3.
The timer/counter 2 overflow becomes the receiving circuit baud rate clock source when
RCLK is set in mode 1 or 3. And the timer/counter 1 overflow becomes the receiving circuit
baud rate clock source if RCLK is cleared.
RCLK has no effect on the baud rate clock source when in mode 0 or 2. RCLK is located at
bit 5 of T2CON (timer/counter 2 control register) specified by data address 0C8H. This bit can
also be specified by bit address 0CDH.
103
MSM80C154S/83C154S/85C154HVS
4.6.2.5 SMOD
SMOD controls the division of the baud rate clock source when the serial port is in UART mode
(mode 1, 2, or 3).
If SMOD is cleared when in mode 1 or 3, the timer/counter 1 overflow frequency divided by
2 becomes the baud rate clock source. And if SMOD is set, the timer/counter 1 overflow
becomes the baud rate clock source.
When TCLK is set in mode 1 or 3, however, and timer/counter 2 is the baud rate clock source
for the transmitting circuit, SMOD has no effect on the transmitting baud rate. And if RCLK
has been set, timer/counter 2 becomes the baud rate source for the receiving circuit, and
SMOD has no effect on the receiving baud rate.
If SMOD is cleared in mode 2, 1/2 OSC (oscillator frequency divided by 2) divided by 2
becomes the baud rate clock source. And if SMOD is set, 1/2 OSC becomes the baud rate
clock source.
SMOD is located at bit 7 of PCON (power control register) specified by data address 87H.
Designation by bit address is not possible.
See Table 4-17 for the corresponding baud rate clock sources for TCLK, RCLK, and SMOD.
Table 4-17 Corresponding baud rate clock sources for TCLK, RCLK, and SMOD
104
INTERNAL SPECIFICATIONS
4.6.2.6 SERR
SERR is the status flag set when a framing error or overrun error is generated during UART
mode (mode 1, 2, or 3).
Framing error:
The SERR flag is set when no stop bit is detected in UART mode. Framing error is
detected irrespective of the data reception conditions set by SM2.
Overrun error:
The SERR flag is also set when the next data is ready to be transferred from the input
shift register to the SBUF which is already full in UART mode. Note that an overrun error
is only detected when the data reception conditions set by SM2 have been satisfied.
Although the SERR flag is set by hardware when a framing or overrun error is
generated, it is not an interrupt request flag. The flag must be checked by software to
determine whether it has been set or not. The flag must also be cleared by software.
Since the SERR flag is set by the logical OR of framing and overrun errors, it is not
possible to determine whether the error is a framing or overrun error simply by checking
the flag.
SERR is located at bit 5 of IOCON (I/O control register) specified by data address
0F8H. This bit can also be specified by bit address 0FDH.
105
MSM80C154S/83C154S/85C154HVS
4.6.3.1 Mode 0
4.6.3.1.1 Outline
Mode 0 is the I/O extension mode where input and output of 8-bit data via RXD (P3.0) is
synchronized with the output clock from TXD (P3.1).
The baud rate in mode 0 is fixed to 1/12th of the fundamental oscillator (XTAL1·2) frequency
to enable the serial port to operate synchronized with the basic MSM80C154S/MSM83C154S
timing.
A block diagram of the mode 0 serial port is shown in Figure 4-28, the operational timing chart
is shown in Figure 4-29, and the serial port operation timing in relation to the basic
MSM80C154S/MSM83C154S timing is shown in Figure 4-30.
In mode 0, the baud rate is determined by the following equation to synchronize operations
with the basic MSM80C154S/MSM83C154S timing.
1
B = FOSC ×
12
where B is baud rate, and FOSC is the fundamental (XTAL1·2) frequency.
Data input is commenced when REN=“1” and R1=“0” is achieved by an instruction used to
set REN or by an instruction used to clear the RI flag (or by an instruction which does both
simultaneously).
Output of the TXD synchronizing clock is commenced following nine states after REN=“1” and
R1=“0” is attained. The synchronized clock is at level “0” from the latter half of S3 thru to the
first half of S6, and at level “1” from the latter half of S6 thru to the first half of S3.
The RXD data is read sequentially into an input shift register in the serial port just before the
synchronized clock is changed from “0” to “1”.
When input of the 8-bit data is completed, loading of the input shift register data into SBUF
(with the LSB at the beginning of the input data) occurs at the same time that receiving circuit
is initialized. The RI flag is then set at the first M1·S3 after completion of input of the 8-bit data.
106
INTERNAL BUS
SHIFT
WRITE CLOCK
START SBUF (T) TXD
TO SBUF
ENABLE
Figure 4-28 Serial port (mode 0)
TI
SERIAL PORT
INTERRUPT
107
REN START RI
RXD
INTERNAL SPECIFICATIONS
INPUT SHIFT REG.
SBUF (R)
INTERNAL BUS
S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4
ALE
WRITE TO SBUF
RXD D0 D1 D2 D3 D4 D5 D6 D7
TXD
TERMINATE TRANSMISSION
TI
MSM80C154S/83C154S/85C154HVS
108
S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4
ALE
WRITE TO SCON
REN·RI
READ RXD
TXD
SHIFT-IN CLOCK
LOAD SBUF
RI
INTERNAL SPECIFICATIONS
S6
S5
S4
S3
S2
S1
S6
S5
S4
S3
S2
S1
(DATA OUTPUT)
(SHIFT CLOCK)
(SHIFT CLOCK)
OUTPUT:
INPUT:
READ RXD
XTAL1
RXD
TXD
TXD
ALE
Figure 4-30 Serial port (mode 0) timing and corresponding basic MSM80C154S/
MSM83C154S timing
109
MSM80C154S/83C154S/85C154HVS
4.6.3.2 Mode 1
4.6.3.2.1 Outline
Mode 1 is the 10-bit frame UART mode (with one start bit, eight data bits, and one stop bit)
where the baud rate may be set to any value depending on the timer/counter 1 or timer/
counter 2 setting.
A block diagram of the serial port in mode 1 is shown in Figure 4-31, and the operational timing
chart is given in Figure 4-32.
The timer/counter 1 or timer/counter 2 overflow can be set as the baud rate clock source in
mode 1 by independent TCLK and RCLK setting for the transmit and receive circuits.
Where the baud rate is determined by the timer/counter 1 overflow, baud rate is determined
by the overflow frequency and SMOD value according to the following equations.
1 1
B = fTC1 × × (SMOD=0)
2 16
1
B = fTC1 × (SMOD=1)
16
where B is the baud rate and fTC1 is the timer/counter 1 overflow frequency.
When timer/counter 1 is used as a timer (internal clock) in auto reload mode (mode 2), the
baud rate is determined by the following equations.
1 1 1 1
B = fOSC × × × × (SMOD=0)
12 256-DTH1 2 16
1 1 1
B = fOSC × × × (SMOD=1)
12 256-DTH1 16
where B is the baud rate, fOSC the fundamental (XTAL1·2) frequency, and DTH1 the TH1
contents (expressed in decimal).
Where the timer/counter 2 overflow serves as the baud rate clock source, the baud rate is
determined by the overflow frequency irrespective of the SMOD value.
When timer/counter 2 is used as a counter (external clock), the baud rate is determined by
the following equation.
1 1
B = fT2 × ×
65536-DRCAP2 16
where B is the baud rate, fT2 the frequency of the clock applied to the T2 pin, and DRCAP2 the
contents of RCAP2L and RCAP2H (expressed in decimal).
Or if timer/counter 2 is used as a timer, the baud rate is determined in the following way.
110
INTERNAL SPECIFICATIONS
1 1 1
B = fOSC × × ×
2 65536-DRCAP2 16
where B is the baud rate, fOSC the fundamental frequency (XTAL1·2), and DRCAP2 the
contents of RCAP2L and RCAP2H (expressed in decimal).
The transmit basic clock (TXCLOCK in Figure 4-31) is obtained from the overflow of a
hexadecimal free-run counter where the timer/counter 1 or timer/counter 2 overflow is used
as the clock.
Transmission is commenced when transmit data is written in SBUF.
The start bit, the eight SBUF data bits (with the LSB first), and the stop bit are transmitted
sequentially from TXD synchronized with the basic clock.
As soon as output of the eight data bits has been completed, the transmit circuit is initialized,
and the T1 flag is set at the first M1·S3 after the completion of that output.
The receive circuit timing is generated by a hexadecimal counter which uses the timer/
counter 1 or timer/counter 2 overflow as the clock, and the input data received from RXD is
bit synchronized. That is, at the same time that reception is started following input of the start
bit, the hexadecimal counter commences to count up, and with one complete round of the
hexadecimal counter corresponding to one bit of received data, reception is continued by the
receive circuit.
The RXD change from “1” to “0” is regarded as the beginning of the start bit for commence-
ment of reception.
When this “1” to “0” RXD change is detected, the hexadecimal counter which had been
stopped in reset status commences to count up. When the hexadecimal counter is in state
7, 8, and 9, the start bit is sampled, and is accepted as valid if at least two of the three sampled
values are “0”, thereby enabling data reception to continue. If two or three of the sampled
values are “1”, the start bit becomes invalid, and the receive circuit is initialized when the
hexadecimal counter reaches state 10.
The reception data is sampled when the hexadecimal counter is in state 7, 8, and 9, and the
more common value of the three sampled values is read sequentially as data into the input
shift register.
If the hexadecimal counter is in state 10 during the period of the next bit (that is, the stop bit)
after the eight bits of data have been received, and if the conditions stated below are satisfied,
the input shift register data (the LSB being read first) is loaded into SBUF, and the sampled
stop bit is read into RB8, thereby initializing the receive circuit. The RI flag is set at the first
M1·S3 after that.
Conditions: (1) RI=“0”
(2) SM2=“0”, or SM2=“1” and sampled stop bit=“0”
If the above conditions are not satisfied, the received data is disregarded, and the receive
circuit is initialized without change to the SBUF, RB8, and RI flags.
Since the receive circuit is double buffered (input shift register and SBUF), processing of the
previous receive data may be completed within the interval up to the stop bit period of the next
frame.
111
MSM80C154S/83C154S/85C154HVS
If the following two conditions are satisfied when the hexadecimal counter is in state 10 during
reception of the stop bit, it is assumed that new data is received before processing of the
previously received data has been completed. Hence, an overrun error is generated, and the
new data is lost. The SERR flag is set at the first M1·S3 after the hexadecimal counter has
reached state 10. Note that the previous SBUF (R) data is preserved.
Conditions: (1) RI=“1”
(2) SM2=“0”, or SM2=“1” and sampled stop bit=“1”
And if the sampled stop bit is “0” when the hexadecimal counter is in state 10, it is assumed
that correct frame synchronization has not been achieved. Hence, a framing error is detected,
and the SERR flag is set at the first M1·S3 after that. Serial port reception is not effected by
the UART error detector circuit detecting an overrun or framing error and only the status flag
being set.
112
INTERNAL BUS
WRITE TXD
START SBUF (T)
TO SBUF
TCLK
BAUD RATE
TCLK=1 CLOCK
1/16
COUTER TI
TCLK=0
Figure 4-31 Serial port (mode 1)
SERIAL PORT
INTERRUPT
113
START RI SERR
RXD
SAMPLE RXD
INPUT SHIFT REG. LOGIC
RCLK
BAUD RATE
INTERNAL SPECIFICATIONS
SM2
RCLK=1 CLOCK
1/16 RECEIVE DATA
COUTER SBUF (R) REN
NEGLECT LOGIC
TIMER/COUNTER2 RCLK=0
OVERFLOW
SMOD
INTERNAL BUS
TIMER/COUNTER1 SMOD=1
OVERFLOW
1/2
SMOD=0
TX CLOCK
WRITE TO SBUF
TI
M1·S3
MSM80C154S/83C154S/85C154HVS
114
RXD START BIT D0 D1 D2 D3 D4 D5 D6 D7 STOP BIT
RX COUNTER RUN
SHIFT-IN CLOCK
LOAD SBUF
TERMINATE RECEPTION
RI or SERR SET
4.6.3.3 Mode 2
4.6.3.3.1 Outline
Mode 2 is an 11-bit frame UART mode (with one start bit, eight data bits, one multipurpose
data bit, and one stop bit) where the baud rate is 1/64th or 1/32nd of the fundamental oscillator
(XTAL1·2) frequency.
A block diagram of the serial port in mode 2 is shown in Figure 4-33, and the operational timing
chart is given in Figure 4-34.
Since the fundamental oscillator frequency divided by two serves as the baud rate clock
source in mode 2, the baud rate is determined by the SMOD value according to the following
equations.
1 1 1
B = fOSC × × × (SMOD=0)
2 2 16
1 1
B = fOSC × × (SMOD=1)
2 16
where B is the baud rate and fOSC the fundamental oscillator (XTAL1·2) frequency.
The transmit basic clock (TXCLOCK in Figure 4-34) is obtained from a hexadecimal free-run
counter overflow where the frequency of 1/2XTAL1·2 (fundamental oscillator frequency
divided by 2) divided by 2 (when SMOD=0) or the 1/2XTAL1·2 frequency (when SMOD=1)
is used as the clock.
Transmission is commenced when transmit data is written in SBUF. The start bit, the eight
SBUF data bits (with the LSB first), TB8, and the stop bit are transmitted sequentially from
the TXD synchronized with the basic clock.
As soon as the TB8 output has been completed, the transmit circuit is initialized, and the T1
flag is set at the first M1·S3 after the completion of that output.
The receive circuit timing is generated by a hexadecimal counter overflow where the
frequency of 1/2XTAL1·2 (fundamental oscillator frequency divided by 2) divided by 2 (when
SMOD=0) or the 1/2XTAL1·2 frequency (when SMOD=1) is used as the clock, and the input
data received from the RXD is bit synchronized. That is, at the same time that reception is
started following input of the start bit, the hexadecimal counter commences to count up, and
with one complete round of the hexadecimal counter corresponding to one bit of received
data, reception is continued by the receive circuit. Therefore, the reception data baud rate
must be equal to the period of a single round of the hexadecimal counter.
The RXD change from “1” to “0” is regarded as the beginning of the start bit where reception
is commenced.
115
MSM80C154S/83C154S/85C154HVS
When this “1” to “0” RXD change is detected, the hexadecimal counter which had been
stopped in reset status commences to count up. When the hexadecimal counter is in state
7, 8, and 9, the start bit is sampled, and is accepted as valid if at least two of the three sampled
values are “0”, thereby enabling data reception to continue. If two or three of the sampled
values are “1”, the start bit becomes invalid, and the receive circuit is initialized when the
hexadecimal counter reaches state 10.
The receive data is sampled when the hexadecimal counter is in state 7, 8, and 9, and the
more common value of the three sampled values is read sequentially as data into the input
shift register.
If the hexadecimal counter is in state 10 during the period of the next bit (that is, the multi-
purpose data bit) after the eight bits of data have been received, and if the conditions stated
below are satisfied, the input shift register data (the LSB being read first) is loaded into SBUF,
and the sampled multi-purpose data bit is read into RB8. And when the hexadecimal counter
is in state 10 during the period of the next after that (that is, the stop bit) the receive circuit
is initialized.
The RI flag is set at the first M1·S3 after that.
Conditions: (1) R1=“0”
(2) SM2=“0”, or SM2=“1” and sampled multi-purpose data bit=“1”
If the above conditions are not satisfied when the hexadecimal counter is in state 10 during
the multi-purpose data bit interval, the received data is disregarded, the SBUF, RB8, and RI
flags remain unchanged, and the receive circuit is initialized when the hexadecimal counter
is in state 10 during the stop bit interval.
Since the receive circuit is double buffered (input shift register and SBUF), processing of the
previous receive data may by completed within the interval up to the multipurpose data bit
period of the next frame.
If the following two conditions are satisfied when the hexadecimal counter is in state 1 0 during
reception of a multi-purpose data bit, it is assumed that new data is received before
processing of the previously received data has been completed. Hence, an overrun error is
generated, and the new data is lost. The SERR flag is set at the first M1·S3 after the
hexadecimal counter has reached state 10 during the stop bit interval. Note that the previous
SBUF (R) data is preserved.
Conditions: (1) R1 =“1”
(2) SM2=“0”, or SM2=“1” and sampled multi-purpose data bit=“1”
And if the sampled stop bit is “0” when the hexadecimal counter is in state 10, it is assumed
that correct frame synchronization has not been achieved. Hence, a framing error is detected,
and the SERR flag is set at the first M1·S3 after that. Serial port reception is not effected by
the UART error detector circuit detecting an overrun or framing error and only the status flag
being set.
116
INTERNAL BUS
WRITE
START TBB SBUF (T) TXD
TO SBUF
SMOD
BAUD RATE
SMOD=1 CLOCK
1/2
Figure 4-33 Serial port (mode 2)
1/16
XTAL1·2 COUTER TI
1/2
SMOD=0
SERIAL PORT
INTERRUPT
117
START RI SERR
RXD
SAMPLE
INTERNAL SPECIFICATIONS
INPUT SHIFT REG. RXD
LOGIC
BAUD RATE
SM2
CLOCK
1/16 RECEIVE DATA
COUTER SBUF (R) REN
NEGLECT LOGIC
INTERNAL BUS
TX CLOCK
WRITE TO SBUF
TI
MSM80C154S/83C154S/85C154HVS
M1·S3
118
RXD START BIT D0 D1 D2 D3 D4 D5 D6 D7 RBB STOP BIT
RX COUNTER RUN
SHIFT-IN CLOCK
LOAD SBUF
TERMINATE RECEPTION
RI or SERR SET
4.6.3.4 Mode 3
4.6.3.4.1 Outline
Mode 3 is another 11-bit frame UART mode (with one start bit, eight data bits, one multi-
purpose data bit, and one stop bit). Whereas the baud rate is 1/64th or 1/32nd of the
fundamental oscillator frequency in mode 2, the mode 3 baud rate can be freely selected
according to the timer/counter 1 or timer/counter 2 setting. Apart from the ability to vary the
baud rate, mode 3 is identical to mode 2.
A block diagram of the serial port in mode 3 is shown in Figure 4-35, and the operational timing
chart is given in Figure 4-36.
As in mode 1, the timer/counter 1 or timer/counter 2 overflow can be set as the baud rate clock
source in mode 3 by independent TCLK and RCLK setting for the transmit and receive
circuits.
Where the baud rate is determined by the timer/counter 1 overflow, baud rate is determined
by the overflow frequency and SMOD value according to the following equations.
1 1
B = fTC1 × × (SMOD=0)
2 16
1
B = fTC1 × (SMOD=1)
16
Where B is the baud rate and fTC1 is the timer/counter 1 overflow frequency.
When timer/counter 1 is used as a timer in auto reload mode (mode 2), the baud rate is
determined by the following equations.
1 1 1 1
B = fOSC × × × × (SMOD=0)
12 256-DTH1 2 16
1 1 1
B = fOSC × × × (SMOD=1)
12 256-DTH1 16
where B is the baud rate, fOSC the fundamental oscillator (XTAL1·2) frequency, and DTH1 the
TH1 contents (expressed in decimal).
Where the timer/counter 2 overflow serves as the baud rate clock source, the baud rate is
determined by the overflow frequency irrespective of the SMOD value.
When timer/counter 2 is used as a counter, the baud rate is determined by the following
equation.
1 1
B = fT2 × ×
65536-DRCAP2 16
where B is the baud rate, fT2 the frequency of the clock applied to the T2 pin, and DRCAP2 the
contents of RCAP2L and RCAP2H (expressed in decimal).
Or if timer/counter 2 is used as a timer, the baud rate is determined by the following way.
119
MSM80C154S/83C154S/85C154HVS
1 1 1
B = fOSC × × ×
2 65536-DRCAP2 16
where B is the baud rate, fOSC the fundamental oscillator (XTAL1·2) frequency, and DRCAP2
the contents of RCAP2L and RCAP2H (expressed in decimal).
The transmit basic clock (TXCLOCK in Figure 4-36) is obtained from a hexadecimal free-run
counter overflow where timer/counter 1 or timer/counter 2 overflow is used as the clock.
Transmission is commenced when transmit data is written in SBUF.
The start bit, the eight SBUF data bits (with the LSB first), TB8, and the stop bit are transmitted
sequentially from the TXD synchronized with the basic clock.
As soon as the TB8 output has been completed, the transmit circuit is initialized, and the T1
flag is set at the first M1·S3 after the completion of that output.
The receive circuit timing is generated by a hexadecimal counter overflow where timer/
counter 1 or timer/counter 2 overflow is used as the clock, and the input data received from
the RXD is bit synchronized. That is, at the same time that reception is started following input
of the start bit, the hexadecimal counter commences to count up, and with one complete
round of the hexadecimal counter corresponding to one bit of received data, reception is
continued by the receive circuit. Therefore, timer/counter 1 must be set so that the period of
a single round of the hexadecimal counter is equal to the reception data baud rate.
The RXD change from “1” to “0” is regarded as the beginning of the start bit where reception
is commenced.
When this “1” to “0” RXD change is detected, the hexadecimal counter which had been
stopped in reset status commences to count up. When the hexadecimal counter is in state
7, 8, and 9, the start bit is sampled, and is accepted as valid if at least two of the three sampled
values are “0”, thereby enabling data reception to continue. If two or three of the sampled
values are “1”, the start bit becomes invalid, and the receive circuit is initialized when the
hexadecimal counter reaches state 10.
The reception data is sampled when the hexadecimal counter is in state 7, 8, and 9, and the
more common value of the three sampled values is read sequentially as data into the input
shift register.
If the hexadecimal counter is in state 10 during the period of the next bit (that is, the multi-
purpose data bit) after the eight bits of data have been received, and if the conditions stated
below are satisfied, the input shift register data (the LSB being read first) is loaded into SBUF,
and the sampled multi-purpose data bit is read into RB8. And when the hexadecimal counter
is in state 10 during the period of the next after that (that is, the stop bit) the receive circuit
is initialized.
The RI flag is set at the first M1·S3 after that.
Conditions: (1) RI=“0”
(2) SM2=“0”, or SM2=“1” and sampled multi-purpose data bit=“1”
120
INTERNAL SPECIFICATIONS
If the above conditions are not satisfied when the hexadecimal counter is in state 10 during
the multi-purpose data bit interval, the received data is disregarded, the SBUF, RB8, and RI
flags remain unchanged, and the receive circuit is initialized when the hexadecimal counter
is in state 10 during the stop bit interval.
Since the receive circuit is double buffered (input shift register and SBUF), processing of the
previous receive data may be completed within the interval up to the multipurpose data bit
period of the next frame.
121
MSM80C154S/83C154S/85C154HVS
INTERNAL BUS
WRITE TXD
START SBUF (T)
TO SBUF
TCLK
BAUD RATE
TCLK=1 CLOCK
1/16
COUTER TI
Figure 4-35 Serial port (mode 3)
TCLK=0
SERIAL PORT
INTERRUPT
122
START RI SERR
RXD
SAMPLE RXD
INPUT SHIFT REG. LOGIC
RCLK
BAUD RATE
SM2
RCLK=1 CLOCK
1/16 RECEIVE DATA
COUTER SBUF (R) REN
NEGLECT LOGIC
TIMER/COUNTER2 RCLK=0
OVERFLOW
SMOD
INTERNAL BUS
TIMER/COUNTER1 SMOD=1
OVERFLOW
1/2
SMOD=0
TX CLOCK
WRITE TO SBUF
TI
M1·S3
123
RXD START BIT D0 D1 D2 D3 D4 D5 D6 D7 RBB STOP BIT
RX COUNTER RUN
SHIFT-IN CLOCK
LOAD SBUF
TERMINATE RECEPTION
RI or SERR SET
I/O extension can be achieved by using the serial port in mode 0. An input extension example
is shown in Figure 4-37 and the corresponding timing chart is shown in Figure 4-38.
Following output of the latch pulse from PX.X, REN=“1” and R1=“0” are set for shift in of 74LS1
65 data.
MSM80C154S
MSM83C154S
RXD
VCC
QH SHIFT/ LOAD
SERIAL IN PX.X
CLOCK 74LS165
INHIBIT CK TXD
H G F E D C B A
INPUT
RX.X
TXD
74LS165-QH
124
INTERNAL SPECIFICATIONS
An output extension example is shown in Figure 4-39 and the corresponding timing chart is
shown in Figure 4-40. After output data has been written into SBUF and the output sequence
completed, the latch pulse output from PX.X is obtained and the 74LS164 data is shifted to
74LS373.
OUTPUT
MSM80C154S
VCC MSM83C154S
8Q 7Q 6Q 5Q 4Q 3Q 2Q 1Q
74LS373
OC G PX.X
8D 7D 6D 5D 4D 3D 2D 1D
QHQG QF QE QDQC QB QA
B A RXD
74LS164
CLK CK TXD
RXD
TXD
PX.X
An input/output extension example is shown in Figure 4-41 and the corresponding timing
chart is shown in Figure 4-42. When input data is applied, INPUT CONTROL is changed from
“0” to “1”, and the parallel input is latched. This is then followed by REN=1 and RI=0 settings,
and shift in of 74LS165 data. INPUT CONTROL is returned to “0” after the input has been
completed. Since INPUT CONTROL is connected to the 74LS126 control pin, the
MSM80C154S/MSM83C154S switches the 74LS126 output to high impedance when
74LS165 input data is not being applied, thereby preventing collision between the 74LS126
and MSM80C154S/MSM83C154S outputs.
When output data is generated, and the output is completed after writing output data into
SBUF, an output latch pulse is generated from OUTPUT CONTROL, and the 74LS164 data
is transferred to 74LS373. Although the 74LS164 data is changed to parallel input data when
74LS165 data is passed to MSM80C154S/MSM83C154S, an output latch pulse is generated
only when output data is obtained from MSM80C154S/MSM83C154S, thereby preserving
the correct data in 74LS373.
125
MSM80C154S/83C154S/85C154HVS
OUTPUT
VCC
8Q 7Q 6Q 5Q 4Q 3Q 2Q 1Q
74LS373 OUTPUT
OC G PX.X CONTROL
8D 7D 6D 5D 4D 3D 2D 1D
MSM80C154S
MSM83C154S
QHQG QF QE QDQC QB QA
B A
74LS164
CLK CK
74LS126
RXD
VCC
INPUT
126
INTERNAL SPECIFICATIONS
MSM80C154S/MSM83C154S OUTPUT
OUTPUT
74LS165 OUTPUT
INPUT
CONTROL
CONTROL
OUTPUT
INPUT
RXD
TXD
In all examples, additional multiple bit I/O extension is made possible by multiple cascade
connections of 74LS164 or 74LS165.
127
MSM80C154S/83C154S/85C154HVS
128
4.7 Interrupt
4.7.1 Outline
SOURCE ENABLE
EX0 PX0
TCON.1 IE0 PI
EXTERNAL INTERRUPT 0
IE.0 NI
IP.0
INTERRUPT ADDRESS DATA
Figure 4-44 Interrupt control equivalent circuit
EX0 PT0
TCON.5 TF0 PI
TCON.7 TF1 PI H D Q
INTERRUPT
TIMER INTERRUPT 1
IE.0 NI R
IP.3
SCON.0 RI EX0 PS CLOCK
PI
SCON.0 TI LOW PRIORITY
SERIAL PORT INTERRUPT IE.0 NI L D Q
IP.4 INTERRUPT
T2CON.7 TF2 EX0 PT2 R
PI
T2CON.6 EXF2 CLOCK
TIMER INTERRUPT 2 IE.0 NI
IP.5
VCC VCC
EA PCT
IE.7 IP.7
RETI
GLOBAL ENABLE
INTERNAL SPECIFICATIONS
The function of the interrupt enable register (IE, 0A8H) is to enable or disable interrupt
processes when an interrupt is requested.
To execute the intended interrupt routine, the interrupt is first enabled by setting “1” in the
corresponding interrupt bit in the interrupt enable register, and the routine then is executed
when the interrupt is requested.
Requested interrupts are disabled if the corresponding interrupt bit is “0”, and no interrupt
routines are executed.
The contents of the interrupt enable register (IE) are shown in Table 4-19.
Bit 7 6 5 4 3 2 1 0
Flag EA — ET2 ES ET1 EX1 ET0 EX0
131
MSM80C154S/83C154S/85C154HVS
The function of the interrupt priority register (IP, 0B8H) is to allocate rights to commence
interrupt routines on a priority basis when an interrupt is requested.
Interrupt priority can be programmed by setting the bit corresponding to the interrupt request
in the interrupt priority register (IP) to “1”. If the interrupt conditions have been satisfied for an
interrupt where “1” data has been set, processing of that interrupt is commenced. If another
interrupt (with “0” priority bit) is already being processed, that routine is suspended, and
processing of the higher priority interrupt is commenced. Note that once a priority interrupt
routine has been commenced, processing of the next interrupt cannot start until processing
of the current interrupt has been completed.
This priority circuit function can be stopped by setting “1” in bit 7 (PCT) of the priority register.
The functions of the priority interrupt control circuit are suspended, and interrupt control is
handled only by the interrupt enable register (IE 0A8H). After this mode has been set, the
interrupt disable instruction (CLR EA) must be placed at the beginning of interrupt routines
to disable the generation of other interrupts.
If another interrupt routine have to be generated during the processing of an interrupt routine,
set the desired interrupt enable bit in the interrupt enable register (IE 0A8H). The desired
interrupt routine is processed when the conditions for that routine are met. Multi-level interrupt
processing can thus be achieved by software control of the interrupt enable register.
The contents of the interrupt priority register are given in Table 4-20, and a priority interrupt
routine flow chart is shown in Figure 4-45. The flow chart for an interrupt routine when the
priority circuit is stopped (PCT=“1”) is shown in Figure 4-46.
Bit 7 6 5 4 3 2 1 0
Flag PCT — PT2 PS PT1 PX1 PT0 PX0
132
INTERNAL SPECIFICATIONS
The flow of interrupt processing when a priority interrupt is generated and processed after a
routine has been commenced by a non-priority interrupt generated during execution of a main
routine program is outlined in Figure 4-45 below. This diagram shows the flow chart up to the
point of return to the main routine.
Main routine
NI
PI
Generation
of interrput
NI
M
RETI
Non-priority interrput routine
Main routine
RETI
Figure 4-45 Interrupt processing flow chart when priority circuit is activated
133
MSM80C154S/83C154S/85C154HVS
When bit 7 (PCT) of the priority register (IP 0B8H) is set to “1”, all interrupt control is transferred
to the interrupt enable register (IE 0A8H). When this mode is set, the interrupt disable
instruction (CLR EA) must always be placed at the beginning of the interrupt routine to prevent
any other interrupt from being generated. If another interrupt routine have to be generated
during the processing of an interrupt routine, set the desired interrupt enable bit in the interrupt
enable register (IE 0A8H) to commence the new interrupt routine. Multi-level interrupt
processing can thus be achieved by control of the interrupt enable register. The flow of this
interrupt routine is shown in Figure 4-46.
Main routine
EA EA EA EA
EA
M
Interrput routine
Main routine
Figure 4-46 lnterrupt routine flow chart when priority circuit is stopped
134
INTERNAL SPECIFICATIONS
4.7.3.3 Interrupt priority when priority register (IP) contents are all “0”
The interrupt priority when the priority register (IP, 0B8H) contents are all “0” indicates the
priority in which a certain interrupt is processed in preference to other interrupts when
interrupt requests are generated simultaneously.
As can be seen from Table 4-21, the interrupt to be processed in preference to all other
interrupts is external interrupt 0, and the interrupt routine with lowest priority is timer interrupt
2.
The interrupt level when all priority bits are “0” is 1 level, and even if the interrupt conditions
for an external interrupt 0 (highest priority) are satisfied while timer interrupt 2 (lowest priority)
is being processed, the external interrupt cannot be processed.
The same operational preferences as described above also exist when all priority bits are “
1”.
135
MSM80C154S/83C154S/85C154HVS
Detect modes of the external interrupt signals 0 and 1 can be set to level-detect or trigger-
detect mode by the IT0 and IT1 data values in the timer control register (TCON 88H) as
indicated in Table 4-22.
When bit 0 (IT0) in the timer control register (TCON 88H) is “0”, external interrupt 0 is level-
activated. And when bit 2 (IT1) is “0”, external interrupt 1 is also level-activated. With the
external interrupt signals in level-detect mode, external interrupts 0 and 1 are level-detected
by the equivalent circuit shown in Figure 4-47.
When the level of the external interrupt pin is “0” at S5 timing, the level is latched and the Q
output becomes “1”. The latched external interrupt signal is set as the external interrupt flag
in the timer control register (TCON) at S3 timing. The interrupt flag set by external interrupt
signal is always reset at S6 timing of the end of the machine cycle, thereby executing the
equivalent of a “level sense” operation. The cycle width of the respective “0” and “1” levels
of the external interrupt signal applied to the external interrupt pin in this case must be at least
12 times (12T) the XTAL1·2 oscillator clock cycle time T.
And the external interrupt signal should be held at “0” level until the corresponding interrupt
is actually generated.
S3
IE0 or 1
INT0 or INT1 D Q S Q
S5 L RESET R
1
0
S6
12T 12T 12T
MEND
Figure 4-47 Interrupt level detect equivalent circuit for IT bit “0”
136
INTERNAL SPECIFICATIONS
When bit 0 (IT0) in the timer Control register (TCON 88H) is “1”, external interrupt 0 is edge-
activated. And when bit 2 (IT1) is “1”, external interrupt 1 is also edge-activated. With the
external interrupt signals in trigger-detect mode, external interrupts 0 and 1 are trigger-
detected by the equivalent circuit shown in Figure 4-48. When the level of the external
interrupt pin is “0” at S5 timing, the level is latched at the first stage and the latched Q output
becomes “1”. The external interrupt signal stored in the first stage latch is transferred to the
second stage latch and is subject to digital differentiation until the S3 timing signal. The RS-
F/F in the next stage is set by the differentiated output signal.
The external interrupt signal applied to the RS-F/F is synchronized with the M2·S3 timing
signal to be applied as a trigger for the external interrupt flag in the timer control register
(TCON). The RS-F/F is subsequently reset at M2·S4 and waits for the next interrupt. Note that
the next interrupt signal is invalid until the first stage latch detects level “1” after detecting level
“0”.
The cycle width of the respective “0” and “1” levels of the external interrupt signal applied to
the external interrupt pin in this case must be at least 12 times (12T) the XTAL1·2 oscillator
clock cycle time T.
INT0 or INT1 D Q D
S5 L L Q
1
S3
0
S4
IE0 or 1
S3 S Q
M2 BUS D
W TCON L
R
RESET
Figure 4-48 lnterrupt edge detect equivalent circuit for IT bit “1”
137
MSM80C154S/83C154S/85C154HVS
4.7.5.1 Interrupt response time chart when interrupt conditions are satisfied during
execution of ordinary instructions in main routine
If interrupt conditions are satisfied during execution of an ordinary instruction (which does not
manipulate IE or IP) in the main routine, the MSM80C154S/MSM83C154S calls the interrupt
address in the next cycle following completion of the ordinary instruction. The time chart is
given in Figure 4-49.
138
M1~M4 M1~M4
M1 M2
M1 or M2 M1 or M2
S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6
1-
XTAL1
0
1
ALE
0-
139
Instruction
execution Execution of one instruction Execution of one instruction Timer 1 interrput address call
Figure 4-49 lnterrupt response time chart when interrupt conditions are satisfied during
INTERNAL SPECIFICATIONS
MSM80C154S/83C154S/85C154HVS
4.7.5.2 Interrupt response time chart when interrupt conditions are satisfied during
execution of IE or IP register operation instruction in main routine
If interrupt conditions are satisfied during execution of an instruction used to manipulate the
interrupt enable register (IE) or the interrupt priority register (IP) in the main routine, the
MSM80C154S/MSM83C154S reactivates the interrupt mask circuit in the next cycle follow-
ing completion of the register manipulation instruction. If interrupt conditions were met as a
result of the re-interrupt mask, the interrupt address is called in the next cycle. That is, if the
interrupt conditions are satisfied during execution of the IE or the IP manipulating instruction,
the interrupt address is called after the next instruction is executed following execution of the
register manipulating instruction. The time chart is given in Figure 4-50.
* In the MOV data address 1, data address 2 instructions, transfer of data to another register
from IE or IP is an exception. (example: MOV ACC, IE)
140
M1~M4
M1 or M2 M1 M2
M1 or M2
S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6
1-
XTAL1
0
1
ALE
0-
141
Instruction Execution of IE or IP
execution manipulation instruction Execution of one instruction Timer 1 interrput address call
1-
Timer flag 1
0
4.7.5.3 Interrupt response time chart when an ordinary instruction is executed after
temporarily returning to the main routine from continuous interrupt
processing
If an ordinary instruction (which does not manipulate IE or IP) is executed after returning to
the main routine following execution of the interrupt routine end instruction RETI, and if the
next interrupt conditions have been met during execution of a previous interrupt routine, the
MSM80C154S/MSM83C154S calls the interrupt address in the next cycle following execu-
tion of one main routine instruction. The same occurs when interrupt conditions are satisfied
during execution of the first main routine instruction after returning to the main routine from
the interrupt routine. The time chart is shown in Figure 4-51.
142
M1~M4
M2 M1 M2
M1 or M2
S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6
1-
XTAL1
0
1
ALE
0-
143
Instruction Execution of one ordinary
execution RETI execution main routine instruction Timer 1 interrput address call
1
Timer flag 1
0
If the next interrupt conditions are satisfied during execution of an interrupt processing routine
and the interrupt terminating instruction RETI is then executed and followed by a return to the
main routine where an instruction which manipulates the interrupt enable register (IE) or
interrupt priority register (IP) is executed, the MSM80C154S/MSM83C154S activates the
interrupt mask circuit in the next cycle following execution of the register manipulating
instruction. And if interrupt conditions are met as a result of the re-interrupt mask, the interrupt
address is called in the next cycle. That is, if the instruction executed in the main routine
manipulates either IE or IP, the interrupt address is called after two instructions are executed.
The time chart is shown in Figure 4-52.
144
processing
M1~M4
M2 M1 or M2 M1
M1 or M2
S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6
1-
XTAL1
0
1
ALE
0-
145
Instruction Execution of IE or IP
execution RETI execution manipulation instruction Execution of one instruction Timer 1 interrput address call
1
Timer flag 1
0
4.8.1 Outline
Idle mode is set when “1” is set in bit 0 (IDL) of the power control register (PCON 87H). The
circuit connections involved in this setting are shown in Figure 4-53.
The idle mode cancellation conditions can be set through manipulation of bit 5 (RPD) of the
power control register. When “0” is set in RPD, idle mode cannot be cancelled by the interrupt
signal if the corresponding interrupt enable bit has not been set. And if “1” is set in RPD, idle
mode is cancelled by setting the interrupt flag and the program is executed from the next
address of the idle mode setting instruction, even when the corresponding interrupt enable
bit is not set.
In idle mode, the supply of clocks to the CPU control section is stopped and CPU operations
are halted. But since XTAL1·2 operations are maintained, the serial port, interrupt circuits,
and timer/counters 0, 1, and 2 remain operative.
The CPU pin status during idle mode is outlined in Table 4-23, and the corresponding time
charts for starting idle mode are shown in Figures 4-54 and 4-55.
146
INTERNAL SPECIFICATIONS
PCON, 87H
SMOD HPD RPD — GF1 GF0 PD IDL
Bit 7 6 5 4 3 2 1 0
Set * •
147
MSM80C154S/83C154S/85C154HVS
148
M1 or M2 M1 M1 M1
S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6
1
XTAL1
0
1
ALE
0
1
PSEN
0
1
W-PCON
0
1
*PCON-bit 0
0
1
PORT 0 PORT DATA
0
1
PORT 1 PORT DATA
149
0
1
PORT 2 PORT DATA
0
1
PORT 3 PORT DATA
0
Figure 4-54 Idle mode setting time chart (internal ROM mode)
INTERNAL SPECIFICATIONS
M1 or M2 M1 M1 M1
S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6
1
XTAL1
0
1
ALE
0
1
PSEN
0
1
W-PCON
0
1
*PCON-bit 0
0
MSM80C154S/83C154S/85C154HVS
1 FLOATING
PORT 0 PCL PCL PCL
0
1
PORT 1 PORT DATA
150
0
1
PORT 2 PCH PCH PCH
0
1
PORT 3 PORT DATA
0
Figure 4-55 Idle mode setting time chart (external ROM mode)
INTERNAL SPECIFICATIONS
Soft power down mode (PD) is set when “1” is set in bit 1 (PD) of the power control register
(PCON 87H). The circuit connection involved in this setting is shown in Figure 4-56.
Soft power down mode cancellation conditions can be set through manipulation of bit 5 (RPD)
of the power control register.
When “0” is set in RPD, soft power down mode cannot be cancelled by the interrupt signal
if the corresponding interrupt enable bit has not been set. And if “1” is set in RPD, the power
down mode is cancelled by setting the interrupt flag and the program is executed from the next
address of the soft power down mode setting instruction, even when the corresponding
interrupt enable bit is not set. In soft power down mode, XTAL1·2 operations are halted. Then
with all internal data preserved, all CPU operations are stopped apart from timer/counters 0
and 1.
(Timer/counters 0 and 1 operate in external clock mode.)
Note, however, that the soft power down mode can not be set under the following conditions.
If the software power down mode can be cancelled by interruption and the following
conditions are established, the software power down mode cannot be set.
(1) If trying to set the software power down mode under the conditions that the mode can
be cancelled by external interrupt 0 or 1 and the INT0 or INT1 pin is set to "0" (either
level input or edge input).
(2) If trying to set the software power down mode under the conditions that the mode can
be cancelled by timer 0 or 1 (external clock mode is set) and the T0 or T1 pin is set to
"1" when the value of the counter is "FF".
Figures 4-57, 4-58, and 4-59 show power down cancellation circuits by external interrupt or
timer interrupt.Note, however, that the soft power down mode can not be set under the
following conditions.
The pin output status of ports 0 thru 3 in soft power down mode can be left in port data output
status, or set to port output floating status.
The ports are set to data output status by setting bit 0 (ALF) of the I/O control register (IOCON)
to “0” when soft power down mode is activated, and to floating status by setting ALF to “1”
before activating power down mode. In floating status, the port pins are disconnected
electrically from the external circuitry. Apart from pins 2,3, 4, and 5 of port 3, all floating status
input port pins may be open, or undefined within the –0.5 to VCC+0.5V range.
The CPU pin status during soft power down mode (PD) with “0” on the ALF bit is /outlined in
Table 424, and the corresponding time charts for starting soft power down mode are shown
in Figures 4-60 and 4-61.
The CPU pin status during soft power down mode with “1” on the ALF bit is outlined in Table
4-25, and the corresponding time charts for starting soft power down mode are shown in
Figures 4-62 and 4-63.
151
MSM80C154S/83C154S/85C154HVS
XTAL 2
CPU CLOCK
Figure 4-56 Soft power down mode equivalent circuit
XTAL 1
PCON 87H
SMOD HPD RPD — GF1 GF0 PD IDL
Bit 7 6 5 4 3 2 1 0
Set * •
IOCON 0F8H
— T32 SERR IZC P3HZ P2HZ P1HZ ALF
Bit 7 6 5 4 3 2 1 0
Set •
INTERNAL SPECIFICATIONS
PD
PCON5(RPD)
S3
IE0 or 1
PDRESET
INT0 or INT1 D Q S Q
S5 L RESET R
S6
M END
INT0 or INT1 D Q D
S5 L L Q
S3
PCON5(RPD)
PD
S4 IE0 or 1
PDRESET
S3 S Q
BUS D
S2
W TCON LR
RESET
153
MSM80C154S/83C154S/85C154HVS
F/F1 F/F2
L SQ PDRESET
T0 or T1 R
S5 S3 RESET R
RESET TF0 or 1
PD
PCON5(RPD)
154
INTERNAL SPECIFICATIONS
Table 4-24 CPU pin details (ALF=0) in soft power down mode (PD)
155
M1 or M2 M1
S6 S1 S2 S3 S4 S5 S6 S1
1
XTAL1
0
1
ALE
0
1
PSEN
0
1
IOCON-bit 0
0
1
W-PCON
0
MSM80C154S/83C154S/85C154HVS
1
*PCON-bit 1
0
156
1
PORT 1 PORT DATA PORT DATA
0
1
PORT 2 PORT DATA PORT DATA
0
1
PORT 3 PORT DATA PORT DATA
0
PD SET CYCLE SOFT POWER DOWN MODE
*ALF=“0”
Figure 4-60 Soft power down mode setting time chart (internal ROM mode)
M1 or M2 M1
S6 S1 S2 S3 S4 S5 S6
1
XTAL1
0
1
ALE
0
1
PSEN
0
1
IOCON-bit 0
0
1
W-PCON
0
1
*PCON-bit 1
0
1 FLOATING
PORT 0 PCL PCL PCL
157
0
1
PORT 1 PORT DATA PORT DATA
0
1
PORT 2 PCH PCH PCH PORT DATA PORT DATA
0
1
PORT 3 PORT DATA PORT DATA
0
PD SET CYCLE SOFT POWER DOWN MODE
*ALF=“0”
Figure 4-61 Soft power down mode setting time chart (external ROM mode)
INTERNAL SPECIFICATIONS
MSM80C154S/83C154S/85C154HVS
Table 4-25 CPU pin details (ALF=1) in soft power down mode (PD)
158
M1 or M2 M1
S6 S1 S2 S3 S4 S5 S6 S1
1
XTAL1
0
1
ALE
0
1
PSEN
0
1
IOCON-bit 0
0
1
W-PCON
0
1
PCON-bit 1
0
1 FLOATING
*PORT 0 PORT DATA
159
0
1 FLOATING
PORT 1 PORT DATA
0
1 FLOATING
PORT 2 PORT DATA
0
1 FLOATING
PORT 3 PORT DATA
0
PD SET CYCLE SOFT POWER DOWN MODE
*ALF=“1”
Figure 4-62 Soft power down mode setting and I/O floating time chart (internal ROM mode)
INTERNAL SPECIFICATIONS
M1 or M2 M1
S6 S1 S2 S3 S4 S5 S6 S1
1
XTAL1
0
1
ALE
0
1
PSEN
0
1
IOCON-bit 0
0
1
W-PCON
0
MSM80C154S/83C154S/85C154HVS
1
*PCON-bit 1
0
1 FLOATING
PORT 0 PCL PCL PCL
160
0
1 FLOATING
PORT 1 PORT DATA
0
1 FLOATING
PORT 2 PCH PCH PCH
0 PORT DATA
1 FLOATING
PORT 3 PORT DATA
0
PD SET CYCLE SOFT POWER DOWN MODE
*ALF=“1”
Figure 4-63 Soft power down mode setting and I/O floating time chart (external ROM mode)
INTERNAL SPECIFICATIONS
To set hard power down mode (HPD), “1” is set in bit 6 (HPD) of the power control register
(PCON 87H) in advance to attain the circuit connections shown in Figure 4-61. Hard power
down mode is set when the level of the power failure detect signal applied to the HPDI pin
(bit 5 of port 3) is changed from level “1” to level “0”. XTAL1·2 operations are stopped in this
mode. And while all internal data is retained, the CPU operations also are stopped apart from
timer/counter 0 and 1. (Timer/counters 0 and 1 operate in external clock mode.)
The pin output status of ports 0 thru 3 in hard power down mode can be left in port data output
status, or set to port output floating status.
The ports are set to data output status by setting bit 0 (ALF) of the I/O control register (IOCON
0F8H) to “0” when hard power down mode is activated, and to floating status by setting ALF
to “1” before activating power down mode. In floating status, the port pins are disconnected
electrically from the external circuitry.
Apart from pins 2, 3, 4, and 5 of port 3, all floating status input port pins may be open, or
undefined within the –0.5 to VCC+0.5 V range.
The CPU pin status during hard power down mode (HPD) with “0” on the ALF bit is outlined
in Table 4-26, and the corresponding time charts for starting hard power down mode are
shown in Figures 4-65 and 4-66.
And the CPU pin status during hard power down mode (HPD) with “1” on the ALF bit is outlined
in Table 4-27, and the corresponding time charts for starting hard power down mode are
shown in Figures 4-67 and 4-68.
161
MSM80C154S/83C154S/85C154HVS
XTAL 2
CPU CLOCK
Figure 4-64 Hard power down mode equivalent circuit
XTAL 1
HPDI
CONTROL I/O FLOATING
162
PCON 87H
SMOD HPD RPD — GF1 GF0 PD IDL
Bit 7 6 5 4 3 2 1 0
Set • •
IOCON 0F8H
— T32 SERR IZC P3HZ P2HZ P1HZ ALF
Bit 7 6 5 4 3 2 1 0
Set •
INTERNAL SPECIFICATIONS
Table 4-26 CPU pin details (ALF=0) in hard power down mode (HPD)
163
M1 or M2 M1
S6 S1 S2 S3 S4 S5 S6 S1
1
XTAL1
0
1
ALE
0
1
PSEN
0
1
IOCON-bit 0
0
1
*HPDI [P3.5]
0
MSM80C154S/83C154S/85C154HVS
1
PCON-bit 6
0
1
PORT 0 PORT DATA PORT DATA
164
0
1
PORT 1 PORT DATA PORT DATA
0
1
PORT 2 PORT DATA PORT DATA
0
1
PORT 3 PORT DATA PORT DATA
0
HPD SET CYCLE HARD POWER DOWN MODE
*ALF=“0”
Figure 4-65 Hard power down mode setting time chart (internal ROM mode)
M1 or M2 M1
S6 S1 S2 S3 S4 S5 S6 S1
1
XTAL1
0
1
ALE
0
1
PSEN
0
1
IOCON-bit 0
0
1
*HPDI [P3.5]
0
1
PCON-bit 6
0
1 FLOATING
PORT 0 PCL PCL PCL
165
0
1
PORT 1 PORT DATA PORT DATA
0
1
PORT 2 PCH PCH PCH PORT DATA PORT DATA
0
1
PORT 3 PORT DATA PORT DATA
0
HPD SET CYCLE HARD POWER DOWN MODE
*ALF=“0”
Figure 4-66 Hard power down mode setting time chart (external ROM mode)
INTERNAL SPECIFICATIONS
MSM80C154S/83C154S/85C154HVS
Table 4-27 CPU pin details (ALF=1) in hard power down mode (HPD)
166
M1 or M2 M1
S6 S1 S2 S3 S4 S5 S6 S1
1
XTAL1
0
1
ALE
0
1
PSEN
0
1
IOCON-bit 0
0
1
*HPDI [P3.5]
0
1
PCON-bit 6
0
1 FLOATING
PORT 0 PORT DATA
167
0
1 FLOATING
PORT 1 PORT DATA
0
1 FLOATING
PORT 2 PORT DATA
0
1 FLOATING
PORT 3 PORT DATA
0
HPD SET CYCLE HARD POWER DOWN MODE
*ALF=“1”
Figure 4-67 Hard power down mode setting and I/O floating time chart (internal ROM mode)
INTERNAL SPECIFICATIONS
M1 or M2 M1
S6 S1 S2 S3 S4 S5 S6 S1
1
XTAL1
0
1
ALE
0
1
PSEN
0
1
IOCON-bit 0
0
1
*HPDI [P3.5]
0
MSM80C154S/83C154S/85C154HVS
1
PCON-bit 6
0
1 FLOATING
PORT 0 PCL PCL PCL
168
0
1 FLOATING
PORT 1 PORT DATA
0
1 FLOATING
PORT 2 PCH PCH PCH
0 PORT DATA
1 FLOATING
PORT 3 PORT DATA
0
HPD SET CYCLE HARD POWER DOWN MODE
*ALF=“1”
Figure 4-68 Hard power down mode setting andl/Of loating time chart (external ROM mode)
INTERNAL SPECIFICATIONS
4.9 CPU Power Down Mode (IDLE, PD, and HPD) Cancellation (CPU Activation)
4.9.1 Outline
CPU power down mode (IDLE, PD, and HPD) can be cancelled (CPU activation) in the
following two ways.
The CPU is reset when a “1” reset signal is applied to the CPU RESET pin, and the program
is executed from address 0. This method can be used in IDLE, PD, and HPD modes.
By generating the respective interrupt source signals, the program can be executed from the
interrupt address, and can also be continued from the next address after the stop address.
This method can be used in IDLE and PD modes.
The CPU is reset when a “1” level signal is applied (for at least 1µAsec.) to the CPU RESET
pin, and the CPU power down mode (IDLE, PD, or HPD) is cancelled. Programs are
subsequently executed by the CPU from address 0. The reset cancellation time charts are
outlined in Figures 4-69 thru 4-74.
169
M1 → M2 M1 → M2 M1 M1
S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6
1
XTAL1
0
1
ALE
0
1
PSEN
0
1
PCON-bit 0
0
1
*RESET
0
MSM80C154S/83C154S/85C154HVS
CPU RESET 1
CONTROL 0
1 PORT DATA FLOATING
PORT 0
170
0
1
PORT 1 PORT DATA PORT DATA=1
0
1
PORT 2 PORT DATA PORT DATA=1
0
1
PORT 3 PORT DATA PORT DATA=1
0
RESET CYCLE EXECUTE CYCLE
IDLE MODE
Figure 4-69 Restart from idle mode by reset (internal ROM mode)
M1 M1 → M2 M1 M1
S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6
1
XTAL1
0
1
ALE
0
1
PSEN
0
1
*RESET
0
CPU RESET 1
CONTROL 0
1
PCON-bit 0
0
1 FLOATING
PORT 0 PCL PCL PCL
171
0
1
PORT 1 PORT DATA PORT DATA=1
0
1
PORT 2 PCH PORT DATA=1 PCH PCH PCH
0
1
PORT 3 PORT DATA PORT DATA=1
0
IDLE MODE RESET CYCLE EXECUTE CYCLE
Figure 4-70 Restart from idle mode by reset (external ROM mode)
INTERNAL SPECIFICATIONS
M1 → M2 M1 → M2 M1 M1
S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6
1
XTAL1
0
1
ALE
0
1
PSEN
0
1
PCON-bit 1
0
1
*RESET
0
MSM80C154S/83C154S/85C154HVS
CPU RESET 1
CONTROL 0
1 PORT DATA FLOATING
PORT 0
172
0
1
PORT 1 PORT DATA PORT DATA=1
0
1
PORT 2 PORT DATA PORT DATA=1
0
1
PORT 3 PORT DATA PORT DATA=1
0
RESET CYCLE EXECUTE CYCLE
Figure 4-71 Restart from soft power mode by reset (internal ROM mode)
M1 → M2 M1 → M2 M1 M1
S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6
1
XTAL1
0
1
ALE
0
1
PSEN
0
1
PCON-bit 1
0
1
*RESET
0
CPU RESET 1
CONTROL 0
1 FLOATING
PORT 0 PCL PCL PCL
173
0
1
PORT 1 PORT DATA PORT DATA=1
0
1
PORT 2 PORT DATA PORT DATA=1 PCH PCH PCH
0
1
PORT 3 PORT DATA PORT DATA=1
0
RESET CYCLE EXECUTE CYCLE
Figure 4-72 Restart from soft power mode by reset (external ROM mode)
INTERNAL SPECIFICATIONS
M1 → M2 M1 → M2 M1 M1
S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6
1
XTAL1
0
1
ALE
0
1
PSEN
0
1
IOCON-bit 0
0
1
HPDI[P3.5]
0
MSM80C154S/83C154S/85C154HVS
1
*RESET
0
CPU RESET 1
174
CONTROL 0
1
PCON-bit 6
0
1 PORT FLOATING FLOATING
PORT 0
0
1
PORT 1 PORT FLOATING PORT DATA=1
0
1
PORT 2 PORT FLOATING PORT DATA=1
0
1
PORT 3 PORT FLOATING PORT DATA=1
0
RESET CYCLE EXECUTE CYCLE
Figure 4-73 Restart from hard power down mode by reset (internal ROM mode)
M1 → M2 M1 → M2 M1 M1
S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6
1
XTAL1
0
1
ALE
0
1
PSEN
0
1
IOCON-bit 0
0
1
HPDI[P3.5]
0
1
*RESET
0
CPU RESET 1
175
CONTROL 0
1
PCON-bit 6
0
1 PORT FLOATING FLOATING
PORT 0 PCL PCL PCL
0
1
PORT 1 PORT FLOATING PORT DATA=1
0
1
PORT 2 PORT FLOATING PORT DATA=1 PCH PCH PCH
0
1
PORT 3 PORT FLOATING PORT DATA=1
0
RESET CYCLE EXECUTE CYCLE
Figure 4-74 Restart from hard power down mode by reset (external ROM mode)
INTERNAL SPECIFICATIONS
MSM80C154S/83C154S/85C154HVS
4.9.3 Cancellation of CPU power down mode (IDLE, PD) by interrupt signal
When idle mode (IDLE) and soft power down mode (PD) are cancelled by interrupt signal,
power down mode cancellation condition is determined by bit 5 (RPD) of the power control
register (PCON 87H) shown in Table 4-29.
When RPD is “0”, power down mode can be cancelled by interrupt signal and CPU executes
program from the interrupt address only when the CPU has been set to interrupt enable
status.
And when RPD is “1”, power down mode can be cancelled and resumes execution from the
next address after the stop address if “1” is set in the interrupt flag by interrupt signal even
when the CPU is in interrupt disable mode.
The conditions for cancellation of power down mode by interrupt signal can thus be specified
by the RPD content.
4.9.3.1 Cancellation of CPU power down mode (IDLE, PD) from interrupt address
To cancel idle mode (IDLE) or soft power down mode (PD) and resume execution from the
interrupt address, an interrupt is specified in the interrupt enable register (IE 0A8H) prior to
setting CPU power down mode and “0” is set in bit 5 (RPD) of the power control register
(PCON 87H).
All six interrupts can be used to cancel idle mode. The interrupt conditions are satisfied when
“1” is set in the specified interrupt flag in TCON, T2CON, or SCON. Clock signals are then
passed to the CPU, and execution is commenced from the interrupt address.
Soft power down mode (PD) can be cancelled by four different interrupts - external interrupts
0 and 1, and timer interrupts 0 and 1. (Timer/counters 0 and 1 are operated in external clock
mode.)
The external interrupts are generated by “0” level being applied to either the INT0 or INT1 pin.
When the specified interrupt flag in TCON is set to “1” to satisfy the interrupt conditions,
XTAL1·2 operation is commenced, and the program is executed from the interrupt address.
When the interrupt routine is completed, the program returns to the next address after the stop
address.
If all interrupts have been disabled, however, CPU power down mode cannot be cancelled
from the interrupt address by this method. A “1” reset signal must be applied to the RESET
pin and execution commenced from address 0 in this case. The equivalent circuit involved
in CPU power down mode cancellation by interrupt is shown in Figure 4-75, and the CPU
power down mode (PD, HPD) cancellation time charts are shown in Figures 4-76 thru 4-79.
176
INTERNAL SPECIFICATIONS
IE0 [TCON.1]
IE.0
TF0 [TCON.5]
IE.1
IE1 [TCON.3]
IE.2
IDLE, PD MODE
TF1 [TCON.7]
INTERRUPT &
IE.3 RESTART
RI/TI [SCON.0, 1]
IE.4
EXF2/TF2[T2CON.6, 7]
IE.5
IE.7
Figure 4-75 Equivalent circuit for, DLE and PD mode rancellation by interrupt signal
177
M1 M1 M1 M2
S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6
1
XTAL1
0
1
ALE
0
1
PSEN
0
1
*INT0 or INT1
0
IE0 or IE1 1
OUT 0
MSM80C154S/83C154S/85C154HVS
1
PCON-bit 0
0
1 PORT DATA
PORT 0
178
0
1
PORT 1 PORT DATA
0
1
PORT 2 PORT DATA
0
1
PORT 3 PORT DATA
0
IDLE MODE WASTE CYCLE INTERRUPT EXECUTE CYCLE
Figure 4-76 Restart from idle mode by interrupt INT0 or 1 (internal ROM mode)
M1 M1 M1 M2
S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6
1
XTAL1
0
1
ALE
0
1
PSEN
0
1
*INT0 or INT1
0
IE0 or IE1 1
OUT 0
1
PCON-bit 0
0
1 FLOATING
PORT 0 PCL PCL PCL PCL PCL
179
0
1
PORT 1 PORT DATA
0
1
PORT 2 PCH PCH PCH PCH PCH
0
1
PORT 3 PORT DATA
0
IDLE MODE WASTE CYCLE INTERRUPT EXECUTE CYCLE
Figure 4-77 Restart from idle mode by interrupt INT0 or 1 (external ROM mode)
INTERNAL SPECIFICATIONS
M1 M1 M2 M1
S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6
1
XTAL1
0
1
ALE
0
1
PSEN
0
1
*INT0 or INT1
0
IE0 or IE1 1
OUT 0
MSM80C154S/83C154S/85C154HVS
1
PCON-bit 1
0
1
PORT 0 PORT DATA
180
0
1
PORT 1 PORT DATA
0
1
PORT 2 PORT DATA
0
1
PORT 3 PORT DATA
0
WASTE CYCLE INTERRUPT EXECUTE CYCLE EXECUTE CYCLE
Figure 4-78 Restart from soft power down mode by Interrupt INT0 or 1 (internal ROM mode)
M1 M1 M2 M1
S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6
1
XTAL1
0
1
ALE
0
1
PSEN
0
1
*INT0 or INT1
0
IE0 or IE1 1
OUT 0
1
PCON-bit 1
0
1
PORT 0 PCL PCL PCL PCL PCL PCL PCL
181
0
1
PORT 1 PORT DATA
0
1
PORT 2 PCH PCH PCH PCH PCH PCH PCH PCH
0
1
PORT 3 PORT DATA
0
WASTE CYCLE INTERRUPT EXECUTE CYCLE EXECUTE CYCLE
Figure 4-79 Restart from soft power down mode by interrupt INT0 or 1 (external ROM mode)
INTERNAL SPECIFICATIONS
MSM80C154S/83C154S/85C154HVS
4.9.3.2 Cancellation of CPU power down mode (IDLE, PD) by interrupt request signal
and restart from next address of stop address
To cancel idle mode (IDLE) or soft power down mode (PD) by interrupt request signal and
then resume execution from the next address after the stop address, “1” is set in bit 5 (RPD)
of the power control register. When “1” is set in this bit, the circuit connections shown in Figure
4-80 are made, and the CPU power down mode is cancelled when the interrupt flag has been
set to “1”, even if the entire contents of the interrupt enable register (IE 0A8H) have been put
into interrupt disable status.
All six interrupt sources can be used to cancel idle mode (IDLE). If an interrupt source is
generated and “1” is set in one of the interrupt flags in TCON, T2CON, or SCON, clock signals
are passed to the CPU control stage, and execution is resumed from the next address after
the stop address.
Soft power down mode (PD) can be cancelled by four different interrupt sources - external
interrupts 0 and 1 , and timer interrupts 0 and 1. The external interrupt flag is set by “0” level
being applied to either the INT0 or INT1 pin. And timer/counters 0 and 1 are used in external
clock mode. When one of the interrupt flags in TCON is set to “1”, XTAL1·2 operation is
commenced, and the program is executed from the next address after the stop address.
Note, however, that the interrupt flags are reset by software. The cancellation time charts are
shown in Figures 4-81 thru 4-84.
IE0 [TCON.1]
TF0 [TCON.5]
IE1 [TCON.3]
IDLE, PD MODE
TF1 [TCON.7] RESTART
RI/TI [SCON.0, 1]
EXF2/TF2 [T2CON.6, 7]
*MODE SET
SMOD HPD RPD — GF1 GF0 PD IDL
Bit 7 6 5 4 3 2 1 0
Set • * *
Figure 4-80 Equivalent circuit for power down mode cancellation and restart by interrupt
source signal
182
M1 M1 M1 M2
S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6
1
XTAL1
0
1
ALE
0
1
PSEN
0
1
*INT0 or INT1
0
EDGE SENSE
IE0 or IE1 1
OUT 0 LEVEL SENSE
1
PCON-bit 0
0
1 PORT DATA
PORT 0
183
0
1
PORT 1 PORT DATA
0
1
PORT 2 PORT DATA
0
1
PORT 3 PORT DATA
0
IDLE MODE WASTE CYCLE INTERRUPT EXECUTE CYCLE
Figure 4-81 Restart from idle mode by INT0 or 1 (internal ROM mode)
INTERNAL SPECIFICATIONS
M1 M1 M1 M2
S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6
1
XTAL1
0
1
ALE
0
1
PSEN
0
1
INT0 or INT1
0
EDGE SENSE
*IE0 or IE1 1
OUT 0 LEVEL SENSE
MSM80C154S/83C154S/85C154HVS
1
PCON-bit 0
0
1 FLOATING
PORT 0 PCL PCL PCL PCL PCL
184
0
1
PORT 1 PORT DATA
0
1
PORT 2 PCH PCH PCH PCH PCH
0
1
PORT 3 PORT DATA
0
IDLE MODE WASTE CYCLE INTERRUPT EXECUTE CYCLE
Figure 4-82 Restart from idle mode by INT0 or 1 (external ROM mode)
M1 M1 M1
S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6
1
XTAL1
0
1
ALE
0
1
PSEN
0
1
INT0 or INT1
0
EDGE SENSE
IE0 or IE1 1
OUT 0 LEVEL SENSE
1
PCON-bit 1
0
1 FLOATING
PORT 0 PORT DATA
185
0
1 FLOATING
PORT 1 PORT DATA
0
1 FLOATING
PORT 2 PORT DATA
0
1 FLOATING
PORT 3 PORT DATA
0
SOFT POWER DOWN MODE WASTE CYCLE EXECUTE CYCLE EXECUTE CYCLE
Figure 4-83 Restart from soft power down mode by INT0 or 1 (internal ROM mode)
INTERNAL SPECIFICATIONS
M1 M1 M1
S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6
1
XTAL1
0
1
ALE
0
1
PSEN
0
1
*INT0 or INT1
0
EDGE SENSE
IE0 or IE1 1
OUT 0 LEVEL SENSE
MSM80C154S/83C154S/85C154HVS
1
PCON-bit 1
0
1 FLOATING
PORT 0 PCL PCL PCL PCL PCL
186
0
1 FLOATING
PORT 1 PORT DATA
0
1 FLOATING
PORT 2 PORT DATA PCH PCH PCH PCH PCH
0
1 FLOATING
PORT 3 PORT DATA
0
SOFT POWER DOWN MODE WASTE CYCLE EXECUTE CYCLE EXECUTE CYCLE
Figure 4-84 Restart from soft power down mode by INT0 or 1 (external ROM mode)
INTERNAL SPECIFICATIONS
Figures 4-85-1/2 and 2/2 show the examples of the MSM80C154S/83C154S battery backup
circuits with hard power down mode. The hard power down mode serves to retain data stored
in the CPU and external RAM if the AC 100V power failure occurs. Figure 4-85-1/2 shows the
CPU, power failure detector, and external RAM control unit. Figure 4-85-2/2 shows the
external RAM. The power failure detection voltage is set up by VR of the circuit A of Figure
4-85-1/2.
If the AC 100V power failure occurs when the power failure detection voltage is 4.5V, the
circuit works as described below.
When the power failure occurs, the internal power supply voltage VCA goes down from 5V
to 0V. When the VCA goes down less than 4.5V, a power failure detection signal is output from
the A circuit to the B circuit.
If data is being transferred between the CPU and external RAM during the detection of power
failure, information on power failure is stored in RS-F/F of the B circuit, when data transfer
ends. When information on on power failure is stored in RS-F/F, the I/O control signal goes
from “1” level to “0” level, which separates the external RAM and the peripheral circuit
electrically to retain data in the external RAM. At the same time, a hard power down signal
is output, the T1 pin of the CPU goes from “1” level to “0” level, and the CPU enters the hard
power down mode.
If the I/O port is ready to output data during hard power down mode, electric current flows to
the external via a 100KW pull-up resistance of the T1 pin.
The current flow to the external can be prevented by setting “1” into bit 0 (ALF) of IOCON
(0F8H) when setting the hard power down mode. If the hard power down mode is set when
ALF is at “1” level, electric current does not flow from the T1 pin to the external because I/O
becomes a floating state.
When AC 100V power supply is restored and the internal VCA goes from 0V to 5V, the hard
power down mode is cancelled.
When VCA exceeds 4.5V, the A circuit stops outputting a power failure signal for the B circuit.
When a power failure signal is not output, the power failure memory RS-F/F of the B circuit
is reset after a time constant of the internal 200W and 10mF, and the external RAM I/O control
signal and hard power down signal turn from “0” level to “1” level.
When RS-F/F is reset, a CPU reset signal is output and the CPU’s power down mode is
cancelled. The CPU starts the operation of XTAL1, 2 and executes a command starting from
address 0.
187
PSEN RD OE
1K 1K
WR
10K
P0.0 P0.0
P1
P0.1 P0.1 SN7408 WR
AC100V 1K 1K
P0.2 P0.2 10K
P0.3 P0.3
SN7408
P0.4 P0.4
5V
+ P0.5 P0.5
P3
MSM80C154S/83C154S
– P0.6 P0.6 CS0
1K 1K
1000µF
P0.7 P0.7
XTAL1 10K
10PF ALE ALE G2A Y0
XTAL2 P2.0 P2.0 G2B Y1
VCC P2.1 P2.1 Y2
P2.2 P2.2 Y3
MSM80C154S/83C154S/85C154HVS
P2.3 A Y4
0.1µF
P2.3
VSS P2.4 B Y5 CS7
P2.4 1K 1K
SN74NS138
P2.5 C Y6
P2.5 10K
188
RESET P2.6 P2.6 G1 Y7
P2.7 P2.7 ACC
T1(P3.5) EA I/O control signal GND
74HC08
74HC02 VCA
A
VCB
74HC02 1K 330
43K
8 +
5.1K
100µF
5.1K
VR
–
2.2V
20K
1K
3 4
ICL3211
5.1K
3N-100AAL S
200K
18K
5.1K
0.1µF
+
RRB51A05W
5 – 10µF 5.1K
Figure 4-85-1/2 MSM80C154S/83C154S battery back up with hard power down mode
B 74HC08
VCB
P0.7
P0.6
P0.5
P0.4
P0.3
P0.2
P0.1 D0 D1 D2 D3 D4 D5 D6 D7 VCC
P0.0
CS MSM5128RS
0.1µF
CS WE A0 A1 A2 A3 A4 A5 A6 A7 A8 A9A10 VSS
CS7
CS0
P2.0
P2.1
P2.2
189
VCA
VCC
P0.7 D7 Q7
P0.6 D6 Q6
P0.5 D5 Q5 D0 D1 D2 D3 D4 D5 D6 D7 VCC
P0.4 D4 Q4
CS MSM5128RS
P0.3 D3 Q3
0.1µF
SN74LS373
P0.0 D0 Q0
51K
ALE L
GND 51K
51K
OE
Figure 4-85-2/2 MSM80C154S/83C154S battery back up with hard power down mode
WR
INTERNAL SPECIFICATIONS
1k ×8
MSM80C154S/83C154S/85C154HVS
5. INPUT/OUTPUT
PORTS
190
INPUT/OUTPUT PORTS
191
MSM80C154S/83C154S/85C154HVS
5. INPUT/OUTPUT PORTS
5.1 Outline
5.2 Port 0
Port 0 is an 8-bit input/output port. The circuit configuration is shown in Figure 5-1. When port
0 is used as an input/output port in internal ROM mode (MSM83C154S), the equivalent circuit
is indicated in Figure 5-2. When operated as an output port, port 0 becomes an open drain
output port, and when operated as an input port, “1” should be set in the port 0 latch to put
the port 0 pin into floating status prior to using the port for input purposes.
When port 0 is used in external ROM mode (MSM80C154S) and external RAM mode, the
equivalent circuit is shown in Figure 5-3 where addresses and data outputs are obtained as
“1” and “0” by totem pole output driver. When data from external ROM or external RAM is
applied as input data, port 0 automatically becomes a tri-state input port. When the CPU is
reset or when an external ROM or external RAM is accessed, “1” data is set automatically in
the port 0 latch. The port 0 pin table is shown in Table 5-1.
PD/DATA
PC0~7
RA0~7
INTERNAL
ACC0~7
BUS VCC
D Q
P
WPO
PORT 0
MODIFY
READ
FLOATING
192
INPUT/OUTPUT PORTS
INTERNAL BUS
PORT 0
READ
D Q N
WPO
MODIFY
Figure 5-2 Port 0 input/Output port equivalent circuit in internal ROM mode
PC0~7 P
RA0~7
ACC0~7
PORT 0
N
READ
Figure 5-3 Port 0 equivalent circuit during address and data input/output in external
ROM/RAM mode
193
MSM80C154S/83C154S/85C154HVS
1 P0.0 ACC.0 PC –0
RA
2 P0.1 ACC.1 PC –1
RA
3 P0.2 ACC.2 PC –2
RA
4 P0.3 ACC.3 PC –3
RA
5 P0.4 ACC.4 PC –4
RA
6 P0.5 ACC.5 PC –5
RA
7 P0.6 ACC.6 PC –6
RA
8 P0.7 ACC.7 PC –7
RA
194
INPUT/OUTPUT PORTS
5.3 Port 1
Port 1 is a quasi-bidirectional port capable of handling input and output of 8-bit data in the
circuit configuration outlined in Figure 5-4.
A “quasi-bidirectional port” refers to a port which has internal pull-up resistance when used
as an input port. The internal equivalent circuit is shown in Figure 5-5.
If a quasi-bidirectional port is used exclusively as an output port, the port output driver
becomes a totem-pole type for driving “1” and “0” data. The output impedance during output
of “1” data is approximately 9 kohm, while a sink current is 1.6mA during output of “0” data.
When used as an output port, the “1” data accelerator circuit is activated for a period
equivalent to two XTAL1·2 oscillator clocks only when the output data is shifted from “0” to
“1”. During this data acceleration operation, the “1” output impedance is changed to about 500
ohms, the IOH current is increased, and the output signal leading edge is speeded up. The
accelerator circuit operation time chart is given in Figure 5-6. Once port output data has been
written in port latch it is preserved until output of the next item of data.
If a quasi-bidirectional port is used exclusively as an input port, “1” data is first set in the port
latch in advance. When the input signal applied to the input port is changed from level “1” to
level “0”, the port 10 kohm pull-up resistance is disconnected from the VCC, leaving only the
100 kohm pull-up resistance for reducing external IIL current. And when the input signal is
changed from level “0” to level “1”, the 10 kohm resistance is reconnected, thereby connecting
the 10 and 100 kohm resistances to the VCC supply in parallel. The quasi-bidirectional port
input equivalent circuit is outlined in Figure 5-7.
To change port 1 from a quasi-bidirectional input port to a high impedance input port, “1” is
set in bit 1 (P1HZ) of the I/O control register (IOCON 0F8H). The output driver circuit is thus
disconnected from the port pin and the port becomes a high impedance input port. The signal
levels applied to high impedance input ports are normal “0” and “1” level signals. The pins
cannot be used in open status.
The bit 0 and bit 1 of port 1 have alternate functions apart from serving as port pins. Bit 0 can
function as the external clock input pin for timer/counter 2, and bit 1 can function as the capture
signal input pin for timer/counter 2, or as the auto reload signal input pin, or as the external
timer flag 2 setting pin, depending on the timer/counter 2 operation mode.
When the bit 0 and 1 pins are to be used as timer/counter 2 control pins, “1” must be set in
the port in advance.
And if port output is to be put into floating status during CPU power down mode (PD, HPD),
“1” is to be set in bit 1 (ALF) of the I/O control register (IOCON 0F8H) before CPU power down
mode is activated. Floated port 1 pins may be either open, or undefined within the –0.5 to VCC
+0.5V range.
And when port 1, 2, and 3 quasi-bidirectional ports are used as input ports, the port pull-up
resistance may be set only to 100 kohms. If “1” is set in bit 4 (IZC) of the I/O control register
(IOCON 0F8H), the 10 kohm pull-up resistance for ports 1, 2, and 3 is all disconnected from
VCC, leaving only the 100 kohm resistance. This mode is useful when input data is applied
to the quasi-bidirectional port by external devices having low output driving capacity (high
output impedance). The port 1 CPU control pin functions are listed in Table 5-2, and the port
pin list is given in Table 5-3.
195
MSM80C154S/83C154S/85C154HVS
INTERNAL
BUS
VCC
CONTROL
C
D Q P1 P2 P3
MODIFY
PORT 1
READ
WP1 Q N
196
INPUT/OUTPUT PORTS
. .
.
R=500Ω ON .
R=500Ω OFF
VCC VCC
P1 P1
. .
.
R=10kΩ ON IOH .
R=10kΩ ON IOH
P2 P2
. .
.
R=100kΩ ON .
R=100kΩ ON
P3 P3
INTERNAL INTERNAL
BUS BUS
READ OFF READ OFF
N N
(A) When accelerator circuit is activated (B) When "1" data is held
.
.
R=500Ω OFF
VCC
P1
.
.
R=10kΩ OFF
P2
.
.
R=100kΩ OFF
P3
INTERNAL
BUS
READ IOL
ON
N
197
MSM80C154S/83C154S/85C154HVS
M1 M1
S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2
1-
XTAL1
0-
1-
ALE
0-
1
PSEN
0
1-
W-PORT
0
1
CPU-BUS
0
1-
PORT-OUT PORT DATA="0" PORT DATA="1"
0
1-
*P1·2·3TR-ON
0 *
198
INPUT/OUTPUT PORTS
VCC
. .
.
R=100kΩ .
R=10kΩ
ON P3 ON P2
INTERNAL
BUS
READ OFF
N
VCC VCC
. .
.
R=100kΩ .
R=10kΩ
ON
ON P3 ON P2
10kΩ
IIH
INTERNAL
BUS
READ OFF OFF
N
VCC VCC
. .
.
R=100kΩ .
R=10kΩ
OFF
ON P3 OFF P2
10kΩ
IOH
INTERNAL
BUS
READ OFF ON
N
199
MSM80C154S/83C154S/85C154HVS
PORT1 Function
P1.0 T2 [TIMER COUNTER 2 EXTERNAL CLOCK]
P1.1 T2EX [TIMER COUNTER 2 EXTERNAL CONTROL]
200
INPUT/OUTPUT PORTS
5.4 Port 2
Port 2 can function as a quasi-bidirectional port capable of handling input and output of 8-bit
data in the circuit configuration outlined in Figure 5-8. It can also be used for output of
addresses 8 thru 15 in external ROM and external RAM (using DPTR) modes. When port 2
is used as a quasi-bidirectional port, it functions in much the same way as port 1. Note,
however, that the port 2 “1” data accelerator circuit operates for a period equivalent to four
XTAL1·2 oscillator clocks.
Output of addresses 8 thru 15 obtained from port 2 is activated by the circuit outlined in Figure
5-9. When the address output data is “1”, the “1” data accelerator circuit is activated during
output of the data, resulting in a higher driving capacity.
To change port 2 from a quasi-bidirectional input port to a high impedance input port, “1” is
set in bit 2 (P2HZ) of the I/O control register (IOCON 0F8H). The output driver circuit is thus
disconnected from the port pin and the port becomes a high impedance input port. The signal
levels applied to high impedance input ports are normal “0” and “1” level signals. The pins
cannot be used in open status.
When port outputs are floated in CPU power down mode (PD, HPD), the port 2 pins may be
either open, or undefined within the –0.5 to VCC+0.5V range. The port 2 pin table is given in
Table 5-4.
INTERNAL
BUS
VCC
PC/DATA
PC8~15 P1 P2 P3
RA8~15
(DPH)
PORT 2
READ
MODIFY Q
D Q C
D
WP2 Q N
CONTROL
201
MSM80C154S/83C154S/85C154HVS
VCC
PC/DATA P1 P2 P3
PC8~15
RA8~15
(DPH)
PORT 2
Figure 5-9 Port 2 address output equivalent circuit for external memory
1 P2.0 ACC.0 PC –8
RA
2 P2.1 ACC.1 PC –9
RA
202
INPUT/OUTPUT PORTS
5.5 Port 3
Port 3 can function as a quasi-bidirectional port capable of handling input and output of 8-bit
data in the circuit configuration outlined in Figure 5-10, and can also be used as a CPU control
pin.
When port 3 is used as a quasi-bidirectional port, all functions are identical to those described
for port 1. And when used as a CPU control pin, the port is used after first setting “1” data in
the port latch. Note that if the port is used with “0” port latch data, the CPU control signal is
ANDed (logical product) with the port “0” data, resulting in the CPU control signal remaining
at “0” level.
To change port 3 from a quasi-bidirectional input port to a high impedance input port, “1” is
set in bit 3 (P3HZ) of the I/O control register (IOCON 0F8H). The output driver circuit is thus
disconnected from the port pin (floating pin status) and the port becomes a high impedance
input port. The signal levels applied to high impedance input ports are normal “0” and “1” level
signals. The pins cannot be used in open status.
When port outputs are floated in CPU power down mode (PD, HPD), normal “0” and “1” level
signals are applied to pins 2 thru 5 of port 3, and pins 0, 1, 6, and 7 may be either open, or
undefined within the –0.5 to VCC+0.5V range. The CPU control function pins are listed in
Table 5-5, and the port 3 pin table is given in Table 5-6.
INTERNAL
BUS
VCC
CONTROL
C
D Q P1 P2 P3
MODIFY
PORT 3
READ
DATA IN
N
D Q
WP3
DATA OUT
203
MSM80C154S/83C154S/85C154HVS
204
INPUT/OUTPUT PORTS
5.6 Port 0, 1, 2, and 3 Output and Floating Status Settings in CPU Power Down
Mode (PD, HPD)
The port 0, 1, 2, and 3 output status can be set to either data output or floating when
MSM80C154S/MSM83C154S is in power down mode (PD, HPD).
To set these ports to output status in power down mode, bit 0 (ALF) of the I/O control register
(IOCON 0F8H) is reset to “0” before PD or HPD mode is activated (see Figure 5-11). The CPU
is then stopped with the ports in data output status when power down mode is started.
And to set the ports to floating status in power down mode, “1” is set in bit 0 (ALF) of the I/
O control register (IOCON 0F8H) before PD or HPD mode is activated (see Figure 5-11). The
port output driver is disconnected from the port pins when power down mode is started.
If “1” output from port becomes a power supply factor in respect to the external circuits when
PD or HPD mode is activated in port data output mode, the PD or HPD mode should be
activated after the port data is reset to “0” by software. And in the reverse case, PD or HPD
mode is activated after the port data is set to “1”.
When port pins are in floating status during PD or HPD mode, the port pin status of all pins
except pins 2 thru 5 of port 3 may be either open or undefined in the –0.5 to VCC+0.5V range.
This mode is used only in battery back-up of CPU data.
205
MSM80C154S/83C154S/85C154HVS
MODIFY
PORT1, 2, 3
VCC
D
P2-10kΩ P3-100kΩ
W PORT Q
I/O
READ
N
INTERNAL BUS
POWER DOWN
[IOCON 0F8H]
Bit 7 6 5 4 3 2 1 0
Flag — T32 SERR IZC P3HZ P2HZ P1HZ ALF
Set • • • • •
206
INPUT/OUTPUT PORTS
Each of the quasi-bidirectional input ports 1, 2, and 3 can be set as high impedance input
ports.
This high impedance condition is achieved by setting “1” in bits 1 (P1HZ), 2 (P2HZ), and 3
(P3HZ) of the I/O control register (IOCON 0F8H) shown in Figure 5-11. Port 1 is set by P1HZ,
port 2 by P2HZ, and port 3 by P3HZ. When the each bit is set to “1”, the port output driver is
disconnected from the port pins, and the quasibidirectional input ports become high
impedance input ports.
After being changed to high impedance input ports, the port latch data modify instructions and
the input instructions for external input signals can still be used.
Normal “0” and “1” level signals must be applied to high impedance input ports. The pins
cannot be used in open status.
5.8 100 kohm Pull-Up Resistance Setting for Quasi-bidirectional Input Ports 1,
2, and 3
207
MSM80C154S/83C154S/85C154HVS
The following points must be carefully considered when quasi-bidirectional ports are used to
drive a transistor by the circuit shown in Figure 5-12.
Even though the CPU output in this circuit is at “1” level, the port output pin level may be
clamped by the base-emitter voltage VBE (0.7V) of an external NPN transistor, resulting in a
pin level of “0”.
VCC VCC
10kΩ 100kΩ
OUT
P
IB
.
CPU "1" OUT .
VBE=0.7V
When the pin level is dropped to “0”, the CPU disconnects the 10 kW pull-up resistance from
the power supply, leaving only the 100 kW pull-up resistance connected. Since the base
current IB of an external NPN transistor is supplied via the 100 kW resistance, the transistor
collector current IC may be reduced to a level insufficient for driving purposes.
To resolve this problem, diode can be inserted between the transistor base and CPU pin as
indicated in Figure 5-13 to achieve a pin level of “1” by level shift. or by using a PNP transistor
as indicated in Figure 5-14 where the external transistor is driven by a “0” level port output,
this problem is solved.
208
INPUT/OUTPUT PORTS
VCC VCC
10kΩ 100kΩ
OUT
P
IB
VCC
OUT
IB
209
MSM80C154S/83C154S/85C154HVS
M1 M1
S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1
1
XTAL1
0
1
ALE
0
1M CYCLE OP
1
W-PORT
0
1
PORT-OUT PORT OLD DATA PORT NEW DATA
0
Figure 5-15 One machine cycle instruction port output time chart
210
INPUT/OUTPUT PORTS
M2 M1
S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1
1
XTAL1
0
1
ALE
0
2M CYCLE OP
1
W-PORT
0
1
PORT-OUT PORT OLD DATA PORT NEW DATA
0
Figure 5-16 Two machine cycle instruction port output time chart
211
MSM80C154S/83C154S/85C154HVS
212
INPUT/OUTPUT PORTS
213
MSM80C154/83C154/85C154
6. ELECTRICAL
CHARACTERISTICS
214
ELECTRICAL CHARACTERISTICS
215
MSM80C154/83C154/85C154
6. ELECTRICAL CHARACTERISTICS
5
4 3
3
tcy fOSC
(ms) fEXTCLK
2 6 (MHz)
1 12
0.6 20
0.5 24
2 2.2 3 4 5 6
216
ELECTRICAL CHARACTERISTICS
6.3 DC Characteristics 1
Measuring
Parameter Symbol Conditions Min Typ Max Unit
Circuit
Input Low Voltage VIL — –0.5 — 0.2VCC V
–0.1
Input High Voltage VIH Except XTAL1, EA 0.2VCC — VCC+0.5 V
and RESET +0.9
Input High Voltage VIH1 XTAL1 and EA 0.7VCC — VCC+0.5 V
RESET
Output Low Voltage VOL IOL=1.6mA — — 0.45 V
[PORT 1, 2,3]
Output Low Voltage VOL1 IOL=3.2mA — — 0.45 V 1
[PORT 0, ALE, PSEN]
IOH=–60µA 2.4 — — V
Output High Voltage VOH
[PORT 1, 2,3] IOH=–30µA 0.75VCC — — V
IOH=–10µA 0.9VCC — — V
IOH=–400µA 2.4 — — V
Output High Voltage VOH1 VCC=5V±10%
[PORT 0, ALE, PSEN] IOH=–150µA 0.75VCC — — V
IOH=–40µA 0.9VCC — — V
Logical 0 Input Current/ IIL/IOH VI=0.45V/VO=0.45V –5 — –80 µA
logical 1 Output Current
[PORT 1, 2,3]
Logical 1 to 0 2
Transition Current ITL VI=2.0V — — –500 µA
[PORT 1, 2,3]
lnput Leakage Current ILI VSS<VI<VCC — — ±10 µA 3
[PORT 0 loating, EA]
RESET Pull-down RRST — 20 40 125 kΩ 2
Resistor
Pin Capacitance CIO Ta=25°C, f=1MHz — — 10 pF —
[except XTAL1]
Power Down Current IPD — — 1 50 µA 4
217
MSM80C154/83C154/85C154
VCC 4V 5V 6V
Freq.
1MHz 2.2 3.1 4.1
3MHz 3.7 5.2 7.0
12MHz 12.0 16.0 20.0
16MHz 16.0 20.0 25.0
20MHz 19.0 25.0 30.0
VCC 4.5V 5V 6V
Freq.
24MHz 25.0 29.0 35.0
VCC 4V 5V 6V
Freq.
1MHz 0.8 1.2 1.6
3MHz 1.2 1.7 2.3
12MHz 3.1 4.4 5.9
16MHz 3.8 5.5 7.3
20MHz 4.5 6.4 8.6
VCC 4.5V 5V 6V
Freq.
24MHz 6.4 7.4 9.8
218
ELECTRICAL CHARACTERISTICS
DC Characteristics 2
(VCC=2.2 to 4.0 V, VSS=0 V, Ta=-40 to +85°C)
Meas-
Parameter Symbol Condition Min. Typ. Max. Unit uring
circuit
Input Low Voltage VIL — –0.5 — 0.25 VCC–0.1 V
Except XTAL1, EA,
Input High Voltage VIH 0.25 VCC+0.9 — VCC+0.5 V
and RESET
Input High Voltage VIH1 XTAL1, RESET, and EA 0.6 VCC+0.6 — VCC+0.5 V
Output Low Voltage
VOL IOL=10 mA — — 0.1 V
(PORT 1, 2, 3)
Output Low Voltage
VOL1 IOL=20 mA — — 0.1 V
(PORT 0, ALE, PSEN)
1
Output High Voltage
VOH IOH=–5 mA 0.75 VCC — — V
Output High Voltage
(PORT 1, 2, 3)
VOH1 IOH=–20 mA 0.75 VCC — — V
(PORT 0, ALE, PSEN)
Logical 0 Input Current/ VI=0.1 V
Logical 1 Output Current/ IIL / IOH –5 — –40 mA
(PORT 1, 2, 3) VO=0.1 V
2
Logical 1 to 0 Transition
ITL VI=1.9 V — — –300 mA
Output Current (PORT 1, 2, 3)
Input Leakage Current
ILI VSS < VI < VCC — — ±10 mA 3
(PORT 0 floating, EA)
RESET Pull-down Resistance RRST — 20 40 125 kW 2
Ta=25°C, f=1 MHz
Pin Capacitance CIO — — 10 pF —
(except XTAL1)
Power Down Current IPD — — 1 10 mA 4
219
MSM80C154/83C154/85C154
Measuring circuits
1 2
OUTPUT
INPUT
INPUT
VIH Note
VIL 3
V A IO V A
VSS VSS
3 4
OUTPUT
INPUT
INPUT
VIH Note VIH Note
VIL 3 VIL 3
V A
VSS VSS
220
ELECTRICAL CHARACTERISTICS
*1 The variable check is from 0 to 24 MHz when the external check is used.
221
MSM80C154/83C154/85C154
tLHLL
ALE
tLLIV
tPLIV
PSEN
tPXAV
tPXIZ
tLLAX tAZPL tPXIX
tAVIV
222
ELECTRICAL CHARACTERISTICS
*1 The variable check is from 0 to 24 MHz when the external check is used.
*2 For 2.2£VCC<4 V
223
MSM80C154/83C154/85C154
tLHLL tWHLH
ALE
PSEN
tLLDV
tLLWL tRLRH
RD
tRHDZ
tAVLL tLLAX tRLDV tRHDX
tAZRL
PORT 0 INSTR A0~A7 A0~A7 DATA IN A0~A7
IN PCL RrorDPL PCL
tAVWL
tAVDV
PORT 2 PCH A8~A15 PCH P2.0~P2.7 DATA or A8~A15 PCH A8~A15 PCH
tLHLL tWHLH
ALE
PSEN
tLLWL tWLWH
WR
tLLAX tQVWH
tAVLL tWHQX
tQVWX
PORT 0 INSTR A0~A7 A0~A7 DATA IN A0~A7
IN PCL RrorDPL PCL
tAVWL
PORT 2 A8~A15 A8~A15 PCH P2.0~P2.7 DATA or A8~A15 PCH A8~A15 PCH
PCH
224
ELECTRICAL CHARACTERISTICS
225
MSM80C154/83C154/85C154
MACHINE CYCLE
ALE
tXLXL
SHIFT CLOCK
226
tQVXH tXHQX
OUTPUT DATA
tXHDV tXHDX
INPUT DATA VALID VALID VALID VALID VALID VALID VALID VALID
ELECTRICAL CHARACTERISTICS
1. Input/output signal
VOH VOH
VIH VIH
TEST POINT
VIL VIL
VOL VOL
* The input signals in AC test mode are either VOH (logic “1”) orVOL (logic “0”).
Timing measurements are made atVIH (logic “1”) and VIL (10gic “0”).
2. Floating
Floating
VOH VOH
VIH VIH
VIL VIL
VOL VOL
* The port 0 floating interval is measured from the time the port 0 pin Voltage drops below
VIH after sinking to GND at 2.4mA when switching to floating status from a “1” output, and
from the time the port 0 pin Voltage exceeds VIL after connecting to a 400µA source when
switching to floating status from a “0” output.
227
MSM80C154/83C154/85C154
VCC–0.5
EXTERMINAL 0.7VCC
OSCILLATOR 0.2VCC–0.1
0.45V
SIGNAL tCHCX tCHCX tCLCH
tCHCL
tCLCL
EXTERMINAL NC XTAL2
OSCILLATOR XTAL1
SIGNAL VSS
228
7. DESCRIPTION OF
INSTRUCTIONS
MSM80C154S/83C154S/85C154HVS
230
DESCRIPTION OF INSTRUCTIONS
7. DESCRIPTION OF INSTRUCTIONS
7.1 Outline
231
MSM80C154S/83C154S/85C154HVS
A Accumulator
AB Register pair
AC Auxiliary carry
B Arithmetic operation register
C Carry (the bit 7 carry represented by CY is changed to C in Chapter 7.)
DPTR Data pointer
PC Program counter
Rr Register representation (r=0/1, or r=0 thru 7)
SP Stack pointer
AND Logical AND
OR Logical OR
XOR Exclusive OR
+ Addition
– Subtraction
× Multiplication
/ Division
(X) Representation of the contents of X
((X)) Representation of the contents addressed by contents of X
# Symbol denoting immediate data
@ Symbol denoting indirect address
= Equal sign
≠ Not equal
← Substitution
→ Substitution
— Negation (upper bar)
< Smaller than
> Larger than
bit address RAM or special function register bit designated address
code address Absolute address (A0 thru A15, A0 thru A11)
data Immediate data (I0 thru I7)
relative offset Corrected relative jump address value
direct address RAM or special function register data designated address (“direct
address” representation changed to “data address” during
detailed description of instructions)
232
L 0 1 2 3 4 5 6 7 8 9 A B C D E F
H 0 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 1 1 0 0 0 1 0 0 1 1 0 1 0 1 0 1 1 1 1 0 0 1 1 0 1 1 1 1 0 1 1 1 1
0 AJMP LJMP
NOP address 11 RR A INC A INC direct INC @R0 INC @R1 INC R0 INC R1 INC R2 INC R3 INC R4 INC R5 INC R6 INC R7
0000 (Page 0) address 16
3 JNB bit, ACALL ADDC A, ADDC A, ADDC A, ADDC A, ADDC ADDC ADDC ADDC ADDC ADDC ADDC ADDC
address 11 RETI RLC A
0011 rel (Page 1) #data direct @R0 @R1 A, R0 A, R1 A, R2 A, R3 A, R4 A, R5 A, R6 A, R7
7.3 List of Instructions
7 ACALL ORL C, JMP MOV A, MOV MOV @R0, MOV @R1, MOV R0, MOV R1, MOV R2, MOV R3, MOV R4, MOV R5, MOV R6, MOV R7,
JNZ rel address 11 direct
233
0111 (Page 3) bit @A+DPTR #data , #data #data #data #data #data #data #data #data #data #data #data
MSM80C154S/MSM83C154S instruction table
8 SJMP AJMP ANL C, MOVC A, MOV MOV MOV MOV MOV MOV MOV MOV MOV MOV MOV
address 11 DIV AB direct 1, direct, direct, direct, direct, direct, direct, direct, direct, direct, direct,
1000 rel (Page 4) bit @A+PC direct 2 @R0 @R1 R0 R1 R2 R3 R4 R5 R6 R7
9 MOV ACALL MOV bit, MOVC A, SUBB A, SUBB A, SUBB A, SUBB A, SUBB A, SUBB A, SUBB A, SUBB A, SUBB A, SUBB A, SUBB A, SUBB A,
DPTR, address 11
1001 #data 16 (Page 4) C @A+DPTR #data direct @R0 @R1 R0 R1 R2 R3 R4 R5 R6 R7
A ORL AJMP MOV C, INC MOV @R0, MOV @R1, MOV R0, MOV R1, MOV R2, MOV R3, MOV R4, MOV R5, MOV R6, MOV R7,
address 11 MUL AB —
1010 C,/bit (Page 5) bit DPTR direct direct direct direct direct direct direct direct direct direct
B ANL ACALL CJNE A, CJNE A, CJNE@R0, CJNE@R1, CJNE R0, CJNE R1, CJNE R2, CJNE R3, CJNE R4, CJNE R5, CJNE R6, CJNE R7,
address 11 CPL bit CPL C
1011 C,/bit (Page 5) #data, rel direct, rel #data, rel #data, rel #data, rel #data, rel #data, rel #data, rel #data, rel #data, rel #data, rel #data, rel
D POP ACALL DJNZ XCHD A, XCHD A, DJNZ R0, DJNZ R1, DJNZ R2, DJNZ R3, DJNZ R4, DJNZ R5, DJNZ R6, DJNZ R7,
address 11 STEB bit STEB C DA A
1101 direct (Page 6) direct, rel @R0 @R1 rel rel rel rel rel rel rel rel
MSM80C154S/83C154S/85C154HVS
Classifi- Instruction code
cation
Mnemonic Byte Cycle Description Page
D7 D6 D5 D4 D3 D2 D1 D0
ADD A, Rr 0 0 1 0 1 r2 r1 r0 1 1 (AC),(OV),(C),(A)←(A)+(Rr) r=0~7 249
0 0 1 0 0 1 0 1
ADD A, direct 2 1 (AC),(OV),(C),(A)←(A)+(direct address) 250
a7 a6 a5 a4 a3 a2 a1 a0
ADD A, @Rr 0 0 1 0 0 1 1 r 1 1 (AC),(OV),(C),(A)←(A)+((Rr)) r=0 or 1 248
0 0 1 0 0 1 0 0
ADD A, #data 2 1 (AC),(OV),(C),(A)←(A)+#data 247
I7 I6 I5 I4 I3 I2 I1 I0
ADDC A, Rr 0 0 1 1 1 r2 r1 r0 1 1 (AC),(OV),(C),(A)←(A)+(C)+(Rr) r=0~7 253
0 0 1 1 0 1 0 1
ADDC A, direct 2 1 (AC),(OV),(C),(A)←(A)+(C)+(direct address) 254
a7 a6 a5 a4 a3 a2 a1 a0
Arithmetic operation instructions
RL A 0 0 1 0 0 0 1 1 1 1 349
Accumulator
C ← ← ← ← ← ← ← ←
7 0
Accumulator operation instructions
RLC A 0 0 1 1 0 0 1 1 1 1 350
Accumulator
C ← ← ← ← ← ← ← ←
235
7 0
RR A 0 0 0 0 0 0 1 1 1 1 351
DESCRIPTION OF INSTRUCTIONS
Accumulator
C ← ← ← ← ← ← ← ←
7 0
RRC A 0 0 0 1 0 0 1 1 1 1 352
Accumulator
C ← ← ← ← ← ← ← ←
7 0
SWAP A 1 1 0 0 0 1 0 0 1 1 →(A0~3)
(A4~7)← 361
MSM80C154S/83C154S/85C154HVS
Classifi- Instruction code
cation
Mnemonic Byte Cycle Description Page
D7 D6 D5 D4 D3 D2 D1 D0
INC A 0 0 0 0 0 1 0 0 1 1 (A)←(A)+1 290
Increment & decrement instructions
0 1 0 1 0 1 0 1
ANL A, direct 2 1 (A)←(A)AND(direct address) 259
a 7 a6 a5 a 4 a3 a 2 a1 a0
ANL A, @Rr 0 1 0 1 0 1 1 r 1 1 (A)←(A)AND((Rr)) r=0 or 1 257
Logical operation instructions
0 1 0 1 0 1 0 0
ANL A, #data 2 1 (A)←(A)AND#data 256
I7 I6 I5 I4 I3 I2 I1 I0
0 1 0 1 0 0 1 0
ANL direct, A 2 1 (direct address)←(direct address)AND(A) 263
a 7 a6 a5 a 4 a3 a 2 a1 a0
0 1 0 1 0 0 1 1
ANL direct,#data a7 a6 a5 a4 a3 a2 a1 a0 3 2 (direct address)←(direct address)AND#data 262
I7 I6 I5 I4 I3 I2 I1 I0
ORL A, Rr 0 1 0 0 1 r2 r1 r0 1 1 (A)←(A)OR(Rr) r=0~7 339
0 1 0 0 0 1 0 1
ORL A, direct 2 1 (A)←(A)OR(direct address) 340
a 7 a6 a5 a 4 a3 a 2 a1 a0
ORL A, @Rr 0 1 0 0 0 1 1 r 1 1 (A)←(A)OR((Rr)) r=0 or 1 338
Classifi- Instruction code
cation
Mnemonic Byte Cycle Description Page
D7 D6 D5 D4 D3 D2 D1 D0
0 1 0 0 0 1 0 0
ORL A, #data 2 1 (A)←(A)OR#data 337
I7 I6 I5 I4 I3 I2 I1 I0
0 1 0 0 0 0 1 0
ORL direct, A 2 1 (direct address)←(direct address)OR(A) 344
a7 a6 a5 a4 a3 a2 a1 a0
0 1 0 0 0 0 1 1
Logical operation instructions
DESCRIPTION OF INSTRUCTIONS
0 1 1 0 0 0 1 1
XRL direct,#data a7 a6 a5 a4 a3 a2 a1 a0 3 2 (direct address)←(direct address)XOR#data 370
I7 I6 I5 I4 I3 I2 I1 I0
0 1 1 1 0 1 0 0
MOV A, #data 2 1 (A)←#data 314
setting instructions
I7 I6 I5 I4 I3 I2 I1 I0
Immediate data
0 1 1 1 1 r2 r1 r0
MOV Rr, #data 2 1 (Rr)←#data r=0~7 320
I7 I6 I5 I4 I3 I2 I1 I0
0 1 1 1 0 1 0 1
MOV direct, #data a7 a6 a5 a4 a3 a2 a1 a0 3 2 (direct address)←#data 324
I7 I6 I5 I4 I3 I2 I1 I0
MSM80C154S/83C154S/85C154HVS
Classifi- Instruction code
cation
Mnemonic Byte Cycle Description Page
D7 D6 D5 D4 D3 D2 D1 D0
0 1 1 1 0 1 1 r
MOV @Rr, #data 2 1 ((Rr))←#data r=0 or 1 311
data setting
instructions
Immediate
I7 I6 I5 I4 I3 I2 I1 I0
1 0 0 1 0 0 0 0
MOV DPTR,
I15 I14 I13 I12 I11 I10 I9 I8 3 2 (DPTR)←#data 319
#data
I7 I6 I5 I4 I3 I2 I1 I0
CLR C 1 1 0 0 0 0 1 1 1 1 (C)←0 273
Carry flag operation instructions
0 1 1 1 0 0 1 0
ORL C, bit 2 2 (C)←(C)OR(bit address) 341
b7 b6 b5 b4 b3 b2 b1 b0
1 0 1 0 0 0 0 0
ORL C,/bit 2 2 (C)←(C)OR(bit address) 342
b7 b6 b5 b4 b3 b2 b1 b0
1 0 1 0 0 0 1 0
instructions
Bit transfer
Bit manipu-
b7 b6 b5 b4 b3 b2 b1 b0
1 1 0 0 0 0 1 0
CLR bit 2 1 (bit address)←0 274
b7 b6 b5 b4 b3 b2 b1 b0
Classifi- Instruction code
cation
Mnemonic Byte Cycle Description Page
D7 D6 D5 D4 D3 D2 D1 D0
instructions
Bit manipu- 1 0 1 1 0 0 1 0
lation
a7 a6 a5 a 4 a3 a2 a 1 a0
1 1 1 1 0 1 0 1
MOV direct, A 2 1 (direct address)←(A) 326
a 7 a6 a5 a 4 a3 a2 a 1 a0
239
1 0 0 0 1 r2 r1 r0
MOV direct, Rr 2 2 (direct address)←(Rr) r=0~7 327
a7 a6 a5 a 4 a3 a2 a 1 a0
1 0 0 0 0 1 0 1
DESCRIPTION OF INSTRUCTIONS
MOV direct1,
a72 a62 a52 a2 a32 a22 a12 a02 3 2 (direct address 1)←(direct address 2) 328
direct 2
a71 a61 a51 a41 a31 a21 a11 a01
1 0 0 0 0 1 1 r
MOV direct, @Rr 2 2 (direct address)←((Rr)) r=0 or 1 325
a 7 a6 a5 a 4 a3 a2 a 1 a0
MOV @Rr, A 1 1 1 1 0 1 1 r 1 1 ((Rr))←(A) r=0 or 1 312
1 0 1 0 0 1 1 r
MOV @Rr, direct 2 2 ((Rr))←(direct address) r=0 or 1 313
a 7 a6 a5 a 4 a3 a2 a 1 a0
instructions
(PC)←(PC)+1
MOVC A, @A+PC 1 0 0 0 0 0 1 1 1 2 330
(A)←((A)+(PC))
MSM80C154S/83C154S/85C154HVS
Classifi- Instruction code
cation
Mnemonic Byte Cycle Description Page
D7 D6 D5 D4 D3 D2 D1 D0
XCH A, Rr 0 0 0 1 1 r2 r1 r0 1 1 (A)→
←(Rr) r=0~7 363
Data exchange
instructions
1 1 0 0 0 1 0 1
XCH A, direct 2 1 (A)→
←(direct address) 364
a7 a6 a5 a4 a3 a2 a1 a0
XCH A, @Rr 1 1 0 0 0 1 1 r 1 1 (A)→
←((Rr)) r=0 or 1 362
XCHD A, @Rr 1 1 0 1 0 1 1 r 1 1 (A0~3)→
←((Rr0~3)) r=0 or 1 365
1 1 0 0 0 0 0 0 (SP)←(SP)+1
PUSH direct 2 2 346
a7 a6 a5 a4 a3 a2 a1 a0 ((SP))←(direct address)
1 1 0 1 0 0 0 0 (direct address)←((SP))
POP direct 2 2 345
a7 a6 a5 a4 a3 a2 a1 a0 (SP)←(SP)–1
ACALL addr 11 A10 A9 A8 1 0 0 0 1 2 2 (PC)←(PC)+2 246
A7 A6 A5 A4 A3 A2 A1 A0 (SP)←(SP)+1
((SP))←(PC0~7)
240
Subroutine instructions
(SP)←(SP)+1
((SP))←(PC8~15)
(PC0~10)←A0~10
LCALL addr 16 0 0 0 1 0 0 1 0 3 2 (PC)←(PC)+3 309
A15 A14 A13 A12 A11 A10 A9 A8 (SP)←(SP)+1
A7 A6 A5 A4 A3 A2 A1 A0 ((SP))←(PC0~7)
(SP)←(SP)+1
((SP))←(PC8~15)
(PC0~15)←A0~15
RET 0 0 1 0 0 0 1 0 1 2 (PC8~15)←((SP)) 347
(SP)←(SP)–1
(PC0~7)←((SP))
(SP)←(SP)–1
Classifi- Instruction code
cation
Mnemonic Byte Cycle Description Page
D7 D6 D5 D4 D3 D2 D1 D0
RETI 0 0 1 1 0 0 1 0 1 2 (PC8~15)←((SP)) 348
instructions
Subroutine
(SP)←(SP)–1
(PC0~7)←((SP))
(SP)←(SP)–1
*INTERRUPT ENABLE
A10 A9 A8 0 0 0 0 1 (PC)←(PC)+2
AJMP addr 11 2 2 255
A7 A6 A5 A4 A3 A2 A1 A0 (PC0~10)←A0~10
Jump instructions
0 0 0 0 0 0 1 0
LJMP addr 16 A15 A14 A13 A12 A11 A10 A9 A8 3 2 (PC0~15)←A0~15 310
A7 A6 A5 A4 A3 A2 A1 A0
1 0 0 0 0 0 0 0 (PC)←(PC)+2
SJMP rel 2 2 355
R7 R6 R5 R4 R3 R2 R1 R0 (PC)←(PC)+relative offset
241
DESCRIPTION OF INSTRUCTIONS
R7 R6 R5 R4 R3 R2 R1 R0 THEN
(PC)←(PC)+relative offset
IF (A)<(direct address)
THEN
(C)←1
ELSE
(C)←0
MSM80C154S/83C154S/85C154HVS
Classifi- Instruction code
cation
Mnemonic Byte Cycle Description Page
D7 D6 D5 D4 D3 D2 D1 D0
CJNE A, #data, rel 1 0 1 1 0 1 0 0 3 2 (PC)←(PC)+3 266
I7 I6 I5 I4 I3 I2 I1 I0 IF (A)≠#data
R7 R6 R5 R4 R3 R2 R1 R0 THEN
(PC)←(PC)+relative offset
IF (A)<#data
THEN
Branching instructions
(C)←1
ELSE
(C)←0
CJNE Rr,#data,rel 1 0 1 1 1 r2 r1 r0 3 2 (PC)←(PC)+3 270
I7 I6 I5 I4 I3 I2 I1 I0 IF (Rr)≠#data r=0~7
R7 R6 R5 R4 R3 R2 R1 R0 THEN
242
(PC)←(PC)+relative offset
IF (A)<#data r=0~7
THEN
(C)←1
ELSE
(C)←0
Classifi- Instruction code
cation
Mnemonic Byte Cycle Description Page
D7 D6 D5 D4 D3 D2 D1 D0
CJNE @Rr, #data, 1 0 1 1 0 1 1 r 3 2 (PC)←(PC)+3 264
rel I7 I6 I5 I4 I3 I2 I1 I0 IF ((Rr))≠#data r=0 or 1
R7 R6 R5 R4 R3 R2 R1 R0 THEN
(PC)←(PC)+relative offset
IF ((Rr))<#data r=0 or 1
THEN
(C)←1
ELSE
(C)←0
Branching instructions
THEN
(PC)←(PC)+relative offset
DJNZ direct, rel 1 1 0 1 0 1 0 1 3 2 (PC)←(PC)+3 287
DESCRIPTION OF INSTRUCTIONS
a7 a6 a5 a4 a3 a2 a1 a0 (direct address)←(direct address)–1
R7 R6 R5 R4 R3 R2 R1 R0 IF (direct address)≠0
THEN
(PC)←(PC)+relative offset
JZ rel 0 1 1 0 0 0 0 0 2 2 (PC)←(PC)+2 307
R7 R6 R5 R4 R3 R2 R1 R0 IF (A)=0
THEN
(PC)←(PC)+relative offset
MSM80C154S/83C154S/85C154HVS
Classifi- Instruction code
cation
Mnemonic Byte Cycle Description Page
D7 D6 D5 D4 D3 D2 D1 D0
JNZ rel 0 1 1 1 0 0 0 0 2 2 (PC)←(PC)+2 305
R7 R6 R5 R4 R3 R2 R1 R0 IF (A)≠0
THEN
(PC)←(PC)+relative offset
JC rel 0 1 0 0 0 0 0 0 2 2 (PC)←(PC)+2 298
R7 R6 R5 R4 R3 R2 R1 R0 IF (C)=1
THEN
(PC)←(PC)+relative offset
JNC rel 0 1 0 1 0 0 0 0 2 2 (PC)←(PC)+2 303
R7 R6 R5 R4 R3 R2 R1 R0 IF (C)=0
Branching instructions
THEN
(PC)←(PC)+relative offset
244
DESCRIPTION OF INSTRUCTIONS
Other instruction
MSM80C154S/83C154S/85C154HVS
7 0
Call address A7 A6 A5 A4 A3 A2 A1 A0 Byte 2
Operations : (PC)←(PC)+2
(SP)←(SP)+1
((SP))←(PC0~7)
(SP)←(SP)+1
((SP))←(PC8~15)
(PC0~10)←A0~10
Number of bytes :2
Number of cycles :2
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : This instruction stores the program counter value (return
address) in the stack following an increment operation.
The program counter data PC0~10 following PC+2 is replaced
by 11-bit page address data A0~10. The destination address for
this instruction must always be within the 2K byte page, but if
the instruction is placed at address X7FEH or X7FFH, execution
proceeds from the call address on the next page.
246
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 0 0 1 0 0 1 0 0 Byte 1
7 0
#data I7 I6 I5 I4 I3 I2 I1 I0 Byte 2
Operation : (A)←(A)+#data
Number of bytes :2
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) • • • •
Description : An 8-bit immediate data value is added to the accumulator. The
result is placed in the accumulator, and the flags are updated.
7 0
Instruction code : 0 0 1 0 0 1 0 0 Byte 1
7 0
0 0 0 0 0 1 1 1 Byte 2
247
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 0 0 1 0 0 1 1 r Byte 1
Operation : (A)←(A)+((Rr)) r=0 or 1
Number of bytes :1
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) • • • •
Description : The data memory location contents addressed by the register r
contents are added to the accumulator. The result is placed in
the accumulator, and the flags are updated.
Example ADD A, @R0
7 0
Instruction code : 0 0 1 0 0 1 1 0 Byte 1
248
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 0 0 1 0 1 r2 r1 r0 Byte 1
Operation : (A)←(A)+(Rr) r=0 thru 7
Number of bytes :1
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) • • • •
Description : The register r contents are added to the accumulator. The result
is placed in the accumulator, and the flags are updated.
Example ADD A, R6
7 0
Instruction code : 0 0 1 0 1 1 1 0 Byte 1
249
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 0 0 1 0 0 1 0 1 Byte 1
7 0
Data address a7 a6 a5 a4 a3 a2 a1 a0 Byte 2
Operation : (A)←(A)+(data address)
Number of bytes :2
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) • • • •
Description : The specified data address contents are added to the
accumulator. The result is placed in the accumulator, and the
flags are updated.
Example ADD A, P1
7 0
Instruction code : 0 0 1 0 0 1 0 1 Byte 1
7 0
1 0 0 1 0 0 0 0 Byte 2
250
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 0 0 1 1 0 1 0 0 Byte 1
7 0
#data I7 I6 I5 I4 I3 I2 I1 I0 Byte 2
Operation : (A)←(A)+(C)+#data
Number of bytes :2
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) • • • •
Description : The carry flag is added to the accumulator, and an 8-bit
immediate data is added to that result. The result is placed in
the accumulator, and the flags are updated.
Example ADDC A, #76H
7 0
Instruction code : 0 0 1 1 0 1 0 0 Byte 1
7 0
0 1 1 1 0 1 1 0 Byte 2
251
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 0 0 1 1 0 1 1 r Byte 1
Operation : (A)←(A)+(C)+((Rr)) r=0 or 1
Number of bytes :1
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) • • • •
Description : The carry flag is added to the accumulator, and the contents of
data memory location addressed by the register r contents are
added to the accumulator. The result is placed in the
accumulator, and the flags are updated.
7 0
Instruction code : 0 0 1 1 0 1 1 0 Byte 1
252
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 0 0 1 1 1 r2 r1 r0 Byte 1
Operation : (A)←(A)+(C)+(Rr) r=0 thru 7
Number of bytes :1
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) • • • •
Description : The carry flag is added to the accumulator,and the register r
contents are added to the result. The result is placed in the
accumulator, and the flags are updated.
Example ADDC A, R2
7 0
Instruction code : 0 0 1 1 1 0 1 0 Byte 1
253
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 0 0 1 1 0 1 0 1 Byte 1
7 0
Data address a7 a6 a5 a4 a3 a2 a1 a0 Byte 2
Operation : (A)←(A)+(C)+(data address)
Number of bytes :2
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) • • • •
Description : The carry flag is added to the accumulator,and the specified
data address contents are added to that result. The result is
placed in the accumulator, and the flags are updated.
Example ADDC A, 45H
7 0
Instruction code : 0 0 1 1 0 1 0 1 Byte 1
7 0
0 1 0 0 0 1 0 1 Byte 2
254
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : A10 A9 A8 0 0 0 0 1 Byte 1
7 0
Call address A7 A6 A5 A4 A3 A2 A1 A0 Byte 2
Operations : (PC)←(PC)+2
(PC0~10)←A0~10
Number of bytes :2
Number of cycles :2
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : After an increment ,the program counter PC0~10 is replaced by
11-bit page address data A0~10. The destination address for
this instruction must always be within the 2K byte page, but if
the instruction is placed at address X7FEH or X7FFH, execution
proceeds from the jump address on the next page.
255
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 0 1 0 1 0 1 0 0 Byte 1
7 0
#data I7 I6 I5 I4 I3 I2 I1 I0 Byte 2
Operation : (A)←(A) AND #data
Number of bytes :2
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) •
Description : The logical AND between an 8-bit immediate data value and the
accumulator contents is determined. The result is placed in the
accumulator and the flag is updated.
Example ANL A, #0AH
7 0
Instruction code : 0 1 0 1 0 1 0 0 Byte 1
7 0
0 0 0 0 1 0 1 0 Byte 2
256
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 0 1 0 1 0 1 1 r Byte 1
Operation : (A)←(A) AND ((Rr)) r=0 or 1
Number of bytes :1
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) •
Description : The logical AND between the accumulator contents and the
data memory location contents addressed by the register r
contents is determined. The result is placed in the accumulator
and the flag is updated.
7 0
Instruction code : 0 1 0 1 0 1 1 0 Byte 1
257
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 0 1 0 1 1 r2 r1 r0 Byte 1
Operation : (A)←(A) AND (Rr) r=0 thru 7
Number of bytes :1
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) •
Description : The logical AND between the accumulator contents and the
register r contents is determined. The result is placed in the
accumulator and the flag is updated.
Example ANL A, R5
7 0
Instruction code : 0 1 0 1 1 1 0 1 Byte 1
258
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 0 1 0 1 0 1 0 1 Byte 1
7 0
Data address a7 a6 a5 a4 a3 a2 a1 a0 Byte 2
Operation : (A)←(A) AND (data address)
Number of bytes :2
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) •
Description : The logical AND between the accumulator contents and the
specified data address contents is determined. The result is
placed in the accumulator and the flag is updated.
Example ANL A, P1
7 0
Instruction code : 0 1 0 1 0 1 0 1 Byte 1
7 0
1 0 0 1 0 0 0 0 Byte 2
259
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 1 0 0 0 0 0 1 0 Byte 1
7 0
Bit address b7 b6 b5 b4 b3 b2 b1 b0 Byte 2
Operation : (C)←(C) AND (bit address)
Number of bytes :2
Number of cycles :2
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) •
Description : The logical AND between the carry flag and the specified bit
address contents is determined. The result is placed in the carry
flag.
Example ANL C, ACC.5
7 0
Instruction code : 1 0 0 0 0 0 1 0 Byte 1
7 0
1 1 1 0 0 1 0 1 Byte 2
Accumulator Accumulator
1 0 0 1 1 0 1 0 1 0 0 1 1 0 1 0
7 5 0 7 5 0
260
DESCRIPTION OF INSTRUCTIONS
16. ANL C,/bit address (Logical AND complement bit to carry flag)
7 0
Instruction code : 1 0 1 1 0 0 0 0 Byte 1
7 0
Bit address b7 b6 b5 b4 b3 b2 b1 b0 Byte 2
Operation : (C)←(C) AND (bit address)
Number of bytes :2
Number of cycles :2
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) •
Description : The logical AND between the carry flag and the complement of
specified bit address contents is determined. The result is
placed in the carry flag.
Example ANL C,/P1.3
7 0
Instruction code : 1 0 1 1 0 0 0 0 Byte 1
7 0
1 0 0 1 0 0 1 1 Byte 2
Port 1 Port 1
0 0 0 0 1 0 1 0 0 0 0 0 1 0 1 0
7 3 0 7 3 0
261
MSM80C154S/83C154S/85C154HVS
17. ANL data address, #data (Logical AND immediate data to memory)
7 0
Instruction code : 0 1 0 1 0 0 1 1 Byte 1
7 0
Data address a7 a6 a5 a4 a3 a2 a1 a0 Byte 2
7 0
#data I7 I6 I5 I4 I3 I2 I1 I0 Byte 3
Operation : (data address)←(data address) AND #data
Number of bytes :3
Number of cycles :2
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : The logical AND between an 8-bit immediate data value and the
specified data address contents is determined. The result is
placed in the specified data address.
Example ANL DPH, #0AAH
7 0
Instruction code : 0 1 0 1 0 0 1 1 Byte 1
7 0
1 0 0 0 0 0 1 1 Byte 2
7 0
1 0 1 0 1 0 1 0 Byte 3
262
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 0 1 0 1 0 0 1 0 Byte 1
7 0
Data address a7 a6 a5 a4 a3 a2 a1 a0 Byte 2
Operation : (data address)←(data address) AND (A)
Number of bytes :2
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : The logical AND between the accumulator and the specified
data address contents is determined. The result is placed in the
specified data address.
Example ANL TCON, A
7 0
Instruction code : 0 1 0 1 0 0 1 0 Byte 1
7 0
1 0 0 0 1 0 0 0 Byte 2
263
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 1 0 1 1 0 1 1 r Byte 1
7 0
#data I7 I6 I5 I4 I3 I2 I1 I0 Byte 2
7 0
Relative offset R7 R6 R5 R4 R3 R2 R1 R0 Byte 3
Operations : (PC)←(PC)+3
IF ((Rr))≠#data r=0 or 1
THEN
(PC)←(PC)+relative offset
IF ((Rr))<#data r=0 or 1
THEN
(C)←1
ELSE
(C)←0
Number of bytes :3
Number of cycles :2
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) •
Description : The data memory location contents addressed by the register r
contents are compared with an immediate data value. Control is
shifted to a relative jump address if the compared data is not
equal. If the compared data is equal, control is shifted to the
next address following this instruction. The carry flag is set to 1
if the immediate data value is greater than the specified address
contents, but is set to 0 if otherwise.
264
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 1 0 1 1 0 1 1 1 Byte 1
7 0
0 0 0 0 0 1 0 1 Byte 2
7 0
1 0 0 1 1 0 0 1 Byte 3
265
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 1 0 1 1 0 1 0 0 Byte 1
7 0
#data I7 I6 I5 I4 I3 I2 I1 I0 Byte 2
7 0
Relative offset R7 R6 R5 R4 R3 R2 R1 R0 Byte 3
Operations : (PC)←(PC)+3
IF (A)≠#data
THEN
(PC)←(PC)+relative offset
IF (A)<#data
THEN
(C)←1
ELSE
(C)←0
Number of bytes :3
Number of cycles :2
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) •
Description : The accumulator contents are compared with an immediate
data value, and control is shifted to a relative jump address if
the compared data is not equal. If the compared data is equal,
control is shifted to the next address following this instruction.
The carry flag is set to 1 if the immediate data value is greater
than the accumulator contents, but is set to 0 if otherwise.
266
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 1 0 1 1 0 1 0 0 Byte 1
7 0
0 0 0 0 1 0 1 0 Byte 2
7 0
1 0 0 1 1 0 0 1 Byte 3
267
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 1 0 1 1 0 1 0 1 Byte 1
7 0
Data address a7 a6 a5 a4 a3 a2 a1 a0 Byte 2
7 0
Relative offset R7 R6 R5 R4 R3 R2 R1 R0 Byte 3
Operations : (PC)←(PC)+3
IF (A)≠(data address)
THEN
(PC)←(PC)+relative offset
IF (A)<(data address)
THEN
(C)←1
ELSE
(C)←0
Number of bytes :3
Number of cycles :2
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) •
Description : The accumulator contents are compared with the specified data
address contents, and control is shifted to a relative jump
address if the compared data is not equal. If the compared data
is equal, control is shifted to the next address following this
instruction. The carry flag is set to 1 if the specified data
address contents are greater than the accumulator contents,
but is set to 0 if otherwise.
268
DESCRIPTION OF INSTRUCTIONS
1123 14 NEXT:DEC A
7 0
Instruction code : 1 0 1 1 0 1 0 1 Byte 1
7 0
0 1 0 1 0 0 0 0 Byte 2
7 0
0 1 0 0 0 1 0 0 Byte 3
269
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 1 0 1 1 1 r2 r1 r0 Byte 1
7 0
#data I7 I6 I5 I4 I3 I2 I1 I0 Byte 2
7 0
Relative offset R7 R6 R5 R4 R3 R2 R1 R0 Byte 3
Operations : (PC)←(PC)+3
IF ((Rr))≠#data r=0 thru 7
THEN
(PC)←(PC)+relative offset
IF ((Rr))<#data r=0 thru 7
THEN
(C)←1
ELSE
(C)←0
Number of bytes :3
Number of cycles :2
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) •
Description : The register r contents are compared with an immediate data
value, and control is shifted to a relative jump address if the
compared data is not equal. If the compared data is equal,
control is shifted to the next address following this instruction.
The carry flag is set to 1 if the immediate data value is greater
than the register r contents, but is set to 0 if otherwise.
270
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 1 0 1 1 1 1 0 0 Byte 1
7 0
0 0 1 1 0 0 1 0 Byte 2
7 0
1 1 1 0 1 1 1 0 Byte 3
271
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 1 1 1 0 0 1 0 0 Byte 1
Operation : (A)←0
Number of bytes :1
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) •
Description : The accumulator is cleared to 0 and flag is updated.
Example CLR A
7 0
Instruction code : 1 1 1 0 0 1 0 0 Byte 1
272
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 1 1 0 0 0 0 1 1 Byte 1
Operation : (C)←0
Number of bytes :1
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) •
Description : The carry flag is cleared to 0.
Example CLR C
7 0
Instruction code : 1 1 0 0 0 0 1 1 Byte 1
273
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 1 1 0 0 0 0 1 0 Byte 1
7 0
Bit address b7 b6 b5 b4 b3 b2 b1 b0 Byte 2
Operation : (bit address)←0
Number of bytes :2
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : The specified bit address content is cleared to 0.
Example CLR P1.5
7 0
Instruction code : 1 0 0 0 0 0 1 0 Byte 1
7 0
1 1 1 0 0 1 0 1 Byte 2
274
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 1 1 1 1 0 1 0 0 Byte 1
Operation : (A)←(A)
Number of bytes :1
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : Accumulator data 0 is set to 1 and 1 is set to 0.
Example CPL A
7 0
Instruction code : 1 1 1 1 0 1 0 0 Byte 1
275
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 1 0 1 1 0 0 1 1 Byte 1
Operation : (C)←(C)
Number of bytes :1
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) •
Description : The carry flag is set to 1 if 0, set to 0 if 1.
Example CPL C
7 0
Instruction code : 1 0 1 1 0 0 1 1 Byte 1
276
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 1 0 1 1 0 0 1 0 Byte 1
7 0
Bit address b7 b6 b5 b4 b3 b2 b1 b0 Byte 2
Operation : (bit address)←(bit address)
Number of bytes :2
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : The specified bit address content is set to 1 if 0, and set to 0 if 1.
7 0
Instruction code : 1 0 1 1 0 0 1 0 Byte 1
7 0
1 1 1 1 0 1 1 1 Byte 2
277
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 1 1 0 1 0 1 0 0 Byte 1
Operations : 100+6←(AC)=1 or 100>10
101+6
(C)←1 }
←(C)=1 or 101>10
Number of bytes :1
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) • •
Description : The arithmetic operation result located in the accumulator
following an addition between two 2-digit decimal number is
converted to a normal decimal number. When the contents of
accumulator bits 0 thru 3 (100 digit) are greater than 9, or when
the auxiliary carry (AC) is 1, 6 is added to accumulator bits 0
thru 3. And if the contents of accumulator bits 4 thru 7 (101 digit)
exceed 9, or if the result obtained by adding a carry from the
lower order digits after compensation is greater than 9, or if the
carry flag is 1, 6 is added to the data in accumulator bits 4 thru
7. The flags are also updated.
278
DESCRIPTION OF INSTRUCTIONS
Example DA A
7 0
Instruction code : 1 1 0 1 0 1 0 0 Byte 1
279
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 0 0 0 1 0 1 1 r Byte 1
Operation : ((Rr))←((Rr))–1 r=0 or 1
Number of bytes :1
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : The contents of the data memory location addressed by the
register r contents are decremented by 1.
7 0
Instruction code : 0 0 0 1 0 1 1 0 Byte 1
280
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 0 0 0 1 0 1 0 0 Byte 1
Operation : (A)←(A)–1
Number of bytes :1
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) •
Description : The accumulator contents are decremented by 1, and the flag is
updated.
Example DEC A
7 0
Instruction code : 0 0 0 1 0 1 0 0 Byte 1
281
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 0 0 0 1 1 r2 r1 r0 Byte 1
Operation : (Rr)←(Rr)–1 r=0 thru 7
Number of bytes :1
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : The register r contents are decremented by 1.
Example DEC R7
7 0
Instruction code : 0 0 0 1 1 1 1 1 Byte 1
282
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 0 0 0 1 0 1 0 1 Byte 1
7 0
Data address a7 a6 a5 a4 a3 a2 a1 a0 Byte 2
Operation : (data address)←(data address)–1
Number of bytes :2
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : The specified data address contents are decremented by 1.
Example DEC 5AH
7 0
Instruction code : 0 0 0 1 0 1 0 1 Byte 1
7 0
0 1 0 1 1 0 1 0 Byte 2
283
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 1 0 0 0 0 1 0 0 Byte 1
Operation : (A) quotient←(A)/(B)
(B) remainder
Number of bytes :1
Number of cycles :4
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) • • •
Description : The accumulator contents are devided by the contents of
arithmetic operation register (B). The two data values are
handled as integers without sign. The quotient is placed in the
accumulator, and the remainder in the arithmetic operation
register (B). The carry flag is always cleared, and the overflow
flag (OV) is set to 1 if division by 0 is executed. This flag is
cleared in all other cases. If division by 0 is executed, the
accumulator and arithmetic operation register (B) contents
remain unchanged.
Example DIV AB(0AEH÷7H=18…………remainder 6H)
7 0
Instruction code : 1 0 0 0 0 1 0 0 Byte 1
284
DESCRIPTION OF INSTRUCTIONS
35. DJNZ Rr, code address (Decrement register, and jump if not zero)
7 0
Instruction code : 1 1 0 1 1 r2 r1 r0 Byte 1
7 0
Relative offset R7 R6 R5 R4 R3 R2 R1 R0 Byte 2
Operations : (PC)←(PC)+2
(Rr)←(Rr)–1 r=0 thru 7
IF (Rr)≠0
THEN
(PC)←(PC)+relative offset
Number of bytes :2
Number of cycles :2
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : The register r contents are decremented by 1. Control is shifted
to a relative jump address if the register r contents are not 0 as
a result of the decrement. Control is shifted to the next address
following this instruction if the result is 0.
285
MSM80C154S/83C154S/85C154HVS
00FE 2F LOOP:ADD A, R7
7 0
Instruction code : 1 1 0 1 1 0 0 1 Byte 1
7 0
1 1 1 1 0 0 0 1 Byte 2
286
DESCRIPTION OF INSTRUCTIONS
36. DJNZ data address, code address (Decrement memory, and jump if not zero)
7 0
Instruction code : 1 1 0 1 0 1 0 1 Byte 1
7 0
Data address a7 a6 a5 a4 a3 a2 a1 a0 Byte 2
7 0
Relative offset R7 R6 R5 R4 R3 R2 R1 R0 Byte 3
Operations : (PC)←(PC)+3
(data address)←(data address)–1
IF (data address)≠0
THEN
(PC)←(PC)+relative offset
Number of bytes :3
Number of cycles :2
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : The specified data address contents are decremented by 1.
Control is shifted to a relative jump address if data address
contents are not 0 as a result of the decrement. Control is
shifted to the next address following this instruction if the result
is 0.
287
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 1 1 0 1 0 1 0 1 Byte 1
7 0
0 1 0 1 0 1 1 1 Byte 2
7 0
1 0 0 1 1 0 1 1 Byte 3
288
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 0 0 0 0 0 1 1 r Byte 1
Operation : ((Rr))←((Rr))+1 r=0 or 1
Number of bytes :1
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : The contents of the data memory location addressed by the
register r contents are incremented by 1.
7 0
Instruction code : 0 0 0 0 0 1 1 1 Byte 1
289
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 0 0 0 0 0 1 0 0 Byte 1
Operation : (A)←(A)+1
Number of bytes :1
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) •
Description : The accumulator contents are incremented by 1, and the flag is
updated.
Example INC A
7 0
Instruction code : 0 0 0 0 0 1 0 0 Byte 1
290
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 1 0 1 0 0 0 1 1 Byte 1
Operation : (DPTR)←(DPTR)+1
Number of bytes :1
Number of cycles :2
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : 16-bit contents od the data pointer (DPH·DPL) are incremented
by 1.
7 0
Instruction code : 1 0 1 0 0 0 1 1 Byte 1
Before execution
DPH DPL
0 1 1 0 1 0 0 0 1 1 1 1 1 1 1 1
15 8 7 0
After execution
DPH DPL
0 1 1 0 1 0 0 1 0 0 0 0 0 0 0 0
15 8 7 0
291
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 0 0 0 0 1 r2 r1 r0 Byte 1
Operation : (Rr)←(Rr)+1 r=0 thru 7
Number of bytes :1
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : The register r contents are incremented by 1.
Example INC R5
7 0
Instruction code : 0 0 0 0 1 1 0 1 Byte 1
292
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 0 0 0 0 0 1 0 1 Byte 1
7 0
Data address a7 a6 a5 a4 a3 a2 a1 a0 Byte 2
Operation : (data address)←(data address)+1
Number of bytes :2
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : The specified data address contents are incremented by 1.
Example INC P1
7 0
Instruction code : 0 0 0 0 0 1 0 1 Byte 1
7 0
Data address : 1 0 0 1 0 0 0 0 Byte 2
293
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 0 0 1 0 0 0 0 0 Byte 1
7 0
Bit address b7 b6 b5 b4 b3 b2 b1 b0 Byte 2
7 0
Relative offset R7 R6 R5 R4 R3 R2 R1 R0 Byte 3
Operations : (PC)←(PC)+3
IF (bit address)=1
THEN
(PC)←(PC)+relative offset
Number of bytes :3
Number of cycles :2
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : Control is shifted to a relative jump address if the specified bit
address content is 1.
Control is shifted to the next address following this instruction if
the content is 0.
294
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 0 0 1 0 0 0 0 0 Byte 1
7 0
0 0 0 1 0 0 1 1 Byte 2
7 0
0 1 0 0 1 0 1 0 Byte 3
295
MSM80C154S/83C154S/85C154HVS
43. JBC bit address, code address (Jump and clear if bit is set)
7 0
Instruction code : 0 0 0 1 0 0 0 0 Byte 1
7 0
Bit address b7 b6 b5 b4 b3 b2 b1 b0 Byte 2
7 0
Relative offset R7 R6 R5 R4 R3 R2 R1 R0 Byte 3
Operations : (PC)←(PC)+3
IF (bit address)=1
THEN
(bit address)←0
(PC)←(PC)+relative offset
Number of bytes :3
Number of cycles :2
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : Control is shifted to a relative jump address if the specified bit
address content is 1, and that bit is cleared to 0.
Control is shifted to the next address following this instruction if
the content is 0.
296
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 0 0 0 1 0 0 0 0 Byte 1
7 0
0 1 1 1 0 0 0 1 Byte 2
7 0
1 0 1 0 0 0 1 1 Byte 3
297
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 0 1 0 0 0 0 0 0 Byte 1
7 0
Relative offset R7 R6 R5 R4 R3 R2 R1 R0 Byte 2
Operations : (PC)←(PC)+2
IF (C)=1
THEN
(PC)←(PC)+relative offset
Number of bytes :2
Number of cycles :2
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : Control is shifted to a relative jump address if the carry flag is 1.
Control is shifted to the next address following this instruction if
the content is 0.
298
DESCRIPTION OF INSTRUCTIONS
Example JC CARRY
LOC OBJ SOURCE
7 0
Instruction code : 0 1 0 0 0 0 0 0 Byte 1
7 0
0 0 0 1 0 1 0 1 Byte 2
299
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 0 1 1 1 0 0 1 1 Byte 1
Operation : (PC)←(A)+(DPTR)
Number of bytes :1
Number of cycles :2
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : The accumulator contents are added to the data pointer con-
tents, and the resulting sum is placed in the program counter.
7 0
Instruction code : 0 1 1 1 0 0 1 1 Byte 1
300
DESCRIPTION OF INSTRUCTIONS
46. JNB bit address, code address (Jump if bit is not set)
7 0
Instruction code : 0 0 1 1 0 0 0 0 Byte 1
7 0
Bit address b7 b6 b5 b4 b3 b2 b1 b0 Byte 2
7 0
Relative offset R7 R6 R5 R4 R3 R2 R1 R0 Byte 3
Operations : (PC)←(PC)+3
IF (bit address)=0
THEN
(PC)←(PC)+relative offset
Number of bytes :3
Number of cycles :2
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : Control is shifted to a relative jump address if the specified bit
address content is 0, but shifted to the next address following
this instruction if the content is 1.
301
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 0 0 1 1 0 0 0 0 Byte 1
7 0
0 0 1 0 1 0 1 1 Byte 2
7 0
0 0 1 0 0 0 1 0 Byte 3
302
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 0 1 0 1 0 0 0 0 Byte 1
7 0
Relative offset R7 R6 R5 R4 R3 R2 R1 R0 Byte 2
Operations : (PC)←(PC)+2
IF (C)=0
THEN
(PC)←(PC)+relative offset
Number of bytes :2
Number of cycles :2
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : Control is shifted to a relative jump address if the carry flag is 0.
Control is shifted to the next address following this instruction if
the content is 1.
303
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 0 1 0 1 0 0 0 0 Byte 1
7 0
0 0 1 0 0 0 1 0 Byte 2
304
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 0 1 1 1 0 0 0 0 Byte 1
7 0
Relative offset R7 R6 R5 R4 R3 R2 R1 R0 Byte 2
Operations : (PC)←(PC)+2
IF (A)≠0
THEN
(PC)←(PC)+relative offset
Number of bytes :2
Number of cycles :2
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : Control is shifted to a relative jump address if the accumulator
contents are not 0. Control is shifted to the next address
following this instruction if the contents are 0.
305
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 0 1 1 1 0 0 0 0 Byte 1
7 0
0 0 1 1 0 0 0 0 Byte 2
306
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 0 1 1 0 0 0 0 0 Byte 1
7 0
Relative offset R7 R6 R5 R4 R3 R2 R1 R0 Byte 2
Operations : (PC)←(PC)+2
IF (A)=0
THEN
(PC)←(PC)+relative offset
Number of bytes :2
Number of cycles :2
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : Control is shifted to a relative jump address if the accumulator
contents are 0. Control is shifted to the next address following
this instruction if the contents are not 0.
307
MSM80C154S/83C154S/85C154HVS
Example JZ EMPTY
LOC OBJ SOURCE
0099 04 EMPTY:INC A
7 0
Instruction code : 0 1 1 0 0 0 0 0 Byte 1
7 0
1 1 0 0 1 1 0 1 Byte 2
308
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 0 0 0 1 0 0 1 0 Byte 1
7 0
Call address A15 A14 A13 A12 A11 A10 A9 A8 Byte 2
7 0
Call address A7 A6 A5 A4 A3 A2 A1 A0 Byte 3
Operations : (PC)←(PC)+3
(SP)←(SP)+1
((SP))←(PC0~7)
(SP)←(SP)+1
((SP))←(PC8~15)
(PC0~15)←A0~15
Number of bytes :3
Number of cycles :2
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : The contents of the program counter (return address) are
pushed in the stack following an increment.
Call address A0~15 specified by operand are placed in the
program counter PC0~15.
This instruction is capable of call to anywhere within the entire
range of 64K words.
309
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 0 0 0 0 0 0 1 0 Byte 1
7 0
Jump address A15 A14 A13 A12 A11 A10 A9 A8 Byte 2
7 0
Jump address A7 A6 A5 A4 A3 A2 A1 A0 Byte 3
Operation : (PC0~15)←A0~15
Number of bytes :3
Number of cycles :2
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : Jump address A0~15 specified by operand are placed in the
program counter PC0~15.
This instruction is capable of jump to anywhere within the entire
range of 64K words.
310
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 0 1 1 1 0 1 1 r Byte 1
7 0
Data address I7 I6 I5 I4 I3 I2 I1 I0 Byte 2
Operation : ((Rr))←#data r=0 or 1
Number of bytes :2
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : An 8-bit immediate data value is copied to the data memory
location addressed by the register r contents.
7 0
Instruction code : 0 1 1 1 0 1 1 1 Byte 1
7 0
1 0 1 0 1 0 1 0 Byte 2
311
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 1 1 1 1 0 1 1 r Byte 1
Operation : ((Rr))←(A) r=0 or 1
Number of bytes :1
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : The accumulator contents are copied to the data memory
location addressed by the register r contents.
7 0
Instruction code : 1 1 1 1 0 1 1 0 Byte 1
312
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 1 0 1 0 0 1 1 r Byte 1
7 0
Data address a7 a6 a5 a4 a3 a2 a1 a0 Byte 2
Operation : ((Rr))←(data address) r=0 or 1
Number of bytes :2
Number of cycles :2
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : The specified data address contents are copied to the data
memory location addressed by the register r contents.
7 0
Instruction code : 1 0 1 0 0 1 1 0 Byte 1
7 0
1 1 1 0 0 0 0 0 Byte 2
313
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 0 1 1 1 0 1 0 0 Byte 1
7 0
#data I7 I6 I5 I4 I3 I2 I1 I0 Byte 2
Operation : (A)←#data
Number of bytes :2
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) •
Description : An 8-bit immediate data is copied to the accumulator, and the
flag is updated.
7 0
Instruction code : 0 1 1 1 0 1 0 0 Byte 1
7 0
0 0 0 0 0 1 0 1 Byte 2
314
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 1 1 1 0 0 1 1 r Byte 1
Operation : (A)←((Rr)) r=0 or 1
Number of bytes :1
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) •
Description : The data memory location contents addressed by the register r
contents are copied to the accumulator, and the flag is updated.
7 0
Instruction code : 1 1 1 0 0 1 1 0 Byte 1
315
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 1 1 1 0 1 r2 r1 r0 Byte 1
Operation : (A)←(Rr) r=0 thru 7
Number of bytes :1
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) •
Description : The register r contents are copied to the accumulator, and the
flag is updated.
Example MOV A, R6
7 0
Instruction code : 1 1 1 0 1 1 1 0 Byte 1
316
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 1 1 1 0 0 1 0 1 Byte 1
7 0
Data address a7 a6 a5 a4 a3 a2 a1 a0 Byte 2
Operation : (A)←(data address)
Number of bytes :2
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) •
Description : The specified data address contents are copied to the accumu-
lator, and the flag is updated.
Example MOV A, P1
7 0
Instruction code : 1 1 1 0 0 1 0 1 Byte 1
7 0
1 0 0 1 0 0 0 0 Byte 2
317
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 1 0 1 0 0 0 1 0 Byte 1
7 0
Bit address b7 b6 b5 b4 b3 b2 b1 b0 Byte 2
Operation : (C)←(bit address)
Number of bytes :2
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) •
Description : The specified bit address content is copied to the carry flag.
Example MOV C, P3.4
7 0
Instruction code : 1 0 1 0 0 0 1 0 Byte 1
7 0
1 0 1 1 0 1 0 0 Byte 2
318
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 1 0 0 1 0 0 0 0 Byte 1
7 0
#data I15 I14 I13 I12 I11 I10 I9 I8 Byte 2
7 0
#data I7 I6 I5 I4 I3 I2 I1 I0 Byte 3
Operation : (DPTR)←#data
(DPH)←I8~15
(DPL)←I0~7
Number of bytes :3
Number of cycles :2
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : A 16-bit immediate data value is copied to the data pointer
(DPH·DPL).
7 0
Instruction code : 1 0 0 1 0 0 0 0 Byte 1
7 0
0 0 0 0 1 0 1 0 Byte 2
7 0
1 1 1 1 0 1 0 1 Byte 3
319
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 0 1 1 1 1 r2 r1 r0 Byte 1
7 0
#data I7 I6 I5 I4 I3 I2 I1 I0 Byte 2
Operation : (Rr)←#data r=0 thru 7
Number of bytes :2
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : An 8-bit immediate data value is copied to the register r.
Example MOV R5, #0AH
7 0
Instruction code : 0 1 1 1 1 1 0 1 Byte 1
7 0
0 0 0 0 1 0 1 0 Byte 2
320
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 1 1 1 1 1 r2 r1 r0 Byte 1
Operation : (Rr)←(A) r=0 thru 7
Number of bytes :1
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : The accumulator contents are copied to the register r.
Example MOV R1, A
7 0
Instruction code : 1 1 1 1 1 0 0 1 Byte 1
321
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 1 0 1 0 1 r2 r1 r0 Byte 1
7 0
Data address a7 a6 a5 a4 a3 a2 a1 a0 Byte 2
Operation : (Rr)←(data address) r=0 thru 7
Number of bytes :2
Number of cycles :2
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : The specified data address contents are copied to the register r.
Example MOV R0, 5AH
7 0
Instruction code : 1 0 1 0 1 0 0 0 Byte 1
7 0
0 1 0 1 1 0 1 0 Byte 2
322
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 1 0 0 1 0 0 1 0 Byte 1
7 0
Bit address b7 b6 b5 b4 b3 b2 b1 b0 Byte 2
Operation : (bit address)←(C)
Number of bytes :2
Number of cycles :2
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : The carry flag content is copied to the specified bit address.
Example MOV P1.4, C
7 0
Instruction code : 1 0 0 1 0 0 1 0 Byte 1
7 0
1 0 0 1 0 1 0 0 Byte 2
323
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 0 1 1 1 0 1 0 1 Byte 1
7 0
Data address a7 a6 a5 a4 a3 a2 a1 a0 Byte 2
7 0
#data I7 I6 I5 I4 I3 I2 I1 I0 Byte 3
Operation : (data address)←#data
Number of bytes :3
Number of cycles :2
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : An 8-bit immediate data value is copied to the specified data
address.
7 0
Instruction code : 0 1 1 1 0 1 0 1 Byte 1
7 0
1 0 0 0 1 0 0 0 Byte 2
7 0
0 1 0 1 0 0 0 0 Byte 3
324
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 1 0 0 0 0 1 1 r Byte 1
7 0
Data address a7 a6 a5 a4 a3 a2 a1 a0 Byte 2
Operation : (data address)←((Rr)) r=0 or 1
Number of bytes :2
Number of cycles :2
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : The data memory location contents addressed by the register r
contents are copied to the specified data address.
7 0
Instruction code : 1 0 0 0 0 1 1 1 Byte 1
7 0
1 1 1 0 0 0 0 0 Byte 2
325
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 1 1 1 1 0 1 0 1 Byte 1
7 0
Data address a7 a6 a5 a4 a3 a2 a1 a0 Byte 2
Operation : (data address)←(A)
Number of bytes :2
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : The accumulator contents are copied to the specified data
address.
7 0
Instruction code : 1 1 1 1 0 1 0 1 Byte 1
7 0
1 0 1 1 0 0 0 0 Byte 2
326
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 1 0 0 0 1 r2 r1 r0 Byte 1
7 0
Data address a7 a6 a5 a4 a3 a2 a1 a0 Byte 2
Operation : (data address)←(Rr) r=0 thru 7
Number of bytes :2
Number of cycles :2
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : The register r contents are copied to the specified data address.
Example MOV 6BH, R2
7 0
Instruction code : 1 0 0 0 1 0 1 0 Byte 1
7 0
0 1 1 0 1 0 1 1 Byte 2
327
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 1 0 0 0 0 1 0 1 Byte 1
7 0
Data address 2 a72 a62 a52 a42 a32 a22 a12 a02 Byte 2
7 0
Data address 1 a71 a61 a51 a41 a31 a21 a11 a01 Byte 3
Operation : (data address 1)←(data address 2)
Number of bytes :3
Number of cycles :2
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : The source data address (data address 2) contents are copied
to the destination data address (data address 1).
7 0
Instruction code : 1 0 0 0 0 1 0 1 Byte 1
7 0
1 0 0 1 0 0 0 0 Byte 2
7 0
1 1 1 0 0 0 0 0 Byte 3
328
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 1 0 0 1 0 0 1 1 Byte 1
Operation : (A)←((A)+(DPTR))
Number of bytes :1
Number of cycles :2
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) •
Description : The data pointer contents are added to the accumulator con-
tents, and after temporary storage of the sum in the program
counter, the ROM data contents specified by the program
counter are stored in the accumulator. The program counter
contents are then restored to former contents, and the flag is
updated.
Example MOVC A, @A+DPTR
7 0
Instruction code : 1 0 0 1 0 0 1 1 Byte 1
329
MSM80C154S/83C154S/85C154HVS
71. MOVC A, @A + PC
(Move code memory offset from program counter to accumulator)
7 0
Instruction code : 1 0 0 0 0 0 1 1 Byte 1
Operations : (PC)←(PC)+1
(A)←((A)+(PC))
Number of bytes :1
Number of cycles :2
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) •
Description : The program counter contents following an increment are
added to the accumulator contents, and after temporary storage
of the sum in the program counter, the ROM data contents
specified by the program counter are stored in the accumulator.
The program counter contents are then restored to former
contents, and the flag is also updated.
Example MOVC A, @A+PC
7 0
Instruction code : 1 0 0 0 0 0 1 1 Byte 1
330
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 1 1 1 1 0 0 0 0 Byte 1
Operation : ((DPTR))←(A)
Number of bytes :1
Number of cycles :2
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : The accumulator contents are stored in external data memory
(RAM) addressed by the data pointer contents.
7 0
Instruction code : 1 1 1 1 0 0 0 0 Byte 1
331
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 1 1 1 1 0 0 1 r Byte 1
Operation : ((Rr))←(A) r=0 or 1
Number of bytes :1
Number of cycles :2
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : The accumulator contents are stored in external data memory
addressed by the register r contents.
7 0
Instruction code : 1 1 1 1 0 0 1 0 Byte 1
332
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 1 1 1 0 0 0 0 0 Byte 1
Operation : (A)←((DPTR))
Number of bytes :1
Number of cycles :2
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) •
Description : External data memory (RAM) contents addressed by the data
pointer are stored in the accumulator, and the flag is updated.
7 0
Instruction code : 1 1 1 0 0 0 0 0 Byte 1
333
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 1 1 1 0 0 0 1 r Byte 1
Operation : (A)←((Rr)) r=0 or 1
Number of bytes :1
Number of cycles :2
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) •
Description : External data memory (RAM) contents addressed by the
register r contents are stored in the accumulator, and the flag is
updated.
Example MOVX A, @R1
7 0
Instruction code : 1 1 1 0 0 0 1 1 Byte 1
334
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 1 0 1 0 0 1 0 0 Byte 1
Operations : (A)0~7←(A) × (B)
(B)8~15
Number of bytes :1
Number of cycles :4
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) • • •
Description : The accumulator contents are multiplied by the arithmetic
operation register (B) contents. The operand is always handled
as an integer without sign. The lower order byte of the result is
placed in the accumulator, and the higher order byte is placed
in the arithmetic operation register (B). The carry flag is always
cleared. The overflow flag is set to 1 if the product is greater
than 00FFH, and to 0 in all other cases.
7 0
Instruction code : 1 0 1 0 0 1 0 0 Byte 1
335
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 0 0 0 0 0 0 0 0 Byte 1
Operation : (PC)←(PC)+1
Number of bytes :1
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : The program counter is incremented by 1 without any other
change in the CPU. Control is shifted to the next instruction.
336
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 0 1 0 0 0 1 0 0 Byte 1
7 0
#data I7 I6 I5 I4 I3 I2 I1 I0 Byte 2
Operation : (A)←(A) OR #data
Number of bytes :2
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) •
Description : The logical OR between an 8-bit immediate data value and the
accumulator contents is determined. The result is placed in the
accumulator and the flag is updated.
Example ORL A, #5FH
7 0
Instruction code : 0 1 0 0 0 1 0 0 Byte 1
7 0
0 1 0 1 1 1 1 1 Byte 2
337
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 0 1 0 0 0 1 1 r Byte 1
Operation : (A)←(A) OR ((Rr)) r=0 or 1
Number of bytes :1
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) •
Description : The logical OR between the accumulator contents and the data
memory location contents addressed by the register r contents
is determined. The result is placed in the accumulator and the
flag is updated.
7 0
Instruction code : 0 1 0 0 0 1 1 0 Byte 1
338
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 0 1 0 0 1 r2 r1 r0 Byte 1
Operation : (A)←(A) OR (Rr) r=0 thru 7
Number of bytes :1
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) •
Description : The logical OR between the accumulator contents and the
register r contents is determined. The result is placed in the
accumulator and the flag is updated.
Example ORL A, R5
7 0
Instruction code : 0 1 0 0 1 1 0 1 Byte 1
339
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 0 1 0 0 0 1 0 1 Byte 1
7 0
Data address a7 a6 a5 a4 a3 a2 a1 a0 Byte 2
Operation : (A)←(A) OR (data address)
Number of bytes :2
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) •
Description : The logical OR between the accumulator contents and the
specified data address contents is determined. The result is
placed in the accumulator and the flag is updated.
Example ORL A, 33H
7 0
Instruction code : 0 1 0 0 0 1 0 1 Byte 1
7 0
0 0 1 1 0 0 1 1 Byte 2
340
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 0 1 1 1 0 0 1 0 Byte 1
7 0
Bit address b7 b6 b5 b4 b3 b2 b1 b0 Byte 2
Operation : (C)←(C) OR (bit address)
Number of bytes :2
Number of cycles :2
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) •
Description : The logical OR between the carry flag and the specified bit
address content is determined. The result is placed in the carry
flag.
Example ORL C, ACC.6
7 0
Instruction code : 0 1 1 1 0 0 1 0 Byte 1
7 0
1 1 1 0 0 1 1 0 Byte 2
Accumulator Accumulator
0 1 1 1 0 0 1 0 0 1 1 1 0 0 1 0
7 6 0 7 6 0
341
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 1 0 1 0 0 0 0 0 Byte 1
7 0
Bit address b7 b6 b5 b4 b3 b2 b1 b0 Byte 2
Operation : (C)←(C) OR (bit address)
Number of bytes :2
Number of cycles :2
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) •
Description : The logical OR between the carry flag and the complement of
specified bit address content is determined. The result is placed
in the carry flag.
Example ORL C,/25H.5
7 0
Instruction code : 1 0 1 0 0 0 0 0 Byte 1
7 0
0 0 1 0 1 1 0 1 Byte 2
25H 25H
1 0 0 0 1 0 1 0 1 0 0 0 1 0 1 0
7 5 0 7 5 0
342
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 0 1 0 0 0 0 1 1 Byte 1
7 0
Data address a7 a6 a5 a4 a3 a2 a1 a0 Byte 2
7 0
#data I7 I6 I5 I4 I3 I2 I1 I0 Byte 3
Operation : (data address)←(data address) OR #data
Number of bytes :3
Number of cycles :2
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : The logical OR between an 8-bit immediate data value and the
specified data address contents is determined. The result is
placed in the specified data address.
Example ORL 55H, #11H
7 0
Instruction code : 0 1 0 0 0 0 1 1 Byte 1
7 0
0 1 0 1 0 1 0 1 Byte 2
7 0
0 0 0 1 0 0 0 1 Byte 3
343
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 0 1 0 0 0 0 1 0 Byte 1
7 0
Data address a7 a6 a5 a4 a3 a2 a1 a0 Byte 2
Operation : (data address)←(data address) OR (A)
Number of bytes :2
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : The logical OR between the accumulator and the specified data
address contents is determined. The result is placed in the
specified data address.
Example ORL 50H, A
7 0
Instruction code : 0 1 0 0 0 0 1 0 Byte 1
7 0
0 1 0 1 0 0 0 0 Byte 2
344
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 1 1 0 1 0 0 0 0 Byte 1
7 0
Data address a7 a6 a5 a4 a3 a2 a1 a0 Byte 2
Operations : (data address)←((SP))
(SP)←(SP)–1
Number of bytes :2
Number of cycles :2
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : Stack contents addressed by the stack pointer are popped in
the specified data address, and the stack pointer is
decremented by 1.
Example POP PSW:No change to parity bit.
7 0
Instruction code : 1 1 0 1 0 0 0 0 Byte 1
7 0
1 1 0 1 0 0 0 0 Byte 2
345
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 1 1 0 0 0 0 0 0 Byte 1
7 0
Data address a7 a6 a5 a4 a3 a2 a1 a0 Byte 2
Operations : (SP)←(SP)+1
((SP))←(data address)
Number of bytes :2
Number of cycles :2
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : The stack pointer is incremented by 1, and the specified data
address contents are pushed in the stack addressed by the
stack pointer.
Example PUSH P1
7 0
Instruction code : 1 1 0 0 0 0 0 0 Byte 1
7 0
1 0 0 1 0 0 0 0 Byte 2
346
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 0 0 1 0 0 0 1 0 Byte 1
Operations : (PC8~15)←((SP))
(SP)←(SP)–1
(PC0~7)←((SP))
(SP)←(SP)–1
Number of bytes :1
Number of cycles :2
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : The stack contents addressed by the stack pointer are popped
in the upper order 8 thru 15 of the program counter, and the
stack pointer is decremented by 1. Then the stack contents
addressed by the updated stack pointer are popped in the lower
order 0 thru 7 of the program counter, again decrementing the
stack pointer by 1. The program counter is updated with the
stack contents, and control is shifted to the address after
updating.
347
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 0 0 1 1 0 0 1 0 Byte 1
Operations : (PC8~15)←((SP))
(SP)←(SP)–1
(PC0~7)←((SP))
(SP)←(SP)–1
*INTERRUPT ENABLE
Number of bytes :1
Number of cycles :2
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : This return instruction functions as an interrupt routine terminat-
ing instruction. If a priority interrupt is generated while a non
priority interrupt routine is being executed, the CPU commences
to process the priority interrupt. And once processing of this
interrupt is commenced, no other interrupts can be processed
until the RETI instruction is executed.
348
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 0 0 1 0 0 0 1 1 Byte 1
Operation : Accumulator
C ← ← ← ← ← ← ← ←
7 0
Number of bytes :1
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : All accumulator bits are shifted by one bit to the left. The MSB
(bit 7) is shifted to the LSB bit position (bit 0).
Example RL A
7 0
Instruction code : 0 0 1 0 0 0 1 1 Byte 1
349
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 0 0 1 1 0 0 1 1 Byte 1
Operation : Carry Accumulator
C ← ← ← ← ← ← ← ←
7 0
Number of bytes :1
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) • •
Description : The accumulator and the carry flag are connected, and all bits
are shifted by one bit to the left. The carry flag is shifted to the
accumulator LSB (bit 0), and the accumulator MSB (bit 7) is
shifted to the carry flag.
Example RLC A
7 0
Instruction code : 0 0 1 1 0 0 1 1 Byte 1
350
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 0 0 0 0 0 0 1 1 Byte 1
Operation : Accumulator
C ← ← ← ← ← ← ← ←
7 0
Number of bytes :1
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : All accumulator bits are shifted by one bit to the right. The LSB
(bit 0) is shifted to the MSB bit position (bit 7).
Example RR A
7 0
Instruction code : 0 0 0 0 0 0 1 1 Byte 1
351
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 0 0 0 1 0 0 1 1 Byte 1
Operation : Carry Accumulator
C ← ← ← ← ← ← ← ←
7 0
Number of bytes :1
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) • •
Description : The accumulator and the carry flag are connected, and all bits
are shifted by one bit to the right. The carry flag is shifted to the
accumulator MSB (bit 7), and the accumulator LSB (bit 0) is
shifted to the carry flag.
Example RRC A
7 0
Instruction code : 0 0 0 1 0 0 1 1 Byte 1
352
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 1 1 0 1 0 0 1 1 Byte 1
Operation : (C)←1
Number of bytes :1
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) •
Description : The carry flag is cleared to 1.
Example SETB C
7 0
Instruction code : 1 1 0 1 0 0 1 1 Byte 1
353
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 1 1 0 1 0 0 1 0 Byte 1
7 0
Bit address b7 b6 b5 b4 b3 b2 b1 b0 Byte 2
Operation : (bit address)←1
Number of bytes :2
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : The specified bit address content is set to 1.
Example SETB IE.7
7 0
Instruction code : 1 1 0 1 0 0 1 0 Byte 1
7 0
1 0 1 0 1 1 1 1 Byte 2
354
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 1 0 0 0 0 0 0 0 Byte 1
7 0
Relative offset R7 R6 R5 R4 R3 R2 R1 R0 Byte 2
Operations : (PC)←(PC)+2
(PC)←(PC)+relative offset
Number of bytes :2
Number of cycles :2
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : Relative offset jump data is added/subtracted to/from the
program counter contents following an increment. The program
counter contents are updated, and control is then shifted to the
updated address. The range in which relative jumps can be
executed by this instruction is +127 to –128 in respect to the
incremented program counter contents. There is no page field
restrictions.
355
MSM80C154S/83C154S/85C154HVS
0123 33 CHECK:RLC A
7 0
Instruction code : 1 0 0 0 0 0 0 0 Byte 1
7 0
0 0 0 1 0 0 0 0 Byte 2
356
DESCRIPTION OF INSTRUCTIONS
97. SUBB A, #data (Substract immediate data from accumulator with borrow)
7 0
Instruction code : 1 0 0 1 0 1 0 0 Byte 1
7 0
#data I7 I6 I5 I4 I3 I2 I1 I0 Byte 2
Operation : (A)←(A)–((C)+#data)
Number of bytes :2
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) • • • •
Description : The carry flag content and an immediate data value are
substracted from the accumulator contents. The result is placed
in the accumulator, and the flags are updated.
Example SUBB A, #05H
7 0
Instruction code : 1 0 0 1 0 1 0 0 Byte 1
7 0
0 0 0 0 0 1 0 1 Byte 2
Accumulator Accumulator
1 0 1 0 1 0 0 1 1 0 1 0 0 0 1 1
7 0 7 0
357
MSM80C154S/83C154S/85C154HVS
98. SUBB A, @Rr (Substract indirect address from accumulator with borrow)
7 0
Instruction code : 1 0 0 1 0 1 1 r Byte 1
Operation : (A)←(A)–((C)+((Rr))) r=0 or 1
Number of bytes :1
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) • • • •
Description : The carry flag content and the data memory location contents
addressed by the register r contents are substracted from the
accumulator contents. The result is placed in the accumulator,
and the flags are updated.
7 0
Instruction code : 1 0 0 1 0 1 1 0 Byte 1
Register 0 Register 0
0 1 0 0 0 1 1 1 0 1 0 0 0 1 1 1
7 0 7 0
47H 47H
1 1 0 1 0 0 1 0 1 1 0 1 0 0 1 0
7 0 7 0
Accumulator Accumulator
0 1 0 1 0 1 0 0 1 0 0 0 0 0 1 0
7 0 7 0
358
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 1 0 0 1 1 r2 r1 r0 Byte 1
Operation : (A)←(A)–((C)+(Rr))
Number of bytes :1
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) • • • •
Description : The carry flag content and the register r contents are
substracted from the accumulator contents. The result is placed
in the accumulator, and the flags are updated.
Example SUBB A, R7
7 0
Instruction code : 1 0 0 1 1 1 1 1 Byte 1
Register 7 Register 7
0 1 0 1 1 0 0 0 0 1 0 1 1 0 0 0
7 0 7 0
Accumulator Accumulator
1 0 0 0 0 1 0 0 0 0 1 0 1 0 1 1
7 0 7 0
359
MSM80C154S/83C154S/85C154HVS
100. SUBB A, data address (Substract memory from accumulator with borrow)
7 0
Instruction code : 1 0 0 1 0 1 0 0 Byte 1
7 0
Data address a7 a6 a5 a4 a3 a2 a1 a0 Byte 2
Operation : (A)←(A)–((C)+(data address))
Number of bytes :2
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) • • • •
Description : The carry flag contents and the specified data address contents
are substracted from the accumulator contents. The result is
placed in the accumulator, and the flags are updated.
Example SUBB A, DPH
7 0
Instruction code : 1 0 0 1 0 1 0 1 Byte 1
7 0
1 0 0 0 0 0 1 1 Byte 2
DPH DPH
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
7 0 7 0
Accumulator Accumulator
0 1 0 1 0 1 0 1 1 0 1 0 1 0 1 1
7 0 7 0
360
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 1 1 0 0 0 1 0 0 Byte 1
Operation : (A4~7)→
←(A0~3)
Number of bytes :1
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : The contents of the four higher order bits (4 thru 7) of the
accumulator are exchanged with the contents of the four lower
order bits (0 thru 3)
Example SWAP A
7 0
Instruction code : 1 1 0 0 0 1 0 0 Byte 1
361
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 1 1 0 0 0 1 1 r Byte 1
Operation : (A)→
←((Rr)) r=0 or 1
Number of bytes :1
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) •
Description : The accumulator contents are exchanged with the data memory
location contents addressed by the register r, and the flag is
updated.
Example XCH A, @R0
7 0
Instruction code : 1 1 0 0 0 1 1 0 Byte 1
362
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 1 1 0 0 1 r2 r1 r0 Byte 1
Operation : (A)→
←(Rr) r=0 thru 7
Number of bytes :1
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) •
Description : The accumulator contents are exchanged with the register r
contents, and the flag is updated.
Example XCH A, R5
7 0
Instruction code : 1 1 0 0 1 1 0 1 Byte 1
363
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 1 1 0 0 0 1 0 1 Byte 1
7 0
Data address a7 a6 a5 a4 a3 a2 a1 a0 Byte 2
Operation : (A)→
←(data address)
Number of bytes :2
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) •
Description : The accumulator contents are exchanged with the specified
data address contents, and the flag is updated.
7 0
Instruction code : 1 1 0 0 0 1 0 1 Byte 1
7 0
0 1 1 1 1 0 1 0 Byte 2
364
DESCRIPTION OF INSTRUCTIONS
105. XCHD A, @Rr (Exchange low nibbles of indirect address with accumulator)
7 0
Instruction code : 1 1 0 1 0 1 1 r Byte 1
Operation : (A0~3)→
←((Rr0~3)) r=0 or 1
Number of bytes :1
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) •
Description : The lower order bits (0 thru 3) of the accumulator contents are
exchanged with contents of the lower order bits (0 thru 3) of the
data memory location addressed by the register r contents. The
flag is updated.
7 0
Instruction code : 1 1 0 1 0 1 1 0 Byte 1
365
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 0 1 1 0 0 1 0 0 Byte 1
7 0
#data I7 I6 I5 I4 I3 I2 I1 I0 Byte 2
Operation : (A)←(A) XOR #data
Number of bytes :2
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) •
Description : The exclusive OR operation is executed between an immediate
data value and the accumulator contents. The result is placed in
the accumulator, and the flag is updated.
7 0
Instruction code : 0 1 1 0 0 1 0 0 Byte 1
7 0
0 0 0 1 0 1 0 1 Byte 2
366
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 0 1 1 0 0 1 1 r Byte 1
Operation : (A)←(A) XOR ((Rr)) r=0 or 1
Number of bytes :1
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) •
Description : The exclusive OR operation is executed between the
accumulator contents and the data memory location contents
addressed by the register r contents. The result is placed in the
accumulator, and the flag is updated.
7 0
Instruction code : 0 1 1 0 0 1 1 1 Byte 1
367
MSM80C154S/83C154S/85C154HVS
7 0
Instruction code : 0 1 1 0 1 r2 r1 r0 Byte 1
Operation : (A)←(A) XOR (Rr) r=0 thru 7
Number of bytes :1
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) •
Description : The exclusive OR between the accumulator contents and the
register r contents is determined. The result is stored in the
accumulator and the flag is updated.
Example XRL A, R3
7 0
Instruction code : 0 1 1 0 1 0 1 1 Byte 1
368
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 0 1 1 0 0 1 0 1 Byte 1
7 0
Data address a7 a6 a5 a4 a3 a2 a1 a0 Byte 2
Operation : (A)←(A) XOR (data address)
Number of bytes :2
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) •
Description : The exclusive OR between the accumulator contents and the
specified data address contents is determined. The result is
placed in the accumulator and the flag is updated.
Example XRL A, 70H
7 0
Instruction code : 0 1 1 0 0 1 0 1 Byte 1
7 0
0 1 1 1 0 0 0 0 Byte 2
369
MSM80C154S/83C154S/85C154HVS
110. XRL data address, #data (Logical exclusive OR immediate data to memory)
7 0
Instruction code : 0 1 1 0 0 0 1 1 Byte 1
7 0
Data address a7 a6 a5 a4 a3 a2 a1 a0 Byte 2
7 0
#data I7 I6 I5 I4 I3 I2 I1 I0 Byte 3
Operation : (data address)←(data address) XOR #data
Number of bytes :3
Number of cycles :2
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW)
Description : The exclusive OR between an immediate data value and the
specified data address contents is determined. The result is
placed in the specified data address.
Example XRL ACC, #5AH
7 0
Instruction code : 0 1 1 0 0 0 1 1 Byte 1
7 0
1 1 1 0 0 0 0 0 Byte 2
7 0
0 1 0 1 1 0 1 0 Byte 3
370
DESCRIPTION OF INSTRUCTIONS
7 0
Instruction code : 0 1 1 0 0 0 1 0 Byte 1
7 0
Data address a7 a6 a5 a4 a3 a2 a1 a0 Byte 2
Operation : (data address)←(data address) XOR (A)
Number of bytes :2
Number of cycles :1
Flags : C AC F0 RS1 RS0 OV F1 P
(PSW) •
Description : The exclusive OR between the accumulator and the specified
data address contents is determined. The result is placed in the
specified data address.
Example XRL 20H, A
7 0
Instruction code : 0 1 1 0 0 0 1 0 Byte 1
7 0
0 0 1 0 0 0 0 0 Byte 2
371
8051 Cross Assembler User's Manual
MetaLink Corporation
Chandler, Arizona
MetaLink Corporation
P.O. BOX 1329
Chandler, Arizona 85244-1329
(602) 926-0797
TELEX: 4998050 MTLNK
FAX: (602) 926-1198
PURCHASE TERMS AND CONDITIONS
Since MetaLink Corporation does business and is located solely in the State of Arizona,
such orders or agreements and the rights of the parties hereunder shall be governed by the
laws of the State of Arizona.
LIMITED WARRANTY: METALINK MAKES NO WARRANTIES OTHER THAN THOSE
CONTAINED HEREIN AND METALINK EXPRESSLY DISCLAIMS ANY AND ALL
IMPLIED WARRANTIES, INCLUDING ANY WARRANTY OF FITNESS FOR A PAR-
TICULAR PURPOSE OR OF MERCHANTABILITY.
The foregoing limited warranty shall not apply unless Buyer has paid for in full the MetaLink
products. Updates to the MetaLink Assembler User's Manual and MetaLink Assembler
software are available free to Registered Buyer upon request for a one (1) year period from
the invoice date.
2
NOTICE
MetaLink Corp. reserves the right to make improvements in the software product described
in this manual as well as the manual itself at any time and without notice.
DISCLAIMER OF ALL WARRANTIES AND LIABILITY
METALINK CORP. MAKES NO WARRANTIES, EITHER EXPRESSED OR IMPLIED,
WITH RESPECT TO THIS MANUAL OR WITH RESPECT TO THE SOFTWARE DE-
SCRIBED IN THIS MANUAL, ITS QUALITY, PERFORMANCE, MERCHANTABIL-
ITY, OR FITNESS FOR ANY PARTICULAR PURPOSE. METALINK CORP. SOFT-
WARE IS SOLD OR LICENSED "AS IS". IN NO EVENT SHALL METALINK CORP. BE
LIABLE FOR INCIDENTAL OR CONSEQUENTIAL DAMAGES RESULTING FROM
ANY DEFECT IN THE SOFTWARE.
Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989, 1990 MetaLink Corp.
All rights are reserved. This manual may not, in whole or part, be copied, photocopied,
reproduced, translated, or reduced to any electronic medium or machine readable form
without the prior agreement and written permission of MetaLink Corp.
MS-DOS is a trademark of Microsoft, Inc.
IBM is a registered trademark of IBM Corp.
Intel is a registered trademark of Intel Corp.
MetaLink is a trademark of MetaLink Corp.
Chapter 1
8051 Overview
1.1 Introduction
The 8051 series of microcontrollers are highly integrated single chip microcomputers with
an 8-bit CPU, memory, interrupt controller, timers, serial I/O and digital I/O on a single
piece of silicon. The current members of the 8051 family of components include:
All members of the 8051 series of microcontrollers share a common architecture. They all
have the same instruction set, addressing modes, addressing range and memory spaces. The
primary dierences between dierent 8051 based products are the amount of memory on
chip, the amount and types of I/O and peripheral functions, and the component's technology
(see Table 1.1).
In the brief summary of the 8051 architecture that follows, the term 8051 is used to mean
collectively all available members of the 8051 family. Please refer to reference (1) for a
complete description of the 8051 architecture and the specications for all the currently
available 8051 based products.
mode. The SFRs can only be accessed using the Direct addressing mode while the upper
128 bytes of the Internal Data Memory (if integrated on-chip) can only be accessed using
the Indirect addressing mode.
The Bit Memory space is used for storing bit variables and
ags. There are specic instruc-
tions in the 8051 that operate only in the Bit Memory space. The maximum size of the
Bit Memory space is 256-bits. 128 of the bits overlap with 16-bytes of the Internal Data
Memory space and 128 of the bits overlap with 16 Special Function Registers. Bits can only
be accessed using the bit instructions and the Direct addressing mode.
The 8051 has a fairly complete set of arithmetic and logical instructions. It includes an 8X8
multiply and an 8/8 divide. The 8051 is particularly good at processing bits (sometimes
called Boolean Processing). Using the Carry Flag in the PSW as a single bit accumulator,
the 8051 can move and do logical operations between the Bit Memory space and the Carry
Flag. Bits in the Bit Memory space can also be used as general purpose
ags for the test
bit and jump instructions.
Except for the MOVE instruction, the 8051 instructions can only operate on either the
Internal Data Memory space or the Special Function Registers. The MOVE instruction
operates in all memory spaces, including the External Memory space and Program Memory
space.
Program control instructions include the usual unconditional calls and jumps as well as
conditional relative jumps based on the Carry Flag, the Accumulator's zero state, and the
state of any bit in the Bit Memory space. Also available is a Compare and Jump if Not
Equal instruction and a Decrement Counter and Jump if Not Zero loop instruction. See
Chapter 4 for a description of the complete 8051 instruction set.
1.4 References
1. Intel Corp., 8-Bit Embedded Controllers, 1990.
2. Siemens Corp., Microcontroller Component 80515, 1985.
3. AMD Corp., Eight-Bit 80C51 Embedded Processors, 1990.
4. Signetics Corp., Microcontroller Users' Guide, 1989.
6 Chap. 1: 8051 Overview
2.1 Introduction
The 8051 Cross Assembler takes an assembly language source le created with a text editor
and translates it into a machine language object le. This translation process is done in
two passes over the source le. During the rst pass, the Cross Assembler builds a symbol
table from the symbols and labels used in the source le. It's during the second pass that
the Cross Assembler actually translates the source le into the machine language object
le. It is also during the second pass that the listing is generated.
The following is a discussion of the syntax required by the Cross Assembler to generate
error free assemblies.
2.2 Symbols
Symbols are alphanumeric representations of numeric constants, addresses, macros, etc. The
legal character set for symbols is the set of letters, both upper and lower case (A..Z,a..z), the
set of decimal numbers (0..9) and the special characters, question mark (?) and underscore
( ). To ensure that the Cross Assembler can distinguish between a symbol and a number,
all symbols must start with either a letter or special character (? or ). The following are
examples of legal symbols:
PI
Serial_Port_Buffer
LOC_4096
?_?_?
In using a symbol, the Cross Assembler converts all letters to upper case. As a result, the
Cross Assembler makes no distinction between upper and lower case letters. For example,
the following two symbols would be seen as the same symbol by the Cross Assembler:
Serial_Port_Buffer
SERIAL_PORT_BUFFER
Symbols can be dened only once. Symbols can be up to 255 characters in length, though
only the rst 32 are signicant. Therefore, for symbols to be unique, they must have a
unique character pattern within the rst 32 characters. In the following example, the rst
two symbols would be seen by the Cross Assembler as duplicate symbols, while the third
and fourth symbols are unique.
BEGINNING_ADDRESS_OF_CONSTANT_TABLE_1
8 Chap. 2: 8051 CROSS ASSEMBLER OVERVIEW
BEGINNING_ADDRESS_OF_CONSTANT_TABLE_2
CONSTANT_TABLE_1_BEGINNING_ADDRESS
CONSTANT_TABLE_2_BEGINNING_ADDRESS
There are certain symbols that are reserved and can't be dened by the user. These reserved
symbols are listed in Appendix C and include the assembler directives, the 8051 instruction
mnemonics, implicit operand symbols, and the following assembly time operators that have
alphanumeric symbols: EQ, NE, GT, GE, LT, LE, HIGH, LOW, MOD, SHR, SHL, NOT,
AND, OR and XOR.
The reserved implicit operands include the symbols A, AB, C, DPTR, PC, R0, R1, R2, R3,
R4, R5, R6, R7, AR0, AR1, AR2, AR3, AR4, AR5, AR6 and AR7. These symbols are used
primarily as instruction operands. Except for AB, C, DPTR or PC, these symbols can also
be used to dene other symbols (see EQU directive in Chapter 5).
The following are examples of illegal symbols with an explanation of why they are illegal:
1ST_VARIABLE (Symbols can not start with a number.)
ALPHA# (Illegal character "#" in symbol.)
MOV (8051 instruction mnemonic)
LOW (Assembly operator)
DATA (Assembly directive)
2.3 Labels
Labels are special cases of symbols. Labels are used only before statements that have phys-
ical addresses associated with them. Examples of such statements are assembly language
instructions, data storage directives (DB and DW), and data reservation directives (DS and
DBIT). Labels must follow all the rules of symbol creation with the additional requirement
that they be followed by a colon. The following are legal examples of label uses:
TABLE_OF_CONTROL_CONSTANTS:
DB 0,1,2,3,4,5 (Data storage)
MESSAGE: DB 'HELP' (Data storage)
VARIABLES: DS 10 (Data reservation)
BIT_VARIABLES: DBIT 16 (Data reservation)
START: MOV A,#23 (Assembly language instruction)
EQU Dene symbol
DATA Dene internal memory symbol
IDATA Dene indirectly addressed internal memory symbol
XDATA Dene external memory symbol
BIT Dene internal bit memory symbol
CODE Dene program memory symbol
DS Reserve bytes of data memory
DBIT Reserve bits of bit memory
DB Store byte values in program memory
DW Store word values in program memory
ORG Set segment location counter
END End of assembly language source le
CSEG Select program memory space
DSEG Select internal memory data space
XSEG Select external memory data space
ISEG Select indirectly addressed internal
BSEG Select bit addressable memory space memory space
USING Select register bank
IF Begin conditional assembly block
ELSE Alternative conditional assembly block
ENDIF End conditional assembly block
of three instructions (SJMP, AJMP or LJMP). The choice of instructions is based on which
one is most byte ecient. The generic CALL or JMP instructions saves the programmer
the trouble of determining which form is best.
However, generic CALLs and JMPs do have their limitations. While the byte eciency
algorithm works well for previously dened locations, when the target location of the CALL
or JMP is a forward location (a location later on in the program), the assembler has no
way of determining the best form of the instruction. In this case the Cross Assembler
simply puts in the long version (LCALL or LJMP) of the instruction, which may not be
the most byte ecient. NOTE that the generic CALLs and JMPs must not be used for the
751/752 device as LCALL and LJMP are not legal instructions for those devices. Instead
use ACALL and AJMP explicitly.
For instructions that have operands, the operands must be separated from the mnemonic
by at least one space or tab. For instructions that have multiple operands, each operand
must be separated from the others by a comma.
Two addressing modes require the operands to be preceded by special symbols to designate
the addressing mode. The AT sign (@) is used to designate the indirect addressing mode. It
is used primarily with Register 0 and Register 1 (R0, R1), but is can also be used with the
DPTR in the MOVX and the Accumulator in MOVC and JMP @A+DPTR instructions.
The POUND sign (#) is used to designate an immediate operand. It can be used to preface
either a number or a symbol representing a number.
A third symbol used with the operands actually species an operation. The SLASH (/) is
used to specify that the contents of a particular bit address is to be complemented before
the instruction operation. This is used with the ANL and ORL bit instructions.
Only one assembly language instruction is allowed per line. Comments are allowed on the
same line as an instruction, but only after all operands have been specied. The following
are examples of instruction statements:
START: LJMP INIT
MOV @R0,Serial_Port_Buffer
CJNE R0 , #TEN, INC_TEN
ANL C,/START_FLAG
CALL GET_BYTE
RET
2.9 Comments
Comments are user dened character strings that are not processed by the Cross Assembler.
A comment begins with a semicolon ( ; ) and ends at the carriage return/line feed pair that
terminates the line. A comment can appear anywhere in a line, but it has to be the last
eld. The following are examples of comment lines:
; Begin initialization routine here
$TITLE(8051 Program Vers. 1.0) ;Place version number here
TEN EQU 10 ;Constant
; Comment can begin anywhere in a line
MOV A,Serial_Port_Buffer ; Get character
While a legal source le line must begin with one of the above items, the item doesn't have
to begin in the rst column of the line. It only must be the rst eld of the line. Any
number (including zero) of spaces or tabs, up to the maximum line size, may precede it.
Comments can be placed anywhere, but they must be the last eld in any line.
When using radices with explicit bit symbols, the radix designator follows the byte portion
of the address as shown in the following examples:
0E0H.7 Bit seven of hexadecimal address 0E0
200Q.ON Bit ON of octal address 200
The Cross Assembler also allows assembly time evaluation of arithmetic expressions up to
thirty-two levels of embedded parentheses. All calculations use integer numbers and are
done in sixteen bit precision.
The relational operators test the specied values and return either a True or False. False
is represented by a zero value, True is represented by a non zero value (the True condition
Chap. 2: 8051 CROSS ASSEMBLER OVERVIEW 15
actually returns a 16-bit value with every bit set; i.e., 0FFFFH). The relational operators
are used primarily with the Conditional Assembly capability of the Cross Assembler.
Table 2.5 lists the operations available while Table 2.6 lists the operations precedence in
descending order. Operations with higher precedence are done rst. Operations with equal
precedence are evaluated from left to right.
OPERATION PRECEDENCE
(,) HIGHEST
HIGH,LOW
,/,MOD,SHR,SHL
+,-
EQ,LT,GT,LE,GE,NE,=,<,>,<=,>=,<>
NOT
AND
OR,XOR LOWEST
The following are examples of all the available operations and their result:
HIGH(0AADDH) will return a result of 0AAH
LOW(0AADDH) will return a result of 0DDH
7*4 will return a result of 28
7/4 will return a result of 1
7 MOD 4 will return a result of 3
1000B SHR 2 will return a result of 0010B
1010B SHL 2 will return a result of 101000B
10+5 will return a result of 15
+72 will return a result of 72
25-17 will return a result of 8
-1 will return a result of 1111111111111111B
NOT 1 will return a result of 1111111111111110B
7 EQ 4, 7 = 4 will return a result of 0
7 LT 4, 7 < 4 will return a result of 0
7 GT 4, 7 > 4 will return a result of 0FFFFH
7 LE 4, 7 <= 4 will return a result of 0
7 GE 4, 7 >= 4 will return a result of 0FFFFH
7 NE 4, 7 <> 4 will return a result of 0FFFFH
1101B AND 0101B will return a result of 0101B
1101B OR 0101B will return a result of 1101B
1101B XOR 0101B will return a result of 1000B
The '002F' is the current value of the location counter in hexadecimal. The '7920' is the
translated instruction, also in hexadecimal. The '152' is the decimal line number of the
current assembly. After the line number is a copy of the source le line that was translated.
Another example of a line in the listing le is as follows:
015B 13 =1 267 +2 RRC A
Here we see two additional elds. The '=1' before the line number gives the current nesting
of include les. The '+2' after the line number gives the current macro nesting. This line
essentially says that this line comes from a second level nesting of a macro that is part of
an include le.
Another line format that is used in the listing is that of symbol denition. In this case the
location counter value and translated instruction elds described above are replaced with
the denition of the symbol. The following are examples of this:
Chap. 2: 8051 CROSS ASSEMBLER OVERVIEW 17
The '00FF' is the hexadecimal value of the symbol MAX NUM. Again, '67'is the decimal
line number of the source le and the remainder of the rst line is a copy of the source le.
In the second line above, the 'REG' shows that the symbol COUNTER was dened to be
a general purpose register.
Optionally, a listing can have a page header that includes the name of the le being assem-
bled, title of program, date and page number. The header and its elds are controlled by
specic Assembler Controls (see Chapter 6).
The default case is for a listing to be output as a le on the default drive with the same name
as the entered source le and an extension of .LST. For example, if the source le name
was PROGRAM.ASM, the listing le would be called PROGRAM.LST. Or if the source
le was called MODULE1, the listing le would be stored as MODULE1.LST. The default
can be changed using the $NOPRINT and $PRINT() Assembler Controls (see Chapter 6).
If the 8051 Cross Assembler disk was placed in a drive other than the default drive, the
drive name would have to be typed rst. For example, if the A drive is the default drive,
and the 8051 Cross Assembler is in the B drive, you would then type:
B:ASM51<CR>
After loading the program from the disk, the program's name, its version number and
general copyright information will be dis- played on the screen. The Cross Assembler then
asks for the source le name to begin the assembly process.
Source file drive and name [.ASM]:
At this point, if you have only one
oppy disk drive and the 8051 Cross Assembler and
source les are on separate disks, remove the disk with the 8051 Cross Assembler on it and
replace it with your source le disk.
Next, enter the source le name. If no extension is given, the Cross Assembler will assume
an extension of .ASM. If no drive is given, the Cross Assembler will assume the default
drive. Since in every case where no drive is given, the Cross Assembler assumes the default
drive, it is generally a good practice to change the default drive to the drive with your
source les.
An alternative method for entering the source le is in the command line. In this case, after
typing in ASM51, type in a space and the source le name (again if no extension is given,
source le on the command line:
A>ASM51 B:CONTROL.A51<CR>
After the source le name has been accepted, the Cross Assembler will begin the translation
process. As it starts the rst pass of its two pass process, it will print on the screen:
First pass
At the completion of the rst pass, and as it starts its second pass through the source le,
the Cross Assembler will display:
Second pass
When second pass is completed, the translation process is done and the Cross Assembler
will print the following message:
ASSEMBLY COMPLETE, XX ERRORS FOUND
XX is replaced with the actual number of errors that were found. Disk I/O may continue
for a while as the Cross Assembler appends the symbol table to the listing le.
Chap. 3: RUNNING THE 8051 CROSS ASSEMBLER ON PC-DOS/MS-DOS SYSTEMS 21
8 0 5 1 C R O S S A S S E M B L E R
Version 1.2
MetaLink Corporation
First pass
Second pass
"inle" and "outle" can be any legal le designator. The Cross Assembler will take its
input from the "inle" instead of the keyboard and will send its output to "outle" instead
of the screen.
Note that redirection of input in ASM51 is redundant since the assembler is an absolute
assembler and has no command line options other than the le name argument.
Output redirection is useful for speeding up the assembly process. Because assembly-time
errors are directed to std err in DOS, an error listing cannot be redirected to a le
To make the .lst le serve as an error-only le, use the Cross Assembler Controls $PRINT
(create a list le) $NOLIST (turn the listing o). Use the Cross Assembler Controls
$NOSYMBOLS to further compress the error-only listing resulting from the manipula-
tion of the list le controls. See Chapter 6 for more information. The errors will be listed
in the .lst le, as usual.
If the control $NOPRINT (see Chapter 6) is active, all error messages are send to the screen.
3.6 References
1. IBM Corp., Disk Operating System, Version 1.10, May 1982.
2. IBM Corp., Disk Operating System, Version 2.00, January 1983.
Chapter 4
8051 INSTRUCTION SET
4.1 Notation
Below is an explanation of the column headings and column contents of the 8051 Instruction
Set Summary Table Table 4.1 that follows in this chapter.
MNEMONIC: The MNEMONIC column contains the 8051 Instruction Set Mnemonic
and a brief description of the instruction's operation.
OPERATION: The OPERATION column describes the 8051 Instruction Set in unam-
biguous symbology. Following are the denitions of the symbols used in this column.
24 Chap. 4: 8051 INSTRUCTION SET
It should be noted that the PSW is both byte and bit directly addressable. Should
the PSW be the operand of an instruction that modies it, the condition codes could
be changed even if this column states that the instruction doesn't aect them.
0 Condition code is cleared
1 Condition code is set
Condition code is modied by instruction
- Condition code is not aected by instruction
5.1 Introduction
The 8051 Cross Assembler Directives are used to dene symbols, reserve memory space,
store values in program memory, select various memory spaces, set the current segment's
location counter and identify the end of the source le.
Only one directive per line is allowed, however comments may be included. The remaining
part of this chapter details the function of each directive.
the Data Segment location counter contained 48 decimal before the example below, it would
contain 104 decimal after processing the example.
DSEG ;Select the data segment
DS 32 ;Label is optional
SP_BUFFER: DS 16 ;Reserve a buffer for the serial port
IO_BUFFER: DS 8 ;Reserve a buffer for the I/O
5.4.3 DB Directive
The DB Directive is used to store byte constants in the Program Memory Space. It can
only be used when CSEG is the active segment.
The format for the DB Directive is: optional label, followed by one or more spaces or tabs,
followed by DB, followed by one or more spaces or tabs, followed by the byte constants that
are separated by commas, followed by an optional comment.
The byte constants can be numbers, arithmetic expressions, symbol values or ASCII literals.
ASCII literals have to be delimited by apostrophes ( ' ), but they can be strung together
up to the length of the line.
Below are examples of using the DB Directive. If an optional label is used, its value will
point to the rst byte constant listed.
COPYRGHT_MSG:
DB '(c) Copyright, 1984' ;ASCII Literal
RUNTIME_CONSTANTS:
DB 127,13,54,0,99 ;Table of constants
DB 17,32,239,163,49 ;Label is optional
MIXED: DB 2*8,'MPG',2*16,'abc' ;Can mix literals & no.
5.4.4 DW Directive
The DW Directive is used to store word constants in the Program Memory Space. It can
only be used when CSEG is the active segment.
34 Chap. 5: 8051 CROSS ASSEMBLER DIRECTIVES
The format for the DW Directive is: optional label, followed by one or more spaces or tabs,
followed by DW, followed by one or more spaces or tabs, followed by the word constants
that are separated by commas, followed by an optional comment.
The word constants can be numbers, arithmetic expressions, symbol values or ASCII literals.
ASCII literals must be delimited by apostrophes ( ' ), but unlike the DB Directive, only a
maximum of two ASCII characters can be strung together. The rst character is placed in
the high byte of the word and the second character is placed in the low byte. If only one
character is enclosed by the apostrophes, a zero will be placed in the high byte of the word.
Below are examples of using the DW Directive. If an optional label is used, its value will
point to the high byte of the rst word constant listed.
JUMP_TABLE: DW RESET,START,END ;Table of addresses
DW TEST,TRUE,FALSE ;Optional label
RADIX: DW 'H',1000H ;1st byte contains 0
;2nd byte contains 48H (H)
;3rd byte contains 10H
;4th byte contains 0
The number, arithmetic expression, or previously dened symbol must result in a number
between 0 and 3 in order to specify one of the four register banks in the 8051.
The following table maps the specied value in the USING directive with the direct addresses
of the predened symbols.
Predened USING Value
Symbol 0 1 2 3
AR0 0 8 16 24
AR1 1 9 17 25
AR2 2 10 18 26
AR3 3 11 19 27
AR4 4 12 20 28
AR5 5 13 21 29
AR6 6 14 22 30
AR7 7 15 23 31
Below are examples of the USING Directive:
USING 0 ;Select addresses for Bank 0
USING 1+1+1 ;Arithmetic expressions
evaluated FALSE (zero), the assembly language statements are considered null up to the
next ELSE or ENDIF directives.
If an optional ELSE appears in the conditional assembly block, the assembly language state-
ments following are handled oppositely from the assembly language statements following
the IF statement. In other words, if the IF statement was evaluated TRUE, the statements
following it are translated, while the statements following the ELSE will be handled as if
they were null. On the other hand, if the IF statement was evaluated FALSE, only the
assembly language statements following the ELSE directive would be translated.
IF-ELSE-ENDIF conditional assembly blocks can be nested up to 255 levels deep. The
following are some examples of conditional assembly blocks. This rst conditional assembly
block simply checks the symbol DEBUG. If DEBUG is non-zero, the MOV and CALL
instructions will be translated by the Cross Assembler.
IF (DEBUG)
MOV A,#25
CALL OUTPUT
ENDIF
The next example used the optional ELSE directive. If SMALL MODEL is zero, only the
statements following the ELSE directive will be translated.
IF (SMALL_MODEL)
MOV R0,#BUFFER
MOV A,@R0
ELSE
MOV R0,#EXT_BUFFER
MOVX A,@R0
ENDIF
The last example shows nested conditional assembly blocks. Conditional assembly blocks
can be nested up to 255 levels deep. Every level of nesting must have balanced IF-ENDIF
statements.
IF (VERSION > 10) \
CALL DOUBLE_PRECISION |
CALL UPDATE_STATUS _ |
IF (DEBUG) \ |
CALL DUMP_REGISTERS > Nested |
ENDIF _/ Block |
ELSE > Outer Block
CALL SINGLE_PRECISION |
CALL UPDATE_STATUS _ |
IF (DEBUG) \ |
CALL DUMP_REGISTERS > Nested |
ENDIF _/ Block |
ENDIF _/
Chapter 6
8051 CROSS ASSEMBLER CONTROLS
6.1 Introduction
Assembler controls are used to control where the Cross Assembler gets its input source le,
where it stores the object le, how it formats and where it outputs the listing.
All Assembler controls are prefaced with a dollar sign, ($). No spaces or tabs are allowed
between the dollar sign and the body of the control. Also, only one control per line is
permitted. Comments are allowed on the same line as an Assembler control.
There are two types of controls, Primary controls and General controls. Primary controls
can be invoked only once per assembly. If an attempt is made to change a previously invoked
primary control, the attempt is ignored. For example, if $NOPRINT is put on line 1 of
the source le and $PRINT is put on line 2, the $PRINT control will be ignored and the
listing will not be output. General controls can be invoked any number of times in a source
program.
There are two legal forms for each Assembler control, the full form and the abbreviated
form. The two forms can be used inter- changeable in the source program.
Below is a description of each Assembler control. Assembler controls with common func-
tionality are grouped together.
6.2.3 $EJECT
Places a form feed (ASCII 0CH) in the listing output. The $NOPAGING control will
override this control.
CONTROL: $EJECT
ABBREV: $EJ
DEFAULT: No form feeds in listing output
TYPE: General
EXAMPLES: $EJECT
$EJ
TYPE: Primary
EXAMPLES: $MOD51 $MOD52 $MOD44 $MOD515 $MOD512
$MOD152 $MOD451 $MOD452 $MOD751
$MOD752 $MOD154 $MOD252 $MOD521
$MOD552 $MOD652 $MOD517 $MOD851
$NOMOD
6.2.9 $PAGELENGTH(n)
Sets the maximum number of lines, (n), on a page of the output listing. If the maximum is
exceeded, a form feed and page header is inserted in the output listing. This control allows
the number of lines per page to be set anywhere between 10 and 255. If the number of lines
specied is less than 10, pagelength will be set to 10. If the number of lines specied is
greater than 255, pagelength will be set to 255.
Chap. 6: 8051 CROSS ASSEMBLER CONTROLS 41
6.2.10 $PAGEWIDTH(n)
Sets the maximum number of characters, (n), on a line of the output listing. This control
allows the number of characters per line to be set anywhere between 72 and 132. If the
number specied is less than 72, the pagewidth is set at 72. If the number specied is
greater than 132, the pagewidth is set at 132. If the pagewidth is specied between 72 and
100 and the line being output exceeds the pagewidth specication, the line is truncated at
the specied pagewidth and a carriage return/line feed pair is inserted in the listing. If the
pagewidth is specied to be greater than 100 and the line being output exceed the pagewidth
specication, a carriage return/line feed pair is inserted at the specied pagewidth and the
line will continue to be listed on the next line beginning at column 80.
CONTROL: $PAGEWIDTH(n)
ABBREV: $PW(n)
DEFAULT $PAGEWIDTH(72)
TYPE: Primary
EXAMPLES: $PAGEWIDTH(132)
$PW(80)
and ACC (accumulator symbol). If a symbol was of type ADDR, it segment is also output
as either C (code), D (data) or X (external). Other information listed with the symbols is
NOT USED (symbol dened but never referenced), UNDEFINED (symbol referenced but
never dened) and REDEFINEABLE (symbol dened using the SET directive). The type
and value listed for a REDEFINABLE symbol is that of its last denition in the source
program. $NOSYMBOLS does not output the symbol table.
CONTROL: $SYMBOLS
$NOSYMBOLS
ABBREV: $SB
$NOSB
DEFAULT: $SYMBOLS
TYPE: Primary
EXAMPLES: $SB
$NOSYMBOLS
6.2.13 $TITLE(string)
Places the ASCII string enclosed by the parenthesis in the title eld of the page header. The
ASCII string can be from 0 to 64 characters long. If the string is greater than 64 characters
or if the width of the page will not support such a long title, the title will be truncated. If
parentheses are part of the string, they must be balanced.
CONTROL: $TITLE(string)
ABBREV: $TT(string)
DEFAULT: No title in page header
TYPE: Primary
EXAMPLES: $TITLE(SAMPLE PROGRAM V1.2)
$TT(METALINK (TM) CROSS ASSEMBLER)
Chapter 7
8051 CROSS ASSEMBLER MACRO PROCESSOR
7.1 Introduction
Macros are useful for code that is used repetitively throughout the program. It saves the
programmer the time and tedium of having to specify the code every time it is used. The
code is written only once in the macro denition and it can be used anywhere in the source
program any number of times by simply using the macro name.
Sometimes there is confusion between macros and subroutines. Subroutines are common
routines that are written once by the programmer and then accessed by CALLing them.
Subroutines are usually used for longer and more complex routines where the call/return
overhead can be tolerated. Macros are commonly used for simpler routines or where the
speed of in-line code is required.
The name eld contains a unique symbol that it used to identify the macro. Whenever that
symbol is encountered in the source program, the Cross Assembler will automatically insert
the macro body in the source program at that point. The name must be a unique symbol
that follows all the rules of symbol formation as outlined in Chapter 2.
The MACRO eld of the macro header contains the keyword MACRO. This is used to
notify the Cross Assembler that this is the beginning of a macro denition.
The <parameter list> eld of the macro header lists anywhere from zero to 16 parameters
that are used in the macro body and are dened at assembly time. The symbols used in
the parameter list are only used by the Cross Assembler during the storing of the macro
denition. As a result, while symbols used in the parameter list must be unique symbols
44 Chap. 7: 8051 CROSS ASSEMBLER MACRO PROCESSOR
that follow all the the rules of symbol formation as outlined in Chapter 2, they can be
reissued in the parameter list of another macro denition without con
ict. Parameter list
items are separated from one another by a comma. The following are examples of macro
denition headers:
MULT_BY_16 MACRO (no parameters)
DIRECT_ADD MACRO DESTINATION,SOURCE (two parameters)
The macro body contains the template that will replace the macro name in the source pro-
gram. The macro body can contain instructions, directives, conditional assembly statements
or controls. As a matter of fact, the macro body can contain any legal Cross Assembler
construct as dened in Chapters 2, 4, 5 and 6.
There are two macro denition terminators: ENDM and EXITM. Every macro denition
must have an ENDM at the end of its denition to notify the Cross Assembler that the
macro denition is complete. The EXITM terminator is an alternative ending of the macro
that is useful with conditional assembly statements. When a EXITM is encountered in a
program, all remaining statements (to the ENDM) are ignored.
The following is an example of a macro denition that multiplies the Accumulator by 16:
MULT_BY_16 MACRO
RL A ;* 2
RL A ;* 4
RL A ;* 8
RL A ;* 16
ENDM
The following is an example of a macro that adds two numbers together. This could be
used by the programmer to do direct memory to memory adds of external variables (create
a virtual instruction).
DIRECT_ADDX MACRO DESTINATION,SOURCE (two parameters)
MOV R0,#SOURCE
MOVX A,@R0
MOV R1,A
MOV R0,#DESTINATION
MOVX A,@R0
ADD A,R1
MOVX @R0,A
ENDM
A nal macro denition example shows the use of the EXITM macro terminator. If CMOS is
non-zero, the MOV and only the MOV instruction will be translated by the Cross Assembler.
IDLE MACRO
IF (CMOS)
MOV PCON,#IDL
EXITM
ENDIF
JMP $
ENDM
%: when the PERCENT sign prefaces a symbol in the parameter list, the symbol's value
is passed to the macro's body instead of the symbol itself.
!: when the EXCLAMATION POINT precedes a character, that character is handled as a
literal and is passed to the macro body with the EXCLAMATION POINT removed.
This is useful when it is necessary to pass a delimiter to the macro body. For example,
in the following parameter list, the second parameter passed to the macro body would
be a COMMA ( , ):
GENERATE_INST 75,!,,STK_VALUE
&: when the AMPERSAND is used in the macro body, the symbols on both sides of it are
concatenated together and the AMPERSAND is removed.
;;: when double SEMI-COLONS are used in a macro denition, the comment preceded by
the double SEMI-COLONS will not be saved and thus will not appear in the listing
whenever the macro is invoked. Using the double SEMI-COLONS lowers the memory
requirement in storing the macro denitions and should be used whenever possible.
Examples of using the above special macro operators follow in the "Using Macros" section.
ELSE
ADD_EXT_BYTES DESTINATION,SOURCE
MOVX @R0,A
ENDIF
ENDM
;USAGE IN PROGRAM
ADD_DIRECT_BYTES 127,128
;TRANSLATED MACRO
30 +1 ADD_DIRECT_BYTES 127,128
31 +1 IF (SMALL_MODEL)
32 +1 MOV A,128
33 +1 ADD A,127
34 +1 MOV 127
35 +1 ELSE
36 +2 ADD_EXT_BYTES 127,128
37 +3 GET_EXT_BYTE 127
0100 787F 38 +3 MOV R0,#127
0102 E2 39 +3 MOVX A,@R0
0103 F9 40 +2 MOV R1,A
41 +3 GET_EXT_BYTE 128
0104 7880 42 +3 MOV R0,#128
0106 E2 43 +3 MOVX A,@R0
0107 29 44 +2 ADD A,R1
0108 F2 45 +1 MOVX @R0,A
46 +1 ENDIF
48
Two things should be pointed out from the above example. First, the order of the parameter
list is important. You must maintain the the order of parameters from the macro denition
if the Cross Assembler is to translate the macro correctly.
Secondly, in order to pass parameters to nested macros, simply use the same parameter
symbol in the parameter list of the denition. For example, the parameter DESTINA-
TION was passed properly to the nested macros ADD EXT BYTES and GET EXT BYTE.
This occurred because in the macro denition of ADD DIRECT BYTES, the parame-
ter DESTINATION was specied in the parameter lists of both ADD EXT BYTES and
GET EXT BYTE.
LABELS IN MACROS You have two choices for specifying labels in a macro body. A
label can either be passed to the body as a parameter or it can be generated within the
body. The following example shows both ways.
;MACRO DEFINITION
SHIFT&LABEL_SUFFIX: RL A
DJNZ R0,SHIFT&LABEL_SUFFIX
ENDM
;USAGE IN PROGRAM
MULTIPLE_SHIFT LOOP_SHIFT,%COUNT,COUNT,4
;TRANSLATED MACRO
15 +1 MULTIPLE_SHIFT LOOP_SHIFT,%COUNT,COUNT,4
0006 16 +1 COUNT SET COUNT+1
17 +1
0100 7804 18 +1 LOOP_SHIFT: MOV R0,#4
0102 23 19 +1 SHIFT5: RL A
0103 D8FD 20 +1 DJNZ R0,SHIFT5
22
Points to note in the above example: 1) the double semi-colon caused the comment not
to be listed in the translated macro; 2) the percent sign caused the value of COUNT (in
this case the value 5) to be passed to the macro body instead of the symbol; and 3) the
ampersand allowed two symbols to be concatenated to form the label SHIFT5.
48 Chap. 7: 8051 CROSS ASSEMBLER MACRO PROCESSOR
Chapter 8
8051 CROSS ASSEMBLER ERROR CODES
8.1 Introduction
When the Cross Assembler encounters an error in the source program, it will emit an error
message in the listing le. If the $NOPRINT control has been invoked, the error message
will be output to the screen.
There are basically two types of errors that are encountered by the Cross Assembler, trans-
lation errors and I/O errors. I/O errors are usually fatal errors. However, whenever an error
is detected, the Cross Assembler makes every eort possible to continue with the assembly.
If it is possible to recover from the error and continue assembling, the Cross Assembler will
report the error, use a default condition and continue on its way. However, when a fatal
error is encountered, it is impossible for the Cross Assembler to proceed. In this case, the
Cross Assembler reports the error and then aborts the assembly process.
Fatal I/O error messages are displayed on the screen and are of the form:
FATAL ERROR opening <filename>
where <lename> would be replaced with the le designator initially entered or read from
the source program. The cause of this error is usually obvious, typically a typographical
error or the wrong drive specication.
Another fatal I/O error message is:
FATAL ERROR writing to <type> file
where <type> would be replaced with either "listing" or "object". The cause of this error is
usually either a write protected disk or a full disk.
Translation error reports contain at least three lines. The rst line is the source line in which
the error was detected, the second line is a pointer to the character, symbol, expression or
line that caused the error. The nal line is the error message itself. There may be more
than one error message, depending on the number of errors in the source line. An example
of a source line with two errors in it follows:
0100 2323 26 START: MOV AB,@35
****----------------------------------------^---^
****ERROR #20: Illegal operand
****ERROR #20: Illegal operand
The errors are pointed out by the up-arrows ( ^). For every up- arrow there will be an
error message. Errors are ordered left to right, so the rst error message corresponds to
50 Chap. 8: 8051 CROSS ASSEMBLER ERROR CODES
the left-most up-arrow and so on. The error message includes an error number and an
description of the error. The error number can be used as an index to the more detailed
error explanations that follow in this chapter.
After the Cross Assembler has completed its translation process, it will print an assembly
complete message:
ASSEMBLY COMPLETE, nn ERRORS FOUND
If it was an error free assembly, in place of the "nn" above the word "NO" will be output.
However, if errors were encountered during the assembly process, the "nn" will be replaced
with the number of errors that were found (up to a maximum of 50). In this case, an error
summary will follow in the listing le with all the errors that were reported during the
assembly. An error summary looks like the following:
ERROR SUMMARY:
Line #26, ERROR #20: Illegal operand
Line #26, ERROR #20: Illegal operand
The same error message that occurred after the source line appears again prefaced by the
source line number to aid in tracking down the error in the source listing.
During the rst pass, the generic CALL will be replaced with a 3-byte LCALL instruction.
During the second pass, the generic CALL will be replaced with a 2-byte ACALL instruction.
To prevent this kind of problem, use the generic CALLs and JMPs with labeled targets,
not EQU or SET dened symbols.
1 ;
2 ; 8-bit by 8-bit signed multiply--byte signed multiply
3 ;
4 ; This routine takes the signed byte in multiplicand and
5 ; multiplies it by the signed byte in multiplier and places
6 ; the signed 16-bit product in product_high and product_low.
7 ;
8 ; This routine assumes 2s complement representation of signed
9 ; numbers. The maximum numbers possible is then -128 and +127.
10 ; Multiplying the possible maximum numbers together easily fits
11 ; in a 16-bit product, so no overflow test is done on the answer.
12 ;
13 ; Registers altered by routine: A, B, PSW.
14 ;
15 ;
16 ; Primary controls
17 $MOD51
18 $TITLE(BYTE SIGNED MULTIPLY)
19 $DATE(JUL-30-84)
20 $PAGEWIDTH(132)
21 $OBJECT(B:BMULB.OBJ)
22 ;
23 ;
24 ; Variable declarations
25 ;
00F0 26 sign_flag BIT 0F0H ;sign of product
0030 27 multiplier DATA 030H ;8-bit multiplier
Chap. A: SAMPLE PROGRAM AND LISTING 59
The following tables detail the pre-dened byte and bit addresses for the 8051/8031 micro-
controllers supported by the MetaLink family of emulators. Proliferation parts are delimited
from the standard MCS-51 denitions by asterisk ("*") boxes.
This list covers these microcontrollers:
8044 8031 8032 8051 8052 8053 80C154 80C321
8344 80C31 80C32 8751 8752 8753 83C154 80C521
8744 80C51 80C52 85C154 87C521
87C51
************************************************************************
for the 80C321/80C521
DPL1 DATA 084H ;DATA POINTER LOW 1
DPH1 DATA 085H ;DATA POINTER HIGH 1
DPS DATA 086H ;DATA POINTER SELECTION
************************************************************************
************************************************************************
for the 83C152/80C152
GMOD DATA 084H ;GSC MODE
TFIFO DATA 085H ;GSC TRANSMIT BUFFER
************************************************************************
************************************************************************
for the 80C517/80C537
WDTREL DATA 086H ;WATCHDOG TIMER RELOAD REG
************************************************************************
************************************************************************
for the 83C751/83C752
RTL DATA 08BH ;TIMER 0 - LOW BYTE RELOAD
************************************************************************
************************************************************************
for the 83C751/83C752
RTH DATA 08DH ;TIMER 0 - HIGH BYTE RELOAD
************************************************************************
************************************************************************
for the 83C752
PWM DATA 08EH ;PULSE WIDTH MODULATION
************************************************************************
************************************************************************
for the 83C152/80C152
P5 DATA 091H ;PORT 5
DCON0 DATA 092H ;DMA CONTROL 0
DCON1 DATA 093H ;DMA CONTROL 1
BAUD DATA 094H ;GSC BAUD RATE
ADR0 DATA 095H ;GSC MATCH ADDRESS 0
************************************************************************
************************************************************************
for the 80C452/83C452
DCON0 DATA 092H ;DMA CONTROL 0
DCON1 DATA 093H ;DMA CONTROL 1
************************************************************************
************************************************************************
for the 80C517/80C537
DPSEL DATA 092H ;DATA POINTER SELECT REGISTER
************************************************************************
************************************************************************
for the 83C751/83C752
I2CON DATA 098H ;I2C CONTROL
I2DAT DATA 099H ;I2C DATA
************************************************************************
************************************************************************
for the 80C517/80C537
IEN2 DATA 09AH ;INTERRUPT ENABLE REGISTER 2
S1CON DATA 09BH ;SERIAL PORT CONTROL 1
S1BUF DATA 09CH ;SERIAL PORT BUFFER 1
S1REL DATA 09DH ;SERIAL RELOAD REG 1
************************************************************************
Chap. B: PRE-DEFINED BYTE AND BIT ADDRESSES 63
************************************************************************
for the 80C51FA/83C51FA(83C252/80C252)
SADDR DATA 0A9H ;SLAVE INDIVIDUAL ADDRESS
************************************************************************
************************************************************************
for the 80515/80535 and 80C517/80C537
IP0 DATA 0A9H ;INTERRUPT PRIORITY REGISTER 0
************************************************************************
************************************************************************
for the 80C321/80C521
WDS DATA 0A9H ;WATCHDOG SELECTION
WDK DATA 0AAH ;WATCHDOG KEY
************************************************************************
************************************************************************
for the 83C152/80C152
P6 DATA 0A1H ;PORT 6
SARL0 DATA 0A2H ;DMA SOURCE ADDR. 0 (LOW)
SARH0 DATA 0A3H ;DMA SOURCE ADDR. 0 (HIGH)
IFS DATA 0A4H ;GSC INTERFRAME SPACING
ADR1 DATA 0A5H ;GSC MATCH ADDRESS 1
************************************************************************
************************************************************************
for the 80C452/83C452
SARL0 DATA 0A2H ;DMA SOURCE ADDR. 0 (LOW)
SARH0 DATA 0A3H ;DMA SOURCE ADDR. 0 (HIGH)
************************************************************************
************************************************************************
for the 80C552/83C552
CML0 DATA 0A9H ;COMPARE 0 - LOW BYTE
CML1 DATA 0AAH ;COMPARE 1 - LOW BYTE
CML2 DATA 0ABH ;COMPARE 2 - LOW BYTE
CTL0 DATA 0ACH ;CAPTURE 0 - LOW BYTE
CTL1 DATA 0ADH ;CAPTURE 1 - LOW BYTE
CTL2 DATA 0AEH ;CAPTURE 2 - LOW BYTE
CTL3 DATA 0AFH ;CAPTURE 3 - LOW BYTE
************************************************************************
************************************************************************
for the 83C152/80C152
SARL1 DATA 0B2H ;DMA SOURCE ADDR. 1 (LOW)
SARH1 DATA 0B3H ;DMA SOURCE ADDR. 1 (HIGH)
SLOTTM DATA 0B4H ;GSC SLOT TIME
ADR2 DATA 0B5H ;GSC MATCH ADDRESS 2
************************************************************************
************************************************************************
for the 80C452/83C452
SARL1 DATA 0B2H ;DMA SOURCE ADDR. 1 (LOW)
SARH1 DATA 0B3H ;DMA SOURCE ADDR. 1 (HIGH)
************************************************************************
************************************************************************
for the 80C51FA/83C51FA(83C252/80C252)
SADEN DATA 0B9H ;SLAVE ADDRESS ENABLE
************************************************************************
************************************************************************
for the 80515/80535 and 80C517/80C537
IP1 DATA 0B9H ;INTERRUPT PRIORITY REGISTER 1
IRCON DATA 0C0H ;INTERRUPT REQUEST CONTROL
CCEN DATA 0C1H ;COMPARE/CAPTURE ENABLE
CCL1 DATA 0C2H ;COMPARE/CAPTURE REGISTER 1 - LOW BYTE
CCH1 DATA 0C3H ;COMPARE/CAPTURE REGISTER 1 - HIGH BYTE
CCL2 DATA 0C4H ;COMPARE/CAPTURE REGISTER 2 - LOW BYTE
CCH2 DATA 0C5H ;COMPARE/CAPTURE REGISTER 2 - HIGH BYTE
CCL3 DATA 0C6H ;COMPARE/CAPTURE REGISTER 3 - LOW BYTE
CCH3 DATA 0C7H ;COMPARE/CAPTURE REGISTER 3 - HIGH BYTE
T2CON DATA 0C8H ;TIMER 2 CONTROL
CRCL DATA 0CAH ;COMPARE/RELOAD/CAPTURE - LOW BYTE
CRCH DATA 0CBH ;COMPARE/RELOAD/CAPTURE - HIGH BYTE
TL2 DATA 0CCH ;TIMER 2 - LOW BYTE
TH2 DATA 0CDH ;TIMER 2 - HIGH BYTE
************************************************************************
************************************************************************
for the 80C517/80C537
CC4EN DATA 0C9H ;COMPARE/CAPTURE 4 ENABLE
CCL4 DATA 0CEH ;COMPARE/CAPTURE REGISTER 4 - LOW BYTE
CCH4 DATA 0CFH ;COMPARE/CAPTURE REGISTER 4 - HIGH BYTE
************************************************************************
************************************************************************
for the RUPI-44
STS DATA 0C8H ;SIU STATUS REGISTER
SMD DATA 0C9H ;SERIAL MODE
RCB DATA 0CAH ;RECEIVE CONTROL BYTE
RBL DATA 0CBH ;RECEIVE BUFFER LENGTH
RBS DATA 0CCH ;RECEIVE BUFFER START
RFL DATA 0CDH ;RECEIVE FIELD LENGTH
STAD DATA 0CEH ;STATION ADDRESS
DMA_CNT DATA 0CFH ;DMA COUNT
************************************************************************
************************************************************************
for the 8052/8032, 80C51FA/83C51FA(83C252/80C252), 80C154/83C154
T2CON DATA 0C8H ;TIMER 2 CONTROL
************************************************************************
************************************************************************
for the 80C51FA/83C51FA(83C252/80C252)
T2MOD DATA 0C9H ;TIMER 2 MODE CONTROL
************************************************************************
************************************************************************
for the 8052/8032, 80C51FA/83C51FA(83C252/80C252), 80C154/83C154
RCAP2L DATA 0CAH ;TIMER 2 CAPTURE REGISTER, LOW BYTE
RCAP2H DATA 0CBH ;TIMER 2 CAPTURE REGISTER, HIGH BYTE
TL2 DATA 0CCH ;TIMER 2 - LOW BYTE
TH2 DATA 0CDH ;TIMER 2 - HIGH BYTE
************************************************************************
************************************************************************
for the 83C152/80C152
P4 DATA 0C0H ;PORT 4
Chap. B: PRE-DEFINED BYTE AND BIT ADDRESSES 65
************************************************************************
for the RUPI-44
NSNR DATA 0D8H ;SEND COUNT/RECEIVE COUNT
SIUST DATA 0D9H ;SIU STATE COUNTER
TCB DATA 0DAH ;TRANSMIT CONTROL BYTE
TBL DATA 0DBH ;TRANSMIT BUFFER LENGTH
TBS DATA 0DCH ;TRANSMIT BUFFER START
FIFO0 DATA 0DDH ;THREE BYTE FIFO
FIFO1 DATA 0DEH
FIFO2 DATA 0DFH
************************************************************************
************************************************************************
for the 80C51FA/83C51FA(83C252/80C252)
CCON DATA 0D8H ;CONTROL COUNTER
CMOD DATA 0D9H ;COUNTER MODE
CCAPM0 DATA 0DAH ;COMPARE/CAPTURE MODE FOR PCA MODULE 0
CCAPM1 DATA 0DBH ;COMPARE/CAPTURE MODE FOR PCA MODULE 1
CCAPM2 DATA 0DCH ;COMPARE/CAPTURE MODE FOR PCA MODULE 2
66 Chap. B: PRE-DEFINED BYTE AND BIT ADDRESSES
************************************************************************
for the 83C152/80C152
BCRL0 DATA 0E2H ;DMA BYTE COUNT 0 (LOW)
BCRH0 DATA 0E3H ;DMA BYTE COUNT 0 (HIGH)
PRBS DATA 0E4H ;GSC PSEUDO-RANDOM SEQUENCE
AMSK1 DATA 0E5H ;GSC ADDRESS MASK 1
RSTAT DATA 0E8H ;RECEIVE STATUS (DMA & GSC)
************************************************************************
************************************************************************
for the 80C452/83C452
BCRL0 DATA 0E2H ;DMA BYTE COUNT 0 (LOW)
BCRH0 DATA 0E3H ;DMA BYTE COUNT 0 (HIGH)
HSTAT DATA 0E6H ;HOST STATUS
HCON DATA 0E7H ;HOST CONTROL
SLCON DATA 0E8H ;SLAVE CONTROL
SSTAT DATA 0E9H ;SLAVE STATUS
IWPR DATA 0EAH ;INPUT WRITE POINTER
IRPR DATA 0EBH ;INPUT READ POINTER
CBP DATA 0ECH ;CHANNEL BOUNDARY POINTER
FIN DATA 0EEH ;FIFO IN
CIN DATA 0EFH ;COMMAND IN
************************************************************************
************************************************************************
for the 80515/80535
P4 DATA 0E8H ;PORT 4
************************************************************************
************************************************************************
for the 80C451/83C451
CSR DATA 0E8H ;CONTROL STATUS
************************************************************************
************************************************************************
for the 80512/80532
P4 DATA 0E8H ;PORT 4
************************************************************************
************************************************************************
for the 80C552/83C552
IEN1 DATA 0E8H ;INTERRUPT ENABLE REGISTER 1
TM2CON DATA 0EAH ;T2 COUNTER CONTROL
CTCON DATA 0EBH ;CAPTURE CONTROL
TML2 DATA 0ECH ;TIMER 2 - LOW BYTE
TMH2 DATA 0EDH ;TIMER 2 - HIGH BYTE
STE DATA 0EEH ;SET ENABLE
RTE DATA 0EFH ;RESET/TOGGLE ENABLE
************************************************************************
************************************************************************
for the 80C51FA/83C51FA(83C252/80C252)
CL DATA 0E9H ;CAPTURE BYTE LOW
CCAP0L DATA 0EAH ;COMPARE/CAPTURE 0 LOW BYTE
CCAP1L DATA 0EBH ;COMPARE/CAPTURE 1 LOW BYTE
CCAP2L DATA 0ECH ;COMPARE/CAPTURE 2 LOW BYTE
68 Chap. B: PRE-DEFINED BYTE AND BIT ADDRESSES
************************************************************************
for the 80C154/83C154
IOCON DATA 0F8H ;I/O CONTROL REGISTER
************************************************************************
************************************************************************
for the 83C152/80C152
BCRL1 DATA 0F2H ;DMA BYTE COUNT 1 (LOW)
BCRH1 DATA 0F3H ;DMA BYTE COUNT 1 (HIGH)
RFIFO DATA 0F4H ;GSC RECEIVE BUFFER
MYSLOT DATA 0F5H ;GSC SLOT ADDRESS
IPN1 DATA 0F8H ;INTERRUPT PRIORITY REGISTER 1
************************************************************************
************************************************************************
for the 83C851/80C851
EADRL DATA 0F2H ;EEPROM Address Register - Low Byte
EADRH DATA 0F3H ;EEPROM Address Register - High Byte
EDAT DATA 0F4H ;EEPROM Data Register
ETIM DATA 0F5H ;EEPROM Timer Register
ECNTRL DATA 0F6H ;EEPROM Control Register
************************************************************************
************************************************************************
for the 80C452/83C452
BCRL1 DATA 0F2H ;DMA BYTE COUNT 1 (LOW)
BCRH1 DATA 0F3H ;DMA BYTE COUNT 1 (HIGH)
ITHR DATA 0F6H ;INPUT FIFO THRESHOLD
OTHR DATA 0F7H ;OUTPUT FIFO THRESHOLD
IEP DATA 0F8H ;INTERRUPT PRIORITY
MODE DATA 0F9H ;MODE
ORPR DATA 0FAH ;OUTPUT READ POINTER
OWPR DATA 0FBH ;OUTPUT WRITE POINTER
IMIN DATA 0FCH ;IMMEDIATE COMMAND IN
IMOUT DATA 0FDH ;IMMEDIATE COMMAND OUT
FOUT DATA 0FEH ;FIFO OUT
Chap. B: PRE-DEFINED BYTE AND BIT ADDRESSES 69
************************************************************************
for the 83C751/83C752
C/T BIT 08EH ;TCON.6 - COUNTER OR TIMER OPERATION
GATE BIT 08FH ;TCON.7 - GATE TIMER
************************************************************************
************************************************************************
for the 80515/80535
INT3 BIT 090H ;P1.0 - EXT. INTERRUPT 3/CAPT & COMP 0
INT4 BIT 091H ;P1.1 - EXT. INTERRUPT 4/CAPT & COMP 1
INT5 BIT 092H ;P1.2 - EXT. INTERRUPT 5/CAPT & COMP 2
INT6 BIT 093H ;P1.3 - EXT. INTERRUPT 6/CAPT & COMP 3
INT2 BIT 094H ;P1.4 - EXT. INTERRUPT 2
T2EX BIT 095H ;P1.5 - TIMER 2 EXT. RELOAD TRIGGER INP
CLKOUT BIT 096H ;P1.6 - SYSTEM CLOCK OUTPUT
T2 BIT 097H ;P1.7 - TIMER 2 INPUT
************************************************************************
************************************************************************
for the 83C152/80C152
GRXD BIT 090H ;P1.0 - GSC RECEIVER DATA INPUT
GTXD BIT 091H ;P1.1 - GSC TRANSMITTER DATA OUTPUT
DEN BIT 092H ;P1.2 - DRIVE ENABLE TO ENABLE EXT DRIVE
TXC BIT 093H ;P1.3 - GSC EXTERNAL TRANSMIT CLOCK INPU
RXC BIT 094H ;P1.4 - GSC EXTERNAL RECEIVER CLOCK INPU
************************************************************************
************************************************************************
for the 83C552/80C552
CT0I BIT 090H ;P1.0 - CAPTURE/TIMER INPUT 0
CT1I BIT 091H ;P1.1 - CAPTURE/TIMER INPUT 1
CT2I BIT 092H ;P1.2 - CAPTURE/TIMER INPUT 2
CT3I BIT 093H ;P1.3 - CAPTURE/TIMER INPUT 3
T2 BIT 094H ;P1.4 - T2 EVENT INPUT
RT2 BIT 095H ;P1.5 - T2 TIMER RESET SIGNAL
SCL BIT 096H ;P1.6 - SERIAL PORT CLOCK LINE I2C
SDA BIT 097H ;P1.7 - SERIAL PORT DATA LINE I2C
************************************************************************
************************************************************************
for the 80C517/80C537
INT3 BIT 090H ;P1.0 - EXT. INTERRUPT 3/CAPT & COMP 0
INT4 BIT 091H ;P1.1 - EXT. INTERRUPT 4/CAPT & COMP 1
INT5 BIT 092H ;P1.2 - EXT. INTERRUPT 5/CAPT & COMP 2
INT6 BIT 093H ;P1.3 - EXT. INTERRUPT 6/CAPT & COMP 3
INT2 BIT 094H ;P1.4 - EXT. INTERRUPT 2
T2EX BIT 095H ;P1.5 - TIMER 2 EXT. RELOAD TRIGGER INPU
CLKOUT BIT 096H ;P1.6 - SYSTEM CLOCK OUTPUT
T2 BIT 097H ;P1.7 - TIMER 2 INPUT
************************************************************************
************************************************************************
for the 80C452/83C452 and 80C152/83C152
HLD BIT 095H ;P1.5 - DMA HOLD REQUEST I/O
HLDA BIT 096H ;P1.6 - DMA HOLD ACKNOWLEDGE OUTPUT
Chap. B: PRE-DEFINED BYTE AND BIT ADDRESSES 71
************************************************************************
************************************************************************
for the 83C751/83C752
INT0 BIT 095H ;P1.5 - EXTERNAL INTERRUPT 0 INPUT
INT1 BIT 096H ;P1.6 - EXTERNAL INTERRUPT 1 INPUT
T0 BIT 096H ;P1.7 - TIMER 0 COUNT INPUT
************************************************************************
************************************************************************
for the 83C751/83C752
MASTER BIT(READ) 099H ;I2CON.1 - MASTER
STP BIT(READ) 09AH ;I2CON.2 - STOP
STR BIT(READ) 09BH ;I2CON.3 - START
ARL BIT(READ) 09CH ;I2CON.4 - ARBITRATION LOSS
DRDY BIT(READ) 09DH ;I2CON.5 - DATA READY
ATN BIT(READ) 09EH ;I2CON.6 - ATTENTION
RDAT BIT(READ) 09FH ;I2CON.7 - RECEIVE DATA
XSTP BIT(WRITE)098H ;I2CON.0 - TRANSMIT STOP
XSTR BIT(WRITE)099H ;I2CON.1 - TRANSMIT REPEATED START
CSTP BIT(WRITE)09AH ;I2CON.2 - CLEAR STOP
CSTR BIT(WRITE)09BH ;I2CON.3 - CLEAR START
CARL BIT(WRITE)09CH ;I2CON.4 - CLEAR ARBITRATION LOSS
CDR BIT(WRITE)09DH ;I2CON.5 - CLEAR DATA READY
IDLE BIT(WRITE)09EH ;I2CON.6 - GO IDLE
CXA BIT(WRITE)09FH ;I2CON.7 - CLEAR TRANSMIT ACTIVE
************************************************************************
************************************************************************
for the 80515/80535
WDT BIT 0AEH ;IEN0.6 - WATCHDOG TIMER RESET
************************************************************************
************************************************************************
for the 83C552/80C552
ES1 BIT 0ADH ;IEN0.5 - SERIAL PORT 1 INTERRUPT ENABLE
EAD BIT 0AEH ;IEN0.6 - ENABLE A/D INTERRUPT
************************************************************************
************************************************************************
for the 80C517/80C537
ET2 BIT 0ADH ;IEN0.5 - TIMER 2 INTERRUPT ENABLE
WDT BIT 0AEH ;IEN0.6 - WATCHDOG TIMER RESET
************************************************************************
************************************************************************
for the 80C154/83C154
PT2 BIT 0BCH ;IP.5 - TIMER 2 PRIORITY
PCT BIT 0BFH ;IP.7 - INTERRUPT PRIORITY DISABLE
************************************************************************
************************************************************************
for the 80C652/83C652
PS1 BIT 0BDH ;IP.5 - SERIAL PORT 1 PRIORITY
************************************************************************
************************************************************************
for the 80C51FA/83C51FA(83C252/80C252)
PT2 BIT 0BDH ;IP.5 - TIMER 2 PRIORITY
PPC BIT 0BEH ;IP.6 - PCA PRIORITY
************************************************************************
************************************************************************
for the 80515/80535 and 80C517/80C537
EADC BIT 0B8H ;IEN1.0 - A/D CONVERTER INTERRUPT EN
EX2 BIT 0B9H ;IEN1.1 - EXT. INTERRUPT 2 ENABLE
EX3 BIT 0BAH ;IEN1.2 - EXT. INT 3/CAPT/COMP INT 0 EN
EX4 BIT 0BBH ;IEN1.3 - EXT. INT 4/CAPT/COMP INT 1 EN
EX5 BIT 0BCH ;IEN1.4 - EXT. INT 5/CAPT/COMP INT 2 EN
EX6 BIT 0BDH ;IEN1.5 - EXT. INT 6/CAPT/COMP INT 3 EN
SWDT BIT 0BEH ;IEN1.6 - WATCHDOG TIMER START
EXEN2 BIT 0BFH ;IEN1.7 - T2 EXT. RELOAD INTER START
IADC BIT 0C0H ;IRCON.0 - A/D CONVERTER INTER REQUEST
IEX2 BIT 0C1H ;IRCON.1 - EXT. INTERRUPT 2 EDGE FLAG
IEX3 BIT 0C2H ;IRCON.2 - EXT. INTERRUPT 3 EDGE FLAG
Chap. B: PRE-DEFINED BYTE AND BIT ADDRESSES 73
************************************************************************
for the 83C152/80C152
EGSRV BIT 0C8H ;IEN1.0 - GSC RECEIVE VALID
EGSRE BIT 0C9H ;IEN1.1 - GSC RECEIVE ERROR
EDMA0 BIT 0CAH ;IEN1.2 - DMA CHANNEL REQUEST 0
EGSTV BIT 0CBH ;IEN1.3 - GSC TRANSMIT VALID
EDMA1 BIT 0CCH ;IEN1.4 - DMA CHANNEL REQUEST 1
EGSTE BIT 0CDH ;IEN1.5 - GSC TRANSMIT ERROR
************************************************************************
************************************************************************
for the 80512/80532
IADC BIT 0C0H ;IRCON.0 - A/D CONVERTER INTERRUPT REQ
************************************************************************
************************************************************************
for the 83C552/80C552
F1 BIT 0D1H ;PSW.1 - FLAG 1
************************************************************************
************************************************************************
for the 80512/80532
F1 BIT 0D1H ;PSW.1 - FLAG 1
MX0 BIT 0D8H ;ADCON.0 - ANALOG INPUT CH SELECT BIT 0
MX1 BIT 0D9H ;ADCON.1 - ANALOG INPUT CH SELECT BIT 1
MX2 BIT 0DAH ;ADCON.2 - ANALOG INPUT CH SELECT BIT 2
ADM BIT 0DBH ;ADCON.3 - A/D CONVERSION MODE
BSY BIT 0DCH ;ADCON.4 - BUSY FLAG
BD BIT 0DFH ;ADCON.7 - BAUD RATE ENABLE
************************************************************************
************************************************************************
for the 80C51FA/83C51FA(83C252/80C252)
CCF0 BIT 0D8H ;CCON.0 -PCA MODULE 0 INTERRUPT FLAG
CCF1 BIT 0D9H ;CCON.1 -PCA MODULE 1 INTERRUPT FLAG
CCF2 BIT 0DAH ;CCON.2 -PCA MODULE 2 INTERRUPT FLAG
CCF3 BIT 0DBH ;CCON.3 -PCA MODULE 3 INTERRUPT FLAG
CCF4 BIT 0DCH ;CCON.4 -PCA MODULE 4 INTERRUPT FLAG
CR BIT 0DEH ;CCON.6 - COUNTER RUN
CF BIT 0DFH ;PCA COUNTER OVERFLOW FLAG
************************************************************************
************************************************************************
for the RUPI-44
SER BIT 0D8H ;NSNR.0 - RECEIVE SEQUENCE ERROR
NR0 BIT 0D9H ;NSNR.1 - RECEIVE SEQUENCE COUNTER-BIT 0
NR1 BIT 0DAH ;NSNR.2 - RECEIVE SEQUENCE COUNTER-BIT 1
NR2 BIT 0DBH ;NSNR.3 - RECEIVE SEQUENCE COUNTER-BIT 2
SES BIT 0DCH ;NSNR.4 - SEND SEQUENCE ERROR
NS0 BIT 0DDH ;NSNR.5 - SEND SEQUENCE COUNTER-BIT 0
NS1 BIT 0DEH ;NSNR.6 - SEND SEQUENCE COUNTER-BIT 1
Chap. B: PRE-DEFINED BYTE AND BIT ADDRESSES 75
The following is a list of reserved symbols used by the Cross Assembler. These symbols
cannot be redened.
A AB ACALL ADD ADDC AJMP AND ANL
AR0 AR1 AR2 AR3 AR4 AR5 AR6 AR7
BIT BSEG C CALL CJNE CLR CODE CPL
CSEG DA DATA DB DBIT DEC DIV DJNZ
DPTR DS DSEG DW END EQ EQU GE
GT HIGH IDATA INC ISEG JB JBC JC
JMP JNB JNC JNZ JZ LCALL LE LJMP
LOW LT MOD MOV MOVC MOVX MUL NE
NOP NOT OR ORG ORL PC POP PUSH
R0 R1 R2 R3 R4 R5 R6 R7
RET RETI RL RLC RR RRC SET SETB
SHL SHR SJMP SUBB SWAP USING XCH XCHD
XDATA XOR XRL XSEG
80 Chap. C: RESERVED SYMBOLS
Appendix D
CROSS ASSEMBLER CHARACTER SET
---------------------------+----------------+-------------------
| PRINTABLE | ASCII CODE
CHARACTER NAME | FORM | HEX | DECIMAL
---------------------------+----------------+---------+----------
Horizontal Tab | | 09 | 9
Line Feed | | 0A | 10
Carriage Return | | 0D | 13
Space | | 20 | 32
Exclamation Point | ! | 21 | 33
Pound Sign | # | 23 | 35
Dollar Sign | $ | 24 | 36
Percent Sign | % | 25 | 37
Ampersand | & | 26 | 38
Apostrophe | ' | 27 | 39
Left Parenthesis | ( | 28 | 40
Right Parenthesis | ) | 29 | 41
Asterisk | * | 2A | 42
Plus sign | + | 2B | 43
Comma | , | 2C | 44
Hyphen | - | 2D | 45
Period | . | 2E | 46
Slash | / | 2F | 47
Number 0 | 0 | 30 | 48
" 1 | 1 | 31 | 49
" 2 | 2 | 32 | 50
" 3 | 3 | 33 | 51
" 4 | 4 | 34 | 52
" 5 | 5 | 35 | 53
" 6 | 6 | 36 | 54
" 7 | 7 | 37 | 55
" 8 | 8 | 38 | 56
" 9 | 9 | 39 | 57
Colon | : | 3A | 58
Semi-colon | ; | 3B | 59
Left Angle Bracket | < | 3C | 60
Equal Sign | = | 3D | 61
Right Angle Bracket | > | 3E | 62
Question Mark | ? | 3F | 63
At Sign | @ | 40 | 64
Upper Case A | A | 41 | 65
" " B | B | 42 | 66
" " C | C | 43 | 67
" " D | D | 44 | 68
" " E | E | 45 | 69
82 Chap. D: CROSS ASSEMBLER CHARACTER SET
" " F | F | 46 | 70
" " G | G | 47 | 71
" " H | H | 48 | 72
---------------------------+----------------+-------------------
| PRINTABLE | ASCII CODE
CHARACTER NAME | FORM | HEX | DECIMAL
---------------------------+----------------+---------+----------
Upper Case I | I | 49 | 73
" " J | J | 4A | 74
" " K | K | 4B | 75
" " L | L | 4C | 76
" " M | M | 4D | 77
" " N | N | 4E | 78
" " O | O | 4F | 79
" " P | P | 50 | 80
" " Q | Q | 51 | 81
" " R | R | 52 | 82
" " S | S | 53 | 83
" " T | T | 54 | 84
" " U | U | 55 | 85
" " V | V | 56 | 86
" " W | W | 57 | 87
" " X | X | 58 | 88
" " Y | Y | 59 | 89
" " Z | Z | 5A | 90
Underscore | _ | 5F | 95
Lower Case A | a | 61 | 97
" " B | b | 62 | 98
" " C | c | 63 | 99
" " D | d | 64 | 100
" " E | e | 65 | 101
" " F | f | 66 | 102
" " G | g | 67 | 103
" " H | h | 68 | 104
" " I | i | 69 | 105
" " J | j | 6A | 106
" " K | k | 6B | 107
" " L | l | 6C | 108
" " M | m | 6D | 109
" " N | n | 6E | 110
" " O | o | 6F | 111
" " P | p | 70 | 112
" " Q | q | 71 | 113
" " R | r | 72 | 114
" " S | s | 73 | 115
" " T | t | 74 | 116
" " U | u | 75 | 117
" " V | v | 76 | 118
" " W | w | 77 | 119
" " X | x | 78 | 120
" " Y | y | 79 | 121
" " Z | z | 7A | 122
XSA-100 Prototyping Board
XSA-100 The XSA-100 Board keeps the same form-factor as our popular XS40 Boards
while increasing the logic density to 100,000 gates with a SpartanII FPGA. The
FPGA is combined with a 16 MByte synchronous DRAM and 256 KByte Flash
● XC2S100 FPGA
to give you the resources for building a complete, soft-core RISC
● XC9572XL CPLD
microcontroller system! Or anything else you might think of...
● 16 MByte SDRAM
● 256 KByte Flash
● 100 MHz programmable The bitstream for the XSA-100 can be stored in the on-board 256 KByte Flash
oscillator so the FPGA loads its configuration as soon as power is applied. Or you can
● Parallel port download directly to the board through the parallel port with the XSTOOLs
● Keyboard/mouse PS/2 port utilities we provide. The interface CPLD on the XSA-100 also supports
● 64-color VGA port downloading with XILINX iMPACT and circuit test/debug with ChipScope
● 7-segment LED software using our simple downloading cable. No more expensive XILINX
● 1 pushbutton cables!
● 4 DIP switches
● 84-pin prototyping interface In addition to the large FPGA, SDRAM and Flash chips, you also get a VGA
(53 I/O pins) port that produces vivid graphics in 64 colors. And the prototyping header gives
● 5V-tolerant I/O you 53 general-purpose I/O pins for building interfaces to external devices.
● 9V DC power jack
● 5V / 3.3V / 2.5V regulators
And the XSA-100 helps you maintain your investment. Use your existing
● Downloading cable
XStend Boards to add a stereo codec, LEDs, switches, and a dedicated
● XSTOOLs utilities CDROM
prototyping area to the XSA-100. And keep your power supplies - the XSA-100
● Works with the XST-1.x and
has the same power connections as an XS40 Board.
XST-2.x Boards
● Works with XILINX ISE,
WebPACK, iMPACT and Think it will be a big switch to move from the XS40 Boards to the XSA-100?
ChipScope software Well, we provide all the software utilities for programming the FPGA, setting the
oscillator frequency, and downloading and uploading the RAM and Flash. And
we make all the source code available for you to play with! How about design
examples? We have parameterized modules for interfacing to the PS/2
keyboard port, displaying images through the VGA port, and reading/writing to
the synchronous DRAM as if it were a simple static RAM. And we will be
adapting all the chapters of our Pragmatic Logic Design online text to support
the XSA-100.
The XS40-010XL Board is perfect for experimenting with FPGA designs,
microcontroller programming, or hardware/software codesign. The 20,000-gate
XC4010XL FPGA operates at 3.3V but is 5V-tolerant so you can connect it to
commonly available TTL chips. Digital logic designs can be loaded into the
FPGA. The microcontroller can use the FPGA as a coprocessor. The SRAM
can store microcontroller programs/data or serve as general-purpose storage
for FPGA-based designs.
All rights reserved. No part of this publication may be reproduced, stored in a retrieval
system, or transmitted, in any form or by any means, electronic, mechanical,
photocopying, recording, or otherwise, without the prior written permission of the publisher.
Printed in the United States of America.
Preliminaries .....................................................................................................4
Getting Help!.................................................................................................4
Installation .........................................................................................................6
Programming ..................................................................................................13
Downloading Designs into the FPGA and CPLD of Your XSA Board ....13
Flash RAM..................................................................................................24
PS/2 Port.....................................................................................................25
Pushbutton..................................................................................................26
XSA Schematics.............................................................................................32
If you can't get the XSA Board hardware to work, send an e-mail message describing
your problem to help@xess.com or submit a problem report at
http://www.xess.com/help.html. Our web site also has
answers to frequently-asked-questions,
a place to sign-up for our email forum where you can post questions to other XS
Board users.
If you can't get your Xilinx WebPACK software tools installed properly, send an e-mail
message describing your problem to hotline@xilinx.com or check their web site at
http://www.xilinx.com/support/support.htm.
If you need help using the WebPACK software to create designs for your XSA Board,
then check out this tutorial.
Take notice!!
The XSA Board requires an external power supply to operate! It does not draw power
through the downloading cable from the PC parallel port.
If you are connecting a 9VDC power supply to your XSA Board, please make sure the
center terminal of the plug is positive and the outer sleeve is negative.
Do not power your XSA Board with a battery! This will not provide enough current to
insure reliable operation of the XSA Board.
an XSA Board;
an XSTOOLS CDROM with software utilities and documentation for using the XSA
Board.
Xilinx currently provides the WebPACK tools for programming their CPLDs and Spartan-II
FPGAs. The XESS CDROM contains a version of WebPACK that will generate bitstream
configuration files compatible with your XSA Board. You can also download the most
current version of the WebPACK tools from the Xilinx website..
In addition, XESS Corp. provides the XSTOOLS utilities for interfacing a PC to your XSA
Board. Run the SETUP.EXE program on the XSTOOLS CDROM to install these utilities.
You can use your XSA Board in three ways, distinguished by the method you use to apply
power to the board.
You can use your XSA Board all by itself to experiment with logic designs. Just place the
XSA Board on a non-conducting surface as shown in Figure 1. Then apply power to jack
J5 of the XSA Board from a 9V DC wall-mount power supply with a 2.1 mm female,
center-positive plug. (See Figure 2 for the location of jack J5 on your XSA Board.) The
on-board voltage regulation circuitry will create the voltages required by the rest of the
XSA Board circuitry. Be careful!! The voltage regulators on the XSA Board will
become hot. Attach a heat sink to them if necessary.
You can use your XSA Board with a laptop PC by connecting a PS/2 male-to-male cable
from the PS/2 port of the laptop to the J4 connector. You must also have a shunt across
pins 1 and 2 of jumper J7. The on-board voltage regulation circuitry will create the
voltages required by the rest of the XSA Board circuitry. Many PS/2 ports cannot
supply more than 0.5A so large, fast FPGA designs may not work when using
this power source!
The two rows of pins from your XSA Board can be plugged into a solderless protoboard
with holes spaced at 0.1" intervals. (One of the A.C.E. protoboards from 3M is a good
choice.) Once plugged in, many of the pins of the FPGA are accessible to other circuits
on the protoboard. (The numbers printed next to the rows of pins on your XSA Board
Parallel Port
PS/2
9V DC
VGA
J8
External
Clock Input J7
J9
100 MHz Osc. J6 9VDC Power Supply
J5
SW1 +3.3V
GND
Pushbutton U15
CPLD
Flash RAM
+5V
J2
SDRAM
J4 J3
The 6' DB25 male-to-male cable included with your XSA Board connects it to a PC. One
end of the cable attaches to the parallel port on the PC and the other connects to the
female DB-25 connector (J8) at the top of the XSA Board as shown in Figure 1.
You can display images on a VGA monitor by connecting it to the 15-pin J3 connector at
the bottom of your XSA Board (see Figure 1). You will have to create a VGA driver circuit
for your XSA Board to actually display an image. You can find an example VGA driver at
http://www.xess.com/ho03000.html.
You can accept inputs from a keyboard or mouse by connecting it to the J4 PS/2
connector at the bottom of your XSA Board (see Figure 1). You can find an example
keyboard driver at http://www.xess.com/ho03000.html.
If you purchased the optional XST-2.x Board, then the XSA Board is inserted as shown
below. Refer to the XST-2.x Board Manual for more details.
The default jumper settings shown in Table 2 configure your XSA Board for use in a logic
design environment. You will need to change the jumper settings only if you are:
downloading FPGA bitstreams to your XSA Board using the Xilinx iMPACT software;
Once your XSA Board is installed and the jumpers are in their default configuration, you
can test the board using the GUI-based GXSTEST utility as follows.
You start GXSTEST by clicking on the icon placed on the desktop during the
XSTOOLS installation. This brings up the window shown below.
Next you select the parallel port that your XSA Board is connected to from the Port
pulldown list. GXSTEST starts with parallel port LPT1 as the default, but you can also
select LPT2 or LPT3 depending upon the configuration of your PC.
After selecting the parallel port, you select either the XSA-50 or XSA-100 item in the Board
Type pulldown list. Then click on the TEST button to start the testing procedure.
GXSTEST will configure the FPGA to perform a test procedure on your XSA Board.
If your XSA Board fails the test, you will be shown a checklist of common causes for
failure. If none of these causes applies to your situation, then test the XSA Board using
another PC. In our experience, 99.9% of all problems are due to the parallel port. If you
cannot get your board to pass the test even after taking these steps, then contact XESS
Corp for further assistance.
As a result of testing the XSA Board, the CPLD is programmed with the standard parallel
port interface found in the dwnldpar.svf bitstream file located within the XSTOOLS\XSA
folder. This is the standard interface that should be loaded into the CPLD when you want
to use it with the GXSLOAD utility.
The XSA Board has a 100 MHz programmable oscillator (a Dallas Semiconductor
DS1075Z-100). The 100 MHz master frequency can be divided by factors of 1, 2, ... up to
2052 to get clock frequencies of 100 MHz, 50 MHz, ... down to 48.7 KHz, respectively.
The divided frequency is sent to the rest of the XSA Board circuitry as a clock signal.
The divisor is stored in non-volatile memory in the oscillator chip so it will resume
operation at its programmed frequency whenever power is applied to the XSA Board. You
can store a particular divisor into the oscillator chip by using the GUI-based GXSSETCLK
as follows.
You start GXSSETCLK by clicking on the icon placed on the desktop during
the XSTOOLS installation. This brings up the window shown below.
Your next step is to select the parallel port that your XSA Board is connected to from the
Port pulldown list. Then select either XSA-50 or XSA-100 in the Board Type pulldown list.
Next you enter a divisor between 1 and 2052 into the Divisor text box and then click on the
SET button. Then follow the sequence of instructions given by XSSETCLK for moving
shunts and removing and restoring power during the oscillator programming process. At
the completion of the process, the new frequency will be programmed into the DS1075.
An external clock signal can be substituted for the internal 100 MHz oscillator of the
DS1075. Checking the External Clock checkbox will enable this feature in the
Downloading Designs into the FPGA and CPLD of Your XSA Board
During the development and testing phases, you will usually connect the XSA Board to the
parallel port of a PC and download your circuit each time you make changes to it. You
can download a Spartan-II FPGA design into your XSA Board using the GXSLOAD utility
as follows.
You start GXSLOAD by clicking on the icon placed on the desktop during the
XSTOOLS installation. This brings up the window shown below. Then select the type of
XS Board you are using and the parallel port to which it is connected as follows.
Once you release the left mouse button and drop the file, the highlighted file name
appears in the FPGA/CPLD area and the Load button in the GXSLOAD window is
enabled. Clicking on the Load button will begin sending the highlighted file to the XSA
Board through the parallel port connection. .BIT files contain configuration bitstreams that
are loaded into the FPGA while .SVF files will go to the CPLD. GXSLOAD will reject any
non-downloadable files (ones with a suffix other than .BIT or .SVF). During the
downloading process, GXSLOAD will display the name of the file and the progress of the
current download.
Double-clicking the highlighted file will deselect it so no file will be downloaded Doing this
disables the Load button.
The Spartan-II FPGA on the XSA Board stores its configuration in an on-chip SRAM
which is erased whenever power is removed. Once your design is finished, you may want
to store the bitstream in the 256-KByte Flash device on the XSA Board which configures
the FPGA for operation as soon as power is applied.
Before downloading to the Flash, the FPGA .BIT file must be converted into a .EXO or
.MCS format using one of the following commands:
In the commands shown above, the bitstream in the file.bit file is transformed into an .EXO
or .MCS file format starting at address zero and proceeding upward until an upper limit of
256 KBytes is reached.
Before attempting to program the Flash, you must place all four DIP switches
into the OFF position!
After the .EXO or .MCS file is generated, it is loaded into the Flash device by dragging it
into the Flash/EEPROM area and clicking on the Load button. This activates the following
sequence of steps:
3. The contents of the .EXO or .MCS file are downloaded into the Flash through the
parallel port.
4. The CPLD is reprogrammed to create a circuit that configures the FPGA with the
contents of the Flash when power is applied to the XSA Board. (This
configuration loader is stored in the fcnfg.svf bitstream file located within the
XSTOOLS\XSA folder.)
Multiple files can be stored in the Flash device just by dragging them into the
Flash/EEPROM area, highlighting the files to be downloaded and clicking the Load button.
(Note that anything previously stored in the Flash will be erased by each new download.)
This is useful if you need to store information in the Flash in addition to the FPGA
bitstream. Files are selected and de-selected for downloading just by clicking on their
names in the Flash/EEPROM area. The address ranges of the data in each file
should not overlap or this will corrupt the data stored in the Flash device!
2. The Flash data between the high and low addresses (inclusive) is uploaded
through the parallel port.
3. The uploaded data is stored in a file named FLSHUPLD with an extension that
reflects the file format.
MCS: Intel hexadecimal file format. This is the same format generated by the promgen
utility with the –p mcs option.
EXO-16: Motorola S-record format with 16-bit addresses (suitable for 64 KByte uploads
only).
EXO-24: Motorola S-record format with 24-bit addresses. This is the same format
generated by the promgen utility with the –p exo option.
XESS-16: XESS hexadecimal format with 16-bit addresses. (This is a simplified file
format that does not use checksums.)
After the data is uploaded from the Flash, the CPLD on the XSA Board is left with the
Flash interface programmed into it. You will need to reprogram the CPLD with either the
parallel port or Flash configuration circuit before the board will function again. The CPLD
configuration bitstreams are stored in the following files:
XSTOOLS\XSA\dwnldpar.svf: Drag & drop this file into the FPGA/CPLD area and click on
the Load button to put the XSA in a mode where it will configure the FPGA through
the parallel port.
XSTOOLS\XSA\ fcnfg.svf: Drag & drop this file into the FPGA/CPLD area and click on the
Load button to put the XSA in a mode where it will configure the FPGA with the
contents of the Flash device upon power-up.
The XSA-100 Board contains a 16-MByte synchronous DRAM (8M x 16 SDRAM) whose
contents can be downloaded and uploaded by GXSLOAD. (The XSA-50 has an 8-MByte
SDRAM organized as 4M x 16.) This is useful for initializing the SDRAM with data for use
by the FPGA and then reading the SDRAM contents after the FPGA has operated upon it.
The SDRAM is loaded with data by dragging & dropping one or more .EXO, .MCS, .HEX,
and/or .XES files into the RAM area of the GXSLOAD window and then clicking on the
Load button. This activates the following sequence of steps:
2. The contents of the .EXO, .MCS, .HEX or .XES files are downloaded into the
SDRAM through the parallel port. The data in the files will overwrite each
other if their address ranges overlap.
3. If any file is highlighted in the FPGA/CPLD area, then this bitstream is loaded into
the FPGA or CPLD on the XSA Board. Otherwise the FPGA remains configured
as an interface between the PC and the SDRAM.
You can also examine the contents of the SDRAM device by uploading it to the PC. To
upload data from an address range in the SDRAM, type the upper and lower bounds of
the range into the High Address and Low Address fields below the RAM area, and select
the format in which you would like to store the data using the Upload Format pulldown list.
Then click on the file icon and drag & drop it into any folder. This activates the following
sequence of steps:
2. The SDRAM data between the high and low addresses (inclusive) is uploaded
through the parallel port.
The 16-bit data words in the SDRAM are mapped into the eight-bit data format of the
.HEX, .MCS, .EXO and .XES files using a Big Endian style. That is, the 16-bit word at
address N in the SDRAM is stored in the eight-bit file with the upper eight bits at location
2N and the lower eight bits at location 2N+1. This byte-ordering applies for both RAM
uploads and downloads.
XC2S50 or XC2S100 Spartan-II FPGA: This is the main repository of programmable logic
on the XSA Board.
XC9572XL CPLD: This CPLD manages the interface between the PC parallel port and the
rest of the XSA Board.
Osc: A programmable oscillator generates the master clock for the XSA Board.
Flash: A 128 or 256-KByte Flash device provides non-volatile storage for data and
configuration bitstreams.
LED: A seven-segment LED allows visible feedback as the XSA Board operates.
DIP switch: A four-position DIP switch passes settings to the XSA Board or controls the
upper address bits of the Flash device.
Parallel Port: This is the main interface for passing configuration bitstreams and data to
and from the XSA Board.
PS/2 Port: A keyboard or mouse can interface to the XSA Board through this port.
VGA Port: The XSA Board can send signals to display graphics on a VGA monitor through
this port.
FLASH
/RESET
A17-A0
D7-D0
/WE
/OE
/CE
Parallel Port
2 - PPD0
8
XC9572XL A17 - A0 XC2S100 D15 - D0 SDRAM
3 - PPD1
4 - PPD2 D7 - D0 D7-D0 BA1 - BA0, A12 - A0
5 - PPD3
6 - PPD4 RAS, CAS, /CS, /WE
7 - PPD5 DQMH
CCLK
8 - PPD6 DQML
/PROGRAM
9 - PPD7 CKE
/INIT
17 - PPC3 TDI CLK
M0
16 - PPC2 TMS GCLK
M1
14 - PPC1 TCK PS/2 Port
M2
11 - PPS7 TDO PSCLK
/CS
12 - PPS5 PSDATA
/WR
13 - PPS4
BSY/DOUT
15 - PPS3
DONE
TCK RED1 - RED0
TMS
GCLK GREEN1 - GREEN0
OSC TDI
TDO BLUE1 - BLUE0
GCLK /HSYNC
/VSYNC
1 - PPC0
10 - PPS6
VGA Connector
A Xilinx XC9572XL CPLD is used to manage the configuration of the FPGA via the
parallel port. The CPLD also controls the programming of the Flash RAM on the XSA
Board.
A Dallas DS1075 programmable oscillator provides a clock signal to both the FPGA and
the CPLD. The DS1075 has a maximum frequency of 100 MHz that is divided to provide
frequencies of 100 MHz, 50 MHz, 33.3 MHz, 25 MHz, ..., 48.7 KHz. The clock signal from
the DS1075 is connected to a dedicated clock input of the CPLD. The CPLD passes the
clock signal on to the FPGA. This allows the CPLD to control the clock source for the
FPGA.
The shunt on jumper J6 must be across pins 2 and 3 to make the oscillator output a clock
signal upon power-up. The clock signal enters a dedicated clock input of the CPLD. Then
the CPLD can output a clock signal to a dedicated clock input of the FPGA.
To get a precise frequency value or to sync the XSA circuitry with an external system, you
can insert an external clock signal of up to 50 MHz through pin 64 of the prototyping
header. This external clock takes the place of the internal 100 MHz clock source in the
DS1075 oscillator. You must use the GXSSETCLK software utility to enable the external
clock input of the DS1075.
Clock signals can also be directly applied to two of the dedicated clock inputs of the FPGA
through the pins of the prototyping header.
+5V
PP-C0
1
J6
Pin 64 2
DS1075
3 17 42 88 18 Pin 1
100 MHz
Prog. Osc.
XC9572XL Spartan-II
CPLD FPGA
15 Pin 31
The various SDRAM organizations and manufacturers used on the XSA Boards are given
in the following table.
SDRAM
Board
Organization Manufacturer & Part No.
4M x 16 Hynix HY57V641620HGT-H
XSA-50
4M x 16 Samsung K4S641632F-TC75000
8M x 16 Hynix HY57V281620HCT-H
XSA-100
8M x 16 Samsung K4S281632E-TC75000
The SDRAM is connected to the FPGA as shown below. Currently, FPGA pin 133 drives
a no-connect pin of the SDRAM but this could be used in the future as the thirteenth
row/column address bit of a larger SDRAM. Also, the SDRAM clock signal is re-routed
back to a dedicated clock input of the FPGA to allow synchronization of the FPGA’s
internal operations with the SDRAM operations.
95 Q0
99 Q1
101 Q2
103 Q3
113 Q4
115 Q5
117 Q6
120 Q7
121 Q8
118 Q9
116 Q10
114 Q11
8M X 16 SDRAM (XSA-100)
112 Q12
4M X 16 SDRAM (XSA-50)
102 Q13
100 Q14
96 Q15
Spartan-II FPGA
141 A0
4 A1
6 A2
10 A3
11 A4
7 A5
5 A6
3 A7
140 A8
138 A9
139 A10
136 A11
133 NC
134 BA0
137 BA1
123 /WE
132 /CS
130 /RAS
126 /CAS
124 DQMH
122 DQML
131 CKE
129 CLK
91
The Flash RAM organizations and manufacturer used on the XSA Boards are given in the
following table.
Flash RAM
Board
Organization Manufacturer & Part No.
The Flash RAM is connected so both the FPGA and CPLD have access. Typically, the
CPLD will program the Flash with data passed through the parallel port. If the data is an
FPGA configuration bitstream, then the CPLD can be configured to program the FPGA
with the bitstream from Flash whenever the XSA Board is powered up. (See the
application note XSA Flash Programming and SpartanII Configuration for more details on
this.) After power-up, the FPGA can read and/or write the Flash. (Of course, the CPLD
and FPGA have to be programmed such that they do not conflict if both are trying to
access the Flash.) The Flash is disabled by raising the /CE pin to a logic 1 thus making
the I/O lines connected to the Flash available for general-purpose communication
between the FPGA and the CPLD.
A10
A11
A12
A13
A14
A15
A16
A17
/WE
/OE
/CE
D0
D1
D2
D3
D4
D5
D6
D7
A0
A1
A2
A3
A4
A5
A6
A7
A8
A9
11 41
12 43
49 58
50 59
1 40
64 29
63 28
62 27
61 74
60 75
XC9572XL CPLD
59 76
Spartan-II FPGA
58 66
45 50
44 48
57 42
43 47
56 65
46 51
47 54
52 64
51 63
48 56
2 39
4 44
5 46
6 49
7 57
8 60
9 62
10 67
+5V
S0
S2
S3 S6
S5
S6
S4
DP
S1
8
S5
S2 S3 S1
S0
S4
DP
DIPSW1
DIPSW2
DIPSW3
DIPSW4
The XSA Board has a 7-segment LED digit for use by the FPGA or the CPLD. The
segments of this LED are active-high meaning that a segment will glow when a logic-high
is applied to it.
The LED shares the same pins as the eight bits of the Flash RAM data bus.
The XSA Board has a bank of four DIP switches accessible from the CPLD and FPGA.
When closed or ON, each switch pulls the connected pin of the FPGA and CPLD to
ground. Otherwise, the pin is pulled high through a resistor when the switch is open or
OFF.
When not being used, the DIP switches should be left in the open or OFF
configuration so the pins of the FPGA and CPLD are not tied to ground and can
freely move between logic low and high levels.
The DIP switches also share the same pins as the uppermost four bits of the Flash RAM
address bus. If the Flash RAM is programmed with several FPGA bitstreams, then the
DIP switches can be used to select a particular bitstreams which will be loaded into the
FPGA by the CPLD on power-up. However, this feature is not currently supported by the
CPLD configuration that loads the FPGA from the Flash RAM (XSTOOLS\XSA\fcnfg.svf).
PS/2 Port
The XSA Board provides a PS/2-style interface (mini-DIN connector J4) to either a
keyboard or a mouse. The FPGA receives two signals from the PS/2 interface: a clock
signal and a serial data stream that is synchronized with the falling edge of the clock.
+5V
clk PS/2
Spartan-II 94
data Connector
FPGA 93
(J4)
Pushbutton
(SW2)
The XSA Board has a single pushbutton that shares the FPGA pin connected to the data
line of the PS/2 port. The pushbutton applies a low level to the FPGA pin when pressed
and a resistor pulls the pin to a high level when the pushbutton is not pressed.
The FPGA can generate a video signal for display on a VGA monitor. When the FPGA is
generating VGA signals, the FPGA outputs two bits each of red, green, and blue color
information to a simple resistor-ladder DAC. The outputs of the DAC are sent to the RGB
inputs of a VGA monitor along with the horizontal and vertical sync pulses (/HSYNC,
/VSYNC) from the FPGA.
26 vsync
23 hsync
RED0
12
Spartan-II 13
RED1 red VGA
FPGA 19
GREEN0 Connector
20
GREEN1 green (J3)
BLUE0
21
BLUE1
22 blue
The parallel port is the main interface for communicating with the XSA Board. Control line
C0 goes directly to the DS1075 oscillator and is used for setting the divisor as described
previously, and status line S6 connects directly to the FPGA for use as a communication
line from the FPGA back to the PC. The CPLD handles the fifteen remaining active lines
of the parallel port as follows.
Three of the parallel port control lines, C1–C3, connect to the JTAG pins through which
the CPLD is programmed. The C1 control line clocks configuration data presented on the
C3 line into the CPLD while the C2 signal steers the actions of the CPLD programming
state machine. Meanwhile, information from the CPLD returns to the PC through status
line S7.
The eight data lines, D0–D7, and the remaining three status lines, S3–S5, connect to
general-purpose pins of the CPLD. The CPLD can be programmed to act as an interface
between the FPGA and the parallel port (the dwnldpar.svf file is an example of such an
interface). Schmitt-trigger inverters are inserted into the D1 line so it can carry a clean
clock edge for use by any state machine programmed into the CPLD. The CPLD
connects to the configuration pins of the Spartan-II FPGA so it can pass bitstreams from
the parallel port to the FPGA. The actual configuration data is presented to the FPGA on
the same 8-bit bus that also connects to the Flash RAM and seven-segment LED. The
CPLD also drives the configuration pins (CCLK, /PROGRAM, /CS, and /WR) of the FPGA
The CPLD also has access to the FPGA’s JTAG pins: TCK, TMS, TDI, TDO. The TMS,
TDI, and TDO pins share the connections with the BSY/DOUT, /CS, and /WR pins. With
these connections, the CPLD can be programmed with an interface that allows
configuration of the Spartan-II FPGA through the Xilinx iMPACT software. Jumper J9
allows the connection of status pin S7 to the general-purpose CPLD pin that also drives
status pin S5. This is required by the iMPACT software so it can check for the presence of
the downloading cable.
FLASH RAM
8
XC9572XL Spartan-II FPGA
Parallel Port D7 - D0
2 - PPD0 33
3 - PPD1 32
4 - PPD2 31 CCLK
16 37
5 - PPD3 27 /PROGRAM
39 69
6 - PPD4 25 /INIT
38 68
7 - PPD5 24 M0
36 109
8 - PPD6 23 M1
9 - PPD7 22 M2
17 - PPC3 TDI
28 /CS
TMS 15 31
16 - PPC2 29 /WR
TCK 19 30
14 - PPC1 30 BSY/DOUT
TDO 18 38
11 - PPS7 53 DONE
40 72
12 - PPS5 35 TCK
13 2
13 - PPS4 20 TMS
142
15 - PPS3 34 TDI
OSC 32
TDO
34
1 - PPC0 78
10 - PPS6
After the SpartanII FPGA is configured with a bitstream and the DONE pin goes high, the
CPLD switches into a mode that connects the parallel port data and status pins to the
FPGA. This lets you pass data to the FPGA over the parallel port data lines while
/RESET
A10
A11
A12
A13
A14
A15
A16
A17
/WE
/OE
/CE
D0
D1
D2
D3
D4
D5
D6
D7
A0
A1
A2
A3
A4
A5
A6
A7
A8
A9
11 41
D7 22 12 43
D6 23 49 58
50 59
S3 34 1 40
S4 20 64 29
S5 35 63 28
62 27
61 74
60 75
XC9572XL CPLD
59 76
Spartan-II FPGA
58 66
D0 33 45 50
D1 32 44 48
D2 31 57 42
D3 27 43 47
D4 25 56 65
D5 24 46 51
47 54
52 64
51 63
48 56
2 39
4 44
5 46
6 49
7 57
8 60
9 62
10 67
+5V
S0
S2
S3 S6
S5
S6
S4
DP
S1
8
S5
S2 S3 S1
S0
S4
DP
DIPSW1
DIPSW2
DIPSW3
DIPSW4
The FPGA sends data back to the PC by driving logic levels onto pins 40, 29 and 28
which pass through the CPLD and onto the parallel port status lines S3, S4 and S5,
respectively. Conversely, the PC sends data to the FPGA on parallel port data lines D0–
D7 and the data passes through the CPLD and ends up on FPGA pins 50, 48, 42, 47, 65,
51, 58 and 43, respectively. The FPGA should never drive these pins unless it is
accessing the Flash RAM otherwise the CPLD and/or the FPGA could be damaged. The
CPLD can sense when the FPGA lowers the Flash RAM chip-enable and it will release
the data lines so the FPGA can drive the address, output-enable and write-enable pins of
the Flash RAM without contention.
The CPLD also drives the decimal-point of the LED display to indicate when the FPGA is
configured with a valid bitstream. Unless it is accessing the Flash RAM, the FPGA should
never drive pin 44 to a low logic level or it may damage itself or the CPLD. But when the
For more details on how the CPLD manages the interface between the parallel port and
the SpartanII FPGA both before and after device configuration, see the XSA Parallel Port
Interface application note.
Prototyping Header
The pins of the FPGA are accessible through the 84-pin prototyping header on the
underside of the XSA Board. Pin 1 of the header (denoted by a square pad) is located in
the middle of the left-hand edge of the board and the remaining 83 pins are arranged
counter-clockwise around the periphery. The physical dimensions of the prototyping
header and the pin arrangement are shown below.
1.75"
64 63
0.1"
84 4.1"
1
21 22
A subset of the 144 pins on the FPGA’s TQFP package connects to the prototyping
header. The number of the FPGA pin connected to a given header pin is printed next to
the header pin on the board. This makes it easier to find a given FPGA pin when you
want to connect it to an external system. While most of the FPGA pins are already used
to support functions of the XSA Board, they can also be used to interface to external
systems through the prototyping header. The FPGA pins can be grouped into the various
categories shown below. (Pins denoted with * are useable as general-purpose I/O; pins
denoted with ** can be used as general-purpose I/O only if the CPLD interface is
Configuration Pins (30*, 31*, 37, 38*, 39*, 44*, 46*, 49*, 57*, 60*, 62*, 67*, 68*, 69, 72,
106, 109, 111): These pins are used to load the SpartanII FPGA with a configuration
bitstream. Some of these pins are dedicated to the configuration process and cannot be
used as general-purpose I/O (37, 69, 72, 106, 109, 111). The rest can be used as
general-purpose I/O after the FPGA is configured. If external logic is connected to these
pins, you may have to disable it during the configuration process. The DONE pin (72) can
be used for this purpose since it goes to a logic high only after the configuration process is
completed.
Flash RAM Pins (27*, 28*, 29*, 39*, 40*, 41*, 42**, 43**, 44*, 46*, 47**, 48**, 49*, 50**,
51**, 54*, 56*, 57*, 58**, 59*, 60*, 62*, 63*, 64*, 65**, 66*, 67*, 74*, 75*, 76*): These pins
are used by the FPGA to access the Flash RAM. They can be used for general-purpose
I/O under the following conditions. When the FPGA is configured from the Flash, the
CPLD drives all these pins so any external logic should be disabled using the DONE pin.
Also, after the configuration, the Flash chip-enable (41) should be driven high to disable
the Flash RAM so it doesn’t drive the data bus pins. In addition, the standard parallel port
interface loaded into the CPLD (dwnldpar.svf) will drive eight of the Flash RAM pins (42,
43, 47, 48, 50, 51, 58, 65) with the logic values found on the eight data lines of the parallel
port. If this is not desired, then use the alternate parallel port interface (dwnldpa2.svf)
which does not drive these pins.
VGA Pins (12*, 13*, 19*, 20*, 21*, 22*, 23*, 26*): When not used to drive a VGA monitor,
these pins can be used for general-purpose I/O through the prototyping header. When
used as I/O, the RED0–RED1 (12–13), GREEN0–GREEN1 (19–20) and BLUE0–BLUE1
(21–22) pairs have an impedance of approximately 1 KΩ between them due to the
presence of the resistor-ladder DAC circuitry.
PS/2 Pins (93*, 94*): When not used to access the PS/2 keyboard/mouse port, these pins
can be used as general-purpose I/O through the prototyping header.
Global Clock Pins (15*, 18*): These pins can be used as global clock inputs or general-
purpose inputs. They cannot be used as outputs.
Free Pins (77*, 78*, 79*, 80*, 83*, 84*, 85*, 86*, 87*): These pins are not connected to
any other devices on the XSA Board so they can be used without restrictions as general-
purpose I/O through the prototyping header.
JTAG Pins (2, 32, 34, 142): These pins are used to access the JTAG features of the
FPGA. They cannot be used as general-purpose I/O pins.
XST-1 The XStend Board provides additional support circuitry that the XS40, XS95,
and CSoC Boards can access through their breadboard interfaces. This
circuitry extends the range of applications of the XS Boards into three new
● XS40/XS95/CSoC Board
areas:
connector
● prototyping area
● pushbuttons (3) ● The pushbuttons, DIP switches, LEDs, and prototyping area are useful
● DIP switch for basic lab experiments.
● LED digits (2) ● The VGA monitor interface, PS/2 interface and additional static RAM let
● LED bargraph you perform video and computing experiments.
● 20-bit stereo codec ● The stereo codec and dual-channel analog I/O circuitry are useful for
● stereo in/out ports processing audio signals in combination with DSP components
● VGA monitor port synthesized with XILINX's CORE generation software.
● mouse/keyboard PS/2 port
● daughterboard connector
● optional 64K SRAM
XST-2 XStend Prototyping
Extender Board
XST-2
● Not compatible with XS95, the XStend Board provides additional support circuitry that the XSA Boards can
XS40 or CSoC Boards!! access through their prototyping interfaces. This circuitry extends the range of
● XSA Board connector applications of the XSA Boards into these new areas:
● pushbuttons (4)
● DIP switch ● The pushbuttons, DIP switches, LEDs, and prototyping area are useful
● LED digits (2) for basic lab experiments.
● LED bargraph ● The static RAM can be used when the larger SDRAM on the XSA
● 128 KByte SRAM Board is overkill for a particular application.
● 20-bit stereo codec ● The stereo codec and dual-channel analog I/O circuitry are useful for
● stereo in/out ports processing audio signals in combination with DSP components
● USB 1.1 peripheral-mode synthesized with XILINX's CORE generation software.
interface ● The USB 1.1 interface lets the XSA Board appear as a low-speed or full-
● RS-232 serial port speed USB peripheral to a PC.
● IDE hard disk interface ● The RS-232 interface is useful when the XSA Board needs to send
● prototyping area information over a low-speed serial communication link.
● daughterboard connector ● The IDE interface provides the XSA Board with access to a hard disk
for data storage and retrieval.
XST-2.0 Board picture
picture of XST-2.0 Board mated with XSA Board
XStend Board V1.2 Manual
XESS Corporation
All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted in
any form or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior
written permission of the publisher. Printed in the United States of America.
Limited Warranty
X Engineering Software Systems Corp. (XESS) warrants that the Product, in the course of its normal use, will be
free from defects in material and workmanship for a period of one (1) year and will conform to XESS’s
specification therefor. This limited warranty shall commence on the date appearing on your purchase receipt.
XESS shall have no liability for any Product returned if XESS determines that the asserted defect a) is not present,
b) cannot reasonably be rectified because of damage occurring before XESS receives the Product, or c) is
attributable to misuse, improper installation, alteration, accident or mishandling while in your possession. Subject
to the limitations specified above, your sole and exclusive warranty shall be, during the period of warranty
specified above and at XESS’s option, the repair or replacement of the product. The foregoing warranty of XESS
shall extend to repaired or replaced Products for the balance of the applicable period of the original warranty or
thirty (30) days from the date of shipment of a repaired or replaced Product, whichever is longer.
THE FOREGOING LIMITED WARRANTY IS XESS’S SOLE WARRANTY AND IS APPLICABLE ONLY TO
PRODUCTS SOLD AS NEW. THE REMEDIES PROVIDED HEREIN ARE IN LIEU OF a) ANY AND ALL
OTHER REMEDIES AND WARRANTIES, WHETHER EXPRESSED OR IMPLIED OR STATUTORY,
INCLUDING BUT NOT LIMITED TO, ANY IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS
FOR A PARTICULAR PURPOSE, AND b) ANY AND ALL OBLIGATIONS AND LIABILITIES OF XESS
FOR DAMAGES INCLUDING, BUT NOT LIMITED TO ACCIDENTAL, CONSEQUENTIAL, OR SPECIAL
DAMAGES, OR ANY FINANCIAL LOSS, LOST PROFITS OR EXPENSES, OR LOST DATA ARISING OUT
OF OR IN CONNECTION WITH THE PURCHASE, USE OR PERFORMANCE OF THE PRODUCT, EVEN IF
XESS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
In the United States, some statutes do not allow exclusion or limitations of incidental or consequential damages,
so the limitations above may not apply to you. This warranty gives you specific legal rights, and you may also
have other rights which vary from state to state.
Table of Contents
1 XStend Overview ......................................................... 3
4.2 Displaying Graphics from RAM Through the VGA Interface .............. 27
4.3 Reading Keyboard Scan Codes Through the PS/2 Interface .............. 39
4.4 Inputing and Outputing Stereo Signals Through the Codec ............. 44
• If you can't get the XStend Board hardware to work, send an e-mail message describing your
problem to fpga-bugs@xess.com or check our web site at
http://www.xess.com/FPGA.
• If you can't get your XILINX software tools installed properly, send an e-mail message
describing your problem to hotline@xilinx.com or check their web site at
http://www.xilinx.com/support/searchtd.htm.
1 XStend Overview
The XS40 and XS95 Boards offer a flexible, low-cost method of prototyping FPGA and CPLD
designs. However, their small physical size limits the amount of support circuitry they can hold.
The XStend Board removes this limitation by providing additional support circuitry that the
XS40 and XS95 Boards can access through their breadboard interfaces.
The XStend Board contains resources that extend the range of applications of the XS Boards
into three areas:
• The pushbuttons, DIP switches, LEDs, and prototyping area are useful for basic lab
experiments. These features in combination with the XS Boards replicates the functionality
of the older HW/UW FPGABOARD.
• The VGA monitor interface, PS/2 keyboard/mouse interface, and static RAM let the XS
Boards be used in video and computing experiments.
• The stereo codec and dual-channel analog input/output circuitry are useful for processing of
audio signals in combination with DSP circuits synthesized with XILINX's CORE generation
software.
2 XStend Board Features
The XStend Board extends the capabilities of the XS40 and XS95 Boards by providing:
These resources are shown in the simplified view of the XStend Board (Figure 1). Each of these
resources will be described below.
Figure 1: XStend Board layout.
2.1 XS40/XS95 Board Mounting Area
An XS40 or XS95 Board is mounted on the XStend Board using the XS Board mounting
sockets. These sockets mate with the breadboard interface pins of the XS Boards to give them
access to all the resources of the XStend Board. To use an XS40 Board with the XStend Board,
insert it into the right-most columns of the socket strips. When using an XS95 Board, you
should insert it into the left-most columns of the sockets. There are markings on the XStend
Board to indicate the appropriate column for each type of XS Board.
If the XS Board is connected to a power supply through jack J9, then its power regulation
circuitry will supply VCC and GND to the XStend Board through the mounting sockets. XS40
Boards with 3.3V FPGAs will supply both 3.3V and 5V to the XStend Board, while XS40
Boards with 5V FPGAs and XS95 Boards will supply only 5V.
*Warning: Version 1.0 of the XS40 Board with a 3.3V XC4000XL FPGA will not work with
the XStend Board because it supplies 3.3V but no 5V! You must replace the XC4000XL
FPGA with an XC4000E FPGA and remove the J8 jumper to switch the board to 5V
operation.
External voltage supplies can also be used with the XStend Board. A 5V power supply can be
connected to header J12 and a 3.3V supply can be attached to header J14 as shown in Figure 2.
These supplies will power the attached XS Board as well as the XStend electronics.
*Warning: Do not attach external voltage supplies while also supplying power to the XStend
Board with an XS Board.
*Warning: Never place shunts on either J12 or J14 or you will short the power supplies to
ground and damage the XStend Board and the attached XS Board..
2.2 LEDs
The XStend Board provides a bargraph LED with eight LEDs (D1—D8) and two more LED
displays (U1 and U2) for use by an XS Board. All of these LEDs are active-low meaning that an
LED segment will glow when a logic-low is applied to it.
The LEDs are enabled and disabled by setting the shunts on the 3-pin jumpers as described in
Table 1 and as shown in Figure 3.
Jumper Setting
Figure 3: Shunt placement for setting the XStend Board LED supply voltages.
Listings 1 and 2 show the connections from the XS40 and XS95 Boards to the LEDs on the
XStend Board expressed as UCF constraints (for the UCF syntax and usage tips, check out
http://www.xilinx.com/techdocs/2449.htm).
Listing 1: Connections between the XStend LEDs and the XS40.
# LEFT LED DIGIT SEGMENT CONNECTIONS (ACTIVE-LOW)
NET LSB<0> LOC=P3;
NET LSB<1> LOC=P4;
NET LSB<2> LOC=P5;
NET LSB<3> LOC=P78;
NET LSB<4> LOC=P79;
NET LSB<5> LOC=P82;
NET LSB<6> LOC=P83;
NET LDPB LOC=P84;
#
# RIGHT LED DIGIT SEGMENT CONNECTIONS (ACTIVE-LOW)
NET RSB<0> LOC=P59;
NET RSB<1> LOC=P57;
NET RSB<2> LOC=P51;
NET RSB<3> LOC=P56;
NET RSB<4> LOC=P50;
NET RSB<5> LOC=P58;
NET RSB<6> LOC=P60;
NET RDPB LOC=P28;
#
# INDIVIDUAL LED CONNECTIONS (ACTIVE-LOW)
NET DB<1> LOC=P41;
NET DB<2> LOC=P40;
NET DB<3> LOC=P39;
NET DB<4> LOC=P38;
NET DB<5> LOC=P35;
NET DB<6> LOC=P81;
NET DB<7> LOC=P80;
NET DB<8> LOC=P10;
Listing 2: Connections between the XStend LEDs and the XS95.
# LEFT LED DIGIT SEGMENT CONNECTIONS (ACTIVE-LOW)
NET LSB<0> LOC=P1;
NET LSB<1> LOC=P2;
NET LSB<2> LOC=P3;
NET LSB<3> LOC=P75;
NET LSB<4> LOC=P79;
NET LSB<5> LOC=P82;
NET LSB<6> LOC=P83;
NET LDPB LOC=P84;
#
# RIGHT LED DIGIT SEGMENT CONNECTIONS (ACTIVE-LOW)
NET RSB<0> LOC=P58;
NET RSB<1> LOC=P56;
NET RSB<2> LOC=P54;
NET RSB<3> LOC=P55;
NET RSB<4> LOC=P53;
NET RSB<5> LOC=P57;
NET RSB<6> LOC=P61;
NET RDPB LOC=P34;
#
# INDIVIDUAL LED CONNECTIONS (ACTIVE-LOW)
NET DB<1> LOC=P44;
NET DB<2> LOC=P43;
NET DB<3> LOC=P41;
NET DB<4> LOC=P40;
NET DB<5> LOC=P39;
NET DB<6> LOC=P37;
NET DB<7> LOC=P36;
NET DB<8> LOC=P35;
2.3 Switches
The XStend has a bank of eight DIP switches and two pushbuttons (labeled SPARE and RESET)
that are accessible from an XS Board. (There is a third pushbutton labeled PROGRAM which is
used to initiate the programming of the XS40 Board. It is not intended to be a general-purpose
input.)
When closed or ON, each DIP switch pulls the connected pin of the XS Board to ground. When
the DIP switch is open or OFF, the pin is pulled high through a 10KΩ resistor.
*When not being used, the DIP switches should be left in the open or OFF configuration so
the pins of the XS Board are not tied to ground and can freely move between logic low and
high levels.
When pressed, each pushbutton pulls the connected pin of the XS Board to ground. Otherwise,
the pin is pulled high through a 10 KΩ resistor.
Listings 3 and 4 show the connections from the XS40 and XS95 Boards to the switches on the
XStend Board expressed as UCF constraints.
Listing 3: Connections between the XStend DIP and pushbutton switches and the XS40.
# DIP SWITCH CONNECTIONS
NET DIPSW<1> LOC=P7;
NET DIPSW<2> LOC=P8;
NET DIPSW<3> LOC=P9;
NET DIPSW<4> LOC=P6;
NET DIPSW<5> LOC=P77;
NET DIPSW<6> LOC=P70;
NET DIPSW<7> LOC=P66;
NET DIPSW<8> LOC=P69;
#
# PUSHBUTTON SWITCH CONNECTIONS (ACTIVE-LOW)
NET SPAREB LOC=P67;
NET RESETB LOC=P37;
Listing 4: Connections between the XStend DIP and pushbutton switches and the XS95.
# DIP SWITCH CONNECTIONS
NET DIPSW<1> LOC=P6;
NET DIPSW<2> LOC=P7;
NET DIPSW<3> LOC=P11;
NET DIPSW<4> LOC=P5;
NET DIPSW<5> LOC=P72;
NET DIPSW<6> LOC=P71;
NET DIPSW<7> LOC=P66;
NET DIPSW<8> LOC=P70;
#
# PUSHBUTTON SWITCH CONNECTIONS (ACTIVE-LOW)
NET SPAREB LOC=P67;
NET RESETB LOC=P10;
Listings 5 and 6 show the connections from the XS40 and XS95 Boards to the VGA interface of
the XStend Board. (These pin assignments are identical to the pin assignments for the XS
Boards which have their own VGA interfaces.)
Listing 5: Connections between the XStend VGA interface and the XS40.
# VGA CONNECTIONS
NET VSYNCB LOC=P67;
NET HSYNCB LOC=P19;
NET RED<1> LOC=P18;
NET RED<0> LOC=P23;
NET GREEN<1> LOC=P20;
NET GREEN<0> LOC=P24;
NET BLUE<1> LOC=P26;
NET BLUE<0> LOC=P25;
Listing 6: Connections between the XStend VGA interface and the XS95.
# VGA CONNECTIONS
NET VSYNCB LOC=P24;
NET HSYNCB LOC=P15;
NET RED<1> LOC=P14;
NET RED<0> LOC=P18;
NET GREEN<1> LOC=P17;
NET GREEN<0> LOC=P19;
NET BLUE<1> LOC=P23;
NET BLUE<0> LOC=P21;
Listings 7 and 8 show the connections from the XS40 and XS95 Boards to the PS/2 interface of
the XStend Board (expressed as UCF constraints):
Listing 7: Connections between the XStend PS/2 interface and the XS40.
# PS/2 KEYBOARD CONNECTIONS
NET KB_CLK LOC=P68;
NET KB_DATA LOC=P69;
Listing 8: Connections between the XStend PS/2 interface and the XS95.
# PS/2 KEYBOARD CONNECTIONS
NET KB_CLK LOC=P26;
NET KB_DATA LOC=P70;
2.6 RAMs
The XStend Board adds an additional 64 KBytes of RAM to the 32 KBytes already on the XS
Board. The XStend RAM connects to the same pins as the XS Board RAM for the address bus,
data bus, write-enable, and output-enable. The chip-selects of the XStend Board RAMs are
connected to different pins so all the RAMs can be individually selected.
Here are the connections from the XS40 and XS95 Boards to their own RAMs and the RAMs of
the XStend Board (expressed as UCF constraints):
Listing 10: Connections between the XStend RAMs and the XS95.
NET D<0> LOC=P44; # DATA BUS
NET D<1> LOC=P43;
NET D<2> LOC=P41;
NET D<3> LOC=P40;
NET D<4> LOC=P39;
NET D<5> LOC=P37;
NET D<6> LOC=P36;
NET D<7> LOC=P35;
NET A<0> LOC=P75; # LOWER BYTE OF ADDRESS
NET A<1> LOC=P79;
NET A<2> LOC=P82;
NET A<3> LOC=P84;
NET A<4> LOC=P1;
NET A<5> LOC=P3;
NET A<6> LOC=P83;
NET A<7> LOC=P2;
NET A<8> LOC=P58; # UPPER BYTE OF ADDRESS
NET A<9> LOC=P56;
NET A<10> LOC=P54;
NET A<11> LOC=P55;
NET A<12> LOC=P53;
NET A<13> LOC=P57;
NET A<14> LOC=P61;
NET WEB LOC=P63; # ACTIVE-LOW WRITE-ENABLE FOR ALL RAMS
NET OEB LOC=P62; # ACTIVE-LOW OUTPUT-ENABLE FOR ALL RAMS
NET CEB LOC=P65; # ACTIVE-LOW CHIP-ENABLE FOR XS95 RAM
NET LCEB LOC=P6; # ACTIVE-LOW CHIP-ENABLE FOR LEFT XSTEND RAM
NET RCEB LOC=P7; # ACTIVE-LOW CHIP-ENABLE FOR RIGHT XSTEND RAM
The codec is configured by placing shunts on the jumpers as indicated in Table 2 and Figure 4.
Jumper Setting
J13, J15 Placing shunts across two of the three pins of these
jumpers selects the digital de-emphasis for different
sampling rates:
1 1 De-emphasis off
Listings 11 and 12 show the connections from the XS40 Board to the codec interface on the
XStend Board (expressed as UCF constraints):
Listing 11: Connections between the XStend stereo codec and the XS40.
# STEREO CODEC CONNECTIONS
NET MCLK LOC=P9; # MASTER CLOCK TO CODEC
NET LRCK LOC=P66; # LEFT/RIGHT CODEC CHANNEL SELECT
NET SCLK LOC=P77; # SERIAL DATA CLOCK
NET SDOUT LOC=P6; # SERIAL DATA OUTPUT FROM CODEC
NET SDIN LOC=P70; # SERIAL DATA INPUT TO CODEC
NET CCLK LOC=P44; # CONTROL SIGNAL CLOCK
NET CDIN LOC=P45; # SERIAL CONTROL INPUT TO CODEC
NET CSB LOC=P46; # SERIAL CONTROL CHIP SELECT
Listing 12: Connections between the XStend codec and the XS95.
# STEREO CODEC CONNECTIONS
NET MCLK LOC=P11; # MASTER CLOCK TO CODEC
NET LRCK LOC=P5; # LEFT/RIGHT CODEC CHANNEL SELECT
NET SCLK LOC=P72; # SERIAL DATA CLOCK
NET SDOUT LOC=P66; # SERIAL DATA OUTPUT FROM CODEC
NET SDIN LOC=P71; # SERIAL DATA INPUT TO CODEC
NET CCLK LOC=P46; # CONTROL SIGNAL CLOCK
NET CDIN LOC=P47; # SERIAL CONTROL INPUT TO CODEC
NET CSB LOC=P48; # SERIAL CONTROL CHIP SELECT
The analog stereo input and output signals enter and exit the XStend Board through the 1/8”
jacks J9 and J10, respectively. The output of an audio CD player can be input through J9 and a
set of small stereo headphones can be connected to J10 for listening to the processed output.
The analog signals that go in and out of the codec chip pass through jumpers J20-J27. Shunts
should be placed on all these jumpers so that the analog signals are not interrupted. The digitized
data output from the codec passes through jumper J17 on its way to the XS Board inserted in the
XStend Board. A shunt should be placed on J17 when the codec is being used. Because the
serial data output of the codec is not tristatable and because it shares the input to the XS Board
with other resources on the XStend Board, the shunt on J17 should be removed when the codec
is not being used.
*Never place a shunt on header J28! J28 provides access to the VCC and GND of the
analog section of the XStend Board. Placing a shunt on J28 will damage the XStend
Board.
• Remove the shunts from jumpers J4, J6, J10 and J11 of the XS40 Board;
The connections between the Xchecker cable and the XS40 and XS95 Boards are listed in Table
3. The configuration and readback signals are not applicable to the XS95 Board, so only the
JTAG and VCC/GND signals are listed for it.
Table 3: Connections between the XStend Board Xchecker interface and the XS40 and XS95
Boards.
1 – VCC (+5V) 2 78
2 – RT 32 N/A
3 – GND 52 49
4 – RD 30 N/A
6 – TRIG 7 N/A
7 – CCLK 73 N/A
9 – DONE 53 N/A
10 – TDI 15 28
11 – DIN 71 N/A
12 – TCK 16 30
13 – PROGRAM 55 N/A
14 – TMS 17 29
15 – INIT 41 N/A
16 – CLKI 13 N/A
17 – RST 8 N/A
18 – CLKO 9 N/A
2.9 Prototyping Area
The XStend Board has a prototyping area consisting of component through-holes on an
0.1"×0.1" grid interspersed with a network of alternating VCC and GND buses as shown in
Figure 5. The buses carrying VCC run on the top side of the XStend Board while the GND
buses run on the bottom side. The VCC and GND buses have connection holes in which a small
wire can be soldered to make a connection to a nearby component through-hole.
Figure 5: Top-side view of the network of VCC and GND buses around the component
through-holes in the XStend Board prototyping area.
The placement of the shunt on jumper J16 will determine whether the VCC buses in the
prototyping area carry either 5V or 3.3V (see Figure 6). Of course the jumper selection will have
no effect unless you have both these voltages supplied to the XStend Board either by the XS
Board or by connecting external power supplies.
Connections from the XS Board to the prototyping area are made through connector J3. The
arrangement of pins on this connector exactly matches the arrangement of pins on the XS40
Board. For example, the pin at the bottom-left of J3 on the XStend Board corresponds to pin 21
at the bottom-left of the XS40 Board.
The XS95 Board has a completely different pin arrangement than the XS40. Therefore each pin
on J3 is explicitly labelled with the corresponding pin number on the XS95 Board. For example,
the pin at the bottom-left of J3 on the XStend Board is connected to pin 68 near the top-left of
the XS95 Board.
2.10 Daughterboard Connector
Daughterboards with specialized circuitry can be connected to the XStend board through
connector J18. This 42×2 connector brings all the I/O and VCC/GND from the XS40 or XS95
Board to the daughterboard.
Items within the shaded area in each figure correspond to circuitry housed on the XS Board. The
remaining items are XStend Board resources.
A cursory glance at the figures reveals that many of the resources share connections. For
example, the codec, DIP switch, and microcontroller port P1 are all connected to the same set of
pins on the FPGA or CPLD. So any design has to ensure that only one of these resources is
outputing data at any particular time. (Hence the need in some designs to place the DIP switches
in the OPEN position, or remove the shunt through which the codec SDOUT drives serial data,
or keep the microcontroller in the reset state.)
Table 4 and Table 5 list the same interconnection data for the XS40 and XS95 Boards,
respectively, in a tabular format which makes it easier to see which resources share common
connections.
Figure 7: Programmer's model of the XS40/XStend Board combination.
Figure 8: Programmer's model of the XS95/XStend Board combination.
Table 4: Connections between the XS40 Board and the XStend Board resources.
Stereo Codec
Push-buttons
Power/ GND
BOARD Pin
PC Parallel
DIP Switch
(J1,J3,J18)
UW-FPGA
Oscillator
XS40 Pin
Interface
Interface
8051 uC
RAMs
LEDs
VGA
PS/2
Port
Function
2 +5V +5V power source
3 LSB0 A0 Left LED segment; RAM address line P35
4 LSB1 A1 Left LED segment; RAM address line P36
5 LSB2 A2 Left LED segment; RAM address line P29
6 DIPSW4 SDOUT P1.3 DIP switch; codec serial data output; uC I/O P24
7 DIPSW1 LCEB P1.0 DIP switch; left RAM chip-enable, uC I/O port P19
8 DIPSW2 RCEB P1.1 DIP switch; right RAM chip-enable, uC I/O port P20
9 DIPSW3 MCLK P1.2 DIP switch; codec master clock; uC I/O port P23
10 DB8 D7 P0.7 LED; RAM data line; uC muxed address/data line P61
13 CLK XS Board oscillator
14 PSENB uC program store-enable
15 JTAG TDI; DIN
16 JTAG TCK; CCLK
17 JTAG TMS
18 S5 RED1 XS Board LED segment; VGA color signal
19 S6 HSYNCB XS Board LED segment; VGA horiz. sync.
20 S3 GREEN1 XS Board LED segment; VGA color signal
23 S4 RED0 XS Board LED segment; VGA color signal
24 S2 GREEN0 XS Board LED segment; VGA color signal
25 S0 BLUE0 XS Board LED segment; VGA color signal
26 S1 BLUE1 XS Board LED segment; VGA color signal
27 P3.7 (RD_) uC read line
28 RDPB P2.7 Right LED decimal-point; uC I/O port P41
29 ALEB uC address-latch-enable
30 Serial EEPROM chip-enable
32 PC_D6 PC parallel port data output
34 PC_D7 PC parallel port data output
35 DB5 D4 P0.4 LED; RAM data line; uC muxed address/data line P66
36 RST uC reset
37 RESETB XTAL1 Pushbutton; uC clock P56
38 DB4 D3 P0.3 LED; RAM data line; uC muxed address/data line P57
39 DB3 D2 P0.2 LED; RAM data line; uC muxed address/data line P58
40 DB2 D1 P0.1 LED; RAM data line; uC muxed address/data line P59
41 DB1 D0 P0.0 LED; RAM data line; uC muxed address/data line P60
44 CCLK PC_D0 Codec control line; PC parallel port data output
45 CDIN PC_D1 Codec control line; PC parallel port data output
46 CSB PC_D2 Codec control line; PC parallel port data output
47 PC_D3 PC parallel port data output
48 PC_D4 PC parallel port data output
49 PC_D5 PC parallel port data output
50 RSB4 A12 P2.4 Right LED segment; RAM address line; uC I/O port P48
51 RSB2 A10 P2.2 Right LED segment; RAM address line; uC I/O port P45
52 GND Power supply ground
54 5.0V/3.3V 5V/3.3V power supply (4000E/4000XL)
55 PROGRAM XS40 configuration control P55
56 RSB3 A11 P2.3 Right LED segment; RAM address line; uC I/O port P51
57 RSB1 A9 P2.1 Right LED segment; RAM address line; uC I/O port P47
58 RSB5 A13 P2.5 Right LED segment; RAM address line; uC I/O port P50
59 RSB0 A8 P2.0 Right LED segment; RAM address line; uC I/O port P46
60 RSB6 A14 P2.6 Right LED segment; RAM address line; uC I/O port P49
61 OEB RAM output-enable
62 WEB P3.6 (WR_) RAM write-enable; uC I/O port
65 CEB XS Board RAM chip-enable
66 DIPSW7 LRCK P1.6 PC_S5 DIP switch; codec left-right channel switch; uC I/O port; PC parallel
P27 port status input
67 SPAREB VSYNCB P1.7 Pushbutton; VGA vert. sync.; uC I/O port P18
68 KB_CLK P3.4 (T0) PS/2 keyboard clock; uC I/O port
69 DIPSW8 KB_DATA P3.1 (TXD)
PC_S6 DIP switch; PS/2 keyboard serial data; uC I/O port; PC parallelP28port status input
70 DIPSW6 SDIN P1.5 PC_S3 DIP switch; codec serial input data; uC I/O port; PC parallel port
P26 status input
71 JTAG TDI; DIN
72 JTAG TDO; DOUT
73 JTAG TCK; CCLK
75 PC_S7 JTAG TDO; DOUT; PC parallel port status input
77 DIPSW5 SCLK P1.4 PC_S4 DIP switch; codec serial I/O clock; uC I/O port; PC parallel port
P25status input
78 LSB3 A3 Left LED segment; RAM address line P44
79 LSB4 A4 Left LED segment; RAM address line P38
80 DB7 D6 P0.6 LED; RAM data line; uC muxed address/data line P62
81 DB6 D5 P0.5 LED; RAM data line; uC muxed address/data line P65
82 LSB5 A5 Left LED segment; RAM address line P40
83 LSB6 A6 Left LED segment; RAM address line P39
84 LDPB A7 Left LED decimal-point; RAM address line P37
Table 5: Connections between the XS95 Board and the XStend Board resources.
Stereo Codec
Push-buttons
Power/ GND
BOARD Pin
PC Parallel
DIP Switch
XS95 Pins
UW-FPGA
Oscillator
Interface
Interface
8051 Uc
RAMs
LEDs
VGA
PS/2
Port
(J2)
Function
1 LSB0 A4 Left LED segment; RAM address line P35
2 LSB1 A7 Left LED segment; RAM address line P36
3 LSB2 A5 Left LED segment; RAM address line P29
4 Uncommitted XS95 I/O pin
5 DIPSW4 SDOUT P1.3 DIP switch; codec serial data output; uC I/O P24
6 DIPSW1 LCEB P1.0 DIP switch; left RAM chip-enable, uC I/O port P19
7 DIPSW2 RCEB P1.1 DIP switch; right RAM chip-enable, uC I/O port P20
9 CLK XS Board oscillator
10 RESETB XTAL1 Pushbutton; uC clock P56
11 DIPSW3 MCLK P1.2 DIP switch; codec master clock; uC I/O port P23
12 Uncommitted XS95 I/O pin
13 PSENB uC program store-enable
14 S5 RED1 XS Board LED segment; VGA color signal
15 S6 HSYNCB XS Board LED segment; VGA horiz. sync.
17 S3 GREEN1 XS Board LED segment; VGA color signal
18 S4 RED0 XS Board LED segment; VGA color signal
19 S2 GREEN0 XS Board LED segment; VGA color signal
20 ALEB uC address-latch-enable
21 S0 BLUE0 XS Board LED segment; VGA color signal
23 S1 BLUE1 XS Board LED segment; VGA color signal
25 Uncommitted XS95 I/O pin
26 KB_CLK P3.4 (T0) PS/2 keyboard clock; uC I/O port
28 JTAG TDI; DIN
29 JTAG TMS
30 JTAG TCK; CCLK
31 P3.0 (RXD) uC I/O port
32 P3.7 (RD_) uC I/O port
33 P3.5 (T1) uC I/O port
34 RDPB P2.7 Right LED decimal-point; RAM address line; uC I/O port P41
35 DB8 D7 P0.7 LED; RAM data line; uC muxed address/data line P61
36 DB7 D6 P0.6 LED; RAM data line; uC muxed address/data line P62
37 DB6 D5 P0.5 LED; RAM data line; uC muxed address/data line P65
39 DB5 D4 P0.4 LED; RAM data line; uC muxed address/data line P66
40 DB4 D3 P0.3 LED; RAM data line; uC muxed address/data line P57
41 DB3 D2 P0.2 LED; RAM data line; uC muxed address/data line P58
43 DB2 D1 P0.1 LED; RAM data line; uC muxed address/data line P59
44 DB1 D0 P0.0 LED; RAM data line; uC muxed address/data line P60
45 RST uC reset
46 CCLK PC_D0 Codec control line; PC parallel port data output
47 CDIN PC_D1 Codec control line; PC parallel port data output
48 CSB PC_D2 Codec control line; PC parallel port data output
49 GND Power supply ground
50 PC_D3 PC parallel port data output
51 PC_D4 PC parallel port data output
52 PC_D5 PC parallel port data output
53 RSB4 A12 P2.4 Right LED segment; RAM address line; uC I/O port P48
54 RSB2 A10 P2.2 Right LED segment; RAM address line; uC I/O port P45
55 RSB3 A11 P2.3 Right LED segment; RAM address line; uC I/O port P51
56 RSB1 A9 P2.1 Right LED segment; RAM address line; uC I/O port P47
57 RSB5 A13 P2.5 Right LED segment; RAM address line; uC I/O port P50
58 RSB0 A8 P2.0 Right LED segment; RAM address line; uC I/O port P46
59 JTAG TDO; DOUT
61 RSB6 A14 P2.6 Right LED segment; RAM address line; uC I/O port P49
62 OEB RAM output-enable
63 WEB P3.6 (WR_) RAM write-enable; uC I/O port
65 CEB XS Board RAM chip-enable
66 DIPSW7 LRCK P1.6 PC_S5 DIP switch; codec left-right channel select; uC I/O port; PC parallel
P27 port status input
68 P3.3 (INT1_) uC I/O port
69 P3.2 (INT0_) uC I/O port
70 DIPSW8 KB_DATA P3.1 (TXD)
PC_S6 DIP switch; PS/2 keyboard serial data; uC I/O port; PC parallelP28
port status input
71 DIPSW6 SDIN P1.5 PC_S3 DIP switch; codec serial input data; uC I/O port; PC parallel port
P26status input
72 DIPSW5 SCLK P1.4 PC_S4 DIP switch; codec serial clock; uC I/O port; PC parallel port status
P25 input
74 Uncommitted XS95 I/O pin
75 LSB3 A0 Left LED segment; RAM address line P44
76 Uncommitted XS95 I/O pin
77 Uncommitted XS95 I/O pin
78 +5V +5V power source
79 LSB4 A1 Left LED segment; RAM address line P38
80 PC_D7 PC parallel port data output
81 PC_D6 PC parallel port data output
82 LSB5 A2 Left LED segment; RAM address line P40
83 LSB6 A6 Left LED segment; RAM address line P39
84 LDPB A3 Left LED decimal-point; RAM address line P37
24,67 SPAREBDP VSYNCB P1.7 Pushbutton; XS Board LED decimal-point; VGA horiz. sync.; uC P18I/O port
4 Example Designs for the XStend Board
With the programmer’s models in hand, several example designs can be built using the XStend
Board coupled with an XS40 or XS95 Board.
The steps for compiling and testing the design using an XS40 combined with an XStend Board
are as follows:
• Compile the synthesized netlist using the SWTCH40.UCF constraint file (Listing 14).
• Mount an XS40 Board in the XStend Board and attach the downloading cable from the
XS40 to the PC parallel port. Apply 9VDC though jack J9 of the XS40. Place shunts on
jumpers J4, J7, and J8 of the XStend Board to enable the LED displays. Remove the shunt
on jumper J17 to keep the XStend codec serial output from interfering with the DIP switch
logic levels.
• Download the SWTCH40.BIT file into the XS40/XStend combination with the command:
XSLOAD SWTCH40.BIT.
• Set the DIP switches and press the SPARE and RESET pushbuttons. Observe the results on
the LEDs.
The steps for compiling and testing the design using an XS95 combined with an XStend Board
are as follows:
• Synthesize the VHDL code in the SWTCH95\SWITCHES.VHD file for an XC95108 CPLD.
• Mount an XS95 Board in the XStend Board and attach the downloading cable from the
XS95 to the PC parallel port. Apply 9VDC though jack J9 of the XS95. Place shunts on
jumpers J4, J7, and J8 of the XStend Board to enable the LED displays. Remove the shunt
on jumper J17 to keep the XStend codec serial output from interfering with the DIP switch
logic levels.
• Download the SWTCH95.SVF file into the XS95/XStend combination with the command:
XSLOAD SWTCH95.SVF.
• Set the DIP switches and press the SPARE and RESET pushbuttons. Observe the results on
the LEDs.
Listing 13: VHDL code for using the XStend LEDs and switches.
001- LIBRARY IEEE;
002- USE IEEE.STD_LOGIC_1164.ALL;
003-
004- ENTITY switches IS
005- PORT
006- (
007- dipsw: IN STD_LOGIC_VECTOR(8 DOWNTO 1); -- DIP switches
008- spareb: IN STD_LOGIC; -- SPARE pushbutton
009- resetb: IN STD_LOGIC; -- RESET pushbutton
010-
011- s: OUT STD_LOGIC_VECTOR(6 DOWNTO 0); -- XS Board LED digit
012- lsb: OUT STD_LOGIC_VECTOR(7 DOWNTO 0); -- XStend left LED digit
013- rsb: OUT STD_LOGIC_VECTOR(7 DOWNTO 0); -- XStend right LED digit
014- db: OUT STD_LOGIC_VECTOR(8 DOWNTO 1); -- XStend bargraph LED
015-
016- oeb: OUT STD_LOGIC; -- output enable for all RAMs
017- rst: OUT STD_LOGIC -- microcontroller reset
018- );
019- END switches;
020-
021- ARCHITECTURE switches_arch OF switches IS
022- BEGIN
023- -- this prevents accidental activation of the RAMs or microcontroller
024- oeb <= '1'; -- disable all the RAM output drivers
025- rst <= '1'; -- disable the microcontroller
026-
027- -- light the XS Board LED digit with the pattern from the
028- -- DIP switches if both pushbuttons are pressed.
029- -- these LED segments are active-high.
030- s <= dipsw(7 DOWNTO 1) WHEN (spareb='0' AND resetb='0') ELSE
031- "0000000"; -- otherwise keep LED digit dark
032-
033- -- light the XStend left LED digit with the pattern from the
034- -- DIP switches if the RESET pushbutton is pressed.
035- -- these LED segments are active low.
036- lsb <= NOT(dipsw) WHEN (spareb='1' AND resetb='0') ELSE
037- "11111111"; -- otherwise keep the LED digit dark
038-
039- -- light the XStend right LED digit with the pattern from the
040- -- DIP switches if the SPARE pushbutton is pressed.
041- -- these LED segments are active low.
042- rsb <= NOT(dipsw) WHEN (spareb='0' AND resetb='1') ELSE
043- "11111111"; -- otherwise keep the LED digit dark
044-
045- -- light the XStend bargraph LED with the pattern from the
046- -- DIP switches if neither pushbutton is pressed
047- -- these LED segments are active low.
048- db <= NOT(dipsw) WHEN (spareb='1' AND resetb='1') ELSE
049- "11111111"; -- otherwise keep the bargraph LED dark
050- END switches_arch;
Each analog color input can be set to one of four levels by two digital outputs using a simple
two-bit digital-to-analog converter (see Figure 9). The four possible levels on each analog input
are combined by the monitor to create a pixel with one of 4 × 4 × 4 = 64 different colors. So the
six digital control lines let us select from a palette of 64 colors.
Negative pulses on the horizontal sync signal mark the start and end of a line and ensure that the
monitor displays the pixels between the left and right edges of the visible screen area. The actual
pixels are sent to the monitor within a 25.17 µs window. The horizontal sync signal drops low a
minimum of 0.94 µs after the last pixel and stays low for 3.77 µs. A new line of pixels can begin
a minimum of 1.89 µs after the horizontal sync pulse ends. So a single line occupies 25.17 µs of
a 31.77 µs interval. The other 6.6 µs of each line is the horizontal blanking interval during
which the screen is dark.
In an analogous fashion, negative pulses on a vertical sync signal mark the start and end of a
frame made up of video lines and ensure that the monitor displays the lines between the top and
bottom edges of the visible monitor screen. The lines are sent to the monitor within a 15.25 ms
window. The vertical sync signal drops low a minimum of 0.45 ms after the last line and stays
low for 64 µs. The first line of the next frame can begin a minimum of 1.02 ms after the vertical
sync pulse ends. So a single frame occupies 15.25 ms of a 16.784 ms interval. The other 1.534
ms of the frame interval is the vertical blanking interval during which the screen is dark.
Figure 10: VGA signal timing.
The pseudocode for a single frame of this process is shown in Listing 16. The pseudocode has
two outer loops: one which displays the L lines of visible pixels, and another which inserts the V
blank lines and the vertical sync pulse. Within the first loop, there are two more loops: one
which sends the P pixels of each video line to the monitor, and another which inserts the H blank
pixels and the horizontal sync pulse.
Within the pixel display loop, there are statements to get the next byte from the RAM. Each byte
contains four two-bit pixels. A small loop iteratively extracts each pixel to be displayed from the
lower two bits of the byte. Then the byte is shifted by two bits so the next pixel will be in the
right position during the next iteration of the loop. Since it has only two bits, each pixel can store
one of four colors. The mapping from the two-bit pixel value to the actual values required by the
monitor electronics is done by the COLOR_MAP() routine.
Figure 11 shows how to pipeline certain operations to account for delays in accessing data from
the RAM. The pipeline has three stages:
Stage 1: The circuit uses the horizontal and vertical counters to compute the address where the
next pixel is found in RAM. The counters are also used to determine the firing of the sync
pulses and whether the video should be blanked. The pixel data from the RAM, blanking
signal, and sync pulses are latched at the end of this stage so they can be used in the next
stage.
Stage 2: The circuit uses the pixel data and the blanking signal to determine the binary color
outputs. These outputs are latched at the end of this stage.
Stage 3: The binary color outputs are applied to the DAC, which sets the intensity levels for the
monitor’s color guns. The actual pixel is painted on the screen during this stage.
clk: The input for the 12 MHz clock of the XS Board is declared here. This clock sets the
maximum rate at which pixels can be sent to the monitor. The time interval within each line
for transmitting viewable pixels is 25.17 µs, so this VGA generator circuit can only put a
maximum of 25.17 ms × 12 MHz = 302 pixels on each line. For purposes of storing images
in the RAM, it is convenient to reduce this to 256 pixels per line and blank the remaining 46
pixels. Half of these blank pixels are placed before the 256 viewable pixels and half are
placed after them on a line. This centers the viewable pixels between the left and right edges
of the monitor screen.
reset: This line declares an input, which will reset all the other circuitry to a known state.
hsyncb, vsyncb: The outputs for the horizontal and vertical sync pulses are declared. The
hsyncb output is declared as a buffer because it will also be referenced within the architecture
section as a clock for the vertical line counter.
rgb: The outputs that control the red, green, and blue color guns of the monitor are declared
here. Each gun is controlled by two bits, so there are four possible intensities for each color.
Thus, this circuit can produce 4 × 4 × 4 = 64 different colors.
address, data: These lines declare the outputs for driving the address lines of the RAM and the
inputs for receiving the data from the RAM.
ceb, oeb, web: These are the declarations for the outputs which drive the chip-select, output-
enable, and write-enable control lines of the RAM.
hcnt, vcnt: The counters that store the current horizontal position within a line of pixels and the
vertical position of the line on the screen are declared on these lines. We will call these the
horizontal or pixel counter, and the vertical or line counter, respectively. The line period is
31.77 µs that is 381 clock cycles, so the pixel counter needs at least nine bits of resolution.
Each frame is composed of 528 video lines (only 480 are visible, the other 48 are blanked), so
a ten bit counter is needed for the line counter.
pixrg: This is the declaration for the eight-bit register that stores the four pixels received from
the RAM.
blank, pblank: This line declares the video blanking signal and its registered counterpart that is
used in the next pipeline stage.
Within the main body of the architecture section, these following processes are executed:
inc_horiz_pixel_counter: This process describes the operation of the horizontal pixel counter.
The counter is asynchronously set to zero when the reset input is high. The counter
increments on the rising edge of each pixel clock. The range for the horizontal pixel counter
is [0,380]. When the counter reaches 380, it rolls over to zero on the next cycle. Thus, the
counter has a period of 381 pixel clocks. With a pixel clock of 12 MHz, this translates to a
period of 31.75 µs.
inc_vert_line_counter: This process describes the operation of the vertical line counter. The
counter is asynchronously set to zero when the reset input is high. The counter increments
on the rising edge of the horizontal sync pulse after a line of pixels is completed. The range
for the horizontal pixel counter is [0,527]. When the counter reaches 527, it rolls over to
zero on the next cycle. Thus, the counter has a period of 528 lines. Since the duration of a
line of pixels is 31.75 µs, this makes the frame interval equal to 16.76 ms.
generate_horiz_sync: This process describes the operation of the horizontal sync pulse
generator. The horizontal sync is set to its inactive high level when the reset is activated.
During normal operations, the horizontal sync output is updated on every pixel clock. The
sync signal goes low on the cycle after the pixel counter reaches 291 and continues until the
cycle after the counter reaches 337. This gives a low horizontal sync pulse of (337-291)=46
pixel clocks. With a pixel clock of 12 MHz, this translates to a low-going horizontal sync
pulse of 3.83 µs. The sync pulse starts 292 clocks after the line of pixels begin, which
translates to 24.33 µs. This is less than the 26.11 µs we stated before. The difference of 1.78
ms translates to 21 pixel clocks. This time interval corresponds to the 23 blank pixels that are
placed before the 256 viewable pixels (minus two clock cycles for pipelining delays).
generate_vert_sync: This process describes the operation of the vertical sync pulse generator.
The vertical sync is set to its inactive high level when the reset is activated. During normal
operations, the vertical sync output is updated after every line of pixels is completed. The
sync signal goes low on the cycle after the line counter reaches 493 and continues until the
cycle after the counter reaches 495. This gives a low vertical sync pulse of (495-493)= 2
lines. With a line interval of 31.75 µs, this translates to a low-going vertical sync pulse of
63.5 µs. The vertical sync pulse starts 494 × 31.75 µs = 15.68 ms after the beginning of the
first video line.
Line 91: This line describes the computation of the combinatorial blanking signal. The video is
blanked after 256 pixels on a line are displayed, or after 480 lines are displayed.
pipeline_blank: This process describes the operation of the pipelined video blanking signal.
Within the process, the blanking signal is stored in a register so it can be used during the next
stage of the pipeline when the color is computed.
Lines 104 -- 106: On these lines, the RAM is permanently selected and writing to the RAM is
disabled. This makes the RAM look like a ROM, which stores video data. In addition, the
outputs from the RAM are disabled when the video is blanked since there is no need for
pixels during the blanking intervals. This isn’t really necessary since no other circuit is trying
to access the RAM.
Line 113: The address in RAM where the next four pixels are stored is calculated by
concatenating the lower nine bits of the line counter with bits 7,6,5,4,3 and 2 of the pixel
counter. With this arrangement, the line counter stores the address of one of 29 = 512 pages.
Each page contains 26 = 64 bytes. Each byte contains four pixels, so each page stores one
line of 256 pixels. The pixel counter increments through the bytes of a page to get the pixels
for the current line. (Note that we don’t need to use bits 1 and 0 of the pixel counter when
computing the RAM address since each byte contains four pixels.) After the line is displayed,
the line counter is incremented to point to the next page.
update_pixel_register: This process describes the operation of the register that holds the byte of
pixel data read from RAM. The register is asynchronously cleared when the VGA circuit is
reset. The register is updated on the rising edge of each pixel clock. The pixel register is
loaded with data from the RAM whenever the lowest two bits of the pixel counter are both
zero. The active pixel is always in the lower two bits of the register. Each pixel in the RAM
data byte is shifted into the active position by right shifting the register two bits on each rising
clock edge.
map_pixel_to_rgb: this process describes the process by which the current active pixel is
mapped into the six bits that drive the red, green and blue color guns. The register is set to
zero (which displays as the color black) when the reset input is high. The color register is
clocked on the rising edge of the pixel clock since this is the rate at which new pixel values
arrive. The value clocked into the register is a function of the pixel value and the blanking
input. When the pipelined blanking input is low (inactive), the color displayed on the monitor
is red, green, blue, or white depending upon whether the pixel value is 00, 01, 10, or 11,
respectively. When the pipelined blanking input is high, the color register is loaded with zero
(black).
Listing 18: XS40 UCF file for the VGA signal generator.
001- net clk loc=p13;
002- net reset loc=p44;
003- net data<0> loc=p41;
004- net data<1> loc=p40;
005- net data<2> loc=p39;
006- net data<3> loc=p38;
007- net data<4> loc=p35;
008- net data<5> loc=p81;
009- net data<6> loc=p80;
010- net data<7> loc=p10;
011- net address<0> loc=p3;
012- net address<1> loc=p4;
013- net address<2> loc=p5;
014- net address<3> loc=p78;
015- net address<4> loc=p79;
016- net address<5> loc=p82;
017- net address<6> loc=p83;
018- net address<7> loc=p84;
019- net address<8> loc=p59;
020- net address<9> loc=p57;
021- net address<10> loc=p51;
022- net address<11> loc=p56;
023- net address<12> loc=p50;
024- net address<13> loc=p58;
025- net address<14> loc=p60;
026- net ceb loc=p65;
027- net web loc=p62;
028- net oeb loc=p61;
029- net rgb<0> loc=p25;
030- net rgb<1> loc=p26;
031- net rgb<2> loc=p24;
032- net rgb<3> loc=p20;
033- net rgb<4> loc=p23;
034- net rgb<5> loc=p18;
035- net hsyncb loc=p19;
036- net vsyncb loc=p67;
Listing 19: XS95 UCF file for the VGA signal generator.
001- net clk loc=p9;
002- net reset loc=p46;
003- net data<0> loc=p44;
004- net data<1> loc=p43;
005- net data<2> loc=p41;
006- net data<3> loc=p40;
007- net data<4> loc=p39;
008- net data<5> loc=p37;
009- net data<6> loc=p36;
010- net data<7> loc=p35;
011- net address<0> loc=p75;
012- net address<1> loc=p79;
013- net address<2> loc=p82;
014- net address<3> loc=p84;
015- net address<4> loc=p1;
016- net address<5> loc=p3;
017- net address<6> loc=p83;
018- net address<7> loc=p2;
019- net address<8> loc=p58;
020- net address<9> loc=p56;
021- net address<10> loc=p54;
022- net address<11> loc=p55;
023- net address<12> loc=p53;
024- net address<13> loc=p57;
025- net address<14> loc=p61;
026- net ceb loc=p65;
027- net web loc=p63;
028- net oeb loc=p62;
029- net rgb<0> loc=p21;
030- net rgb<1> loc=p23;
031- net rgb<2> loc=p19;
032- net rgb<3> loc=p17;
033- net rgb<4> loc=p18;
034- net rgb<5> loc=p14;
035- net hsyncb loc=p15;
036- net vsyncb loc=p24;
The steps for compiling and testing the VGA design using an XS40 combined with an XStend
Board are as follows:
• Synthesize the VHDL code in the VGA40\VGA.VHD file for an XC4005XL FPGA.
• Compile the synthesized netlist using the VGA40.UCF constraint file (Listing 18).
• Mount an XS40 Board in the XStend Board and attach the downloading cable from the
XS40 to the PC parallel port. Apply 9VDC though jack J9 of the XS40. Place shunts on
jumpers J4, J7, and J8 of the XStend Board to enable the LED displays. Remove the shunt
on jumper J17 to keep the XStend codec serial output from interfering with the DIP switch
logic levels. Set all the DIP switches to the OPEN position.
• Download the VGA40.BIT file and a video test pattern into the XS40/XStend combination
with the command: XSLOAD TESTPATT.HEX VGA40.BIT.
• Release the reset to the VGA circuitry with the command: XSPORT 0.
The steps for compiling and testing the design using an XS95 combined with an XStend Board
are as follows:
• Synthesize the VHDL code in the VGA95\VGA.VHD file for an XC95108 CPLD.
• Compile the synthesized netlist using the VGA95.UCF constraint file (Listing 19).
• Mount an XS95 Board in the XStend Board and attach the downloading cable from the
XS95 to the PC parallel port. Apply 9VDC though jack J9 of the XS40. Place shunts on
jumpers J4, J7, and J8 of the XStend Board to enable the LED displays. Remove the shunt
on jumper J17 to keep the XStend codec serial output from interfering. Set all the DIP
switches to the OPEN position.
• Download the VGA95.SVF file and a video test pattern into the XS95/XStend combination
with the command: XSLOAD TESTPATT.HEX VGA95.SVF.
• Release the reset to the VGA circuitry with the command: XSPORT 0.
The format of the scan code transmissions from the keyboard are shown in Figure 12. The
keyboard electronics drive the clock and data lines. The start of a scan code transmission is
indicated by a low level on the data line on the falling edge of the clock. The eight bits of the
scan code follow (starting with the least-significant bit) on successive falling clock edges. These
are followed by an odd-parity bit and then a high-level stop bit.
When the clock line goes high after the stop bit, the receiver (in this case, the FPGA or CPLD on
the XS Board inserted in the XStend Board) can pull the clock line low to inhibit any further
transmissions. After the clock line is released and it returns to a high level, the keyboard can
send another scan code. If the receiver never pulls the clock line low, then the keyboard will
send scan codes whenever a key is pressed.
Figure 12: Keyboard data transmission waveforms.
rst: This output drives the reset pin of the microcontroller on the XS Board.
oeb: This output drives the output-enable pin of the RAM on the XS Board.
db: These outputs drive the segments of the bargraph LED on the XStend Board.
rsb: These outputs drive the segments of the right LED digit on the XStend Board.
Within the main body of the architecture section, these operations occur:
Lines 22 & 23: The microcontroller reset pin and the RAM output-enable pin are driven high so
these chips cannot interfere while receiving data from the keyboard.
Lines 25 & 26: The keyboard clock passes through an input buffer and then a global clock buffer
before it reaches the rest of the circuitry. (These buffers are declared on lines 18 and 19,
respectively.) The global clock buffer distributes the clock signal with minimal skew in the
XS40 Board FPGA. These statements are not used with the CPLD in the XS95 Board.
gather_scancode: On every falling edge of kb_clk, this process shifts the data bit on the kb_data
input into the most-significant bit of a 10-bit shift register. After 11 clock cycles, the lower 8
bits of the register will contain the scan code, the upper 2 bits will store the stop and parity
bits, and the start bit will have been shifted through the entire register and discarded.
Line 38: The value in the shift register is inverted and applied to the segments of the LED
bargraph. Since the bargraph segments are active-low, a segment will light for every ‘1’ bit
in the shift register. The LED segment drivers are not registered so there will be some
flickering as the shift register contents change.
Lines 40-51: If the scan code in the shift register matches the codes for the digits 0-9, then the
right LED digit segments will be activated to display the corresponding digit. If the scan
code does not match one of these codes, the letter ‘E’ is displayed.
The steps for compiling and testing the design using an XS40 combined with an XStend Board
are as follows:
• Mount an XS40 Board in the XStend Board and attach the downloading cable from the
XS40 to the PC parallel port. Apply 9VDC though jack J9 of the XS40. Place shunts on
jumpers J4, J7, and J8 to enable the LEDs. Remove the shunt on jumper J17 to keep the
XStend codec from interfering. Set all the DIP switches to the OPEN position.
• Download the KEYBRD40.BIT file into the XS40/XStend combination with the command:
XSLOAD KEYBRD40.BIT.
• Press keys on the keyboard and observe the results on the LED displays.
The steps for compiling and testing the design using an XS95 combined with an XStend Board
are as follows:
• Compile the synthesized netlist using the KEYBRD95.UCF constraint file (Listing 23).
• Mount an XS95 Board in the XStend Board and attach the downloading cable from the
XS95 to the PC parallel port. Apply 9VDC though jack J9 of the XS95. Place shunts on
jumpers J4, J7, and J8 to enable the LEDs. Remove the shunt on jumper J17 to keep the
XStend codec from interfering. Set all the DIP switches to the OPEN position.
• Download the KEYBRD95.SVF file into the XS95/XStend combination with the command:
XSLOAD KEYBRD95.SVF.
• Press keys on the keyboard and observe the results on the LED displays.
Listing 20: VHDL code for receiving keyboard scan codes from the PS/2 interface.
001- LIBRARY IEEE;
002- USE IEEE.STD_LOGIC_1164.ALL;
003-
004- ENTITY kbd_read IS
005- PORT
006- (
007- rst: OUT STD_LOGIC; -- uC reset
008- oeb: OUT STD_LOGIC; -- RAM output enable
009- kb_data: IN STD_LOGIC; -- serial data from the keyboard
010- kb_clk: IN STD_LOGIC; -- clock from the keyboard
011- db: OUT STD_LOGIC_VECTOR(8 DOWNTO 1); -- bargraph LED
012- rsb: OUT STD_LOGIC_VECTOR(6 DOWNTO 0) -- right LED digit
013- );
014- END kbd_read;
015-
016- ARCHITECTURE kbd_read_arch OF kbd_read IS
017- SIGNAL scancode: STD_LOGIC_VECTOR(9 DOWNTO 0);
018- COMPONENT ibuf PORT(i: IN STD_LOGIC; o: OUT STD_LOGIC); END COMPONENT;
019- COMPONENT bufg PORT(i: IN STD_LOGIC; o: OUT STD_LOGIC); END COMPONENT;
020- SIGNAL buf_clk0, buf_clk1: STD_LOGIC;
021- BEGIN
022- rst <= '1'; -- keep the uC in the reset state
023- oeb <= '1'; -- disable the RAM output drivers
024-
025- b0: ibuf PORT MAP(i=>kb_clk,o=>buf_clk0); -- buffer the clock from
026- b1: bufg PORT MAP(i=>buf_clk0,o=>buf_clk1); -- the keyboard
027-
028- -- shift keyboard data into the MSb of the scancode register
029- -- on the falling edge of the keyboard clock
030- gather_scancode:
031- PROCESS(buf_clk1,scancode)
032- BEGIN
033- IF(buf_clk1'EVENT AND buf_clk1='0') THEN
034- scancode <= kb_data & scancode(9 DOWNTO 1);
035- END IF;
036- END PROCESS;
037-
038- db <= NOT(scancode(7 DOWNTO 0)); -- show the scancode on the bargraph
039-
040- -- display the key that was pressed on the right LED digit
041- rsb <= "1101101" WHEN scancode(7 DOWNTO 0)="00010110" ELSE -- 1
042- "0100010" WHEN scancode(7 DOWNTO 0)="00011110" ELSE -- 2
043- "0100100" WHEN scancode(7 DOWNTO 0)="00100110" ELSE -- 3
044- “1000101" WHEN scancode(7 DOWNTO 0)="00100101" ELSE -- 4
045- "0010100" WHEN scancode(7 DOWNTO 0)="00101110" ELSE -- 5
046- "0010000" WHEN scancode(7 DOWNTO 0)="00110110" ELSE -- 6
047- "0101101" WHEN scancode(7 DOWNTO 0)="00111101" ELSE -- 7
048- "0000000" WHEN scancode(7 DOWNTO 0)="00111110" ELSE -- 8
049- "0000100" WHEN scancode(7 DOWNTO 0)="01000110" ELSE -- 9
050- "0001000" WHEN scancode(7 DOWNTO 0)="01000101" ELSE -- 0
051- "0010010"; -- E
052- END kbd_read_arch;
Listing 21: XS40 UCF file for the PS/2 keyboard interface.
001- net rst loc=p36;
002- net oeb loc=p61;
003- net kb_data loc=p69;
004- net kb_clk loc=p68;
005- net rsb<0> loc=p59;
006- net rsb<1> loc=p57;
007- net rsb<2> loc=p51;
008- net rsb<3> loc=p56;
009- net rsb<4> loc=p50;
010- net rsb<5> loc=p58;
011- net rsb<6> loc=p60;
012- net db<1> loc=p41;
013- net db<2> loc=p40;
014- net db<3> loc=p39;
015- net db<4> loc=p38;
016- net db<5> loc=p35;
017- net db<6> loc=p81;
018- net db<7> loc=p80;
019- net db<8> loc=p10;
Listing 23: XS95 UCF file for the PS/2 keyboard interface.
001- net rst loc=p45;
002- net oeb loc=p62;
003- net kb_data loc=p70;
004- net kb_clk loc=p26;
005- net rsb<0> loc=p58;
006- net rsb<1> loc=p56;
007- net rsb<2> loc=p54;
008- net rsb<3> loc=p55;
009- net rsb<4> loc=p53;
010- net rsb<5> loc=p57;
011- net rsb<6> loc=p61;
012- net db<1> loc=p44;
013- net db<2> loc=p43;
014- net db<3> loc=p41;
015- net db<4> loc=p40;
016- net db<5> loc=p39;
017- net db<6> loc=p37;
018- net db<7> loc=p36;
019- net db<8> loc=p35;
4.4 Inputing and Outputing Stereo Signals Through the Codec
The stereo codec on the XStend Board is capable of digitizing two analog signals to 20 bits of
resolution while simultaneously generating two analog signals from 20-bit values. A high-level
view of the codec chip is shown on the right-half of Figure 13. Two analog inputs (which are
tpically the left and right channels of a stereo audio signal) enter the codec and are digitized into
two 20-bit values by analog-to-digital converters (ADCs). These values are loaded into shift
registers which are shifted out of a single pin of the codec under control of a shift clock and a
left/right channel selector control input. At the same time, 20-bit values are alternately shifted
into two shift registers in the codec which feed digital-to-analog converters (DACs) that drive
two analog outputs. Signals on these outputs are typically the left and right channels of a stereo
audio signal.
If the FPLD is handling these values in a bit-parallel manner, then the FPLD must contain a set of
shift registers which convert the serial input stream into 20-bit values and another set which
converts 20-bit values into a serial output stream. This is shown in the left-half of Figure 13.
The gating of these shift registers onto the serial input and output pins is synchronized with the
same left/right channel select signal used by the codec chip.
In addition to the shift registers, the FPLD needs circuitry to read and write them and to indicate
when they are full and empty. Since the codec ADCs and DACs generate and consume data at a
set sample rate, it is also necessary to build circuitry which detects overflow and underflow of the
FPLD shift registers if they are not read or written in time.
Figure 13: Connections between the XStend codec chip and the XS Board FPGA or CPLD.
• a clock generator module which outputs the serial data shift clock and the left/right channel
select signals;
• a channel module which contains the shift registers, buffers, read/write control, and
overflow/underflow detection circuitry for a single input/output stream of data;
• a top-level module which combines the clock generator module with two channel modules to
form a complete codec interface circuit.
The VHDL code for the clock generator module is detailed in Listing 24. The inputs and outputs
of the clock generator as defined in the entity declaration are as follows:
clk: This is the main clock input which is typically the 12 MHz clock from the XS Board.
reset: This input synchronously resets the counter the clock generator.
mclk: This output is the master clock for the codec chip.
sclk: This output is the clock for synchronizing serial data transfers between the FPLD and the
codec.
lrck: This output controls the activation of the left and right channel circuitry in the codec and
the FPLD.
bit_cntr: These outputs indicate the current bit being transmitted and received in the serial data
streams.
subcycle_cntr: The duration of each serial data bit is divided into four phases and these outputs
indicate the current phase.
Within the main body of the clock generator architecture section, these operations occur:
gen_clock: This process increments the sequencing counter and toggles the left/right channel
selector when the count reaches the duration for which a channel is active. The codec chip
requires that the channel duration be either 128, 192, or 256 master clock periods in length.
Thus, the total time to handle both channels is 256, 384, or 512 clock periods. This sets the
sampling rate. So using a channel duration of 128 with a 12 MHz clock gives a sampling rate
of 46.875 KHz that is sufficient for audio.
Lines 45-47: The various clocks are output on these lines. The master clock and left/right
selector have already been discussed. The serial data shift clock is one-quarter of the master
clock. So transmitting or receiving a 20-bit value will require 4 × 20 = 80 clock periods, and
this will fit within the shortest possible channel duration.
Line 48: The position of the current data bit in the serial stream for a channel is output here.
Since each bit has a duration of four clock periods, the position of the bit in the stream is just
the sequence counter with the two least-significant bits removed.
Line 49: The position within a bit is output on this line. This is given by the two least-significant
bits of the sequence counter.
Listing 24: VHDL code for the codec clock generator module.
001- LIBRARY IEEE,codec;
002- USE IEEE.STD_LOGIC_1164.ALL;
003- USE IEEE.std_logic_unsigned.ALL;
004- USE codec.codec.ALL;
005-
006- ENTITY clkgen IS
007- GENERIC
008- (
009- channel_duration: POSITIVE := 128 -- must be 128, 192, or 256
010- );
011- PORT
012- (
013- -- interface I/O signals
014- clk: IN STD_LOGIC; -- clock input
015- reset: IN STD_LOGIC; -- synchronous active-high reset
016- -- codec chip clock signals
017- mclk: OUT STD_LOGIC; -- master clock output to codec
018- sclk: OUT STD_LOGIC; -- serial data clock to codec
019- lrck: OUT STD_LOGIC; -- left/right codec channel select
020- bit_cntr: OUT STD_LOGIC_VECTOR(5 DOWNTO 0);
021- subcycle_cntr: OUT STD_LOGIC_VECTOR(1 DOWNTO 0)
022- );
023- END clkgen;
024-
025- ARCHITECTURE clkgen_arch OF clkgen IS
026- SIGNAL lrck_int: STD_LOGIC;
027- SIGNAL seq: STD_LOGIC_VECTOR(7 DOWNTO 0);
028- BEGIN
029- gen_clock:
030- PROCESS(clk,seq,lrck_int)
031- BEGIN
032- IF (clk'EVENT AND clk='1') THEN
033- IF(reset=yes) THEN -- synchronous reset
034- seq <= (OTHERS=>'0');
035- lrck_int <= left; -- start with left channel of codec
036- ELSIF(seq=channel_duration-1) THEN
037- seq <= (OTHERS=>'0'); -- reset seq every channel period
038- lrck_int <= NOT(lrck_int); -- toggle chan select every period
039- ELSE
040- seq <= seq+1; -- normally, just inc the sequencer
041- lrck_int <= lrck_int; -- don’t change channel selector
042- END IF;
043- END IF;
044- END PROCESS;
045- lrck <= lrck_int; -- output the channel selector to the codec
046- mclk <= clk; -- codec master clock equals input clock
047- sclk <= seq(1); -- serial shift clock is 1/4 of the master clock
048- bit_cntr <= seq(7 DOWNTO 2); -- which bit period is being processed
049- subcycle_cntr <= seq(1 DOWNTO 0); -- position within bit
050- END clkgen_arch;
The VHDL code for the channel module is shown in Listing 25. The inputs and outputs of the
clock generator as defined in the entity declaration are as follows:
clk: This is the main clock input which is typically the 12 MHz clock from the XS Board.
chan_on: A high level on this input activates the channel. This input is usually controlled by the
left/right channel selector.
bit_cntr: These inputs inform the channel of the index of the serial data bit currently being
transmitted and received.
chan_sel: A high level on this input enables the interface that lets the shift registers be read and
written. (Note that despite its name, this input is not controlled by the left/right channel
selector.)
rd: A high level on this input outputs the value stored in the shift register connected to the ADC.
wr: A high level on this input writes a new value into the shift register connected to the DAC.
adc_out: The bits stored in the ADC shift register are read out in parallel through these outputs..
dac_in: The DAC shift register is loaded in parallel with bits passed through these inputs.
adc_out_rdy: This output goes high after all the bits have been shifted from the codec into the
ADC shift register.
adc_overrun: This output goes high if new serial data is shifted into the ADC shift register
before the old contents have been read out through the parallel outputs.
dac_in_rdy: This output goes high after all the bits in the DAC shift register have been shifted
over to the codec.
dac_underrun: This output goes high if the DAC shift register starts shifting data over to the
codec before it has been written through the parallel inputs.
sdin: The serial data stream for the codec DAC is shifted out through this output. (Note that
this output takes its name from the pin it is connected to on the codec chip; it is not an input.)
sdout: The serial data stream from the codec ADC is shifted in through this input. (Note that
this input takes its name from the pin it is connected to on the codec chip; it is not an output.)
Within the main body of the channel module architecture section, these operations occur:
rcv_adc: This process receives serial data from the ADC in the codec. The ADC shift register is
cleared upon reset and a flag is set which indicates the shift register does not contain all the
bits from the ADC. Once the reset is removed and the channel is active, bits are shifted into
the register during the second subcycle of each bit period (the subcycles are numbered 0, 1, 2
and 3). Accepting data on the second subcycle gives the serial data bit plenty of time to
stabilize. The first bit of the serial data (when the bit counter equals 0) contains no data and
is discarded. Then bits 1,2,..., up to the width of the ADC data value are pushed into the shift
register. Then the shifting stops. The shift register is marked as ‘not full’ as soon as a single
bit is shifted in so that the value will not be inadvertently read. The shift register status
changes to full as soon as the last bit enters the shift register.
Line 66: The contents of the shift register are output in a parallel format on this line. These
outputs are not latched and will change as bits are shifted into the register.
Line 69: A flag is maintained that indicates whether the contents of the ADC shift register have
been read. The flag is set when the ADC register for the channel is full and it is selected for a
read operation. The flag will stay set after the read operation is complete. Reading the
register does not empty it. The shift register is no longer full only when the first bit of the
next sample is shifted into it. This will reset the read flag.
read_adc: This process updates the flag that indicates whether the ADC shift register has been
read.
Lines 84—85: A status output is asserted when the data in the ADC shift register is ready for
reading. Reads are permitted when the register is full and has not yet been read. This output
is cleared as soon as a read occurs or new data is shifted into the register.
detect_adc_overrun: This process monitors the ADC shift register and flags an error condition
if the register begins accepting bits from the current sample period but the data from the
previous period has not yet been read.
tx_dac: This process transmits serial data to the DAC in the codec. The DAC shift register is
cleared upon reset and a flag is set which indicates the shift register contains no bits for the
DAC. After the reset is removed, the register can be loaded in parallel if the channel is
selected for a write operation. If no write operation is in process but the channel is active,
then data is shifted out to the codec on the second subcycle. (This gives the data some hold
time so the codec chip can clock it in reliably.) No data is output during the first bit period
because the codec discards this bit, but a flag is set which indicates the register is no longer
empty and a serial transmission is in process. Then bits 1,2,..., up to the width of the DAC
data value are shifted out. As the last bit is output, the flag is set to show the shift register is
now empty.
Line 124: The DAC serial data input of the codec chip is driven by the most-significant bit of the
DAC shift register.
Line 127: A flag is maintained that indicates whether the DAC shift register has been written.
The flag is set when the DAC register for the channel is empty and it is selected for a write
operation. The flag will stay set after the write operation is complete. Writing the register
does not fill it. The shift register is full only when the first bit of the next sample period is
shifted out of it. This will reset the write flag.
write_dac: This process updates the flag that indicates whether the DAC shift register has been
written.
Lines 142—143: A status output is asserted when the DAC shift register is ready to be written
with new input data. Writes are permitted when the register is empty and has not yet been
written. This output is cleared as soon as a write occurs or when data bits start shifting out
of the register.
detect_dac_underrun: This process monitors the DAC shift register and flags an error condition
if the register starts shifting out data but has not yet been written with a new data value for
the current sample period.
clk: This is the main clock input which is typically the 12 MHz clock from the XS Board.
reset: This input synchronously resets the two channel modules and the clock generator.
lrsel: This input selects either the right or left channel for parallel read or write operations.
rd: A high level on this input outputs the value stored in the selected shift register connected to
the ADC.
wr: A high level on this input writes a new value into the selected shift register connected to the
DAC.
ladc_out, radc_out: The bits stored in the left and right ADC shift registers are read out in
parallel through these outputs..
ldac_in, rdac_in: The DAC shift registers are loaded in parallel with bits passed through these
inputs.
ladc_out_rdy, rdac_out_rdy: These outputs go high after all the bits have been shifted from the
codec into the left or right ADC shift register, respectively.
adc_overrun: This output goes high if new serial data is shifted into either the left or right ADC
shift register before the old contents have been read out through the parallel outputs.
ldac_in_rdy, rdac_in_rdy: These outputs go high after all the bits in the left or right DAC shift
register have been shifted over to the codec, respectively.
dac_underrun: This output goes high if either the left or right DAC shift register starts shifting
data over to the codec before it has been written through the parallel inputs.
mclk: This output is the master clock for the codec chip.
sclk: This output is the clock for synchronizing serial data transfers between the FPLD and the
codec.
lrck: This output controls the activation of the left and right channel circuitry in the codec.
sdin: The serial data stream for the codec DAC is shifted out through this output.
sdout: The serial data stream from the codec ADC is shifted in through this input.
Within the main body of the top-level module architecture section, the following modules are
instantiated:
u0: One clock generator module is instantiated. It receives the 12 MHz clock as an input and
generates the master clock, left/right clock, and serial shift clock for the codec. It also
outputs the position of the current bit in the serial stream and the current cycle within each bit
period.
u_left: The module which handles the left channel of the codec is instantiated. This module is
activated during one half of the left/right clock period. It is selected for reading or writing by
the left/right selection input.
u_right: The module which handles the right channel of the codec is instantiated. This module is
activated during the other half of the left/right clock period. It is selected for reading and
writing by the opposite polarity of the left/right selection input.
Lines 129—130: The overrun and underrun error indicators for the total codec interface are
formed by the logical-OR of the associated error outputs of the left and right channel
modules. Thus an error is reported if either channel reports an error.
Line 134: The serial data stream that is transmitted to the codec chip is selected from the output
data stream of the currently-active channel module.
Listing 26: VHDL code for the top-level codec interface module.
001- LIBRARY IEEE,codec;
002- USE IEEE.STD_LOGIC_1164.ALL;
003- USE IEEE.std_logic_unsigned.ALL;
004- USE codec.codec.ALL;
005-
006- ENTITY codec_intfc IS
007- GENERIC
008- (
009- dac_width: POSITIVE := 20;
010- adc_width: POSITIVE := 20;
011- channel_duration: POSITIVE := 128 -- must be 128, 192, or 256
012- );
013- PORT
014- (
015- -- interface I/O signals
016- clk: IN STD_LOGIC; -- clock input
017- reset: IN STD_LOGIC; -- synchronous active-high reset
018- lrsel: IN STD_LOGIC; -- select the left/right chan for rd/wr
019- rd: IN STD_LOGIC; -- read from the codec ADC
020- wr: IN STD_LOGIC; -- write to the codec DAC
021- ladc_out: OUT STD_LOGIC_VECTOR(adc_width-1 DOWNTO 0); -- left ADC
022- radc_out: OUT STD_LOGIC_VECTOR(adc_width-1 DOWNTO 0); -- right ADC
023- ldac_in: IN STD_LOGIC_VECTOR(dac_width-1 DOWNTO 0); -- left DAC
024- rdac_in: IN STD_LOGIC_VECTOR(dac_width-1 DOWNTO 0); -- right DAC
025- ladc_out_rdy: OUT STD_LOGIC; -- left ADC output is ready to be read
026- radc_out_rdy: OUT STD_LOGIC; -- right ADC output is ready to be read
027- adc_overrun: OUT STD_LOGIC; -- ADC data overwritten before read
028- ldac_in_rdy: OUT STD_LOGIC; -- left DAC input ready to be written
029- rdac_in_rdy: OUT STD_LOGIC; -- right DAC input ready to be written
030- dac_underrun: OUT STD_LOGIC; -- DAC not written to in time
031- -- codec chip I/O signals
032- mclk: OUT STD_LOGIC; -- master clock output to codec
033- sclk: OUT STD_LOGIC; -- serial data clock to codec
034- lrck: OUT STD_LOGIC; -- left/right codec channel select
035- sdin: OUT STD_LOGIC; -- serial output to codec DAC
036- sdout: IN STD_LOGIC -- serial input from codec ADC
037- );
038- END codec_intfc;
039-
040- ARCHITECTURE codec_intfc_arch OF codec_intfc IS
041- SIGNAL lrck_int: STD_LOGIC; -- internal left/right codec channel select
042- SIGNAL bit_cntr: STD_LOGIC_VECTOR(5 DOWNTO 0);
043- SIGNAL subcycle_cntr: STD_LOGIC_VECTOR(1 DOWNTO 0);
044- SIGNAL lsdin: STD_LOGIC;
045- SIGNAL rsdin: STD_LOGIC;
046- SIGNAL ladc_overrun: STD_LOGIC;
047- SIGNAL radc_overrun: STD_LOGIC;
048- SIGNAL ldac_underrun: STD_LOGIC;
049- SIGNAL rdac_underrun: STD_LOGIC;
050- SIGNAL lchan_sel: STD_LOGIC;
051- SIGNAL rchan_sel: STD_LOGIC;
052- SIGNAL lchan_on: STD_LOGIC;
053- SIGNAL rchan_on: STD_LOGIC;
054- BEGIN
055-
056- u0: clkgen
057- GENERIC MAP
058- (
059- channel_duration=>channel_duration
060- )
061- PORT MAP
062- (
063- clk=>clk,
064- reset=>reset,
065- mclk=>mclk,
066- sclk=>sclk,
067- lrck=>lrck_int,
068- bit_cntr=>bit_cntr,
069- subcycle_cntr=>subcycle_cntr
070- );
071- lrck <= lrck_int;
072-
073- lchan_sel <= yes WHEN lrsel=left ELSE no;
074- lchan_on <= yes WHEN lrck_int=left ELSE no;
075- u_left: channel
076- GENERIC MAP
077- (
078- dac_width=>dac_width,
079- adc_width=>adc_width
080- )
081- PORT MAP
082- (
083- clk=>clk,
084- reset=>reset,
085- chan_on=>lchan_on,
086- bit_cntr=>bit_cntr,
087- subcycle_cntr=>subcycle_cntr,
088- chan_sel=>lchan_sel,
089- rd=>rd,
090- wr=>wr,
091- adc_out=>ladc_out,
092- dac_in=>ldac_in,
093- adc_out_rdy=>ladc_out_rdy,
094- adc_overrun=>ladc_overrun,
095- dac_in_rdy=>ldac_in_rdy,
096- dac_underrun=>ldac_underrun,
097- sdin=>lsdin,
098- sdout=>sdout
099- );
100-
101- rchan_sel <= yes WHEN lrsel=right ELSE no;
102- rchan_on <= yes WHEN lrck_int=right ELSE no;
103- u_right: channel
104- GENERIC MAP
105- (
106- dac_width=>dac_width,
107- adc_width=>adc_width
108- )
109- PORT MAP
110- (
111- clk=>clk,
112- reset=>reset,
113- chan_on=>rchan_on,
114- bit_cntr=>bit_cntr,
115- subcycle_cntr=>subcycle_cntr,
116- chan_sel=>rchan_sel,
117- rd=>rd,
118- wr=>wr,
119- adc_out=>radc_out,
120- dac_in=>rdac_in,
121- adc_out_rdy=>radc_out_rdy,
122- adc_overrun=>radc_overrun,
123- dac_in_rdy=>rdac_in_rdy,
124- dac_underrun=>rdac_underrun,
125- sdin=>rsdin,
126- sdout=>sdout
127- );
128-
129- dac_underrun <= yes WHEN ldac_underrun=yes OR rdac_underrun=yes ELSE no;
130- adc_overrun <= yes WHEN ladc_overrun=yes OR radc_overrun=yes ELSE no;
131-
132- -- generates the serial data output to the SDIN pin of the
133- -- codec DAC depending on which channel is active
134- sdin <= lsdin WHEN lrck_int=left ELSE rsdin;
135-
136- END codec_intfc_arch;
The interfaces to these three modules are placed into the package shown in
Listing 27. (The I/O declarations in the COMPONENT constructs have been removed for the
sake of brevity.) The declarations for the constants used in these modules are also included in the
package.
Listing 27 : VHDL code for the codec package.
001- LIBRARY IEEE;
002- USE IEEE.STD_LOGIC_1164.ALL;
003- USE IEEE.std_logic_unsigned.ALL;
004-
005- PACKAGE codec IS
006- CONSTANT yes: STD_LOGIC := '1';
007- CONSTANT no: STD_LOGIC := '0';
008- CONSTANT ready: STD_LOGIC := '1';
009- CONSTANT overrun: STD_LOGIC := '1';
010- CONSTANT underrun: STD_LOGIC := '1';
011- CONSTANT left: STD_LOGIC := '0';
012- CONSTANT right: STD_LOGIC := '1';
013-
014- COMPONENT clkgen
015- GENERIC
016- (
017- ...
018- );
019- PORT
020- (
021- ...
022- );
023- END COMPONENT;
024-
025- COMPONENT channel
026- GENERIC
027- (
028- ...
029- );
030- PORT
031- (
032- ...
033- );
034- END COMPONENT;
035-
036- COMPONENT codec_intfc
037- GENERIC
038- (
039- ...
040- );
041- PORT
042- (
043- ...
044- );
045- END COMPONENT;
046- END PACKAGE;
Once the codec interface module is completed and packaged, we can use it in an application.
The simplest use is to have the FPLD accept the left and right stereo inputs from the codec
ADCs and loop these back to the codec DACs so they can output the stereo signals.
The VHDL code for the loopback application is detailed in Listing 29. The inputs and outputs
of the loopback design are as follows:
reset: A high level on this input synchronously resets the codec interface module. The reset
input is driven from the parallel port of the PC.
mclk: This output is the master clock for the codec chip.
lrck: This output controls the activation of the left and right channel circuitry in the codec and
the codec interface.
sclk: This output is the clock for synchronizing serial data transfers between the FPLD and the
codec.
sdout: The serial data stream from the codec ADCs are shifted in through this input.
sdin: The serial data stream for the codec DACs are shifted out through this output.
The following modules and processes are placed within the main body of the loopback
application:
u0: This is the instantiation of the codec interface module. Note that the ADC output buses of
this module are connected back to the DAC input buses on lines 43—46.
loop: This process controls the reading of each ADC and the writing of the value back to the
associated DAC. For example, if the output of the left channel ADC is ready to be read and
the left channel DAC is ready to be written, then the left channel is selected and the read and
write control lines are asserted. This reads the data from the ADC shift register and writes it
into the DAC shift register during a single clock cycle. Then the ADC and DAC registers
will no longer be ready for reading or writing so the read and write signals will be deasserted.
Listing 29: VHDL code for a design that uses the codec interface module to do loopback.
001- LIBRARY IEEE,codec;
002- USE IEEE.STD_LOGIC_1164.ALL;
003- USE codec.codec.ALL;
004-
005- ENTITY loopback IS
006- PORT
007- (
008- clk: IN STD_LOGIC; -- 12 MHz clock
009- rst: IN STD_LOGIC; -- active-high reset
010- mclk: OUT STD_LOGIC; -- master clock to codec
011- lrck: OUT STD_LOGIC; -- left/right clock to codec
012- sclk: OUT STD_LOGIC; -- serial data shift clock to codec
013- sdout: IN STD_LOGIC; -- serial data from codec ADCs
014- sdin: OUT STD_LOGIC; -- serial data to codec DACs
015- s: OUT STD_LOGIC_VECTOR(1 DOWNTO 0) –- LED segments
016- );
017- END loopback;
018-
019- ARCHITECTURE loopback_arch OF loopback IS
020- SIGNAL lrsel,rd,wr: STD_LOGIC;
021- SIGNAL left_channel,right_channel: STD_LOGIC_VECTOR(7 DOWNTO 0);
022- SIGNAL ldac_in_rdy,rdac_in_rdy: STD_LOGIC;
023- SIGNAL ladc_out_rdy,radc_out_rdy: STD_LOGIC;
024- BEGIN
025- u0: codec_intfc
026- GENERIC MAP
027- (
028- adc_width=>20,
029- dac_width=>20
030- )
031- PORT MAP
032- (
033- clk=>clk,
034- reset=>rst,
035- mclk=>mclk,
036- sclk=>sclk,
037- lrck=>lrck,
038- sdout=>sdout,
039- sdin=>sdin,
040- lrsel=>lrsel,
041- rd=>rd,
042- wr=>wr,
043- ladc_out=>left_channel, -- loop the left channel ADC
044- ldac_in=>left_channel, -- to the left channel DAC
045- radc_out=>right_channel, -- loop the right channel ADC
046- rdac_in=>right_channel, -- to the right channel DAC
047- ladc_out_rdy=>ladc_out_rdy,
048- radc_out_rdy=>radc_out_rdy,
049- ldac_in_rdy=>ldac_in_rdy,
050- rdac_in_rdy=>rdac_in_rdy,
051- dac_underrun=>s(0), -- connect underrun and overrun
052- adc_overrun=>s(1) -- error indicators to LEDs
053- );
054-
055- loop: PROCESS(ldac_in_rdy,ladc_out_rdy,rdac_in_rdy,radc_out_rdy)
056- BEGIN
057- IF(ladc_out_rdy=yes AND ldac_in_rdy=yes) THEN
058- lrsel<=left; -- loopback the left channel
059- rd<=yes; -- assert the read and
060- wr<=yes; -- write control signals
061- ELSIF(radc_out_rdy=yes AND rdac_in_rdy=yes) THEN
062- lrsel<=right; -- loopback the right channel
063- rd<=yes; -- assert the read and
064- wr<=yes; -- write control signals
065- ELSE
066- lrsel<=left; -- default channel selection
067- rd<=no; -- but don’t read or
068- wr<=no; -- write the registers
069- END IF;
070- END PROCESS;
071- END loopback_arch;
Listing 30: XS40 UCF file for the stereo signal loopback application.
001- net clk loc=p13;
002- net rst loc=p44;
003- net sdout loc=p6;
004- net mclk loc=p9;
005- net lrck loc=p66;
006- net sdin loc=p70;
007- net sclk loc=p77;
008- net s<0> loc=p25;
009- net s<1> loc=p26;
Listing 31: XS95 UCF file for the stereo signal loopback application.
001- net clk loc = p9
002- net rst loc = p46
003- net sdout loc = p5
004- net mclk loc = p11
005- net lrck loc = p66
006- net sdin loc = p71
007- net sclk loc = p72
008- net s<0> loc = p21
009- net s<1> loc = p23
The steps for compiling and testing the design using an XS40 combined with an XStend Board
are as follows:
• Compile the synthesized netlist using the LOOP40.UCF constraint file (Listing 30).
• Mount an XS40 Board in the XStend Board and attach the downloading cable from the
XS40 to the PC parallel port. Apply 9VDC though jack J9 of the XS40. Remove the shunts
from jumpers J4, J7, and J8 to disable the LEDs. Place a shunt on jumper J17 so the codec
serial output data stream can reach the FPLD. Set all the DIP switches to the OPEN
position.
• Connect a stereo audio source (such as a CD player) to jack J9. Then plug a set of stereo
mini-headphones into jack J10.
• Download the LOOP40.BIT file into the XS40/XStend combination with the command:
XSLOAD LOOP40.BIT.
• Release the reset on the loopback circuit with the command XSPORT 0.
• Start the CD player and listen to the result with the headphones.
The steps for compiling and testing the design using an XS95 combined with an XStend Board
are as follows:
• Mount an XS95 Board in the XStend Board and attach the downloading cable from the
XS95 to the PC parallel port. Apply 9VDC though jack J9 of the XS95. Remove the shunts
from jumpers J4, J7, and J8 to disable the LEDs. Place a shunt on jumper J17 so the codec
serial output data stream can reach the FPLD. Set all the DIP switches to the OPEN
position.
• Connect a stereo audio source (such as a CD player) to jack J9. Then plug a set of stereo
mini-headphones into jack J10.
• Download the LOOP95.BIT file into the XS95/XStend combination with the command:
XSLOAD LOOP95.BIT.
• Release the reset on the loopback circuit with the command XSPORT 0.
• Start the CD player and listen to the result with the headphones.
5 XStend V1.2 Schematics
The detailed schematics for the XStend Board are on the following pages.
xstnd1_2.sch-1 - Thu Oct 15 00:58:19 1998
xstnd1_2.sch-2 - Thu Oct 15 00:58:22 1998
xstnd1_2.sch-3 - Thu Oct 15 00:58:24 1998
xstnd1_2.sch-4 - Thu Oct 15 00:58:26 1998
xstnd1_2.sch-5 - Thu Oct 15 00:58:27 1998
XStend Board V1.3 Manual
Revision 1.0, 3/19/1999
XESS Corporation
All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted in
any form or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior
written permission of the publisher. Printed in the United States of America.
Limited Warranty
X Engineering Software Systems Corp. (XESS) warrants that the Product, in the course of its normal use, will be
free from defects in material and workmanship for a period of one (1) year and will conform to XESS’s
specification therefor. This limited warranty shall commence on the date appearing on your purchase receipt.
XESS shall have no liability for any Product returned if XESS determines that the asserted defect a) is not present,
b) cannot reasonably be rectified because of damage occurring before XESS receives the Product, or c) is
attributable to misuse, improper installation, alteration, accident or mishandling while in your possession. Subject
to the limitations specified above, your sole and exclusive warranty shall be, during the period of warranty
specified above and at XESS’s option, the repair or replacement of the product. The foregoing warranty of XESS
shall extend to repaired or replaced Products for the balance of the applicable period of the original warranty or
thirty (30) days from the date of shipment of a repaired or replaced Product, whichever is longer.
THE FOREGOING LIMITED WARRANTY IS XESS’S SOLE WARRANTY AND IS APPLICABLE ONLY TO
PRODUCTS SOLD AS NEW. THE REMEDIES PROVIDED HEREIN ARE IN LIEU OF a) ANY AND ALL
OTHER REMEDIES AND WARRANTIES, WHETHER EXPRESSED OR IMPLIED OR STATUTORY,
INCLUDING BUT NOT LIMITED TO, ANY IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS
FOR A PARTICULAR PURPOSE, AND b) ANY AND ALL OBLIGATIONS AND LIABILITIES OF XESS
FOR DAMAGES INCLUDING, BUT NOT LIMITED TO ACCIDENTAL, CONSEQUENTIAL, OR SPECIAL
DAMAGES, OR ANY FINANCIAL LOSS, LOST PROFITS OR EXPENSES, OR LOST DATA ARISING OUT
OF OR IN CONNECTION WITH THE PURCHASE, USE OR PERFORMANCE OF THE PRODUCT, EVEN IF
XESS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
In the United States, some statutes do not allow exclusion or limitations of incidental or consequential damages,
so the limitations above may not apply to you. This warranty gives you specific legal rights, and you may also
have other rights which vary from state to state.
XStend Board V1.3 Manual 2
Table of Contents
1 XStend Overview ......................................................... 3
4.2 Displaying Graphics from RAM Through the VGA Interface .............. 24
4.3 Reading Keyboard Scan Codes Through the PS/2 Interface .............. 37
4.4 Inputing and Outputing Stereo Signals Through the Codec ............. 42
Getting Help!
If you follow the instructions in this manual and you encounter problems, here are some places to
get help:
• If you can't get the XStend Board hardware to work, send an e-mail message describing your
problem to fpga-bugs@xess.com or check our web site at
http://www.xess.com/FPGA.
• If you can't get your XILINX software tools installed properly, send an e-mail message
describing your problem to hotline@xilinx.com or check their web site at
http://www.xilinx.com/support/searchtd.htm.
1 XStend Overview
The XS40 and XS95 Boards offer a flexible, low-cost method of prototyping FPGA and CPLD
designs. However, their small physical size limits the amount of support circuitry they can hold.
The XStend Board removes this limitation by providing additional support circuitry that the
XS40 and XS95 Boards can access through their breadboard interfaces.
The XStend Board contains resources that extend the range of applications of the XS Boards
into three areas:
• The pushbuttons, DIP switches, LEDs, and prototyping area are useful for basic lab
experiments. These features in combination with the XS Boards replicates the functionality
of the older HW/UW FPGABOARD.
• The VGA monitor interface, PS/2 keyboard/mouse interface, and static RAM let the XS
Boards be used in video and computing experiments.
• The stereo codec and dual-channel analog input/output circuitry are useful for processing of
audio signals in combination with DSP circuits synthesized with XILINX's CORE generation
software.
These resources are shown in the simplified view of the XStend Board (Figure 1). Each of these
resources will be described below.
If the XS Board is connected to a power supply through jack J9, then its power regulation
circuitry will supply VCC and GND to the XStend Board through the mounting sockets. XS40
Boards with 3.3V FPGAs will supply both 3.3V and 5V to the XStend Board, while XS40
Boards with 5V FPGAs and XS95 Boards will supply only 5V.
*Warning: Version 1.0 of the XS40 Board with a 3.3V XC4000XL FPGA will not work with
the XStend Board because it supplies 3.3V but no 5V! You must replace the XC4000XL
FPGA with an XC4000E FPGA and remove the J8 jumper on the XS40 board to switch the
board to 5V operation. Ignore this warning if you have Version 1.1 or higher.
External voltage supplies can also be used with the XStend Board. A 5V power supply can be
connected to header J12 and a 3.3V supply can be attached to header J14 as shown in Figure 2.
These supplies will power the attached XS Board as well as the XStend electronics.
*Warning: Do not attach external voltage supplies while also supplying power to the XStend
Board with an XS Board.
*Warning: Never place shunts on either J12 or J14 or you will short the power supplies to
ground and damage the XStend Board and the attached XS Board..
2.2 LEDs
The XStend Board provides a bargraph LED with eight LEDs (D1—D8) and two more LED
displays (U1 and U2) for use by an XS Board. All of these LEDs are active-low meaning that an
LED segment will glow when a logic-low is applied to it.
The LEDs are enabled and disabled by setting the shunts on the 2-pin jumpers as described in
Table 1.
Jumper Setting
Listing 1 and Listing 2: Connections between the XStend LEDs and the XS95. show the
connections from the XS40 and XS95 Boards to the LEDs on the XStend Board expressed as
UCF constraints (for the UCF syntax and usage tips, check out
http://www.xilinx.com/techdocs/2449.htm).
2.3 Switches
The XStend has a bank of eight DIP switches and two pushbuttons (labeled SPARE and RESET)
that are accessible from an XS Board. (There is a third pushbutton labeled PROGRAM which is
used to initiate the programming of the XS40 Board. It is not intended to be a general-purpose
input.)
When closed or ON, each DIP switch pulls the connected pin of the XS Board to ground. When
the DIP switch is open or OFF, the pin is pulled high through a 10KΩ resistor.
*When not being used, the DIP switches should be left in the open or OFF configuration so
the pins of the XS Board are not tied to ground and can freely move between logic low and
high levels.
When pressed, each pushbutton pulls the connected pin of the XS Board to ground. Otherwise,
the pin is pulled high through a 10 KΩ resistor.
Listing 3 and Listing 4 show the connections from the XS40 and XS95 Boards to the switches
on the XStend Board expressed as UCF constraints.
Listing 3: Connections between the XStend DIP and pushbutton switches and the XS40.
# DIP SWITCH CONNECTIONS
NET DIPSW<1> LOC=P7;
NET DIPSW<2> LOC=P8;
NET DIPSW<3> LOC=P9;
NET DIPSW<4> LOC=P6;
NET DIPSW<5> LOC=P77;
NET DIPSW<6> LOC=P70;
NET DIPSW<7> LOC=P66;
NET DIPSW<8> LOC=P69;
#
# PUSHBUTTON SWITCH CONNECTIONS (ACTIVE-LOW)
NET SPAREB LOC=P67;
NET RESETB LOC=P37;
Listing 4: Connections between the XStend DIP and pushbutton switches and the XS95.
# DIP SWITCH CONNECTIONS
NET DIPSW<1> LOC=P6;
NET DIPSW<2> LOC=P7;
NET DIPSW<3> LOC=P11;
NET DIPSW<4> LOC=P5;
NET DIPSW<5> LOC=P72;
NET DIPSW<6> LOC=P71;
NET DIPSW<7> LOC=P66;
NET DIPSW<8> LOC=P70;
#
# PUSHBUTTON SWITCH CONNECTIONS (ACTIVE-LOW)
NET SPAREB LOC=P67;
NET RESETB LOC=P10;
Listing 5 and Listing 6 show the connections from the XS40 and XS95 Boards to the VGA
interface of the XStend Board. (These pin assignments are identical to the pin assignments for
the XS Boards which have their own VGA interfaces.)
Listing 5: Connections between the XStend VGA interface and the XS40.
# VGA CONNECTIONS
NET VSYNCB LOC=P67;
NET HSYNCB LOC=P19;
NET RED<1> LOC=P18;
NET RED<0> LOC=P23;
NET GREEN<1> LOC=P20;
NET GREEN<0> LOC=P24;
NET BLUE<1> LOC=P26;
NET BLUE<0> LOC=P25;
Listing 6: Connections between the XStend VGA interface and the XS95.
# VGA CONNECTIONS
NET VSYNCB LOC=P24;
NET HSYNCB LOC=P15;
NET RED<1> LOC=P14;
NET RED<0> LOC=P18;
NET GREEN<1> LOC=P17;
NET GREEN<0> LOC=P19;
NET BLUE<1> LOC=P23;
NET BLUE<0> LOC=P21;
Listing 7 and Listing 8 show the connections from the XS40 and XS95 Boards to the PS/2
interface of the XStend Board (expressed as UCF constraints):
Listing 7: Connections between the XStend PS/2 interface and the XS40.
# PS/2 KEYBOARD CONNECTIONS
NET KB_CLK LOC=P68;
NET KB_DATA LOC=P69;
Listing 8: Connections between the XStend PS/2 interface and the XS95.
# PS/2 KEYBOARD CONNECTIONS
NET KB_CLK LOC=P26;
NET KB_DATA LOC=P70;
2.6 RAMs
The XStend Board adds an additional 64 KBytes of RAM to the 32 KBytes already on the XS
Board. The XStend RAM connects to the same pins as the XS Board RAM for the address bus,
data bus, write-enable, and output-enable. The chip-selects of the XStend Board RAMs are
connected to different pins so all the RAMs can be individually selected.
Listing 9 and Listing 10 show the connections from the XS40 and XS95 Boards to their own
RAMs and the RAMs of the XStend Board (expressed as UCF constraints):
Listing 10: Connections between the XStend RAMs and the XS95.
NET D<0> LOC=P44; # DATA BUS
NET D<1> LOC=P43;
NET D<2> LOC=P41;
NET D<3> LOC=P40;
NET D<4> LOC=P39;
NET D<5> LOC=P37;
NET D<6> LOC=P36;
NET D<7> LOC=P35;
NET A<0> LOC=P75; # LOWER BYTE OF ADDRESS
NET A<1> LOC=P79;
NET A<2> LOC=P82;
NET A<3> LOC=P84;
NET A<4> LOC=P1;
Jumper Setting
Listing 11 and Listing 12 show the connections from the XS40 Board to the codec interface on
the XStend Board (expressed as UCF constraints):
Listing 11: Connections between the XStend stereo codec and the XS40 Board.
# STEREO CODEC CONNECTIONS
NET MCLK LOC=P9; # MASTER CLOCK TO CODEC
NET LRCK LOC=P66; # LEFT/RIGHT CODEC CHANNEL SELECT
NET SCLK LOC=P77; # SERIAL DATA CLOCK
NET SDOUT LOC=P6; # SERIAL DATA OUTPUT FROM CODEC
NET SDIN LOC=P70; # SERIAL DATA INPUT TO CODEC
NET CCLK LOC=P44; # CONTROL SIGNAL CLOCK
Listing 12: Connections between the XStend stereo codec and the XS95 Board.
# STEREO CODEC CONNECTIONS
NET MCLK LOC=P11; # MASTER CLOCK TO CODEC
NET LRCK LOC=P5; # LEFT/RIGHT CODEC CHANNEL SELECT
NET SCLK LOC=P72; # SERIAL DATA CLOCK
NET SDOUT LOC=P66; # SERIAL DATA OUTPUT FROM CODEC
NET SDIN LOC=P71; # SERIAL DATA INPUT TO CODEC
NET CCLK LOC=P46; # CONTROL SIGNAL CLOCK
NET CDIN LOC=P47; # SERIAL CONTROL INPUT TO CODEC
NET CSB LOC=P48; # SERIAL CONTROL CHIP SELECT
The analog stereo input and output signals enter and exit the XStend Board through the 1/8”
jacks J9 and J10, respectively. The output of an audio CD player can be input through J9 and a
set of small stereo headphones can be connected to J10 for listening to the processed output.
The digitized data output from the codec passes through jumper J17 on its way to the XS Board
inserted in the XStend Board. A shunt should be placed on J17 when the codec is being used.
Because the serial data output of the codec is not tristatable and because it shares the input to the
XS Board with other resources on the XStend Board, the shunt on J17 should be removed when
the codec is not being used.
• Remove the shunts from jumpers J4, J6, J10 and J11 of the XS40 Board;
The connections between the Xchecker cable and the XS40 Board is listed in Table 3.
Table 3: Connections between the XStend Board Xchecker interface and the XS40 Board.
Figure 3: Top-side view of the network of VCC and GND buses around the component
through-holes in the XStend Board prototyping area.
The placement of the shunt on jumper J16 will determine whether the VCC buses in the
prototyping area carry either 5V or 3.3V (see Figure 6). Of course the jumper selection will have
no effect unless you have both these voltages supplied to the XStend Board either by the XS
Board or by connecting external power supplies.
Connections from the XS Board to the prototyping area are made through connector J3. The
arrangement of pins on this connector exactly matches the arrangement of pins on the XS40
Board. For example, the pin at the bottom-left of J3 on the XStend Board corresponds to pin 21
at the bottom-left of the XS40 Board.
The XS95 Board has a completely different pin arrangement than the XS40. Therefore each pin
on J3 is explicitly labelled with the corresponding pin number on the XS95 Board. For example,
the pin at the bottom-left of J3 on the XStend Board is connected to pin 68 near the top-left of
the XS95 Board.
Items within the shaded area in each figure correspond to circuitry housed on the XS Board. The
remaining items are XStend Board resources.
A cursory glance at the figures reveals that many of the resources share connections. For
example, the codec, DIP switch, and microcontroller port P1 are all connected to the same set of
pins on the FPGA or CPLD. So any design has to ensure that only one of these resources is
outputing data at any particular time. (Hence the need in some designs to place the DIP switches
in the OPEN position, or remove the shunt through which the codec SDOUT drives serial data,
or keep the microcontroller in the reset state.)
Table 4 and Table 5 list the same interconnection data for the XS40 and XS95 Boards,
respectively, in a tabular format which makes it easier to see which resources share common
connections.
Table 4: Connections between the XS40 Board and the XStend Board resources.
Stereo Codec
Push-buttons
Power/ GND
BOARD Pin
PC Parallel
DIP Switch
(J1,J3,J18)
UW-FPGA
Oscillator
XS40 Pin
Interface
Interface
8051 uC
RAMs
LEDs
VGA
PS/2
Port
Function
2 +5V +5V power source
3 LSB0 A0 Left LED segment; RAM address line P35
4 LSB1 A1 Left LED segment; RAM address line P36
5 LSB2 A2 Left LED segment; RAM address line P29
6 DIPSW4 SDOUT P1.3 DIP switch; codec serial data output; uC I/O P24
7 DIPSW1 LCEB P1.0 DIP switch; left RAM chip-enable, uC I/O port P19
8 DIPSW2 RCEB P1.1 DIP switch; right RAM chip-enable, uC I/O port P20
9 DIPSW3 MCLK P1.2 DIP switch; codec master clock; uC I/O port P23
10 DB8 D7 P0.7 LED; RAM data line; uC muxed address/data line P61
13 CLK XS Board oscillator
14 PSENB uC program store-enable
15 JTAG TDI; DIN
16 JTAG TCK; CCLK
17 JTAG TMS
18 S5 RED1 XS Board LED segment; VGA color signal
19 S6 HSYNCB XS Board LED segment; VGA horiz. sync.
20 S3 GREEN1 XS Board LED segment; VGA color signal
23 S4 RED0 XS Board LED segment; VGA color signal
24 S2 GREEN0 XS Board LED segment; VGA color signal
25 S0 BLUE0 XS Board LED segment; VGA color signal
26 S1 BLUE1 XS Board LED segment; VGA color signal
27 P3.7 (RD_) uC read line
28 RDPB P2.7 Right LED decimal-point; uC I/O port P41
29 ALEB uC address-latch-enable
30 Serial EEPROM chip-enable
32 PC_D6 PC parallel port data output
34 PC_D7 PC parallel port data output
35 DB5 D4 P0.4 LED; RAM data line; uC muxed address/data line P66
36 RST uC reset
37 RESETB XTAL1 Pushbutton; uC clock P56
38 DB4 D3 P0.3 LED; RAM data line; uC muxed address/data line P57
39 DB3 D2 P0.2 LED; RAM data line; uC muxed address/data line P58
40 DB2 D1 P0.1 LED; RAM data line; uC muxed address/data line P59
41 DB1 D0 P0.0 LED; RAM data line; uC muxed address/data line P60
44 CCLK PC_D0 Codec control line; PC parallel port data output
45 CDIN PC_D1 Codec control line; PC parallel port data output
46 CSB PC_D2 Codec control line; PC parallel port data output
47 PC_D3 PC parallel port data output
48 PC_D4 PC parallel port data output
49 PC_D5 PC parallel port data output
50 RSB4 A12 P2.4 Right LED segment; RAM address line; uC I/O port P48
51 RSB2 A10 P2.2 Right LED segment; RAM address line; uC I/O port P45
52 GND Power supply ground
54 5.0V/3.3V 5V/3.3V power supply (4000E/4000XL)
55 PROGRAM XS40 configuration control P55
56 RSB3 A11 P2.3 Right LED segment; RAM address line; uC I/O port P51
57 RSB1 A9 P2.1 Right LED segment; RAM address line; uC I/O port P47
58 RSB5 A13 P2.5 Right LED segment; RAM address line; uC I/O port P50
59 RSB0 A8 P2.0 Right LED segment; RAM address line; uC I/O port P46
60 RSB6 A14 P2.6 Right LED segment; RAM address line; uC I/O port P49
61 OEB RAM output-enable
62 WEB P3.6 (WR_) RAM write-enable; uC I/O port
65 CEB XS Board RAM chip-enable
66 DIPSW7 LRCK P1.6 PC_S5 DIP switch; codec left-right channel switch; uC I/O port; PC parallel
P27 port status input
67 SPAREB VSYNCB P1.7 Pushbutton; VGA vert. sync.; uC I/O port P18
68 KB_CLK P3.4 (T0) PS/2 keyboard clock; uC I/O port
69 DIPSW8 KB_DATA P3.1 (TXD)
PC_S6 DIP switch; PS/2 keyboard serial data; uC I/O port; PC parallelP28port status input
70 DIPSW6 SDIN P1.5 PC_S3 DIP switch; codec serial input data; uC I/O port; PC parallel port
P26 status input
71 JTAG TDI; DIN
72 JTAG TDO; DOUT
73 JTAG TCK; CCLK
75 PC_S7 JTAG TDO; DOUT; PC parallel port status input
77 DIPSW5 SCLK P1.4 PC_S4 DIP switch; codec serial I/O clock; uC I/O port; PC parallel port
P25status input
78 LSB3 A3 Left LED segment; RAM address line P44
79 LSB4 A4 Left LED segment; RAM address line P38
80 DB7 D6 P0.6 LED; RAM data line; uC muxed address/data line P62
81 DB6 D5 P0.5 LED; RAM data line; uC muxed address/data line P65
82 LSB5 A5 Left LED segment; RAM address line P40
83 LSB6 A6 Left LED segment; RAM address line P39
84 LDPB A7 Left LED decimal-point; RAM address line P37
Table 5: Connections between the XS95 Board and the XStend Board resources.
Stereo Codec
Push-buttons
Power/ GND
BOARD Pin
PC Parallel
DIP Switch
XS95 Pins
UW-FPGA
Oscillator
Interface
Interface
8051 Uc
RAMs
LEDs
VGA
PS/2
Port
(J2)
Function
1 LSB0 A4 Left LED segment; RAM address line P35
2 LSB1 A7 Left LED segment; RAM address line P36
3 LSB2 A5 Left LED segment; RAM address line P29
4 Uncommitted XS95 I/O pin
5 DIPSW4 SDOUT P1.3 DIP switch; codec serial data output; uC I/O P24
6 DIPSW1 LCEB P1.0 DIP switch; left RAM chip-enable, uC I/O port P19
7 DIPSW2 RCEB P1.1 DIP switch; right RAM chip-enable, uC I/O port P20
9 CLK XS Board oscillator
10 RESETB XTAL1 Pushbutton; uC clock P56
11 DIPSW3 MCLK P1.2 DIP switch; codec master clock; uC I/O port P23
12 Uncommitted XS95 I/O pin
13 PSENB uC program store-enable
14 S5 RED1 XS Board LED segment; VGA color signal
15 S6 HSYNCB XS Board LED segment; VGA horiz. sync.
17 S3 GREEN1 XS Board LED segment; VGA color signal
18 S4 RED0 XS Board LED segment; VGA color signal
19 S2 GREEN0 XS Board LED segment; VGA color signal
20 ALEB uC address-latch-enable
21 S0 BLUE0 XS Board LED segment; VGA color signal
23 S1 BLUE1 XS Board LED segment; VGA color signal
25 Uncommitted XS95 I/O pin
26 KB_CLK P3.4 (T0) PS/2 keyboard clock; uC I/O port
28 JTAG TDI; DIN
29 JTAG TMS
30 JTAG TCK; CCLK
31 P3.0 (RXD) uC I/O port
32 P3.7 (RD_) uC I/O port
33 P3.5 (T1) uC I/O port
34 RDPB P2.7 Right LED decimal-point; RAM address line; uC I/O port P41
35 DB8 D7 P0.7 LED; RAM data line; uC muxed address/data line P61
36 DB7 D6 P0.6 LED; RAM data line; uC muxed address/data line P62
37 DB6 D5 P0.5 LED; RAM data line; uC muxed address/data line P65
39 DB5 D4 P0.4 LED; RAM data line; uC muxed address/data line P66
40 DB4 D3 P0.3 LED; RAM data line; uC muxed address/data line P57
41 DB3 D2 P0.2 LED; RAM data line; uC muxed address/data line P58
43 DB2 D1 P0.1 LED; RAM data line; uC muxed address/data line P59
44 DB1 D0 P0.0 LED; RAM data line; uC muxed address/data line P60
45 RST uC reset
46 CCLK PC_D0 Codec control line; PC parallel port data output
47 CDIN PC_D1 Codec control line; PC parallel port data output
48 CSB PC_D2 Codec control line; PC parallel port data output
49 GND Power supply ground
50 PC_D3 PC parallel port data output
51 PC_D4 PC parallel port data output
52 PC_D5 PC parallel port data output
53 RSB4 A12 P2.4 Right LED segment; RAM address line; uC I/O port P48
54 RSB2 A10 P2.2 Right LED segment; RAM address line; uC I/O port P45
55 RSB3 A11 P2.3 Right LED segment; RAM address line; uC I/O port P51
56 RSB1 A9 P2.1 Right LED segment; RAM address line; uC I/O port P47
57 RSB5 A13 P2.5 Right LED segment; RAM address line; uC I/O port P50
58 RSB0 A8 P2.0 Right LED segment; RAM address line; uC I/O port P46
59 JTAG TDO; DOUT
61 RSB6 A14 P2.6 Right LED segment; RAM address line; uC I/O port P49
62 OEB RAM output-enable
63 WEB P3.6 (WR_) RAM write-enable; uC I/O port
65 CEB XS Board RAM chip-enable
66 DIPSW7 LRCK P1.6 PC_S5 DIP switch; codec left-right channel select; uC I/O port; PC parallel
P27 port status input
68 P3.3 (INT1_) uC I/O port
69 P3.2 (INT0_) uC I/O port
70 DIPSW8 KB_DATA P3.1 (TXD)
PC_S6 DIP switch; PS/2 keyboard serial data; uC I/O port; PC parallelP28
port status input
71 DIPSW6 SDIN P1.5 PC_S3 DIP switch; codec serial input data; uC I/O port; PC parallel port
P26status input
72 DIPSW5 SCLK P1.4 PC_S4 DIP switch; codec serial clock; uC I/O port; PC parallel port status
P25 input
74 Uncommitted XS95 I/O pin
75 LSB3 A0 Left LED segment; RAM address line P44
76 Uncommitted XS95 I/O pin
77 Uncommitted XS95 I/O pin
78 +5V +5V power source
79 LSB4 A1 Left LED segment; RAM address line P38
80 PC_D7 PC parallel port data output
81 PC_D6 PC parallel port data output
82 LSB5 A2 Left LED segment; RAM address line P40
83 LSB6 A6 Left LED segment; RAM address line P39
84 LDPB A3 Left LED decimal-point; RAM address line P37
24,67 SPAREBDP VSYNCB P1.7 Pushbutton; XS Board LED decimal-point; VGA horiz. sync.; uC P18I/O port
The steps for compiling and testing the design using an XS40 combined with an XStend Board
are as follows:
• Compile the synthesized netlist using the SWTCH40.UCF constraint file (Listing 14).
• Mount an XS40 Board in the XStend Board and attach the downloading cable from the
XS40 to the PC parallel port. Apply 9VDC though jack J9 of the XS40. Place shunts on
jumpers J4, J7, and J8 of the XStend Board to enable the LED displays. Remove the shunt
on jumper J17 to keep the XStend codec serial output from interfering with the DIP switch
logic levels.
• Download the SWTCH40.BIT file into the XS40/XStend combination with the command:
XSLOAD SWTCH40.BIT.
• Set the DIP switches and press the SPARE and RESET pushbuttons. Observe the results on
the LEDs.
The steps for compiling and testing the design using an XS95 combined with an XStend Board
are as follows:
• Synthesize the VHDL code in the SWTCH95\SWITCHES.VHD file for an XC95108 CPLD.
Listing 15).
• Mount an XS95 Board in the XStend Board and attach the downloading cable from the
XS95 to the PC parallel port. Apply 9VDC though jack J9 of the XS95. Place shunts on
jumpers J4, J7, and J8 of the XStend Board to enable the LED displays. Remove the shunt
on jumper J17 to keep the XStend codec serial output from interfering with the DIP switch
logic levels.
• Download the SWTCH95.SVF file into the XS95/XStend combination with the command:
XSLOAD SWTCH95.SVF.
• Set the DIP switches and press the SPARE and RESET pushbuttons. Observe the results on
the LEDs.
Listing 13: VHDL code for using the XStend LEDs and switches.
001- LIBRARY IEEE;
002- USE IEEE.STD_LOGIC_1164.ALL;
003-
004- ENTITY switches IS
005- PORT
006- (
007- dipsw: IN STD_LOGIC_VECTOR(8 DOWNTO 1); -- DIP switches
008- spareb: IN STD_LOGIC; -- SPARE pushbutton
009- resetb: IN STD_LOGIC; -- RESET pushbutton
010-
011- s: OUT STD_LOGIC_VECTOR(6 DOWNTO 0); -- XS Board LED digit
012- lsb: OUT STD_LOGIC_VECTOR(7 DOWNTO 0); -- XStend left LED digit
013- rsb: OUT STD_LOGIC_VECTOR(7 DOWNTO 0); -- XStend right LED digit
014- db: OUT STD_LOGIC_VECTOR(8 DOWNTO 1); -- XStend bargraph LED
015-
016- oeb: OUT STD_LOGIC; -- output enable for all RAMs
017- rst: OUT STD_LOGIC -- microcontroller reset
018- );
019- END switches;
020-
021- ARCHITECTURE switches_arch OF switches IS
022- BEGIN
023- -- this prevents accidental activation of the RAMs or microcontroller
024- oeb <= '1'; -- disable all the RAM output drivers
025- rst <= '1'; -- disable the microcontroller
026-
027- -- light the XS Board LED digit with the pattern from the
028- -- DIP switches if both pushbuttons are pressed.
029- -- these LED segments are active-high.
030- s <= dipsw(7 DOWNTO 1) WHEN (spareb='0' AND resetb='0') ELSE
031- "0000000"; -- otherwise keep LED digit dark
032-
033- -- light the XStend left LED digit with the pattern from the
034- -- DIP switches if the RESET pushbutton is pressed.
035- -- these LED segments are active low.
036- lsb <= NOT(dipsw) WHEN (spareb='1' AND resetb='0') ELSE
037- "11111111"; -- otherwise keep the LED digit dark
038-
039- -- light the XStend right LED digit with the pattern from the
040- -- DIP switches if the SPARE pushbutton is pressed.
041- -- these LED segments are active low.
042- rsb <= NOT(dipsw) WHEN (spareb='0' AND resetb='1') ELSE
043- "11111111"; -- otherwise keep the LED digit dark
044-
045- -- light the XStend bargraph LED with the pattern from the
046- -- DIP switches if neither pushbutton is pressed
047- -- these LED segments are active low.
048- db <= NOT(dipsw) WHEN (spareb='1' AND resetb='1') ELSE
049- "11111111"; -- otherwise keep the bargraph LED dark
050- END switches_arch;
Each analog color input can be set to one of four levels by two digital outputs using a simple
two-bit digital-to-analog converter (see Figure 7). The four possible levels on each analog input
are combined by the monitor to create a pixel with one of 4 × 4 × 4 = 64 different colors. So the
six digital control lines let us select from a palette of 64 colors.
Negative pulses on the horizontal sync signal mark the start and end of a line and ensure that the
monitor displays the pixels between the left and right edges of the visible screen area. The actual
pixels are sent to the monitor within a 25.17 µs window. The horizontal sync signal drops low a
minimum of 0.94 µs after the last pixel and stays low for 3.77 µs. A new line of pixels can begin
a minimum of 1.89 µs after the horizontal sync pulse ends. So a single line occupies 25.17 µs of
a 31.77 µs interval. The other 6.6 µs of each line is the horizontal blanking interval during
which the screen is dark.
In an analogous fashion, negative pulses on a vertical sync signal mark the start and end of a
frame made up of video lines and ensure that the monitor displays the lines between the top and
bottom edges of the visible monitor screen. The lines are sent to the monitor within a 15.25 ms
window. The vertical sync signal drops low a minimum of 0.45 ms after the last line and stays
low for 64 µs. The first line of the next frame can begin a minimum of 1.02 ms after the vertical
sync pulse ends. So a single frame occupies 15.25 ms of a 16.784 ms interval. The other 1.534
ms of the frame interval is the vertical blanking interval during which the screen is dark.
The pseudocode for a single frame of this process is shown in Listing 16. The pseudocode has
two outer loops: one which displays the L lines of visible pixels, and another which inserts the V
blank lines and the vertical sync pulse. Within the first loop, there are two more loops: one
which sends the P pixels of each video line to the monitor, and another which inserts the H blank
pixels and the horizontal sync pulse.
Within the pixel display loop, there are statements to get the next byte from the RAM. Each byte
contains four two-bit pixels. A small loop iteratively extracts each pixel to be displayed from the
lower two bits of the byte. Then the byte is shifted by two bits so the next pixel will be in the
right position during the next iteration of the loop. Since it has only two bits, each pixel can store
one of four colors. The mapping from the two-bit pixel value to the actual values required by the
monitor electronics is done by the COLOR_MAP() routine.
Figure 9 shows how to pipeline certain operations to account for delays in accessing data from
the RAM. The pipeline has three stages:
Stage 1: The circuit uses the horizontal and vertical counters to compute the address where the
next pixel is found in RAM. The counters are also used to determine the firing of the sync
pulses and whether the video should be blanked. The pixel data from the RAM, blanking
signal, and sync pulses are latched at the end of this stage so they can be used in the next
stage.
Stage 2: The circuit uses the pixel data and the blanking signal to determine the binary color
outputs. These outputs are latched at the end of this stage.
Stage 3: The binary color outputs are applied to the DAC, which sets the intensity levels for the
monitor’s color guns. The actual pixel is painted on the screen during this stage.
clk: The input for the 12 MHz clock of the XS Board is declared here. This clock sets the
maximum rate at which pixels can be sent to the monitor. The time interval within each line
for transmitting viewable pixels is 25.17 µs, so this VGA generator circuit can only put a
maximum of 25.17 ms × 12 MHz = 302 pixels on each line. For purposes of storing images
in the RAM, it is convenient to reduce this to 256 pixels per line and blank the remaining 46
pixels. Half of these blank pixels are placed before the 256 viewable pixels and half are
placed after them on a line. This centers the viewable pixels between the left and right edges
of the monitor screen.
reset: This line declares an input, which will reset all the other circuitry to a known state.
hsyncb, vsyncb: The outputs for the horizontal and vertical sync pulses are declared. The
hsyncb output is declared as a buffer because it will also be referenced within the architecture
section as a clock for the vertical line counter.
rgb: The outputs that control the red, green, and blue color guns of the monitor are declared
here. Each gun is controlled by two bits, so there are four possible intensities for each color.
Thus, this circuit can produce 4 × 4 × 4 = 64 different colors.
address, data: These lines declare the outputs for driving the address lines of the RAM and the
inputs for receiving the data from the RAM.
ceb, oeb, web: These are the declarations for the outputs which drive the chip-select, output-
enable, and write-enable control lines of the RAM.
hcnt, vcnt: The counters that store the current horizontal position within a line of pixels and the
vertical position of the line on the screen are declared on these lines. We will call these the
horizontal or pixel counter, and the vertical or line counter, respectively. The line period is
31.77 µs that is 381 clock cycles, so the pixel counter needs at least nine bits of resolution.
Each frame is composed of 528 video lines (only 480 are visible, the other 48 are blanked), so
a ten bit counter is needed for the line counter.
pixrg: This is the declaration for the eight-bit register that stores the four pixels received from
the RAM.
blank, pblank: This line declares the video blanking signal and its registered counterpart that is
used in the next pipeline stage.
Within the main body of the architecture section, these following processes are executed:
inc_horiz_pixel_counter: This process describes the operation of the horizontal pixel counter.
The counter is asynchronously set to zero when the reset input is high. The counter
increments on the rising edge of each pixel clock. The range for the horizontal pixel counter
is [0,380]. When the counter reaches 380, it rolls over to zero on the next cycle. Thus, the
counter has a period of 381 pixel clocks. With a pixel clock of 12 MHz, this translates to a
period of 31.75 µs.
inc_vert_line_counter: This process describes the operation of the vertical line counter. The
counter is asynchronously set to zero when the reset input is high. The counter increments
on the rising edge of the horizontal sync pulse after a line of pixels is completed. The range
for the horizontal pixel counter is [0,527]. When the counter reaches 527, it rolls over to
zero on the next cycle. Thus, the counter has a period of 528 lines. Since the duration of a
line of pixels is 31.75 µs, this makes the frame interval equal to 16.76 ms.
generate_horiz_sync: This process describes the operation of the horizontal sync pulse
generator. The horizontal sync is set to its inactive high level when the reset is activated.
During normal operations, the horizontal sync output is updated on every pixel clock. The
sync signal goes low on the cycle after the pixel counter reaches 291 and continues until the
cycle after the counter reaches 337. This gives a low horizontal sync pulse of (337-291)=46
pixel clocks. With a pixel clock of 12 MHz, this translates to a low-going horizontal sync
pulse of 3.83 µs. The sync pulse starts 292 clocks after the line of pixels begin, which
translates to 24.33 µs. This is less than the 26.11 µs we stated before. The difference of 1.78
ms translates to 21 pixel clocks. This time interval corresponds to the 23 blank pixels that are
placed before the 256 viewable pixels (minus two clock cycles for pipelining delays).
generate_vert_sync: This process describes the operation of the vertical sync pulse generator.
The vertical sync is set to its inactive high level when the reset is activated. During normal
operations, the vertical sync output is updated after every line of pixels is completed. The
sync signal goes low on the cycle after the line counter reaches 493 and continues until the
cycle after the counter reaches 495. This gives a low vertical sync pulse of (495-493)= 2
lines. With a line interval of 31.75 µs, this translates to a low-going vertical sync pulse of
63.5 µs. The vertical sync pulse starts 494 × 31.75 µs = 15.68 ms after the beginning of the
first video line.
Line 91: This line describes the computation of the combinatorial blanking signal. The video is
blanked after 256 pixels on a line are displayed, or after 480 lines are displayed.
pipeline_blank: This process describes the operation of the pipelined video blanking signal.
Within the process, the blanking signal is stored in a register so it can be used during the next
stage of the pipeline when the color is computed.
Lines 104 -- 106: On these lines, the RAM is permanently selected and writing to the RAM is
disabled. This makes the RAM look like a ROM, which stores video data. In addition, the
outputs from the RAM are disabled when the video is blanked since there is no need for
pixels during the blanking intervals. This isn’t really necessary since no other circuit is trying
to access the RAM.
Line 113: The address in RAM where the next four pixels are stored is calculated by
concatenating the lower nine bits of the line counter with bits 7,6,5,4,3 and 2 of the pixel
counter. With this arrangement, the line counter stores the address of one of 29 = 512 pages.
Each page contains 26 = 64 bytes. Each byte contains four pixels, so each page stores one
line of 256 pixels. The pixel counter increments through the bytes of a page to get the pixels
for the current line. (Note that we don’t need to use bits 1 and 0 of the pixel counter when
computing the RAM address since each byte contains four pixels.) After the line is displayed,
the line counter is incremented to point to the next page.
update_pixel_register: This process describes the operation of the register that holds the byte of
pixel data read from RAM. The register is asynchronously cleared when the VGA circuit is
reset. The register is updated on the rising edge of each pixel clock. The pixel register is
loaded with data from the RAM whenever the lowest two bits of the pixel counter are both
zero. The active pixel is always in the lower two bits of the register. Each pixel in the RAM
data byte is shifted into the active position by right shifting the register two bits on each rising
clock edge.
map_pixel_to_rgb: this process describes the process by which the current active pixel is
mapped into the six bits that drive the red, green and blue color guns. The register is set to
zero (which displays as the color black) when the reset input is high. The color register is
clocked on the rising edge of the pixel clock since this is the rate at which new pixel values
arrive. The value clocked into the register is a function of the pixel value and the blanking
input. When the pipelined blanking input is low (inactive), the color displayed on the monitor
is red, green, blue, or white depending upon whether the pixel value is 00, 01, 10, or 11,
respectively. When the pipelined blanking input is high, the color register is loaded with zero
(black).
095- BEGIN
096- IF reset='1' THEN
097- pblank <= '0';
098- ELSIF (clk'EVENT AND clk='1') THEN
099- pblank <= blank;
100- END IF;
101- END PROCESS;
102-
103- -- video RAM control signals
104- ceb <= '0'; -- enable the RAM
105- web <= '1'; -- disable writing to the RAM
106- oeb <= blank; -- enable the RAM outputs when video is not blanked
107-
108- -- The video RAM address is built from the lower 9 bits of the vert
109- -- line counter and bits 7-2 of the horizontal pixel counter.
110- -- Each byte of the RAM contains four 2-bit pixels. As an example,
111- -- the byte at address ^h1234=^b0001,0010,0011,0100 contains the pixls
112- -- at (row,col)=(^h048,^hD0),(^h048,^hD1),(^h048,^hD2),(^h048,^hD3).
113- address <= vcnt(8 DOWNTO 0) & hcnt(7 DOWNTO 2);
114-
115- update_pixel_register:
116- PROCESS(clk,reset)
117- BEGIN
118- IF reset='1' THEN -- clear the pixel register on reset
119- pixrg <= "00000000";
120- -- pixel clock controls changes in pixel register
121- ELSIF (clk'EVENT AND clk='1') THEN
122- -- the pixel register is loaded with the contents of the video
123- -- RAM location when the lower two bits of the horiz. counter
124- -- are both zero. The active pixel is in the lower two bits
125- -- of the pixel register. For the next 3 clocks, the pixel
126- -- register is right-shifted by two bits to bring the other
127- -- pixels in the register into the active position.
128- IF hcnt(1 DOWNTO 0)="00" THEN
129- pixrg <= data; -- load 4 pixels from RAM
130- ELSE
131- pixrg <= "00" & pixrg(7 DOWNTO 2); -- right-shift pixel register
132- END IF;
133- END IF;
134- END PROCESS;
135-
136- -- the color mapper translates each 2-bit pixel into a 6-bit
137- -- color value. When the video signal is blanked, the color
138- -- is forced to zero (black).
139- map_pixel_to_rgb:
140- PROCESS(clk,reset)
141- BEGIN
142- IF reset='1' THEN -- blank the video on reset
143- rgb <= "000000";
144- ELSIF (clk'EVENT AND clk='1') THEN -- update the color every clock
145- -- map the pixel to a color if the video is not blanked
146- IF pblank='0' THEN
147- CASE pixrg(1 DOWNTO 0) IS
148- WHEN "00" => rgb <= "110000"; -- red
149- WHEN "01" => rgb <= "001100"; -- green
150- WHEN "10" => rgb <= "000011"; -- blue
151- WHEN OTHERS => rgb <= "111111"; -- white
152- END CASE;
153- ELSE -- otherwise, output black if the video is blanked
154- rgb <= "000000"; -- black
Listing 18: XS40 UCF file for the VGA signal generator.
001- net clk loc=p13;
002- net reset loc=p44;
003- net data<0> loc=p41;
004- net data<1> loc=p40;
005- net data<2> loc=p39;
006- net data<3> loc=p38;
007- net data<4> loc=p35;
008- net data<5> loc=p81;
009- net data<6> loc=p80;
010- net data<7> loc=p10;
011- net address<0> loc=p3;
012- net address<1> loc=p4;
013- net address<2> loc=p5;
014- net address<3> loc=p78;
015- net address<4> loc=p79;
016- net address<5> loc=p82;
017- net address<6> loc=p83;
018- net address<7> loc=p84;
019- net address<8> loc=p59;
020- net address<9> loc=p57;
021- net address<10> loc=p51;
022- net address<11> loc=p56;
023- net address<12> loc=p50;
024- net address<13> loc=p58;
025- net address<14> loc=p60;
026- net ceb loc=p65;
027- net web loc=p62;
028- net oeb loc=p61;
029- net rgb<0> loc=p25;
030- net rgb<1> loc=p26;
031- net rgb<2> loc=p24;
032- net rgb<3> loc=p20;
033- net rgb<4> loc=p23;
034- net rgb<5> loc=p18;
035- net hsyncb loc=p19;
036- net vsyncb loc=p67;
Listing 19: XS95 UCF file for the VGA signal generator.
001- net clk loc=p9;
002- net reset loc=p46;
003- net data<0> loc=p44;
004- net data<1> loc=p43;
005- net data<2> loc=p41;
006- net data<3> loc=p40;
007- net data<4> loc=p39;
008- net data<5> loc=p37;
009- net data<6> loc=p36;
010- net data<7> loc=p35;
011- net address<0> loc=p75;
012- net address<1> loc=p79;
013- net address<2> loc=p82;
014- net address<3> loc=p84;
015- net address<4> loc=p1;
016- net address<5> loc=p3;
017- net address<6> loc=p83;
018- net address<7> loc=p2;
019- net address<8> loc=p58;
020- net address<9> loc=p56;
021- net address<10> loc=p54;
022- net address<11> loc=p55;
023- net address<12> loc=p53;
024- net address<13> loc=p57;
025- net address<14> loc=p61;
026- net ceb loc=p65;
027- net web loc=p63;
028- net oeb loc=p62;
029- net rgb<0> loc=p21;
030- net rgb<1> loc=p23;
031- net rgb<2> loc=p19;
032- net rgb<3> loc=p17;
033- net rgb<4> loc=p18;
034- net rgb<5> loc=p14;
035- net hsyncb loc=p15;
036- net vsyncb loc=p24;
The steps for compiling and testing the VGA design using an XS40 combined with an XStend
Board are as follows:
• Synthesize the VHDL code in the VGA40\VGA.VHD file for an XC4005XL FPGA.
• Compile the synthesized netlist using the VGA40.UCF constraint file (Listing 18).
• Mount an XS40 Board in the XStend Board and attach the downloading cable from the
XS40 to the PC parallel port. Apply 9VDC though jack J9 of the XS40. Place shunts on
jumpers J4, J7, and J8 of the XStend Board to enable the LED displays. Remove the shunt
on jumper J17 to keep the XStend codec serial output from interfering with the DIP switch
logic levels. Set all the DIP switches to the OPEN position.
• Download the VGA40.BIT file and a video test pattern into the XS40/XStend combination
with the command: XSLOAD TESTPATT.HEX VGA40.BIT.
• Release the reset to the VGA circuitry with the command: XSPORT 0.
The steps for compiling and testing the design using an XS95 combined with an XStend Board
are as follows:
• Synthesize the VHDL code in the VGA95\VGA.VHD file for an XC95108 CPLD.
• Listing 19).
• Mount an XS95 Board in the XStend Board and attach the downloading cable from the
XS95 to the PC parallel port. Apply 9VDC though jack J9 of the XS40. Place shunts on
jumpers J4, J7, and J8 of the XStend Board to enable the LED displays. Remove the shunt
on jumper J17 to keep the XStend codec serial output from interfering. Set all the DIP
switches to the OPEN position.
• Download the VGA95.SVF file and a video test pattern into the XS95/XStend combination
with the command: XSLOAD TESTPATT.HEX VGA95.SVF.
• Release the reset to the VGA circuitry with the command: XSPORT 0.
The format of the scan code transmissions from the keyboard are shown in Figure 10. The
keyboard electronics drive the clock and data lines. The start of a scan code transmission is
indicated by a low level on the data line on the falling edge of the clock. The eight bits of the
scan code follow (starting with the least-significant bit) on successive falling clock edges. These
are followed by an odd-parity bit and then a high-level stop bit.
When the clock line goes high after the stop bit, the receiver (in this case, the FPGA or CPLD on
the XS Board inserted in the XStend Board) can pull the clock line low to inhibit any further
transmissions. After the clock line is released and it returns to a high level, the keyboard can
send another scan code. If the receiver never pulls the clock line low, then the keyboard will
send scan codes whenever a key is pressed.
The VHDL code for this example is shown in . The inputs and outputs of the circuit as defined in
the entity declaration are as follows:
rst: This output drives the reset pin of the microcontroller on the XS Board.
oeb: This output drives the output-enable pin of the RAM on the XS Board.
db: These outputs drive the segments of the bargraph LED on the XStend Board.
rsb: These outputs drive the segments of the right LED digit on the XStend Board.
Within the main body of the architecture section, these operations occur:
Lines 22 & 23: The microcontroller reset pin and the RAM output-enable pin are driven high so
these chips cannot interfere while receiving data from the keyboard.
Lines 25 & 26: The keyboard clock passes through an input buffer and then a global clock buffer
before it reaches the rest of the circuitry. (These buffers are declared on lines 18 and 19,
respectively.) The global clock buffer distributes the clock signal with minimal skew in the
XS40 Board FPGA. These statements are not used with the CPLD in the XS95 Board.
gather_scancode: On every falling edge of kb_clk, this process shifts the data bit on the kb_data
input into the most-significant bit of a 10-bit shift register. After 11 clock cycles, the lower 8
bits of the register will contain the scan code, the upper 2 bits will store the stop and parity
bits, and the start bit will have been shifted through the entire register and discarded.
Line 38: The value in the shift register is inverted and applied to the segments of the LED
bargraph. Since the bargraph segments are active-low, a segment will light for every ‘1’ bit
in the shift register. The LED segment drivers are not registered so there will be some
flickering as the shift register contents change.
Lines 40-51: If the scan code in the shift register matches the codes for the digits 0-9, then the
right LED digit segments will be activated to display the corresponding digit. If the scan
code does not match one of these codes, the letter ‘E’ is displayed.
The steps for compiling and testing the design using an XS40 combined with an XStend Board
are as follows:
• Compile the synthesized netlist using the KEYBRD40.UCF constraint file (Listing 21).
• Mount an XS40 Board in the XStend Board and attach the downloading cable from the
XS40 to the PC parallel port. Apply 9VDC though jack J9 of the XS40. Place shunts on
jumpers J4, J7, and J8 to enable the LEDs. Remove the shunt on jumper J17 to keep the
XStend codec from interfering. Set all the DIP switches to the OPEN position.
• Download the KEYBRD40.BIT file into the XS40/XStend combination with the command:
XSLOAD KEYBRD40.BIT.
• Press keys on the keyboard and observe the results on the LED displays.
The steps for compiling and testing the design using an XS95 combined with an XStend Board
are as follows:
• Compile the synthesized netlist using the KEYBRD95.UCF constraint file (Listing 22).
• Mount an XS95 Board in the XStend Board and attach the downloading cable from the
XS95 to the PC parallel port. Apply 9VDC though jack J9 of the XS95. Place shunts on
jumpers J4, J7, and J8 to enable the LEDs. Remove the shunt on jumper J17 to keep the
XStend codec from interfering. Set all the DIP switches to the OPEN position.
• Download the KEYBRD95.SVF file into the XS95/XStend combination with the command:
XSLOAD KEYBRD95.SVF.
• Press keys on the keyboard and observe the results on the LED displays.
Listing 20: VHDL code for receiving keyboard scan codes from the PS/2 interface.
001- LIBRARY IEEE;
002- USE IEEE.STD_LOGIC_1164.ALL;
003-
004- ENTITY kbd_read IS
005- PORT
006- (
007- rst: OUT STD_LOGIC; -- uC reset
008- oeb: OUT STD_LOGIC; -- RAM output enable
009- kb_data: IN STD_LOGIC; -- serial data from the keyboard
010- kb_clk: IN STD_LOGIC; -- clock from the keyboard
011- db: OUT STD_LOGIC_VECTOR(8 DOWNTO 1); -- bargraph LED
012- rsb: OUT STD_LOGIC_VECTOR(6 DOWNTO 0) -- right LED digit
013- );
014- END kbd_read;
015-
016- ARCHITECTURE kbd_read_arch OF kbd_read IS
017- SIGNAL scancode: STD_LOGIC_VECTOR(9 DOWNTO 0);
018- COMPONENT ibuf PORT(i: IN STD_LOGIC; o: OUT STD_LOGIC); END COMPONENT;
019- COMPONENT bufg PORT(i: IN STD_LOGIC; o: OUT STD_LOGIC); END COMPONENT;
020- SIGNAL buf_clk0, buf_clk1: STD_LOGIC;
021- BEGIN
022- rst <= '1'; -- keep the uC in the reset state
023- oeb <= '1'; -- disable the RAM output drivers
024-
025- b0: ibuf PORT MAP(i=>kb_clk,o=>buf_clk0); -- buffer the clock from
026- b1: bufg PORT MAP(i=>buf_clk0,o=>buf_clk1); -- the keyboard
027-
028- -- shift keyboard data into the MSb of the scancode register
029- -- on the falling edge of the keyboard clock
030- gather_scancode:
031- PROCESS(buf_clk1,scancode)
032- BEGIN
033- IF(buf_clk1'EVENT AND buf_clk1='0') THEN
034- scancode <= kb_data & scancode(9 DOWNTO 1);
035- END IF;
036- END PROCESS;
037-
038- db <= NOT(scancode(7 DOWNTO 0)); -- show the scancode on the bargraph
039-
040- -- display the key that was pressed on the right LED digit
041- rsb <= "1101101" WHEN scancode(7 DOWNTO 0)="00010110" ELSE -- 1
042- "0100010" WHEN scancode(7 DOWNTO 0)="00011110" ELSE -- 2
043- "0100100" WHEN scancode(7 DOWNTO 0)="00100110" ELSE -- 3
044- “1000101" WHEN scancode(7 DOWNTO 0)="00100101" ELSE -- 4
045- "0010100" WHEN scancode(7 DOWNTO 0)="00101110" ELSE -- 5
046- "0010000" WHEN scancode(7 DOWNTO 0)="00110110" ELSE -- 6
047- "0101101" WHEN scancode(7 DOWNTO 0)="00111101" ELSE -- 7
048- "0000000" WHEN scancode(7 DOWNTO 0)="00111110" ELSE -- 8
049- "0000100" WHEN scancode(7 DOWNTO 0)="01000110" ELSE -- 9
050- "0001000" WHEN scancode(7 DOWNTO 0)="01000101" ELSE -- 0
051- "0010010"; -- E
052- END kbd_read_arch;
Listing 21: XS40 UCF file for the PS/2 keyboard interface.
001- net rst loc=p36;
002- net oeb loc=p61;
003- net kb_data loc=p69;
004- net kb_clk loc=p68;
005- net rsb<0> loc=p59;
006- net rsb<1> loc=p57;
007- net rsb<2> loc=p51;
008- net rsb<3> loc=p56;
009- net rsb<4> loc=p50;
010- net rsb<5> loc=p58;
011- net rsb<6> loc=p60;
012- net db<1> loc=p41;
013- net db<2> loc=p40;
014- net db<3> loc=p39;
015- net db<4> loc=p38;
016- net db<5> loc=p35;
017- net db<6> loc=p81;
018- net db<7> loc=p80;
019- net db<8> loc=p10;
Listing 22: XS95 UCF file for the PS/2 keyboard interface.
001- net rst loc=p45;
002- net oeb loc=p62;
003- net kb_data loc=p70;
004- net kb_clk loc=p26;
005- net rsb<0> loc=p58;
006- net rsb<1> loc=p56;
007- net rsb<2> loc=p54;
008- net rsb<3> loc=p55;
009- net rsb<4> loc=p53;
010- net rsb<5> loc=p57;
011- net rsb<6> loc=p61;
012- net db<1> loc=p44;
013- net db<2> loc=p43;
014- net db<3> loc=p41;
015- net db<4> loc=p40;
016- net db<5> loc=p39;
017- net db<6> loc=p37;
018- net db<7> loc=p36;
019- net db<8> loc=p35;
If the FPLD is handling these values in a bit-parallel manner, then the FPLD must contain a set of
shift registers which convert the serial input stream into 20-bit values and another set which
converts 20-bit values into a serial output stream. This is shown in the left-half of Figure 11.
The gating of these shift registers onto the serial input and output pins is synchronized with the
same left/right channel select signal used by the codec chip.
In addition to the shift registers, the FPLD needs circuitry to read and write them and to indicate
when they are full and empty. Since the codec ADCs and DACs generate and consume data at a
set sample rate, it is also necessary to build circuitry which detects overflow and underflow of the
FPLD shift registers if they are not read or written in time.
Figure 11: Connections between the XStend codec chip and the XS Board FPGA or CPLD.
• a clock generator module which outputs the serial data shift clock and the left/right channel
select signals;
• a channel module which contains the shift registers, buffers, read/write control, and
overflow/underflow detection circuitry for a single input/output stream of data;
• a top-level module which combines the clock generator module with two channel modules to
form a complete codec interface circuit.
The VHDL code for the clock generator module is detailed in Listing 23. The inputs and outputs
of the clock generator as defined in the entity declaration are as follows:
clk: This is the main clock input which is typically the 12 MHz clock from the XS Board.
reset: This input synchronously resets the counter the clock generator.
mclk: This output is the master clock for the codec chip.
sclk: This output is the clock for synchronizing serial data transfers between the FPLD and the
codec.
lrck: This output controls the activation of the left and right channel circuitry in the codec and
the FPLD.
bit_cntr: These outputs indicate the current bit being transmitted and received in the serial data
streams.
subcycle_cntr: The duration of each serial data bit is divided into four phases and these outputs
indicate the current phase.
Within the main body of the clock generator architecture section, these operations occur:
gen_clock: This process increments the sequencing counter and toggles the left/right channel
selector when the count reaches the duration for which a channel is active. The codec chip
requires that the channel duration be either 128, 192, or 256 master clock periods in length.
Thus, the total time to handle both channels is 256, 384, or 512 clock periods. This sets the
sampling rate. So using a channel duration of 128 with a 12 MHz clock gives a sampling rate
of 46.875 KHz that is sufficient for audio.
Lines 45-47: The various clocks are output on these lines. The master clock and left/right
selector have already been discussed. The serial data shift clock is one-quarter of the master
clock. So transmitting or receiving a 20-bit value will require 4 × 20 = 80 clock periods, and
this will fit within the shortest possible channel duration.
Line 48: The position of the current data bit in the serial stream for a channel is output here.
Since each bit has a duration of four clock periods, the position of the bit in the stream is just
the sequence counter with the two least-significant bits removed.
Line 49: The position within a bit is output on this line. This is given by the two least-significant
bits of the sequence counter.
Listing 23: VHDL code for the codec clock generator module.
001- LIBRARY IEEE,codec;
002- USE IEEE.std_logic_1164.ALL;
003- USE IEEE.std_logic_unsigned.ALL;
004- USE codec.codec.ALL;
005-
006- ENTITY clkgen IS
007- GENERIC
008- (
009- CHANNEL_DURATION: positive := 128 -- must be 128
010- );
011- PORT
012- (
013- -- interface I/O signals
014- clk: IN std_logic; -- clock input
015- reset: IN std_logic; -- synchronous active-high reset
016- -- codec chip clock signals
017- mclk: OUT std_logic; -- master clock output to codec
018- sclk: OUT std_logic; -- serial data clock to codec
019- lrck: OUT std_logic; -- left/right codec channel select
020- bit_cntr: OUT std_logic_vector(5 DOWNTO 0);
021- subcycle_cntr: OUT std_logic_vector(1 DOWNTO 0)
022- );
023- END clkgen;
024-
025- ARCHITECTURE clkgen_arch OF clkgen IS
026- SIGNAL lrck_int: std_logic;
027- SIGNAL seq: std_logic_vector(7 DOWNTO 0);
028- BEGIN
029- gen_clock:
030- PROCESS(clk,seq,lrck_int)
031- BEGIN
032- IF (clk'event AND clk='1') THEN
033- IF(reset=YES) THEN -- synchronous reset
034- seq <= (OTHERS=>'0');
035- lrck_int <= LEFT; -- start with left channel of codec
036- ELSIF(seq=CHANNEL_DURATION-1) THEN
037- seq <= (OTHERS=>'0'); -- reset sequencer every channel period
038- lrck_int <= NOT(lrck_int); -- toggle channel sel every period
039- ELSE
040- seq <= seq+1;
041- lrck_int <= lrck_int;
042- END IF;
043- END IF;
044- END PROCESS;
045- lrck <= lrck_int; -- output the channel selector to the codec
046- mclk <= clk; -- codec master clock equals input clock
047- sclk <= seq(1); -- serial data shift clock is 1/4 of the master clock
048- bit_cntr <= seq(7 DOWNTO 2);
049- subcycle_cntr <= seq(1 DOWNTO 0);
050- END clkgen_arch;
The VHDL code for the channel module is shown in Listing 24. The inputs and outputs of the
clock generator as defined in the entity declaration are as follows:
clk: This is the main clock input which is typically the 12 MHz clock from the XS Board.
chan_on: A high level on this input activates the channel. This input is usually controlled by the
left/right channel selector.
bit_cntr: These inputs inform the channel of the index of the serial data bit currently being
transmitted and received.
chan_sel: A high level on this input enables the interface that lets the shift registers be read and
written. (Note that despite its name, this input is not controlled by the left/right channel
selector.)
rd: A high level on this input outputs the value stored in the shift register connected to the ADC.
wr: A high level on this input writes a new value into the shift register connected to the DAC.
adc_out: The bits stored in the ADC shift register are read out in parallel through these outputs..
dac_in: The DAC shift register is loaded in parallel with bits passed through these inputs.
adc_out_rdy: This output goes high after all the bits have been shifted from the codec into the
ADC shift register.
adc_overrun: This output goes high if new serial data is shifted into the ADC shift register
before the old contents have been read out through the parallel outputs.
dac_in_rdy: This output goes high after all the bits in the DAC shift register have been shifted
over to the codec.
dac_underrun: This output goes high if the DAC shift register starts shifting data over to the
codec before it has been written through the parallel inputs.
sdin: The serial data stream for the codec DAC is shifted out through this output. (Note that
this output takes its name from the pin it is connected to on the codec chip; it is not an input.)
sdout: The serial data stream from the codec ADC is shifted in through this input. (Note that
this input takes its name from the pin it is connected to on the codec chip; it is not an output.)
Within the main body of the channel module architecture section, these operations occur:
rcv_adc: This process receives serial data from the ADC in the codec. The ADC shift register is
cleared upon reset and a flag is set which indicates the shift register does not contain all the
bits from the ADC. Once the reset is removed and the channel is active, bits are shifted into
the register during the third subcycle of each bit period (the subcycles are numbered 0, 1, 2
and 3). Accepting data on the third subcycle gives the serial data bit plenty of time to
stabilize. Bits 1,2,..., up to the width of the ADC data value are pushed into the shift register.
Then the shifting stops. The shift register is marked as ‘not full’ as soon as a single bit is
shifted in so that the value will not be inadvertently read. The shift register status changes to
full as soon as the last bit enters the shift register.
Line 66: The contents of the shift register are output in a parallel format on this line. These
outputs are not latched and will change as bits are shifted into the register.
Line 69: A flag is maintained that indicates whether the contents of the ADC shift register have
been read. The flag is set when the ADC register for the channel is full and it is selected for a
read operation. The flag will stay set after the read operation is complete. Reading the
register does not empty it. The shift register is no longer full only when the first bit of the
next sample is shifted into it. This will reset the read flag.
read_adc: This process updates the flag that indicates whether the ADC shift register has been
read.
Lines 84—85: A status output is asserted when the data in the ADC shift register is ready for
reading. Reads are permitted when the register is full and has not yet been read. This output
is cleared as soon as a read occurs or new data is shifted into the register.
detect_adc_overrun: This process monitors the ADC shift register and flags an error condition
if the register begins accepting bits from the current sample period but the data from the
previous period has not yet been read.
tx_dac: This process transmits serial data to the DAC in the codec. The DAC shift register is
cleared upon reset and a flag is set which indicates the shift register contains no bits for the
DAC. After the reset is removed, the register can be loaded in parallel if the channel is
selected for a write operation. If no write operation is in process but the channel is active,
then data is shifted out to the codec on the third subcycle. (This gives the data some hold
time so the codec chip can clock it in reliably.) During the first bit period, a flag is set which
indicates the register is no longer empty and a serial transmission is in process. Then bits
1,2,..., up to the width of the DAC data value are shifted out. As the last bit is output, the
flag is set to show the shift register is now empty.
Line 123: The DAC serial data input of the codec chip is driven by the most-significant bit of the
DAC shift register.
Line 126: A flag is maintained that indicates whether the DAC shift register has been written.
The flag is set when the DAC register for the channel is empty and it is selected for a write
operation. The flag will stay set after the write operation is complete. Writing the register
does not fill it. The shift register is full only when the first bit of the next sample period is
shifted out of it. This will reset the write flag.
write_dac: This process updates the flag that indicates whether the DAC shift register has been
written.
Lines 141—142: A status output is asserted when the DAC shift register is ready to be written
with new input data. Writes are permitted when the register is empty and has not yet been
written. This output is cleared as soon as a write occurs or when data bits start shifting out
of the register.
detect_dac_underrun: This process monitors the DAC shift register and flags an error condition
if the register starts shifting out data but has not yet been written with a new data value for
the current sample period.
043- SIGNAL adc_rd: std_logic; -- the ADC channel has been read
044- SIGNAL adc_rd_nxt: std_logic; -- the ADC channel has been read
045- SIGNAL adc_out_rdy_int: std_logic; -- internal version adc_out_rdy
046- BEGIN
047- -- receives data from codec ADC
048- rcv_adc:
049- PROCESS(clk,chan_on,subcycle_cntr,bit_cntr,adc_shfreg,sdout)
050- BEGIN
051- IF(clk'event AND (clk=YES)) THEN
052- IF(reset='1') THEN
053- adc_shfreg <= (OTHERS=>'0');
054- adc_full <= NO;
055- ELSIF((chan_on=YES) AND (subcycle_cntr=2)) THEN
056- IF(bit_cntr<ADC_WIDTH-1) THEN
057- adc_full <= NO;
058- adc_shfreg <= adc_shfreg(ADC_WIDTH-2 DOWNTO 0) & sdout;
059- ELSIF(bit_cntr=ADC_WIDTH-1) THEN
060- adc_full <= YES;
061- adc_shfreg <= adc_shfreg(ADC_WIDTH-2 DOWNTO 0) & sdout;
062- END IF;
063- END IF;
064- END IF;
065- END PROCESS;
066- adc_out <= adc_shfreg;
067-
068- -- handle reading of ADC data from codec interface
069- adc_rd_nxt <= YES WHEN (adc_full=YES AND chan_sel=YES AND rd=YES) OR
070- (adc_full=YES AND adc_rd=YES)
071- ELSE NO;
072- read_adc:
073- PROCESS(clk,adc_rd_nxt)
074- BEGIN
075- IF(clk'event AND clk='1') THEN
076- IF(reset=YES) THEN
077- adc_rd <= NO;
078- ELSE
079- adc_rd <= adc_rd_nxt;
080- END IF;
081- END IF;
082- END PROCESS;
083- -- ADC data is ready if register is full and hasn't been read yet
084- adc_out_rdy_int <= YES WHEN adc_full=YES AND adc_rd=NO ELSE NO;
085- adc_out_rdy <= adc_out_rdy_int;
086-
087- -- detect and signal overwriting of data from the codec ADC channels
088- detect_adc_overrun:
089- PROCESS(clk,reset,bit_cntr,chan_on,adc_out_rdy_int)
090- BEGIN
091- IF(clk'event AND clk='1') THEN
092- IF(reset=YES) THEN
093- adc_overrun <= NO;
094- ELSIF(bit_cntr=1 AND chan_on=YES AND adc_out_rdy_int=YES) THEN
095- adc_overrun <= YES;
096- END IF;
097- END IF;
098- END PROCESS;
099-
100- -- transmits data to codec DAC
101- tx_dac:
102- PROCESS(clk,reset,chan_on,subcycle_cntr,bit_cntr,dac_shfreg)
103- BEGIN
104- IF(clk'event AND clk='1') THEN
105- IF(reset=YES) THEN
106- dac_shfreg <= (OTHERS=>'0');
107- dac_empty <= YES;
108- ELSIF(chan_sel=YES AND wr=YES) THEN
109- dac_shfreg <= dac_in;
110- ELSIF(chan_on=YES AND subcycle_cntr=2) THEN
111- IF(bit_cntr<DAC_WIDTH-1) THEN
112- dac_empty <= NO;
113- dac_shfreg <= dac_shfreg(DAC_WIDTH-2 DOWNTO 0) & '0';
114- ELSIF(bit_cntr=DAC_WIDTH-1) THEN
115- dac_empty <= YES;
116- dac_shfreg <= dac_shfreg(DAC_WIDTH-2 DOWNTO 0) & '0';
117- END IF;
118- END IF;
119- END IF;
120- END PROCESS;
121-
122- -- output the serial data to the SDIN pin of the codec DAC
123- sdin <= dac_shfreg(DAC_WIDTH-1) WHEN chan_on=YES ELSE '0';
124-
125- -- handle writing of DAC data from codec interface
126- dac_wr_nxt <= YES WHEN (dac_empty=YES AND chan_sel=YES AND wr=YES) OR
127- (dac_empty=YES AND dac_wr=YES)
128- ELSE NO;
129- write_dac:
130- PROCESS(clk,reset,dac_wr_nxt)
131- BEGIN
132- IF(clk'event AND clk='1') THEN
133- IF(reset=YES) THEN
134- dac_wr <= NO;
135- ELSE
136- dac_wr <= dac_wr_nxt;
137- END IF;
138- END IF;
139- END PROCESS;
140- -- DAC is ready if register is empty and hasn't been written yet
141- dac_in_rdy_int <= YES WHEN dac_empty=YES AND dac_wr=NO ELSE NO;
142- dac_in_rdy <= dac_in_rdy_int;
143-
144- -- detect and signal underflow of data to the codec DAC channels
145- detect_dac_underrun:
146- PROCESS(clk,reset,bit_cntr,chan_on,dac_in_rdy_int)
147- BEGIN
148- IF(clk'event AND clk='1') THEN
149- IF(reset=YES) THEN
150- dac_underrun <= NO;
151- ELSIF(bit_cntr=1 AND chan_on=YES AND dac_in_rdy_int=YES) THEN
152- dac_underrun <= YES;
153- END IF;
154- END IF;
155- END PROCESS;
156- END channel_arch;
The VHDL code for the top-level module that combines the clock generator module with two
channel modules is detailed in Listing 25. The inputs and outputs of the top-level module as
defined in the entity declaration are as follows:
clk: This is the main clock input which is typically the 12 MHz clock from the XS Board.
reset: This input synchronously resets the two channel modules and the clock generator.
lrsel: This input selects either the right or left channel for parallel read or write operations.
rd: A high level on this input outputs the value stored in the selected shift register connected to
the ADC.
wr: A high level on this input writes a new value into the selected shift register connected to the
DAC.
ladc_out, radc_out: The bits stored in the left and right ADC shift registers are read out in
parallel through these outputs..
ldac_in, rdac_in: The DAC shift registers are loaded in parallel with bits passed through these
inputs.
ladc_out_rdy, rdac_out_rdy: These outputs go high after all the bits have been shifted from the
codec into the left or right ADC shift register, respectively.
adc_overrun: This output goes high if new serial data is shifted into either the left or right ADC
shift register before the old contents have been read out through the parallel outputs.
ldac_in_rdy, rdac_in_rdy: These outputs go high after all the bits in the left or right DAC shift
register have been shifted over to the codec, respectively.
dac_underrun: This output goes high if either the left or right DAC shift register starts shifting
data over to the codec before it has been written through the parallel inputs.
mclk: This output is the master clock for the codec chip.
sclk: This output is the clock for synchronizing serial data transfers between the FPLD and the
codec.
lrck: This output controls the activation of the left and right channel circuitry in the codec.
sdin: The serial data stream for the codec DAC is shifted out through this output.
sdout: The serial data stream from the codec ADC is shifted in through this input.
Within the main body of the top-level module architecture section, the following modules are
instantiated:
u0: One clock generator module is instantiated. It receives the 12 MHz clock as an input and
generates the master clock, left/right clock, and serial shift clock for the codec. It also
outputs the position of the current bit in the serial stream and the current cycle within each bit
period.
Lines 73—75: The input signals to the codec on the XStend V1.3 Board pass through inverters.
Therefore, the clock signals are inverted on these lines to remove the effect of the inverters.
u_left: The module which handles the left channel of the codec is instantiated. This module is
activated during one half of the left/right clock period. It is selected for reading or writing by
the left/right selection input.
u_right: The module which handles the right channel of the codec is instantiated. This module is
activated during the other half of the left/right clock period. It is selected for reading and
writing by the opposite polarity of the left/right selection input.
Lines 133—134: The overrun and underrun error indicators for the total codec interface are
formed by the logical-OR of the associated error outputs of the left and right channel
modules. Thus an error is reported if either channel reports an error.
Line 138: The serial data stream that is transmitted to the codec chip is selected from the output
data stream of the currently-active channel module. The data stream input to the codec on
the XStend V1.3 Board passes through an inverter. Therefore, the data stream is inverted on
this line to remove the effect of the inverter.
Listing 25: VHDL code for the top-level codec interface module.
001- LIBRARY IEEE,codec;
002- USE IEEE.std_logic_1164.ALL;
003- USE IEEE.std_logic_unsigned.ALL;
004- USE codec.codec.ALL;
005-
006- ENTITY codec_intfc IS
007- GENERIC
008- (
009- DAC_WIDTH: positive := 20;
010- ADC_WIDTH: positive := 20;
011- CHANNEL_DURATION: positive := 128 -- must be 128
012- );
013- PORT
014- (
015- -- interface I/O signals
016- clk: IN std_logic; -- clock input
017- reset: IN std_logic; -- synchronous active-high reset
018- lrsel: IN std_logic; -- select left/right channel for read/write
019- rd: IN std_logic; -- read from the codec ADC
020- wr: IN std_logic; -- write to the codec DAC
021- ladc_out: OUT std_logic_vector(ADC_WIDTH-1 DOWNTO 0); -- left ADC
022- radc_out: OUT std_logic_vector(ADC_WIDTH-1 DOWNTO 0); -- right ADC
023- ldac_in: IN std_logic_vector(DAC_WIDTH-1 DOWNTO 0); -- left DAC
024- rdac_in: IN std_logic_vector(DAC_WIDTH-1 DOWNTO 0); -- right DAC
025- ladc_out_rdy: OUT std_logic; -- left ADC output is ready to be read
026- radc_out_rdy: OUT std_logic; -- right ADC output is ready to be read
027- adc_overrun: OUT std_logic; -- ADC overwritten before being read
028- ldac_in_rdy: OUT std_logic; -- left DAC input is ready to be written
029- rdac_in_rdy: OUT std_logic; --right DAC input is ready to be written
030- dac_underrun: OUT std_logic; -- DAC did not receive data in time
031- -- codec chip I/O signals
032- mclk: OUT std_logic; -- master clock output to codec
033- sclk: OUT std_logic; -- serial data clock to codec
034- lrck: OUT std_logic; -- left/right codec channel select
035- sdin: OUT std_logic; -- serial output to codec DAC
036- sdout: IN std_logic -- serial input from codec ADC
037- );
038- END codec_intfc;
039-
040- ARCHITECTURE codec_intfc_arch OF codec_intfc IS
041- SIGNAL mclk_int: std_logic; -- internal codec master clock
042- SIGNAL lrck_int: std_logic; -- internal left/right codec channel select
043- SIGNAL sclk_int: std_logic; -- internal codec data shift clock
044- SIGNAL bit_cntr: std_logic_vector(5 DOWNTO 0);
045- SIGNAL subcycle_cntr: std_logic_vector(1 DOWNTO 0);
046- SIGNAL lsdin: std_logic;
047- SIGNAL rsdin: std_logic;
048- SIGNAL ladc_overrun: std_logic;
049- SIGNAL radc_overrun: std_logic;
050- SIGNAL ldac_underrun: std_logic;
051- SIGNAL rdac_underrun: std_logic;
052- SIGNAL lchan_sel: std_logic;
053- SIGNAL rchan_sel: std_logic;
054- SIGNAL lchan_on: std_logic;
055- SIGNAL rchan_on: std_logic;
056- BEGIN
057-
118- bit_cntr=>bit_cntr,
119- subcycle_cntr=>subcycle_cntr,
120- chan_sel=>rchan_sel,
121- rd=>rd,
122- wr=>wr,
123- adc_out=>radc_out,
124- dac_in=>rdac_in,
125- adc_out_rdy=>radc_out_rdy,
126- adc_overrun=>radc_overrun,
127- dac_in_rdy=>rdac_in_rdy,
128- dac_underrun=>rdac_underrun,
129- sdin=>rsdin,
130- sdout=>sdout
131- );
132-
133- dac_underrun <= YES WHEN ldac_underrun=YES OR rdac_underrun=YES ELSE NO;
134- adc_overrun <= YES WHEN ladc_overrun=YES OR radc_overrun=YES ELSE NO;
135-
136- -- generates the serial data output to the SDIN pin of the
137- -- codec DAC depending on which channel is being loaded
138- sdin <= NOT(lsdin) WHEN lrck_int=LEFT ELSE NOT(rsdin);
139-
140- END codec_intfc_arch;
The interfaces to these three modules are placed into the package shown in Listing 26. (The I/O
declarations in the COMPONENT constructs have been removed for the sake of brevity.) The
declarations for the constants used in these modules are also included in the package.
029- );
030- PORT
031- (
032- ...
033- );
034- END COMPONENT;
035-
036- COMPONENT codec_intfc
037- GENERIC
038- (
039- ...
040- );
041- PORT
042- (
043- ...
044- );
045- END COMPONENT;
046- END PACKAGE;
Once the codec interface module is completed and packaged, we can use it in an application.
The simplest use is to have the FPLD accept the left and right stereo inputs from the codec
ADCs and loop these back to the codec DACs so they can output the stereo signals.
The VHDL code for the loopback application is detailed in Listing 27. The inputs and outputs
of the loopback design are as follows:
reset: A high level on this input synchronously resets the codec interface module. The reset
input is driven from the parallel port of the PC.
mclk: This output is the master clock for the codec chip.
lrck: This output controls the activation of the left and right channel circuitry in the codec and
the codec interface.
sclk: This output is the clock for synchronizing serial data transfers between the FPLD and the
codec.
sdout: The serial data stream from the codec ADCs are shifted in through this input.
sdin: The serial data stream for the codec DACs are shifted out through this output.
The following modules and processes are placed within the main body of the loopback
application:
u0: This is the instantiation of the codec interface module. Note that the ADC output buses of
this module are connected back to the DAC input buses on lines 43—46.
loop: This process controls the reading of each ADC and the writing of the value back to the
associated DAC. For example, if the output of the left channel ADC is ready to be read and
the left channel DAC is ready to be written, then the left channel is selected and the read and
write control lines are asserted. This reads the data from the ADC shift register and writes it
into the DAC shift register during a single clock cycle. Then the ADC and DAC registers
will no longer be ready for reading or writing so the read and write signals will be deasserted.
Listing 27: VHDL code for a design that uses the codec interface module to do loopback.
001- LIBRARY IEEE,codec;
002- USE IEEE.STD_LOGIC_1164.ALL;
003- USE codec.codec.ALL;
004-
005- ENTITY loopback IS
006- PORT
007- (
008- clk: IN STD_LOGIC; -- 12 MHz clock
009- rst: IN STD_LOGIC; -- active-high reset
010- mclk: OUT STD_LOGIC; -- master clock to codec
011- lrck: OUT STD_LOGIC; -- left/right clock to codec
012- sclk: OUT STD_LOGIC; -- serial data shift clock to codec
013- sdout: IN STD_LOGIC; -- serial data from codec ADCs
014- sdin: OUT STD_LOGIC; -- serial data to codec DACs
015- s: OUT STD_LOGIC_VECTOR(1 DOWNTO 0) –- LED segments
016- );
017- END loopback;
018-
019- ARCHITECTURE loopback_arch OF loopback IS
020- SIGNAL lrsel,rd,wr: STD_LOGIC;
021- SIGNAL left_channel,right_channel: STD_LOGIC_VECTOR(7 DOWNTO 0);
022- SIGNAL ldac_in_rdy,rdac_in_rdy: STD_LOGIC;
023- SIGNAL ladc_out_rdy,radc_out_rdy: STD_LOGIC;
024- BEGIN
025- u0: codec_intfc
026- GENERIC MAP
027- (
028- adc_width=>20,
029- dac_width=>20
030- )
031- PORT MAP
032- (
033- clk=>clk,
034- reset=>rst,
035- mclk=>mclk,
036- sclk=>sclk,
037- lrck=>lrck,
038- sdout=>sdout,
039- sdin=>sdin,
040- lrsel=>lrsel,
041- rd=>rd,
042- wr=>wr,
043- ladc_out=>left_channel, -- loop the left channel ADC
044- ldac_in=>left_channel, -- to the left channel DAC
045- radc_out=>right_channel, -- loop the right channel ADC
046- rdac_in=>right_channel, -- to the right channel DAC
047- ladc_out_rdy=>ladc_out_rdy,
048- radc_out_rdy=>radc_out_rdy,
049- ldac_in_rdy=>ldac_in_rdy,
050- rdac_in_rdy=>rdac_in_rdy,
051- dac_underrun=>s(0), -- connect underrun and overrun
052- adc_overrun=>s(1) -- error indicators to LEDs
053- );
054-
055- loop: PROCESS(ldac_in_rdy,ladc_out_rdy,rdac_in_rdy,radc_out_rdy)
056- BEGIN
057- IF(ladc_out_rdy=yes AND ldac_in_rdy=yes) THEN
Listing 28: XS40 UCF file for the stereo signal loopback application.
001- net clk loc=p13;
002- net rst loc=p44;
003- net sdout loc=p6;
004- net mclk loc=p9;
005- net lrck loc=p66;
006- net sdin loc=p70;
007- net sclk loc=p77;
008- net s<0> loc=p25;
009- net s<1> loc=p26;
Listing 29: XS95 UCF file for the stereo signal loopback application.
001- net clk loc = p9
002- net rst loc = p46
003- net sdout loc = p5
004- net mclk loc = p11
005- net lrck loc = p66
006- net sdin loc = p71
007- net sclk loc = p72
008- net s<0> loc = p21
009- net s<1> loc = p23
The steps for compiling and testing the design using an XS40 combined with an XStend Board
are as follows:
• Compile the synthesized netlist using the LOOP40.UCF constraint file (Listing 28).
• Mount an XS40 Board in the XStend Board and attach the downloading cable from the
XS40 to the PC parallel port. Apply 9VDC though jack J9 of the XS40. Remove the shunts
from jumpers J4, J7, and J8 to disable the LEDs. Place a shunt on jumper J17 so the codec
serial output data stream can reach the FPLD. Set all the DIP switches to the OPEN
position.
• Connect a stereo audio source (such as a CD player) to jack J9. Then plug a set of stereo
mini-headphones into jack J10.
• Download the LOOP40.BIT file into the XS40/XStend combination with the command:
XSLOAD LOOP40.BIT.
• Release the reset on the loopback circuit with the command XSPORT 0.
• Start the CD player and listen to the result with the headphones.
The steps for compiling and testing the design using an XS95 combined with an XStend Board
are as follows:
• Compile the synthesized netlist using the LOOP95.UCF constraint file (Listing 29).
• Mount an XS95 Board in the XStend Board and attach the downloading cable from the
XS95 to the PC parallel port. Apply 9VDC though jack J9 of the XS95. Remove the shunts
from jumpers J4, J7, and J8 to disable the LEDs. Place a shunt on jumper J17 so the codec
serial output data stream can reach the FPLD. Set all the DIP switches to the OPEN
position.
• Connect a stereo audio source (such as a CD player) to jack J9. Then plug a set of stereo
mini-headphones into jack J10.
• Download the LOOP95.BIT file into the XS95/XStend combination with the command:
XSLOAD LOOP95.BIT.
• Release the reset on the loopback circuit with the command XSPORT 0.
• Start the CD player and listen to the result with the headphones.
All rights reserved. No part of this publication may be reproduced, stored in a retrieval
system, or transmitted, in any form or by any means, electronic, mechanical,
photocopying, recording, or otherwise, without the prior written permission of the publisher.
Printed in the United States of America.
LEDs .............................................................................................................6
Switches........................................................................................................8
RAMs ..........................................................................................................11
Stereo Codec..............................................................................................12
Prototyping Area.........................................................................................14
Introduction ........................................................................................................21
1
Preliminaries
Getting Help!
If you can't get the XStend Board hardware to work, send an e-mail message
describing your problem to help@xess.com or submit a problem report at
http://www.xess.com/reqhelp.html. Our web site also has
answers to frequently-asked-questions,
application notes,
a place to sign-up for our email forum where you can post questions to other XS
Board users.
If you can't get your XILINX Foundation software tools installed properly, send an e-
mail message describing your problem to hotline@xilinx.com or check their web site
at http://support.xilinx.com.
Packing List
an XStend Board;
an XSTOOLs CDROM with software utilities and documentation for using the XStend
Board.
Chapter
2
XStend Overview
The XS40 and XS95 Boards offer a flexible, low-cost method of prototyping FPGA and
CPLD designs. However, their small physical size limits the amount of support circuitry
they can hold. The XStend Board removes this limitation by providing additional support
circuitry that the XS40 and XS95 Boards can access through their breadboard interfaces.
The XStend Board contains resources that extend the range of applications of the XS
Boards into three areas:
The pushbuttons, DIP switches, LEDs, and prototyping area are useful for basic lab
experiments. These features in combination with the XS Boards replicate the
functionality of the older HW/UW FPGABOARD.
The VGA monitor interface, PS/2 keyboard/mouse interface, and static RAM let the
XS Boards be used in video and computing experiments.
The stereo codec and dual-channel analog input/output circuitry are useful for
processing of audio signals in combination with DSP circuits synthesized with
XILINX's CORE generation software.
The XStend Board extends the capabilities of the XS40 and XS95 Boards by providing:
4
a 42×2 header connector for add-on daughterboards.
These resources are shown in the simplified view of the XStend Board (Figure 1). Each of
these resources will be described below.
An XS40 or XS95 Board is mounted on the XStend Board using the XS Board mounting
sockets. These sockets mate with the breadboard interface pins of the XS Boards to give
5
them access to all the resources of the XStend Board. To use an XS40 Board with the
XStend Board, insert it into the right-most columns of the socket strips. When using an
XS95 Board, you should insert it into the left-most columns of the sockets. There are
markings on the XStend Board to indicate the appropriate column for each type of XS
Board.
If the XS Board is connected to a power supply through jack J9, then its power regulation
circuitry will supply VCC and GND to the XStend Board through the mounting sockets.
XS40 Boards with 3.3V FPGAs will supply both 3.3V and 5V to the XStend Board, while
XS40 Boards with 5V FPGAs and XS95 Boards will supply only 5V.
External voltage supplies can also be used with the XStend Board. A 5V power supply
can be connected to header J12 and a 3.3V supply can be attached to header J14 as
shown in Figure 2. These supplies will power the attached XS Board as well as the
XStend electronics.
Warning: Do not attach external voltage supplies while also supplying power to the
XStend Board with an XS Board. !!!
Warning: Never place shunts on either J12 or J14 or you will short the power
supplies to ground and damage the XStend Board and the attached XS Board.. !!!
LEDs
The XStend Board provides a bargraph LED with eight LEDs (D1—D8) and two more
LED displays (U1 and U2) for use by an XS Board. All of these LEDs are active-low
meaning that an LED segment will glow when a logic-low is applied to it.
The LEDs are enabled and disabled by setting the shunts on the 2-pin jumpers as
described in Table 1.
6
• Table 1: Jumper settings for XStend LEDs.
Jumper Setting
J8 Removing the shunt on this jumper disconnects the power from bargraph LEDs D1—D8. Placing the shunt on the
jumper enables the bargraph LEDs.
J4 Removing the shunt on this jumper disconnects the power from left LED digit U1. Placing the shunt on the jumper
enables the LED digit.
J7 Removing the shunt on this jumper disconnects the power from right LED digit U2. Placing the shunt on the jumper
enables the LED digit.
J13 A shunt placed on this jumper will enable the LEDs when you are using the XStend Board with an XS95 Board. This
shunt must be removed if you are using an XS40 Board with the XStend Board!!
Listing 1 and Listing 2 show the connections from the XS40 and XS95 Boards to the
LEDs on the XStend Board expressed as UCF constraints (for the UCF syntax and usage
tips, check out http://www.xilinx.com/techdocs/2449.htm).
7
• Listing 2: Connections between the XStend LEDs and the XS95.
Switches
The XStend has a bank of eight DIP switches and two pushbuttons (labeled SPARE and
RESET) that are accessible from an XS Board. (There is a third pushbutton labeled
PROGRAM, which is used to initiate the programming of the XS40 Board. It is not
intended to be a general-purpose input.)
When closed or ON, each DIP switch pulls the connected pin of the XS Board to ground.
When the DIP switch is open or OFF, the pin is pulled high through a 10KΩ resistor.
When not being used, the DIP switches should be left in the open or OFF
configuration so the pins of the XS Board are not tied to ground and can freely !!!
move between logic low and high levels.
When pressed, each pushbutton pulls the connected pin of the XS Board to ground.
Otherwise, the pin is pulled high through a 10 KΩ resistor.
Listing 3 and Listing 4 show the connections from the XS40 and XS95 Boards to the
switches on the XStend Board expressed as UCF constraints.
8
• Listing 3: Connections between the XStend DIP and pushbutton switches and the XS40.
• Listing 4: Connections between the XStend DIP and pushbutton switches and the XS95.
VGA Interface
The XStend Board provides an XS Board with an interface to a VGA monitor through
connector J5. (Version 1.2 and higher of the XS Boards already have their own VGA
interfaces, so the XStend circuitry is redundant for them.) The XS Board can drive the
active-low horizontal and vertical sync signals that control the width and height of the video
frame. The XS Board also has access to two bits each of red, green, and blue color
2 2 2
signals so it can generate pixels in any of 2 ×2 ×2 =64 different colors.
Listing 5 and Listing 6 show the connections from the XS40 and XS95 Boards to the
VGA interface of the XStend Board. (These pin assignments are identical to the pin
assignments for the XS Boards, which have their own VGA interfaces.)
9
• Listing 5: Connections between the XStend VGA interface and the XS40.
# VGA CONNECTIONS
NET VSYNCB LOC=P67;
NET HSYNCB LOC=P19;
NET RED<1> LOC=P18;
NET RED<0> LOC=P23;
NET GREEN<1> LOC=P20;
NET GREEN<0> LOC=P24;
NET BLUE<1> LOC=P26;
NET BLUE<0> LOC=P25;
• Listing 6: Connections between the XStend VGA interface and the XS95.
# VGA CONNECTIONS
NET VSYNCB LOC=P24;
NET HSYNCB LOC=P15;
NET RED<1> LOC=P14;
NET RED<0> LOC=P18;
NET GREEN<1> LOC=P17;
NET GREEN<0> LOC=P19;
NET BLUE<1> LOC=P23;
NET BLUE<0> LOC=P21;
The XStend Board provides an XS Board with a PS/2-style interface (mini-DIN connector
J6) to either a keyboard or a mouse. The XS Board receives two signals from the PS/2
interface: a clock signal and a serial data stream that is synchronized with the falling edges
on the clock signal.
Listing 7 and Listing 8 show the connections from the XS40 and XS95 Boards to the
PS/2 interface of the XStend Board (expressed as UCF constraints):
• Listing 7: Connections between the XStend PS/2 interface and the XS40.
• Listing 8: Connections between the XStend PS/2 interface and the XS95.
10
RAMs
The XStend Board adds an additional 64 KBytes of RAM to the 32 KBytes already on the
XS Board. The XStend RAM connects to the same pins as the XS Board RAM for the
address bus, data bus, write-enable, and output-enable. The chip-selects of the XStend
Board RAMs are connected to different pins so all the RAMs can be individually selected.
Listing 9 and Listing 10 show the connections from the XS40 and XS95 Boards to their
own RAMs and the RAMs of the XStend Board (expressed as UCF constraints):
11
• Listing 10: Connections between the XStend RAMs and the XS95.
Stereo Codec
The XStend Board has a stereo codec that accepts two analog input channels from jack
J9, digitizes the analog values, and sends the digital values to the XS Board as a serial bit
stream. The codec also accepts a serial bit stream from the XS Board and converts it into
two analog output signals, which exit the XStend Board through jack J10.
Jumper Setting
J11 Placing a shunt on this jumper disables the codec by holding it in the reset state. No shunt should be placed
on this jumper when the codec is being used.
J17 Removing this shunt prevents the codec’s serial data output from reaching the XS Board. A shunt should be
placed on this jumper when the codec is being used.
Listing 11 and Listing 12 show the connections from the XS40 Board to the codec
interface on the XStend Board (expressed as UCF constraints):
12
• Listing 11: Connections between the XStend stereo codec and the XS40 Board.
• Listing 12: Connections between the XStend stereo codec and the XS95 Board.
The analog stereo input and output signals enter and exit the XStend Board through the
1/8” jacks J9 and J10, respectively. The output of an audio CD player can be input
through J9 and a set of small stereo headphones can be connected to J10 for listening to
the processed output.
The digitized data output from the codec passes through jumper J17 on its way to the XS
Board inserted in the XStend Board. A shunt should be placed on J17 when the codec is
being used. Because the serial data output of the codec is not tristatable and because it
shares the input to the XS Board with other resources on the XStend Board, the shunt on
J17 should be removed when the codec is not being used.
An XS40 Board inserted in the XStend Board can be configured and tested using a
XILINX Xchecker cable attached to header J19. When using the Xchecker cable, you
must not connect the cable between the XS Board and the parallel port of the PC. In
addition, when using the Xchecker cable with an XStend/XS40 combination, you must
make the following adjustments to the XS40 Board:
Remove the shunts from jumpers J4, J6, J10 and J11 of the XS40 Board;
The connections between the Xchecker cable and the XS40 Board is listed in Table 3.
13
• Table 3: Connections between the XStend Board Xchecker interface and the XS40 Board.
Prototyping Area
• Figure 3: Top-side view of the network of VCC and GND buses around the component through-holes
in the XStend Board prototyping area.
The placement of the shunt on jumper J16 will determine whether the VCC buses in the
prototyping area carry either 5V or 3.3V (see Figure 6). Of course, the jumper selection
will have no effect unless you have both these voltages supplied to the XStend Board
either by the XS Board or by connecting external power supplies.
14
• Figure 4: Shunt placement for setting the VCC bus voltage..
Connections from the XS Board to the prototyping area are made through connector J3.
The arrangement of pins on this connector exactly matches the arrangement of pins on
the XS40 Board. For example, the pin at the bottom-left of J3 on the XStend Board
corresponds to pin 21 at the bottom-left of the XS40 Board.
The XS95 Board has a completely different pin arrangement than the XS40. Therefore,
each pin on J3 is explicitly labeled with the corresponding pin number on the XS95 Board.
For example, the pin at the bottom-left of J3 on the XStend Board is connected to pin 68
near the top-left of the XS95 Board.
Daughterboard Connector
Daughterboards with specialized circuitry can be connected to the XStend board through
connector J18. This 42×2 connector brings all the I/O and VCC/GND from the XS40 or
XS95 Board to the daughterboard.
15
Chapter
3
Programmer's
Models
The interconnections of the XStend Board resources and an XS40 or XS95 Board are
shown in Figure 5 and Figure 6, respectively. These figures remove much of the
extraneous detail of the actual schematics, so we refer to them as programmer’s models.
Items within the shaded area in each figure correspond to circuitry housed on the XS
Board. The remaining items are XStend Board resources.
A cursory glance at the figures reveals that many of the resources share connections. For
example, the codec, DIP switch, and microcontroller port P1 are all connected to the same
set of pins on the FPGA or CPLD. So any design has to ensure that only one of these
resources is outputting data at any particular time. (Hence the need in some designs to
place the DIP switches in the OPEN position, or remove the shunt through which the
codec SDOUT drives serial data, or keep the microcontroller in the reset state.)
Table 4 and Table 5 list the same interconnection data for the XS40 and XS95 Boards,
respectively, in a tabular format, which makes it easier to see which resources share
common connections.
• Figure 5: Programmer's model of the XS40/XStend Board combination.
17
• Figure 6: Programmer's model of the XS95/XStend Board combination.
18
• Table 4: Connections between the XS40 Board and the XStend Board resources.
Stereo Codec
Push-buttons
Power/ GND
BOARD Pin
PC Parallel
(J1,J3,J18)
DIP Switch
UW-FPGA
Oscillator
XS40 Pin
Interface
Interface
8051 uC
RAMs
LEDs
PS/2
VGA
Port
Function
2 +5V +5V power source
3 LSB0 A0 Left LED segment; RAM address line P35
4 LSB1 A1 Left LED segment; RAM address line P36
5 LSB2 A2 Left LED segment; RAM address line P29
6 DIPSW4 SDOUT P1.3 DIP switch; codec serial data output; uC I/O P24
7 DIPSW1 LCEB P1.0 DIP switch; left RAM chip-enable, uC I/O port P19
8 DIPSW2 RCEB P1.1 DIP switch; right RAM chip-enable, uC I/O port P20
9 DIPSW3 MCLK P1.2 DIP switch; codec master clock; uC I/O port P23
10 DB8 D7 P0.7 LED; RAM data line; uC muxed address/data line P61
13 CLK XS Board oscillator
14 PSENB uC program store-enable
15 JTAG TDI; DIN
16 JTAG TCK; CCLK
17 JTAG TMS
18 S5 RED1 XS Board LED segment; VGA color signal
19 S6 HSYNCB XS Board LED segment; VGA horiz. sync.
20 S3 GREEN1 XS Board LED segment; VGA color signal
23 S4 RED0 XS Board LED segment; VGA color signal
24 S2 GREEN0 XS Board LED segment; VGA color signal
25 S0 BLUE0 XS Board LED segment; VGA color signal
26 S1 BLUE1 XS Board LED segment; VGA color signal
27 P3.7 (RD_) uC read line
28 RDPB P2.7 Right LED decimal-point; uC I/O port P41
29 ALEB uC address-latch-enable
30 Serial EEPROM chip-enable
32 PC_D6 PC parallel port data output
34 PC_D7 PC parallel port data output
35 DB5 D4 P0.4 LED; RAM data line; uC muxed address/data line P66
36 RST uC reset
37 RESETB XTAL1 Pushbutton; uC clock P56
38 DB4 D3 P0.3 LED; RAM data line; uC muxed address/data line P57
39 DB3 D2 P0.2 LED; RAM data line; uC muxed address/data line P58
40 DB2 D1 P0.1 LED; RAM data line; uC muxed address/data line P59
41 DB1 D0 P0.0 LED; RAM data line; uC muxed address/data line P60
44 CCLK PC_D0 Codec control line; PC parallel port data output
45 CDIN PC_D1 Codec control line; PC parallel port data output
46 CSB PC_D2 Codec control line; PC parallel port data output
47 PC_D3 PC parallel port data output
48 PC_D4 PC parallel port data output
49 PC_D5 PC parallel port data output
50 RSB4 A12 P2.4 Right LED segment; RAM address line; uC I/O port P48
51 RSB2 A10 P2.2 Right LED segment; RAM address line; uC I/O port P45
52 GND Power supply ground
54 5.0V/3.3V 5V/3.3V power supply (4000E/4000XL)
55 PROGRAM XS40 configuration control P55
56 RSB3 A11 P2.3 Right LED segment; RAM address line; uC I/O port P51
57 RSB1 A9 P2.1 Right LED segment; RAM address line; uC I/O port P47
58 RSB5 A13 P2.5 Right LED segment; RAM address line; uC I/O port P50
59 RSB0 A8 P2.0 Right LED segment; RAM address line; uC I/O port P46
60 RSB6 A14 P2.6 Right LED segment; RAM address line; uC I/O port P49
61 OEB RAM output-enable
62 WEB P3.6 (WR_) RAM write-enable; uC I/O port
65 CEB XS Board RAM chip-enable
66 DIPSW7 LRCK P1.6 PC_S5 DIP switch; codec left-right channel switch; uC I/O port; PC P27
67 SPAREB VSYNCB P1.7 Pushbutton; VGA vert. sync.; uC I/O port P18
68 KB_CLK P3.4 (T0) PS/2 keyboard clock; uC I/O port
69 DIPSW8 KB_DATA P3.1 (TX PC_S6 DIP switch; PS/2 keyboard serial data; uC I/O port; PC par P28
70 DIPSW6 SDIN P1.5 PC_S3 DIP switch; codec serial input data; uC I/O port; PC paralle P26
71 JTAG TDI; DIN
72 JTAG TDO; DOUT
73 JTAG TCK; CCLK
75 PC_S7 JTAG TDO; DOUT; PC parallel port status input
77 DIPSW5 SCLK P1.4 PC_S4 DIP switch; codec serial I/O clock; uC I/O port; PC parallel P25
78 LSB3 A3 Left LED segment; RAM address line P44
79 LSB4 A4 Left LED segment; RAM address line P38
80 DB7 D6 P0.6 LED; RAM data line; uC muxed address/data line P62
81 DB6 D5 P0.5 LED; RAM data line; uC muxed address/data line P65
82 LSB5 A5 Left LED segment; RAM address line P40
83 LSB6 A6 Left LED segment; RAM address line P39
• 84 LDPB A7 Left LED decimal-point; RAM address line P37
19
• Table 5: Connections between the XS95 Board and the XStend Board resources.
Stereo Codec
Push-buttons
Power/ GND
BOARD Pin
PC Parallel
DIP Switch
XS95 Pins
UW-FPGA
Oscillator
Interface
Interface
8051 Uc
RAMs
LEDs
PS/2
VGA
Port
(J2)
Function
1 LSB0 A4 Left LED segment; RAM address line P35
2 LSB1 A7 Left LED segment; RAM address line P36
3 LSB2 A5 Left LED segment; RAM address line P29
4 Uncommitted XS95 I/O pin
5 DIPSW4 SDOUT P1.3 DIP switch; codec serial data output; uC I/O P24
6 DIPSW1 LCEB P1.0 DIP switch; left RAM chip-enable, uC I/O port P19
7 DIPSW2 RCEB P1.1 DIP switch; right RAM chip-enable, uC I/O port P20
9 CLK XS Board oscillator
10 RESETB XTAL1 Pushbutton; uC clock P56
11 DIPSW3 MCLK P1.2 DIP switch; codec master clock; uC I/O port P23
12 Uncommitted XS95 I/O pin
13 PSENB uC program store-enable
14 S5 RED1 XS Board LED segment; VGA color signal
15 S6 HSYNCB XS Board LED segment; VGA horiz. sync.
17 S3 GREEN1 XS Board LED segment; VGA color signal
18 S4 RED0 XS Board LED segment; VGA color signal
19 S2 GREEN0 XS Board LED segment; VGA color signal
20 ALEB uC address-latch-enable
21 S0 BLUE0 XS Board LED segment; VGA color signal
23 S1 BLUE1 XS Board LED segment; VGA color signal
25 Uncommitted XS95 I/O pin
26 KB_CLK P3.4 (T0) PS/2 keyboard clock; uC I/O port
28 JTAG TDI; DIN
29 JTAG TMS
30 JTAG TCK; CCLK
31 P3.0 (RXD) uC I/O port
32 P3.7 (RD_) uC I/O port
33 P3.5 (T1) uC I/O port
34 RDPB P2.7 Right LED decimal-point; RAM address line; uC I/O port P41
35 DB8 D7 P0.7 LED; RAM data line; uC muxed address/data line P61
36 DB7 D6 P0.6 LED; RAM data line; uC muxed address/data line P62
37 DB6 D5 P0.5 LED; RAM data line; uC muxed address/data line P65
39 DB5 D4 P0.4 LED; RAM data line; uC muxed address/data line P66
40 DB4 D3 P0.3 LED; RAM data line; uC muxed address/data line P57
41 DB3 D2 P0.2 LED; RAM data line; uC muxed address/data line P58
43 DB2 D1 P0.1 LED; RAM data line; uC muxed address/data line P59
44 DB1 D0 P0.0 LED; RAM data line; uC muxed address/data line P60
45 RST uC reset
46 CCLK PC_D0 Codec control line; PC parallel port data output
47 CDIN PC_D1 Codec control line; PC parallel port data output
48 CSB PC_D2 Codec control line; PC parallel port data output
49 GND Power supply ground
50 PC_D3 PC parallel port data output
51 PC_D4 PC parallel port data output
52 PC_D5 PC parallel port data output
53 RSB4 A12 P2.4 Right LED segment; RAM address line; uC I/O port P48
54 RSB2 A10 P2.2 Right LED segment; RAM address line; uC I/O port P45
55 RSB3 A11 P2.3 Right LED segment; RAM address line; uC I/O port P51
56 RSB1 A9 P2.1 Right LED segment; RAM address line; uC I/O port P47
57 RSB5 A13 P2.5 Right LED segment; RAM address line; uC I/O port P50
58 RSB0 A8 P2.0 Right LED segment; RAM address line; uC I/O port P46
59 JTAG TDO; DOUT
61 RSB6 A14 P2.6 Right LED segment; RAM address line; uC I/O port P49
62 OEB RAM output-enable
63 WEB P3.6 (WR_) RAM write-enable; uC I/O port
65 CEB XS Board RAM chip-enable
66 DIPSW7 LRCK P1.6 PC_S5 DIP switch; codec left-right channel select; uC I/O port; PC P27
68 P3.3 (INT1_) uC I/O port
69 P3.2 (INT0_) uC I/O port
70 DIPSW8 KB_DATA P3.1 (TX PC_S6 DIP switch; PS/2 keyboard serial data; uC I/O port; PC par P28
71 DIPSW6 SDIN P1.5 PC_S3 DIP switch; codec serial input data; uC I/O port; PC paralle P26
72 DIPSW5 SCLK P1.4 PC_S4 DIP switch; codec serial clock; uC I/O port; PC parallel por P25
74 Uncommitted XS95 I/O pin
75 LSB3 A0 Left LED segment; RAM address line P44
76 Uncommitted XS95 I/O pin
77 Uncommitted XS95 I/O pin
78 +5V +5V power source
79 LSB4 A1 Left LED segment; RAM address line P38
80 PC_D7 PC parallel port data output
81 PC_D6 PC parallel port data output
82 LSB5 A2 Left LED segment; RAM address line P40
83 LSB6 A6 Left LED segment; RAM address line P39
84 LDPB A3 Left LED decimal-point; RAM address line P37
24,67 SPAREBDP VSYNCB P1.7 Pushbutton; XS Board LED decimal-point; VGA horiz. sync P18
20
Chapter
4
Example Designs
Introduction
This chapter discusses some design examples that you can build using the Xstend Board
coupled with an XS40 or XS95 Board. You can find links to the source code for these
designs at http://www.xess.com/ho03000.html.
This example creates a circuit that displays the settings of the DIP switches on the LEDs
and LED digits of the XStend and XS Boards. The particular set of LEDs, which is
activated, is selected by the SPARE and RESET pushbuttons. The VHDL code for this
example is shown in Listing 13.
The steps for compiling and testing the design using an XS40 combined with an XStend
Board are as follows:
Compile the synthesized netlist using the SWTCH40.UCF constraint file (Listing 14).
Mount an XS40 Board in the XStend Board and attach the downloading cable from
the XS40 to the PC parallel port. Apply 9VDC though jack J9 of the XS40. Place
shunts on jumpers J4, J7, and J8 of the XStend Board to enable the LED displays.
Remove the shunt on jumper J17 to keep the XStend codec serial output from
interfering with the DIP switch logic levels.
Download the SWTCH40.BIT file into the XS40/XStend combination with the
command: XSLOAD SWTCH40.BIT.
Set the DIP switches and press the SPARE and RESET pushbuttons. Observe the
results on the LEDs.
The steps for compiling and testing the design using an XS95 combined with an
XStend Board are as follows:
Compile the synthesized netlist using the SWTCH95.UCF constraint file (Listing 15).
Generate an SVF file for the design.
Mount an XS95 Board in the XStend Board and attach the downloading cable from
the XS95 to the PC parallel port. Apply 9VDC though jack J9 of the XS95. Place
shunts on jumpers J4, J7, and J8 of the XStend Board to enable the LED displays.
Remove the shunt on jumper J17 to keep the XStend codec serial output from
interfering with the DIP switch logic levels.
Download the SWTCH95.SVF file into the XS95/XStend combination with the
command: XSLOAD SWTCH95.SVF.
Set the DIP switches and press the SPARE and RESET pushbuttons. Observe the
results on the LEDs.
• Listing 13: VHDL code for using the XStend LEDs and switches.
22
041- -- these LED segments are active low.
042- rsb <= NOT(dipsw) WHEN (spareb='0' AND resetb='1') ELSE
043- "11111111"; -- otherwise keep the LED digit dark
044-
045- -- light the XStend bargraph LED with the pattern from the
046- -- DIP switches if neither pushbutton is pressed
047- -- these LED segments are active low.
048- db <= NOT(dipsw) WHEN (spareb='1' AND resetb='1') ELSE
049- "11111111"; -- otherwise keep the bargraph LED dark
050- END switches_arch;
23
24
• Listing 15: XS95 UCF file for the LED/switch example.
25
Displaying Graphics from RAM Through the VGA Interface
This section discusses the timing for the signals that drive a VGA monitor and describes a
VHDL module that will let you drive a monitor with a picture stored in RAM.
There are three signals -- red, green, and blue -- that send color information to a VGA
monitor. These three signals each drive an electron gun that emits electrons which paint
one primary color at a point on the monitor screen. Analog levels between 0 (completely
dark) and 0.7 V (maximum brightness) on these control lines tell the monitor what
intensities of these three primary colors to combine to make the color of a dot (or pixel) on
the monitor’s screen.
Each analog color input can be set to one of four levels by two digital outputs using a
simple two-bit digital-to-analog converter (see Figure 7). The four possible levels on each
analog input are combined by the monitor to create a pixel with one of 4 × 4 × 4 = 64
different colors. So the six digital control lines let us select from a palette of 64 colors.
26
• Figure 7: Digital-to-analog interface to a VGA monitor.
A single dot of color on a video monitor doesn’t impart much information. A horizontal line
of pixels carries a bit more information. But a frame composed of multiple lines can
present an image on the monitor screen. A frame of VGA video typically has 480 lines and
each line usually contains 640 pixels. In order to paint a frame, there are deflection circuits
in the monitor that move the electrons emitted from the guns both left-to-right and top-to-
bottom across the screen. These deflection circuits require two synchronization signals in
order to start and stop the deflection circuits at the right times so that a line of pixels is
painted across the monitor and the lines stack up from the top to the bottom to form an
image. The timing for the VGA synchronization signals is shown in Figure 8.
Negative pulses on the horizontal sync signal mark the start and end of a line and ensure
that the monitor displays the pixels between the left and right edges of the visible screen
area. The actual pixels are sent to the monitor within a 25.17 µs window. The horizontal
sync signal drops low a minimum of 0.94 µs after the last pixel and stays low for 3.77 µs.
A new line of pixels can begin a minimum of 1.89 µs after the horizontal sync pulse ends.
So a single line occupies 25.17 µs of a 31.77 µs interval. The other 6.6 µs of each line is
the horizontal blanking interval during which the screen is dark.
In an analogous fashion, negative pulses on a vertical sync signal mark the start and end
of a frame made up of video lines and ensure that the monitor displays the lines between
the top and bottom edges of the visible monitor screen. The lines are sent to the monitor
27
within a 15.25 ms window. The vertical sync signal drops low a minimum of 0.45 ms after
the last line and stays low for 64 µs. The first line of the next frame can begin a minimum
of 1.02 ms after the vertical sync pulse ends. So a single frame occupies 15.25 ms of a
16.784 ms interval. The other 1.534 ms of the frame interval is the vertical blanking
interval during which the screen is dark.
Now we have to figure out a process that will send pixels to the monitor with the correct
timing and framing. We can store a picture in the RAM of the XS Board. Then we can
retrieve the data from the RAM, format it into lines of pixels, and send the lines to the
monitor with the appropriate pulses on the horizontal and vertical sync pulses.
The pseudocode for a single frame of this process is shown in Listing 16. The
pseudocode has two outer loops: one, which displays the L lines of visible pixels, and
another, which inserts the V, blank lines and the vertical sync pulse. Within the first loop,
there are two more loops: one, which sends the P pixels of each video line to the monitor,
and another, which inserts the H, blank pixels and the horizontal sync pulse.
28
Within the pixel display loop, there are statements to get the next byte from the RAM.
Each byte contains four two-bit pixels. A small loop iteratively extracts each pixel to be
displayed from the lower two bits of the byte. Then the byte is shifted by two bits so the
next pixel will be in the right position during the next iteration of the loop. Since it has only
two bits, each pixel can store one of four colors. The mapping from the two-bit pixel value
to the actual values required by the monitor electronics is done by the COLOR_MAP()
routine.
29
Figure 9 shows how to pipeline certain operations to account for delays in accessing data
from the RAM. The pipeline has three stages:
Stage 1: The circuit uses the horizontal and vertical counters to compute the address
where the next pixel is found in RAM. The counters are also used to determine the
firing of the sync pulses and whether the video should be blanked. The pixel data
from the RAM, blanking signal, and sync pulses are latched at the end of this stage so
they can be used in the next stage.
Stage 2: The circuit uses the pixel data and the blanking signal to determine the binary
color outputs. These outputs are latched at the end of this stage.
Stage 3: The binary color outputs are applied to the DAC, which sets the intensity levels
for the monitor’s color guns. The actual pixel is painted on the screen during this
stage.
The pseudocode and pipeline timing in the last section will help us to understand the
VHDL code for a VGA signal generator shown in Listing 17. The inputs and outputs of
the circuit as defined in the entity declaration are as follows:
clk: The input for the 12 MHz clock of the XS Board is declared here. This clock sets the
maximum rate at which pixels can be sent to the monitor. The time interval within
each line for transmitting viewable pixels is 25.17 µs, so this VGA generator circuit can
only put a maximum of 25.17 ms × 12 MHz = 302 pixels on each line. For purposes
of storing images in the RAM, it is convenient to reduce this to 256 pixels per line and
blank the remaining 46 pixels. Half of these blank pixels are placed before the 256
viewable pixels and half are placed after them on a line. This centers the viewable
pixels between the left and right edges of the monitor screen.
30
reset: This line declares an input, which will reset all the other circuitry to a known state.
hsyncb, vsyncb: The outputs for the horizontal and vertical sync pulses are declared.
The hsyncb output is declared as a buffer because it will also be referenced within the
architecture section as a clock for the vertical line counter.
rgb: The outputs that control the red, green, and blue color guns of the monitor are
declared here. Each gun is controlled by two bits, so there are four possible
intensities for each color. Thus, this circuit can produce 4 × 4 × 4 = 64 different colors.
address, data: These lines declare the outputs for driving the address lines of the RAM
and the inputs for receiving the data from the RAM.
ceb, oeb, web: These are the declarations for the outputs which drive the chip-select,
output-enable, and write-enable control lines of the RAM.
hcnt, vcnt: The counters that store the current horizontal position within a line of pixels
and the vertical position of the line on the screen are declared on these lines. We will
call these the horizontal or pixel counter, and the vertical or line counter, respectively.
The line period is 31.77 µs that is 381 clock cycles, so the pixel counter needs at least
nine bits of resolution. Each frame is composed of 528 video lines (only 480 are
visible, the other 48 are blanked), so a ten bit counter is needed for the line counter.
pixrg: This is the declaration for the eight-bit register that stores the four pixels received
from the RAM.
blank, pblank: This line declares the video blanking signal and its registered counterpart
that is used in the next pipeline stage.
Within the main body of the architecture section, these following processes are executed:
inc_vert_line_counter: This process describes the operation of the vertical line counter.
The counter is asynchronously set to zero when the reset input is high. The counter
increments on the rising edge of the horizontal sync pulse after a line of pixels is
completed. The range for the horizontal pixel counter is [0,527]. When the counter
reaches 527, it rolls over to zero on the next cycle. Thus, the counter has a period of
528 lines. Since the duration of a line of pixels is 31.75 µs, this makes the frame
interval equal to 16.76 ms.
generate_horiz_sync: This process describes the operation of the horizontal sync pulse
generator. The horizontal sync is set to its inactive high level when the reset is
activated. During normal operations, the horizontal sync output is updated on every
pixel clock. The sync signal goes low on the cycle after the pixel counter reaches 291
and continues until the cycle after the counter reaches 337. This gives a low
31
horizontal sync pulse of (337-291)=46 pixel clocks. With a pixel clock of 12 MHz, this
translates to a low-going horizontal sync pulse of 3.83 µs. The sync pulse starts 292
clocks after the line of pixels begin, which translates to 24.33 µs. This is less than the
26.11 µs we stated before. The difference of 1.78 ms translates to 21 pixel clocks.
This time interval corresponds to the 23 blank pixels that are placed before the 256
viewable pixels (minus two clock cycles for pipelining delays).
generate_vert_sync: This process describes the operation of the vertical sync pulse
generator. The vertical sync is set to its inactive high level when the reset is activated.
During normal operations, the vertical sync output is updated after every line of pixels
is completed. The sync signal goes low on the cycle after the line counter reaches
493 and continues until the cycle after the counter reaches 495. This gives a low
vertical sync pulse of (495-493)= 2 lines. With a line interval of 31.75 µs, this
translates to a low-going vertical sync pulse of 63.5 µs. The vertical sync pulse starts
494 × 31.75 µs = 15.68 ms after the beginning of the first video line.
Line 91: This line describes the computation of the combinatorial blanking signal. The
video is blanked after 256 pixels on a line are displayed, or after 480 lines are
displayed.
pipeline_blank: This process describes the operation of the pipelined video blanking
signal. Within the process, the blanking signal is stored in a register so it can be used
during the next stage of the pipeline when the color is computed.
Lines 104 -- 106: On these lines, the RAM is permanently selected and writing to the
RAM is disabled. This makes the RAM look like a ROM, which stores video data. In
addition, the outputs from the RAM are disabled when the video is blanked since
there is no need for pixels during the blanking intervals. This isn’t really necessary
since no other circuit is trying to access the RAM.
Line 113: The address in RAM where the next four pixels are stored is calculated by
concatenating the lower nine bits of the line counter with bits 7,6,5,4,3 and 2 of the
9
pixel counter. With this arrangement, the line counter stores the address of one of 2
6
= 512 pages. Each page contains 2 = 64 bytes. Each byte contains four pixels, so
each page stores one line of 256 pixels. The pixel counter increments through the
bytes of a page to get the pixels for the current line. (Note that we don’t need to use
bits 1 and 0 of the pixel counter when computing the RAM address since each byte
contains four pixels.) After the line is displayed, the line counter is incremented to
point to the next page.
update_pixel_register: This process describes the operation of the register that holds the
byte of pixel data read from RAM. The register is asynchronously cleared when the
VGA circuit is reset. The register is updated on the rising edge of each pixel clock.
The pixel register is loaded with data from the RAM whenever the lowest two bits of
the pixel counter are both zero. The active pixel is always in the lower two bits of the
register. Each pixel in the RAM data byte is shifted into the active position by right
shifting the register two bits on each rising clock edge.
map_pixel_to_rgb: this process describes the process by which the current active pixel is
mapped into the six bits that drive the red, green and blue color guns. The register is
set to zero (which displays as the color black) when the reset input is high. The color
register is clocked on the rising edge of the pixel clock since this is the rate at which
new pixel values arrive. The value clocked into the register is a function of the pixel
32
value and the blanking input. When the pipelined blanking input is low (inactive), the
color displayed on the monitor is red, green, blue, or white depending upon whether
the pixel value is 00, 01, 10, or 11, respectively. When the pipelined blanking input is
high, the color register is loaded with zero (black).
33
046- BEGIN
047- IF reset='1' THEN -- reset asynchronously clears line counter
048- vcnt <= "0000000000";
049- ELSIF (int_hsyncb'EVENT AND int_hsyncb='1') THEN
050- IF vcnt<527 THEN -- vert. line counter rolls-over after 528 lines
051- vcnt <= vcnt + 1;
052- ELSE
053- vcnt <= "0000000000";
054- END IF;
055- END IF;
056- END PROCESS;
057-
058- generate_horiz_sync:
059- PROCESS(clk,reset)
060- BEGIN
061- IF reset='1' THEN -- reset asynchronously inactivates horiz sync
062- int_hsyncb <= '1';
063- ELSIF (clk'EVENT AND clk='1') THEN
064- IF (hcnt>=291 AND hcnt<337) THEN
065- -- horiz. sync is low in this interval to signal start of new line
066- int_hsyncb <= '0';
067- ELSE
068- int_hsyncb <= '1';
069- END IF;
070- END IF;
071- hsyncb <= int_hsyncb; -- output the horizontal sync signal
072- END PROCESS;
073-
074- generate_vert_sync:
075- PROCESS(int_hsyncb,reset)
076- BEGIN
077- IF reset='1' THEN -- reset inactivates vertical sync
078- vsyncb <= '1';
079- -- vertical sync is recomputed at the end of every line of pixels
080- ELSIF (int_hsyncb'EVENT AND int_hsyncb='1') THEN
081- IF (vcnt>=490 AND vcnt<492) THEN
082- -- vert. sync is low in this interval to signal start of new frame
083- vsyncb <= '0';
084- ELSE
085- vsyncb <= '1';
086- END IF;
087- END IF;
088- END PROCESS;
089-
090- -- blank video outside of visible region: (0,0) -> (255,479)
091- blank <= '1' WHEN (hcnt>=256 OR vcnt>=480) ELSE '0';
092- -- store the blanking signal for use in the next pipeline stage
093- pipeline_blank:
094- PROCESS(clk,reset)
095- BEGIN
096- IF reset='1' THEN
097- pblank <= '0';
098- ELSIF (clk'EVENT AND clk='1') THEN
099- pblank <= blank;
34
100- END IF;
101- END PROCESS;
102-
103- -- video RAM control signals
104- ceb <= '0'; -- enable the RAM
105- web <= '1'; -- disable writing to the RAM
106- oeb <= blank; -- enable the RAM outputs when video is not blanked
107-
108- -- The video RAM address is built from the lower 9 bits of the vert
109- -- line counter and bits 7-2 of the horizontal pixel counter.
110- -- Each byte of the RAM contains four 2-bit pixels. As an example,
111- -- the byte at address ^h1234=^b0001,0010,0011,0100 contains the pixels
112- -- at (row,col)=(^h048,^hD0),(^h048,^hD1),(^h048,^hD2),(^h048,^hD3).
113- address <= vcnt(8 DOWNTO 0) & hcnt(7 DOWNTO 2);
114-
115- update_pixel_register:
116- PROCESS(clk,reset)
117- BEGIN
118- IF reset='1' THEN -- clear the pixel register on reset
119- pixrg <= "00000000";
120- -- pixel clock controls changes in pixel register
121- ELSIF (clk'EVENT AND clk='1') THEN
122- -- the pixel register is loaded with the contents of the video
123- -- RAM location when the lower two bits of the horiz. counter
124- -- are both zero. The active pixel is in the lower two bits
125- -- of the pixel register. For the next 3 clocks, the pixel
126- -- register is right-shifted by two bits to bring the other
127- -- pixels in the register into the active position.
128- IF hcnt(1 DOWNTO 0)="00" THEN
129- pixrg <= data; -- load 4 pixels from RAM
130- ELSE
131- pixrg <= "00" & pixrg(7 DOWNTO 2); -- R-shift pixel register
132- END IF;
133- END IF;
134- END PROCESS;
135-
136- -- the color mapper translates each 2-bit pixel into a 6-bit
137- -- color value. When the video signal is blanked, the color
138- -- is forced to zero (black).
139- map_pixel_to_rgb:
140- PROCESS(clk,reset)
141- BEGIN
142- IF reset='1' THEN -- blank the video on reset
143- rgb <= "000000";
144- ELSIF (clk'EVENT AND clk='1') THEN -- update color every clock
145- -- map the pixel to a color if the video is not blanked
146- IF pblank='0' THEN
147- CASE pixrg(1 DOWNTO 0) IS
148- WHEN "00" => rgb <= "110000"; -- red
149- WHEN "01" => rgb <= "001100"; -- green
150- WHEN "10" => rgb <= "000011"; -- blue
151- WHEN OTHERS => rgb <= "111111"; -- white
152- END CASE;
153- ELSE -- otherwise, output black if the video is blanked
35
154- rgb <= "000000"; -- black
155- END IF;
156- END IF;
157- END PROCESS;
158-
159- END vga_generator_arch;
• Listing 18: XS40 UCF file for the VGA signal generator.
36
• Listing 19: XS95 UCF file for the VGA signal generator.
The steps for compiling and testing the VGA design using an XS40 combined with an
XStend Board are as follows:
1. Synthesize the VHDL code in the VGA40\VGA.VHD file for an XC4005XL FPGA.
2. Compile the synthesized netlist using the VGA40.UCF constraint file (Listing 18).
3. Mount an XS40 Board in the XStend Board and attach the downloading cable
from the XS40 to the PC parallel port. Apply 9VDC though jack J9 of the XS40.
Place shunts on jumpers J4, J7, and J8 of the XStend Board to enable the LED
displays. Remove the shunt on jumper J17 to keep the XStend codec serial
37
output from interfering with the DIP switch logic levels. Set all the DIP switches to
the OPEN position.
5. Download the VGA40.BIT file and a video test pattern into the XS40/XStend
combination with the command: XSLOAD TESTPATT.HEX VGA40.BIT.
6. Release the reset to the VGA circuitry with the command: XSPORT 0.
The steps for compiling and testing the design using an XS95 combined with an XStend
Board are as follows:
1. Synthesize the VHDL code in the VGA95\VGA.VHD file for an XC95108 CPLD.
2. Compile the synthesized netlist using the VGA95.UCF constraint file (Listing 19).
4. Mount an XS95 Board in the XStend Board and attach the downloading cable
from the XS95 to the PC parallel port. Apply 9VDC though jack J9 of the XS40.
Place shunts on jumpers J4, J7, and J8 of the XStend Board to enable the LED
displays. Remove the shunt on jumper J17 to keep the XStend codec serial
output from interfering. Set all the DIP switches to the OPEN position.
6. Download the VGA95.SVF file and a video test pattern into the XS95/XStend
combination with the command: XSLOAD TESTPATT.HEX VGA95.SVF.
7. Release the reset to the VGA circuitry with the command: XSPORT 0.
This example creates a circuit that accepts scan codes from a keyboard attached to the
PS/2 interface of the XStend Board. The binary pattern of the scan code is displayed on
the bargraph LEDs. In addition, if a scan code for one of the keys '0'—'9' arrives, then the
numeral will be displayed on the right LED display of the XStend Board.
The format of the scan code transmissions from the keyboard are shown in Figure 10.
The keyboard electronics drive the clock and data lines. The start of a scan code
transmission is indicated by a low level on the data line on the falling edge of the clock.
The eight bits of the scan code follow (starting with the least-significant bit) on successive
falling clock edges. These are followed by an odd-parity bit and then a high-level stop bit.
When the clock line goes high after the stop bit, the receiver (in this case, the FPGA or
CPLD on the XS Board inserted in the XStend Board) can pull the clock line low to inhibit
any further transmissions. After the clock line is released and it returns to a high level, the
38
keyboard can send another scan code. If the receiver never pulls the clock line low, then
the keyboard will send scan codes whenever a key is pressed.
The VHDL code for this example is shown in . The inputs and outputs of the circuit as
defined in the entity declaration are as follows:
rst: This output drives the reset pin of the microcontroller on the XS Board.
oeb: This output drives the output-enable pin of the RAM on the XS Board.
db: These outputs drive the segments of the bargraph LED on the XStend Board.
rsb: These outputs drive the segments of the right LED digit on the XStend Board.
Within the main body of the architecture section, these operations occur:
Lines 22 & 23: The microcontroller reset pin and the RAM output-enable pin are driven
high so these chips cannot interfere while receiving data from the keyboard.
Lines 25 & 26: The keyboard clock passes through an input buffer and then a global clock
buffer before it reaches the rest of the circuitry. (These buffers are declared on lines
18 and 19, respectively.) The global clock buffer distributes the clock signal with
minimal skew in the XS40 Board FPGA. These statements are not used with the
CPLD in the XS95 Board.
gather_scancode: On every falling edge of kb_clk, this process shifts the data bit on the
kb_data input into the most-significant bit of a 10-bit shift register. After 11 clock
cycles, the lower 8 bits of the register will contain the scan code, the upper 2 bits will
store the stop and parity bits, and the start bit will have been shifted through the entire
register and discarded.
Line 38: The value in the shift register is inverted and applied to the segments of the LED
bargraph. Since the bargraph segments are active-low, a segment will light for every
‘1’ bit in the shift register. The LED segment drivers are not registered so there will be
some flickering as the shift register contents change.
39
Lines 40-51: If the scan code in the shift register matches the codes for the digits 0-9,
then the right LED digit segments will be activated to display the corresponding digit.
If the scan code does not match one of these codes, the letter ‘E’ is displayed.
The steps for compiling and testing the design using an XS40 combined with an XStend
Board are as follows:
2. Compile the synthesized netlist using the KEYBRD40.UCF constraint file (Listing
21).
3. Mount an XS40 Board in the XStend Board and attach the downloading cable
from the XS40 to the PC parallel port. Apply 9VDC though jack J9 of the XS40.
Place shunts on jumpers J4, J7, and J8 to enable the LEDs. Remove the shunt
on jumper J17 to keep the XStend codec from interfering. Set all the DIP
switches to the OPEN position.
5. Download the KEYBRD40.BIT file into the XS40/XStend combination with the
command: XSLOAD KEYBRD40.BIT.
6. Press keys on the keyboard and observe the results on the LED displays.
The steps for compiling and testing the design using an XS95 combined with an XStend
Board are as follows:
2. Compile the synthesized netlist using the KEYBRD95.UCF constraint file (Listing
22).
4. Mount an XS95 Board in the XStend Board and attach the downloading cable
from the XS95 to the PC parallel port. Apply 9VDC though jack J9 of the XS95.
Place shunts on jumpers J4, J7, and J8 to enable the LEDs. Remove the shunt
on jumper J17 to keep the XStend codec from interfering. Set all the DIP
switches to the OPEN position.
5. Download the KEYBRD95.SVF file into the XS95/XStend combination with the
command: XSLOAD KEYBRD95.SVF.
6. Press keys on the keyboard and observe the results on the LED displays.
40
• Listing 20: VHDL code for receiving keyboard scan codes from the PS/2 interface.
41
051- "0010010"; -- E
052- END kbd_read_arch;
• Listing 21: XS40 UCF file for the PS/2 keyboard interface.
• Listing 22: XS95 UCF file for the PS/2 keyboard interface.
42
Inputting and Outputting Stereo Signals Through the Codec
The stereo codec on the XStend Board is capable of digitizing two analog signals to 20
bits of resolution while simultaneously generating two analog signals from 20-bit values. A
high-level view of the codec chip is shown on the right-half of Figure 11. Two analog
inputs (which are typically the left and right channels of a stereo audio signal) enter the
codec and are digitized into two 20-bit values by analog-to-digital converters (ADCs).
These values are loaded into shift registers, which are shifted out of a single pin of the
codec under control of a shift clock and a left/right channel selector control input. At the
same time, 20-bit values are alternately shifted into two shift registers in the codec, which
feed digital-to-analog converters (DACs) that drive two analog outputs. Signals on these
outputs are typically the left and right channels of a stereo audio signal.
If the FPLD is handling these values in a bit-parallel manner, then the FPLD must contain
a set of shift registers which convert the serial input stream into 20-bit values and another
set which converts 20-bit values into a serial output stream. This is shown in the left-half
of Figure 11. The gating of these shift registers onto the serial input and output pins is
synchronized with the same left/right channel select signal used by the codec chip.
In addition to the shift registers, the FPLD needs circuitry to read and write them and to
indicate when they are full and empty. Since the codec ADCs and DACs generate and
consume data at a set sample rate, it is also necessary to build circuitry which detects
overflow and underflow of the FPLD shift registers if they are not read or written in time.
• Figure 11: Connections between the XStend codec chip and the XS Board FPGA or CPLD.
a clock generator module which outputs the serial data shift clock and the left/right
channel select signals;
43
a channel module which contains the shift registers, buffers, read/write control, and
overflow/underflow detection circuitry for a single input/output stream of data;
a top-level module, which combines the clock generator module with two channel
modules to form a complete codec, interface circuit.
The VHDL code for the clock generator module is detailed in Listing 23. The inputs and
outputs of the clock generator as defined in the entity declaration are as follows:
clk: This is the main clock input, which is typically the 12 MHz clock from the XS Board.
reset: This input synchronously resets the counter the clock generator.
mclk: This output is the master clock for the codec chip.
sclk: This output is the clock for synchronizing serial data transfers between the FPLD
and the codec.
lrck: This output controls the activation of the left and right channel circuitry in the codec
and the FPLD.
bit_cntr: These outputs indicate the current bit being transmitted and received in the serial
data streams.
subcycle_cntr: The duration of each serial data bit is divided into four phases and these
outputs indicate the current phase.
Within the main body of the clock generator architecture section, these operations occur:
gen_clock: This process increments the sequencing counter and toggles the left/right
channel selector when the count reaches the duration for which a channel is active.
The codec chip requires that the channel duration be either 128, 192, or 256 master
clock periods in length. Thus, the total time to handle both channels is 256, 384, or
512 clock periods. This sets the sampling rate. So using a channel duration of 128
with a 12 MHz clock gives a sampling rate of 46.875 KHz that is sufficient for audio.
Lines 45-47: The various clocks are output on these lines. The master clock and left/right
selector have already been discussed. The serial data shift clock is one-quarter of the
master clock. So transmitting or receiving a 20-bit value will require 4 × 20 = 80 clock
periods, and this will fit within the shortest possible channel duration.
Line 48: The position of the current data bit in the serial stream for a channel is output
here. Since each bit has a duration of four clock periods, the position of the bit in the
stream is just the sequence counter with the two least-significant bits removed.
Line 49: The position within a bit is output on this line. This is given by the two least-
significant bits of the sequence counter.
44
• Listing 23: VHDL code for the codec clock generator module.
45
049- subcycle_cntr <= seq(1 DOWNTO 0);
050- END clkgen_arch;
The VHDL code for the channel module is shown in Listing 24. The inputs and outputs of
the clock generator as defined in the entity declaration are as follows:
clk: This is the main clock input, which is typically the 12 MHz clock from the XS Board.
chan_on: A high level on this input activates the channel. This input is usually controlled
by the left/right channel selector.
bit_cntr: These inputs inform the channel of the index of the serial data bit currently being
transmitted and received.
chan_sel: A high level on this input enables the interface that lets the shift registers be
read and written. (Note that despite its name, this input is not controlled by the
left/right channel selector.)
rd: A high level on this input outputs the value stored in the shift register connected to the
ADC.
wr: A high level on this input writes a new value into the shift register connected to the
DAC.
adc_out: The bits stored in the ADC shift register are read out in parallel through these
outputs..
dac_in: The DAC shift register is loaded in parallel with bits passed through these inputs.
adc_out_rdy: This output goes high after all the bits have been shifted from the codec
into the ADC shift register.
adc_overrun: This output goes high if new serial data is shifted into the ADC shift register
before the old contents have been read out through the parallel outputs.
dac_in_rdy: This output goes high after all the bits in the DAC shift register have been
shifted over to the codec.
dac_underrun: This output goes high if the DAC shift register starts shifting data over to
the codec before it has been written through the parallel inputs.
sdin: The serial data stream for the codec DAC is shifted out through this output. (Note
that this output takes its name from the pin it is connected to on the codec chip; it is
not an input.)
sdout: The serial data stream from the codec ADC is shifted in through this input. (Note
that this input takes its name from the pin it is connected to on the codec chip; it is not
an output.)
Within the main body of the channel module architecture section, these operations occur:
46
rcv_adc: This process receives serial data from the ADC in the codec. The ADC shift
register is cleared upon reset and a flag is set which indicates the shift register does
not contain all the bits from the ADC. Once the reset is removed and the channel is
active, bits are shifted into the register during the third subcycle of each bit period (the
subcycles are numbered 0, 1, 2 and 3). Accepting data on the third subcycle gives
the serial data bit plenty of time to stabilize. Bits 1,2,..., up to the width of the ADC
data value are pushed into the shift register. Then the shifting stops. The shift
register is marked as ‘not full’ as soon as a single bit is shifted in so that the value will
not be inadvertently read. The shift register status changes to full as soon as the last
bit enters the shift register.
Line 66: The contents of the shift register are output in a parallel format on this line.
These outputs are not latched and will change as bits are shifted into the register.
Line 69: A flag is maintained that indicates whether the contents of the ADC shift register
have been read. The flag is set when the ADC register for the channel is full and it is
selected for a read operation. The flag will stay set after the read operation is
complete. Reading the register does not empty it. The shift register is no longer full
only when the first bit of the next sample is shifted into it. This will reset the read flag.
read_adc: This process updates the flag that indicates whether the ADC shift register has
been read.
Lines 84—85: A status output is asserted when the data in the ADC shift register is ready
for reading. Reads are permitted when the register is full and has not yet been read.
This output is cleared as soon as a read occurs or new data is shifted into the register.
detect_adc_overrun: This process monitors the ADC shift register and flags an error
condition if the register begins accepting bits from the current sample period but the
data from the previous period has not yet been read.
tx_dac: This process transmits serial data to the DAC in the codec. The DAC shift
register is cleared upon reset and a flag is set which indicates the shift register
contains no bits for the DAC. After the reset is removed, the register can be loaded in
parallel if the channel is selected for a write operation. If no write operation is in
process but the channel is active, then data is shifted out to the codec on the third
subcycle. (This gives the data some hold time so the codec chip can clock it in
reliably.) During the first bit period, a flag is set which indicates the register is no
longer empty and a serial transmission is in process. Then bits 1,2,..., up to the width
of the DAC data value are shifted out. As the last bit is output, the flag is set to show
the shift register is now empty.
Line 123: The DAC serial data input of the codec chip is driven by the most-significant bit
of the DAC shift register.
Line 126: A flag is maintained that indicates whether the DAC shift register has been
written. The flag is set when the DAC register for the channel is empty and it is
selected for a write operation. The flag will stay set after the write operation is
complete. Writing the register does not fill it. The shift register is full only when the
first bit of the next sample period is shifted out of it. This will reset the write flag.
write_dac: This process updates the flag that indicates whether the DAC shift register has
been written.
47
Lines 141—142: A status output is asserted when the DAC shift register is ready to be
written with new input data. Writes are permitted when the register is empty and has
not yet been written. This output is cleared as soon as a write occurs or when data
bits start shifting out of the register.
detect_dac_underrun: This process monitors the DAC shift register and flags an error
condition if the register starts shifting out data but has not yet been written with a new
data value for the current sample period.
48
043- SIGNAL adc_rd: std_logic; -- the ADC channel has been read
044- SIGNAL adc_rd_nxt: std_logic; -- the ADC channel has been read
045- SIGNAL adc_out_rdy_int: std_logic; -- internal version adc_out_rdy
046- BEGIN
047- -- receives data from codec ADC
048- rcv_adc:
049- PROCESS(clk,chan_on,subcycle_cntr,bit_cntr,adc_shfreg,sdout)
050- BEGIN
051- IF(clk'event AND (clk=YES)) THEN
052- IF(reset='1') THEN
053- adc_shfreg <= (OTHERS=>'0');
054- adc_full <= NO;
055- ELSIF((chan_on=YES) AND (subcycle_cntr=2)) THEN
056- IF(bit_cntr<ADC_WIDTH-1) THEN
057- adc_full <= NO;
058- adc_shfreg <= adc_shfreg(ADC_WIDTH-2 DOWNTO 0) & sdout;
059- ELSIF(bit_cntr=ADC_WIDTH-1) THEN
060- adc_full <= YES;
061- adc_shfreg <= adc_shfreg(ADC_WIDTH-2 DOWNTO 0) & sdout;
062- END IF;
063- END IF;
064- END IF;
065- END PROCESS;
066- adc_out <= adc_shfreg;
067-
068- -- handle reading of ADC data from codec interface
069- adc_rd_nxt <= YES WHEN (adc_full=YES AND chan_sel=YES AND rd=YES) OR
070- (adc_full=YES AND adc_rd=YES)
071- ELSE NO;
072- read_adc:
073- PROCESS(clk,adc_rd_nxt)
074- BEGIN
075- IF(clk'event AND clk='1') THEN
076- IF(reset=YES) THEN
077- adc_rd <= NO;
078- ELSE
079- adc_rd <= adc_rd_nxt;
080- END IF;
081- END IF;
082- END PROCESS;
083- -- ADC data is ready if register is full and hasn't been read yet
084- adc_out_rdy_int <= YES WHEN adc_full=YES AND adc_rd=NO ELSE NO;
085- adc_out_rdy <= adc_out_rdy_int;
086-
087- -- detect and signal overwriting of data from the codec ADC channels
088- detect_adc_overrun:
089- PROCESS(clk,reset,bit_cntr,chan_on,adc_out_rdy_int)
090- BEGIN
091- IF(clk'event AND clk='1') THEN
092- IF(reset=YES) THEN
093- adc_overrun <= NO;
094- ELSIF(bit_cntr=1 AND chan_on=YES AND adc_out_rdy_int=YES) THEN
095- adc_overrun <= YES;
096- END IF;
49
097- END IF;
098- END PROCESS;
099-
100- -- transmits data to codec DAC
101- tx_dac:
102- PROCESS(clk,reset,chan_on,subcycle_cntr,bit_cntr,dac_shfreg)
103- BEGIN
104- IF(clk'event AND clk='1') THEN
105- IF(reset=YES) THEN
106- dac_shfreg <= (OTHERS=>'0');
107- dac_empty <= YES;
108- ELSIF(chan_sel=YES AND wr=YES) THEN
109- dac_shfreg <= dac_in;
110- ELSIF(chan_on=YES AND subcycle_cntr=2) THEN
111- IF(bit_cntr<DAC_WIDTH-1) THEN
112- dac_empty <= NO;
113- dac_shfreg <= dac_shfreg(DAC_WIDTH-2 DOWNTO 0) & '0';
114- ELSIF(bit_cntr=DAC_WIDTH-1) THEN
115- dac_empty <= YES;
116- dac_shfreg <= dac_shfreg(DAC_WIDTH-2 DOWNTO 0) & '0';
117- END IF;
118- END IF;
119- END IF;
120- END PROCESS;
121-
122- -- output the serial data to the SDIN pin of the codec DAC
123- sdin <= dac_shfreg(DAC_WIDTH-1) WHEN chan_on=YES ELSE '0';
124-
125- -- handle writing of DAC data from codec interface
126- dac_wr_nxt <= YES WHEN (dac_empty=YES AND chan_sel=YES AND wr=YES) OR
127- (dac_empty=YES AND dac_wr=YES)
128- ELSE NO;
129- write_dac:
130- PROCESS(clk,reset,dac_wr_nxt)
131- BEGIN
132- IF(clk'event AND clk='1') THEN
133- IF(reset=YES) THEN
134- dac_wr <= NO;
135- ELSE
136- dac_wr <= dac_wr_nxt;
137- END IF;
138- END IF;
139- END PROCESS;
140- -- DAC is ready if register is empty and hasn't been written yet
141- dac_in_rdy_int <= YES WHEN dac_empty=YES AND dac_wr=NO ELSE NO;
142- dac_in_rdy <= dac_in_rdy_int;
143-
144- -- detect and signal underflow of data to the codec DAC channels
145- detect_dac_underrun:
146- PROCESS(clk,reset,bit_cntr,chan_on,dac_in_rdy_int)
147- BEGIN
148- IF(clk'event AND clk='1') THEN
149- IF(reset=YES) THEN
150- dac_underrun <= NO;
50
151- ELSIF(bit_cntr=1 AND chan_on=YES AND dac_in_rdy_int=YES) THEN
152- dac_underrun <= YES;
153- END IF;
154- END IF;
155- END PROCESS;
156- END channel_arch;
The VHDL code for the top-level module that combines the clock generator module with
two channel modules is detailed in Listing 25. The inputs and outputs of the top-level
module as defined in the entity declaration are as follows:
clk: This is the main clock input, which is typically the 12 MHz clock from the XS Board.
reset: This input synchronously resets the two channel modules and the clock generator.
lrsel: This input selects either the right or left channel for parallel read or write operations.
rd: A high level on this input outputs the value stored in the selected shift register
connected to the ADC.
wr: A high level on this input writes a new value into the selected shift register connected
to the DAC.
ladc_out, radc_out: The bits stored in the left and right ADC shift registers are read out in
parallel through these outputs..
ldac_in, rdac_in: The DAC shift registers are loaded in parallel with bits passed through
these inputs.
ladc_out_rdy, rdac_out_rdy: These outputs go high after all the bits have been shifted
from the codec into the left or right ADC shift register, respectively.
adc_overrun: This output goes high if new serial data is shifted into either the left or right
ADC shift register before the old contents have been read out through the parallel
outputs.
ldac_in_rdy, rdac_in_rdy: These outputs go high after all the bits in the left or right DAC
shift register have been shifted over to the codec, respectively.
dac_underrun: This output goes high if either the left or right DAC shift register starts
shifting data over to the codec before it has been written through the parallel inputs.
mclk: This output is the master clock for the codec chip.
sclk: This output is the clock for synchronizing serial data transfers between the FPLD
and the codec.
lrck: This output controls the activation of the left and right channel circuitry in the codec.
sdin: The serial data stream for the codec DAC is shifted out through this output.
sdout: The serial data stream from the codec ADC is shifted in through this input.
51
Within the main body of the top-level module architecture section, the following modules
are instantiated:
u0: One clock generator module is instantiated. It receives the 12 MHz clock as an input
and generates the master clock, left/right clock, and serial shift clock for the codec. It
also outputs the position of the current bit in the serial stream and the current cycle
within each bit period.
Lines 73—75: The input signals to the codec on the XStend V1.3 Board pass through
inverters. Therefore, the clock signals are inverted on these lines to remove the effect
of the inverters.
u_left: The module, which handles the left channel of the codec, is instantiated. This
module is activated during one half of the left/right clock period. It is selected for
reading or writing by the left/right selection input.
u_right: The module, which handles the right channel of the codec, is instantiated. This
module is activated during the other half of the left/right clock period. It is selected for
reading and writing by the opposite polarity of the left/right selection input.
Lines 133—134: The overrun and underrun error indicators for the total codec interface
are formed by the logical-OR of the associated error outputs of the left and right
channel modules. Thus an error is reported if either channel reports an error.
Line 138: The serial data stream that is transmitted to the codec chip is selected from the
output data stream of the currently-active channel module. The data stream input to
the codec on the XStend V1.3 Board passes through an inverter. Therefore, the data
stream is inverted on this line to remove the effect of the inverter.
• Listing 25: VHDL code for the top-level codec interface module.
52
023- ldac_in: IN std_logic_vector(DAC_WIDTH-1 DOWNTO 0); -- left DAC
024- rdac_in: IN std_logic_vector(DAC_WIDTH-1 DOWNTO 0); -- right DAC
025- ladc_out_rdy: OUT std_logic; -- left ADC output ready to read
026- radc_out_rdy: OUT std_logic; -- right ADC output ready to read
027- adc_overrun: OUT std_logic; -- ADC overwritten before read
028- ldac_in_rdy: OUT std_logic; -- left DAC in ready to be written
029- rdac_in_rdy: OUT std_logic; --right DAC in ready to be written
030- dac_underrun: OUT std_logic; -- DAC did not receive data in time
031- -- codec chip I/O signals
032- mclk: OUT std_logic; -- master clock output to codec
033- sclk: OUT std_logic; -- serial data clock to codec
034- lrck: OUT std_logic; -- left/right codec channel select
035- sdin: OUT std_logic; -- serial output to codec DAC
036- sdout: IN std_logic -- serial input from codec ADC
037- );
038- END codec_intfc;
039-
040- ARCHITECTURE codec_intfc_arch OF codec_intfc IS
041- SIGNAL mclk_int: std_logic; -- internal codec master clock
042- SIGNAL lrck_int: std_logic; -- internal L/R codec channel select
043- SIGNAL sclk_int: std_logic; -- internal codec data shift clock
044- SIGNAL bit_cntr: std_logic_vector(5 DOWNTO 0);
045- SIGNAL subcycle_cntr: std_logic_vector(1 DOWNTO 0);
046- SIGNAL lsdin: std_logic;
047- SIGNAL rsdin: std_logic;
048- SIGNAL ladc_overrun: std_logic;
049- SIGNAL radc_overrun: std_logic;
050- SIGNAL ldac_underrun: std_logic;
051- SIGNAL rdac_underrun: std_logic;
052- SIGNAL lchan_sel: std_logic;
053- SIGNAL rchan_sel: std_logic;
054- SIGNAL lchan_on: std_logic;
055- SIGNAL rchan_on: std_logic;
056- BEGIN
057-
058- u0: clkgen
059- GENERIC MAP
060- (
061- CHANNEL_DURATION=>CHANNEL_DURATION
062- )
063- PORT MAP
064- (
065- clk=>clk,
066- reset=>reset,
067- mclk=>mclk_int,
068- sclk=>sclk_int,
069- lrck=>lrck_int,
070- bit_cntr=>bit_cntr,
071- subcycle_cntr=>subcycle_cntr
072- );
073- lrck <= NOT(lrck_int); -- invert for inverter in XStend V1.3
074- mclk <= NOT(mclk_int);
075- sclk <= NOT(sclk_int);
076-
53
077- lchan_sel <= YES WHEN lrsel=LEFT ELSE NO;
078- lchan_on <= YES WHEN lrck_int=LEFT ELSE NO;
079- u_left: channel
080- GENERIC MAP
081- (
082- DAC_WIDTH=>DAC_WIDTH,
083- ADC_WIDTH=>ADC_WIDTH
084- )
085- PORT MAP
086- (
087- clk=>clk,
088- reset=>reset,
089- chan_on=>lchan_on,
090- bit_cntr=>bit_cntr,
091- subcycle_cntr=>subcycle_cntr,
092- chan_sel=>lchan_sel,
093- rd=>rd,
094- wr=>wr,
095- adc_out=>ladc_out,
096- dac_in=>ldac_in,
097- adc_out_rdy=>ladc_out_rdy,
098- adc_overrun=>ladc_overrun,
099- dac_in_rdy=>ldac_in_rdy,
100- dac_underrun=>ldac_underrun,
101- sdin=>lsdin,
102- sdout=>sdout
103- );
104-
105- rchan_sel <= YES WHEN lrsel=RIGHT ELSE NO;
106- rchan_on <= YES WHEN lrck_int=RIGHT ELSE NO;
107- u_right: channel
108- GENERIC MAP
109- (
110- DAC_WIDTH=>DAC_WIDTH,
111- ADC_WIDTH=>ADC_WIDTH
112- )
113- PORT MAP
114- (
115- clk=>clk,
116- reset=>reset,
117- chan_on=>rchan_on,
118- bit_cntr=>bit_cntr,
119- subcycle_cntr=>subcycle_cntr,
120- chan_sel=>rchan_sel,
121- rd=>rd,
122- wr=>wr,
123- adc_out=>radc_out,
124- dac_in=>rdac_in,
125- adc_out_rdy=>radc_out_rdy,
126- adc_overrun=>radc_overrun,
127- dac_in_rdy=>rdac_in_rdy,
128- dac_underrun=>rdac_underrun,
129- sdin=>rsdin,
130- sdout=>sdout
54
131- );
132-
133- dac_underrun <= YES WHEN ldac_underrun=YES OR rdac_underrun=YES
134- ELSE NO;
135- adc_overrun <= YES WHEN ladc_overrun=YES OR radc_overrun=YES
136- ELSE NO;
137-
138- -- generates the serial data output to the SDIN pin of the
139- -- codec DAC depending on which channel is being loaded
140- sdin <= NOT(lsdin) WHEN lrck_int=LEFT ELSE NOT(rsdin);
141-
142- END codec_intfc_arch;
The interfaces to these three modules are placed into the package shown in Listing 26.
(The I/O declarations in the COMPONENT constructs have been removed for the sake of
brevity.) The declarations for the constants used in these modules are also included in the
package.
55
034- END COMPONENT;
035-
036- COMPONENT codec_intfc
037- GENERIC
038- (
039- ...
040- );
041- PORT
042- (
043- ...
044- );
045- END COMPONENT;
046- END PACKAGE;
Once the codec interface module is completed and packaged, we can use it in an
application. The simplest use is to have the FPLD accept the left and right stereo inputs
from the codec ADCs and loop these back to the codec DACs so they can output the
stereo signals.
The VHDL code for the loopback application is detailed in Listing 27. The inputs and
outputs of the loopback design are as follows:
reset: A high level on this input synchronously resets the codec interface module. The
reset input is driven from the parallel port of the PC.
mclk: This output is the master clock for the codec chip.
lrck: This output controls the activation of the left and right channel circuitry in the codec
and the codec interface.
sclk: This output is the clock for synchronizing serial data transfers between the FPLD
and the codec.
sdout: The serial data stream from the codec ADCs are shifted in through this input.
sdin: The serial data stream for the codec DACs are shifted out through this output.
The following modules and processes are placed within the main body of the loopback
application:
u0: This is the instantiation of the codec interface module. Note that the ADC output
buses of this module are connected back to the DAC input buses on lines 43—46.
loop: This process controls the reading of each ADC and the writing of the value back to
the associated DAC. For example, if the output of the left channel ADC is ready to be
read and the left channel DAC is ready to be written, then the left channel is selected
and the read and write control lines are asserted. This reads the data from the ADC
shift register and writes it into the DAC shift register during a single clock cycle. Then
the ADC and DAC registers will no longer be ready for reading or writing so the read
and write signals will be deasserted.
56
• Listing 27: VHDL code for a design that uses the codec interface module to do loopback.
57
053- );
054-
055- loop: PROCESS(ldac_in_rdy,ladc_out_rdy,rdac_in_rdy,radc_out_rdy)
056- BEGIN
057- IF(ladc_out_rdy=yes AND ldac_in_rdy=yes) THEN
058- lrsel<=left; -- loopback the left channel
059- rd<=yes; -- assert the read and
060- wr<=yes; -- write control signals
061- ELSIF(radc_out_rdy=yes AND rdac_in_rdy=yes) THEN
062- lrsel<=right; -- loopback the right channel
063- rd<=yes; -- assert the read and
064- wr<=yes; -- write control signals
065- ELSE
066- lrsel<=left; -- default channel selection
067- rd<=no; -- but don’t read or
068- wr<=no; -- write the registers
069- END IF;
070- END PROCESS;
071- END loopback_arch;
• Listing 28: XS40 UCF file for the stereo signal loopback application.
• Listing 29: XS95 UCF file for the stereo signal loopback application.
The steps for compiling and testing the design using an XS40 combined with an XStend
Board are as follows:
2. Compile the synthesized netlist using the LOOP40.UCF constraint file (Listing
28).
58
3. Mount an XS40 Board in the XStend Board and attach the downloading cable
from the XS40 to the PC parallel port. Apply 9VDC though jack J9 of the XS40.
Remove the shunts from jumpers J4, J7, and J8 to disable the LEDs. Place a
shunt on jumper J17 so the codec serial output data stream can reach the FPLD.
Set all the DIP switches to the OPEN position.
4. Connect a stereo audio source (such as a CD player) to jack J9. Then plug a set
of stereo mini-headphones into jack J10.
5. Download the LOOP40.BIT file into the XS40/XStend combination with the
command: XSLOAD LOOP40.BIT.
6. Release the reset on the loopback circuit with the command XSPORT 0.
7. Start the CD player and listen to the result with the headphones.
The steps for compiling and testing the design using an XS95 combined with an XStend
Board are as follows:
2. Compile the synthesized netlist using the LOOP95.UCF constraint file (Listing
29).
4. Mount an XS95 Board in the XStend Board and attach the downloading cable
from the XS95 to the PC parallel port. Apply 9VDC though jack J9 of the XS95.
Remove the shunts from jumpers J4, J7, and J8 to disable the LEDs. Place a
shunt on jumper J17 so the codec serial output data stream can reach the FPLD.
Set all the DIP switches to the OPEN position.
5. Connect a stereo audio source (such as a CD player) to jack J9. Then plug a set
of stereo mini-headphones into jack J10.
6. Download the LOOP95.BIT file into the XS95/XStend combination with the
command: XSLOAD LOOP95.BIT.
7. Release the reset on the loopback circuit with the command XSPORT 0.
8. Start the CD player and listen to the result with the headphones.
59
Appendix
A
XStend Schematics
xst1_3_2.sch-1 - Mon Nov 6 17:09:31 2000
xst1_3_2.sch-2 - Mon Nov 6 17:09:32 2000
xst1_3_2.sch-3 - Mon Nov 6 17:09:33 2000
xst1_3_2.sch-4 - Mon Nov 6 17:09:34 2000
xst1_3_2.sch-5 - Mon Nov 6 17:09:35 2000
Documento seguro incrustado
El archivo http://www.dacya.ucm.es/mendias/143/docs/xstv20.pdf es un documento seguro que se ha incrustado en este
documento. Haga doble clic en el pin para visualizar.
XSV Virtex Prototyping Board
XSV The XSV Board brings you the power of the XILINX Virtex FPGA embedded in a
framework for processing video and audio signals. The XSV Board accepts Virtex
FPGAs from 50K to 800K gates in size. The XSV can accept PAL, SECAM, or NTSC
● XCV50-XCV800
video with up to 9-bits of resolution on the red, green, and blue channels and can output
Virtex FPGA
video images through a 110 MHz, 24-bit RAMDAC. The XSV can also process stereo
● XC95108 CPLD
audio signals with up to 20 bits of resolution and a bandwidth of 50 KHz. Two
● Two 512K x 16
independent banks of 512K x 16 SRAM are provided for local buffering of signals and
SRAM banks
data.
● PAL/SECAM/NTSC
video decoder
● 110 MHz RAMDAC The XSV Board has a variety of interfaces for communicating with the outside world:
● 10/100 Ethernet PHY parallel and serial ports, Xchecker cable, USB port, PS/2 mouse and keyboard port, and
● 16 Mbit Flash RAM 10/100 Ethernet PHY layer interface. There are also two independent expansion ports,
● 100 MHz each with 38 general purpose I/O pins connected directly to the FPGA.
programmable
oscillator You configure the XSV Board through a PC parallel port, serial port, or from a bitstream
● Two expansion stored in the 16 Mbit Flash RAM. The Flash RAM can also store data for use by the
connectors each with FPGA after configuration is complete.
38 general-purpose
I/O
● Four pushbuttons
● DIP switch
● Two LED digits
● LED bargraph
● 20-bit stereo codec
● stereo in/out ports
● VGA monitor port
● mouse/keyboard PS/2
port
● USB port (host or
hub)
● Parallel/serial port
connectors
● ATX power input or
9 VDC power jack
2608 Sweetgum Drive
Apex NC 27502
Toll-free: 800-549-9377
International: 919-387-0076
FAX: 919-387-1302
;69%RDUG90DQXDO
All rights reserved. No part of this publication may be reproduced, stored in a retrieval
system, or transmitted, in any form or by any means, electronic, mechanical,
photocopying, recording, or otherwise, without the prior written permission of the publisher.
Printed in the United States of America.
/LPLWHG :DUUDQW\
X Engineering Software Systems Corp. (XESS) warrants that the Product, in the course of
its normal use, will be free from defects in material and workmanship for a period of one
(1) year and will conform to XESS’s specification therefor. This limited warranty shall
commence on the date appearing on your purchase receipt.
XESS shall have no liability for any Product returned if XESS determines that the asserted
defect a) is not present, b) cannot reasonably be rectified because of damage occurring
before XESS receives the Product, or c) is attributable to misuse, improper installation,
alteration, accident or mishandling while in your possession. Subject to the limitations
specified above, your sole and exclusive warranty shall be, during the period of warranty
specified above and at XESS’s option, the repair or replacement of the product. The
foregoing warranty of XESS shall extend to repaired or replaced Products for the balance
of the applicable period of the original warranty or thirty (30) days from the date of
shipment of a repaired or replaced Product, whichever is longer.
In the United States, some statutes do not allow exclusion or limitations of incidental or
consequential damages, so the limitations above may not apply to you. This warranty
gives you specific legal rights, and you may also have other rights which vary from state to
state.
Preliminaries................................................................................................... 4
Getting Help!............................................................................................ 4
Installation ...................................................................................................... 8
Applying Power........................................................................................ 8
Connecting to a PC.................................................................................. 9
Video Decoder....................................................................................... 17
Stereo Codec......................................................................................... 20
Ethernet PHY......................................................................................... 20
USB Port................................................................................................ 29
XSV Schematics........................................................................................... 34
3UHOLPLQDULHV
*HWWLQJ +HOS
If you follow the instructions in this manual and you encounter problems, here are some
places to get help:
If you can't get the XSV Board hardware to work, send an e-mail message describing
your problem to bugs@xess.com or check our web site at http://www.xess.com.
If you can't get your XILINX software tools installed properly, send an e-mail message
describing your problem to hotline@xilinx.com or check their web site at
http://support.xilinx.com.
3DFNLQJ /LVW
an XSV Board;
The XSV Board has a variety of interfaces for communicating with the outside world:
parallel and serial ports, Xchecker cable, a USB port, PS/2 mouse and keyboard port, and
10/100 Ethernet PHY layer interface. There are also two independent expansion ports,
each with 38 general-purpose I/O pins connected directly to the Virtex FPGA.
You can configure the XSV Board through a PC parallel port, serial port, Xchecker cable
or from a bitstream stored in the 16 Mbit Flash RAM. The Flash RAM can also store data
for use by the FPGA after configuration is complete.
XILINX Virtex FPGA: Virtex FPGAs from 57 Kgates (XCV50) up to 888 Kgates
(XCV800) in a 240-pin PQFP or HQFP package are compatible with the XSV
Board. The Virtex FPGA is the main repository of programmable logic on the
XSV Board.
XILINX XC95108 CPLD: The CPLD is used to manage the configuration of the
Virtex FPGA via the parallel port, serial port, or Flash RAM. The CPLD also
controls the configuration of the Ethernet PHY chip.
Programmable oscillator that provides a clock signal to the FPGA and CPLD derived
form a 100 MHz base frequency.
16 Mbit Flash RAM that can store multiple configurations or general-purpose data for
the FPGA.
Two independent 512K x 16 SRAM banks used by the FPGA for general-purpose
data storage.
RAMDAC with a 256-entry, 24-bit colormap that is used by the FPGA to output video
to a VGA monitor.
Stereo codec that lets the FPGA digitize and generate 0-50 KHz audio signals with up
to 20 bits of resolution.
Two expansion headers interface the FPGA to external circuitry through 76 general-
purpose I/Os.
Four pushbuttons and one eight-position DIP switch provide general-purpose inputs to
the FPGA and CPLD.
Two LED digits and one LED bargraph let the FPGA and CPLD display status
information.
Mouse/keyboard PS/2 port gives the FPGA access to common PC input devices.
Single USB port provides the FPGA with a serial I/O channel with bandwidths of 1.5 to
12 Mbps.
Parallel/serial port interfaces let the CPLD send and receive data in a parallel or serial
format similar to a PC.
ATX power connector or 9 VDC power jack lets the XSV Board receive power from a
standard ATX power supply or a 9 VDC power supply.
The location of these resources are indicated in the simplified view of the XSV Board
shown below. Each of these resources will be described in the following section.
DIP S w.
ATX Pow er
Connector
Xchecker
X C 9 5 1 08
CPLD 16 M bit Flash
E xpansion Connector
E xpansion Connector
512K x 8 512K x 8
SRA M Virtex FPG A SRA M
(XCV 50-800)
512K x 8 512K x 8
SRA M SRA M
Pushbuttons
Ether
Phy RAM
DAC
If you are running Windows NT™, then you must also install the parallel port driver using
the port95nt.exe installation script on the CDROM.
$SSO\LQJ 3RZHU
You can supply the XSV Board with power in two ways:
2. Attach a 9 VDC power supply with a 2.1mm, center-positive plug to jack J12. The
power supply must be able to source at least 1.5 A. Place shunts on jumpers J13 and
J14. Place a shunt on pins 1 and 2 of jumper J32.
operation of the hardware. You start GXSTEST by clicking on the icon placed
on the desktop during the XSVTOOLs installation. This brings up the screen shown
below.
Your next step is to select the parallel port that your XS Board is connected to from the
port pulldown list. GXSTEST starts with parallel port LPT1 as the default, but you can also
select LPT2 or LPT3 depending upon the configuration of your PC.
After selecting the parallel port, you select the type of XSV Board you are testing from the
associated pulldown list. Then click on the TEST button to start the testing procedure.
GXSTEST will program the CPLD on the XSV Board and then use it to program the Virtex
FPGA witha test circuit. Status messages will be printed at the bottom of the GXSTEST
window as the testing proceeds. At the end of the test, you will receive a message
informing you whether your XSV Board passed the test or not.
The divisor is set with the GXSSETCLK software utility. You start GXSSETCLK by clicking
on the icon placed on the desktop during the XSVTOOLs installation. This
brings up the screen shown below.
Next you must enter a divisor between 1 and 2052 into the text box. Once programmed,
the oscillator will output a clock signal generated by dividing its 100 MHz master frequency
by the divisor. The divisor is stored in non-volatile storage in the oscillator chip so you only
need to use GXSSETCLK when you want to change the frequency.
The external clock checkbox is inactive for the XSV Board because no external clock is
connected to the programmable oscillator chip.
Clicking on the SET button will start the oscillator programming procedure. Status
messages will be printed at the bottom of the GXSSETCLK window as the programming
proceeds. You will also receive instructions on how to set the shunts on the XSV Board
jumpers to place the oscillator into its programming mode. At the end of the programming,
you will receive a message informing you that your XSV Board clock has been set.
Note that GXSSETCLK reprograms the CPLD on the XSV Board in order to access the
programmable oscillator. So you will need to reprogram the CPLD with a parallel port
interface circuit if you want to program the FPGA. (See the next section for details on
this.)
The CPLD is enabled for configuration by placing a shunt on jumper J23. The CPLD is
configured with an interface by using the GXSLOAD software utility. You start GXSLOAD
by clicking on the icon placed on the desktop during the XSVTOOLs installation.
This brings up the screen shown below.
After setting the parallel port, you can download an .SVF file to the CPLD on the XSV
Board simply by dragging it to the GXSLOAD window. To program the CPLD with the
parallel port interface, drag the dwnldpar.svf file from the XSTOOLS\BIN directory. Once
you release the mouse left-button and drop the file, GXSLOAD will begin sending it to the
XSV Board through the parallel port connection. During the process, GXSLOAD will
display the name of the file currently being downloaded.
Once the CPLD is programmed with the parallel port interface circuit, you can remove the
shunt from jumper J23 to prevent accidental reprogramming of the CPLD.
Once the downloading is finished, the .BIT file name is added to the Recent Files window
and the Reload button is enabled. You can download the file to the XSV Board again just
by clicking on the Reload button.
Your XSV Board is now configured with the circuit in your .BIT file.
Now the Virtex FPGA will be loaded with the circuit you stored in the Flash whenever
power is applied to the XSV Board. You will have to reprogram the CPLD with the
dwnldpar.svf file if you want to reconfigure the FPGA with a .BIT file using the parallel port.
The .EXO file is generated using the Programmer tool in Foundation. The configuration
data should start at address 0 and extend upward to higher addresses.
A XILINX Virtex FPGA in a 240-pin QFP package. Virtex FPGAs from 57 Kgates
(XCV50) up to 888 Kgates (XCV800) are compatible with the XSV Board. The Virtex
FPGA is the main repository of programmable logic on the XSV Board.
A XILINX XC95108 CPLD that is used to manage the configuration of the Virtex
FPGA via the parallel port, serial port, or Flash RAM. The CPLD also controls the
configuration of the Ethernet PHY chip.
To get a precise frequency value or to sync the XSV circuitry with an external system, you
can insert an external clock signal through pin 1 of connector J27 and place a shunt
across pins 2 and 3 of jumper J36. This external clock replaces the output from the
DS1075 oscillator.
100 M H z
Prog. O sc.
1
J3 6
DS1075
2
3
22 89 1
External
J2 7 C lock
XC95108 Virte x
CPLD FPGA
re se t
ce
oe
XC95108 we
rd y
1 6 M b it
CPLD 8 F lash R A M
d 0 -7
a 0 -2 0
21
Virte x
FPGA
The CPLD and FPGA both have access to the Flash RAM. Typically, the CPLD will
program the Flash with data passed through the parallel or serial port. If the data is an
FPGA configuration bitstream then the CPLD can be configured to program the FPGA
with the Flash bitstream whenever the XSV Board is powered up. After power-up, the
FPGA can read and/or write the Flash. (Of course, the CPLD and FPGA have to be
programmed such that they do not conflict if both are trying to access the Flash.) The
Flash can be disabled by raising the /CE pin to Vcc in which case the I/O lines connected
to the Flash can be used for general-purpose communication between the FPGA and the
CPLD.
The pins of the FPGA and CPLD connected to the Flash RAM are listed below:
8 8
d 0 - 7
d 0 - 7
4 M b it ce
oe
ce
oe
4 M b it
SR AM we we SR AM
a 0 - 1 8
19 19 a 0 - 1 8
Virte x
FPGA
a 0 - 1 8
a 0 - 1 8
4 M b it ce
oe
ce 4 M b it
oe
SR AM we we SR AM
8 8
d 0 - 7
d 0 - 7
9LGHR 'HFRGHU
The XSV Board can digitize NTSC, SECAM, and PAL video signals using the SAA7113
video decoder (http://www-us.semiconductors.philips.com/pip/SAA7113H). The digitized
video arrives at the FPGA over the VPO bus. The arrival of video data is synchronized
with the rising edge of the LLC (line-locked clock) from the video decoder. The FPGA
2
programs the video options of the SAA7113 using the I C bus (SCL and SDA).
8
vpo 0 - 7
lu m a S -V id eo
rts0 a i11 C o nn ecto r
S A A 7 11 3 a i12 c hrom a (J8)
Virte x rts1
FPGA
rtco Vide o
llc a i21
scl D e co d er a i22 c vbs
R C A Ja ck
sda (J9)
6$$ 9LUWH[
3LQ )3*$ 3LQ
LLC 92
RTS0 111
RTS1 110
vsyn c
h sync
p 5
p 4
p 3
p 2
p
p
1
0
r 0
r 1
g 0
g 1
b 0
b 1
VGA
C o nn ecto r
(J4)
8
p 0 - 7
J5 re d
b lan k re d
p ixelclk
Virte x B T 4 8 1A g ree n
J6 g ree n
rd
FPGA wr RAM DAC
rs J7 b lue
0 - 2
b lue
d
8 0 - 7
When the FPGA is directly generating VGA signals, the lower six bits of the P bus provide
two-bits of red, green, and blue color information to a simple resistor-ladder DAC. The
outputs of the DAC are sent to a VGA monitor along with the horizontal and vertical sync
pulses (/HSYNC, /VSYNC) from the FPGA.
When the RAMDAC generates the VGA color signals, then the FPGA uses the full eight-
bit P bus to pass the index of the color for the current pixel. The index is used to lookup
the 24-bit color value (eight bits for the red, green, and blue components) stored in the
The colormap of the RAMDAC is initialized by the FPGA using the D bus along with the
RS, /WR, and /RD signals. The 24-bit colormap entries are passed in groups of three
bytes over the eight-bit D bus synchronized by the /WR signal. The register-select signals
(RS0, RS1, RS2) select the staging register for writing the colormap. The contents of the
staging register are written into the colormap after the last byte of color information arrives
over the D bus, and then the internal colormap address is incremented to point to the next
entry.
The shunt placement to enable the FPGA to generate VGA signals directly or through the
RAMDAC is shown below.
J7 J6 J5 J7 J6 J5
Direct VG A RAM DAC
Shunt Setting Shunt Setting
The pin assignments for the connection of the FPGA to the VGA signal generation circuitry
are shown below. Note that the FPGA shares some connections between the RAMDAC
and the chip which interfaces to the Ethernet (LXT970A). The RAMDAC pins are used to
load the colormap and should not be active except during system initialization. The other
connections are used for Ethernet data transmission and reception and are usually only
active after system initialization.
6WHUHR &RGHF
The XSV Board has an AK4520A stereo codec
(http://www.akm.com/ProductPages/ak4520a.html) that accepts two analog input
channels from jack J1, digitizes the analog values, and sends the digital values to the
FPGA as a serial bit stream. The codec also accepts a serial bit stream from the XS
Board and converts it into two analog output signals, which exit the XSV Board through
jack J2. The serial bit streams are synchronized with a clock from the FPGA that enters
the codec on SCLK signal. The FPGA uses the LRCK signal to select the left or right
channel as the source/destination of the serial data. The master clock from the FPGA
m clk in S tere o Ja ck
le ft
lrck in (J1)
Virte x sclk
A K 4 52 0 A r ig h t
FPGA sdin
Codec o ut le f t S tere o Ja ck
Am p
o ut (J2)
sdo ut rig h t
6WHUHR 9LUWH[
&RGHF 3LQ )3*$ 3LQ
MCLK 3
LRCK 4
SCLK 5
SDIN 6
SDOUT 7
(WKHUQHW 3+<
The XSV Board interfaces to an Ethernet LAN at 10 or 100 Mbps. The LXT970A Ethernet
PHY chip (http://128.11.21.45/scripts/mardev/product/lxt970.asp ) connects to both the
tx_e rr
tx_clk
tx_e n
4
txd 0 - 4
rx_e r
tp op
tra n sfo rm e r
rx_clk
Virte x rx_d v
tp on R J45
4 C o nn ecto r
FPGA rxd 0 - 4
tp ip (J3)
col
crs tp in
trste
fd s/m dint
L X T 9 70 A
m dio E th e rne t
m dc PH Y
4 mf 0 -4
2 cfg 0 - 1
m dd is
fd e
re se t
X C 95 1 0 8 p w rdw n
C P LD le d s
le d r
le d t
le d l
le d c
The FPGA enables the transmitter with TX_EN and sends bits on TXD4-0 in sync with the
transmit clock (TX_CLK) generated by the PHY chip. The PHY chip is alerted to
transmission errors that occur in the MAC when the TX_ERR signal is asserted. The
FPGA also receives an indication when valid data has been received (RX_DV) and the
data (RXD0-4) in sync with the receiver clock (RX_CLK) from the PHY chip. Any reception
errors are indicated to the FPGA via the RX_ER signal. The CRS signal indicates when
the receiver is non-idle. The COL signal is asserted when data collides on the Ethernet.
The FPGA can disable the interface to the PHY chip by asserting the tristate control
(TRSTE). Otherwise, the FPGA passes management information to and from the PHY
chip over the serial data line (MDIO) in sync with a clock (MDC). the FPGA can be alerted
to changes in PHY chip status by the FDS/MDINT interrupt line.
The CPLD sets the static values on pins which control the configuration of the PHY chip.
Pins MF0-4 set the modes for auto-negotiation, repeating, symbol transmission,
scrambling, etc. Likewise, the configurations signals (CFG0-1) select the 10 Mbps or 100
Mbps operating speed of the PHY chip. MDDIS enables/disables the management
information interface. FDE selects either full-duplex or half-duplex communication mode.
The reset (/RESET) and power-down (PWRDWN) signals do exactly what they say.
The connections of the PHY chip to the FPGA and CPLD are listed below. Note that the
FPGA shares some connections between the PHY chip and the RAMDAC. The
RAMDAC pins are used to load the colormap and should not be active except during
system initialization. The PHY connections are used for data transmission and reception
and are usually only active after system initialization.
([SDQVLRQ +HDGHUV
The XSV Board has two 50-pin headers (J25 and J26) which connect the FPGA to
external systems. The arrangement of the headers is shown below:
J2 6
1
50
49
Virte x
FPGA
U18
49
50
1
2
J2 5
The connections between the FPGA and the expansion headers are listed below. The
FPGA pins which connect to the left and right expansion headers are also connected to
the left and right banks of SRAM, respectively. The SRAM bank chip-enable should be
raised to disable the SRAMs on that side if the associated expansion header is being used
for external I/O.
The XSV Board has a bank of eight DIP switches and four pushbuttons that are
accessible from the FPGA. The CPLD is also connected to the DIP switches and one of
the pushbuttons. When pressed, each pushbutton pulls the connected pin of the FPGA
and CPLD to ground. Otherwise, the pin is pulled high through a resistor. Likewise, each
DIP switch pulls the connected pin of the FPGA or CPLD to ground when it is closed or
ON. When the DIP switch is open or OFF, the pin is pulled high through a resistor.
:KHQ QRW EHLQJ XVHG WKH ',3 VZLWFKHV VKRXOG EH OHIW LQ WKH RSHQ RU 2))
FRQILJXUDWLRQ VR WKH SLQV RI WKH )3*$ DQG &3/' DUH QRW WLHG WR JURXQG DQG FDQ
IUHHO\ PRYH EHWZHHQ ORJLF ORZ DQG KLJK OHYHOV
D IP
S w itch
(S W 6 )
SW 4
SW 3
SW 2
SW 1
X C 95 1 0 8 Virte x
C P LD FPGA
The table below lists the connections from the FPGA and CPLD to the switches. The DIP
switches also share the same pins as the uppermost eight bits of the Flash RAM address
bus. If the Flash RAM is programmed with several FPGA bitstreams, then the DIP switch
can be used to select a particular bitstreams which will be loaded into the FPGA by the
CPLD on power-up.
The table below lists the connections from the FPGA and CPLD to the LEDs. The LEDs
also share the same pins as the uppermost eight bits of the Flash RAM address bus. If
the Flash RAM is programmed with several FPGA bitstreams, then the DIP switch can be
used to select a particular bitstreams which will be loaded into the FPGA by the CPLD.
S6
S5 S4
S2 S3 S1
S0
S6
S5 S4
S2 S3 S1
S0
7 7 10 7 7 10
XC95108 Virte x
CPLD FPGA
SL3 156 35 D3
SL4 145 36 D4
SL5 138 37 D5
SL6 134 39 D6
Right Digit
SR2 133 17 A1
SR3 139 18 A2
SR4 141 19 A3
SR5 144 20 A4
SR6 147 23 A5
B0 152 24 A6
B1 154 25 A7
B2 157 27 A8
B3 160 28 A9
Bargraph
B4 162 29 A10
B5 169 30 A11
B6 168 49 A12
B7 173 42 /OE
B8 131 43 /WE
B9 171 41 RDY
36 3RUW
The XSV Board provides a PS/2-style interface (mini-DIN connector J20) to either a
keyboard or a mouse. The FPGA receives two signals from the PS/2 interface: a clock
signal and a serial data stream that is synchronized with the falling edges on the clock
signal.
clk P S /2
Virte x C o nn ecto r
d ata
FPGA (J20 )
The following table shows the connections from the FPGA to the PS/2 interface.
CLK 13
DATA 17
The XSV Board has a USB interface (J35) that can be connected to a variety of high-
speed or low-speed USB peripherals. The FPGA interfaces to the two differential data
signals from the USB port through a PDIUSBP11A USB interface chip (http://www-
us.semiconductors.philips.com/pip/PDIUSBP11A_2).
J1 6
J1 8
P D IU S B P 11A lo w
1 3
h igh V
/O E c c
h igh 2 lo w
spe ed spe ed J1 9
The USB port is set to high (12 Mbps) or low speed (1.5 Mbps) by shunts on jumpers J18
and J37. A 15K load can be placed on the D+ and D- USB signals by placing shunts
across jumpers J33 and J34. If the USB peripheral connected to the port needs to draw
power from the XSV Board, then a shunt should be placed on jumper J16.
The connections of the FPGA to the USB interface chip are listed below. Note that the
FPGA shares some of its pins between the USB interface, the PS/2 interface and one
pushbutton switch.
RCV 11
VP 10
VM 9
Four of the parallel port lines also connect to the JTAG pins through which the CPLD is
programmed. The TCK signal clocks configuration data in through the TDI pin while the
TMS signal steers the actions of the programming state machine. The TDO pin outputs
information back through the parallel port. Removing the shunt from jumper J23 isolates
the TCK pin from the parallel port so the CPLD will not be inadvertently reprogrammed
during routine parallel port operations. The series resistor prevents the TDO output from
interfering with the general-purpose I/O pin during routine parallel port operations.
The CPLD can be programmed to act as an interface between the FPGA and the parallel
port (the dwnldpar.svf file is an example of such an interface). Schmitt-trigger inverters
can be inserted into the d0, d1, and c1 signal lines by placing shunts on pins 2 and 3 of
jumpers J29, J30, and J31, respectively. Along with the parallel port interface circuitry in
the CPLD, these inverters make the XSV Board compatible with the GXSPORT and
GXSLOAD software utilities. If your application requires direct access to these signal
lines, then you can move the shunts on one or more of these jumpers to pins 1 and 2. But
GXSLOAD will no longer work if you remove the inverter from the c1 signal line.
3
J2 9 d 0
2
1
3
J3 0 d 1
2
1
d 2
d 3
d 4
d 5 P a ralle l P ort
d 6
C o nn ecto r
d
s
7
3
(J10 )
s 4
s 5
s 6
XC95108 s 7
c 0
CPLD 3
J3 1 c 1
2
1
c 2
c 3
td i J2 3
tm s
tck
td o
The table below lists the connections from the parallel port to the general-purpose I/O pins
of the CPLD:
3DUDOOHO ;&
3RUW 3LQ &3/' 3LQ
6HULDO 3RUW
The CPLD handles the interface to the serial port. The four active lines of the serial port
connect to general-purpose I/O pins on the CPLD as follows.
M AX232A
rd
rts
le vel
shifte rs
3RZHU &RQQHFWRUV
A standard ATX PC power supply can be connected to the XSV Board through connector
J11. The connector is keyed so power cannot be applied with the wrong polarity. The
shunts should be removed from jumpers J13 and J14 to prevent the 9 VDC converter
circuitry from interfering with the ATX power supply. We recommend using the ATX
power supply due to its stability and power capacity.
The XSV Board can also be powered from a 9 VDC power supply through jack J12. The
power supply must have a 2.1mm, center-positive plug. Two voltage regulators will
generate the 5V and 3.3V voltages for the other XSV Board components. Shunts should
be placed on jumpers J13 and J14 to connect the outputs from the voltage regulators to
the rest of the XSV Board. We do not recommend the 9 VDC power input for general use!
The 2.5V for the Virtex FPGA core logic can be generated on the XSV Board or supplied
from an external source. Placing a shunt across pins 1 and 2 of jumper J32 will use the
on-board regulator to generate the 2.5V from the 5V supply. You can inject 2.5V from an
external source by attaching the positive terminal to pin 2 of jumper J32 and ground to pin
3.
XSTE5 The XSTE5 CSoC Board is perfect for experimenting with hardware/software
codesigns based on the Triscend TE505 Configurable System on a Chip (CSoC).
The TE505 CSoC combines an 8032 microcontroller core with 512 cells of
● Triscend TE505 CSoC
configurable system logic (CSL). You customize the CSL with a variety of soft
● 128 KByte SRAM
modules that act as peripherals for the 8032 while it executes your application
● 128 KByte Flash
code. The Triscend FastChip software helps you integrate 8032 application code
● 100 MHz programmable
from a variety of third-party development tools with Triscend's library of soft
oscillator
modules. Or you can build your own modules using Orcad or other tools which
● Parallel port
output an EDIF netlist.
● mouse/keyboard PS/2
port
● VGA monitor port
● 7-segment LED
● 8 position DIP switch
● 84-pin breadboard
interface
● 9V DC power jack
● 5V/3.3V regulators
● Downloading cable
● 9V DC power supply
The XSTE5 Board provides additional circuitry that speeds your development
process. Just connect the XSTE5 Board to the parallel port of a PC and you can
download your application code and soft modules to the TE505 CSoC directly from
the FastChip environment. Or you can store your design in the 128 KByte Flash
so it starts running whenever power is applied to the board. An additional 128
KBytes of SRAM is provided for running larger applications or for general-purpose
data storage. The programmable 100 MHz oscillator lets you select just the right
speed that balances your design's performance against its power consumption.
The TE505 CSoC will be used in a wide variety of systems and applications. The
XSTE5 Board makes it easy to connect to external systems through an 84-pin
breadboard interface that gives you access to all the general-purpose I/O of the
CSoC. The TE505 operates at 3.3V but is 5V-tolerant so you can connect it to a
wide variety of chips. The on-board regulators of the XSTE5 Board generate all
the voltages you need from a single 9V DC power input.
Documento seguro incrustado
El archivo http://www.dacya.ucm.es/mendias/143/docs/xste5v10.pdf es un documento seguro que se ha incrustado en este
documento. Haga doble clic en el pin para visualizar.
APS-V240 VIRTEX PC104 FPGA
DEVELOPMENT BOARD & KITS
Available with FPGA Devlopment Software and boilerplates
Powered By:
APS-V240-REVB_DATASHEET 02-1-2000_____ _________________________________ __1
Applications:
Dimensions: v Embedded Programmable Logic Board
3.8 x 3.6 x .6" (PC104 Stackable !) v Algorithm Testing
v Rapid Development Module
v Reconfigurable Processor
Features: v Custom DSP processing
ü 240 pin QFP FPGA
ü 3.3v IO/TTL compliant operation (3.3v on board reg.) The APS-V240 board can be ordered with the following
ü 2.5v core VIRTEX XCV50 to XCV800 or (2.5v reg.) FPGAs:
ü 256K x 18 ZBT SRAM OPTION
ü 1 9572XL CPLD in JTAG chain Virtex System Block Ram
ü XILINX 1800 series JTAG chained in circuit FPGA Gates Bytes
programmable EPROM's means FPGA configuration XCV50 57,906 4,096
is non-volatile. Eproms programmed right on board XCV100 108,904 5,120
using low cost Parallel Cable or JTAG port cable.
XCV150 164,674 6,144
ü Xchecker/JTAG Cable Port
XCV200 236,666 7,168
ü Real Time Programmable Direct Digital Synthesized
Clock module option (.5-30 MHz) (to 120Mhz w PLL) XCV300 322,970 8,192
ü On board Phase Lock Loop clock multiplier chip. XCV400 468,252 10,240
ü PC104 DMA / IRQ / IORW / MEMRW XCV600 661,111 12,288
ü 3 Oscillator Sockets XCV800 888,439 14,336
ü Up to 888,439 system gates (XCV800)
ü 166 available IO pins (-45 Sram, -50 ISA) Options:
ü Configured from Bus, Eprom, JTAG Cable Ø Real time programmable Direct Digital Synthesis
ü On Board 2 channel RS232 transceiver Clock (.5-30 MHz)
ü Wall transformer option ( to 120MHz using provided PLL chip )
ü ISA carrier board option Ø 256Kby 18 ZBT SRAM
ü RS-232 Transceiver and Com port connector with Ø PC104 to ISA Carrier Board
VHDL UART example included. Ø In-circuit programmable JTAG FPGA eprom
ü Stackable PC104 (ISA) format Ø 2.4 Amp Wall transformer
____________________________________________________________________________________________________________1
© Associated Professional Systems (APS) URL: http://www.associatedpro.com
3003 Latrobe Court Abingdon, MD 21009 USA email: X240@associatedpro.com
Voice: 410.569.5897 Fax: 888.709.8707
APS-V240 VIRTEX PC104 FPGA
DEVELOPMENT BOARD & KITS
Available with FPGA Devlopment Software and boilerplates
Powered By:
APS-V240-REVB_DATASHEET 02-1-2000_____ _________________________________ __2
PRODUCT Price
APS-V240-XCV50 $575.00
APS-V240-XCV100 $630.00
APS-V240-XCV150 $670.00
APS-V240-XCV200 $710.00
APS-V240-XCV300 $790.00
APS-V240-XCV400 $900.00
APS-V240-XCV600 $1100.00
APS-V240-XCV800 $1400.00
OPTION: Direct Digital Synthesis Clock $99.00
(.5-30 MHz)
OPTION: 256Kby 18 ZBT SRAM Option $ 80.00
OPTION: PC104 to ISA Carrier Board $150.00
OPTION: 2.4 Amp Wall transformer $40.00
____________________________________________________________________________________________________________2
© Associated Professional Systems (APS) URL: http://www.associatedpro.com
3003 Latrobe Court Abingdon, MD 21009 USA email: X240@associatedpro.com
Voice: 410.569.5897 Fax: 888.709.8707
APS-V240 VIRTEX PC104 FPGA
DEVELOPMENT BOARD & KITS
Available with FPGA Devlopment Software and boilerplates
Powered By:
APS-V240-REVB_DATASHEET 02-1-2000_____ _________________________________ __3
____________________________________________________________________________________________________________3
© Associated Professional Systems (APS) URL: http://www.associatedpro.com
3003 Latrobe Court Abingdon, MD 21009 USA email: X240@associatedpro.com
Voice: 410.569.5897 Fax: 888.709.8707
APS-V240 VIRTEX PC104 FPGA
DEVELOPMENT BOARD & KITS
Available with FPGA Devlopment Software and boilerplates
Powered By:
APS-V240-REVB_DATASHEET 02-1-2000_____ _________________________________ __4
Application Examples: Many different Examples are provided to allow the user to easily
step through and verify the programming and operation of the APS-V240 board. Two basic
modes are supported in the provided examples, although there can be many others modes
and variations of modes. The two basic modes provided in the examples are Stand-Alone,
and PC-104 ISA mode. Five basic examples are provided:
____________________________________________________________________________________________________________4
© Associated Professional Systems (APS) URL: http://www.associatedpro.com
3003 Latrobe Court Abingdon, MD 21009 USA email: X240@associatedpro.com
Voice: 410.569.5897 Fax: 888.709.8707
APS-V240 VIRTEX PC104 FPGA
DEVELOPMENT BOARD & KITS
Available with FPGA Devlopment Software and boilerplates
Powered By:
APS-V240-REVB_DATASHEET 02-1-2000_____ _________________________________ __5
____________________________________________________________________________________________________________5
© Associated Professional Systems (APS) URL: http://www.associatedpro.com
3003 Latrobe Court Abingdon, MD 21009 USA email: X240@associatedpro.com
Voice: 410.569.5897 Fax: 888.709.8707
APS-V240 VIRTEX PC104 FPGA
DEVELOPMENT BOARD & KITS
Available with FPGA Devlopment Software and boilerplates
Powered By:
APS-V240-REVB_DATASHEET 02-1-2000_____ _________________________________ __6
set. DMA request is set on JP2, while the The board can get power from the PC104 bus(5v),
acknowledge is set on JP4. or via a standalone wall transformer power
supply(5v).
JP2 SETTING DRQ SELECTED J5 is the JTAG port connector. The V240 can chain
JP3-1 to JP3-2 DRQ5 all the programmable devices , or can allow
JP3-3 to JP3-2 DRQ6 connection to each device separatly. The TMS and
OFF No DRQ TCLK lines are common to all devices. Be sure to
have the correct configuration option enabled when
compiling the FPGA. Set the configuration clock to
JTAG when configuring the FPGA clock directly,
and to CCLK when using the EPROM. When using
JP4 SETTING DACK SELECTED the EPROM it is not necessary to chain in the
FPGA, since the FPGA can boot right from the
JP5-1 to JP5-2 DACK5
newly configured EPROM.
JP5-3 to JP5-2 DACK6
OFF No DACK JTAG Port J5:
J5 Pin
The APS-V240 can use an on board serial EPROM
1 GND
as well as being downloaded from the PC104 BUS
2 CPLD_TDI
or XCHECKER CABLE. JP7 sets the DOWNLOAD
MODE. BE AWARE THAT THE CPLD CAN ALSO 3 CPLD_TDO
DRIVE THE MODE PINS. IT IS NOT 4 FPGA_TDO
RECCOMENDED TO USE THE JUMPERS TO 5 JTAG_TMS
SET THE FPGA MODE. RATHER USE THE CPLD 6 3.3V
TO SET THE MODE. 7 PROM_TDI
8 FPGA_TDI
JP7 SETTING MODE SELECTED 9 PROM_TDO
M0 M1 M2 10 JTAG_TCLK
0FF 0FF 0FF
ON OFF OFF
OFF ON OFF Oscillator and Clock Options: The APS-V240 has
several on board oscillator and clock options
ON ON OFF
available for use. The ISA BUS provides an 8.33
OFF OFF ON
MHz clock which is sent into the FPGA on pin 162.
ON OFF ON There are also internal FPGA oscillators which can
OFF ON ON be used and instantiated in your designs. For more
ON ON ON precise clocks, two oscillator sockets (U19, and
U20) are on board the V240 board which allow for
standard oscillators to be installed. The output pins
Four LEDs are available for utility use and for are connected to the primary global clock inputs.
FPGA status. JP2 can be strapped as follows: The oscillator socket runs on 5 Volts. The output of
U19 also goes to the CPLD Clock. The output of
LED JP1 Pos FPGA Purpose U20 goes to the same pin as the output of the DDS
Pin # module if installed. U20 and the DDS module
1 7-8 118 Utility should not be installed at the same time.
2 5-6 117 Utility
3 3-4 116 Utility DDS OPTION MODULE:
4 1-2 na FPGA DONE
FROM cpld The APS-DDS-1 module is a compact 24 pin
PIN 56 (standard 0.6 inch wide through hole)
programmable clock oscillator module based on the
____________________________________________________________________________________________________________6
© Associated Professional Systems (APS) URL: http://www.associatedpro.com
3003 Latrobe Court Abingdon, MD 21009 USA email: X240@associatedpro.com
Voice: 410.569.5897 Fax: 888.709.8707
APS-V240 VIRTEX PC104 FPGA
DEVELOPMENT BOARD & KITS
Available with FPGA Devlopment Software and boilerplates
Powered By:
APS-V240-REVB_DATASHEET 02-1-2000_____ _________________________________ __7
____________________________________________________________________________________________________________7
© Associated Professional Systems (APS) URL: http://www.associatedpro.com
3003 Latrobe Court Abingdon, MD 21009 USA email: X240@associatedpro.com
Voice: 410.569.5897 Fax: 888.709.8707
APS-V240 VIRTEX PC104 FPGA
DEVELOPMENT BOARD & KITS
Available with FPGA Devlopment Software and boilerplates
Powered By:
APS-V240-REVB_DATASHEET 02-1-2000_____ _________________________________ __8
____________________________________________________________________________________________________________8
© Associated Professional Systems (APS) URL: http://www.associatedpro.com
3003 Latrobe Court Abingdon, MD 21009 USA email: X240@associatedpro.com
Voice: 410.569.5897 Fax: 888.709.8707
APS-V240 VIRTEX PC104 FPGA
DEVELOPMENT BOARD & KITS
Available with FPGA Devlopment Software and boilerplates
Powered By:
APS-V240-REVB_DATASHEET 02-1-2000_____ _________________________________ __9
____________________________________________________________________________________________________________9
© Associated Professional Systems (APS) URL: http://www.associatedpro.com
3003 Latrobe Court Abingdon, MD 21009 USA email: X240@associatedpro.com
Voice: 410.569.5897 Fax: 888.709.8707
APS-V240 VIRTEX PC104 FPGA
DEVELOPMENT BOARD & KITS
Available with FPGA Devlopment Software and boilerplates
Powered By:
APS-V240-REVB_DATASHEET 02-1-2000_____ _________________________________ __10
J3 IO Connectors (25-50)
____________________________________________________________________________________________________________ 10
© Associated Professional Systems (APS) URL: http://www.associatedpro.com
3003 Latrobe Court Abingdon, MD 21009 USA email: X240@associatedpro.com
Voice: 410.569.5897 Fax: 888.709.8707
APS-V240 VIRTEX PC104 FPGA
DEVELOPMENT BOARD & KITS
Available with FPGA Devlopment Software and boilerplates
Powered By:
APS-V240-REVB_DATASHEET 02-1-2000_____ _________________________________ __11
____________________________________________________________________________________________________________ 11
© Associated Professional Systems (APS) URL: http://www.associatedpro.com
3003 Latrobe Court Abingdon, MD 21009 USA email: X240@associatedpro.com
Voice: 410.569.5897 Fax: 888.709.8707
APS-V240 VIRTEX PC104 FPGA
DEVELOPMENT BOARD & KITS
Available with FPGA Devlopment Software and boilerplates
Powered By:
APS-V240-REVB_DATASHEET 02-1-2000_____ _________________________________ __12
____________________________________________________________________________________________________________ 12
© Associated Professional Systems (APS) URL: http://www.associatedpro.com
3003 Latrobe Court Abingdon, MD 21009 USA email: X240@associatedpro.com
Voice: 410.569.5897 Fax: 888.709.8707
APS-V240 VIRTEX PC104 FPGA
DEVELOPMENT BOARD & KITS
Available with FPGA Devlopment Software and boilerplates
Powered By:
APS-V240-REVB_DATASHEET 02-1-2000_____ _________________________________ __13
J9 PC104 ROW C
____________________________________________________________________________________________________________ 13
© Associated Professional Systems (APS) URL: http://www.associatedpro.com
3003 Latrobe Court Abingdon, MD 21009 USA email: X240@associatedpro.com
Voice: 410.569.5897 Fax: 888.709.8707
APS-V240 VIRTEX PC104 FPGA
DEVELOPMENT BOARD & KITS
Available with FPGA Devlopment Software and boilerplates
Powered By:
APS-V240-REVB_DATASHEET 02-1-2000_____ _________________________________ __14
____________________________________________________________________________________________________________ 14
© Associated Professional Systems (APS) URL: http://www.associatedpro.com
3003 Latrobe Court Abingdon, MD 21009 USA email: X240@associatedpro.com
Voice: 410.569.5897 Fax: 888.709.8707
A B C D E
APS
Associated Professional Systems
4 3003 Latrobe Court Abingdon, Maryland 21009 4
TABLE OF CONTENTS
PAGE DESCRIPTION
INSTRUCTIONS
INSTRUCT # DESCRIPTION
1 1
Title
APS-V240 PC104 XILINX FPGA DEVELOPMENT BOARD
PROM1_RESET_OUT
TO CLOCK PAGE PLL PLL_OE
PLL_SEL1
PLL_SEL0
CPLD_TDO
4 3.3VOLTS 4
DONE_LED
DDS_WCLK
TO CLOCK PAGE DDS DDS_FQUD
DDS_RESET
DDS_DATA
D7
TO/FROM PC104 ISA BUS D6 3.3VOLTS
D5
CPLD_SPARE1
R8 10K
R9 27K
R10 10K JP6
3.3VOLTS
R11 27K 1 2
R12 10K 3 4
3.3VOLTS 5 6
64
63
62
61
60
59
58
57
56
55
54
53
52
51
50
49
U21 R13 27K 7 8
R14 10K ADDRESS
GND
TDO
VCCIO
FB2_8
FB2_6
FB2_5
FB2_2
FB2_4
FB2_3
FB4_6
FB4_17
FB4_15
FB4_12
FB4_10
FB4_14
FB2_9 GSR
3.3VOLTS
3 3
D0 1 48 DIN
FB2_10 FB4_11
CPLD_SPARE2 2 47
FB2_11 gts2 FB4_4 CCLK
3 46 DONE
3.3VOLTS VCCINT FB4_3
D2 4 45 INIT
FB2_12 FB4_8
PROM2_RESET_OUT 5 44 PROG
FB2_14 gts1 FB4_5
D4 6 43
FB2_15 FB4_2
A0 7 42
TO/FROM PC104 ISA BUS FB2_17 XC9572XL CPLD FB3_16
A1 8 41
FB1_2 GND
A2 9 40
FB1_5 FB3_12
A3 10 39
FB1_6 FB3_10
A4 11 38 AEN
FB1_8 FB3_17
A5 12 37 3.3VOLTS
FB1_3 VCCINT
13 36 D1
A6 FB1_4 FB3_15
14 35 D3
GND FB3_14
IOW 15 34 OSC_OE_2
FB1_9 gclk1 FB3_6
IOR 16 33 OSC_OE_1
FB1_11 gclk2 FB3_11
FB1_14 gclk3
FB1_10
FB1_15
FB1_17
FB1_12
VCCIO
FB3_2
FB3_5
FB3_8
FB3_9
FB3_3
FB3_4
GND
2 2
TMS
TCK
TDI
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
M0
PROM_CLK
JTAG_TCK TO JTAG PORT
JTAG_TMS
3.3VOLTS
CPLD_TDI
M1
3.3VOLTS
C7 C8 C9 C10 C11 C12 C13 C14
M2 TO AND FROM EEPROMS
.01uf .01uf .01uf .01uf .01uf .01uf .01uf .01uf
PROM_DATA
CPLD BYPASS PROM_OE
PROM_CE
CAPS
A9
A8
A7
CPLD_CLK
1 1
Title
APS-V240 VIRTEX PC104 FPGA BOARD
3.3VOLTS
FPGAGCLK3
FPGAGCLK2
C17 C18 C19 C20 C21 C22 C23 C24
3.3VOLTS
FPGAP184
FPGAP185
SramBWS0
SramDQ15
SramDQ13
SramDQ11
SramDQ14
SramDQ12
SramDQ10
SramBWS1
SramDP0
FPGA_TDO
FPGA_TDI
SramDQ9
SramDQ8
SramDQ7
SramDQ6
SramMODE
.01uf .01uf .01uf .01uf .01uf .01uf .01uf .01uf
3.3VOLT S
2.5VOLT S
2.5VOLT S
2.5VOLT S
JTAG_TCK
3.3VOLTS
3.3VOLTS
SramA12
SramA13
SramA16
SramA10
SramA11
SramA14
SramA15
SramA17
SramDQ16
Sram/OE
SramCLK
SramRW
SramA0
SramA5
SramA7
SramA1
SramA2
SramA3
SramA4
SramA6
SramA8
SramLD
SramA9
FPGA BYPASS
CAPS
D0
4 4
2.5VOLTS
240
239
238
237
236
235
234
233
232
231
230
229
228
227
226
225
224
223
222
221
220
219
218
217
216
215
214
213
212
211
210
209
208
207
206
205
204
203
202
201
200
199
198
197
196
195
194
193
192
191
190
189
188
187
186
185
184
183
182
181
C25 C26 C27 C28 C29 C30 C31 C32
GND
GND
GND
GND
GND
GND
GND
GND
CS
TDO
IO
IO
IO
IO
IO
IO
IO
IO
IO
IO
IO
IO
IO
IO
IO
IO
IO
IO
IO
IO
IO
IO
IO
IO
TCK
VCCO
VCCO
VCCO
VCCO
VCCINT
VCCINT
VCCINT
TDI
GCLK3
GCLK2
VREFB0
VREFB0
VREFB0
VREFB0
VREFB0
VREFB0
VREFB0
VREFB1
VREFB1
VREFB1
VREFB1
VREFB1
VREFB1
VREFB1
WRITE
.01uf .01uf .01uf .01uf .01uf .01uf .01uf .01uf
VREFB5
VREFB5
VREFB6
VREFB5
VREFB5
VREFB5
VREFB4
VREFB4
VREFB4
VREFB4
VREFB4
VREFB4
VCCINT
VCCINT
VCCINT
4.7K
VREFB
VREFB
GCLK1
GCLK0
VCCO
VCCO
VCCO
VCCO
DONE
GND
GND
GND
GND
GND
GND
GND
GND
3.3VOLTS 4.7K
M2
IO
IO
IO
IO
IO
IO
IO
IO
IO
IO
IO
IO
IO
IO
IO
IO
IO
IO
IO
IO
IO
IO
IO
IO
IO
IO
IO
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
M0
1 R22 1
M1
JP7 DONE
4.7K
1 2
3.3VOLT S
3.3VOLT S
3.3VOLT S
2.5VOLTS
2.5VOLTS
2.5VOLTS
3.3VOLTS
FPGAP100
FPGAP102
FPGAP107
FPGAP109
FPGAP110
FPGAP114
FPGAP115
FPGAP117
FPGAP101
FPGAP103
FPGAP108
FPGAP111
FPGAP113
FPGAP116
FPGAP118
FPGAP66
FPGAP68
FPGAP71
FPGAP73
FPGAP74
FPGAP78
FPGAP79
FPGAP81
FPGAP84
FPGAP86
FPGAP93
FPGAP94
FPGAP96
FPGAP99
Silkscreen
FPGAGCLK1
FPGAP65
FPGAP67
FPGAP70
FPGAP72
FPGAP80
FPGAP82
FPGAP85
FPGAP87
FPGAP92
FPGAP95
FPGAP97
DRQ
3 4
Label JP7 5 6 Title
"FPGA MODE" FPGA MODE STRAP APS-V240 VIRTEX PC104 FPGA BOARD
PROM1_RESET_OUT
EEPROMs
JTAG_TCK
PROM_TDI
JTAG_TMS
4 4
PROM_TDO
3.3VOLTS
C15
.01uf
20
19
U14
3
2
1
D2
D0
VCC
CLK
VCCO
PLACE RESISTOR
4 18 R15 WHEN 1801 NOT
TDI VCC 0
5 17 INSTALLED
R17 TMS TDO
6 16
R16 TCK D1
7 15 XC1804TDO
0 0 D4 D3
8 14
RESET/OE D5
XC1804TDO
GND
CEO
/CE
D6
D7
3 3
10
11
12
13
9
XC1801PC20
U16 R19
44
43
42
41
40
39
38
37
36
35
34
NC
NC
NC
GND
D2
D0
VCC
VCC
CLK
VCCO
R15 1 33
NC NC
2 32
NC NC
3 31 XC1804TDO
TDI TD0
4 30 PROM_DATA
XCV50 U14=1801 U16-NI XCV100 nc NC
5 29 PROM_CLK
TMS D1
U14=1801 U16=NI XCV150 U14=1801 6 28 PROM_CE
GND GND
U16=NI XCV200 U14=NI U16=1802 7 27 PROM_OE
TCK D3
XCV300 U16=NI U14=1802 XCV400 8 26
VCCO VCC0
2 9 25 2
D4 D5
RESET/OE
U16=1804
GND
CEO
VCC
/CE
NC
NC
NC
D6
D7
3.3VOLTS
1 C16 1
.01uf
Title
APS-V240 VIRTEX PC104 FPGA BOARD
J6 J7
0
0
1 0
D7 IOCHCHK* na
2 1
4
D6 SD7 0V 4
3 2
D5 SD6 RESETDRV
4 3
D4 SD5 +5V 5v
5 4
D3 SD4 IRQ9
6 5
D2 SD3 -5V
7 6
D1 SD2 DRQ2 J9
8 7
D0 SD1 -12V J8
9 8
SD0 ENDXFER*
10 9 0 0
AEN IOCHRDY +12V 0V 0V
11 10 1 1 MEMCS16
AEN KEY SBHE* MEMCS16*
12 11 MEMW 2 2 IOCS16
SA19 SMEMW* LA23 IOCS16*
13 12 MEMR 3 3 IRQ10
SA18 SMEMR* LA22 IRQ10
14 13 IOW 4 4
SA17 IOW* LA21 IRQ11
15 14 IOR 5 5
A15 SA16 IOR* LA20 IRQ12
16 15 6 6
A14 SA15 DACK3* LA19 IRQ15
17 16 7 7
A13 SA14 DRQ3 LA18 IRQ14
18 17 8 8
A12 SA13 DACK1* LA17 DACK0*
19 18 9 9
A11 SA12 DRQ1 MEMR* DRQ0
3 20 19 10 10 DACK5
3
A10 SA11 REFRESH/KEY D8 MEMW* DACK5*
21 20 SYSCLK 11 11 DRQ5
A9 SA10 SYSCLK D9 SD8 DRQ5
22 21 IRQ7 12 12 DACK6
A8 SA9 IRQ7 D10 SD9 DACK6*
23 22 IRQ6 13 13 DRQ6
A7 SA8 IRQ6 D11 SD10 DRQ6
24 23 IRQ5 14 14
A6 SA7 IRQ5 D12 SD11 DACK7*
25 24 15 15
A5 SA6 IRQ4 D13 SD12 DRQ7
26 25 16 16
A4 SA5 IRQ3 D14 SD13 +5V 5v
27 26 17 17
A3 SA4 DACK2* D15 SD14 MASTER
28 27 TC 18 18
A2 SA3 TC SD15 0V
29 28 BALE 19 19
A1 SA2 BALE KEY 0V
30 29
A0 SA1 +5V 5v
31 30
SA0 OSC PC104_RC PC104_RD
32 31
0V 0V
32
0V
PC104_RA PC104_RB
2 2
LONG CONNECTOR
1 1
Title
APS-V240 VIRTEX PC104 FPGA BOARD
C1
U17 .01uf
1 8 FROM CPLD
PLL_OE OE VCC 3.3VOLTS
2 7 PLL_SEL1
X1 SEL1
3 6 PLL_SEL0
FROM CPLD X2 SEL0
4 5
4 GND CLKOUT FPGAGCLK0 4
R1 0 C2
PERICOM P16C918 CLOCK PHASE LOCK LOOP 0
MULTIPLIER
PLL_IN
TO FPGA
FPGAGCLK3
5VOLTS
14
19
U18
AVDD
DVCC
3 1 3
D0
2
D1
3
D2 TO FPGA
4 15
D3 QOUT
5 18 FPGAGCLK1
D4 QOUTB
6
D5
7
D6 APS-DDS-1
DDS_DATA 8
D7
DDS_RESET 9
RESET SINE
16 OSCILLATOR SOCKETS TO CPLD GCK3
DDS_FQUD 12 CPLD_CLK
FQUD
DDS_WCLK 17
WCLK U19
FROM CPLD 13 1 8
NC OSC_OE_1 OE VDD 5v
R2
0 TO FPGA
DGND
DGND
DGND
DGND
DGND
AGND
4 5
GND OUT FPGAGCLK2
11
2 OSC SG-531P
2
5v
10
21
22
23
24
20
SHORT (8PIN) THROUGH HOLE SOCKET
MODULE R3
0 TO FPGA
4 5 FPGAGCLK1
GND OUT
SG-531P
1 1
Title
APS-V240 VIRTEX PC104 FPGA BOARD
TO263 PACKAGE
4 4
MIC29150-3.3V REGULATOR
5v
1 3 3.3VOLTS
VIN 3.3VOUT
C33
GND
10uf
U23
2
C34
10uf
3 3
TO263 PACKAGE
MIC29150-2.5V REGULATOR
5v
1 3 2.5VOLTS
VIN 2.5VOUT
C35
GND 10uf
U24
2
C36
10uf
2 2
3.3VOLTS
4 4
+ C37
.01uF
19
U25
+ C38 2
VCC
.1uf C1+
4 3
C1- V+
5 7 + C39
C2+ V- 0.1uf
6
+ C40 C2- C41
+
0.1uf
0.1uf
3
RS232_T1IN 13 17 RS232_T1OUT
3
T1in T1Out
TO FPGA 12 8
RS232_T2IN T2in T2Out RS232_T2OUT
RS232_R1OUT 15 16 RS232_R1IN
R1out R1in
TO FPGA 10 9
RS232_R2OUT R2out R2in RS232_R2IN
1 11
/en InvalidOut
GND
14 20 3.3VOLTS
forceon forceoff
max3223
18
2 2
1 1
Title
APS-V240 VIRTEX PC104 FPGA BOARD
3.3VOLTS
SramDNU
R23
SramDQ2
0
3.3VOLTS
3.3VOLTS
3.3VOLTS
3.3VOLTS
3.3VOLTS
3.3VOLTS
SramA17
SramDP0
SramDQ5
SramDQ4
SramDQ1
SramDQ0
SramZZ
SramDQ7
SramDQ6
SramDQ3
80
79
78
77
76
75
74
73
72
71
70
69
68
67
66
65
64
63
62
61
60
59
58
57
56
55
54
53
52
51
VSS
VSS
VSS
VSS
VSS
A17
DP0
VDD
VDD
NC
NC
NC
NC
NC
NC
NC
NC
VDDQ
VDDQ
VDDQ
VDDQ
DQ7
DQ6
DQ5
DQ4
DQ3
DQ2
DQ1
DQ0
ZZ
SramA9 81 50 SramA16
A9 A16
SramA8 82 49 SramA15
A8 A15
3 83 48 SramA14
3
NC A14
84 47 SramA13
NC A13
SramLD 85 46 SramA12
ADV/*LD A12
Sram/OE 86 45 SramA11
/OE A11
87 44 SramA10
/CEN U26 A10
SramRW 88 43 SramDNU
R/W DNU
SramCLK 89 42 SramDNU
CLK MT55L256L18P DNU
90 41 3.3VOLTS
VSS VDD
91 40
3.3VOLTS VDD VSS
92 39 SramDNU
/CE2 DNU
SramBWS0 93 38 SramDNU
/BWS0 DNU
SramBWS1 94 37 SramA0
/BWS1 A0
95 36 SramA1
NC A1
96 35 SramA2
NC A2
SramCE2 97 34 SramA3
CE2 A3
98 33 SramA4
/CE1 A4
SramA7 99 32 SramA5
A7 A5
SramA6 100 31 SramMODE
2 A6 MODE 2
VDDQ
VDDQ
VDDQ
VDDQ
DQ10
DQ11
DQ12
DQ13
DQ14
DQ15
DQ16
VDD
VDD
VDD
DQ8
DQ9
VSS
VSS
VSS
VSS
VSS
NC
NC
NC
NC
NC
NC
NC
NC
NC
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
1
2
3
4
5
6
7
8
9
3.3VOLTS
3.3VOLTS
3.3VOLTS
3.3VOLTS
3.3VOLTS
3.3VOLTS
3.3VOLTS
SramDQ10
SramDQ11
SramDQ14
SramDQ15
SramDQ16
SramDQ12
SramDQ13
SramDQ8
SramDQ9
1 1
Title
APS-V240 VIRTEX PC104 FPGA BOARD
FPGAP157 1 2 5v 1 2 5v 1 2 5v SramA9 1 2 5v
1 2 FPGAP100 1 2 FPGAP65 1 2 1 2
FPGAP155 3 4 3.3VOLTS 3 4 3.3VOLTS 3 4 3.3VOLTS SramA8 3 4 3.3VOLTS
3 4 FPGAP101 3 4 FPGAP66 3 4 3 4
FPGAP154 5 6 2.5VOLTS 5 6 2.5VOLTS 5 6 2.5VOLTS SramLD 5 6 2.5VOLTS
5 6 FPGAP102 5 6 FPGAP67 5 6 5 6
FPGAP153 7 8 7 8 7 8 Sram/OE 7 8
7 8 FPGAP103 7 8 FPGAP68 7 8 7 8
FPGAP152 9 10 CPLD_TDI FPGAP107 9 10 9 10 SramRW 9 10
4 9 10 9 10 FPGAP70 9 10 9 10 SramA17 4
FPGAP149 11 12 PROM_TDO FPGAP108 11 12 11 12 SramCLK 11 12
11 12 11 12 FPGAP71 11 12 11 12 SramDP0
FPGAP147 13 14 FPGAP109 13 14 13 14 SramBWS0 13 14
13 14 JTAG_TMS 13 14 FPGAP72 13 14 13 14 SramDQ7
FPGAP146 15 16 JTAG_TCK FPGAP110 15 16 15 16 SramBWS1 15 16
15 16 15 16 FPGAP73 15 16 15 16 SramDQ6
FPGAP144 17 18 RS232_T1IN FPGAP111 17 18 17 18 SramCE2 17 18
17 18 17 18 FPGAP74 17 18 17 18 SramDQ5
FPGAP142 19 20 RS232_T2IN 19 20 19 20 SramA7 19 20
19 20 FPGAP113 19 20 FPGAP78 19 20 19 20 SramDQ4
FPGAP141 21 22 RS232_R1IN 21 22 21 22 SramA6 21 22 SramA16
21 22 FPGAP114 21 22 FPGAP79 21 22 21 22
23 24 23 24 23 24 23 24
Select Map CPLD_SPARE1 25
23 24
26
RS232_R2IN FPGAP115
25
23 24
26
FPGAP80
25
23 24
26
SramDQ8
25
23 24
26
SramA15
CPLD_SPARE2 25 26 RS232_R1OUT FPGAP116 25 26 FPGAP81 25 26 SramDQ9 25 26 SramA14
Lines FPGAGCLK1 27 28 RS232_R2OUT 27 28 27 28 27 28 SramA13
27 28 FPGAP117 27 28 FPGAP82 27 28 SramDQ10 27 28
29 30 29 30 29 30 29 30
SM Wr FPGAP185 31
29 30
32
RS232_T1OUT FPGAP118
31
29 30
32
FPGAP84
31
29 30
32
SramDQ11
31
29 30
32
SramA12
SM CS FPGAP184 33
31 32
34
RS232_T2OUT FPGAP125
33
31 32
34 FPGAP85 33
31 32
34 SramDQ12 33
31 32
34
SramA11
SM D0 FPGAP177 35
33 34
36
FPGAP126
35
33 34
36
FPGAP86
35
33 34
36
SramDQ13
35
33 34
36
SramA10
SM D1 FPGAP167 37
35 36
38
FPGAP127
37
35 36
38
FPGAP87
37
35 36
38
SramDQ14
37
35 36
38
SramA0
SM D2 FPGAP163 39
37 38
40
FPGAP128
39
37 38
40
FPGAP92
39
37 38
40
SramDQ15
39
37 38
40
SramA1
SM D3 FPGAP156 41
39 40
42
FPGAP130
41
39 40
42
FPGAP93
41
39 40
42
SramDQ16
41
39 40
42
SramA2
SM D4 FPGAP145 43
41 42
44 FPGAP131 43
41 42
44 FPGAP94 43
41 42
44 SramDQ0 43
41 42
44
SramA3
SM D5 FPGAP138 45
43 44
46
FPGAP132
45
43 44
46
FPGAP95
45
43 44
46
SramDQ1
45
43 44
46
SramA4
SM D6 FPGAP134 47
45 46
48
FPGAP133
47
45 46
48
FPGAP96
47
45 46
48
SramDQ2
47
45 46
48
SramA5
SM D7 FPGAP124 47 48 FPGAP139 47 48 FPGAP97 47 48 SramDQ3 47 48 SramMODE
49 50 FPGAP140 49 50 49 50 49 50
BUSY FPGAP178 49 50 49 50 FPGAP99 49 50 SramZZ 49 50
3
50PIN_CONN 50PIN_CONN 50PIN_CONN 50PIN_CONN 3
R4 R5 R6 R7
INT B 150 150 150 150
DACK
Title
APS-V240 VIRTEX PC104 FPGA BOARD
Componentes: La placa dispone de un teclado matricial numérico 4x4 con una fila
adicional de 4 pulsadores dispuestos como cursores.
● Keypad 4x4
● 4 pulsadores
Conectores:
(izq. a der. según la foto)
● alimentación
● tierra
● código de retorno (4 bits)
● código de scan (5 bits)
● AND del código de scan
1 2 3 4
D D
8
Vcc JP1
C0 C1 C2 C3 1
2
Vcc 1
R0 3
4
2
1
R1 5
6
3
R2 7
C
8
4
R3 9
10
PAD1
11
KEYPAD_16
C 12 C
HEADER 12
8
AR1 S1
10K
U1A S2 S3
1 C4
3
2
U1C S4
74F08 9
8 nINT
10
U1B 74F08
4
6
5
B B
74F08
U1D
12
A
11
Y
13
B
7
GND
74F08
14
VCC
Vcc C1
100nF
Title
A Keypad Board A
Conectores:
(izq. a der. según la foto)
● selección (3 bits)
● código 7-segs (dp, g..a)
● tierra
● alimentación
1 2 3 4
D D
DISP2 DISP1
7SEG_4DISP Catodo Común RP2 7SEG_4DISP Catodo Común RP1
a 1 1 16 A a 1 1 16 A
b 2 2 15 B b 2 2 15 B
a a a a a a a a
c 3 3 14 C c 3 3 14 C
f b f b f b f b d 4 4 13 D f b f b f b f b d 4 4 13 D
g g g g g g g g
e 5 5 12 E e 5 5 12 E
e c e c e c e c 6 6 11 F e c e c e c e c 6 6 11 F
C d d d d f d d d d f C
7 7 10 G 7 7 10 G
dp dp dp dp g dp dp dp dp g
dp 8 8 9 DP dp 8 8 9 DP
4 3 2 1 4 3 2 1
470 470
JP1
9
9
12
11
10
12
11
10
Vdd HEADER 13
1
2
A
3
B
4
C
5
D
6
10
11
12
13
14
15
E
7
9
7
U1 F
8
G
9
Y7
Y6
Y5
Y4
Y3
Y2
Y1
Y0
Vdd C1 DP
10
8 16 D0
GND VCC 11
D1
12
G2A
G2B
100nF D2
G1
B 13 B
A
C
B
74F138
5
4
6
3
2
1
Vdd
Title
A Placa de 7 segmentos A
Componentes: La placa forma una matriz 40x7 de leds multiplexada (lógica directa
para filas e inversa para columnas), accesible en serie a través de 2
registros de desplazamiento de 40 y 7 bits.
● 8 matrices 5x7de leds con
filas en cátodo común y
columnas en ánodo común La placa puede encadenarse en vertical u horizontal con otras
similares, para formar matrices de leds de mayores dimensiones.
Conectores:
(izq. a der. según la foto)
● tierra
● alimentación
● entrada serie columnas
● reloj columnas
● entrada serie filas
● reloj filas
● salida serie columnas
● salida serie filas
1 2 3 4 5 6 7 8
D D
Vcc
U7
DISP0 DISP1 DISP2 DISP3 DISP4 DISP5 DISP6 DISP7 10 9
Vcc GND
DOT_MATRIX_DISP DOT_MATRIX_DISP DOT_MATRIX_DISP DOT_MATRIX_DISP DOT_MATRIX_DISP DOT_MATRIX_DISP DOT_MATRIX_DISP DOT_MATRIX_DISP 11 8
ROW0 1 ROW0 1 ROW0 1 ROW0 1 ROW0 1 ROW0 1 ROW0 1 ROW0 1 ROW0 12 7
ROW1 2 ROW1 2 ROW1 2 ROW1 2 ROW1 2 ROW1 2 ROW1 2 ROW1 2 ROW1 13 6
ROW2 11 ROW2 11 ROW2 11 ROW2 11 ROW2 11 ROW2 11 ROW2 11 ROW2 11 ROW2 14 5
ROW3 10 ROW3 10 ROW3 10 ROW3 10 ROW3 10 ROW3 10 ROW3 10 ROW3 10 ROW3 15 4
ROW4 8 ROW4 8 ROW4 8 ROW4 8 ROW4 8 ROW4 8 ROW4 8 ROW4 8 ROW4 16 3
C ROW5 5 ROW5 5 ROW5 5 ROW5 5 ROW5 5 ROW5 5 ROW5 5 ROW5 5 ROW5 17 2 C
ROW6 6 ROW6 6 ROW6 6 ROW6 6 ROW6 6 ROW6 6 ROW6 6 ROW6 6 ROW6 18 1
ULN2803
4
3
7
9
4
3
7
9
4
3
7
9
4
3
7
9
4
3
7
9
4
3
7
9
4
3
7
9
4
3
7
9
12
12
12
12
12
12
12
12
15
9
7
6
5
4
3
2
1
16
15
14
13
12
11
10
16
15
14
13
12
11
10
16
15
14
13
12
11
10
16
15
14
13
12
11
10
16
15
14
13
12
11
10
9
9
U6
QH1
QH
QG
QE
QD
QA
QF
QC
QB
RP1 RP2 RP3 RP4 RP5 SN74LS594
100 100 100 100 100
SRCLR
SRCK
RCLR
RCK
SER
1
2
3
4
5
6
7
8
1
2
3
4
5
6
7
8
1
2
3
4
5
6
7
8
1
2
3
4
5
6
7
8
1
2
3
4
5
6
7
8
15
15
15
15
15
9
7
6
5
4
3
2
1
9
7
6
5
4
3
2
1
9
7
6
5
4
3
2
1
9
7
6
5
4
3
2
1
9
7
6
5
4
3
2
1
14
11
10
12
13
U1 U2 U3 U4 U5
QH1
QH1
QH1
QH1
QH1
QH
QG
QE
QD
QA
QH
QG
QE
QD
QA
QH
QG
QE
QD
QA
QH
QG
QE
QD
QA
QH
QG
QE
QD
QA
QF
QC
QB
QF
QC
QB
QF
QC
QB
QF
QC
QB
QF
QC
QB
SN74LS594 SN74LS594 SN74LS594 SN74LS594 SN74LS594
SRCLR
SRCLR
SRCLR
SRCLR
SRCLR
SRCK
SRCK
SRCK
SRCK
SRCK
RCLR
RCLR
RCLR
RCLR
RCLR
B B
RCK
RCK
RCK
RCK
RCK
SER
SER
SER
SER
SER
Vcc
J1
1
14
11
10
12
13
14
11
10
12
13
14
11
10
12
13
14
11
10
12
13
14
11
10
12
13
2
COL_Serial_IN
3
COL_Clk
4
ROW_Serial_IN
5
ROW_Clk
6
Reset
7
COL_Serial_OUT
8
ROW_Serial_OUT
9
CON9
A A
Title
8 Dot Matrix Display 5x7
Size Number Revision
A3
2.0
Date: 17-Jan-2002 Sheet of
File: C:\Documents and Settings\Administrador\Escritorio\UCM.ddb
Drawn By:
1 2 3 4 5 6 7 8
The Concise LCD Data Sheet. http://www.senet.com.au/~cpeacock
Write Cycle
RS
tas tah
R/W
tw
tf
Enable
tr tds th
Data Valid Data
tc
(2)
Parameter Symbol Min (1) Typ (1) Max (1) Unit
Enable Cycle Time tc 500 - - ns
Enable Pulse Width tw 230 - - ns
(High)
Enable Rise/Fall Time tr,tf - - 20 ns
Address Setup Time tas 40 - - ns
Address Hold Time tah 10 - - ns Pin No Name I/O Description
Data Setup Time 80 - ns 1 Vss Power GND
tds
2 Vdd Power +5v
Data Hold Time th 10 - - ns 3 Vo Analog Contrast Control
4 RS Input Register Select
Note 1 The above specifications are a indication only. Timing will vary from manufacturer 5 R/W Input Read/Write
to manufacturer. 6 E Input Enable (Strobe)
7 D0 I/O Data LSB
8 D1 I/O Data
Note 2 A 2 line by 16 Character LCD Module is Pictured. Data will work on most 1 line x 9 D2 I/O Data
16 character, 1 line x 20 character, 2 line x 16 character, 2 line x 20 character, 4 lines x 10 D3 I/O Data
20 character, 2 lines x 40 character etc. modules compatible with the HD44780 LCD 11 D4 I/O Data
Module. 12 D5 I/O Data
13 D6 I/O Data
14 D7 I/O Data MSB
1 2 3 4
D D
J1
CON14
10
11
12
13
14
1
2
3
4
5
6
7
8
9
R1
10K 330
POT1
C C
10
11
12
13
14
15
16
1
2
3
4
5
6
7
8
9
LED A
LED K
Vdriver
RS
D0
D1
D2
D3
D4
D5
D6
D7
GND
RW
Vcc
E
LCD
B B
LCD_16X2
LCD1
Title
A LCD A
● tierra
● alimentación
● columnas 1-8
1 2 3 4 5 6
G
R
R
1
3
R31 R30 R29 R28 R27 R26 R25 R24 R23 R22 R21 R20 R19 R18 R17 R16
470 470 470 470 470 470 470 470 470 470 470 470 470 470 470 470
10
Vcc Vcc Vcc
2
6
74F14 U1C U1E 74F14 U2C U2E 74F14 U3C
VCC
VCC
VCC
GND
GND
GND
A Y
A Y
A Y
U1A C8 74F14 74F14 U2A C9 74F14 74F14 U3A C10 74F14
1
5
14
11
14
11
14
C C
JP1
1
2
3
4
5
6
7
8
9
10
Vcc Vcc Vcc Vcc Vcc Vcc Vcc Vcc Vcc
HEADER 10
B B
C7 C6 C5 C4 C3 C2 C1 C0
R7 R6 R5 R4 R3 R2 R1 R0
A A
Title
8 Digital Inputs
Size Number Revision
B
1.0
Date: 17-Jan-2002 Sheet of
File: C:\Documents and Settings\Administrador\Escritorio\UCM.ddb
Drawn By:
1 2 3 4 5 6
1 2 3 4
D D
U?
C R1 C
VCC BUZZER
J1
1
2
3
CON3
R2
SPEAKER1
SPEAKER
B B
Title
A Sound A
Catalog
Manuals
●
Software Downloads
● Support
Product Manuals
Tutorials
●
Application Notes
●
Design Examples
●
FAQ
●
User Forum
●
Request Help
● Purchasing
search Search
Web Orders
Purchase Orders
●
Payment Methods
●
Get a Quote
●
Home
About Us
●
Contact Us
● Misc.
Links
If you are looking for some information about XESS programmable logic boards and development tools, then please use the Search
We feature on our main page. You can also send us a message to tell us about the missing file.
Couldn't
Find
That
Page!
Sorry, the file you
requested could not be
found. Try these
suggestions to find the
information you want.
webmaster@xess.com Products Manuals Downloads How to Buy Online Quote Order Online
© 1998-2006, XESS Corp.
All rights reserved. Help! FAQ Forum Tutorials Examples Links Home About Us Contact Us
¡ Semiconductor
¡ Semiconductor MSM80C154S/83C154S
MSM80C154S/83C154S
CMOS 8-bit Microcontroller
GENERAL DESCRIPTION
The MSM80C154S/MSM83C154S, designed for the high speed version of the existing
MSM80C154/MSM83C154, is a higher performance 8-bit microcontroller providing low-power
consumption.
The MSM80C154S/MSM83C154S covers the functions and operating range of the existing
MSM80C154/83C154/80C51F/80C31F.
The MSM80C154S is identical to the MSM83C154S except it does not contain the internal
program memory (ROM).
FEATURES
• Operating range
Operating frequency : 0 to 3 MHz (Vcc=2.2 to 6.0 V)
0 to 12 MHz (Vcc=3.0 to 6.0 V)
0 to 24 MHz (Vcc=4.5 to 6.0 V)
Operating voltage : 2.2 to 6.0 V
Operating temperature : –40 to +85°C (Operation at +125°C conforms to
the other specification.)
• Fully static circuit
• Upward compatible with the MSM80C51F/80C31F
• On-chip program memory : 16K words x 8 bits ROM (MSM83C154S only)
• On-chip data memory : 256 words x 8 bits RAM
• External program memory address space : 64K bytes ROM (Max)
• External data memory address space : 64K bytes RAM
• I/O ports : 4 ports x 8 bits
(Port 1, 2, 3, impedance programmable) : 32
• 16-bit timer/counters : 3
• Multifunctional serial port : I/O Expansion mode
: UART mode (featuring error detection)
• 6-source 2-priority level
Interrupt and multi-level
Interrupt available by programming IP and IE registers
• Memory-mapped special function registers
• Bit addressable data memory and SFRs
• Minimum instruction cycle : 500 ns @ 24 MHz operation
• Standby functions : Power-down mode (oscillator stop)
Activated by software or hardware; providing
ports with floating or active status
The software power-down stet mode is termi-
nated by interrupt signal enabling execution from
the interrupted address.
259
MSM80C154S/83C154S ¡ Semiconductor
• Package options
40-pin plastic DIP (DIP40-P-600-2.54) : (Product name: MSM80C154SRS/
MSM83C154S-xxxRS)
44-pin plastic QFP (QFP44-P-910-0.80-2K) : (Product name: MSM80C154SGS-2K/
MSM83C154S-xxxGS-2K)
44-pin QFJ (QFJ44-P-S650-1.27) : (Product name: MSM80C154SJS/
MSM83C154S-xxxJS)
44-pin TQFP (TQFP44-P-1010-0.80-K) : (Product name: MSM80C154STS-K/
MSM83C154S-xxxTS-K)
260
¡ Semiconductor
BLOCK DIAGRAM (MSM83C154S)
P2.0
PORT 2
P2.7 DPH CONTROL SIGNAL R/W SIGNAL
ADDRESS DECODER
P0.0 ROM SPECIAL
FUNCTION
PORT 0
XTAL2
OSC and TIMING
C-ROM
ALE
PSEN
IOCON
EA
T2CON TL2 TH2 R/W AMP ACC TR2 TR1
RESET
RAM
P1.0 256 WORDS RAMDP
PORT 1
MSM80C154S/83C154S
P3.0
PORT 3
P1.0/T2 1 40 VCC
P1.1/T2EX 2 39 P0.0
P1.2 3 38 P0.1
P1.3 4 37 P0.2
P1.4 5 36 P0.3
P1.5 6 35 P0.4
P1.6 7 34 P0.5
P1.7 8 33 P0.6
RESET 9 32 P0.7
P3.0/RXD 10 31 EA
P3.1/TXD 11 30 ALE
P3.2/INT0 12 29 PSEN
P3.3/INT1 13 28 P2.7
P3.4/T0 14 27 P2.6
P3.5/T1/HPDI 15 26 P2.5
P3.6/WR 16 25 P2.4
P3.7/RD 17 24 P2.3
XTAL2 18 23 P2.2
XTAL1 19 22 P2.1
VSS 20 21 P2.0
262
¡ Semiconductor MSM80C154S/83C154S
44 P1.4
43 P1.3
42 P1.2
41 P1.1
40 P1.0
37 P0.0
36 P0.1
35 P0.2
34 P0.3
38 VCC
39 NC
P1.5 1 33 P0.4
P1.6 2 32 P0.5
P1.7 3 31 P0.6
RESET 4 30 P0.7
P3.0/RXD 5 29 EA
NC 6 28 NC
P3.1/TXD 7 27 ALE
P3.2/INT0 8 26 PSEN
P3.3/INT1 9 25 P2.7
P3.4/T0 10 24 P2.6
P3.5/T1/HPDI 11 23 P2.5
P3.6/WR 12
P3.7/RD 13
XTAL2 14
XTAL1 15
VSS 16
VSS 17
P2.0 18
P2.1 19
P2.2 20
P2.3 21
P2.4 22
NC : No-connection pin
263
MSM80C154S/83C154S ¡ Semiconductor
44 P1.4
43 P1.3
42 P1.2
41 P1.1
40 P1.0
39 NC
38 VCC
37 P0.0
36 P0.1
35 P0.2
34 P0.3
P1.5 1 33 P0.4
P1.6 2 32 P0.5
P1.7 3 31 P0.6
RESET 4 30 P0.7
P3.0/RXD 5 29 EA
NC 6 28 NC
P3.1/TXD 7 27 ALE
P3.2/INT0 8 26 PSEN
P3.3/INT1 9 25 P2.7
P3.4/T0 10 24 P2.6
P3.5/T1/HPDI 11 23 P2.5
P3.6/WR 12
P3.7/RD 13
XTAL2 14
XTAL1 15
VSS 16
VSS 17
P2.0 18
P2.1 19
P2.2 20
P2.3 21
P2.4 22
NC : No-connection pin
264
¡ Semiconductor MSM80C154S/83C154S
, 32 PSEN
39 P0.4
38 P0.5
37 P0.6
36 P0.7
31 P2.7
30 P2.6
29 P2.5
33 ALE
34 NC
35 EA
P0.3 40 28 P2.4
P0.2 41 27 P2.3
P0.1 42 26 P2.2
P0.0 43 25 P2.1
VCC 44 24 P2.0
NC 1 23 NC
P1.0/T2 2 22 VSS
P1.1/T2EX 3 21 XTAL1
P1.2 4 20 XTAL2
P1.3 5 19 P3.7/RD
P1.4 6 18 P3.6/WR
RESET 10
P3.0/RXD 11
NC 12
P3.1/TXD 13
P3.2/INT0 14
P3.3/INT1 15
P3.4/T0 16
P3.5/T1/HPDI 17
P1.5 7
P1.6 8
P1.7 9
NC : No-connection pin
265
MSM80C154S/83C154S ¡ Semiconductor
PIN DESCRIPTIONS
Symbol Descriptipn
P0.0 to P0.7 Bidirectional I/O ports. They are also the data/address bus (input/output of data and output of
lower 8-bit address when external memory is accessed).
They are open-drain outputs when used as I/O ports, but 3-state outputs when used as data/address
bus.
P1.0 to P1.7 P1.0 to P1.7 are quasi-bidirectional I/O ports. They are pulled up internally when used as input
ports. Two of them have the following secondary functions:
•P1.0 (T2) : used as external clock input pins for the timer/counter 2.
•P1.1 (T2EX) : used as trigger input for the timer/counter 2 to be reloaded or captured;
causing the timer/counter 2 interrupt.
P2.0 to P2.7 P2.0 to P2.7 are quasi-bidirectional I/O ports. They also output the higher 8-bit address when
an external memory is accessed. They are pulled up internally when used as input ports.
P3.0 to P3.7 P3.0 to P3.7 are quasi-bidirectional I/O ports. They are pulled up internally when used as input
ports. They also have the following secondary functions:
•P3.0 (RXD)
Serial data input/output in the I/O expansion mode and serial data input in the UART mode when
the serial port is used.
•3.1 (TXD)
Synchronous clock output in the I/O expansion mode and serial data output in the UART mode
when the serial port is used.
•3.2 (INT0)
Used as input pin for the external interrupt 0, and as count-up control pin for the timer/counter 0.
•3.3 (INT1)
Used as input pin for the external interrupt 1, and as count-up control pin for the timer/counter 1.
•3.4 (T0)
Used as external clock input pin for the timer/counter 0.
•3.5 (T1)
Used as external clock input pin for the timer/counter 1 and power-down-mode control input pin.
•3.6 (WR)
Output of the write-strobe signal when data is written into external data memory.
•3.7 (RD)
Output of the read-strobe signal when data is read from external data memory.
ALE Address latch enable output for latching the lower 8-bit address during external memory access.
Two ALE pulses are activated per machine cycle except during external data memory access at
which time one ALE pulse is skipped.
PSEN Program store enable output which enables the external memory output to the bus during external
program memory access. Two PSEN pulses are activated per machine cycle except during
external data memory access at which two PSEN pulses are skipped.
EA When EA is held at "H" level, the MSM 83C154S executes instructions from internal program
memory at address 0000H to 3FFFH, and executes instructions from external program memory
above address 3FFFH.
When EA is held at "L" level, the MSM80C154S/MSM83C154S executes instructions from external
program memory for all addresses.
266
¡ Semiconductor MSM80C154S/83C154S
Symbol Descriptipn
RESET If this pin remains "H" for at least one machine cycle, the MSM80C154S/MSM83C154S is reset.
Since this pin is pulled down internally, a power-on reset is achieved by simply connecting a
capacitor between VCC and this pin.
XTAL1 Oscillator inverter input pin. External clock is input through XTAL1 pin.
XTAL2 Oscillator inverter output pin.
VCC Power supply pin during both normal operation and standby operations.
VSS GND pin.
267
MSM80C154S/83C154S ¡ Semiconductor
REGISTERS
268
¡ Semiconductor MSM80C154S/83C154S
MSB LSB
NAME ADDRESS
7 6 5 4 3 2 1 0
TMOD 89H GATE C/T M1 M0 GATE C/T M1 M0
BIT LOCATION FLAG FUNCTION
TMOD.0 M0 M1 M0 Timer/counter 0 mode setting
0 0 8-bit timer/counter with 5-bit prescalar.
0 1 16-bit timer/counter.
1 0 8-bit timer/counter with 8-bit auto reloading.
TMOD.1 M1 1 1 Timer/counter 0 separated into TLO (8-bit) timer/counter
and TH0 (8-bit) timer/counter. TF0 is set by TL0 carry, and
TF1 is set by TH0 carry.
269
MSM80C154S/83C154S ¡ Semiconductor
MSB LSB
NAME ADDRESS
7 6 5 4 3 2 1 0
PCON 87H SMOD HPD RPD — GF1 GF0 PD IDL
BIT LOCATION FLAG FUNCTION
PCON.0 IDL IDLE mode is set when this bit is set to "1". CPU operations are stopped when
IDLE mode is set, but XTAL1•2, timer/counters 0, 1 and 2, the interrupt circuits,
and the serial port remain active. IDLE mode is cancelled when the CPU is reset
or when an interrupt is generated.
PCON.1 PD PD mode is set when this bit is set to "1". CPU operations and XTAL1•2 are
stopped when PD mode is set. PD mode is cancelled when the CPU is reset or
when an interrupt is generated.
PCON.6 HPD The hard power-down setting mode in enabled when this bit is set to "1".
If the level of the power failure detect signal applied to the HPDI pin (pin 3.5)
is changed from "1" to "0" when this bit is "1", XTAL1•2 oscillation is stopped and
the system is put into hard power down mode. HPD mode is cancelled when the
CPU is reset.
PCON.7 SMOD When the timer/counter 1 carry signal is used as a clock in mode 1, 2 or 3 of
the serial port, this bit has the following functions.
The serial port operation clock is reduced by 1/2 when the bit is "0" for delayed
processing. When the bit is "1", the serial port operation clock is normal
for faster processing.
270
¡ Semiconductor MSM80C154S/83C154S
MSB LSB
NAME ADDRESS
7 6 5 4 3 2 1 0
TCON 88H TF1 TR1 TF0 TR0 IE1 IT1 IE0 IT0
BIT LOCATION FLAG FUNCTION
TCON.0 IT0 External interrupt 0 signal is used in level-detect mode when this bit is "0" and in
trigger detect mode when "1".
TCON.1 IE0 Interrupt request flag for external interrupt 0.
The bit is reset automatically when an interrupt is serviced.
The bit can be set and reset by software when IT0 = "1".
TCON.2 IT1 External interrupt 1 signal is used in level detect mode when this bit is "0", and in
trigger detect mode when "1".
TCON.3 IE1 Interrupt request flag for external interrupt 1.
The bit is reset automatically when an interrupt is serviced.
The bit can be set and reset by software when IT1 = "1".
TCON.4 TR0 Counting start and stop control bit for timer/counter 0.
Timer/counter 0 starts counting when this bit is "1", and stops counitng when "0".
TCON.5 TF0 Interrupt request flag for timer interrupt 0.
The bit is reset automatically when an interrupt is serviced.
The bit is set to "1" when a carry signal is generated from timer/counter 0.
TCON.6 TR1 Counting start and stop control bit for timer/counter 1.
The timer/counter 1 starts counting when this bit is "1", and stops counting when "0".
TCON.7 TF1 Interrupt request flag for timer interrupt 1.
The bit is reset automatically when interrupt is serviced.
The bit is set to "1" when carry signal is generated from timer/counter 1.
271
MSM80C154S/83C154S ¡ Semiconductor
MSB LSB
NAME ADDRESS
7 6 5 4 3 2 1 0
SCON 98H SM0 SM1 SM2 REN TB8 RB8 TI RI
BIT LOCATION FLAG FUNCTION
SCON.0 RI "End of serial port reception" interrupt request flag.
This flag must be reset by software during interrupt service routine.
This flag is set after the eighth bit of data has been received when in mode 0, or
by the STOP bit when in any other mode.
In mode 2 or 3, however, RI is not set if the RB8 data is "0" with SM2 = "1".
RI is set in mode 1 if STOP bit is received when SM2 = "1".
SCON.1 TI "End of serial port tramsmission" interrupt request flag. This flag must be reset
by software during interrupt service routine.
This flag is set after the eighth bit of data has been sent when in mode 0, or after
the last bit of data has been sent when in any other mode.
SCON.2 RB8 The ninth bit of data received in mode 2 or 3 is passed to RB8.
The STOP bit is applied to RB8 if SM2 = "0" when in mode 1.
RB8 can not be used in mode 0.
SCON.3 TB8 The TB8 data is sent as the ninth data bit when in mode 2 or 3.
Any desired data can be set in TB8 by software.
SCON.4 REN Reception enable control bit.
No reception when REN = "0".
Reception enabled when REN = "1".
SCON.5 SM2 If the ninth bit of received data is "0" with SM2 = "1" in mode 2 or 3, the "end of
reception" signal is not set in the RI flag.
The "end of reception" signal set in the RI flag if the STOP bit is not "1" when
SM2 = "1" in mode 1.
272
¡ Semiconductor MSM80C154S/83C154S
MSB LSB
NAME ADDRESS
7 6 5 4 3 2 1 0
IE 0A8H EA — ET2 ES ET1 EX1 ET0 EX0
BIT LOCATION FLAG FUNCTION
IE.0 EX0 Interrupt control bit for external interrupt 0.
Interrupt disabled when bit is "0".
Interrupt enabled when bit is "1".
IE.6 — Reserved bit. The output data is "1" if the bit is read.
IE.7 EA Overall interrupt control bit.
All interrupts are disabled when bit is "0".
All interrupts are controlled by IE.0 thru IE.5 when bit is "1".
273
MSM80C154S/83C154S ¡ Semiconductor
MSB LSB
NAME ADDRESS
7 6 5 4 3 2 1 0
IP 0B8H PCT — PT2 PS PT1 PX1 PT0 PX0
BIT LOCATION FLAG FUNCTION
IP.0 PX0 Interrupt priority bit for external interrupt 0.
Priority is assigned when bit is "1".
IP.1 PT0 Interrupt priority bit for timer interrupt 0.
Priority is assigned when bit is "1".
IP.2 PX1 Interrupt priority bit for external interrupt 1.
Priority is assigned when bit is "1".
IP.3 PT1 Interrupt priority bit for timer interrupt 1.
Priority is assigned when bit is "1".
IP.4 PS Interrupt priority bit for serial port.
Priority is assigned when bit is "1".
IP.5 PT2 Interrupt priority bit for timer interrupt 2.
Priority is assigned when bit is "1".
IP.6 — Reserved bit. The output data is "1" if the bit is read.
IP.7 PCT Priority interrupt circuit control bit.
The priority register contents are valid and priority assigned interrupts can be
processed when this bit is "0". When the bit is "1", the priority interrupt circuit is
stopped, and interrupts can only be controlled by the interrupt enable register (IE).
274
¡ Semiconductor MSM80C154S/83C154S
MSB LSB
NAME ADDRESS
7 6 5 4 3 2 1 0
PSW 0D0H CY AC F0 RS1 RS0 OV F1 P
BIT LOCATION FLAG FUNCTION
PSW.0 P Accumulator (ACC) parity indicator.
This bit is "1" when the "1" bit number in the accumulator is an odd number, and
"0" when an even number.
PSW.1 F1 User flag which may be set to "0" or "1" as desired by the user.
PSW.2 OV Overflow flag which is set if the carry C6 from bit 6 of the ALU or CY is "1" as a
result of an arithmetic operation. The flag is also set to "1" if the resultant product
of executing multiplication instruction (MUL AB) is greater than 0FFH, but is reset
to "0" if the product is less than or equal to 0FFH.
275
MSM80C154S/83C154S ¡ Semiconductor
MSB LSB
NAME ADDRESS
7 6 5 4 3 2 1 0
IOCON 0F8H — T32 SERR IZC P3HZ P2HZ P1HZ ALF
BIT LOCATION FLAG FUNCTION
IOCON.0 ALF If CPU power down mode (PD, HPD) is activated with this bit set to "1", the
outputs from ports 0, 1, 2, and 3 are switched to floating status.
When this bit is "0", ports 0, 1, 2, and 3 are in output mode.
IOCON.1 P1HZ Port 1 becomes a high impedance input port when this bit is "1".
IOCON.2 P2HZ Port 2 becomes a high impedance input port when this bit is "1".
IOCON.3 P3HZ Port 3 becomes a high impedance input port when this bit is "1".
IOCON.4 IZC The 10 kW pull-up resistor for ports 1, 2, and 3 is switched off when this bit
is "1", leaving only the 100 kW pull-up resistor.
IOCON.5 SERR Serial port reception error flag.
This flag is set to "1" if an overrun or framing error is generated when data is
received at a serial port.
The flag is reset by software.
IOCON.6 T32 Timer/counters 0 and 1 are connected serially to from a 32-bit timer/counter
when this bit is set to "1".
TF1 of TCON is set if a carry is generated in the 32-bit timer/counter.
276
¡ Semiconductor MSM80C154S/83C154S
MSB LSB
NAME ADDRESS
7 6 5 4 3 2 1 0
T2CON 0C8H TF2 EXF2 RCLK TCLK EXEN2 TR2 C/T2 CP/RL2
BIT LOCATION FLAG FUNCTION
T2CON.0 CP/RL2 Capture mode is set when TCLK + RCLK = "0" and CP/RL2 = "1".
16-bit auto reload mode is set when TCLK + RCLK = "0" and CP/RL2 = "0".
CP/RL2 is ignored when TCLK + RCLK = "1".
277
MSM80C154S/83C154S ¡ Semiconductor
MEMORY MAPS
Program Area
44 002CH
43 002BH External interrupt 0 start 3 0003H
2 0002H
1 0001H
278
¡ Semiconductor MSM80C154S/83C154S
IE AFH~A8H 168(0A8H)
P2 A7H~A0H 160(0A0H)
USER DATA RAM
SBUF 153( 99H)
SCON 9FH~98H 152( 98H)
P1 97H~90H 144( 90H)
TH1 141( 8DH)
TH0 140( 8CH)
TL1 139( 8BH)
TL0 138( 8AH)
TMOD 137( 89H)
TCON 8FH~88H 136( 88H)
PCON 135( 87H)
DPH 131( 83H)
DPL 130( 82H)
SP 129( 81H)
80 P0 87H~80H 128( 80H)
7F
USER DATA RAM
30
2F 7F 78
BIT RAM
20 7 0
BIT ADDRESSING
1F R7
BANK3
18 R0
17 R7
BANK2
10 R0
0F R7
BANK1
08 R0
DATA ADDRESSING
07 R7
BANK0
00 R0
279
MSM80C154S/83C154S ¡ Semiconductor
0FFH 255
USER DATA RAM
80H 128
7FH 127
USER DATA RAM
30H 48
2FH 7F 7E 7D 7C 7B 7A 79 78 47
2EH 77 76 75 74 73 72 71 70 46
2DH 6F 6E 6D 6C 6B 6A 69 68 45
2BH 5F 5E 5D 5C 5B 5A 59 58 43
DATA ADDRESSING
2AH 57 56 55 54 53 52 51 50 42
BIT ADDRESSING
29H 4F 4E 4D 4C 4B 4A 49 48 41
28H 47 46 45 44 43 42 41 40 40
27H 3F 3E 3D 3C 3B 3A 39 38 39
26H 37 36 35 34 33 32 31 30 38
25H 2F 2E 2D 2C 2B 2A 29 28 37
24H 27 26 25 24 23 22 21 20 36
23H 1F 1E 1D 1C 1B 1A 19 18 35
22H 17 16 15 14 13 12 11 10 34
21H 0F 0E 0D 0C 0B 0A 09 08 33
20H 07 06 05 04 03 02 01 00 32
1FH 31
REGISTERS 0-7 DIRIECT ADDRESSING
Bank 3
18H 24
17H 23
Bank 2
10H 16
0FH 15
Bank 1
08H 8
07H 7
Bank 0
00H 0
280
¡ Semiconductor MSM80C154S/83C154S
12 1
5
fOSC fEXTCLK (MHz)
4 3
tCY (ms)
2 6
1 12
0.6 20
0.5 24
2 2.2 3 4 5 6
Power Supply Voltage (VCC)
281
MSM80C154S/83C154S ¡ Semiconductor
ELECTRICAL CHARACTERISTICS
DC Characteristics 1
(VCC=4.0 to 6.0 V, VSS=0 V, Ta=-40 to +85°C)
Meas-
Parameter Symbol Condition Min. Typ. Max. Unit uring
circuit
Input Low Voltage VIL — –0.5 — 0.2 VCC–0.1 V
Except XTAL1, EA,
Input High Voltage VIH 0.2 VCC+0.9 — VCC+0.5 V
and RESET
Input High Voltage VIH1 XTAL1, RESET and EA 0.7 VCC — VCC+0.5 V
Output Low Voltage
VOL IOL=1.6 mA — — 0.45 V
(PORT 1, 2, 3)
Output Low Voltage
VOL1 IOL=3.2 mA — — 0.45 V
(PORT 0, ALE, PSEN)
1
IOH=–60 mA
2.4 — — V
Output High Voltage VCC=5 V±10%
VOH
(PORT 1, 2, 3) IOH=–30 mA 0.75 VCC — — V
IOH=–10 mA 0.9 VCC — — V
IOH=–400 mA
2.4 — — V
Output High Voltage VCC=5 V±10%
VOH1
(PORT 0, ALE, PSEN) IOH=–150 mA 0.75 VCC — — V
IOH=–40 mA 0.9 VCC — — V
Logical 0 Input Current/ VI=0.45 V
Logical 1 Output Current/ IIL / IOH –5 –20 –80 mA
(PORT 1, 2, 3) VO=0.45 V
2
Logical 1 to 0 Transition
ITL VI=2.0 V — –190 –500 mA
Output Current (PORT 1, 2, 3)
Input Leakage Current
ILI VSS < VI < VCC — — ±10 mA 3
(PORT 0 floating, EA)
RESET Pull-down Resistance RRST — 20 40 125 kW
2
Ta=25°C, f=1 MHz
Pin Capacitance CIO — — 10 pF —
(except XTAL1)
Power Down Current IPD — — 1 50 mA 4
282
¡ Semiconductor MSM80C154S/83C154S
VCC 4V 5V 6V
Freq
1 MHz 2.2 3.1 4.1
3 MHz 3.9 5.2 7.0
12 MHz 12.0 16.0 20.0
16 MHz 16.0 20.0 25.0
20 MHz 19.0 25.0 30.0
VCC 4.5 V 5V 6V
Freq
24 MHz 25.0 29.0 35.0
VCC 4V 5V 6V
Freq
1 MHz 0.8 1.2 1.6
3 MHz 1.2 1.7 2.3
12 MHz 3.1 4.4 5.9
16 MHz 3.8 5.5 7.3
20 MHz 4.5 6.4 8.6
VCC 4.5 V 5V 6V
Freq
24 MHz 6.4 7.4 9.8
283
MSM80C154S/83C154S ¡ Semiconductor
DC Characteristics 2
284
¡ Semiconductor MSM80C154S/83C154S
285
MSM80C154S/83C154S ¡ Semiconductor
Measuring circuits
1 2
OUTPUT
OUTPUT
VIH
INPUT
INPUT
(*3)
V A IO V A
VIL
VSS VSS
3 4
OUTPUT
VIH VIH
INPUT
INPUT
(*3)
(*3)
V A
VIL VIL
VSS VSS
286
¡ Semiconductor MSM80C154S/83C154S
AC Characteristics
*1 The variable check is from 0 to 24 MHz when the external check is used.
287
MSM80C154S/83C154S ¡ Semiconductor
tLHLL
ALE
PORT0 A0 to A7 INSTR A0 to A7
IN
tAVIV
288
¡ Semiconductor MSM80C154S/83C154S
289
MSM80C154S/83C154S ¡ Semiconductor
tLHLL tWHLH
ALE
PSEN
tLLDV
tLLWL tRLRH
RD
tRHDZ
tAVLL tLLAX tRLDV tRHDX
tAZRL
PORT 0 INSTR A0 to A7 A0 to A7 DATA IN A0 to A7
IN PCL Rr or DPL PCL
tAVWL
tAVDV
PORT 2 PCH A8 to A15 PCH P2.0 to P2.7 DATA or A8 to A15 DPH A8 to A15 PCH
tLHLL tWHLH
ALE
PSEN
tLLWL tWLWH
WR
tLLAX
tAVLL tQVWH
tWHQX
tQVWX
PORT 0 INSTR A0 to A7 A0 to A7
DATA (ACC) A0 to A7
IN PCL Rr or DPL PCL
tAVWL
A8 to A15 A8 to A15 PCH P2.0 to P2.7 DATA or A8 to A15 DPH A8 to A15 PCH
PORT 2 PCH
290
¡ Semiconductor MSM80C154S/83C154S
291
292
MSM80C154S/83C154S
MACHINE
CYCLE
ALE
tXLXL
SHIFT
CLOCK
tQVXH tXHQX
OUTPUT
DATA
tXHDX
¡ Semiconductor
tXHDV
1.Input/output signal
VOH VOH
VIH VIH
TEST POINT
VIL VIL
VOL VOL
* The input signals in AC test mode are either VOH (logic "1") or VOL (logic "0") input signals
where logic "1" corresponds to a CPU output signal waveform measuring point in excess of
VIH, and logic "0" to a point below VIL.
2.Floating
Floating
VOH VOH
VIH VIH
VIL VIL
VOL VOL
* The port 0 floating interval is measured from the time the port 0 pin voltage drops below VIH
after sinking to GND at 2.4 mA when switching to floating status from a "1" output, and from
the time the port 0 pin voltage exceeds VIL after connecting to a 400 mA source when switching
to floating status from a "0" output.
0.7 VCC
EXTERNAL
OSCILLATOR 0.2 VCC - 0.1
tCHCL tCLCH
SIGNAL tCHCX tCLCX
tCLCL
293
294
CYCLE M1 M1 M2 M1
STEP S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6
Basic timing
1
XTAL 1
Timing Diagram
0
1
ALE
0
MSM80C154S/83C154S
1
PSEN
0
1
RD/WR
0
DPL&Rr
1
PORT-0 PCL PCL PCL ACC & RAM PCL PCL PCL
0
1
,,
PORT-2 PCH PCH PCH PCH DPH & PORT DATA PCH PCH PCH
,,
,,
,,
,,
,,
,,
,,
,,
,,
,,
,,
,,
,,
,,
,,
,,
1
,
,,
,,
,,
,,
,,
,,
,,
,,
,,
,,
,,
,,
,,
CPU¨PORT
,,
,,
,,
,,
,,
,,
0
,,
,,
,,
,,
,
,,
,,
,,
,,
,,
,,
,,
,,
,,
,,
,,
,,
,,
,,
,,
,,
,,
1
,,
,,
,,
,,
,,
,,
,,
,,
,,
PORT OLD DATA
,,
,,
PORT¨CPU
,,
,,
,,
PORT NEW DATA
,
,
,,
,,
,,
,,
,,
0
Empowering Partners
Winning Solutions
Winning Products
Winning Service
Winbond ePaper
R
XC4000E and XC4000X Series Field
Programmable Gate Arrays
XC4000E and XC4000X Series much as 50% from XC4000 values. See “Fast Carry Logic”
on page 18 for more information.
Compared to the XC4000
For readers already familiar with the XC4000 family of Xil- Select-RAM Memory: Edge-Triggered, Synchro-
inx Field Programmable Gate Arrays, the major new fea- nous RAM Modes
tures in the XC4000 Series devices are listed in this The RAM in any CLB can be configured for synchronous,
section. The biggest advantages of XC4000E and edge-triggered, write operation. The read operation is not
XC4000X devices are significantly increased system affected by this change to an edge-triggered write.
speed, greater capacity, and new architectural features,
particularly Select-RAM memory. The XC4000X devices Dual-Port RAM
also offer many new routing features, including special A separate option converts the 16x2 RAM in any CLB into a
high-speed clock buffers that can be used to capture input 16x1 dual-port RAM with simultaneous Read/Write.
data with minimal delay.
The function generators in each CLB can be configured as
Any XC4000E device is pinout- and bitstream-compatible either level-sensitive (asynchronous) single-port RAM,
with the corresponding XC4000 device. An existing edge-triggered (synchronous) single-port RAM, edge-trig-
XC4000 bitstream can be used to program an XC4000E gered (synchronous) dual-port RAM, or as combinatorial
device. However, since the XC4000E includes many new logic.
features, an XC4000E bitstream cannot be loaded into an
XC4000 device. Configurable RAM Content
XC4000X Series devices are not bitstream-compatible with The RAM content can now be loaded at configuration time,
equivalent array size devices in the XC4000 or XC4000E so that the RAM starts up with user-defined data.
families. However, equivalent array size devices, such as
the XC4025, XC4025E, XC4028EX, and XC4028XL, are H Function Generator
6
pinout-compatible. In current XC4000 Series devices, the H function generator
is more versatile than in the original XC4000. Its inputs can
Improvements in XC4000E and XC4000X come not only from the F and G function generators but
also from up to three of the four control input lines. The H
Increased System Speed
function generator can thus be totally or partially indepen-
XC4000E and XC4000X devices can run at synchronous dent of the other two function generators, increasing the
system clock rates of up to 80 MHz, and internal perfor- maximum capacity of the device.
mance can exceed 150 MHz. This increase in performance
over the previous families stems from improvements in both IOB Clock Enable
device processing and system architecture. XC4000 The two flip-flops in each IOB have a common clock enable
Series devices use a sub-micron multi-layer metal process. input, which through configuration can be activated individ-
In addition, many architectural improvements have been ually for the input or output flip-flop or both. This clock
made, as described below. enable operates exactly like the EC pin on the XC4000
The XC4000XL family is a high performance 3.3V family CLB. This new feature makes the IOBs more versatile, and
based on 0.35µ SRAM technology and supports system avoids the need for clock gating.
speeds to 80 MHz.
Output Drivers
PCI Compliance The output pull-up structure defaults to a TTL-like
XC4000 Series -2 and faster speed grades are fully PCI totem-pole. This driver is an n-channel pull-up transistor,
compliant. XC4000E and XC4000X devices can be used to pulling to a voltage one transistor threshold below Vcc, just
implement a one-chip PCI solution. like the XC4000 family outputs. Alternatively, XC4000
Series devices can be globally configured with CMOS out-
Carry Logic puts, with p-channel pull-up transistors pulling to Vcc. Also,
The speed of the carry logic chain has increased dramati- the configurable pull-up resistor in the XC4000 Series is a
cally. Some parameters, such as the delay on the carry p-channel transistor that pulls to Vcc, whereas in the origi-
chain through a single CLB (TBYP), have improved by as nal XC4000 family it is an n-channel transistor that pulls to
a voltage one transistor threshold below Vcc.
The three mode inputs can be individually configured with Latch Capability in CLBs
or without weak pull-up or pull-down resistors after configu-
Storage elements in the XC4000X CLB can be configured
ration.
as either flip-flops or latches. This capability makes the
The PROGRAM input pin has a permanent weak pull-up. FPGA highly synthesis-compatible.
Detailed Functional Description Each CLB contains two storage elements that can be used
to store the function generator outputs. However, the stor-
XC4000 Series devices achieve high speed through age elements and function generators can also be used
advanced semiconductor technology and improved archi- independently. These storage elements can be configured
tecture. The XC4000E and XC4000X support system clock as flip-flops in both XC4000E and XC4000X devices; in the
rates of up to 80 MHz and internal performance in excess XC4000X they can optionally be configured as latches. DIN
of 150 MHz. Compared to older Xilinx FPGA families, can be used as a direct input to either of the two storage
XC4000 Series devices are more powerful. They offer elements. H1 can drive the other through the H function
on-chip edge-triggered and dual-port RAM, clock enables generator. Function generator outputs can also drive two
on I/O flip-flops, and wide-input decoders. They are more outputs independent of the storage element outputs. This
versatile in many applications, especially those involving versatility increases logic capacity and simplifies routing.
RAM. Design cycles are faster due to a combination of
increased routing resources and more sophisticated soft- Thirteen CLB inputs and four CLB outputs provide access
ware. to the function generators and storage elements. These
inputs and outputs connect to the programmable intercon-
Basic Building Blocks nect resources outside the block.
Xilinx user-programmable gate arrays include two major Function Generators
configurable elements: configurable logic blocks (CLBs)
Four independent inputs are provided to each of two func-
and input/output blocks (IOBs).
tion generators (F1 - F4 and G1 - G4). These function gen-
• CLBs provide the functional elements for constructing erators, with outputs labeled F’ and G’, are each capable of
the user’s logic. implementing any arbitrarily defined Boolean function of
• IOBs provide the interface between the package pins four inputs. The function generators are implemented as
and internal signal lines. memory look-up tables. The propagation delay is therefore
independent of the function implemented. 6
Three other types of circuits are also available:
• 3-State buffers (TBUFs) driving horizontal longlines are A third function generator, labeled H’, can implement any
associated with each CLB. Boolean function of its three inputs. Two of these inputs can
• Wide edge decoders are available around the periphery optionally be the F’ and G’ functional generator outputs.
of each device. Alternatively, one or both of these inputs can come from
• An on-chip oscillator is provided. outside the CLB (H2, H0). The third input must come from
outside the block (H1).
Programmable interconnect resources provide routing
paths to connect the inputs and outputs of these config- Signals from the function generators can exit the CLB on
urable elements to the appropriate networks. two outputs. F’ or H’ can be connected to the X output. G’ or
H’ can be connected to the Y output.
The functionality of each circuit block is customized during
configuration by programming internal static memory cells. A CLB can be used to implement any of the following func-
The values stored in these memory cells determine the tions:
logic functions and interconnections implemented in the • any function of up to four variables, plus any second
FPGA. Each of these available circuits is described in this function of up to four unrelated variables, plus any third
section. function of up to three unrelated variables1
• any single function of five variables
Configurable Logic Blocks (CLBs) • any function of four variables together with some
Configurable Logic Blocks implement most of the logic in functions of six variables
an FPGA. The principal CLB elements are shown in • some functions of up to nine variables.
Figure 1. Two 4-input function generators (F and G) offer
Implementing wide functions in a single block reduces both
unrestricted versatility. Most combinatorial logic functions
the number of blocks required and the delay in the signal
need four or fewer inputs. However, a third function gener-
path, achieving both increased capacity and speed.
ator (H) is provided. The H function generator has three
inputs. Either zero, one, or two of these inputs can be the The versatility of the CLB function generators significantly
outputs of F and G; the other input(s) are from outside the improves system speed. In addition, the design-software
CLB. The CLB can, therefore, implement certain functions tools can deal with each function generator independently.
of up to nine variables, like parity check or expand- This flexibility improves cell usage.
able-identity comparison of two sets of four inputs.
1. When three separate functions are generated, one of the function outputs must be captured in a flip-flop internal to the CLB. Only two
unregistered function generator outputs are available from the CLB.
4
C1 • • • C4
H1 D IN /H 2 SR/H 0 EC
G4 S/R Bypass
CONTROL
DIN YQ
G3 LOGIC SD
F' D
FUNCTION G' Q
G'
OF
H'
G2 G1-G4
G1
LOGIC
EC
FUNCTION RD
G'
OF H' H'
F', G', 1
AND Y
H1
F4 Bypass
S/R
CONTROL
DIN XQ
F3 LOGIC SD
F'
FUNCTION F' D Q
G'
OF
H'
F2 F1-F4
F1
EC
RD
K
(CLOCK) 1
H'
X
F'
Multiplexer Controlled
by Configuration Program
X6692
Figure 1: Simplified Block Diagram of XC4000 Series CLB (RAM and Carry Logic functions not shown)
The set/reset state is specified by using the INIT attribute, • EC — Enable Clock
or by placing the appropriate set or reset flip-flop library • SR/H0 — Asynchronous Set/Reset or H function
symbol. generator Input 0
• DIN/H2 — Direct In or H function generator Input 2
SR is active High. It is not invertible within the CLB. • H1 — H function generator Input 1.
Global Set/Reset When the memory function is enabled, the four inputs are:
A separate Global Set/Reset line (not shown in Figure 1) • EC — Enable Clock
sets or clears each storage element during power-up, • WE — Write Enable
re-configuration, or when a dedicated Reset net is driven • D0 — Data Input to F and/or G function generator
active. This global net (GSR) does not compete with other • D1 — Data input to G function generator (16x1 and
16x2 modes) or 5th Address bit (32x1 mode).
6
routing resources; it uses a dedicated distribution network.
Each flip-flop is configured as either globally set or reset in Using FPGA Flip-Flops and Latches
the same way that the local set/reset (SR) is specified.
Therefore, if a flip-flop is set by SR, it is also set by GSR. The abundance of flip-flops in the XC4000 Series invites
Similarly, a reset flip-flop is reset by both SR and GSR. pipelined designs. This is a powerful way of increasing per-
formance by breaking the function into smaller subfunc-
STARTUP
tions and executing them in parallel, passing on the results
through pipeline flip-flops. This method should be seriously
PAD GSR Q2 considered wherever throughput is more important than
GTS Q3 latency.
IBUF
Q1Q4
To include a CLB flip-flop, place the appropriate library
CLK DONEIN
symbol. For example, FDCE is a D-type flip-flop with clock
X5260 enable and asynchronous clear. The corresponding latch
Figure 2: Schematic Symbols for Global Set/Reset symbol (for the XC4000X only) is called LDCE.
In XC4000 Series devices, the flip flops can be used as reg-
GSR can be driven from any user-programmable pin as a isters or shift registers without blocking the function gener-
global reset input. To use this global net, place an input pad ators from performing a different, perhaps unrelated task.
and input buffer in the schematic or HDL code, driving the This ability increases the functional capacity of the devices.
GSR pin of the STARTUP symbol. (See Figure 2.) A spe- The CLB setup time is specified between the function gen-
cific pin location can be assigned to this input using a LOC erator inputs and the clock input K. Therefore, the specified
attribute or property, just as with any other user-program- CLB flip-flop setup time includes the delay through the
mable pad. An inverter can optionally be inserted after the function generator.
input buffer to invert the sense of the Global Set/Reset sig-
nal. Using Function Generators as RAM
Alternatively, GSR can be driven from any internal node. Optional modes for each CLB make the memory look-up
tables in the F’ and G’ function generators usable as an
Data Inputs and Outputs array of Read/Write memory cells. Available modes are
The source of a storage element data input is programma- level-sensitive (similar to the XC4000/A/H families),
ble. It is driven by any of the functions F’, G’, and H’, or by edge-triggered, and dual-port edge-triggered. Depending
the Direct In (DIN) block input. The flip-flops or latches drive on the selected mode, a single CLB can be configured as
the XQ and YQ CLB outputs. either a 16x2, 32x1, or 16x1 bit array.
Supported CLB memory configurations and timing modes The selected timing mode applies to both function genera-
for single- and dual-port modes are shown in Table 3. tors within a CLB when both are configured as RAM.
XC4000 Series devices are the first programmable logic The number of read ports is also programmable:
devices with edge-triggered (synchronous) and dual-port
• Single Port: each function generator has a common
RAM accessible to the user. Edge-triggered RAM simpli-
read and write port
fies system timing. Dual-port RAM doubles the effective
• Dual Port: both function generators are configured
throughput of FIFO applications. These features can be
together as a single 16x1 dual-port RAM with one write
individually programmed in any XC4000 Series CLB.
port and two read ports. Simultaneous read and write
Advantages of On-Chip and Edge-Triggered RAM operations to the same or different addresses are
supported.
The on-chip RAM is extremely fast. The read access time is
the same as the logic delay. The write access time is RAM configuration options are selected by placing the
slightly slower. Both access times are much faster than appropriate library symbol.
any off-chip solution, because they avoid I/O delays.
Choosing a RAM Configuration Mode
Edge-triggered RAM, also called synchronous RAM, is a
The appropriate choice of RAM mode for a given design
feature never before available in a Field Programmable
should be based on timing and resource requirements,
Gate Array. The simplicity of designing with edge-triggered
desired functionality, and the simplicity of the design pro-
RAM, and the markedly higher achievable performance,
cess. Recommended usage is shown in Table 4.
add up to a significant improvement over existing devices
with on-chip RAM. The difference between level-sensitive, edge-triggered,
and dual-port RAM is only in the write operation. Read
Three application notes are available from Xilinx that dis-
operation and timing is identical for all modes of operation.
cuss edge-triggered RAM: “XC4000E Edge-Triggered and
Dual-Port RAM Capability,” “Implementing FIFOs in
XC4000E RAM,” and “Synchronous and Asynchronous Table 4: RAM Mode Selection
FIFO Designs.” All three application notes apply to both Dual-Port
XC4000E and XC4000X RAM. Level-Sens Edge-Trigg Edge-Trigg
itive ered ered
Table 3: Supported RAM Modes Use for New
No Yes Yes
Designs?
16 16 32 Edge- Level-
x x x Triggered Sensitive Size (16x1,
1/2 CLB 1/2 CLB 1 CLB
1 2 1 Timing Timing Registered)
Single-Port √ √ √ √ √ Simultaneous
No No Yes
Read/Write
Dual-Port √ √
Relative 2X (4X
X 2X
Performance effective)
RAM Configuration Options
The function generators in any CLB can be configured as RAM Inputs and Outputs
RAM arrays in the following sizes:
The F1-F4 and G1-G4 inputs to the function generators act
• Two 16x1 RAMs: two data inputs and two data outputs as address lines, selecting a particular memory cell in each
with identical or, if preferred, different addressing for look-up table.
each RAM
• One 32x1 RAM: one data input and one data output. The functionality of the CLB control signals changes when
the function generators are configured as RAM. The
One F or G function generator can be configured as a 16x1 DIN/H2, H1, and SR/H0 lines become the two data inputs
RAM while the other function generators are used to imple- (D0, D1) and the Write Enable (WE) input for the 16x2
ment any function of up to 5 inputs. memory. When the 32x1 configuration is selected, D1 acts
Additionally, the XC4000 Series RAM may have either of as the fifth address bit and D0 is the data input.
two timing modes: The contents of the memory cell(s) being addressed are
• Edge-Triggered (Synchronous): data written by the available at the F’ and G’ function-generator outputs. They
designated edge of the CLB clock. WE acts as a true can exit the CLB through its X and Y outputs, or can be cap-
clock enable. tured in the CLB flip-flop(s).
• Level-Sensitive (Asynchronous): an external WE signal Configuring the CLB function generators as Read/Write
acts as the write strobe. memory does not affect the functionality of the other por-
tions of the CLB, with the exception of the redefinition of the nals. An internal write pulse is generated that performs the
control signals. In 16x2 and 16x1 modes, the H’ function write. See Figure 4 and Figure 5 for block diagrams of a
generator can be used to implement Boolean functions of CLB configured as 16x2 and 32x1 edge-triggered, sin-
F’, G’, and D1, and the D flip-flops can latch the F’, G’, H’, or gle-port RAM.
D0 signals. The relationships between CLB pins and RAM inputs and
Single-Port Edge-Triggered Mode outputs for single-port, edge-triggered mode are shown in
Table 5.
Edge-triggered (synchronous) RAM simplifies timing
requirements. XC4000 Series edge-triggered RAM timing The Write Clock input (WCLK) can be configured as active
operates like writing to a data register. Data and address on either the rising edge (default) or the falling edge. It uses
are presented. The register is enabled for writing by a logic the same CLB pin (K) used to clock the CLB flip-flops, but it
High on the write enable input, WE. Then a rising or falling can be independently inverted. Consequently, the RAM
clock edge loads the data into the register, as shown in output can optionally be registered within the same CLB
Figure 3. either by the same clock edge as the RAM, or by the oppo-
site edge of this clock. The sense of WCLK applies to both
TWPS function generators in the CLB when both are configured
WCLK (K) as RAM.
TWSS TWHS The WE pin is active-High and is not invertible within the
CLB.
WE
Note: The pulse following the active edge of WCLK (TWPS
TDSS TDHS in Figure 3) must be less than one millisecond wide. For
most applications, this requirement is not overly restrictive;
DATA IN however, it must not be forgotten. Stopping WCLK at this 6
point in the write cycle could result in excessive current and
TASS TAHS
even damage to the larger devices if many CLBs are con-
ADDRESS
figured as edge-triggered RAM.
Table 5: Single-Port Edge-Triggered RAM Signals
TILO TILO
TWOS RAM Signal CLB Pin Function
D D0 or D1 (16x2, Data In
DATA OUT OLD NEW 16x1), D0 (32x1)
X6461
A[3:0] F1-F4 or G1-G4 Address
Figure 3: Edge-Triggered RAM Write Timing A[4] D1 (32x1) Address
WE WE Write Enable
Complex timing relationships between address, data, and WCLK K Clock
write enable signals are not required, and the external write SPO F’ or G’ Single Port Out
enable pulse becomes a simple clock enable. The active (Data Out) (Data Out)
edge of WCLK latches the address, input data, and WE sig-
4
C1 • • • C4
WE D1 D0 EC
DIN
WRITE 16-LATCH
DECODER ARRAY MUX G'
4 4
G1 • • • G4
1 of 16
LATCH
ENABLE
READ
WRITE PULSE ADDRESS
DIN
WRITE 16-LATCH
DECODER ARRAY MUX F'
4 4
F1 • • • F4
1 of 16
LATCH
ENABLE
K
(CLOCK) READ
WRITE PULSE ADDRESS
X6752
4
C1 • • • C4
EC
WE D1/A4 D0 EC
DIN
WRITE 16-LATCH
DECODER ARRAY MUX G'
G1 • • • G4 4 4
F1 • • • F4 1 of 16
LATCH
ENABLE
READ
WRITE PULSE ADDRESS
H'
DIN
WRITE 16-LATCH
DECODER ARRAY MUX F'
4 4
1 of 16
LATCH
ENABLE
K
(CLOCK) READ
WRITE PULSE ADDRESS
X6754
D D D Q Registered DPO
delay on the WE signal and the address lines must be care-
DPRA[3:0] AR[3:0] fully verified to ensure that WE does not become active
AW[3:0] until after the address lines have settled, and that WE goes
inactive before the address lines change again. The data
G Function Generator
must be stable before and after the falling edge of WE.
SPO (Single Port Out)
4
C1 • • • C4
WE D1 D0 EC
DIN
WRITE 16-LATCH
DECODER ARRAY MUX G'
4
1 of 16
LATCH
ENABLE
READ
4 WRITE PULSE ADDRESS
G1 • • • G4
DIN
WRITE 16-LATCH
DECODER ARRAY MUX F'
4 4
F1 • • • F4 1 of 16
LATCH
ENABLE
K
READ
(CLOCK) WRITE PULSE ADDRESS
X6748
Figure 8 shows the write timing for level-sensitive, sin- attached to the RAM or ROM symbol, as described in the
gle-port RAM. schematic library guide. If not defined, all RAM contents
The relationships between CLB pins and RAM inputs and are initialized to all zeros, by default.
outputs for single-port level-sensitive mode are shown in RAM initialization occurs only during configuration. The
Table 7. RAM content is not affected by Global Set/Reset.
Figure 9 and Figure 10 show block diagrams of a CLB con- Table 7: Single-Port Level-Sensitive RAM Signals
figured as 16x2 and 32x1 level-sensitive, single-port RAM.
RAM Signal CLB Pin Function
Initializing RAM at Configuration D D0 or D1 Data In
A[3:0] F1-F4 or G1-G4 Address
Both RAM and ROM implementations of the XC4000 WE WE Write Enable
Series devices are initialized during configuration. The ini- O F’ or G’ Data Out
tial contents are defined via an INIT attribute or property
T WC
ADDRESS
TAS T WP T AH
WRITE ENABLE
T DS T DH
DATA IN REQUIRED
X6462
4
C1 • • • C4
WE D1 D0 EC
DIN
Enable
WRITE 16-LATCH
DECODER ARRAY MUX G'
4
G1 • • • G4
1 of 16
4
READ ADDRESS
DIN
Enable
WRITE 16-LATCH
DECODER ARRAY MUX F'
4
F1 • • • F4
1 of 16
4
X6746 READ ADDRESS
6
Figure 9: 16x2 (or 16x1) Level-Sensitive Single-Port RAM
4
C1 • • • C4
WE D1/A4 D0 EC
DIN
Enable
WRITE 16-LATCH
DECODER ARRAY MUX G'
G1 • • • G4 4
F 1 • • • F4 1 of 16
4
READ ADDRESS
H'
DIN
Enable
WRITE 16-LATCH
DECODER ARRAY MUX F'
4
1 of 16
4
READ ADDRESS X6749
Figure 10: 32x1 Level-Sensitive Single-Port RAM (F and G addresses are identical)
C OUT C IN DOWN D IN
CARRY
LOGIC
Y
G H
CARRY
G4
G3
G
G2 DIN
H S/R
G D Q YQ
F
G1
EC
COUT0
6
H1 H
DIN
F H S/R
CARRY G D Q XQ
F
EC
F4
F3
F
F2
H
F1
X
F
X6699
Figure 13: Fast Carry Logic in XC4000E CLB (shaded area not present in XC4000X)
C OUT
M
G1
M
1
0 1 G2
I 0
G4
G3
C OUT0
TO
M FUNCTION
GENERATORS
F2
M
1
0 1
F1
M 0
F4
M 0 1
M 3
F3 1 M
M 0
M 1 0
C IN UP
X2000
C IN DOWN
Input/Output Blocks (IOBs) The choice is made by placing the appropriate library sym-
bol. For example, IFD is the basic input flip-flop (rising edge
User-configurable input/output blocks (IOBs) provide the triggered), and ILD is the basic input latch (transpar-
interface between external package pins and the internal ent-High). Variations with inverted clocks are available, and
logic. Each IOB controls one package pin and can be con- some combinations of latches and flip-flops can be imple-
figured for input, output, or bidirectional signals.
mented in a single IOB, as described in the XACT Libraries
Figure 15 shows a simplified block diagram of the Guide.
XC4000E IOB. A more complete diagram which includes
The XC4000E inputs can be globally configured for either
the boundary scan logic of the XC4000E IOB can be found
TTL (1.2V) or 5.0 volt CMOS thresholds, using an option in
in Figure 40 on page 43, in the “Boundary Scan” section. the bitstream generation software. There is a slight input
The XC4000X IOB contains some special features not hysteresis of about 300mV. The XC4000E output levels are
included in the XC4000E IOB. These features are high- also configurable; the two global adjustments of input
lighted in a simplified block diagram found in Figure 16, and threshold and output level are independent.
discussed throughout this section. When XC4000X special
Inputs on the XC4000XL are TTL compatible and 3.3V
features are discussed, they are clearly identified in the
CMOS compatible. Outputs on the XC4000XL are pulled to
text. Any feature not so identified is present in both the 3.3V positive supply.
XC4000E and XC4000X devices.
The inputs of XC4000 Series 5-Volt devices can be driven
IOB Input Signals by the outputs of any 3.3-Volt device, if the 5-Volt inputs are
Two paths, labeled I1 and I2 in Figure 15 and Figure 16, in TTL mode.
bring input signals into the array. Inputs also connect to an Supported sources for XC4000 Series device inputs are
input register that can be programmed as either an shown in Table 8.
edge-triggered flip-flop or a level-sensitive latch.
T
Flip-Flop
D Q
Out Output
CE Buffer
Pad
Output
Clock
I1
Flip- Input
Flop/ Buffer
Latch
I2
Q D
Delay
Clock
Enable CE
Input
Clock
X6704
6
Figure 15: Simplified Block Diagram of XC4000E IOB
Passive
Slew Rate Pull-Up/
Control Pull-Down
T
Output MUX
0
1
Flip-Flop
Out D Q
Output
CE Buffer
Pad
I1
Flip-Flop/
Latch
I2 Delay Delay
Q D
Q D
Latch
Clock Enable CE Fast G
Capture
Latch
Input Clock
X5984
Figure 16: Simplified Block Diagram of XC4000X IOB (shaded areas indicate differences from XC4000E)
Table 8: Supported Sources for XC4000 Series Device Optional Delay Guarantees Zero Hold Time
Inputs The data input to the register can optionally be delayed by
XC4000E/EX XC4000XL several nanoseconds. With the delay enabled, the setup
Series Inputs Series Inputs time of the input flip-flop is increased so that normal clock
Source 5 V, 5 V, 3.3 V routing does not result in a positive hold-time requirement.
TTL CMOS CMOS A positive hold time requirement can lead to unreliable,
temperature- or processing-dependent operation.
Any device, Vcc = 3.3 V,
√ √ The input flip-flop setup time is defined between the data
CMOS outputs
Unreli measured at the device I/O pin and the clock input at the
XC4000 Series, Vcc = 5 V,
√ -able √ IOB (not at the clock pin). Any routing delay from the device
TTL outputs
Data clock pin to the clock input of the IOB must, therefore, be
Any device, Vcc = 5 V,
√ √ subtracted from this setup time to arrive at the real setup
TTL outputs (Voh ≤ 3.7 V)
time requirement relative to the device pins. A short speci-
Any device, Vcc = 5 V,
√ √ √ fied setup time might, therefore, result in a negative setup
CMOS outputs time at the device pins, i.e., a positive hold-time require-
XC4000XL 5-Volt Tolerant I/Os ment.
The I/Os on the XC4000XL are fully 5-volt tolerant even When a delay is inserted on the data line, more clock delay
though the VCC is 3.3 volts. This allows 5 V signals to can be tolerated without causing a positive hold-time
directly connect to the XC4000XL inputs without damage, requirement. Sufficient delay eliminates the possibility of a
as shown in Table 8. In addition, the 3.3 volt VCC can be data hold-time requirement at the external pin. The maxi-
applied before or after 5 volt signals are applied to the I/Os. mum delay is therefore inserted as the default.
This makes the XC4000XL immune to power supply The XC4000E IOB has a one-tap delay element: either the
sequencing problems. delay is inserted (default), or it is not. The delay guarantees
a zero hold time with respect to clocks routed through any
Registered Inputs
of the XC4000E global clock buffers. (See “Global Nets and
The I1 and I2 signals that exit the block can each carry Buffers (XC4000E only)” on page 35 for a description of the
either the direct or registered input signal. global clock buffers in the XC4000E.) For a shorter input
The input and output storage elements in each IOB have a register setup time, with non-zero hold, attach a NODELAY
common clock enable input, which, through configuration, attribute or property to the flip-flop.
can be activated individually for the input or output flip-flop, The XC4000X IOB has a two-tap delay element, with
or both. This clock enable operates exactly like the EC pin choices of a full delay, a partial delay, or no delay. The
on the XC4000 Series CLB. It cannot be inverted within the attributes or properties used to select the desired delay are
IOB. shown in Table 10. The choices are no added attribute,
The storage element behavior is shown in Table 9. MEDDELAY, and NODELAY. The default setting, with no
added attribute, ensures no hold time with respect to any of
Table 9: Input Register Functionality the XC4000X clock buffers, including the Global Low-Skew
(active rising edge is shown) buffers. MEDDELAY ensures no hold time with respect to
Clock the Global Early buffers. Inputs with NODELAY may have a
Mode Clock D Q positive hold time with respect to all clock buffers. For a
Enable
description of each of these buffers, see “Global Nets and
Power-Up or X X X SR
Buffers (XC4000X only)” on page 37.
GSR
Flip-Flop __/ 1* D D Table 10: XC4000X IOB Input Delay Element
0 X X Q Value When to Use
Latch 1 1* X Q full delay Zero Hold with respect to Global
0 1* D D (default, no Low-Skew Buffer, Global Early Buffer
Both X 0 X Q attribute added)
Legend: MEDDELAY Zero Hold with respect to Global Early
X Don’t care Buffer
__/ Rising edge
SR Set or Reset value. Reset is default. NODELAY Short Setup, positive Hold time
0* Input is Low or unconnected (default value)
1* Input is High or unconnected (default value)
Additional Input Latch for Fast Capture (XC4000X only) the desired delay based on the discussion in the previous
The XC4000X IOB has an additional optional latch on the subsection.
input. This latch, as shown in Figure 16, is clocked by the IOB Output Signals
output clock — the clock used for the output flip-flop —
rather than the input clock. Therefore, two different clocks Output signals can be optionally inverted within the IOB,
can be used to clock the two input storage elements. This and can pass directly to the pad or be stored in an
additional latch allows the very fast capture of input data, edge-triggered flip-flop. The functionality of this flip-flop is
which is then synchronized to the internal clock by the IOB shown in Table 11.
flip-flop or latch. An active-High 3-state signal can be used to place the out-
To use this Fast Capture technique, drive the output clock put buffer in a high-impedance state, implementing 3-state
pin (the Fast Capture latching signal) from the output of one outputs or bidirectional I/O. Under configuration control, the
of the Global Early buffers supplied in the XC4000X. The output (OUT) and output 3-state (T) signals can be
second storage element should be clocked by a Global inverted. The polarity of these signals is independently con-
Low-Skew buffer, to synchronize the incoming data to the figured for each IOB.
internal logic. (See Figure 17.) These special buffers are The 4-mA maximum output current specification of many
described in “Global Nets and Buffers (XC4000X only)” on FPGAs often forces the user to add external buffers, which
page 37. are especially cumbersome on bidirectional I/O lines. The
The Fast Capture latch (FCL) is designed primarily for use XC4000E and XC4000EX/XL devices solve many of these
with a Global Early buffer. For Fast Capture, a single clock problems by providing a guaranteed output sink current of
signal is routed through both a Global Early buffer and a 12 mA. Two adjacent outputs can be interconnected exter-
Global Low-Skew buffer. (The two buffers share an input nally to sink up to 24 mA. The XC4000E and XC4000EX/XL
pad.) The Fast Capture latch is clocked by the Global Early FPGAs can thus directly drive buses on a printed circuit
buffer, and the standard IOB flip-flop or latch is clocked by board. 6
the Global Low-Skew buffer. This mode is the safest way to By default, the output pull-up structure is configured as a
use the Fast Capture latch, because the clock buffers on TTL-like totem-pole. The High driver is an n-channel pull-up
both storage elements are driven by the same pad. There is transistor, pulling to a voltage one transistor threshold
no external skew between clock pads to create potential below Vcc. Alternatively, the outputs can be globally config-
problems. ured as CMOS drivers, with p-channel pull-up transistors
To place the Fast Capture latch in a design, use one of the pulling to Vcc. This option, applied using the bitstream gen-
special library symbols, ILFFX or ILFLX. ILFFX is a trans- eration software, applies to all outputs on the device. It is
parent-Low Fast Capture latch followed by an active-High not individually programmable. In the XC4000XL, all out-
input flip-flop. ILFLX is a transparent-Low Fast Capture puts are pulled to the positive supply rail.
latch followed by a transparent-High input latch. Any of the
clock inputs can be inverted before driving the library ele- Table 11: Output Flip-Flop Functionality (active rising
ment, and the inverter is absorbed into the IOB. If a single edge is shown)
BUFG output is used to drive both clock inputs, the soft-
Clock
ware automatically runs the clock through both a Global
Mode Clock Enable T D Q
Low-Skew buffer and a Global Early buffer, and clocks the
Fast Capture latch appropriately. Power-Up X X 0* X SR
or GSR
Figure 16 on page 21 also shows a two-tap delay on the
X 0 0* X Q
input. By default, if the Fast Capture latch is used, the Xilinx
software assumes a Global Early buffer is driving the clock, Flip-Flop __/ 1* 0* D D
and selects MEDDELAY to ensure a zero hold time. Select X X 1 X Z
0 X 0* X Q
ILFFX Legend:
X Don’t care
IPAD D Q to internal __/ Rising edge
logic SR Set or Reset value. Reset is default.
0* Input is Low or unconnected (default value)
GF 1* Input is High or unconnected (default value)
BUFGE Z 3-state
CE
C
IPAD
BUFGLS
X9013
Figure 17: Examples Using XC4000X FCL
Any XC4000 Series 5-Volt device with its outputs config- Power/Ground pin pairs are connected to special Power
ured in TTL mode can drive the inputs of any typical and Ground planes within the packages, to reduce ground
3.3-Volt device. (For a detailed discussion of how to inter- bounce. Therefore, the maximum total capacitive load is
face between 5 V and 3.3 V devices, see the 3V Products 300 pF between each external Power/Ground pin pair.
section of The Programmable Logic Data Book.) Maximum loading may vary for the low-voltage devices.
Supported destinations for XC4000 Series device outputs For slew-rate limited outputs this total is two times larger for
are shown in Table 12. each device type: 400 pF for XC4000E devices and 600 pF
An output can be configured as open-drain (open-collector) for XC4000X devices. This maximum capacitive load
by placing an OBUFT symbol in a schematic or HDL code, should not be exceeded, as it can result in ground bounce
then tying the 3-state pin (T) to the output signal, and the of greater than 1.5 V amplitude and more than 5 ns dura-
input pin (I) to Ground. (See Figure 18.) tion. This level of ground bounce may cause undesired
transient behavior on an output, or in the internal logic. This
Table 12: Supported Destinations for XC4000 Series restriction is common to all high-speed digital ICs, and is
Outputs not particular to Xilinx or the XC4000 Series.
XC4000 Series XC4000 Series devices have a feature called “Soft
Outputs Start-up,” designed to reduce ground bounce when all out-
Destination 3.3 V, 5 V, 5 V, puts are turned on simultaneously at the end of configura-
CMOS TTL CMOS tion. When the configuration process is finished and the
Any typical device, Vcc = 3.3 V, √ √ some1 device starts up, the first activation of the outputs is auto-
CMOS-threshold inputs matically slew-rate limited. Immediately following the initial
activation of the I/O, the slew rate of the individual outputs
Any device, Vcc = 5 V, √ √ √
is determined by the individual configuration option for each
TTL-threshold inputs
IOB.
Any device, Vcc = 5 V, Unreliable √
CMOS-threshold inputs Data Global Three-State
1. Only if destination device has 5-V tolerant inputs A separate Global 3-State line (not shown in Figure 15 or
Figure 16) forces all FPGA outputs to the high-impedance
state, unless boundary scan is enabled and is executing an
EXTEST instruction. This global net (GTS) does not com-
OPAD pete with other routing resources; it uses a dedicated distri-
OBUFT bution network.
X6702
Figure 18: Open-Drain Output GTS can be driven from any user-programmable pin as a
global 3-state input. To use this global net, place an input
Output Slew Rate pad and input buffer in the schematic or HDL code, driving
the GTS pin of the STARTUP symbol. A specific pin loca-
The slew rate of each output buffer is, by default, reduced, tion can be assigned to this input using a LOC attribute or
to minimize power bus transients when switching non-criti- property, just as with any other user-programmable pad. An
cal signals. For critical signals, attach a FAST attribute or inverter can optionally be inserted after the input buffer to
property to the output buffer or flip-flop. invert the sense of the Global 3-State signal. Using GTS is
For XC4000E devices, maximum total capacitive load for similar to GSR. See Figure 2 on page 11 for details.
simultaneous fast mode switching in the same direction is Alternatively, GTS can be driven from any internal node.
200 pF for all package pins between each Power/Ground
pin pair. For XC4000X devices, additional internal
or clear on reset and after configuration. Other than the glo- Standard 3-State Buffer
bal GSR net, no user-controlled set/reset signal is available All three pins are used. Place the library element BUFT.
to the I/O flip-flops. The choice of set or clear applies to Connect the input to the I pin and the output to the O pin.
both the initial state of the flip-flop and the response to the The T pin is an active-High 3-state (i.e. an active-Low
Global Set/Reset pulse. See “Global Set/Reset” on enable). Tie the T pin to Ground to implement a standard
page 11 for a description of how to use GSR. buffer.
JTAG Support Wired-AND with Input on the I Pin
Embedded logic attached to the IOBs contains test struc- The buffer can be used as a Wired-AND. Use the WAND1
tures compatible with IEEE Standard 1149.1 for boundary library symbol, which is essentially an open-drain buffer.
scan testing, permitting easy chip and board-level testing. WAND4, WAND8, and WAND16 are also available. See the
More information is provided in “Boundary Scan” on XACT Libraries Guide for further information.
page 42.
The T pin is internally tied to the I pin. Connect the input to
Three-State Buffers the I pin and the output to the O pin. Connect the outputs of
all the WAND1s together and attach a PULLUP symbol.
A pair of 3-state buffers is associated with each CLB in the
array. (See Figure 27 on page 30.) These 3-state buffers Wired OR-AND
can be used to drive signals onto the nearest horizontal
longlines above and below the CLB. They can therefore be The buffer can be configured as a Wired OR-AND. A High
used to implement multiplexed or bidirectional buses on the level on either input turns off the output. Use the
horizontal longlines, saving logic resources. Programmable WOR2AND library symbol, which is essentially an
pull-up resistors attached to these longlines help to imple- open-drain 2-input OR gate. The two input pins are func-
ment a wide wired-AND function. tionally equivalent. Attach the two inputs to the I0 and I1
pins and tie the output to the O pin. Tie the outputs of all the
The buffer enable is an active-High 3-state (i.e. an WOR2ANDs together and attach a PULLUP symbol.
active-Low enable), as shown in Table 13.
Three-State Buffer Examples
Another 3-state buffer with similar access is located near
each I/O block along the right and left edges of the array. Figure 21 shows how to use the 3-state buffers to imple-
(See Figure 33 on page 34.) ment a wired-AND function. When all the buffer inputs are
High, the pull-up resistor(s) provide the High output.
The horizontal longlines driven by the 3-state buffers have
a weak keeper at each end. This circuit prevents undefined Figure 22 shows how to use the 3-state buffers to imple-
floating levels. However, it is overridden by any driver, even ment a multiplexer. The selection is accomplished by the
a pull-up resistor. buffer 3-state signal.
Special longlines running along the perimeter of the array Pay particular attention to the polarity of the T pin when
can be used to wire-AND signals coming from nearby IOBs using these buffers in a design. Active-High 3-state (T) is
or from internal longlines. These longlines form the wide identical to an active-Low output enable, as shown in
edge decoders discussed in “Wide Edge Decoders” on Table 13.
page 27. Table 13: Three-State Buffer Functionality
Three-State Buffer Modes IN T OUT
The 3-state buffers can be configured in three modes: X 1 Z
• Standard 3-state buffer IN 0 IN
• Wired-AND with input on the I pin
• Wired OR-AND
P
Z=D ●D ● (D +D ) ● (D +D ) U
A B C D E F U
L P
L
D D
C E
D D D D
A B D F
WAND1 WAND1
WOR2AND WOR2AND
X6465
Z = DA • A + D B • B + D C • C + D N • N
~100 kΩ
DA DB DC DN
BUFT BUFT BUFT BUFT
A B C N
X6466
"Weak Keeper"
Figure 22: 3-State Buffers Implement a Multiplexer
device. F500K
F16K
The decoder outputs can drive CLB inputs, so they can be
F490
combined with other logic to form a PAL-like AND/OR struc-
ture. The decoder outputs can also be routed directly to the F15
chip outputs. For fastest speed, the output should be on the X6703
The oscillator output is optionally available after configura- • Global routing consists of dedicated networks primarily
tion. Any two of four resynchronized taps of a built-in divider designed to distribute clocks throughout the device with
are also available. These taps are at the fourth, ninth, four- minimum delay and skew. Global routing can also be
teenth and nineteenth bits of the divider. Therefore, if the used for other high-fanout signals.
primary oscillator output is running at the nominal 8 MHz, Five interconnect types are distinguished by the relative
the user has access to an 8 MHz clock, plus any two of 500 length of their segments: single-length lines, double-length
kHz, 16kHz, 490Hz and 15Hz (up to 10% lower for low-volt- lines, quad and octal lines (XC4000X only), and longlines.
age devices). These frequencies can vary by as much as In the XC4000X, direct connects allow fast data flow
-50% or +25%. between adjacent CLBs, and between IOBs and CLBs.
These signals can be accessed by placing the OSC4 Extra routing is included in the IOB pad ring. The XC4000X
library element in a schematic or in HDL code (see also includes a ring of octal interconnect lines near the
Figure 24). IOBs to improve pin-swapping and routing to locked pins.
The oscillator is automatically disabled after configuration if XC4000E/X devices include two types of global buffers.
the OSC4 symbol is not used in the design. These global buffers have different properties, and are
intended for different purposes. They are discussed in
Programmable Interconnect detail later in this section.
All internal connections are composed of metal segments
with programmable switching points and switching matrices CLB Routing Connections
to implement the desired routing. A structured, hierarchical A high-level diagram of the routing resources associated
matrix of routing resources is provided to achieve efficient with one CLB is shown in Figure 25. The shaded arrows
automated routing. represent routing present only in XC4000X devices.
The XC4000E and XC4000X share a basic interconnect Table 14 shows how much routing of each type is available
structure. XC4000X devices, however, have additional rout- in XC4000E and XC4000X CLB arrays. Clearly, very large
ing not available in the XC4000E. The extra routing designs, or designs with a great deal of interconnect, will
resources allow high utilization in high-capacity devices. All route more easily in the XC4000X. Smaller XC4000E
XC4000X-specific routing resources are clearly identified designs, typically requiring significantly less interconnect,
throughout this section. Any resources not identified as do not require the additional routing.
XC4000X-specific are present in all XC4000 Series
devices. Figure 27 on page 30 is a detailed diagram of both the
XC4000E and the XC4000X CLB, with associated routing.
This section describes the varied routing resources avail- The shaded square is the programmable switch matrix,
able in XC4000 Series devices. The implementation soft- present in both the XC4000E and the XC4000X. The
ware automatically assigns the appropriate resources L-shaped shaded area is present only in XC4000X devices.
based on the density and timing requirements of the As shown in the figure, the XC4000X block is essentially an
design. XC4000E block with additional routing.
Interconnect Overview CLB inputs and outputs are distributed on all four sides,
providing maximum routing flexibility. In general, the entire
There are several types of interconnect. architecture is symmetrical and regular. It is well suited to
• CLB routing is associated with each row and column of established placement and routing algorithms. Inputs, out-
the CLB array. puts, and function generators can freely swap positions
• IOB routing forms a ring (called a VersaRing) around within a CLB to avoid routing congestion during the place-
the outside of the CLB array. It connects the I/O with the ment and routing operation.
internal logic blocks.
Quad
Single
Double
Long
Direct
CLB Connect
Long
x5994
Figure 25: High-Level Routing Diagram of XC4000 Series CLB (shaded arrows indicate XC4000X only)
6
Table 14: Routing per CLB in XC4000 Series Devices
e
es
e
bl
bl
gl
ou
XC4000E XC4000X
ou
in
D
S
D
Vertical Horizontal Vertical Horizontal
Singles 8 8 8 8
Double
Doubles 4 4 4 4
Quads 0 0 12 12
Singles
Longlines 6 6 10 6
Six Pass Transistors
Direct 0 0 2 2 Per Switch Matrix
Interconnect Point
Connects Double
Globals 4 0 8 0
X6600
Carry Logic 2 0 1 0
Total 24 18 45 32 Figure 26: Programmable Switch Matrix (PSM)
QUAD
DOUBLE
SINGLE
DOUBLE
LONG
F4 C4 G4
YQ
Y DIRECT
G1
C1
F1
CLB G3
C3 FEEDBACK
F3
K
X
XQ
F2 C2 G2
LONG
LO G LO D D LO G D
LO O O LO IR
Q N N U SI U N BA EC FE
U G BA G BL N BL G
AD L E G E L T ED
LE BA
C
K
XC4000X only
Figure 27: Detail of Programmable Interconnect Associated with XC4000 Series CLB
Doubles
CLB CLB CLB
Doubles
PSM PSM
X6601
Programmable Switch Matrices (PSMs) Figure 29: Quad Lines (XC4000X only)
Double-Length Lines and up to two independent outputs. Only one of the inde-
The double-length lines consist of a grid of metal segments, pendent inputs can be buffered. 6
each twice as long as the single-length lines: they run past The place and route software automatically uses the timing
two CLBs before entering a switch matrix. Double-length requirements of the design to determine whether or not a
lines are grouped in pairs with the switch matrices stag- quad line signal should be buffered. A heavily loaded signal
gered, so that each line goes through a switch matrix at is typically buffered, while a lightly loaded one is not. One
every other row or column of CLBs (see Figure 28). scenario is to alternate buffers and pass transistors. This
There are four vertical and four horizontal double-length allows both vertical and horizontal quad lines to be buffered
lines associated with each CLB. These lines provide faster at alternating buffered switch matrices.
signal routing over intermediate distances, while retaining Due to the buffered switch matrices, quad lines are very
routing flexibility. Double-length lines are connected by way fast. They provide the fastest available method of routing
of the programmable switch matrices. Routing connectivity heavily loaded signals for long distances across the device.
is shown in Figure 27.
Longlines
Quad Lines (XC4000X only)
Longlines form a grid of metal interconnect segments that
XC4000X devices also include twelve vertical and twelve run the entire length or width of the array. Longlines are
horizontal quad lines per CLB row and column. Quad lines intended for high fan-out, time-critical signal nets, or nets
are four times as long as the single-length lines. They are that are distributed over long distances. In XC4000X
interconnected via buffered switch matrices (shown as dia- devices, quad lines are preferred for critical nets, because
monds in Figure 27 on page 30). Quad lines run past four the buffered switch matrices make them faster for high
CLBs before entering a buffered switch matrix. They are fan-out nets.
grouped in fours, with the buffered switch matrices stag-
gered, so that each line goes through a buffered switch Two horizontal longlines per CLB can be driven by 3-state
matrix at every fourth CLB location in that row or column. or open-drain drivers (TBUFs). They can therefore imple-
(See Figure 29.) ment unidirectional or bidirectional buses, wide multiplex-
ers, or wired-AND functions. (See “Three-State Buffers” on
The buffered switch matrixes have four pins, one on each page 26 for more details.)
edge. All of the pins are bidirectional. Any pin can drive any
or all of the other pins. Each horizontal longline driven by TBUFs has either two
(XC4000E) or eight (XC4000X) pull-up resistors. To acti-
Each buffered switch matrix contains one buffer and six vate these resistors, attach a PULLUP symbol to the
pass transistors. It resembles the programmable switch long-line net. The software automatically activates the
matrix shown in Figure 26, with the addition of a program- appropriate number of pull-ups. There is also a weak
mable buffer. There can be up to two independent inputs keeper at each end of these two horizontal longlines. This
IOB
IOB
IOB
IOB
IOB
~ ~
~
IOB IOB
CLB CLB CLB
~
IOB IOB
~ ~
~ ~ ~ ~
~ ~ ~ ~
~ ~
~ ~
~
IOB IOB
CLB CLB CLB
~
IOB IOB
IOB
IOB
IOB
IOB
IOB
IOB
X6603
WED
IOB
Quad
WED
Single
Double
INTERCONNECT
Long
Direct
Connect
Long
IOB
WED
6
Direct Edge Double Long Global Octal
Connect Decode Clock
X5995
Figure 31: High-Level Routing Diagram of XC4000 Series VersaRing (Left Edge)
WED = Wide Edge Decoder, IOB = I/O Block (shaded arrows indicate XC4000X only)
IOB IOB
IOB IOB
X9015
QUAD
T
O
DOUBLE
C
SINGLE L
B
DOUBLE
LONG
A
R
R
IOB
A
DECODER
I1 I2
IK
OK
T
CE
O
DIRECT
Y
DECODER
IOB
T O
OK CE
DECODER
IK
I1 I2
LONG
G
LO
ED EC
LO
D
N
G OD
D
O
BA
G
E E
O
C
U
TA
L
BL
L
E
XC4000X only
Figure 33: Detail of Programmable Interconnect Associated with XC4000 Series IOB (Left Edge)
IOB inputs and outputs interface with the octal lines via the Two different types of clock buffers are available in the
single-length interconnect lines. Single-length lines are XC4000E:
also used for communication between the octals and dou-
• Primary Global Buffers (BUFGP)
ble-length lines, quads, and longlines within the CLB array. • Secondary Global Buffers (BUFGS)
Segmentation into buffered octals was found to be optimal Four Primary Global buffers offer the shortest delay and
for distributing signals over long distances around the negligible skew. Four Secondary Global buffers have
device. slightly longer delay and slightly more skew due to poten-
tially heavier loading, but offer greater flexibility when used
Global Nets and Buffers
to drive non-clock CLB inputs.
Both the XC4000E and the XC4000X have dedicated glo-
The Primary Global buffers must be driven by the
bal networks. These networks are designed to distribute
semi-dedicated pads. The Secondary Global buffers can
clocks and other high fanout control signals throughout the
be sourced by either semi-dedicated pads or internal nets.
devices with minimal skew. The global buffers are
described in detail in the following sections. The text Each CLB column has four dedicated vertical Global lines.
descriptions and diagrams are summarized in Table 15. Each of these lines can be accessed by one particular Pri-
The table shows which CLB and IOB clock pins can be mary Global buffer, or by any of the Secondary Global buff-
sourced by which global buffers. ers, as shown in Figure 34. Each corner of the device has
one Primary buffer and one Secondary buffer.
In both XC4000E and XC4000X devices, placement of a
library symbol called BUFG results in the software choos- IOBs along the left and right edges have four vertical global
ing the appropriate clock buffer, based on the timing longlines. Top and bottom IOBs can be clocked from the
requirements of the design. The detailed information in global lines in the adjacent CLB column.
these sections is included only for reference. A global buffer should be specified for all timing-sensitive
Global Nets and Buffers (XC4000E only) global signal distribution. To use a global buffer, place a 6
BUFGP (primary buffer), BUFGS (secondary buffer), or
Four vertical longlines in each CLB column are driven BUFG (either primary or secondary buffer) element in a
exclusively by special global buffers. These longlines are schematic or in HDL code. If desired, attach a LOC
in addition to the vertical longlines used for standard inter- attribute or property to direct placement to the designated
connect. The four global lines can be driven by either of two location. For example, attach a LOC=L attribute or property
types of global buffers. The clock pins of every CLB and to a BUFGS symbol to direct that a buffer be placed in one
IOB can also be sourced from local interconnect. of the two Secondary Global buffers on the left edge of the
device, or a LOC=BL to indicate the Secondary Global
buffer on the bottom edge of the device, on the left.
Table 15: Clock Pin Access
locals
locals
locals
locals
BUFGS BUFGP
PGCK1 SGCK4
SGCK1 PGCK4
4
4
BUFGP BUFGS
4
4 locals locals
CLB CLB
IOB IOB
locals locals
X4 Any BUFGS X4 X4 Any BUFGS X4
locals locals
One BUFGP One BUFGP
IOB per Global Line per Global Line IOB
locals CLB CLB locals
BUFGS BUFGP
PGCK2 SGCK3
SGCK2 PGCK3
locals
locals
locals
locals
BUFGP BUFGS
BUFGE BUFGE
locals
locals
locals
locals
CLB CLB
X4 BUFGLS 8 X8 X8 8 BUFGLS X8
BUFGLS 8 locals locals 8 BUFGLS
locals locals
4 8
8 8
locals locals
IOB CLB CLOCKS CLB CLOCKS IOB
IOB CLOCKS (PER COLUMN) (PER COLUMN) CLOCKS IOB
8 8
locals 4 8 locals
BUFGLS 8 locals locals 8 BUFGLS
BUFGLS 8 8 BUFGLS
X4 X8 X8 X8
CLB CLB
locals
locals
locals
locals
BUFGE BUFGE
Global Nets and Buffers (XC4000X only) Early and Global Low-Skew buffers share a common input;
they cannot be driven by two different signals.
Eight vertical longlines in each CLB column are driven by
special global buffers. These longlines are in addition to the Choosing an XC4000X Clock Buffer
vertical longlines used for standard interconnect. The glo-
The clocking structure of the XC4000X provides a large
bal lines are broken in the center of the array, to allow faster
distribution and to minimize skew across the whole array. variety of features. However, it can be simple to use, with-
Each half-column global line has its own buffered multi- out understanding all the details. The software automati-
plexer, as shown in Figure 35. The top and bottom global cally handles clocks, along with all other routing, when the
lines cannot be connected across the center of the device, appropriate clock buffer is placed in the design. In fact, if a
as this connection might introduce unacceptable skew. The buffer symbol called BUFG is placed, rather than a specific
top and bottom halves of the global lines must be sepa- type of buffer, the software even chooses the buffer most
rately driven — although they can be driven by the same appropriate for the design. The detailed information in this
global buffer. section is provided for those users who want a finer level of
control over their designs.
The eight global lines in each CLB column can be driven by
either of two types of global buffers. They can also be If fine control is desired, use the following summary and
driven by internal logic, because they can be accessed by Table 15 on page 35 to choose an appropriate clock buffer.
single, double, and quad lines at the top, bottom, half, and • The simplest thing to do is to use a Global Low-Skew
quarter points. Consequently, the number of different buffer.
clocks that can be used simultaneously in an XC4000X • If a faster clock path is needed, try a BUFG. The
device is very large. software will first try to use a Global Low-Skew Buffer. If
There are four global lines feeding the IOBs at the left edge timing requirements are not met, a faster buffer will
of the device. IOBs along the right edge have eight global automatically be used.
• If a single quadrant of the chip is sufficient for the 6
lines. There is a single global line along the top and bottom
edges with access to the IOBs. All IOB global lines are bro- clocked logic, and the timing requires a faster clock than
ken at the center. They cannot be connected across the the Global Low-Skew buffer, use a Global Early buffer.
center of the device, as this connection might introduce Global Low-Skew Buffers
unacceptable skew.
Each corner of the XC4000X device has two Global
IOB global lines can be driven from two types of global buff- Low-Skew buffers. Any of the eight Global Low-Skew buff-
ers, or from local interconnect. Alternatively, top and bottom ers can drive any of the eight vertical Global lines in a col-
IOBs can be clocked from the global lines in the adjacent umn of CLBs. In addition, any of the buffers can drive any of
CLB column. the four vertical lines accessing the IOBs on the left edge of
Two different types of clock buffers are available in the the device, and any of the eight vertical lines accessing the
XC4000X: IOBs on the right edge of the device. (See Figure 36 on
page 38.)
• Global Low-Skew Buffers (BUFGLS)
• Global Early Buffers (BUFGE) IOBs at the top and bottom edges of the device are
accessed through the vertical Global lines in the CLB array,
Global Low-Skew Buffers are the standard clock buffers.
as in the XC4000E. Any Global Low-Skew buffer can,
They should be used for most internal clocking, whenever a
therefore, access every IOB and CLB in the device.
large portion of the device must be driven.
The Global Low-Skew buffers can be driven by either
Global Early Buffers are designed to provide a faster clock
semi-dedicated pads or internal logic.
access, but CLB access is limited to one-fourth of the
device. They also facilitate a faster I/O interface. To use a Global Low-Skew buffer, instantiate a BUFGLS
element in a schematic or in HDL code. If desired, attach a
Figure 35 is a conceptual diagram of the global net struc-
LOC attribute or property to direct placement to the desig-
ture in the XC4000X.
nated location. For example, attach a LOC=T attribute or
Global Early buffers and Global Low-Skew buffers share a property to direct that a BUFGLS be placed in one of the
single pad. Therefore, the same IPAD symbol can drive one two Global Low-Skew buffers on the top edge of the device,
buffer of each type, in parallel. This configuration is particu- or a LOC=TR to indicate the Global Low-Skew buffer on the
larly useful when using the Fast Capture latches, as top edge of the device, on the right.
described in “IOB Input Signals” on page 20. Paired Global
8 7 8 7
IOB IOB IOB IOB
1 6 1 6
I I I I
O CLB CLB O O CLB CLB O
B B B B
I I I I
O CLB CLB O O CLB CLB O
B B B B
2 5 2 5
IOB IOB IOB IOB
3 4 3 4
X6751
X6753
Figure 36: Any BUFGLS (GCK1 - GCK8) Can Figure 37: Left and Right BUFGEs Can Drive Any or
Drive Any or All Clock Inputs on the Device All Clock Inputs in Same Quadrant or Edge (GCK1 is
shown. GCK2, GCK5 and GCK6 are similar.)
Global Early Buffers
The left-side Global Early buffers can each drive two of the
Each corner of the XC4000X device has two Global Early
four vertical lines accessing the IOBs on the entire left edge
buffers. The primary purpose of the Global Early buffers is
of the device. The right-side Global Early buffers can each
to provide an earlier clock access than the potentially
drive two of the eight vertical lines accessing the IOBs on
heavily-loaded Global Low-Skew buffers. A clock source
the entire right edge of the device. (See Figure 37.)
applied to both buffers will result in the Global Early clock
edge occurring several nanoseconds earlier than the Glo- Each left and right Global Early buffer can also drive half of
bal Low-Skew buffer clock edge, due to the lighter loading. the IOBs along either the top or bottom edge of the device,
using a dedicated line that can only be accessed through
Global Early buffers also facilitate the fast capture of device
the Global Early buffers.
inputs, using the Fast Capture latches described in “IOB
Input Signals” on page 20. For Fast Capture, take a single The top and bottom Global Early buffers can drive half of
clock signal, and route it through both a Global Early buffer the IOBs along either the left or right edge of the device, as
and a Global Low-Skew buffer. (The two buffers share an shown in Figure 38. They can only access the top and bot-
input pad.) Use the Global Early buffer to clock the Fast tom IOBs via the CLB global lines.
Capture latch, and the Global Low-Skew buffer to clock the
normal input flip-flop or latch, as shown in Figure 17 on 8 7
page 23. IOB IOB
1 6
The Global Early buffers can also be used to provide a fast
Clock-to-Out on device output pins. However, an early clock I I
in the output flip-flop IOB must be taken into consideration O CLB CLB O
when calculating the internal clock speed for the design. B B
The Global Early buffers at the left and right edges of the
chip have slightly different capabilities than the ones at the
top and bottom. Refer to Figure 37, Figure 38, and I I
Figure 35 on page 36 while reading the following explana- O CLB CLB O
B B
tion.
Each Global Early buffer can access the eight vertical Glo- 2 5
bal lines for all CLBs in the quadrant. Therefore, only IOB IOB
one-fourth of the CLB clock pins can be accessed. This 3 4
X6747
restriction is in large part responsible for the faster speed of
the buffers, relative to the Global Low-Skew buffers. Figure 38: Top and Bottom BUFGEs Can Drive Any
or All Clock Inputs in Same Quadrant (GCK8 is
shown. GCK3, GCK4 and GCK7 are similar.)
I/O I/O
During After
Pin Name Config. Config. Pin Description
Permanently Dedicated Pins
Eight or more (depending on package) connections to the nominal +5 V supply voltage
VCC I I (+3.3 V for low-voltage devices). All must be connected, and each must be decoupled
with a 0.01 - 0.1 µF capacitor to Ground.
Eight or more (depending on package type) connections to Ground. All must be con-
GND I I
nected.
During configuration, Configuration Clock (CCLK) is an output in Master modes or Asyn-
chronous Peripheral mode, but is an input in Slave mode and Synchronous Peripheral
mode. After configuration, CCLK has a weak pull-up resistor and can be selected as the
CCLK I or O I
Readback Clock. There is no CCLK High or Low time restriction on XC4000 Series de-
vices, except during Readback. See “Violating the Maximum High and Low Time Spec-
ification for the Readback Clock” on page 56 for an explanation of this exception.
DONE is a bidirectional signal with an optional internal pull-up resistor. As an output, it
indicates the completion of the configuration process. As an input, a Low level on DONE
DONE I/O O can be configured to delay the global logic initialization and the enabling of outputs.
The optional pull-up resistor is selected as an option in the XACTstep program that cre-
ates the configuration bitstream. The resistor is included by default.
PROGRAM is an active Low input that forces the FPGA to clear its configuration mem-
ory. It is used to initiate a configuration cycle. When PROGRAM goes High, the FPGA
finishes the current clear cycle and executes another complete clear cycle, before it
PROGRAM I I
goes into a WAIT state and releases INIT.
The PROGRAM pin has a permanent weak pull-up, so it need not be externally pulled
up to Vcc.
User I/O Pins That Can Have Special Functions
During Peripheral mode configuration, this pin indicates when it is appropriate to write
another byte of data into the FPGA. The same status is also available on D7 in Asyn-
RDY/BUSY O I/O chronous Peripheral mode, if a read operation is performed when the device is selected.
After configuration, RDY/BUSY is a user-programmable I/O pin.
RDY/BUSY is pulled High with a high-impedance pull-up prior to INIT going High.
During Master Parallel configuration, each change on the A0-A17 outputs (A0 - A21 for
XC4000X) is preceded by a rising edge on RCLK, a redundant output signal. RCLK is
RCLK O I/O
useful for clocked PROMs. It is rarely used during configuration. After configuration,
RCLK is a user-programmable I/O pin.
As Mode inputs, these pins are sampled after INIT goes High to determine the configu-
ration mode to be used. After configuration, M0 and M2 can be used as inputs, and M1
can be used as a 3-state output. These three pins have no associated input or output
registers.
I (M0), During configuration, these pins have weak pull-up resistors. For the most popular con-
M0, M1, M2 I O (M1), figuration mode, Slave Serial, the mode pins can thus be left unconnected. The three
I (M2) mode inputs can be individually configured with or without weak pull-up or pull-down re-
sistors. A pull-down resistor value of 4.7 kΩ is recommended.
These pins can only be used as inputs or outputs when called out by special schematic
definitions. To use these pins, place the library components MD0, MD1, and MD2 in-
stead of the usual pad symbols. Input or output buffers must still be used.
If boundary scan is used, this pin is the Test Data Output. If boundary scan is not used,
this pin is a 3-state output without a register, after configuration is completed.
TDO O O This pin can be user output only when called out by special schematic definitions. To
use this pin, place the library component TDO instead of the usual pad symbol. An out-
put buffer must still be used.
I/O I/O
During After
Pin Name Config. Config. Pin Description
If boundary scan is used, these pins are Test Data In, Test Clock, and Test Mode Select
inputs respectively. They come directly from the pads, bypassing the IOBs. These pins
can also be used as inputs to the CLB logic after configuration is completed.
I/O
TDI, TCK, If the BSCAN symbol is not placed in the design, all boundary scan functions are inhib-
I or I
TMS ited once configuration is completed, and these pins become user-programmable I/O.
(JTAG)
In this case, they must be called out by special schematic definitions. To use these pins,
place the library components TDI, TCK, and TMS instead of the usual pad symbols. In-
put or output buffers must still be used.
High During Configuration (HDC) is driven High until the I/O go active. It is available as
HDC O I/O a control output indicating that configuration is not yet completed. After configuration,
HDC is a user-programmable I/O pin.
Low During Configuration (LDC) is driven Low until the I/O go active. It is available as a
LDC O I/O control output indicating that configuration is not yet completed. After configuration,
LDC is a user-programmable I/O pin.
Before and during configuration, INIT is a bidirectional signal. A 1 kΩ - 10 kΩ external
pull-up resistor is recommended.
As an active-Low open-drain output, INIT is held Low during the power stabilization and
internal clearing of the configuration memory. As an active-Low input, it can be used
INIT I/O I/O
to hold the FPGA in the internal WAIT state before the start of configuration. Master 6
mode devices stay in a WAIT state an additional 30 to 300 µs after INIT has gone High.
During configuration, a Low on this output indicates that a configuration data error has
occurred. After the I/O go active, INIT is a user-programmable I/O pin.
Four Primary Global inputs each drive a dedicated internal global net with short delay
PGCK1 - and minimal skew. If not used to drive a global buffer, any of these pins is a user-pro-
PGCK4 Weak grammable I/O.
I or I/O
(XC4000E Pull-up The PGCK1-PGCK4 pins drive the four Primary Global Buffers. Any input pad symbol
only) connected directly to the input of a BUFGP symbol is automatically placed on one of
these pins.
Four Secondary Global inputs each drive a dedicated internal global net with short delay
SGCK1 - and minimal skew. These internal global nets can also be driven from internal logic. If
SGCK4 Weak not used to drive a global net, any of these pins is a user-programmable I/O pin.
I or I/O
(XC4000E Pull-up The SGCK1-SGCK4 pins provide the shortest path to the four Secondary Global Buff-
only) ers. Any input pad symbol connected directly to the input of a BUFGS symbol is auto-
matically placed on one of these pins.
Eight inputs can each drive a Global Low-Skew buffer. In addition, each can drive a Glo-
GCK1 - bal Early buffer. Each pair of global buffers can also be driven from internal logic, but
GCK8 Weak must share an input signal. If not used to drive a global buffer, any of these pins is a
I or I/O
(XC4000X Pull-up user-programmable I/O.
only) Any input pad symbol connected directly to the input of a BUFGLS or BUFGE symbol
is automatically placed on one of these pins.
FCLK1 - Four inputs can each drive a Fast Clock (FCLK) buffer which can deliver a clock signal
FCLK4 to any IOB clock input in the octant of the die served by the Fast Clock buffer. Two Fast
(XC4000XLA Weak Clock buffers serve the two IOB octants on the left side of the die and the other two Fast
I or I/O
and Pull-up Clock buffers serve the two IOB octants on the right side of the die. On each side of the
XC4000XV die, one Fast Clock buffer serves the upper octant and the other serves the lower octant.
only) If not used to drive a Fast Clock buffer, any of these pins is a user-programmable I/O.
I/O I/O
During After
Pin Name Config. Config. Pin Description
These four inputs are used in Asynchronous Peripheral mode. The chip is selected
when CS0 is Low and CS1 is High. While the chip is selected, a Low on Write Strobe
(WS) loads the data present on the D0 - D7 inputs into the internal data buffer. A Low
CS0, CS1, on Read Strobe (RS) changes D7 into a status output — High if Ready, Low if Busy —
I I/O
WS, RS and drives D0 - D6 High.
In Express mode, CS1 is used as a serial-enable signal for daisy-chaining.
WS and RS should be mutually exclusive, but if both are Low simultaneously, the Write
Strobe overrides. After configuration, these are user-programmable I/O pins.
During Master Parallel configuration, these 18 output pins address the configuration
A0 - A17 O I/O
EPROM. After configuration, they are user-programmable I/O pins.
A18 - A21 During Master Parallel configuration with an XC4000X master, these 4 output pins add
(XC4003XL to O I/O 4 more bits to address the configuration EPROM. After configuration, they are user-pro-
XC4085XL) grammable I/O pins. (See Master Parallel Configuration section for additional details.)
During Master Parallel and Peripheral configuration, these eight input pins receive con-
D0 - D7 I I/O
figuration data. After configuration, they are user-programmable I/O pins.
During Slave Serial or Master Serial configuration, DIN is the serial configuration data
DIN I I/O input receiving data on the rising edge of CCLK. During Parallel configuration, DIN is
the D0 input. After configuration, DIN is a user-programmable I/O pin.
During configuration in any mode but Express mode, DOUT is the serial configuration
data output that can drive the DIN of daisy-chained slave FPGAs. DOUT data changes
on the falling edge of CCLK, one-and-a-half CCLK periods after it was received at the
DOUT O I/O DIN input.
In Express modefor XC4000E and XC4000X only, DOUT is the status output that can
drive the CS1 of daisy-chained FPGAs, to enable and disable downstream devices.
After configuration, DOUT is a user-programmable I/O pin.
Unrestricted User-Programmable I/O Pins
These pins can be configured to be input and/or output after configuration is completed.
Weak
I/O I/O Before configuration is completed, these pins have an internal high-value pull-up resis-
Pull-up
tor (25 kΩ - 100 kΩ) that defines the logic level as High.
Boundary Scan of how to enable this circuitry are covered later in this sec-
tion.
The ‘bed of nails’ has been the traditional method of testing
electronic assemblies. This approach has become less By exercising these input signals, the user can serially load
appropriate, due to closer pin spacing and more sophisti- commands and data into these devices to control the driv-
cated assembly methods like surface-mount technology ing of their outputs and to examine their inputs. This
and multi-layer boards. The IEEE Boundary Scan Standard method is an improvement over bed-of-nails testing. It
1149.1 was developed to facilitate board-level testing of avoids the need to over-drive device outputs, and it reduces
electronic assemblies. Design and test engineers can the user interface to four pins. An optional fifth pin, a reset
imbed a standard test logic structure in their device to for the control logic, is described in the standard but is not
achieve high fault coverage for I/O and internal logic. This implemented in Xilinx devices.
structure is easily implemented with a four-pin interface on The dedicated on-chip logic implementing the IEEE 1149.1
any boundary scan-compatible IC. IEEE 1149.1-compati- functions includes a 16-state machine, an instruction regis-
ble devices may be serial daisy-chained together, con- ter and a number of data registers. The functional details
nected in parallel, or a combination of the two. can be found in the IEEE 1149.1 specification and are also
The XC4000 Series implements IEEE 1149.1-compatible discussed in the Xilinx application note XAPP 017: “Bound-
BYPASS, PRELOAD/SAMPLE and EXTEST boundary ary Scan in XC4000 Devices.”
scan instructions. When the boundary scan configuration Figure 40 on page 43 shows a simplified block diagram of
option is selected, three normal user I/O pins become ded- the XC4000E Input/Output Block with boundary scan
icated inputs for these functions. Another user output pin implemented. XC4000X boundary scan logic is identical.
becomes the dedicated boundary scan output. The details
Figure 41 on page 44 is a diagram of the XC4000 Series data register, respectively, and BSCANT.UPD, which is
boundary scan logic. It includes three bits of Data Register always the last bit of the data register. These three bound-
per IOB, the IEEE 1149.1 Test Access Port controller, and ary scan bits are special-purpose Xilinx test signals.
the Instruction Register with decodes. The other standard data register is the single flip-flop
XC4000 Series devices can also be configured through the BYPASS register. It synchronizes data being passed
boundary scan logic. See “Readback” on page 55. through the FPGA to the next downstream boundary scan
device.
Data Registers
The FPGA provides two additional data registers that can
The primary data register is the boundary scan register. For be specified using the BSCAN macro. The FPGA provides
each IOB pin in the FPGA, bonded or not, it includes three two user pins (BSCAN.SEL1 and BSCAN.SEL2) which are
bits for In, Out and 3-State Control. Non-IOB pins have the decodes of two user instructions. For these instructions,
appropriate partial bit population for In or Out only. PRO- two corresponding pins (BSCAN.TDO1 and
GRAM, CCLK and DONE are not included in the boundary BSCAN.TDO2) allow user scan data to be shifted out on
scan register. Each EXTEST CAPTURE-DR state captures TDO. The data register clock (BSCAN.DRCK) is available
all In, Out, and 3-state pins. for control of test logic which the user may wish to imple-
The data register also includes the following non-pin bits: ment with CLBs. The NAND of TCK and RUN-TEST-IDLE
TDO.T, and TDO.O, which are always bits 0 and 1 of the is also provided (BSCAN.IDLE).
TS/OE
3-State TS
Boundary
TS - capture VCC 6
Scan
TS - update
OUTPUT
INVERT
OUTPUT
M
sd
D Q
Ouput Data O
EC
M INVERT
O - capture
Clock Enable Boundary Q - capture
Scan
O - update
M
I - capture
Boundary
Scan
Input Data 1 I1
I - update
M M
sd
Q M M
D
EC Input Data 2 I2
DELAY QL
M INVERT
M
FLIP-FLOP/LATCH
Input Clock IK
rd
M S/R
INPUT
GLOBAL
S/R X5792
Figure 40: Block Diagram of XC4000E IOB with Boundary Scan (some details not shown).
XC4000X Boundary Scan Logic is Identical.
DATA IN
IOB.T 0
1 sd
D Q D Q 1
0
IOB IOB sd
1
D Q D Q
0
IOB IOB
LE
IOB IOB
1
IOB.I
0
IOB IOB
1 sd
IOB IOB D Q D Q
0
LE
IOB IOB
1
0
IOB IOB IOB.Q
BYPASS
REGISTER
IOB.T 0
M TDO
U 1 sd
INSTRUCTION REGISTER D Q D Q 1
TDI
X 0
LE
1 sd
D Q D Q
0
LE
1
IOB.I
0
is passed through and is captured by each FPGA when it tiated and most boundary scan instructions cannot be
recognizes the 0010 preamble. Following the length-count used.
data, each FPGA outputs a High on DOUT until it has The user has some control over the relative timing of these
received its required number of data frames. events and can, therefore, make sure that they occur at the
After an FPGA has received its configuration data, it proper time and the finish point F is reached. Timing is con-
passes on any additional frame start bits and configuration trolled using options in the bitstream generation software.
data on DOUT. When the total number of configuration
clocks applied after memory initialization equals the value XC3000 Master with an XC4000 Series Slave
of the 24-bit length count, the FPGAs begin the start-up Some designers want to use an inexpensive lead device in
sequence and become operational together. FPGA I/O are peripheral mode and have the more precious I/O pins of the
normally released two CCLK cycles after the last configura- XC4000 Series devices all available for user I/O. Figure 44
tion bit is received. Figure 47 on page 53 shows the provides a solution for that case.
start-up timing for an XC4000 Series device.
This solution requires one CLB, one IOB and pin, and an
The daisy-chained bitstream is not simply a concatenation internal oscillator with a frequency of up to 5 MHz as a
of the individual bitstreams. The PROM file formatter must clock source. The XC3000 master device must be config-
be used to combine the bitstreams for a daisy-chained con- ured with late Internal Reset, which is the default option.
figuration.
One CLB and one IOB in the lead XC3000-family device
Multi-Family Daisy Chain are used to generate the additional CCLK pulse required by
the XC4000 Series devices. When the lead device removes
All Xilinx FPGAs of the XC2000, XC3000, and XC4000 the internal RESET signal, the 2-bit shift register responds
Series use a compatible bitstream format and can, there- to its clock input and generates an active Low output signal
fore, be connected in a daisy chain in an arbitrary for the duration of the subsequent clock period. An external
sequence. There is, however, one limitation. The lead connection between this output and CCLK thus creates the 6
device must belong to the highest family in the chain. If the extra CCLK pulse.
chain contains XC4000 Series devices, the master nor-
mally cannot be an XC2000 or XC3000 device.
The reason for this rule is shown in Figure 47 on page 53.
Since all devices in the chain store the same length count
value and generate or receive one common sequence of
CCLK pulses, they all recognize length-count match on the
same CCLK edge, as indicated on the left edge of OE/T
Output
Figure 47. The master device then generates additional Connected
Reset to CCLK
CCLK pulses until it reaches its finish point F. The different 0 0
families generate or require different numbers of additional 1 0 Active Low Output
1 1 Active High Output
CCLK pulses until they reach F. Not reaching F means that 0 1
0 1
the device does not really finish its configuration, although etc
. .
. . X5223
DONE may have gone High, the outputs became active,
and the internal reset was released. For the XC4000 Series Figure 44: CCLK Generation for XC3000 Master
device, not reaching F means that readback cannot be ini- Driving an XC4000 Series Slave
Cyclic Redundancy Check (CRC) for figuration process with a potentially corrupted bitstream is
Configuration and Readback terminated. The FPGA pulls the INIT pin Low and goes into
a Wait state.
The Cyclic Redundancy Check is a method of error detec-
tion in data transmission applications. Generally, the trans- During Readback, 11 bits of the 16-bit checksum are added
mitting system performs a calculation on the serial to the end of the Readback data stream. The checksum is
bitstream. The result of this calculation is tagged onto the computed using the CRC-16 CCITT polynomial, as shown
data stream as additional check bits. The receiving system in Figure 45. The checksum consists of the 11 most signif-
performs an identical calculation on the bitstream and com- icant bits of the 16-bit code. A change in the checksum indi-
pares the result with the received checksum. cates a change in the Readback bitstream. A comparison
to a previous checksum is meaningful only if the readback
Each data frame of the configuration bitstream has four data is independent of the current device state. CLB out-
error bits at the end, as shown in Table 19. If a frame data puts should not be included (Read Capture option not
error is detected during the loading of the FPGA, the con-
X2 X15 No
X16
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
SAMPLE/PRELOAD Config-
BYPASS uration No
memory
SERIAL DATA IN Full
Yes
Polynomial: X16 + X15 + X2 + 1
Pass
Configuration
Data to DOUT
1 1 1 1 1 0 15 14 13 12 11 10 9 8 7 6 5
START BIT
Operational
EXTEST
SAMPLE PRELOAD
BYPASS
USER 1 If Boundary Scan
USER 2 is Selected
CONFIGURE
READBACK
X6076
Low. During this time delay, or as long as the PROGRAM rise time is excessive or poorly defined. As long as PRO-
input is asserted, the configuration logic is held in a Config- GRAM is Low, the FPGA keeps clearing its configuration
uration Memory Clear state. The configuration-memory memory. When PROGRAM goes High, the configuration
frames are consecutively initialized, using the internal oscil- memory is cleared one more time, followed by the begin-
lator. ning of configuration, provided the INIT input is not exter-
At the end of each complete pass through the frame nally held Low. Note that a Low on the PROGRAM input
addressing, the power-on time-out delay circuitry and the automatically forces a Low on the INIT output. The XC4000
Series PROGRAM pin has a permanent weak pull-up.
level of the PROGRAM pin are tested. If neither is asserted,
the logic initiates one additional clearing of the configura- Using an open-collector or open-drain driver to hold INIT
tion frames and then tests the INIT input. Low before the beginning of configuration causes the
FPGA to wait after completing the configuration memory
Initialization clear operation. When INIT is no longer held Low exter-
During initialization and configuration, user pins HDC, LDC, nally, the device determines its configuration mode by cap-
INIT and DONE provide status outputs for the system inter- turing its mode pins, and is ready to start the configuration
face. The outputs LDC, INIT and DONE are held Low and process. A master device waits up to an additional 250 µs
HDC is held High starting at the initial application of power. to make sure that any slaves in the optional daisy chain
have seen that INIT is High.
The open drain INIT pin is released after the final initializa-
tion pass through the frame addresses. There is a deliber- Start-Up
ate delay of 50 to 250 µs (up to 10% longer for low-voltage
devices) before a Master-mode device recognizes an inac- Start-up is the transition from the configuration process to
the intended user operation. This transition involves a
tive INIT. Two internal clocks after the INIT pin is recognized
as High, the FPGA samples the three mode lines to deter- change from one clock source to another, and a change
from interfacing parallel or serial configuration data where
mine the configuration mode. The appropriate interface 6
most outputs are 3-stated, to normal operation with I/O pins
lines become active and the configuration preamble and
active in the user-system. Start-up must make sure that the
data can be loaded.Configuration
user-logic ‘wakes up’ gracefully, that the outputs become
The 0010 preamble code indicates that the following 24 bits active without causing contention with the configuration sig-
represent the length count. The length count is the total nals, and that the internal flip-flops are released from the
number of configuration clocks needed to load the com- global Reset or Set at the right time.
plete configuration data. (Four additional configuration
Figure 47 describes start-up timing for the three Xilinx fam-
clocks are required to complete the configuration process,
as discussed below.) After the preamble and the length ilies in detail. The configuration modes can use any of the
count have been passed through to all devices in the daisy four timing sequences.
chain, DOUT is held High to prevent frame start bits from To access the internal start-up signals, place the STARTUP
reaching any daisy-chained devices. library symbol.
A specific configuration bit, early in the first frame of a mas- Start-up Timing
ter device, controls the configuration-clock rate and can
increase it by a factor of eight. Therefore, if a fast configu- Different FPGA families have different start-up sequences.
ration clock is selected by the bitstream, the slower clock The XC2000 family goes through a fixed sequence. DONE
rate is used until this configuration bit is detected. goes High and the internal global Reset is de-activated one
Each frame has a start field followed by the frame-configu- CCLK period after the I/O become active.
ration data bits and a frame error field. If a frame data error The XC3000A family offers some flexibility. DONE can be
is detected, the FPGA halts loading, and signals the error programmed to go High one CCLK period before or after
by pulling the open-drain INIT pin Low. After all configura- the I/O become active. Independent of DONE, the internal
tion frames have been loaded into an FPGA, DOUT again global Reset is de-activated one CCLK period before or
follows the input data so that the remaining data is passed after the I/O become active.
on to the next device.
The XC4000 Series offers additional flexibility. The three
Delaying Configuration After Power-Up events — DONE going High, the internal Set/Reset being
de-activated, and the user I/O going active — can all occur
There are two methods of delaying configuration after in any arbitrary sequence. Each of them can occur one
power-up: put a logic Low on the PROGRAM input, or pull
CCLK period before or after, or simultaneous with, any of
the bidirectional INIT pin Low, using an open-collector the others. This relative timing is selected by means of soft-
(open-drain) driver. (See Figure 46 on page 50.) ware options in the bitstream generation software.
A Low on the PROGRAM input is the more radical
approach, and is recommended when the power-supply
The default option, and the most practical one, is for DONE received since INIT went High equals the loaded value of
to go High first, disconnecting the configuration data source the length count.
and avoiding any contention when the I/Os become active The next rising clock edge sets a flip-flop Q0, shown in
one clock later. Reset/Set is then released another clock Figure 48. Q0 is the leading bit of a 5-bit shift register. The
period later to make sure that user-operation starts from outputs of this register can be programmed to control three
stable internal conditions. This is the most common events.
sequence, shown with heavy lines in Figure 47, but the
designer can modify it to meet particular requirements. • The release of the open-drain DONE output
• The change of configuration-related pins to the user
Normally, the start-up sequence is controlled by the internal function, activating all IOBs.
device oscillator output (CCLK), which is asynchronous to • The termination of the global Set/Reset initialization of
the system clock. all CLB and IOB storage elements.
XC4000 Series offers another start-up clocking option, The DONE pin can also be wire-ANDed with DONE pins of
UCLK_NOSYNC. The three events described above need other FPGAs or with other external signals, and can then
not be triggered by CCLK. They can, as a configuration be used as input to bit Q3 of the start-up register. This is
option, be triggered by a user clock. This means that the called “Start-up Timing Synchronous to Done In” and is
device can wake up in synchronism with the user system. selected by either CCLK_SYNC or UCLK_SYNC.
When the UCLK_SYNC option is enabled, the user can When DONE is not used as an input, the operation is called
externally hold the open-drain DONE output Low, and thus “Start-up Timing Not Synchronous to DONE In,” and is
stall all further progress in the start-up sequence until selected by either CCLK_NOSYNC or UCLK_NOSYNC.
DONE is released and has gone High. This option can be
used to force synchronization of several FPGAs to a com- As a configuration option, the start-up control register
mon user clock, or to guarantee that all devices are suc- beyond Q0 can be clocked either by subsequent CCLK
cessfully configured before any I/Os go active. pulses or from an on-chip user net called STARTUP.CLK.
These signals can be accessed by placing the STARTUP
If either of these two options is selected, and no user clock library symbol.
is specified in the design or attached to the device, the chip
could reach a point where the configuration of the device is Start-up from CCLK
complete and the Done pin is asserted, but the outputs do
If CCLK is used to drive the start-up, Q0 through Q3 pro-
not become active. The solution is either to recreate the bit-
vide the timing. Heavy lines in Figure 47 show the default
stream specifying the start-up clock as CCLK, or to supply
timing, which is compatible with XC2000 and XC3000
the appropriate user clock.
devices using early DONE and late Reset. The thin lines
Start-up Sequence indicate all other possible timing options.
CCLK
F
DONE
I/O
XC2000
Global Reset
F = Finished, no more
F
configuration clocks needed
DONE Daisy-chain lead device
XC3000 must have latest F
I/O
Heavy lines describe
default timing
Global Reset
F
DONE
C1 C2 C3 C4
XC4000E/X I/O
CCLK_NOSYNC
C2 C3 C4
GSR Active 6
C2 C3 C4
DONE IN
F
DONE
C1, C2 or C3
XC4000E/X I/O
CCLK_SYNC
Di Di+1
GSR Active
Di Di+1
F
DONE
C1 U2 U3 U4
I/O
XC4000E/X
UCLK_NOSYNC U2 U3 U4
GSR Active
U2 U3 U4
DONE IN
F
DONE
C1 U2
I/O
XC4000E/X
UCLK_SYNC Di Di+1 Di+2
GSR Active
Di Di+1 Di+2
Synchronization
Uncertainty UCLK Period
X9024
Start-up from a User Clock (STARTUP.CLK) Release of User I/O After DONE Goes High
When, instead of CCLK, a user-supplied start-up clock is By default, the user I/O are released one CCLK cycle after
selected, Q1 is used to bridge the unknown phase relation- the DONE pin goes High. If CCLK is not clocked after
ship between CCLK and the user clock. This arbitration DONE goes High, the outputs remain in their initial state —
causes an unavoidable one-cycle uncertainty in the timing 3-stated, with a 50 kΩ - 100 kΩ pull-up. The delay from
of the rest of the start-up sequence. DONE High to active user I/O is controlled by an option to
the bitstream generation software.
DONE Goes High to Signal End of Configuration
XC4000 Series devices read the expected length count Release of Global Set/Reset After DONE Goes
from the bitstream and store it in an internal register. The High
length count varies according to the number of devices and By default, Global Set/Reset (GSR) is released two CCLK
the composition of the daisy chain. Each device also counts cycles after the DONE pin goes High. If CCLK is not
the number of CCLKs during configuration. clocked twice after DONE goes High, all flip-flops are held
Two conditions have to be met in order for the DONE pin to in their initial set or reset state. The delay from DONE High
go high: to GSR inactive is controlled by an option to the bitstream
generation software.
• the chip's internal memory must be full, and
• the configuration length count must be met, exactly. Configuration Complete After DONE Goes High
This is important because the counter that determines Three full CCLK cycles are required after the DONE pin
when the length count is met begins with the very first goes High, as shown in Figure 47 on page 53. If CCLK is
CCLK, not the first one after the preamble. not clocked three times after DONE goes High, readback
Therefore, if a stray bit is inserted before the preamble, or cannot be initiated and most boundary scan instructions
the data source is not ready at the time of the first CCLK, cannot be used.
the internal counter that holds the number of CCLKs will be
one ahead of the actual number of data bits read. At the
Configuration Through the Boundary Scan
end of configuration, the configuration memory will be full, Pins
but the number of bits in the internal counter will not match XC4000 Series devices can be configured through the
the expected length count. boundary scan pins. The basic procedure is as follows:
As a consequence, a Master mode device will continue to • Power up the FPGA with INIT held Low (or drive the
send out CCLKs until the internal counter turns over to PROGRAM pin Low for more than 300 ns followed by a
zero, and then reaches the correct length count a second High while holding INIT Low). Holding INIT Low allows
time. This will take several seconds [224 ∗ CCLK period] — enough time to issue the CONFIG command to the
which is sometimes interpreted as the device not configur- FPGA. The pin can be used as I/O after configuration if
ing at all. a resistor is used to hold INIT Low.
If it is not possible to have the data ready at the time of the • Issue the CONFIG command to the TMS input
first CCLK, the problem can be avoided by increasing the • Wait for INIT to go High
number in the length count by the appropriate value. The • Sequence the boundary scan Test Access Port to the
XACT User Guide includes detailed information about man- SHIFT-DR state
ually altering the length count. • Toggle TCK to clock data into TDI pin.
Note that DONE is an open-drain output and does not go The user must account for all TCK clock cycles after INIT
High unless an internal pull-up is activated or an external goes High, as all of these cycles affect the Length Count
pull-up is attached. The internal pull-up is activated as the compare.
default by the bitstream generation software. For more detailed information, refer to the Xilinx application
note XAPP017, “Boundary Scan in XC4000 Devices.” This
application note also applies to XC4000E and XC4000X
devices.
Q3 Q1/Q4
STARTUP DONE
Q2
IN
* GLOBAL SET/RESET OF
ALL CLB AND IOB FLIP-FLOP
1
0
GSR ENABLE
GSR INVERT
STARTUP.GSR CONTROLLED BY STARTUP SYMBOL
IN THE USER SCHEMATIC (SEE
STARTUP.GTS LIBRARIES GUIDE)
GTS INVERT
GTS ENABLE
0
GLOBAL 3-STATE OF ALL IOBs
1
Q S
* DONE
Q0 Q1 Q2 Q3 Q4
FULL
LENGTH COUNT
S Q D Q D Q
1
D Q D Q
6
0
K K K * K K
CLEAR MEMORY
CCLK 0
STARTUP.CLK 1
USER NET
M
CONFIGURATION BIT OPTIONS SELECTED BY USER IN "MAKEBITS"
* * X1528
Readback BACK library symbol and attach the appropriate pad sym-
bols, as shown in Figure 49.
The user can read back the content of configuration mem-
ory and the level of certain internal nodes without interfer- After Readback has been initiated by a High level on
ing with the normal operation of the device. RDBK.TRIG after configuration, the RDBK.RIP (Read In
Progress) output goes High on the next rising edge of
Readback not only reports the downloaded configuration RDBK.CLK. Subsequent rising edges of this clock shift out
bits, but can also include the present state of the device, Readback data on the RDBK.DATA net.
represented by the content of all flip-flops and latches in
CLBs and IOBs, as well as the content of function genera- Readback data does not include the preamble, but starts
tors used as RAMs. with five dummy bits (all High) followed by the Start bit
(Low) of the first frame. The first two data bits of the first
Note that in XC4000 Series devices, configuration data is frame are always High.
not inverted with respect to configuration as it is in XC2000
and XC3000 families. Each frame ends with four error check bits. They are read
back as High. The last seven bits of the last frame are also
XC4000 Series Readback does not use any dedicated read back as High. An additional Start bit (Low) and an
pins, but uses four internal nets (RDBK.TRIG, RDBK.DATA, 11-bit Cyclic Redundancy Check (CRC) signature follow,
RDBK.RIP and RDBK.CLK) that can be routed to any IOB. before RDBK.RIP returns Low.
To access the internal Readback signals, place the READ-
IF UNCONNECTED,
DEFAULT IS CCLK
Readback Options
I/O I/O
Readback options are: Read Capture, Read Abort, and
Clock Select. They are set with the bitstream generation PROGRAMMABLE
INTERCONNECT
software.
Read Capture
DATA
TRIG
RIP
When the Read Capture option is selected, the readback
I
rdbk I/O I/O I/O rdclk
data stream includes sampled values of CLB and IOB sig-
nals. The rising edge of RDBK.TRIG latches the inverted
values of the four CLB outputs, the IOB output flip-flops and X1787
the input signals I1 and I2. Note that while the bits describ- Figure 50: READBACK Symbol in Graphical Editor
ing configuration (interconnect, function generators, and
RAM content) are not inverted, the CLB and IOB output sig- Violating the Maximum High and Low Time
nals are inverted. Specification for the Readback Clock
When the Read Capture option is not selected, the values The readback clock has a maximum High and Low time
of the capture bits reflect the configuration data originally specification. In some cases, this specification cannot be
written to those memory locations. met. For example, if a processor is controlling readback, an
If the RAM capability of the CLBs is used, RAM data are interrupt may force it to stop in the middle of a readback.
available in readback, since they directly overwrite the F This necessitates stopping the clock, and thus violating the
and G function-table configuration of the CLB. specification.
RDBK.TRIG is located in the lower-left corner of the device, The specification is mandatory only on clocking data at the
as shown in Figure 50. end of a frame prior to the next start bit. The transfer mech-
anism will load the data to a shift register during the last six
Read Abort clock cycles of the frame, prior to the start bit of the follow-
ing frame. This loading process is dynamic, and is the
When the Read Abort option is selected, a High-to-Low
source of the maximum High and Low time requirements.
transition on RDBK.TRIG terminates the readback opera-
tion and prepares the logic to accept another trigger. Therefore, the specification only applies to the six clock
cycles prior to and including any start bit, including the
After an aborted readback, additional clocks (up to one
clocks before the first start bit in the readback data stream.
readback clock per configuration frame) may be required to
At other times, the frame data is already in the register and
re-initialize the control logic. The status of readback is indi-
the register is not dynamic. Thus, it can be shifted out just
cated by the output control net RDBK.RIP. RDBK.RIP is
like a regular shift register.
High whenever a readback is in progress.
The user must precisely calculate the location of the read-
Clock Select back data relative to the frame. The system must keep track
CCLK is the default clock. However, the user can insert of the position within a data frame, and disable interrupts
another clock on RDBK.CLK. Readback control and data before frame boundaries. Frame lengths and data formats
are clocked on rising edges of RDBK.CLK. If readback are listed in Table 19, Table 20 and Table 21.
must be inhibited for security reasons, the readback control
nets are simply not connected. Readback with the XChecker Cable
The XChecker Universal Download/Readback Cable and
RDBK.CLK is located in the lower right chip corner, as Logic Probe uses the readback feature for bitstream verifi-
shown in Figure 50. cation. It can also display selected internal signals on the
PC or workstation screen, functioning as a low-cost in-cir-
cuit emulator.
Finished
Internal Net
rdbk.TRIG
TRCRT TRCRT 2
1 TRTRC 2 1 TRTRC
rdclk.I
4 TRCL TRCH 5
rdbk.RIP
6
TRCRR
TRCRD
7 X1790
6
E/EX
Description Symbol Min Max Units
rdbk.TRIG rdbk.TRIG setup to initiate and abort Readback 1 TRTRC 200 - ns
rdbk.TRIG hold to initiate and abort Readback 2 TRCRT 50 - ns
rdclk.1 rdbk.DATA delay 7 TRCRD - 250 ns
rdbk.RIP delay 6 TRCRR - 250 ns
High time 5 TRCH 250 500 ns
Low time 4 TRCL 250 500 ns
Note 1: Timing parameters apply to all speed grades.
Note 2: If rdbk.TRIG is High prior to Finished, Finished will trigger the first Readback.
XL
Description Symbol Min Max Units
rdbk.TRIG rdbk.TRIG setup to initiate and abort Readback 1 TRTRC 200 - ns
rdbk.TRIG hold to initiate and abort Readback 2 TRCRT 50 - ns
rdclk.1 rdbk.DATA delay 7 TRCRD - 250 ns
rdbk.RIP delay 6 TRCRR - 250 ns
High time 5 TRCH 250 500 ns
Low time 4 TRCL 250 500 ns
Note 1: Timing parameters apply to all speed grades.
Note 2: If rdbk.TRIG is High prior to Finished, Finished will trigger the first Readback.
NOTE: NOTE:
M2, M1, M0 can be shorted M2, M1, M0 can be shorted
to Ground if not used as I/O to VCC if not used as I/O
VCC
N/C
4.7 KΩ 4.7 KΩ 4.7 KΩ 4.7 KΩ 4.7 KΩ
4.7 KΩ
M0 M1 M0 M1 M0 M1 PWRDN
M2 N/C M2 M2
PROGRAM X9025
CCLK
4 TCCH 3 TCCO
DOUT
Bit n - 1 Bit n
(Output)
X5379
Master Serial Mode For actual timing values please refer to “Configuration
Switching Characteristics” on page 68. Be sure that the
In Master Serial mode, the CCLK output of the lead FPGA serial PROM and slaves are fast enough to support this
drives a Xilinx Serial PROM that feeds the FPGA DIN input. data rate. XC2000, XC3000/A, and XC3100A devices do
Each rising edge of the CCLK output increments the Serial not support the Fast ConfigRate option.
PROM internal address counter. The next data bit is put on
the SPROM data output, connected to the FPGA DIN pin. The SPROM CE input can be driven from either LDC or
The lead FPGA accepts this data on the subsequent rising DONE. Using LDC avoids potential contention on the DIN
CCLK edge. pin, if this pin is configured as user-I/O, but LDC is then
restricted to be a permanently High user output after con-
The lead FPGA then presents the preamble data—and all figuration. Using DONE can also avoid contention on DIN,
data that overflows the lead device—on its DOUT pin. provided the early DONE option is invoked.
There is an internal pipeline delay of 1.5 CCLK periods,
which means that DOUT changes on the falling CCLK Figure 51 on page 60 shows a full master/slave system.
edge, and the next FPGA in the daisy chain accepts data The leftmost device is in Master Serial mode.
on the subsequent rising CCLK edge. Master Serial mode is selected by a <000> on the mode
In the bitstream generation software, the user can specify pins (M2, M1, M0).
Fast ConfigRate, which, starting several bits into the first
frame, increases the CCLK frequency by a factor of eight.
CCLK
(Output)
2 TCKDS
1 TDSCK 6
Serial Data In n n+1 n+2
X3223
Master Parallel Modes Master Parallel Down mode is selected by a <110> on the
mode pins. The EPROM addresses start at 3FFFF and
In the two Master Parallel modes, the lead FPGA directly decrement.
addresses an industry-standard byte-wide EPROM, and
accepts eight data bits just before incrementing or decre- Additional Address lines in XC4000 devices
menting the address outputs.
The XC4000X devices have additional address lines
The eight data bits are serialized in the lead FPGA, which (A18-A21) allowing the additional address space required
then presents the preamble data—and all data that over- to daisy-chain several large devices.
flows the lead device—on its DOUT pin. There is an inter-
The extra address lines are programmable in XC4000EX
nal delay of 1.5 CCLK periods, after the rising CCLK edge
devices. By default these address lines are not activated. In
that accepts a byte of data (and also changes the EPROM
the default mode, the devices are compatible with existing
address) until the falling CCLK edge that makes the LSB
XC4000 and XC4000E products. If desired, the extra
(D0) of this byte appear at DOUT. This means that DOUT
address lines can be used by specifying the address lines
changes on the falling CCLK edge, and the next FPGA in
option in bitgen as 22 (bitgen -g AddressLines:22). The
the daisy chain accepts data on the subsequent rising
lines (A18-A21) are driven when a master device detects,
CCLK edge.
via the bitstream, that it should be using all 22 address
The PROM address pins can be incremented or decre- lines. Because these pins will initially be pulled high by
mented, depending on the mode pin settings. This option internal pull-ups, designers using Master Parallel Up mode
allows the FPGA to share the PROM with a wide variety of should use external pull down resistors on pins A18-A21. If
microprocessors and micro controllers. Some processors Master Parallel Down mode is used external resistors are
must boot from the bottom of memory (all zeros) while oth- not necessary.
ers must boot from the top. The FPGA is flexible and can
All 22 address lines are always active in Master Parallel
load its configuration bitstream from either end of the mem-
modes with XC4000XL devices. The additional address
ory.
lines behave identically to the lower order address lines. If
Master Parallel Up mode is selected by a <100> on the the Address Lines option in bitgen is set to 18, it will be
mode pins (M2, M1, M0). The EPROM addresses start at ignored by the XC4000XL device.
00000 and increment.
The additional address lines (A18-A21) are not available in
the PC84 package.
N/C
M0 M1 M2 TO CCLK OF OPTIONAL
DAISY-CHAINED FPGAS
CCLK
DOUT
NOTE:M0 can be shorted
to Ground if not used A17 ... M0 M1 M2
as I/O.
A16 ... DIN DOUT
VCC
A15 ... EPROM
(8K x 8) CCLK
A14 ...
4.7KΩ (OR LARGER)
USER CONTROL OF HIGHER
INIT A13 ...
ORDER PROM ADDRESS BITS XC4000E/X
CAN BE USED TO SELECT BETWEEN SLAVE
A12 A12
ALTERNATIVE CONFIGURATIONS
A11 A11
PROGRAM
A10 A10
PROGRAM A9 A9
DONE INIT
D7 A8 A8
D6 A7 A7 D7
D5 A6 A6 D6
D4 A5 A5 D5
D3 A4 A4 D4
D2 A3 A3 D3
D1 A2 A2 D2
D0 A1 A1 D1
A0 A0 D0
DONE OE
CE
DATA BUS 8
PROGRAM
X9026
A0-A17
(output) Address for Byte n Address for Byte n + 1
1 TRAC
D0-D7
Byte
2 TDRC 3 TRCD
RCLK
(output)
7 CCLKs CCLK
CCLK
(output)
DOUT
(output) D6 D7
Byte n - 1 X6078
Synchronous Peripheral Mode The lead FPGA serializes the data and presents the pre-
amble data (and all data that overflows the lead device) on
Synchronous Peripheral mode can also be considered
its DOUT pin. There is an internal delay of 1.5 CCLK peri-
Slave Parallel mode. An external signal drives the CCLK
ods, which means that DOUT changes on the falling CCLK
input(s) of the FPGA(s). The first byte of parallel configura-
edge, and the next FPGA in the daisy chain accepts data
tion data must be available at the Data inputs of the lead on the subsequent rising CCLK edge.
FPGA a short setup time before the rising CCLK edge.
Subsequent data bytes are clocked in on every eighth con- In order to complete the serial shift operation, 10 additional
secutive rising CCLK edge. CCLK rising edges are required after the last data byte has
been loaded, plus one more CCLK cycle for each
The same CCLK edge that accepts data, also causes the daisy-chained device.
RDY/BUSY output to go High for one CCLK period. The pin
name is a misnomer. In Synchronous Peripheral mode it is Synchronous Peripheral mode is selected by a <011> on
really an ACKNOWLEDGE signal. Synchronous operation the mode pins (M2, M1, M0).
does not require this response, but it is a meaningful signal
for test purposes. Note that RDY/BUSY is pulled High with
a high-impedance pullup prior to INIT going High.
NOTE:
M2 can be shorted to Ground
if not used as I/O
M0 M1 M2 M0 M1 M2
CLOCK CCLK CCLK
OPTIONAL
8 DAISY-CHAINED
DATA BUS D0-7 FPGAs
DOUT DIN DOUT
CONTROL RDY/BUSY
SIGNALS INIT DONE INIT DONE
4.7 kΩ
X9027
CCLK
INIT
BYTE BYTE
0 1
DOUT 0 1 2 3 4 5 6 7 0 1
RDY/BUSY
X6096
Asynchronous Peripheral Mode The READY/BUSY handshake can be ignored if the delay
from any one Write to the end of the next Write is guaran-
Write to FPGA teed to be longer than 10 CCLK periods.
Asynchronous Peripheral mode uses the trailing edge of Status Read
the logic AND condition of WS and CS0 being Low and RS
and CS1 being High to accept byte-wide data from a micro- The logic AND condition of the CS0, CS1and RS inputs
processor bus. In the lead FPGA, this data is loaded into a puts the device status on the Data bus.
double-buffered UART-like parallel-to-serial converter and • D7 High indicates Ready
is serially shifted into the internal logic. • D7 Low indicates Busy
The lead FPGA presents the preamble data (and all data • D0 through D6 go unconditionally High
that overflows the lead device) on its DOUT pin. The It is mandatory that the whole start-up sequence be started
RDY/BUSY output from the lead FPGA acts as a hand- and completed by one byte-wide input. Otherwise, the pins
shake signal to the microprocessor. RDY/BUSY goes Low used as Write Strobe or Chip Enable might become active
when a byte has been received, and goes High again when outputs and interfere with the final byte transfer. If this
the byte-wide input buffer has transferred its information transfer does not occur, the start-up sequence is not com-
into the shift register, and the buffer is ready to receive new pleted all the way to the finish (point F in Figure 47 on page
data. A new write may be started immediately, as soon as 53).
the RDY/BUSY output has gone Low, acknowledging
In this case, at worst, the internal reset is not released. At
receipt of the previous data. Write may not be terminated
best, Readback and Boundary Scan are inhibited. The
until RDY/BUSY is High again for one CCLK period. Note
length-count value, as generated by the XACTstep soft-
that RDY/BUSY is pulled High with a high-impedance
pull-up prior to INIT going High. ware, ensures that these problems never occur.
Although RDY/BUSY is brought out as a separate signal,
The length of the BUSY signal depends on the activity in
the UART. If the shift register was empty when the new byte microprocessors can more easily read this information on
was received, the BUSY signal lasts for only two CCLK one of the data lines. For this purpose, D7 represents the
periods. If the shift register was still full when the new byte RDY/BUSY status when RS is Low, WS is High, and the
two chip select lines are both active.
was received, the BUSY signal can be as long as nine
CCLK periods. Asynchronous Peripheral mode is selected by a <101> on
the mode pins (M2, M1, M0).
Note that after the last byte has been entered, only seven of
its bits are shifted out. CCLK remains High with DOUT
equal to bit 6 (the next-to-last bit) of the last byte entered.
N/C
N/C N/C
4.7 kΩ
M0 M1 M2 M0 M1 M2
DATA 8
D0–7 CCLK CCLK
BUS
OPTIONAL
DAISY-CHAINED
FPGAs
DOUT DIN DOUT
VCC ADDRESS CS0
ADDRESS DECODE XC4000E/X
...
BUS LOGIC
ASYNCHRO- XC4000E/X
NOUS SLAVE
4.7 kΩ
PERIPHERAL
4.7 kΩ CS1
RS
WS
CONTROL RDY/BUSY
SIGNALS
INIT INIT
DONE DONE
REPROGRAM
PROGRAM PROGRAM
4.7 kΩ
X9028
CCLK
TWTRB 4
6 TBUSY
RDY/BUSY
X6097
INIT
T ICCK TCCLK
<300 ns
M0, M1, M2
VALID DONE RESPONSE
(Required)
X1532
<300 ns
I/O
Product Availability
Table 24, Table 25, and Table 26 show the planned packages and speed grades for XC4000-Series devices. Call your local
sales office for the latest availability information, or see the Xilinx WEBLINX at http://www.xilinx.com for the latest revision of
the specifications.
High-Perf.
High-Perf.
High-Perf.
High-Perf.
High-Perf.
High-Perf.
Ceram.
Ceram.
Ceram.
Ceram.
PQFP
VQFP
PQFP
PQFP
PQFP
PLCC
TQFP
TQFP
TQFP
TQFP
Plast.
Plast.
Plast.
Plast.
Plast.
Plast.
Plast.
Plast.
Plast.
Plast.
Plast.
Plast.
BGA
PGA
BGA
PGA
BGA
PGA
PGA
BGA
QFP
QFP
QFP
QFP
TYPE
HQ160
HQ208
HQ240
HQ304
PQ100
VQ100
PQ160
PQ208
PQ240
BG256
PG299
BG352
PG411
BG432
PG475
PG559
BG560
TQ144
TQ176
HT144
HT176
PC84
CODE
-3 CI CI CI
-2 CI CI CI
XC4002XL -1 CI CI CI
-09C C C C
-3 CI CI CI CI CI CI
-2 CI C CI CI CI CI
XC4005XL -1 CI CI CI CI CI CI
-09C C C C C C C
-3 CI CI CI CI CI CI CI
-2 CI CI CI CI CI CI CI
XC4010XL -1 CI CI CI CI CI CI CI
-09C C C C C C C C 6
-3 CI CI CI CI CI CI
-2 CI CI CI CI CI CI
XC4013XL -1 CI CI CI CI CI CI
-09C C C C C C C
-08C C C C C C C
-3 CI CI CI CI CI CI
-2 CI CI CI CI CI CI
XC4020XL -1 CI CI CI CI CI CI
-09C C C C C C C
-3 CI CI CI CI CI CI CI
-2 CI CI CI CI CI CI CI
XC4028XL -1 CI CI CI CI CI CI CI
-09C C C C C C C C
-3 CI CI CI CI CI CI CI
-2 CI CI C CI CI CI CI
XC4036XL -1 CI CI CI CI CI CI CI
-09C C C C C C C C
-08C C C C C C C C
-3 CI CI CI CI CI CI CI
-2 CI CI CI CI CI CI CI
XC4044XL -1 CI CI CI CI CI CI CI
-09C C C C C C C C
-3 CI CI CI CI CI
-2 CI CI CI CI CI
XC4052XL -1 CI CI CI CI CI
-09C C C C C C
-3 CI CI CI CI CI
-2 CI CI CI CI CI
XC4062XL -1 CI CI CI CI CI
-09C C C C C C
-08C C C C C C
-3 CI CI CI
-2 CI CI CI
XC4085XL -1 CI CI CI
-09C C C C
1/29/99
C = Commercial TJ = 0° to +85°C
I= Industrial TJ = -40°C to +100°C
High-Perf.
High-Perf.
High-Perf.
Ceram.
Ceram.
Ceram.
Ceram.
Ceram.
PQFP
VQFP
PQFP
PQFP
PQFP
PLCC
TQFP
Plast.
Plast.
Plast.
Plast.
Plast.
Plast.
Plast.
Plast.
PGA
PGA
PGA
PGA
BGA
PGA
QFP
QFP
QF
TYPE
HQ208
HQ240
HQ304
PQ100
VQ100
PG120
PG156
PQ160
PG191
PQ208
PG223
BG225
PQ240
PG299
TQ144
PC84
CODE
-4 CI CI CI CI
-3 CI CI CI CI
XC4003E -2 CI CI CI CI
-1 C C C C
-4 CI CI CI CI CI CI
-3 CI CI CI CI CI CI
XC4005E -2 CI CI CI CI CI CI
-1 C C C C C C
-4 CI CI CI CI CI
-3 CI CI CI CI CI
XC4006E -2 CI CI CI CI CI
-1 C C C C C
-4 CI CI CI CI
-3 CI CI CI CI
XC4008E -2 CI CI CI CI
-1 C C C C
-4 CI CI CI CI CI CI
-3 CI CI CI CI CI CI
XC4010E -2 CI CI CI CI CI CI
-1 C C C C C C
-4 CI CI CI CI CI CI CI
-3 CI CI CI CI CI CI CI
XC4013E -2 CI CI CI CI CI CI CI
-1 C C C C C C C
-4 CI CI CI
-3 CI CI CI
XC4020E -2 CI CI CI
-1 C C C
-4 CI CI CI CI
XC4025E -3 CI CI CI CI
-2 C C C C
1/29/99
C = Commercial TJ = 0° to +85°C
I= Industrial TJ = -40°C to +100°C
HQ160
HQ208
HQ240
HQ304
PQ100
VQ100
PQ160
PQ208
PQ240
BG256
PG299
BG352
PG411
BG432
PG475
PG559
BG560
TQ144
TQ176
HT144
HT176
PC84
Max
Device I/O
XC4002XL 64 61 64 64
HQ240
HQ304
PQ100
VQ100
PG120
PG156
PQ160
PG191
PQ208
PG223
BG225
PQ240
PG299
TQ144
PC84
Max
Device I/O
XC4003E 80 61 77 77 80
1/29/99
Ordering Information
Example: XC4013E-3HQ240C
Device Type
Temperature Range
Speed Grade C = Commercial (TJ = 0 to +85°C)
-6 I = Industrial (TJ = -40 to +100°C)
-5 M = Military (TC = -55 to+125°C)
-4
-3 Number of Pins
-2
-1
Package Type
PC = Plastic Lead Chip Carrier BG = Ball Grid Array
PQ = Plastic Quad Flat Pack PG = Ceramic Pin Grid Array
VQ = Very Thin Quad Flat Pack HQ = High Heat Dissipation Quad Flat Pack
TQ = Thin Quad Flat Pack MQ = Metal Quad Flat Pack
CB = Top Brazed Ceramic Quad Flat Pack
X9020
Revision Control
Version Description
3/30/98 (1.5) Updated XC4000XL timing and added XC4002XL
1/29/99 (1.5) Updated pin diagrams
5/14/99 (1.6) Replaced Electrical Specification and pinout pages for E, EX, and XL families with separate updates and
added URL link for electrical specifications/pinouts for WebLINX users
Products
Silicon Devices
● Virtex™-5 FPGA
● Virtex-4 FPGA
● Spartan™-3 Generation FPGAs
● CoolRunner™-II CPLD
● XC9500XL CPLD
● Configuration PROMs
Design Tools
● ISE Foundation™
● ISE WebPACK™ (FREE download)
● ChipScope™ Pro
● PlanAhead™
● EDK and Platform Studio
● System Generator for DSP
● AccelDSP™
Solutions
Integrated Solutions
● Programmable Logic
● Embedded Processing
● DSP
Market Solutions
● Automotive
● Aerospace & Defense
● Consumer
● Broadcast
Services
● Design Services
Sales
● Sales Representatives
● Online Store
Attention
Xilinx.com will be undergoing site maintenance from 5:00 pm PST Friday, January 12 to 9:00 am PST Monday, January 15, 2007. Thank you for your
patience.
Documentation
IP Cores
Enter Core Keywords
See All IP Cores
Development Boards
Enter Keywords
See All Development Boards
Support by Device
Device List
See All Support
Partner Products
● IP Cores / Reference Designs
● Design Tools
● Development Boards
● Design Services
● Embedded Partnerships
Partners
Select a Region
See Xilinx Alliance Program
News
9.ð&02665$0&RPPRQ,2
)HDWXUHV
• Organization: 32,768 words × 8 bits • TTL-compatible, three-state I/O
• High speed • 28-pin JEDEC standard packages
65$0
- 10/12/15/20 ns address access time - 300 mil PDIP and SOJ
- 3/3/4/5 ns output enable access time Socket compatible with 7C512 and 7C1024
• Low power consumption - 8×13.4 TSOP
- Active: 660 mW max (10 ns cycle) • ESD protection ≥ 2000 volts
- Standby: 11 mW max, CMOS I/O • Latch-up current ≥ 200 mA
- Very low DC component in active power • Industrial temperature available (-40° to +85°C)
• 2.0V data retention
• Equal access and cycle times
• Easy memory expansion with CE and OE inputs
/RJLFEORFNGLDJUDP 3LQDUUDQJHPHQW
TSOP 8×13.4 DIP, SOJ
Vcc
GND
OE 1 28 A10 A14 1 28 Vcc
Input buffer
A11 2 27 CE A12 2 27 WE
A9 3 26 I/O7 A7 3 26 A13
A8 4 25 I/O6 A6 4 25 A8
A0 A13 5 24 I/O5
I/O7 A5 5 24 A9
A1 WE 6 23 I/O4 A4 6 23 A11
AS7C256
Row decoder
A2 Vcc 7 I/O3
Sense amp
256×128×8 AS7C256 22 A3 7 22 OE
A3 A14 8 21 GND A2 8 21 A10
Array A12 9 20 I/O2 A1 9 20 CE
A4
(262,144) A7 10 19 I/O1 A0 10 19 I/O7
A5
A6 11 18 I/O0 I/O0 11 18 I/O6
A6 12
I/O0 A5 17 A0 I/O1 12 17 I/O5
A14 A4 13 16 A1 I/O2 13 16 I/O4
A3 14 15 A2 GND 14 15 I/O3
Column decoder WE
Control
OE
circuit
CE
A A A A A A A
7 8 9 10 11 12 13
6HOHFWLRQJXLGH
7C256-10 7C256-12 7C256-15 7C256-20 Unit
Maximum address access time 10 12 15 20 ns
Maximum output enable access time 3 3 4 5 ns
Maximum operating current 110 105 100 90 mA
Maximum CMOS standby current 2.0 2.0 2.0 2.0 mA
',
',''
$$
$//,$1&(6(0,&21'8&725
Copyright ©1998 Alliance Semiconductor. All rights reserved.
$6&
)XQFWLRQDOGHVFULSWLRQ
The AS7C256 is a high performance CMOS 262,144-bit Static Random Access Memory (SRAM) organized as 32,768 words × 8 bits. It is
designed for memory applications where fast data access, low power, and simple interfacing are desired.
Equal address access and cycle times (tAA, tRC, tWC) of 10/12/15/20 ns with output enable access times (tOE) of 3/3/4/5 ns are ideal for
high performance applications. A chip enable (CE) input permits easy memory expansion with multiple-bank memory organizations.
65$0
When CE is HIGH the device enters standby mode. The standard AS7C256 is guaranteed not to exceed 11 mW power consumption in
standby mode; the L version is guaranteed not to exceed 2.75 mW, and typically requires only 500 µW. The L version also offers 2.0V data
retention, with maximum power consumption in this mode of 300 µW.
A write cycle is accomplished by asserting chip enable (CE) and write enable (WE) LOW. Data on the input pins I/O0-I/O7 is written on the
rising edge of WE (write cycle 1) or CE (write cycle 2). To avoid bus contention, external devices should drive I/O pins only after outputs
have been disabled with output enable (OE) or write enable (WE).
A read cycle is accomplished by asserting chip enable (CE) and output enable (OE) LOW, with write enable (WE) HIGH. The chip drives I/O
pins with the data word referenced by the input address. When chip enable or output enable is HIGH, or write enable is LOW, out put drivers
stay in high-impedance mode.
All chip inputs and outputs are TTL-compatible, and operation is from a single 5V supply. The AS7C256 is packaged in all high volume
industry standard packages.
$EVROXWHPD[LPXPUDWLQJV
Parameter Symbol Min Max Unit
Voltage on any pin relative to GND Vt –0.5 +7.0 V
Power dissipation PD – 1.0 W
Storage temperature (plastic) Tstg –55 +150 oC
7UXWKWDEOH
CE WE OE Data Mode
H X X High Z Standby (ISB, ISB1)
L H H High Z Output disable
L H L Dout Read
L L X Din Write
X = Don’t Care, L = LOW, H = HIGH
65$0
65$0
current Vin = GND to VCC
Output leakage CE = VIH, VCC = max,
|ILO| – 1 – 1 – 1 – 1 µA
current Vout = GND to VCC
Operating power CE = VIL, f = fmax,
ICC – 110 – 105 – 100 – 90 mA
supply current Iout = 0 mA
ISB CE = VIH, f = fmax – 45 – 40 – 30 – 30 mA
Standby power CE > VCC–0.2V, f = 0,
supply current ISB1 Vin ≤ 0.2V or – 2.0 – 2.0 – 2.0 – 2.0 mA
Vin ≥ VCC–0.2V
VOL IOL = 8 mA, VCC = min – 0.4 – 0.4 – 0.4 – 0.4 V
Output voltage
VOH IOH = –4 mA, VCC = min 2.4 – 2.4 – 2.4 – 2.4 – V
.H\WRVZLWFKLQJZDYHIRUPV
Rising input Falling input Undefined output/don’t care
' ,'
$
$//,$1&(6(0,&21'8&725
$6&
5HDGZDYHIRUP3,6,7,9 $GGUHVVFRQWUROOHG
tRC
Address
65$0
tAA tOH
5HDGZDYHIRUP3,6,8,9 &(FRQWUROOHG
tRC1
CE
tOE
OE
tOLZ tOHZ
tACE tCHZ
Dout Data valid
tCLZ
tPD
ICC
tPU
Supply 50% 50% ISB
current
:ULWHZDYHIRUP :(FRQWUROOHG
tWC
tAW tAH
Address
65$0
65$0
tWP
WE
tAS tDW tDH
Din Data valid
tWZ tOW
Dout
:ULWHZDYHIRUP &(FRQWUROOHG
tWC
tAW tAH
Address
tAS tCW
CE
tWP
WE
tWZ tDW tDH
Din Data valid
Dout
'DWDUHWHQWLRQFKDUDFWHULVWLFV
Parameter Symbol Test conditions Min Max Unit
VCC for data retention VDR 2.0 – V
VCC = 2.0V
Data retention current ICCDR – 150 µA
CE ≥ VCC–0.2V
Chip enable to data retention time tCDR 0 – ns
Vin ≥ VCC–0.2V or
Operation recovery time tR tRC – ns
Vin ≤ 0.2V
Input leakage current | ILI | – 1 µA
'DWDUHWHQWLRQZDYHIRUP
Data retention mode
tCDR tR
VDR
CE VIH VIH
' ,'
$
$//,$1&(6(0,&21'8&725
$6&
$&WHVWFRQGLWLRQV
– Output load: see Figure B,
Thevenin equivalent:
except for tCLZ and tCHZ see Figure C.
168W
– Input pulse level: GND to 3.0V. See Figure A. Dout +1.728V
– Input rise and fall times: 5 ns. See Figure A.
65$0
480W 480W
Dout Dout
+3.0V
90% 90% 255W 30 pF* 255W 5 pF* *including scope
and jig capacitance
10% 10%
GND GND GND
Figure A: Input waveform Figure B: Output load Figure C: Output load for tCLZ, tCHZ
1RWHV
1 During VCC power-up, a pull-up resistor to VCC on CE is required to meet ISB specification.
2 This parameter is sampled and not 100% tested.
3 For test conditions, see AC Test Conditions, Figures A, B, C.
4 tCLZ and tCHZ are specified with CL = 5pF as in Figure C. Transition is measured ±500mV from steady-state voltage.
5 This parameter is guaranteed but not tested.
6 WE is HIGH for read cycle.
7 CE and OE are LOW for read cycle.
8 Address valid prior to or coincident with CE transition LOW.
9 All read cycle timings are referenced from the last valid address to the first transitioning address.
10 CE or WE must be HIGH during address transitions.
11 All write cycle timings are referenced from the last valid address to the first transitioning address.
7\SLFDO'&DQG$&FKDUDFWHULVWLFV
Normalized supply current ICC, ISB Normalized supply current ICC, ISB Normalized supply current ISB1
vs. supply voltage VCC vs. ambient temperature Ta vs. ambient temperature Ta
1.4 1.4
65$0
65$0
1.2 1.2 625
Normalized access time tAA Normalized access time tAA Normalized supply current ICC
vs. supply voltage VCC vs. ambient temperature Ta vs. cycle frequency 1/tRC, 1/tWC
1.5 1.5 1.4
Output source current IOH Output sink current IOL Typical access time change ∆tAA
vs. output voltage VOH vs. output voltage VOL vs. output capacitive loading
140 140 35
Output source current (mA)
120 120 30
Output sink current (mA)
' ,'
$
$//,$1&(6(0,&21'8&725
$6&
$6&RUGHULQJLQIRUPDWLRQ
Package / Access time 10 ns 12 ns 15 ns 20 ns
Plastic DIP, 300 mil AS7C256-12PC AS7C256-15PC AS7C256-20PC
AS7C256-10JC AS7C256-12JC AS7C256-15JC AS7C256-20JC
Plastic SOJ, 300 mil
65$0
$6&SDUWQXPEHULQJV\VWHP
AS7C 256 –XX X X
Temperature range,
Device Package:P = PDIP 300 mil J = SOJ 300 mil
SRAM prefix Access time C =Commercial 0°C to 70 °C
number T = TSOP 8×14
I =Industrial -40 to +85 °C
VERSION 2.0
DECEMBER 1998
Philips Semiconductors
2
Philips Semiconductors
NOTE: Neither the 100 kbit/s I2C-bus system nor the • The fixed input levels for new devices are replaced by
100 kbit/s devices have been changed. bus voltage-related levels.
• Application information for bi-directional level shifter is
added.
Purchase of Philips I2C components conveys a license under the Philips’ I2C patent to use the
components in the I2C system provided the system conforms to the I2C specification defined by
Philips.
3
Philips Semiconductors
2 THE I2C-BUS BENEFITS DESIGNERS AND • The number of ICs that can be connected to the same
MANUFACTURERS bus is limited only by a maximum bus capacitance of
400 pF.
In consumer electronics, telecommunications and
industrial electronics, there are often many similarities Figure 1 shows two examples of I2C-bus applications.
between seemingly unrelated designs. For example,
nearly every system includes: 2.1 Designer benefits
• Some intelligent control, usually a single-chip I2C-bus compatible ICs allow a system design to rapidly
microcontroller progress directly from a functional block diagram to a
• General-purpose circuits like LCD drivers, remote I/O prototype. Moreover, since they ‘clip’ directly onto the
ports, RAM, EEPROM, or data converters I2C-bus without any additional external interfacing, they
allow a prototype system to be modified or upgraded
• Application-oriented circuits such as digital tuning and
simply by ‘clipping’ or ‘unclipping’ ICs to or from the bus.
signal processing circuits for radio and video systems,
or DTMF generators for telephones with tone dialling. Here are some of the features of I2C-bus compatible ICs
which are particularly attractive to designers:
To exploit these similarities to the benefit of both systems
designers and equipment manufacturers, as well as to • Functional blocks on the block diagram correspond with
maximize hardware efficiency and circuit simplicity, Philips the actual ICs; designs proceed rapidly from block
developed a simple bi-directional 2-wire bus for efficient diagram to final schematic.
inter-IC control. This bus is called the Inter IC or I2C-bus. • No need to design bus interfaces because the I2C-bus
At present, Philips’ IC range includes more than 150 interface is already integrated on-chip.
CMOS and bipolar I2C-bus compatible types for • Integrated addressing and data-transfer protocol allow
performing functions in all three of the previously systems to be completely software-defined
mentioned categories. All I2C-bus compatible devices
incorporate an on-chip interface which allows them to • The same IC types can often be used in many different
communicate directly with each other via the I2C-bus. This applications
design concept solves the many interfacing problems • Design-time reduces as designers quickly become
encountered when designing digital control circuits. familiar with the frequently used functional blocks
represented by I2C-bus compatible ICs
Here are some of the features of the I2C-bus:
• ICs can be added to or removed from a system without
• Only two bus lines are required; a serial data line (SDA)
affecting any other circuits on the bus
and a serial clock line (SCL)
• Fault diagnosis and debugging are simple; malfunctions
• Each device connected to the bus is software
can be immediately traced
addressable by a unique address and simple
master/slave relationships exist at all times; masters can • Software development time can be reduced by
operate as master-transmitters or as master-receivers assembling a library of reusable software modules.
• It’s a true multi-master bus including collision detection In addition to these advantages, the CMOS ICs in the
and arbitration to prevent data corruption if two or more I2C-bus compatible range offer designers special features
masters simultaneously initiate data transfer which are particularly attractive for portable equipment and
• Serial, 8-bit oriented, bi-directional data transfers can be battery-backed systems.
made at up to 100 kbit/s in the Standard-mode, up to They all have:
400 kbit/s in the Fast-mode, or up to 3.4 Mbit/s in the
• Extremely low current consumption
High-speed mode
• High noise immunity
• On-chip filtering rejects spikes on the bus data line to
preserve data integrity • Wide supply voltage range
• Wide operating temperature range.
4
Philips Semiconductors
MICRO-
CONTROLLER
PCB83C528
PLL
SYNTHESIZER
TSA5512
NON-VOLATILE
MEMORY
PCF8582E
M/S COLOUR
DECODER
TDA9160A
STEREO / DUAL
SOUND
DECODER
SDA SCL
TDA9840
PICTURE DTMF
SIGNAL GENERATOR
IMPROVEMENT
TDA4670 PCD3311
HI-FI LINE
AUDIO INTERFACE
PROCESSOR
TDA9860 PCA1070
VIDEO ADPCM
PROCESSOR
TDA4685 PCD5032
SAA52XX PCD5042
ON-SCREEN MICRO-
DISPLAY CONTROLLER
PCA8510 P80CLXXX
MSB575
(a) (b)
Fig.1 Two examples of I2C-bus applications: (a) a high performance highly-integrated TV set
(b) DECT cordless phone base-station.
5
Philips Semiconductors
6
Philips Semiconductors
SDA
SCL
MICRO -
GATE CONTROLLER
ARRAY ADC B
MBC645
7
Philips Semiconductors
VDD
pull-up
Rp Rp
resistors
SDA (Serial Data Line)
SCLK SCLK
8
Philips Semiconductors
SCL
6.2 START and STOP conditions The bus stays busy if a repeated START (Sr) is generated
instead of a STOP condition. In this respect, the START
Within the procedure of the I2C-bus, unique situations
(S) and repeated START (Sr) conditions are functionally
arise which are defined as START (S) and STOP (P)
identical (see Fig.6). For the remainder of this document,
conditions (see Fig.5).
therefore, the S symbol will be used as a generic term to
A HIGH to LOW transition on the SDA line while SCL is represent both the START and repeated START
HIGH is one such unique case. This situation indicates a conditions, unless Sr is particularly relevant.
START condition.
Detection of START and STOP conditions by devices
A LOW to HIGH transition on the SDA line while SCL is connected to the bus is easy if they incorporate the
HIGH defines a STOP condition. necessary interfacing hardware. However,
microcontrollers with no such interface have to sample the
START and STOP conditions are always generated by the
SDA line at least twice per clock period to sense the
master. The bus is considered to be busy after the START
transition.
condition. The bus is considered to be free again a certain
time after the STOP condition. This bus free situation is
specified in Section 15.
SDA SDA
SCL SCL
S P
9
Philips Semiconductors
7 TRANSFERRING DATA during the HIGH period of this clock pulse (see Fig.7). Of
course, set-up and hold times (specified in Section 15)
7.1 Byte format must also be taken into account.
Every byte put on the SDA line must be 8-bits long. The Usually, a receiver which has been addressed is obliged to
number of bytes that can be transmitted per transfer is generate an acknowledge after each byte has been
unrestricted. Each byte has to be followed by an received, except when the message starts with a CBUS
acknowledge bit. Data is transferred with the most address (see Section 10.1.3).
significant bit (MSB) first (see Fig.6). If a slave can’t
receive or transmit another complete byte of data until it When a slave doesn’t acknowledge the slave address (for
has performed some other function, for example servicing example, it’s unable to receive or transmit because it’s
an internal interrupt, it can hold the clock line SCL LOW to performing some real-time function), the data line must be
force the master into a wait state. Data transfer then left HIGH by the slave. The master can then generate
continues when the slave is ready for another byte of data either a STOP condition to abort the transfer, or a repeated
and releases clock line SCL. START condition to start a new transfer.
In some cases, it’s permitted to use a different format from If a slave-receiver does acknowledge the slave address
the I2C-bus format (for CBUS compatible devices for but, some time later in the transfer cannot receive any
example). A message which starts with such an address more data bytes, the master must again abort the transfer.
can be terminated by generation of a STOP condition, This is indicated by the slave generating the
even during the transmission of a byte. In this case, no not-acknowledge on the first byte to follow. The slave
acknowledge is generated (see Section 10.1.3). leaves the data line HIGH and the master generates a
STOP or a repeated START condition.
7.2 Acknowledge If a master-receiver is involved in a transfer, it must signal
Data transfer with acknowledge is obligatory. The the end of data to the slave- transmitter by not generating
acknowledge-related clock pulse is generated by the an acknowledge on the last byte that was clocked out of
master. The transmitter releases the SDA line (HIGH) the slave. The slave-transmitter must release the data line
during the acknowledge clock pulse. to allow the master to generate a STOP or repeated
START condition.
The receiver must pull down the SDA line during the
acknowledge clock pulse so that it remains stable LOW
byte complete,
interrupt within slave
SCL S Sr
or 1 2 7 8 9 1 2 3-8 9 or
Sr P
ACK ACK
START or STOP or
repeated START repeated START
condition condition
MSC608
10
Philips Semiconductors
DATA OUTPUT
BY TRANSMITTER
not acknowledge
DATA OUTPUT
BY RECEIVER
acknowledge
SCL FROM
MASTER 1 2 8 9
S
clock pulse for
START acknowledgement
condition
MBC602
8 ARBITRATION AND CLOCK GENERATION that a HIGH to LOW transition on the SCL line will cause
the devices concerned to start counting off their LOW
8.1 Synchronization period and, once a device clock has gone LOW, it will hold
All masters generate their own clock on the SCL line to the SCL line in that state until the clock HIGH state is
transfer messages on the I2C-bus. Data is only valid during reached (see Fig.8). However, the LOW to HIGH transition
the HIGH period of the clock. A defined clock is therefore of this clock may not change the state of the SCL line if
needed for the bit-by-bit arbitration procedure to take another clock is still within its LOW period. The SCL line
place. will therefore be held LOW by the device with the longest
LOW period. Devices with shorter LOW periods enter a
Clock synchronization is performed using the wired-AND HIGH wait-state during this time.
connection of I2C interfaces to the SCL line. This means
start counting
wait HIGH period
state
CLK
1
counter
CLK reset
2
SCL
MBC632
11
Philips Semiconductors
When all devices concerned have counted off their LOW to address the same device, arbitration continues with
period, the clock line will be released and go HIGH. There comparison of the data-bits if they are master-transmitter,
will then be no difference between the device clocks and or acknowledge-bits if they are master-receiver. Because
the state of the SCL line, and all the devices will start address and data information on the I2C-bus is determined
counting their HIGH periods. The first device to complete by the winning master, no information is lost during the
its HIGH period will again pull the SCL line LOW. arbitration process.
In this way, a synchronized SCL clock is generated with its A master that loses the arbitration can generate clock
LOW period determined by the device with the longest pulses until the end of the byte in which it loses the
clock LOW period, and its HIGH period determined by the arbitration.
one with the shortest clock HIGH period.
As an Hs-mode master has a unique 8-bit master code, it
will always finish the arbitration during the first byte (see
8.2 Arbitration
Section 13).
A master may start a transfer only if the bus is free. Two or
If a master also incorporates a slave function and it loses
more masters may generate a START condition within the
arbitration during the addressing stage, it’s possible that
minimum hold time (tHD;STA) of the START condition which
the winning master is trying to address it. The losing
results in a defined START condition to the bus.
master must therefore switch over immediately to its slave
Arbitration takes place on the SDA line, while the SCL line mode.
is at the HIGH level, in such a way that the master which
Figure 9 shows the arbitration procedure for two masters.
transmits a HIGH level, while another master is
Of course, more may be involved (depending on how
transmitting a LOW level will switch off its DATA output
many masters are connected to the bus). The moment
stage because the level on the bus doesn’t correspond to
there is a difference between the internal data level of the
its own level.
master generating DATA 1 and the actual level on the SDA
Arbitration can continue for many bits. Its first stage is line, its data output is switched off, which means that a
comparison of the address bits (addressing information is HIGH output level is then connected to the bus. This will
given in Sections 10 and 14). If the masters are each trying not affect the data transfer initiated by the winning master.
DATA
2
SDA
SCL
S MSC609
12
Philips Semiconductors
Since control of the I2C-bus is decided solely on the then hold the SCL line LOW after reception and
address or master code and data sent by competing acknowledgment of a byte to force the master into a wait
masters, there is no central master, nor any order of state until the slave is ready for the next byte transfer in a
priority on the bus. type of handshake procedure (see Fig.6).
Special attention must be paid if, during a serial transfer, On the bit level, a device such as a microcontroller with or
the arbitration procedure is still in progress at the moment without limited hardware for the I2C-bus, can slow down
when a repeated START condition or a STOP condition is the bus clock by extending each clock LOW period. The
transmitted to the I2C-bus. If it’s possible for such a speed of any master is thereby adapted to the internal
situation to occur, the masters involved must send this operating rate of this device.
repeated START condition or STOP condition at the same
position in the format frame. In other words, arbitration isn’t In Hs-mode, this handshake feature can only be used on
allowed between: byte level (see Section 13).
SDA
S P
13
Philips Semiconductors
,,
data transferred
'0' (write) (n bytes + acknowledge)
,,,,,, ,,,, 1
,,,,,, ,,,,
handbook, full pagewidth
S SLAVE ADDRESS R/W A DATA A DATA A P
data transferred
MBC606 (read) (n bytes + acknowledge)
14
Philips Semiconductors
,,,,,
handbook, full pagewidth
read or write
,,,,, ,
DATA A/A Sr SLAVE ADDRESS
(n bytes
+ ack.) *
R/W A DATA A/A
(n bytes
+ ack.) *
P
10 7-BIT ADDRESSING
The addressing procedure for the I2C-bus is such that the
first byte after the START condition usually determines
which slave will be selected by the master. The exception MSB
handbook, halfpage LSB
is the ‘general call’ address which can address all devices. R/W
When this address is used, all devices should, in theory,
respond with an acknowledge. However, devices can be slave address
MBC608
made to ignore this address. The second byte of the
general call address then defines the action to be taken. Fig.14 The first byte after the START procedure.
This procedure is explained in more detail in
Section 10.1.1. For information on 10-bit addressing, see
Section 14
A slave address can be made-up of a fixed and a
programmable part. Since it’s likely that there will be
10.1 Definition of bits in the first byte
several identical devices in a system, the programmable
The first seven bits of the first byte make up the slave part of the slave address enables the maximum possible
address (see Fig.14). The eighth bit is the LSB (least number of such devices to be connected to the I2C-bus.
significant bit). It determines the direction of the message. The number of programmable address bits of a device
A ‘zero’ in the least significant position of the first byte depends on the number of pins available. For example, if
means that the master will write information to a selected a device has 4 fixed and 3 programmable address bits, a
slave. A ‘one’ in this position means that the master will total of 8 identical devices can be connected to the same
read information from the slave. bus.
When an address is sent, each device in a system The I2C-bus committee coordinates allocation of I2C
compares the first seven bits after the START condition addresses. Further information can be obtained from the
with its address. If they match, the device considers itself Philips representatives listed on the back cover. Two
addressed by the master as a slave-receiver or groups of eight addresses (0000XXX and 1111XXX) are
slave-transmitter, depending on the R/W bit. reserved for the purposes shown in Table 2. The bit
combination 11110XX of the slave address is reserved for
10-bit addressing (see Section 14).
15
Philips Semiconductors
16
Philips Semiconductors
,,,,,,,,
S
,,,,
00000000 A MASTER ADDRESS
general second
(B)
1 A DATA A DATA A
(n bytes + ack.)
P
In some systems, an alternative could be that the an interface, it must constantly monitor the bus via
hardware master transmitter is set in the slave-receiver software. Obviously, the more times the microcontroller
mode after the system reset. In this way, a system monitors, or polls the bus, the less time it can spend
configuring master can tell the hardware master- carrying out its intended function.
transmitter (which is now in slave-receiver mode) to which There is therefore a speed difference between fast
address data must be sent (see Fig.17). After this hardware devices and a relatively slow microcontroller
programming procedure, the hardware master remains in which relies on software polling.
the master-transmitter mode.
In this case, data transfer can be preceded by a start
10.1.2 START BYTE procedure which is much longer than normal (see Fig.18).
The start procedure consists of:
Microcontrollers can be connected to the I2C-bus in two
• A START condition (S)
ways. A microcontroller with an on-chip hardware I2C-bus
interface can be programmed to be only interrupted by • A START byte (00000001)
requests from the bus. When the device doesn’t have such • An acknowledge clock pulse (ACK)
• A repeated START condition (Sr).
,,,,,,,,,,,, ,,
,,,,,,,,,,,,,,
handbook, full pagewidth
S SLAVE ADDR. H/W MASTER R/W A DUMP ADDR. FOR H/W MASTER X A P
write
,,,,,,,
,, ,,
,,
(a)
,,,,,,,
,,,,,,
S DUMP ADDR. FROM H/W MASTER R/W A DATA A DATA A/A P
MBC609
write
(n bytes + ack.)
(b)
Fig.17 Data transfer by a hardware-transmitter capable of dumping data directly to slave devices.
(a) Configuring master sends dump address to hardware master
(b) Hardware master dumps data to selected slave.
17
Philips Semiconductors
SDA dummy
acknowledge
(HIGH)
SCL 1 2 7 8 9
S ACK Sr
After the START condition S has been transmitted by a 10.1.3 CBUS COMPATIBILITY
master which requires bus access, the START byte
CBUS receivers can be connected to the Standard-mode
(00000001) is transmitted. Another microcontroller can
I2C-bus. However, a third bus line called DLEN must then
therefore sample the SDA line at a low sampling rate until
be connected and the acknowledge bit omitted. Normally,
one of the seven zeros in the START byte is detected.
I2C transmissions are sequences of 8-bit bytes; CBUS
After detection of this LOW level on the SDA line, the
compatible devices have different formats.
microcontroller can switch to a higher sampling rate to find
the repeated START condition Sr which is then used for In a mixed bus structure, I2C-bus devices must not
synchronization. respond to the CBUS message. For this reason, a special
CBUS address (0000001X) to which no I2C-bus
A hardware receiver will reset on receipt of the repeated
compatible device will respond, has been reserved. After
START condition Sr and will therefore ignore the START
transmission of the CBUS address, the DLEN line can be
byte.
made active and a CBUS-format transmission sent (see
An acknowledge-related clock pulse is generated after the Fig.19). After the STOP condition, all devices are again
START byte. This is present only to conform with the byte ready to accept data.
handling format used on the bus. No device is allowed to
Master-transmitters can send CBUS formats after sending
acknowledge the START byte.
the CBUS address. The transmission is ended by a STOP
condition, recognized by all devices.
NOTE: If the CBUS configuration is known, and expansion
with CBUS compatible devices isn’t foreseen, the designer
is allowed to adapt the hold time to the specific
requirements of the device(s) used.
18
Philips Semiconductors
SDA
SCL
DLEN
S P
11 EXTENSIONS TO THE STANDARD-MODE I2C-BUS apparent that more address combinations were required
SPECIFICATION to prevent problems with the allocation of slave
addresses for new devices. This problem was resolved
The Standard-mode I2C-bus specification, with its data with the new 10-bit addressing scheme, which allowed
transfer rate of up to 100 kbit/s and 7-bit addressing, has about a tenfold increase in available addresses.
been in existence since the beginning of the 1980’s. This
concept rapidly grew in popularity and is today accepted New slave devices with a Fast- or Hs-mode I2C-bus
worldwide as a de facto standard with several hundred interface can have a 7- or a 10-bit slave address. If
different compatible ICs on offer from Philips possible, a 7-bit address is preferred as it is the cheapest
Semiconductors and other suppliers. To meet the hardware solution and results in the shortest message
demands for higher speeds, as well as make available length. Devices with 7- and 10-bit addresses can be mixed
more slave address for the growing number of new in the same I2C-bus system regardless of whether it is an
devices, the Standard-mode I2C-bus specification was F/S- or Hs-mode system. Both existing and future masters
upgraded over the years and today is available with the can generate either 7- or 10-bit addresses.
following extensions:
• Fast-mode, with a bit rate up to 400 kbit/s. 12 FAST-MODE
• High-speed mode (Hs-mode), with a bit rate up to With the Fast-mode I2C-bus specification, the protocol,
3.4 Mbit/s. format, logic levels and maximum capacitive load for the
• 10-bit addressing, which allows the use of up to 1024 SDA and SCL lines quoted in the Standard-mode I2C-bus
additional slave addresses. specification are unchanged. New devices with an I2C-bus
interface must meet at least the minimum requirements of
There are two main reasons for extending the regular
the Fast- or Hs-mode specification (see Section 13).
I2C-bus specification:
• Many of today’s applications need to transfer large Fast-mode devices can receive and transmit at up to
amounts of serial data and require bit rates far in excess 400 kbit/s. The minimum requirement is that they can
of 100 kbit/s (Standard-mode), or even 400 kbit/s synchronize with a 400 kbit/s transfer; they can then
(Fast-mode). As a result of continuing improvements in prolong the LOW period of the SCL signal to slow down the
semiconductor technologies, I2C-bus devices are now transfer. Fast-mode devices are downward-compatible
available with bit rates of up to 3.4 Mbit/s (Hs-mode) and can communicate with Standard-mode devices in a
without any noticeable increases in the manufacturing 0 to 100 kbit/s I2C-bus system. As Standard-mode
cost of the interface circuitry. devices, however, are not upward compatible, they should
not be incorporated in a Fast-mode I2C-bus system as
• As most of the 112 addresses available with the 7-bit they cannot follow the higher transfer rate and
addressing scheme were soon allocated, it became unpredictable states would occur.
19
Philips Semiconductors
The Fast-mode I2C-bus specification has the following current-source of one master is enabled at any one time,
additional features compared with the Standard-mode: and only during Hs-mode.
• The maximum bit rate is increased to 400 kbit/s. • No arbitration or clock synchronization is performed
• Timing of the serial data (SDA) and serial clock (SCL) during Hs-mode transfer in multi-master systems, which
signals has been adapted. There is no need for speeds-up bit handling capabilities. The arbitration
compatibility with other bus systems such as CBUS procedure always finishes after a preceding master
because they cannot operate at the increased bit rate. code transmission in F/S-mode.
• The inputs of Fast-mode devices incorporate spike • Hs-mode master devices generate a serial clock signal
suppression and a Schmitt trigger at the SDA and SCL with a HIGH to LOW ratio of 1 to 2. This relieves the
inputs. timing requirements for set-up and hold times.
• The output buffers of Fast-mode devices incorporate • As an option, Hs-mode master devices can have a
slope control of the falling edges of the SDA and SCL built-in bridge(1). During Hs-mode transfer, the high
signals. speed data (SDAH) and high-speed serial clock (SCLH)
lines of Hs-mode devices are separated by this bridge
• If the power supply to a Fast-mode device is switched from the SDA and SCL lines of F/S-mode devices. This
off, the SDA and SCL I/O pins must be floating so that reduces the capacitive load of the SDAH and SCLH
they don’t obstruct the bus lines. lines resulting in faster rise and fall times.
• The external pull-up devices connected to the bus lines • The only difference between Hs-mode slave devices
must be adapted to accommodate the shorter maximum and F/S-mode slave devices is the speed at which they
permissible rise time for the Fast-mode I2C-bus. For bus operate. Hs-mode slaves have open-drain output buffers
loads up to 200 pF, the pull-up device for each bus line on the SCLH and SDAH outputs. Optional pull-down
can be a resistor; for bus loads between 200 pF and transistors on the SCLH pin can be used to stretch the
400 pF, the pull-up device can be a current source LOW level of the SCLH signal, although this is only
(3 mA max.) or a switched resistor circuit (see Fig.43). allowed after the acknowledge bit in Hs-mode transfers.
• The inputs of Hs-mode devices incorporate spike
13 Hs-MODE suppression and a Schmitt trigger at the SDAH and
SCLH inputs.
High-speed mode (Hs-mode) devices offer a quantum
leap in I2C-bus transfer speeds. Hs-mode devices can • The output buffers of Hs-mode devices incorporate
transfer information at bit rates of up to 3.4 Mbit/s, yet they slope control of the falling edges of the SDAH and SCLH
remain fully downward compatible with Fast- or signals.
Standard-mode (F/S-mode) devices for bi-directional Figure 20 shows the physical I2C-bus configuration in a
communication in a mixed-speed bus system. With the system with only Hs-mode devices. Pins SDA and SCL on
exception that arbitration and clock synchronization is not the master devices are only used in mixed-speed bus
performed during the Hs-mode transfer, the same serial systems and are not connected in an Hs-mode only
bus protocol and data format is maintained as with the system. In such cases, these pins can be used for other
F/S-mode system. Depending on the application, new functions.
devices may have a Fast or Hs-mode I2C-bus interface,
although Hs-mode devices are preferred as they can be Optional series resistors Rs protect the I/O stages of the
designed-in to a greater number of applications. I2C-bus devices from high-voltage spikes on the bus lines
and minimize ringing and interference.
13.1 High speed transfer Pull-up resistors Rp maintain the SDAH and SCLH lines at
To achieve a bit transfer of up to 3.4 Mbit/s the following a HIGH level when the bus is free and ensure the signals
improvements have been made to the regular I2C-bus are pulled up from a LOW to a HIGH level within the
specification: required rise time. For higher capacitive bus-line loads
(>100 pF), the resistor Rp can be replaced by external
• Hs-mode master devices have an open-drain output
current source pull-ups to meet the rise time requirements.
buffer for the SDAH signal and a combination of an
Unless proceeded by an acknowledge bit, the rise time of
open-drain pull-down and current-source pull-up circuit
the SCLH clock pulses in Hs-mode transfers is shortened
on the SCLH output(1). This current-source circuit
by the internal current-source pull-up circuit MCS of the
shortens the rise time of the SCLH signal. Only the
active master.
(1) Patent application pending.
20
Philips Semiconductors
Rp Rp
SDAH
SCLH
Rs Rs Rs Rs Rs Rs Rs Rs
(1) (1) (1) (1)
SDAH SCLH SDAH SCLH SDAH SCLH SDA SCL SDAH SCLH SDA SCL
MCS MCS
(4) (4) (3) (3)
VDD VDD
(1) SDA and SCL are not used here but may be used for other functions.
(2) To input filter.
(3) Only the active master can enable its current-source pull-up circuit
(4) Dotted transistors are optional open-drain outputs which can stretch the serial clock signal SCLH.
13.2 Serial data transfer format in Hs-mode master code for an Hs-mode master device is software
programmable and is chosen by the System Designer.
Serial data transfer format in Hs-mode meets the
Standard-mode I2C-bus specification. Hs-mode can only Arbitration and clock synchronization only take place
commence after the following conditions (all of which are during the transmission of the master code and
in F/S-mode): not-acknowledge bit (A), after which one winning master
1. START condition (S) remains active. The master code indicates to other
devices that an Hs-mode transfer is to begin and the
2. 8-bit master code (00001XXX) connected devices must meet the Hs-mode specification.
3. not-acknowledge bit (A) As no device is allowed to acknowledge the master code,
the master code is followed by a not-acknowledge (A).
Figures 21 and 22 show this in more detail. This master
code has two main functions: After the not-acknowledge bit (A), and the SCLH line has
• It allows arbitration and synchronization between been pulled-up to a HIGH level, the active master switches
competing masters at F/S-mode speeds, resulting in to Hs-mode and enables (at time tH, see Fig.22) the
one winning master. current-source pull-up circuit for the SCLH signal. As other
devices can delay the serial transfer before tH by stretching
• It indicates the beginning of an Hs-mode transfer.
the LOW period of the SCLH signal, the active master will
Hs-mode master codes are reserved 8-bit codes, which enable its current-source pull-up circuit when all devices
are not used for slave addressing or other purposes. have released the SCLH line and the SCLH signal has
Furthermore, as each master has its own unique master reached a HIGH level, thus speeding up the last part of the
code, up to eight Hs-mode masters can be present on the rise time of the SCLH signal.
one I2C-bus system (although master code 0000 1000
The active master then sends a repeated START condition
should be reserved for test and diagnostic purposes). The
(Sr) followed by a 7-bit slave address (or 10-bit slave
21
Philips Semiconductors
address, see Section 14) with a R/W bit address, and SCLH signal reaches a HIGH level, and so speeds up the
receives an acknowledge bit (A) from the selected slave. last part of the SCLH signal’s rise time.
After each acknowledge bit (A) or not-acknowledge bit (A) Data transfer continues in Hs-mode after the next
the active master disables its current-source pull-up repeated START (Sr), and only switches back to
circuit. This enables other devices to delay the serial F/S-mode after a STOP condition (P). To reduce the
transfer by stretching the LOW period of the SCLH signal. overhead of the master code, it’s possible that a master
The active master re-enables its current-source pull-up links a number of Hs-mode transfers, separated by
circuit again when all devices have released and the repeated START conditions (Sr).
,,,,,,,,,, ,,
handbook, full pagewidth Hs-mode (current-source for SCLH enabled)
F/S-mode F/S-mode
,,,,,,,,,,
S MASTER CODE A Sr SLAVE ADD. R/W A DATA
,,
A/A P
,,,,
(n bytes + ack.)
Hs-mode continues
t1
8-bit Master code 00001xxx A
handbook, full pagewidth S tH
SDAH
SCLH 1 2 to 5 6 7 8 9
F/S mode
SDAH
SCLH 1 2 to 5 6 7 8 9 1 2 to 5 6 7 8 9
If P then
Hs-mode F/S mode
If Sr (dotted lines)
then Hs-mode
tH
tFS MSC618
= MCS current source pull-up
= Rp resistor pull-up
Fig.22 A complete Hs-mode transfer.
22
Philips Semiconductors
13.3 Switching from F/S- to Hs-mode and back The non-active, or loosing masters:
After reset and initialization, Hs-mode devices must be in 1. Adapt their SDAH and SCLH input filters according to
Fast-mode (which is in effect F/S-mode as Fast-mode is the spike suppression requirement in Hs-mode.
downward compatible with Standard-mode). Each 2. Wait for a STOP condition to detect when the bus is
Hs-mode device can switch from Fast- to Hs-mode and free again.
back and is controlled by the serial transfer on the I2C-bus.
All slaves:
Before time t1 in Fig.22, each connected device operates 1. Adapt their SDAH and SCLH input filters according to
in Fast-mode. Between times t1 and tH (this time interval the spike suppression requirement in Hs-mode.
can be stretched by any device) each connected device
must recognized the “S 00001XXX A” sequence and has 2. Adapt the set-up and hold times according to the
to switch its internal circuit from the Fast-mode setting to Hs-mode requirements. This requirement may already
the Hs-mode setting. Between times t1 and tH the be fulfilled by the adaptation of the input filters.
connected master and slave devices perform this 3. Adapt the slope control of their SDAH output stages, if
switching by the following actions. necessary. For slave devices, slope control is
applicable for the SDAH output stage only and,
The active (winning) master:
depending on circuit tolerances, both the Fast- and
1. Adapts its SDAH and SCLH input filters according to Hs-mode requirements may be fulfilled without
the spike suppression requirement in Hs-mode. switching its internal circuit.
2. Adapts the set-up and hold times according to the At time tFS in Fig.22, each connected device must
Hs-mode requirements. recognize the STOP condition (P) and switch its internal
3. Adapts the slope control of its SDAH and SCLH output circuit from the Hs-mode setting back to the Fast-mode
stages according to the Hs-mode requirement. setting as present before time t1. This must be completed
4. Switches to the Hs-mode bit-rate, which is required within the minimum bus free time as specified in Table 5
after time tH. according to the Fast-mode specification.
5. Enables the current source pull-up circuit of its SCLH
output stage at time tH.
23
Philips Semiconductors
13.4 Hs-mode devices at lower speed modes F/S-mode and communicate at F/S-mode speeds with
their current-source disabled. The SDAH and SCLH pins
Hs-mode devices are fully downwards compatible, and
are used to connect to the F/S-mode bus system, allowing
can be connected to an F/S-mode I2C-bus system (see
the SDA and SCL pins (if present) on the Hs-mode master
Fig.23). As no master code will be transmitted in such a
device to be used for other functions.
configuration, all Hs-mode master devices stay in
Rp Rp
SDA
SCL
Rs Rs Rs Rs Rs Rs Rs Rs Rs Rs
(1) (1)
SDAH SCLH SDAH SCLH SDAH SCLH SDA SCL SDA SCL SDA SCL
(2) (2) (2) (2) (2) (2) (2) (2) (2) (2)
(3)
(4) (4) (4)
VDD
(1) Bridge not used. SDA and SCL may have an alternative function.
(2) To input filter.
(3) The current-source pull-up circuit stays disabled.
(4) Dotted transistors are optional open-drain outputs which can stretch the serial clock signal SCL.
13.5 Mixed speed modes on one serial bus system a high impedance between the drain and source of each
switched on transistor. In the latter case, the transistors will
If a system has a combination of Hs-, Fast- and/or
act as a level shifter as SDAH and SCLH will be pulled-up
Standard-mode devices, it’s possible, by using an
to VDD1 and SDA and SCL will be pulled-up to VDD2
interconnection bridge, to have different bit rates between
different devices (see Figs 24 and 25). During F/S-mode speed, a bridge on one of the Hs-mode
masters connects the SDAH and SCLH lines to the
One bridge is required to connect/disconnect an Hs-mode
corresponding SDA and SCL lines thus permitting
section to/from an F/S-mode section at the appropriate
Hs-mode devices to communicate with F/S-mode devices
time. This bridge includes a level shift function that allows
at slower speeds. Arbitration and synchronization is
devices with different supply voltages to be connected. For
possible during the total F/S-mode transfer between all
example F/S-mode devices with a VDD2 of 5 V can be
connected devices as described in Section 8. During
connected to Hs-mode devices with a VDD1 of 3 V or less
Hs-mode transfer, however, the bridge opens to separate
(i.e. where VDD2 ≥ VDD1), provided SDA and SCL pins are
the two bus sections and allows Hs-mode devices to
5 V tolerant. This bridge is incorporated in Hs-mode
communicate with each other at 3.4 Mbit/s. Arbitration
master devices and is completely controlled by the serial
between Hs-mode devices and F/S-mode devices is only
signals SDAH, SCLH, SDA and SCL. Such a bridge can be
performed during the master code (00001XXX), and
implemented in any IC as an autonomous circuit.
normally won by one Hs-mode master as no slave address
TR1, TR2 and TR3 are N-channel transistors. TR1 and has four leading zeros. Other masters can win the
TR2 have a transfer gate function, and TR3 is an open- arbitration only if they send a reserved 8-bit code
drain pull-down stage. If TR1 or TR2 are switched on they (00000XXX). In such cases, the bridge remains closed
transfer a LOW level in both directions, otherwise when and the transfer proceeds in F/S-mode. Table 3 gives the
both the drain and source rise to a HIGH level there will be possible communication speeds in such a system.
24
Philips Semiconductors
VDD1 VDD2
Rp Rp BRIDGE Rp Rp
Rs TR1
SDAH SDAH SDA
Rs TR2
SCLH SCLH SCL
Rs Rs Rs Rs Rs Rs Rs Rs Rs Rs
TR3
(1) (1)
SDAH SCLH SDAH SCLH SDAH SCLH SDA SCL VSS SDA SCL SDA SCL
(2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2)
MCS MCS
(4) (4) (3) (3) (4)
VDD VDD
(1) Bridge not used. SDA and SCL may have an alternative function.
(2) To input filter.
(3) Only the active master can enable its current-source pull-up circuit.
(4) Dotted transistors are optional open-drain outputs which can stretch the serial clock signal SCL or SCLH.
13.5.1 F/S-MODE TRANSFER IN A MIXED-SPEED BUS 13.5.2 HS-MODE TRANSFER IN A MIXED-SPEED BUS
SYSTEM SYSTEM
The bridge shown in Fig.24 interconnects corresponding Figure 25 shows the timing diagram of a complete
serial bus lines, forming one serial bus system. As no Hs-mode transfer, which is invoked by a START condition,
master code (00001XXX) is transmitted, the a master code, and a not-acknowledge A (at F/S-mode
current-source pull-up circuits stay disabled and all output speed). Although this timing diagram is split in two parts, it
stages are open-drain. All devices, including Hs-mode should be viewed as one timing diagram were time point tH
devices, communicate with each other according the is a common point for both parts.
protocol, format and speed of the F/S-mode I2C-bus
specification.
25
Philips Semiconductors
t1
handbook, full pagewidth 8-bit Master code 00001xxx A
S tH
SDAH
SCLH 1 2 to 5 6 7 8 9
SDA
SCL 1 2 to 5 6 7 8 9
F/S mode
SDAH
SCLH 1 2 to 5 6 7 8 9 1 2 to 5 6 7 8 9
P
SDA t2
SCL If P then
Hs-mode F/S mode
If Sr (dotted lines)
then Hs-mode
tH
tFS
MSC611
= MCS current source pull-up
= Rp resistor pull-up
The master code is recognized by the bridge in the active 2. When both SCLH and SCL become HIGH (tH in
or non-active master (see Fig.24). The bridge performs the Fig.25), transistor TR2 opens to separate the SCLH
following actions: and SCL lines. TR2 must be opened before SCLH
goes LOW after Sr.
1. Between t1 and tH (see Fig.25), transistor TR1 opens
to separate the SDAH and SDA lines, after which Hs-mode transfer starts after tH with a repeated START
transistor TR3 closes to pull-down the SDA line to VSS. condition (Sr). During Hs-mode transfer, the SCL line
stays at a HIGH and the SDA line at a LOW steady-state
level, and so is prepared for the transfer of a STOP
condition (P).
26
Philips Semiconductors
After each acknowledge (A) or not-acknowledge bit (A) the seven bits of the first byte following a START (S) or
active master disables its current-source pull-up circuit. repeated START (Sr) condition as explained in Section
This enables other devices to delay the serial transfer by 10.1. The 10-bit addressing does not affect the existing
stretching the LOW period of the SCLH signal. The active 7-bit addressing. Devices with 7-bit and 10-bit addresses
master re-enables its current-source pull-up circuit again can be connected to the same I2C-bus, and both 7-bit and
when all devices are released and the SCLH signal 10-bit addressing can be used in F/S-mode and Hs-mode
reaches a HIGH level, and so speeds up the last part of the systems.
SCLH signal’s rise time. In irregular situations, F/S-mode
Although there are eight possible combinations of the
devices can close the bridge (TR1 and TR2 closed, TR3
reserved address bits 1111XXX, only the four
open) at any time by pulling down the SCL line for at least
combinations 11110XX are used for 10-bit addressing.
1 µs, e.g. to recover from a bus hang-up.
The remaining four combinations 11111XX are reserved
Hs-mode finishes with a STOP condition and brings the for future I2C-bus enhancements.
bus system back into the F/S-mode. The active master
disables its current-source MCS when the STOP condition 14.1 Definition of bits in the first two bytes
(P) at SDAH is detected (tFS in Fig.25). The bridge also
The 10-bit slave address is formed from the first two bytes
recognizes this STOP condition and takes the following
following a START condition (S) or a repeated START
actions:
condition (Sr).
1. Transistor TR2 closes after tFS to connect SCLH with
SCL; both of which are HIGH at this time. Transistor The first seven bits of the first byte are the combination
TR3 opens after tFS, which releases the SDA line and 11110XX of which the last two bits (XX) are the two
allows it to be pulled HIGH by the pull-up resister Rp. most-significant bits (MSBs) of the 10-bit address; the
This is the STOP condition for the F/S-mode devices. eighth bit of the first byte is the R/W bit that determines the
TR3 must open fast enough to ensure the bus free direction of the message. A ‘zero’ in the least significant
time between the STOP condition and the earliest next position of the first byte means that the master will write
START condition is according to the Fast-mode information to a selected slave. A ‘one’ in this position
specification (see tBUF in Table 5). means that the master will read information from the slave.
2. When SDA reaches a HIGH (t2 in Fig.25) transistor If the R/W bit is ‘zero’, then the second byte contains the
TR1 closes to connect SDAH with SDA. (Note: remaining 8 bits (XXXXXXXX) of the 10-bit address. If the
interconnections are made when all lines are HIGH, R/W bit is ‘one’, then the next byte contains data
thus preventing spikes on the bus lines). TR1 and TR2 transmitted from a slave to a master.
must be closed within the minimum bus free time
according to the Fast-mode specification (see tBUF in 14.2 Formats with 10-bit addresses
Table 5).
Various combinations of read/write formats are possible
within a transfer that includes 10-bit addressing. Possible
13.5.3 TIMING REQUIREMENTS FOR THE BRIDGE IN A
data transfer formats are:
MIXED-SPEED BUS SYSTEM
• Master-transmitter transmits to slave-receiver with a
It can be seen from Fig.25 that the actions of the bridge at 10-bit slave address.
t1, tH and tFS must be so fast that it does not affect the The transfer direction is not changed (see Fig.26). When
SDAH and SCLH lines. Furthermore the bridge must meet a 10-bit address follows a START condition, each slave
the related timing requirements of the Fast-mode compares the first seven bits of the first byte of the slave
specification for the SDA and SCL lines. address (11110XX) with its own address and tests if the
eighth bit (R/W direction bit) is 0. It is possible that more
14 10-BIT ADDRESSING than one device will find a match and generate an
acknowledge (A1). All slaves that found a match will
This section describes 10-bit addressing and can be compare the eight bits of the second byte of the slave
disregarded if only 7-bit addressing is used. address (XXXXXXXX) with their own addresses, but
10-bit addressing is compatible with, and can be combined only one slave will find a match and generate an
with, 7-bit addressing. Using 10 bits for addressing acknowledge (A2). The matching slave will remain
exploits the reserved combination 1111XXX for the first addressed by the master until it receives a STOP
27
Philips Semiconductors
condition (P) or a repeated START condition (Sr) • Combined format. A master transmits data to one slave
followed by a different slave address. and then transmits data to another slave (Fig.29). The
• Master-receiver reads slave- transmitter with a 10-bit same master occupies the bus all the time.
slave address. • Combined format. 10-bit and 7-bit addressing combined
The transfer direction is changed after the second R/W in one serial transfer (Fig.30). After each START
bit (Fig.27). Up to and including acknowledge bit A2, the condition (S), or each repeated START condition (Sr), a
procedure is the same as that described for a 10-bit or 7-bit slave address can be transmitted.
master-transmitter addressing a slave-receiver. After Figure 27 shows how a master-transmits data to a slave
the repeated START condition (Sr), a matching slave with a 7-bit address and then transmits data to a second
remembers that it was addressed before. This slave slave with a 10-bit address. The same master occupies
then checks if the first seven bits of the first byte of the the bus all the time.
slave address following Sr are the same as they were
NOTES:
after the START condition (S), and tests if the eighth
(R/W) bit is 1. If there is a match, the slave considers 1. Combined formats can be used, for example, to
that it has been addressed as a transmitter and control a serial memory. During the first data byte, the
generates acknowledge A3. The slave-transmitter internal memory location has to be written. After the
remains addressed until it receives a STOP condition START condition and slave address is repeated, data
(P) or until it receives another repeated START can be transferred.
condition (Sr) followed by a different slave address. 2. All decisions on auto-increment or decrement of
After a repeated START condition (Sr), all the other previously accessed memory locations etc. are taken
slave devices will also compare the first seven bits of the by the designer of the device.
first byte of the slave address (11110XX) with their own 3. Each byte is followed by an acknowledgment bit as
addresses and test the eighth (R/W) bit. However, none indicated by the A or blocks in the sequence.
of them will be addressed because R/W = 1 (for 10-bit
devices), or the 11110XX slave address (for 7-bit 4. I2C-bus compatible devices must reset their bus logic
devices) does not match. on receipt of a START or repeated START condition
such that they all anticipate the sending of a slave
• Combined format. A master transmits data to a slave address.
and then reads data from the same slave (Fig.28). The
same master occupies the bus all the time. The transfer
direction is changed after the second R/W bit.
,,,,,
,,,,
,, ,,,,
,,,,,
,,,,
,, ,,,,
handbook, full pagewidth 1 1 1 1 0 X X 0
SLAVE ADDRESS SLAVE ADDRESS
S R/W A1 A2 DATA A DATA A/A P
1st 7 BITS 2nd BYTE
MBC613
(write)
,,,,,,,,
,,,,, , ,,
handbook, full pagewidth1 1 1 1 0 X X 0 1 1 1 1 0 X X 1
SLAVE ADDRESS SLAVE ADDRESS SLAVE ADDRESS
S R/W A1 A2 Sr R/W A3 DATA A DATA A P
1st 7 BITS 2nd BYTE 1st 7 BITS
MBC614
(write) (read)
28
Philips Semiconductors
,,,,,,,,,,,,
,,,,,,,,,,,,
handbook, full pagewidth
1 1 1 1 0 X X 0
SLAVE ADDRESS SLAVE ADDRESS
S R/W A A DATA A DATA A/A
,,,,,,, ,,
1st 7 BITS 2nd BYTE
,,,,,,, ,,
(write)
1 1 1 1 0 X X 1
MBC615
(read)
,,,,,,,,,
,,
,,,,,,,,, ,,
,,,,
handbook, full pagewidth 1 1 1 1 0 X X
S
SLAVE ADDRESS
R/W A
0
SLAVE ADDRESS
A DATA A DATA A/A
,,,,,
,,,,,,,,,,
1st 7 BITS 2nd BYTE
(write)
,,,,,
,,,,,,,,,,
1 1 1 1 0 X X 0
SLAVE ADDRESS SLAVE ADDRESS
Sr R/W A A DATA A DATA A/A P
1st 7 BITS 2nd BYTE
(write) MBC616
Fig.29 Combined format. A master transmits data to two slaves, both with 10-bit addresses.
,,,,,,,,
,,,,,,,,
dbook, full pagewidth 0
(write)
,,,,,
,,,,,,,,, 1 1 1 1 0 X X 0
,,,,,
,,,,,,,,,
1st 7 BITS OF 10-BIT 2nd BYTE OF 10-BIT
Sr R/W A SLAVE ADDRESS A DATA A DATA A/A P
SLAVE ADDRESS
(write) MBC617
Fig.30 Combined format. A master transmits data to two slaves, one with a 7-bit address,
and one with a 10-bit address.
29
Philips Semiconductors
14.3 General call address and start byte with 10-bit 15 ELECTRICAL SPECIFICATIONS AND TIMING FOR
addressing I/O STAGES AND BUS LINES
The 10-bit addressing procedure for the I2C-bus is such 15.1 Standard- and Fast-mode devices
that the first two bytes after the START condition (S)
The I/O levels, I/O current, spike suppression, output slope
usually determine which slave will be selected by the
control and pin capacitance for F/S-mode I2C-bus devices
master. The exception is the “general call” address
are given in Table 4. The I2C-bus timing characteristics,
00000000 (H‘00’). Slave devices with 10-bit addressing
bus-line capacitance and noise margin are given in
will react to a “general call” in the same way as slave
Table 5. Figure 31 shows the timing definitions for the
devices with 7-bit addressing (see Section 10.1.1).
I2C-bus.
Hardware masters can transmit their 10-bit address after a
The minimum HIGH and LOW periods of the SCL clock
‘general call’. In this case, the ‘general call’ address byte is
specified in Table 5 determine the maximum bit transfer
followed by two successive bytes containing the 10-bit
rates of 100 kbit/s for Standard-mode devices and
address of the master-transmitter. The format is as shown
400 kbit/s for Fast-mode devices. Standard-mode and
in Fig.16 where the first DATA byte contains the eight
Fast-mode I2C-bus devices must be able to follow
least-significant bits of the master address.
transfers at their own maximum bit rates, either by being
The START byte 00000001 (H‘01’) can precede the 10-bit able to transmit or receive at that speed or by applying the
addressing in the same way as for 7-bit addressing (see clock synchronization procedure described in Section 8
Section 10.1.2). which will force the master into a wait state and stretch the
LOW period of the SCL signal. Of course, in the latter case
the bit transfer rate is reduced.
30
Philips Semiconductors
Table 4 Characteristics of the SDA and SCL I/O stages for F/S-mode I2C-bus devices
STANDARD-MODE FAST-MODE
PARAMETER SYMBOL UNIT
MIN. MAX. MIN. MAX.
LOW level input voltage: VIL
fixed input levels −0.5 1.5 n/a n/a V
VDD-related input levels −0.5 0.3VDD −0.5 0.3VDD (1) V
HIGH level input voltage: VIH
fixed input levels 3.0 (2) n/a n/a V
VDD-related input levels 0.7VDD (2) 0.7VDD(1) (2) V
Hysteresis of Schmitt trigger inputs: Vhys
VDD > 2 V n/a n/a 0.05VDD – V
VDD < 2 V n/a n/a 0.1VDD – V
LOW level output voltage (open drain or
open collector) at 3 mA sink current:
VDD > 2 V VOL1 0 0.4 0 0.4 V
VDD < 2 V VOL3 n/a n/a 0 0.2VDD V
Output fall time from VIHmin to VILmax with
a bus capacitance from 10 pF to 400 pF tof – 250(4) 20 + 0.1Cb(3) 250(4) ns
Pulse width of spikes which must be tSP n/a n/a 0 50 ns
suppressed by the input filter
Input current each I/O pin with an input Ii −10 10 −10(5) 10(5) µA
voltage between 0.1VDD and 0.9VDDmax
Capacitance for each I/O pin Ci − 10 − 10 pF
Notes
1. Devices that use non-standard supply voltages which do not conform to the intended I2C-bus system levels must
relate their input levels to the VDD voltage to which the pull-up resistors Rp are connected.
2. Maximum VIH = VDDmax + 0.5 V.
3. Cb = capacitance of one bus line in pF.
4. The maximum tf for the SDA and SCL bus lines quoted in Table 5 (300 ns) is longer than the specified maximum tof
for the output stages (250 ns). This allows series protection resistors (Rs) to be connected between the SDA/SCL
pins and the SDA/SCL bus lines as shown in Fig.36 without exceeding the maximum specified tf.
5. I/O pins of Fast-mode devices must not obstruct the SDA and SCL lines if VDD is switched off.
31
Philips Semiconductors
Table 5 Characteristics of the SDA and SCL bus lines for F/S-mode I2C-bus devices(1)
STANDARD-MODE FAST-MODE
PARAMETER SYMBOL UNIT
MIN. MAX. MIN. MAX.
SCL clock frequency fSCL 0 100 0 400 kHz
Hold time (repeated) START condition. tHD;STA 4.0 – 0.6 − µs
After this period, the first clock pulse is
generated
LOW period of the SCL clock tLOW 4.7 – 1.3 – µs
HIGH period of the SCL clock tHIGH 4.0 – 0.6 – µs
Set-up time for a repeated START tSU;STA 4.7 – 0.6 – µs
condition
Data hold time: tHD;DAT
for CBUS compatible masters (see NOTE,
Section 10.1.3) 5.0 – – – µs
for I2C-bus devices 0(2) 3.45(3) 0(2) 0.9(3) µs
Data set-up time tSU;DAT 250 − 100(4) – ns
Rise time of both SDA and SCL signals tr – 1000 20 + 0.1Cb (5) 300 ns
Fall time of both SDA and SCL signals tf – 300 20 + 0.1Cb(5) 300 ns
Set-up time for STOP condition tSU;STO 4.0 – 0.6 – µs
Bus free time between a STOP and tBUF 4.7 – 1.3 – µs
START condition
Capacitive load for each bus line Cb – 400 – 400 pF
Noise margin at the LOW level for each VnL 0.1VDD – 0.1VDD – V
connected device (including hysteresis)
Noise margin at the HIGH level for each VnH 0.2VDD – 0.2VDD – V
connected device (including hysteresis)
Notes
1. All values referred to VIHmin and VILmax levels (see Table 4).
2. A device must internally provide a hold time of at least 300 ns for the SDA signal (referred to the VIHmin of the SCL
signal) to bridge the undefined region of the falling edge of SCL.
3. The maximum tHD;DAT has only to be met if the device does not stretch the LOW period (tLOW) of the SCL signal.
4. A Fast-mode I2C-bus device can be used in a Standard-mode I2C-bus system, but the requirement tSU;DAT ≥ 250 ns
must then be met. This will automatically be the case if the device does not stretch the LOW period of the SCL signal.
If such a device does stretch the LOW period of the SCL signal, it must output the next data bit to the SDA line tr max
+ tSU;DAT = 1000 + 250 = 1250 ns (according to the Standard-mode I2C-bus specification) before the SCL line is
released.
5. Cb = total capacitance of one bus line in pF. If mixed with Hs-mode devices, faster fall-times according to Table 6 are
allowed.
32
Philips Semiconductors
SDA
SCL
33
Philips Semiconductors
15.2 Hs-mode devices With an internally generated SCLH signal with LOW and
HIGH level periods of 200 ns and 100 ns respectively, an
The I/O levels, I/O current, spike suppression, output slope
Hs-mode master can fulfil the timing requirements for the
control and pin capacitance for I2C-bus Hs-mode devices
external SCLH clock pulses (taking the rise and fall times
are given in Table 6. The noise margin for HIGH and LOW
into account) for the maximum bit rate of 3.4 Mbit/s. So a
levels on the bus lines are the same as specified for
basic frequency of 10 MHz, or a multiple of 10 MHz, can
F/S-mode I2C-bus devices.
be used by an Hs-mode master to generate the SCLH
Figure 32 shows all timing parameters for the Hs-mode signal. There are no limits for maximum HIGH and LOW
timing.The “normal” START condition S does not exist in periods of the SCLH clock, and there is no limit for a lowest
Hs-mode. Timing parameters for Address bits, R/W bit, bit rate.
Acknowledge bit and DATA bits are all the same. Only the
Timing parameters are independent for capacitive load up
rising edge of the first SCLH clock signal after an
to 100 pF for each bus line allowing the maximum possible
acknowledge bit has an larger value because the external
bit rate of 3.4 Mbit/s. At a higher capacitive load on the bus
Rp has to pull-up SCLH without the help of the internal
lines, the bit rate decreases gradually. The timing
current-source.
parameters for a capacitive bus load of 400 pF are
The Hs-mode timing parameters for the bus lines are specified in Table 7, allowing a maximum bit rate of
specified in Table 7. The minimum HIGH and LOW periods 1.7 Mbit/s. For capacitive bus loads between 100 pF and
and the maximum rise and fall times of the SCLH clock 400 pF, the timing parameters must be interpolated
signal determine the highest bit rate. linearly. Rise and fall times are in accordance with the
maximum propagation time of the transmission lines
SDAH and SCLH to prevent reflections of the open ends.
34
Philips Semiconductors
Table 6 Characteristics of the SDAH, SCLH, SDA and SCL I/O stages for Hs-mode I2C-bus devices
Hs-MODE
PARAMETER SYMBOL UNIT
MIN. MAX.
LOW level input voltage VIL −0.5 0.3VDD(1) V
HIGH level input voltage VIH 0.7VDD(1) VDD + 0.5(2) V
Hysteresis of Schmitt trigger inputs Vhys 0.1VDD(1) – V
LOW level output voltage (open drain) at 3 mA sink VOL
current at SDAH, SDA and SCLH for:
VDD > 2 V 0 0.4 V
VDD < 2 V 0 0.2VDD V
On resistance of the transfer gate, for both current RonL − 50 Ω
directions at VOL level between SDA and SDAH or
SCL and SCLH at 3 mA
On resistance of the transfer gate between SDA and RonH(2) 50 – kΩ
SDAH or SCL and SCLH if both are at VDD level
Pull-up current of the SCLH current-source. Applies for ICS 3 12 mA
SCLH output levels between 0.3VDD and 0.7VDD
Output rise time (current-source enabled) and fall time trCL, tfCL 10 40 ns
at SCLH with a capacitive load from 10 to 100 pF
Output rise time (current-source enabled) and fall time trCL(3), tfCL(3) 20 80 ns
at SCLH with an external pull-up current source of 3 mA
and a capacitive load of 400 pF
Output fall time at SDAH with a capacitive load from 10 tfDA 20 80 ns
to 100 pF
Output fall time at SDAH with a capacitive load of tfDA(3) 40 160 ns
400 pF
Pulse width of spikes at SDAH and SCLH that must be tSP 0 10 ns
suppressed by the input filters
Input current each I/O pin with an input voltage between Ii(4) – 10 µA
0.1VDD and 0.9VDD
Capacitance for each I/O pin Ci – 10 pF
Notes
1. Devices that use non-standard supply voltages which do not conform to the intended I2C-bus system levels must
relate their input levels to the VDD voltage to which the pull-up resistors Rp are connected.
2. Devices that offer the level shift function must tolerate a maximum input voltage of 5.5 V at SDA and SCL.
3. For capacitive bus loads between 100 and 400 pF, the rise and fall time values must be linearly interpolated.
4. SDAH and SCLH I/O stages of Hs-mode slave devices must have floating outputs if their supply voltage has been
switched off. Due to the current-source output circuit, which normally has a clipping diode to VDD, this requirement
is not mandatory for the SCLH or the SDAH I/O stage of Hs-mode master devices. This means that the supply voltage
of Hs-mode master devices cannot be switched off without affecting the SDAH and SCLH lines.
35
Philips Semiconductors
Table 7 Characteristics of the SDAH, SCLH, SDA and SCL bus lines for Hs-mode I2C-bus devices(1)
Notes
1. All values referred to VIHmin and VILmax levels (see Table 6).
2. For bus line loads Cb between 100 and 400 pF the timing parameters must be linearly interpolated.
3. A device must internally provide a Data hold time to bridge the undefined part between VIH and VIL of the falling edge
of the SCLH signal. An input circuit with a threshold as low as possible for the falling edge of the SCLH signal
minimizes this hold time.
36
Philips Semiconductors
SDAH
tHD;DAT
tSU;STO
tSU;STA tHD;STA tSU;DAT
SCLH
tfCL
trCL1 trCL1
trCL (1) (1)
= Rp resistor pull-up
(1) Rising edge of the first SCLH clock pulse after an acknowledge bit.
I2C-bus devices with fixed input levels of 1.5 V and 3 V can Input levels are defined in such a way that:
each have their own appropriate supply voltage. Pull-up • The noise margin on the LOW level is 0.1VDD
resistors must be connected to a 5 V ± 10% supply
• The noise margin on the HIGH level is 0.2VDD
(Fig.33). I2C-bus devices with input levels related to VDD
must have one common supply line to which the pull-up • As shown in Fig.36, series resistors (RS) of e.g. 300 Ω
resistor is also connected (Fig.34). can be used for protection against high-voltage spikes
on the SDA and SCL lines (resulting from the flash-over
When devices with fixed input levels are mixed with of a TV picture tube, for example).
devices with input levels related to VDD, the latter devices
37
Philips Semiconductors
SDA
SCL
MBC610
SDA
SCL
MBC625
Fig.34 Devices with wide supply voltage range connected to the I2C-bus.
SDA
SCL
MBC626
Fig.35 Devices with input levels related to VDD (supply VDD1) mixed with fixed input level devices
(supply VDD2,3) on the I2C-bus.
38
Philips Semiconductors
I2 C I2 C
DEVICE DEVICE
Rp Rp
Rs Rs Rs Rs
SDA
SCL
MBC627
16.1 Maximum and minimum values of resistors Rp Rp min is shown in Fig.37. The required noise margin of
and Rs for Standard-mode I2C-bus devices 0.1VDD for the LOW level, limits the maximum value of Rs.
Rs max as a function of Rp is shown in Fig.38.
For Standard-mode I2C-bus systems, the values of
resistors Rp and Rs in Fig.35 depend on the following The bus capacitance is the total capacitance of wire,
parameters: connections and pins. This capacitance limits the
maximum value of Rp due to the specified rise time. Fig.39
• Supply voltage shows Rp max as a function of bus capacitance.
• Bus capacitance
The maximum HIGH level input current of each
• Number of connected devices (input current + leakage input/output connection has a specified maximum value of
current). 10 µA. Due to the required noise margin of 0.2 VDD for the
The supply voltage limits the minimum value of resistor Rp HIGH level, this input current limits the maximum value of
due to the specified minimum sink current of 3 mA at Rp. This limit depends on VDD. The total HIGH level input
VOLmax = 0.4 V for the output stages. VDD as a function of current is shown as a function of Rp max in Fig.40.
39
Philips Semiconductors
MBC635
20
MBC628 maximum
6
handbook,
minimum halfpage value R p
value R p (kΩ)
(kΩ ) 16
5
RS = 0
4 12
RS = 0
3
8
max. R S
2
max. R S
4
@ V DD = 5 V
1
0
0 100 200 300 400
0
0 4 8 12 16 bus capacitance (pF)
V DD (V)
Fig.37 Minimum value of Rp as a function of supply Fig.39 Maximum value of Rp as a function of bus
voltage with the value os Rs as a parameter. capacitance for a Standard-mode I2C-bus.
MBC630
MBC629 20
10 maximum
value R p
Rp
(kΩ )
(kΩ ) V DD = 2.5 V 5V 16
8
12
6
15 V
VDD= 15 V
8
4
10 V
10 V
4
2 5V
2.5 V
0
0 0 40 80 120 160 200
0 400 800 1200 1600 total high level input current (µA)
maximum value R s (Ω)
40
Philips Semiconductors
nY VDD
Fig.41 Slope-controlled output stage in CMOS 1/4 HCT4066
VCC 5V 10 %
nE
technology.
P N
nZ GND
1.3 kΩ R p2 1.7 kΩ R p1
SDA or SCL
Vp bus line
VDD
100 Ω Rs 100 Ω Rs
to input
R1 circuit I/O I/O
20 kΩ Rp Cb
C1
I/O SDA or SCL 400 pF
bus line max.
5 pF N N
T1 T2 Cb
MBC620 VSS
GND VSS
FAST - MODE I 2 C BUS DEVICES
MBC619
41
Philips Semiconductors
VDD
max. R S
1.5
VSS @ V DD = 5 V
SCL
0
If only the VSS line is included, the wiring pattern must be: 0 100 200 300 400
bus capacitance (pF)
SDA
VSS Fig.44 Maximum value of Rp as a function of bus
capacitance for meeting the tr max requirement for
SCL a Fast-mode I2C-bus.
These wiring patterns also result in identical capacitive
loads for the SDA and SCL lines. The VSS and VDD lines
can be omitted if a PCB with a VSS and/or VDD layer is 17.5 Maximum and minimum values of resistors Rp
used. and Rs for Hs-mode I2C-bus devices
If the bus lines are twisted-pairs, each bus line must be The maximum and minimum values for resistors Rp and Rs
twisted with a VSS return. Alternatively, the SCL line can be connected to an Hs-mode I2C-bus can be calculated from
twisted with a VSS return, and the SDA line twisted with a the data in Tables 6 and 7. Many combinations of these
VDD return. In the latter case, capacitors must be used to values are possible, owing to different rise and fall times,
decouple the VDD line to the VSS line at both ends of the bus line loads, supply voltages, mixed speed systems and
twisted pairs. level shifting. Because of this, no further graphs are
included in this specification.
If the bus lines are shielded (shield connected to VSS),
interference will be minimized. However, the shielded
cable must have low capacitive coupling between the SDA 18 BI-DIRECTIONAL LEVEL SHIFTER FOR
and SCL lines to minimize crosstalk. F/S-MODE I2C-BUS SYSTEMS
17.4 Maximum and minimum values of resistors Rp Present technology processes for integrated circuits with
clearances of 0.5 µm and less, limit the maximum supply
and Rs for Fast-mode I2C-bus devices
voltage and consequently the logic levels for the digital I/O
The maximum and minimum values for resistors Rp and Rs signals. To interface these lower voltage circuits with
connected to a Fast-mode I2C-bus can be determined existing 5 V devices a level shifter is needed. For
from Figs 37, 38 and 40 in Section 16.1. Because a bi-directional bus systems as like the I2C-bus, such a level
Fast-mode I2C-bus has faster rise times (tr) the maximum shifter must also be bi-directional, without the need of a
value of Rp as a function of bus capacitance is less than direction control signal(1). The simplest way to solve this
that shown in Fig.39 The replacement graph for Fig.39 problem is by connecting a discrete MOS-FET to each bus
showing the maximum value of Rp as a function of bus line.
capacitance (Cb) for a Fast-mode I2C-bus is given in
Fig.44.
(1) US 5,689,196 granted; corresponding patent applications
pending.
42
Philips Semiconductors
In spite of its surprising simplicity, such a solution not only interconnect two sections of an I2C-bus system, with each
fulfils the requirement of bi-directional level shifting without section having a different supply voltage and different logic
a direction control signal, it also: levels. Such a configuration is shown in Fig.45. The left
• isolates a powered-down bus section from the rest of the “low-voltage” section has pull-up resistors and devices
bus system connected to a 3.3 V supply voltage, the right
“high-voltage” section has pull-up resistors and devices
• protects the “lower voltage” side against high voltage connected to a 5 V supply voltage. The devices of each
spikes from the “higher-voltage” side.
section have I/Os with supply voltage related logic input
The bi-directional level shifter can be used for both levels and an open drain output configuration.
Standard-mode (up to100 kbit/s) or in Fast-mode (up to
The level shifter for each bus line is identical and consists
400 kbit/s) I2C-bus systems. It is not intended for Hs-mode
of one discrete N-channel enhancement MOS-FET; TR1
systems, which may have a bridge with a level shifting
for the serial data line SDA and TR2 for the serial clock line
possibility (see Section 13.5)
SCL. The gates (g) have to be connected to the lowest
supply voltage VDD1, the sources (s) to the bus lines of the
18.1 Connecting devices with different logic levels “lower-voltage” section, and the drains (d) to the bus lines
Section 16 described how different voltage devices could of the “higher-voltage” section. Many MOS-FETs have the
be connected to the same bus by using pull-up resistors to substrate internally connected with its source, if this is not
the supply voltage line. Although this is the simplest the case, an external connection should be made. Each
solution, the lower voltage devices must be 5 V tolerant, MOS-FET has an integral diode (n-p junction) between the
which can make them more expensive to manufacture. By drain and substrate.
using a bi-directional level shifter, however, it’s possible to
VDD1 = 3.3 V
handbook, full pagewidth VDD2 = 5 V
Rp Rp g TR1 Rp Rp
SDA1 s d SDA2
g TR2
SCL1 s d SCL2
MGK879
Fig.45 Bi-directional level shifter circuit connecting two different voltage sections in an I2C-bus system.
43
Philips Semiconductors
18.1.1 OPERATION OF THE LEVEL SHIFTER 3. A 5 V device pulls down the bus line to a LOW level.
The drain-substrate diode of the MOS-FET the
The following three states should be considered during the
“lower-voltage” section is pulled down until VGS
operation of the level shifter:
passes the threshold and the MOS-FET starts to
1. No device is pulling down the bus line. conduct. The bus line of the “lower-voltage” section is
The bus line of the “lower-voltage” section is pulled up then further pulled down to a LOW level by the 5 V
by its pull-up resistors Rp to 3.3 V. The gate and the device via the conducting MOS-FET. So the bus lines
source of the MOS-FET are both at 3.3 V, so its VGS is of both sections go LOW to the same voltage level.
below the threshold voltage and the MOS-FET is not
conducting. This allows the bus line at the The three states show that the logic levels are transferred
“higher-voltage” section to be pulled up by its pull-up in both directions of the bus system, independent of the
resistor Rp to 5 V. So the bus lines of both sections are driving section. State 1 performs the level shift function.
HIGH, but at a different voltage level. States 2 and 3 perform a “wired AND” function between
the bus lines of both sections as required by the I2C-bus
2. A 3.3 V device pulls down the bus line to a LOW level. specification.
The source of the MOS-FET also becomes LOW,
while the gate stay at 3.3 V. VGS rises above the Supply voltages other than 3.3 V for VDD1 and 5 V for VDD2
threshold and the MOS-FET starts to conduct. The bus can also be applied, e.g. 2 V for VDD1 and 10 V for VDD2 is
line of the “higher-voltage” section is then also pulled feasible. In normal operation VDD2 must be equal to or
down to a LOW level by the 3.3 V device via the higher than VDD1 (VDD2 is allowed to fall below VDD1 during
conducting MOS-FET. So the bus lines of both switching power on/off).
sections go LOW to the same voltage level.
44
Philips Semiconductors
PRODUCT DESCRIPTION
OM1022 PC I2C-bus analyzer with multi-master capability. Hardware and software (runs on IBM or
compatible PC) to experiment with and analyze the behaviour of the I2C-bus (includes
documentation)
OM4777 Similar to OM1022 but for single-master systems only
PF8681 I2C-bus analyzer support package for the PM3580 logic analyzer family
45
Philips Semiconductors
20 SUPPORT LITERATURE
Table 12 Data handbooks
TITLE ORDERING CODE
IC01: Semiconductors for Radio, Audio and CD/DVD Systems 9397 750 02453
IC02: Semiconductors for Television and Video Systems 9397 750 01989
IC03: Semiconductors for Wired Telecom Systems (parts a & b) 9397 750 00839,
9397 750 00811
IC12: I2C Peripherals 9397 750 01647
IC14: 8048-based 8-bit microcontrollers 9398 652 40011
IC17: Semiconductors for wireless communications 9397 750 01002
IC18: Semiconductors for in-car electronics 9397 750 00418
IC19: ICs for data communications 9397 750 00138
IC20: 80C51-based 8-bit microcontrollers + Application notes and Development tools 9397 750 00963
IC22: Multimedia ICs 9397 750 02183
For more information about Philips Semiconductors and how we can help in your I2C-bus design, contact your nearest
Philips Semiconductors national organization from the address list of the back of this book, or visit our worldwide web
site at http://www.semiconductors.philips.com
46
Philips Semiconductors
NOTES
47
Philips Semiconductors
NOTES
48
Documento seguro incrustado
El archivo http://www.dacya.ucm.es/mendias/143/docs/usb.pdf es un documento seguro que se ha incrustado en este documento.
Haga doble clic en el pin para visualizar.
Documento seguro incrustado
El archivo http://www.dacya.ucm.es/mendias/143/docs/74HC594.pdf es un documento seguro que se ha incrustado en este
documento. Haga doble clic en el pin para visualizar.
Order this document by ULN2803/D
The eight NPN Darlington connected transistors in this family of arrays
OCTAL PERIPHERAL
are ideally suited for interfacing between low logic level digital circuitry (such DRIVER ARRAYS
as TTL, CMOS or PMOS/NMOS) and the higher current/voltage
requirements of lamps, relays, printer hammers or other similar loads for a
broad range of computer, industrial, and consumer applications. All devices SEMICONDUCTOR
feature open–collector outputs and free wheeling clamp diodes for transient TECHNICAL DATA
suppression.
The ULN2803 is designed to be compatible with standard TTL families
while the ULN2804 is optimized for 6 to 15 volt high level CMOS or PMOS.
MAXIMUM RATINGS (TA = 25°C and rating apply to any one device in the
package, unless otherwise noted.)
Rating Symbol Value Unit
Output Voltage VO 50 V
Input Voltage (Except ULN2801) VI 30 V A SUFFIX
PLASTIC PACKAGE
Collector Current – Continuous IC 500 mA CASE 707
Base Current – Continuous IB 25 mA
Operating Ambient Temperature Range TA 0 to +70 °C
Storage Temperature Range Tstg – 55 to +150 °C
Junction Temperature TJ 125 °C PIN CONNECTIONS
RθJA = 55°C/W
Do not exceed maximum current limit per driver.
1 18
ORDERING INFORMATION 2 17
Characteristics
3 16
Operating
Input Temperature
Compatibility 4 15
D i
Device VCE(Max)/IC(Max) Range
7 12
8 11
Gnd 9 10
Input Capacitance CI – 15 25 pF
Turn–On Delay Time ton – 0.25 1.0 µs
(50% EI to 50% EO)
TEST FIGURES
Figure 1. Figure 2.
Open
Open VCE
+ IC
I
h FE
in
µA
V
VCE
Figure 3. Figure 4.
µA
Iin
µA DUT µA DUT Open
Vin Vin
Figure 5. Figure 6.
VR
Open
µA
IR
DUT
DUT
IC Open
V VCE V
Vin
Figure 7.
IF
V
VF
DUT
Open
200 200
0 0
0 0.5 1.0 1.5 2.0 0 200 400 600 800
VCE(sat), SATURATION VOLTAGE (V) IIN, INPUT CURRENT (µA)
Input Characteristics
Figure 10. ULN2803 Input Current Figure 11. ULN2804 Input Current
versus Input Voltage versus Input Voltage
2.0 2.0
IIN , INPUT CURRENT (mA)
IIN , INPUT CURRENT (mA)
1.5 1.5
1.0 1.0
0.5 0.5
0 0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 5.0 6.0 7.0 8.0 9.0 10 11 12 13
VIN, INPUT VOLTAGE (V) VIN, INPUT VOLTAGE (V)
7.2 k 7.2 k
3.0 k 3.0 k
OUTLINE DIMENSIONS
A SUFFIX
PLASTIC PACKAGE
CASE 707–02
ISSUE C NOTES:
1. POSITIONAL TOLERANCE OF LEADS (D),
SHALL BE WITHIN 0.25 (0.010) AT MAXIMUM
18 10 MATERIAL CONDITION, IN RELATION TO
SEATING PLANE AND EACH OTHER.
B 2. DIMENSION L TO CENTER OF LEADS WHEN
1 9 FORMED PARALLEL.
3. DIMENSION B DOES NOT INCLUDE MOLD
FLASH.
A MILLIMETERS INCHES
DIM MIN MAX MIN MAX
L A 22.22 23.24 0.875 0.915
C B 6.10 6.60 0.240 0.260
C 3.56 4.57 0.140 0.180
D 0.36 0.56 0.014 0.022
F 1.27 1.78 0.050 0.070
N K G 2.54 BSC 0.100 BSC
J H 1.02 1.52 0.040 0.060
F D SEATING M J 0.20 0.30 0.008 0.012
PLANE K 2.92 3.43 0.115 0.135
H G L 7.62 BSC 0.300 BSC
M 0_ 15_ 0_ 15 _
N 0.51 1.02 0.020 0.040
Motorola reserves the right to make changes without further notice to any products herein. Motorola makes no warranty, representation or guarantee regarding
the suitability of its products for any particular purpose, nor does Motorola assume any liability arising out of the application or use of any product or circuit, and
specifically disclaims any and all liability, including without limitation consequential or incidental damages. “Typical” parameters which may be provided in Motorola
data sheets and/or specifications can and do vary in different applications and actual performance may vary over time. All operating parameters, including “Typicals”
must be validated for each customer application by customer’s technical experts. Motorola does not convey any license under its patent rights nor the rights of
others. Motorola products are not designed, intended, or authorized for use as components in systems intended for surgical implant into the body, or other
applications intended to support or sustain life, or for any other application in which the failure of the Motorola product could create a situation where personal injury
or death may occur. Should Buyer purchase or use Motorola products for any such unintended or unauthorized application, Buyer shall indemnify and hold Motorola
and its officers, employees, subsidiaries, affiliates, and distributors harmless against all claims, costs, damages, and expenses, and reasonable attorney fees
arising out of, directly or indirectly, any claim of personal injury or death associated with such unintended or unauthorized use, even if such claim alleges that
Motorola was negligent regarding the design or manufacture of the part. Motorola and are registered trademarks of Motorola, Inc. Motorola, Inc. is an Equal
Opportunity/Affirmative Action Employer.
MFAX: RMFAX0@email.sps.mot.com – TOUCHTONE 602–244–6609 ASIA/PACIFIC: Motorola Semiconductors H.K. Ltd.; 8B Tai Ping Industrial Park,
INTERNET: http://Design–NET.com 51 Ting Kok Road, Tai Po, N.T., Hong Kong. 852–26629298
*ULN2803/D*
6 ◊ MOTOROLA ANALOG IC DEVICE DATA
ULN2803/D