Module-4 Memory and Programmable Logic: Read-Only Memory (Rom)
Module-4 Memory and Programmable Logic: Read-Only Memory (Rom)
Types of Memories
Integrated-circuit RAM units are available in two possible operating modes, static and dynamic.
The static RAM consists essentially of internal flip-flops that store the binary information. The
stored information remains valid as long as power is applied to the unit. The dynamic RAM
stores the binary information in the form of electric charges that are applied to capacitors. The
capacitors are provided inside the chip by MOS transistors. The stored charge on the capacitors
tends to discharge with time and the capacitors must be periodically recharged by refreshing
the dynamic memory. Refreshing is done by cycling through the words every few milliseconds
to restore the decaying charge. Dynamic RAM offers reduced power consumption and larger
storage capacity in a single memory chip, but static RAM is easier to use and has shorter read
and write cycles.
Structure of a PLA.
Maps of the four output functions and minimal sum-of-products expressions are shown in
below Figure. In this example, a total of only four product terms covers all functions, so only
four AND gates are needed in the implementation. Two sets of lines must be programmed: the
input lines and the output lines. To do this, we construct a programming table as follows:
• The implicants (product terms) are listed as row headings.
• In one set of columns, the headings are the input variables; this part of the table must provide
the information that tells which variables (or their complements) are factors in each implicant.
• In a second set of columns, the headings are the output functions; this part of the table must
provide the information that indicates the output gate to which each implicant (AND-gate
output) is directed.
In the first set of columns, if a variable ( uncomplemented) is present in a particular row, the
corresponding entry is 1; if its complement is present, the entry is 0. If neither is present, the
entry can be left blank, but it is preferable to show some symbol instead; a dash is often used.
In the second set of columns, corresponding to the output functions, if a particular function
covers a particular implicant, then the corresponding entry is 1; otherwise it could be left blank,
but it is customary to enter a dot. To illustrate, consider row 4. Since the implicant is y'z, the
entry in column z is 1, that in column y is 0, and that in x is a dash. In the output columns, only
f1 does not cover implicant y'z; hence, the entry will be 1 in every column in row 4 except the f1
column. Confirm the remaining rows.
Once the programming is done, fabricating the links (connection points) in a PLA is carried out
in a similar manner as for the ROM. The PLA is either mask programmable or field
programmable (FPLA). In the case of the FPLA, with p= the number of AND gates, there will be
2np links at the inputs and mp links at the outputs.
The mostly used configuration for SPLD is constructed with 8 to 10 macro cells as shown below.
Complex PLD:-
Complex digital systems often require the connection of several devices to produce the
complex specification
More economical to use a complex PLD (CPLD)
CPLD is a collection of individual PLDs on a single IC with programmable interconnection
structure
FPGA (Xilinx)
Digital Logic Circuits :-
TTL Circuit:-
TTL logic IC’s use NPN and PNP type Bipolar Junction Transistors while CMOS logic IC’s use
complementary MOSFET or JFET type Field Effect Transistors for both their input and output
circuitry. As well as TTL and CMOS technology, simple Digital Logic Gates can also be made by
connecting together diodes, transistors and resistors to produce RTL, Resistor-Transistor logic
gates, DTL, Diode-Transistor logic gates or ECL, Emitter-Coupled logic gates but these are less
common now compared to the popular CMOS family.
When using a standard +5 volt supply any TTL voltage input between 2.0 V and 5 V is
considered to be a logic “1” or “HIGH” while any voltage input below 0.8 V is recognized as a
logic “0” or “LOW”. The voltage region in between these two voltage levels either as an input or
as an output is called the Indeterminate Region and operating within this region may cause the
logic gate to produce a false output.
The CMOS 4000 logic family uses different levels of voltages compared to the TTL types as they
are designed using field effect transistors, or FET’s. In CMOS technology a logic “1” level
operates between 3.0 volts and 18 volts and a logic “0” level is below 1.5 volts.
Basic TTL Logic Gates:-
The simple Diode-Resistor AND gate above uses separate diodes for its inputs, one for each
input. As a transistor is made up off two diode circuits connected together representing an NPN
or a PNP device, the input diodes of the DTL circuit can be replaced by one single NPN
transistor with multiple emitter inputs as shown.
As the NAND gate contains a single stage inverting NPN transistor circuit (TR2) an output logic
level “1” at Q is only present when both the emitters of TR1 are connected to logic level “0” or
ground allowing base current to pass through the PN junctions of the emitter and not the
collector. The multiple emitters of TR1 are connected as inputs thus producing a NAND gate
function.
In standard TTL logic gates, the transistors operate either completely in the “cut off” region, or
else completely in the saturated region, Transistor as a Switch type operation.
DTL circuit
Improved gate with reversed diodes.
-If all inputs are high, the transistor saturates and VOUT goes low.
-If any input goes low, the base current is diverted out through the input diode. The transistor
cuts off and VOUT goes high.
-This is a NAND gate.
RTL Logic:-
The basic circuit of the RTL digital logic family is the NOR gate shown in given Figure. Each input
is associated with one resistor and one transistor. The collectors of the transistors are tied
together at the output. The voltage levels for the circuit are 0.2 V for the low level and from 1
to 3.6 V for the high level.
The analysis of the RTL gate is very simple and as follows. If any input of the RTL gate is high,
the corresponding transistor is driven into saturation. This causes the output to be low,
regardless of the states of the other transistors. If all inputs are low at 0.2 V, all transistors are
cut off because VBE < 0.6 V. This causes the output of the circuit to be high, approaching the
value of supply voltage Vcc . This confirms the conditions stated in given Fig for the NOR gate.
Note that the noise margin for low signal input is 0.6 - 0.2 = 0.4 V.
The fan-out of the RTL gate is limited by the value of the output voltage when high. As the
output is loaded with inputs of other gates, more current is consumed by the load. This current
must flow through the 640 resistor.
RTL NOR Gate
The first design unit is a package that defines a new type, num, for eight-bit unsigned numbers
and an enumerated type, states, with six possible values. nums are defined as a subtype of the
unsigned type.
-- RTL design of 4-input summer
-- subtype used in design
library ieee ;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
package averager_types is
sub type num is unsigned (7 downto 0);
type states is (clr, add_a, add_b, add_c,
add_d, hold);
end averager_types;
The first entity defines the data path. In this case the four numbers to be added are available as
inputs to the entity and there is one output for the current sum. The inputs to the data path
from the controller are a 2-bit selector for the multiplexer and two control signals to load or
clear (set to 0) the register.
-- data path
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.al;
use work.averager_types.all;
entity datapath is
port (
a, b, c, d: in num;
sum : out num ;
sel : in std_logic_vector (1 downto 0) ;
load, clear, clk : in std_logic
);
end datapath ;
architecture rtl of datapath is
signal mux_out, sum_reg, next_sum_reg : num ;
constant sum_zero : num :=
conv_unsigned(0,next_sum_reg’length) ;
begin
-- mux to select input to add
with sel select mux_out <=
a when "00",
b when "01",
c when "10",
d when others ;
-- mux to select register input
next_sum_reg <=
sum_reg + mux_out when load = ’1’ else
sum_zero when clear = ’1’ else
sum_reg ;
-- register sum
process(clk)
begin
if clk’event and clk = ’1’ then
sum_reg <= next_sum_reg ;
end if ;
end process ;
-- entity output is register output
sum <= sum_reg ;
end rtl;
The RTL design’s controller is a state machine whose outputs control the multiplexers in the
datapath. The controller’s inputs are signals that control the controller’s state transitions. In
this case the only input is an update signal that tells our device to recompute the sum
(presumably because one or more of the inputs has changed).
This particular state machine sits at the “hold” state until the update signal is true. It then
sequences through the other five states and then stops at the hold state again. The other five
states are used to clear the register and to add the four inputs to the current value of the
register.
-- controller
library ieee ;
use ieee.std_logic_1164.all ;
use work.averager_types.all ;
entity controller is
port (
update : in std_logic ;
sel : out std_logic_vector (1 downto 0) ;
load, clear : out std_logic ;
clk : in std_logic
);
end controller ;
architecture rtl of controller is
signal s, holdns, ns : states ;
signal tmp : std_logic_vector (3 downto 0) ;
begin
-- select next state
with s select ns <=
add_a when clr,
add_b when add_a,
add_c when add_b,
add_d when add_c,
hold when add_d,
holdns when others ; -- hold
-- next state if in hold state
holdns <=
clr when update = ’1’ else
hold ;
-- state register
process(clk)
begin
if clk’event and clk = ’1’ then
s <= ns ;
end if ;
end process ;
-- controller outputs
with s select sel <=
"00" when add_a,
"01" when add_b,
"10" when add_c,
"11" when others ;
load <= ’0’ when s = clr or s = hold else ’1’ ;
clear <= ’1’ when s = clr else ’0’ ;
end rtl ;
State machine :-
In general, a state machine is any device that stores the status of something at a given time and
can operate on input to change the status and/or cause an action or output to take place for
any given change. A computer is basically a state machine and each machine instruction is input
that changes one or more states and may cause other actions to take place. Each computer's
data register stores a state. The read-only memory from which a boot program is loaded stores
a state (the boot program itself is an initial state). The operating system is itself a state and
each application that runs begins with some initial state that may change as it begins to handle
input. Thus, at any moment in time, a computer system can be seen as a very complex set of
states and each program in it as a state machine. In practice, however, state machines are used
to develop and describe specific device or program interactions.
A finite state machine is one that has a limited or finite number of possible states. (An infinite
state machine can be conceived but is not practical.) A finite state machine can be used both as
a development tool for approaching and solving problems and as a formal way of describing the
solution for later developers and system maintainers. There are a number of ways to show
state machines, from simple tables through graphically animated illustrations.
The finite state machine is also a useful approach to many problems in software architecture;
only in this case you don’t build one you simulate it.
Essentially a finite state machine consists of a number of states – finite naturally! When a
symbol, a character from some alphabet say, is input to the machine it changes state in such a
way that the next state depends only on the current state and the input symbol.
Notice that this is more sophisticated than you might think because inputting the same symbol
doesn’t always produce the same behaviour or result because of the change of state.
The new state depends on the old state and the input.
What this means that the entire history of the machine is summarized in its current state. All
that matters is the state that it is in and not how it reached this state. Before you write off the
finite state machine as so feeble as to be not worth considering as a model of computation it is
worth pointing out that as you can have as many states as you care to invent the machine can
record arbitrarily long histories. All you need is a state for each of the possible past histories
and then the state that you find the machine in is an indication of not only its current state but
how it arrived in that state.
Because a finite state machine can represent any history and a reaction, by regarding the
change of state as a response to the history, it has been argued that it is a sufficient model of
human behaviour i.e. humans are finite state machines.
If you know some probability theory you will recognize a connection between finite state
machines and Markov chains. A Markov chain sums up the past history in terms of the current
state and the probability of transition to the next state only depends on the current state. The
Markov chain is a sort of probabilistic version of the finite state machine.
You can represent a finite state machine in a form that makes it easier to understand and think
about.
All you have to do is draw a circle for every state and arrows that show which state follows for
each input symbol.
For example, the finite state machine in the diagram below has three states. If the machine is in
state 1 then an A moves it to state 2 and a B moves it to state 3.
For example, many communications protocols, such as USB can be defined by a finite state
machine’s diagram showing what happens as different pieces of information are input. You can
even write or obtain a compiler that will take a finite state machine’s specification and produce
code that behaves correctly.
Many programming problems are most easily solved by actually implementing a finite state
machine. You set up an array or other data structure which stores the possible states and you
implement a pointer to the location that is the current state. Each state contains a lookup table
that shows what the next state is given an input symbol. When a symbol is read in your
program simply has to look it up in the lookup table and move the pointer to the new state.