ES Module3 1
ES Module3 1
in
Controller architecture: Implements the finite state machine model (FSM) using a state
register and two combinational circuits.
Datapath architecture: Best suited for implementing the data flow graph model where
the output is generated as a result of a set of predefined computations on input data.
Complex Instruction Set Computing (CISC) architecture: Uses an instruction set
representing complex operations and can perform a large complex operation with a
single instruction.
Reduced Instruction Set Computing (RISC) architecture: Reuses instruction set
representing simple operations and it requires the execution of multiple RISC
instructions to perform a complex operation.
Very Long Instruction Word Computing (VLIW) architecture: Implements multiple
functional units (ALUs, multipliers, etc.) in the datapath.
Single Instruction Multiple Data (SIMD) architecture: A single instruction is executed in
parallel with the help of the Processing Element. The SIMD architecture forms the basis
of reconfigurable processor.
Multiple Instruction Multiple Data (MIMD) architecture: Executes different instructions
at a given point of time. The MIMD architecture forms the basis of multiprocessor
systems.
Selecting the Language: A programming language captures a 'Computational Model' and
maps it into architecture. There is no hard and fast rule to specify which language should
be used for capturing this model. A model can be captured using multiple programming
languages like C, C++, C#, Java, etc. for software implementations and languages like
VHDL, System C, Verilog, etc. for hardware implementations. On the other hand, a single
language can be used for capturing a variety of models.
Certain languages are good in capturing certain computational model. For example,
C++ is a good candidate for capturing an object oriented model. The only pre-requisite in
selecting a programming language for capturing a model is that the language should
capture the model easily.
Partitioning System Requirements into Hardware and Software: It may be possible to
implement the system requirements in either hardware or software (firmware). It is a tough
decision making task to figure out which one to opt. Various hardware software trade-offs
are used for making a decision on the hardware-software partitioning.
Finite State Machine (FSM): A FSM model is one in which the number of states are finite.
In other words the system is described using a finite number of possible states. For
example, consider the design of an embedded system for driver/ passenger 'Seat Belt
Warning' in an automotive using the FSM model. The system requirements are captured as:
When the vehicle ignition is turned on and the seat belt is not fastened within 10
seconds of ignition ON, the system generates an alarm signal for 5 seconds.
The Alarm is turned off when the alarm time (5 seconds) expires or if the driver/
passenger fasten the belt or if the ignition switch is turned off, whichever happens first.
Here the states are 'Alarm Off', 'Waiting' and 'Alarm On' and the events are 'Ignition Key
ON', 'Ignition Key OFF', 'Timer Expire', 'Alarm Time Expire' and 'Seat Belt ON'.
Using the FSM, the system requirements can be modelled as given in following Figure.
The wait state is implemented using a timer. The timer also has certain set of states
and events for state transitions. Using the FSM model, the timer can be modelled as shown
in the below figure.
Problem 1: Design an automatic tea/ coffee vending machine based on FSM model for the
following requirement:
The tea/coffee vending is initiated by user inserting a 5 rupee coin.
After inserting the coin, the user can either select 'Coffee' or 'Tea' or press 'Cancel' to
cancel the order and take back the coin.
Solution: The FSM representation contains four states namely; 'Wait for coin' 'Wait for User
Input', 'Dispense Tea' and 'Dispense Coffee'. The FSM representation for the above
requirement is given in the below figure.
Problem 2: Design a coin operated public telephone unit based on FSM model for the
following requirements.
The calling process is initiated by lifting the receiver (off-hook) of the telephone unit.
After lifting the phone the user needs to insert a 1 rupee coin to make the call.
If the line is busy, the coin is returned on placing the receiver back on the hook (on-
hook).
If the line is through, the user is allowed to talk till 60 seconds and at the end of 45th
second, prompt for inserting another 1 rupee coin for continuing the call is initiated.
If the user doesn't insert another 1 rupee coin, the call is terminated on completing the
60 seconds time slot.
The system is ready to accept new call request when the receiver is placed back on the
hook (on-hook).
The system goes to the 'Out of Order' state when there is a line fault.
MOHAMMED SALEEM | Asst. Prof., Dept. of E & C, PACE 6
[INTRODUCTION TO EMBEDDED SYSTEMS-BETCK205J] saleem_ece@pace.edu.in
Solution: The FSM representation for the above requirement is given in the below figure.
For example, consider the implementation of the 'Seat Belt Warning' system in
concurrent processing model. We can split the tasks into:
1. Timer task for waiting 10 seconds (wait timer task)
2. Task for checking the ignition key status (ignition key status monitoring task)
3. Task for checking the seat belt status (seat belt status monitoring task)
4. Task for starting and stopping the alarm (alarm control task)
5. Alarm timer task for waiting 5 seconds (alarm timer task)
The tasks cannot be executed them randomly or sequentially. One way of implementing
a concurrent model for the 'Seat Belt Warning' system is illustrated in the below figure:
Object-Oriented Model
The object-oriented model is an object based model for modelling system requirements. It
disseminates a complex software requirement into simple well defined pieces called objects.
Object-oriented model brings re-usability, maintainability and productivity in system
design. In the object-oriented modelling, object is an entity used for representing or
modelling a particular piece of the system. Each object is characterized by a set of unique
behaviour and state.
embedded applications. Relay, buzzer and stepper motor driving circuits are examples for
common emitter configuration based driver circuit implementation using transistor.
Digital Electronic Components
Digital electronics deal with digital or discrete signals. Microprocessors, Microcontrollers,
and System on Chips (SoCs) work on digital principles. They interact with the rest of the
world through digital I/O interfaces and process digital data. Embedded systems employ
various digital electronic circuits for 'Glue logic' implementation. 'Glue logic' is the custom
digital electronic circuitry required to achieve compatible interface between two different
integrated circuit chips. Address decoders, latches, encoders/ decoders, etc. are examples
for glue logic circuits. Transistor - Transistor Logic (TTL), Complementary Metal Oxide
Semiconductor (CMOS) logic etc. are some of the standards describing the electrical
characteristics of digital signals in a digital system.
Open Collector Configuration
Open collector is an I/O interface standard in digital system design. It facilitates the
interfacing of IC output to other systems which operate at different voltage levels. In the
open collector configuration, the output line from an IC circuit is connected to the base of
an NPN transistor. The collector of the transistor is left unconnected and the emitter is
internally connected to the ground signal of IC. Figure below illustrates an open collector
output configuration.
For the output pin to function properly, the output pin should be pulled, to the
desired voltage for the output device, through a pull-up resistor. The output signal of the IC
is fed to the base of an open collector transistor. When the base drive to the transistor is
ON and the collector is in open state, the output pin floats. This state is known as 'high
impedance' state. If a pull-up resistor is connected to the output pin, when the base drive is
ON, the output pin becomes at logic 0 (0V). With a pull-up resistor, if the base driver is 0,
the output will be at logic high (Voltage = V).
The advantage of open collector output in embedded system design is listed below:
(1) It facilitates interfacing of devices, operating at a voltage different from IC, with the IC.
(2) An open collector configuration supports multi-drop connection.
(3) It is easy to build Wired AND & Wired OR configuration using open collector output line.
Logic Gates
Logic gates are the building blocks of digital circuits. Logic gates control the flow of digital
information by performing a logical operation of the input signals. Depending on the logical
operation, the logic gates used in digital design are classified into-AND, OR, XOR, NOT,
NAND, NOR and XNOR. The logical relationship between the output signal and the input
signals for a logic gate is represented using a truth table. Figure 8.2 illustrates the truth
table and symbolic representation of each logic gate.
Buffer
A buffer circuit is a logic circuit for amplifying the current or power. It increases the driving
capability of a logic circuit. A tri-state buffer is a buffer with Output Enable control. When
the Output Enable control is active, the tri-state buffer functions as a buffer. If the Output
Enable is not active, the output of the buffer remains at high impedance state (Tri-stated).
Tri- state buffers are commonly used as drivers for address bus and to select the required
device among multiple devices connected to a shared data bus. 74LS244/74HC244 is an
example of unidirectional octal buffer.
Latch
A latch is used for storing binary data. It contains an input data line, clock or gating
control line for triggering the latching operation and an output line. Whenever a latch
trigger happens, the data present on the input line is latched. The latched data is available
on the output line of the latch until the next trigger. D flip flop is a typical example of a
latch. In electronic circuits, latches are commonly used for latching data, which is available
only for a short duration.
Decoder
A decoder is a logic circuit which generates all the possible combinations of the input
signals. Decoders are named with their input line numbers and the possible combinations
of the input as output. E.g.: 2 to 4 decoder, 3 to 8 decoder and 4 to 16 decoder. Decoders
are mainly used for address decoding and chip select signal generation in electronic circuits
and are available as integrated circuits. 74LS138/74AHC138 is an example for 3 to 8
decoder IC. Figure 8.7 illustrates the 74AHC138 decoder and the function table for it.
The decoder output is enabled only when the "Output Enable' signal lines E1\, E2\
and E3 are at logic levels 0, 0 and 1 respectively. If the output enable signals are not at the
required logic state, all the output lines are forced to the inactive (High) state. The output
line corresponding to the input state is asserted "Low" when the 'Output Enable signal lines
are at the required logic state.
Encoder
The encoder encodes the corresponding input state to a particular output format. The
binary encoder encodes the input to the corresponding binary format. Encoders are named
with their input line numbers and the encoder output format. E.g.: 4 to 2 encoder, 8 to 3
encoder and 16 to 4 encoder.
The 8 to 3 encoder contains 8 input signal lines and it is possible to generate a 3 bit
binary output corresponding to the input. Encoders are mainly used for address decoding
and chip select signal generation in electronic circuits and are available as integrated
circuits. 74F148/74LS148 is an example of 8 to 3 encoder IC. Figure 8.8 illustrates the
74F148/74LS148 encoder and the function table for it.
The encoder output is enabled only when the 'Enable Input (El)' signal line is at logic
0. The group signal (GS) is active-Low when any input is Low: this indicates when any
input is active. The Enable Output (EO) is active-Low when all inputs are at logic 'High'.
Encoding of key press in a keyboard is a typical example for an application requiring
encoder. The encoder converts each key press to a binary code.
Multiplexer (MUX)
A multiplexer (MUX) can be considered as a digital switch which connects one input line
from a set of input lines, to an output line at a given point of time. It contains multiple
input lines and a single output line. The inputs of a MUX are said to be multiplexed. It is
possible to connect one input with the output line at a time. The input line is selected
through the MUX control lines. 745151 is an example for 8 to 1 multiplexer IC. Figure 8.9
illustrates the 745151 multiplexer and the function table for it.
The multiplexer is enabled only when the 'Enable signal (EN)' line is at logic 0. The input
signal is switched to the output line through the channel select control lines A2, A1 and A0.
De-multiplexer (D-MUX)
A de-multiplexer performs the reverse operation of multiplexer. De-multiplexer switches the
input signal to the selected output line among a number of output lines. The output line to
which the input is to be switched is selected by the output selector control lines. The 1 to 2
de-multiplexer, NL7SZ18 is a typical example for 1 to 2 de-multiplexer IC. Figure 8.10
illustrates the NL7SZ18 de-multiplexer and the function table for it.
Combinational Circuits
In digital system design, a combinational circuit is a combination of the logic gates. The
output of the combinational circuit, at a given point of time, is dependent only on the state
of the inputs at the given point of time. Encoders, decoders, multiplexers, de-multiplexers,
adder circuits, comparators, multiple input gates, etc. are examples of digital combinational
circuits.
Half adder
A half adder is combinational circuit that adds two 1-bit binary numbers and produces the
result sum & carry. After simplifying the truth table, the half adder circuit can be realised
using an XOR and an AND gate. The circuit implementation is shown in Fig. 8.13.
Sequential Circuits
Digital logic circuit, whose output at any
given point of time depends on both the
present and past inputs, is known as
sequential circuits. Hence, sequential
circuits contain a memory element for
holding the previous input states. In
general, a sequential circuit can be
visualised as a combinational circuit with
memory elements as shown in fig.8.14.
Flip-flops act as the basic building blocks of sequential circuits. Sequential circuits
are of two types: synchronous (clocked) sequential circuits and asynchronous sequential
circuits. The operation of a synchronous sequential circuit is synchronised to a clock
signal, whereas an asynchronous sequential circuit does not require a clock for operation.
Register, synchronous counters, etc. are examples of synchronous serial circuits, whereas
ripple or asynchronous counter is an example for asynchronous sequential circuits.
MOHAMMED SALEEM | Asst. Prof., Dept. of E & C, PACE 16
[INTRODUCTION TO EMBEDDED SYSTEMS-BETCK205J] saleem_ece@pace.edu.in
A clock signal can be used for triggering the state change of flip-flops. The clock
signal can be either level triggered or edge triggered. For level triggered flip-flops, the output
responds to any changes in input signal, if the clock signal is active (ie., if the clock signal
is at logic 1 for 'HIGH' level triggered and at logic 0 for 'LOW' level triggered clock signal).
For edge triggered flip-flops, the output state changes only when a clock trigger happens
regardless of the changes in the input signal state. The clock trigger signal can be either a
positive edge (0 to 1 transition) or a negative edge (1 to 0 transition). Figure 8.16 illustrates
the implementation of an edge triggered S-R flip-flop.
The input condition S=R=1 is undefined in an S-R flip-flop. The J-K flip-flop
augments the behaviour of SR flip-flop by interpreting the input state S=R=1 as a toggle
command. The logic circuit and I/O states for JK flip-flop are given in fig.8.17.
The J-K flip-flop operates in the following way:
(1) When J=1 and K=0, the output remains in the set state.
(2) When J=0 and K=1, the output remains in the reset state.
(3) When J=K=0, the output remains at the previous logic state.
4) When J=1 and K=1, the output toggles its state.
A D-type (Delay) flip-flop is formed by connecting a NOT gate in between the S and R
inputs of an S-R flip-flop or by connecting a NOT gate between the J and K inputs of a J-K
flip-flop. Figure 8.18 illustrates a D-type flip-flop and its I/O states.
This flip-flop is known with the so-called name 'Delay' flip-flop for the following
reason-the input to the flip-flop appears at the output at the end of the clock pulse (for
falling edge triggering). A Toggle flip-flop or T flip-flop is formed by combining the J and K
inputs of a J-K flip-flop. Figure 8.19 illustrates a T flip-flop and its I/O states.
Library name-of-library;
Use name-of-library.name-of-package.ALL;
If packages or libraries are to be used, they must be defined before entity declaration. E.g.
Library ieee;
Use ieee.std_logic_1164.ALL;
E.g. The VHDL description of the D flip-flop is given below:
Library ieee;
Use ieee.std_logic_1164.all;
Entity DFF is
Port (D, CLK: in bit; Q: out bit);
End DFF;
Architecture DFF-ARCH of DFF is
Begin
Process (D, CLK)
Begin
If CLK='1' and CLK' event then
Q <= D;
End if;
End Process;
End DFF_ARCH;
HDL based VLSI Design Process
The HDL model of the circuit is compiled and loaded in an HDL simulator. The simulator
enables the designer to apply the input stimuli to the design and observe whether the
output response is as expected. If there are any functional errors, the HDL code is corrected
and the design re-simulated, till the design meets the functional specifications. The design
is now ready for synthesis.
A synthesiser tool compiles the source code to an optimised technology dependent
circuit at the gate level. The inputs to a synthesiser are the HDL code, a technology library,
and constraints. The constraints are in terms of the area and speed requirements of the
circuit to be realised in the target technology. This process is done in two phases: