2 Introduction to Computing

Dr K. Vani

 

About the course :

 

In this digital world, embedded systems are more important in day to day life. Embedded processors are even more important as key components of embedded products ranging from toys to aeroplane. Cell phone is the most important embedded device ruling our lives. So It is necessary to understand the basics behind the embedded systems. In this course basics about micro controllers, how to program them and how to make embedded products will be discussed.

 

Learning Outcomes :

 

● To understand the hardware and software of embedded systems one must know basic concepts of digital computer design.

 

● In this lecture fundamentals of numbering system, logic gates, digital circuits, basic system architecture  and working of computer  will be discussed.

 

You will mostly be familiar with all this – this is just a quick recap !

 

1.1 System

 

A system is defined as “a way of working, organizing or performing one or many tasks according to a fixed set of rules programs or plans” (or) as “an arrangement in which all units assemble and work together according to a program or plan”. On the other hand, an embedded system is a system that has software embedded into computer hardware, which makes a system dedicated for an application or specific part of an application or a product, or part of a larger system.

 

1.2 Digital fundamentals

 

All digital computing systems work with binary values (bits). Generation of binary values and working with bits are important in computing systems. The common number system we use is the “Decimal” number system(base 10 system). There are 10 distinct symbols, 0, 1, 2, …,9 whereas computers use binary numbers (base 2 system).There are only two symbols 0 and 1. These two binary digits are commonly referred to as bits. Each decimal number has to be converted into binary for processing. The following are the steps to convert from decimal to binary number system, and vice-versa.

 

1.2.1 Steps for Decimal to Binary conversion

 

• Divide the decimal number by 2 repeatedly

    • Keep track of the remainders

 

• Continue this process until the quotient becomes zero

 

• Write the remainders in reverse order to obtain the binary number Example 2510 = 110012

 

 

1.2.2 Steps for Binary to Decimal conversion

 

•  Know the weight of each bit in a binary number according to its position

 

•  Multiply each bit by its weight

 

•  Add them together to get the decimal equivalent

 

Example      110012 = 1*20 + 0*21 + 0*22 + 1*23 + 1*24 =      2510

 

Another number system generally used for compact representation is the Hexadecimal System ( base 16 system) (Fig 1.1). It is used as a convenient representation of binary numbers.

 

1.2.3 Steps for Binary to Hexadecimal Conversion

 

● In the binary number system, group the binary digits, 4 bits at a time, starting from the right side (least significant bit)

 ● Replace each 4-bit binary number with its hex equivalent (Fig 1.2).

 

 

1.2.4 Logic gates

 

To process these binary values logic gates – AND, OR, NOT, XOR, NAND and NOR are widely used (Fig 1.3-1.5).

 

 

In an AND gate, the output variable is true (1) only when both the input variables A and B are true(1). It acts like a multiplier. In an OR gate, the output variable is true(1) when any one of the input variables is true(1). It acts like an adder.

 

In an inverter (NOT gate), the output variable is true(1) when the input variable is false(0), and the output is false(0) when the input variable is true(1). It inverts the logic sense of the binary variable. It is used in subtraction operation. In an XOR gate, the output is true(1) when any one of the inputs is true(1). It is used for comparison (Fig 1.4).

 

 

 

NAND and NOR gates (Fig 1.5) are the compliment of the AND and OR gates respectively. NAND and NOR gates are universal gates because using these gates we can generate any logic function. So these gates are used extensively.

 

Using the above set of gates any kind of digital operations can be done with digital circuits. The following is the example for adding two bits which is the half adder circuit using an XOR and an AND gate(Fig 1.6).

 

• Flip-flops are frequently used to store data. There are many types of flip-flops – D, RS, JK etc. A clocked D flip-flop is shown in Fig 1.7.

 

2. Computer Hardware

 

A computer hardware is made with these kind of digital circuits (Fig 2.1). A computer system has a CPU (Central Processing Unit) which executes instructions stored in memory, I/O (Input/output) devices which provide a means of communicating with CPU and Memory to store data and programs. There are different kinds of memory. They are:

 

RAM (Random Access Memory) – It is a temporary storage of programs when the computer is running. The data is lost when the computer is off.

 

ROM (Read Only Memory) – It contains programs and information essential for the operation of the computer. This information cannot be changed by use, and is not lost when power is off. It is called as nonvolatile memory.

 

The internal working can be broken down into three parts namely CPU, memory and I/O devices. The function of the CPU is to execute instructions stored in memory. The function of I/O devices such as keyboard and video monitor is to provide a means of communicating with the CPU. The CPU is connected to memory and I/O through strips of wires called a bus. It carries information from place to place.

 

Based on the usage/purpose of communication, these are named as Address bus/Data bus/Control bus. Address bus will communicate the address for memory locations. It is unidirectional and is used to identify the devices and memory connected to CPU – the more address lines available, the larger the number of devices that can be addressed. It determines the number of locations with which it can communicate. The number of locations is always equal to 2x where x is the number of address lines, regardless of the size of the data bus. For example, a CPU with 16 address lines can provide a total of 65,536 or 64k bytes of addressable memory.

 

The grouping of data lines is called data bus. It is bidirectional, since the CPU must use it either to receive or to send data. The size of data bus in CPUs normally varies between 8 and 64. Early computers such as Apple 2 use an 8 bit data bus while super-computers such as Cray use a 64 bit bus. Control bus will send control signals.

 

2.1 Inside CPUs

 

A program stored in memory provides instruction to the CPU to perform an action (Fig 2.2). The action can simply be adding data such as payroll data, or controlling a machine as a robot. It is the function of CPU to fetch these instruction from memory and execute them. To perform the actions of fetch and execute, all CPUs are equipped with resources as explained below.

 

1. The CPU uses registers to store the information temporarily. The information could be two values to be processed or the address of the value needed to be fetched from memory. Depending on the CPU, registers can be 8-bits, 32-bits or even 64-bits wide. The more and bigger the registers, the better the CPU. The disadvantage of bigger registers is that it will increase the cost of that CPU.

 

2. The CPU has ALU (Arithmetic/Logic Unit). The ALU is used for performing arithmetic functions such as addition, subtraction, multiplication, division and logic functions such as AND, OR and NOT.

 

3. Every CPU has a Program Counter. The function of the Program Counter(PC) is to point to the address of the next instruction that is to be executed. As each instruction is executed, the program counter is incremented to the address of the next instruction that is to be executed.

 

4. The function of the instruction decoder is to interpret the instructions fetched into the CPU. The complexity of the instruction decoder depends on the type and number of instructions supported. A CPU requires more hardware (transistors in design) for understanding a large number of instructions. Hence, there is a trend towards keeping the number of instructions limited (Reduced Instruction Set Computers – RISC).

 

In the example shown in Fig. 2.2, the CPU has registers called A, B, C and D. It has an 8-bit data bus and a 16 bit address bus. Hence the CPU can access memory from address 0000 to FFFFH. Thus, the hardware architecture gives complete inner details of the system. This hardware(system) is used for processing data in association with the software.

 

3. Summary

 

In this module, different definitions of system and embedded system have been outlined. Fundamentals of computing, digital processing and different number systems are discussed. Logic circuits for digital design is also discussed. An introduction to System architecture has been given.

 

Supporting books

 

Web Links

  • http://en.wikipedia.org/wiki/Embedded_system
  • http://en.wikibooks.org/wiki/Embedded_Systems/Embedded_Systems_Introduction