The Software Developer S View of the Hardware

The Software Developer S View of the Hardware

THE SOFTWARE DEVELOPER’S VIEW OF THE HARDWARE

Representation of data within the computer

character representation, namely:

  • ASCII (American Standard Code for Information Interchange) allows text data to be stored in binary form using 7 bits to encode a total of 128 characters. The “spare” bit is known as a parity bit when used for error-checking. Sorting ASCII in ascending order places uppercase letters before lowercase.
  • BCD (Binary Encoded Decimal) stores each digit using 4 bits. It is not sufficient for alphabet characters, as it can only represent 16 (24) characters, ten of which are decimals.
  • EBCDIC (Extended Binary Coded Decimal Interchange) uses 8 bits and thus 256 characters can be encoded.
  • Hexadecimal numbers are to the base 16, of values 0-9 and then A-F.

integer representation, including:

  • Sign and modulus uses the leftmost bit to represent the sign of a number. 0 is positive, while 1 is negative. The remaining bits give the magnitude or modulus of the number. There are two representations of zero using this method, positive 00000000 and negative 10000000.
  • Using one’s complement, all the zeros and ones in the positive form are reversed to represent its negative form, and thus the range extends from –128 to +127 (where 0 is positive) using an 8 bit system. There are two representations of zero using this method, positive 00000000 and negative 11111111.
  • Two’s complement can be found by adding 00000001 to the one’s complement of a number. There is only one representation of zero using this method, 00000000, as 11111111 + 1 is not allowable.

representation of fractions, namely floating point or real

  • Floating point or real numbers are a method of representing fractions. They are made up of a sign bit, an exponent (8 bits), and a mantissa (23 bits). IEEE 754 floating point standard is used in most computers.
  • Real numbers allow for a grater range of numbers to be represented, because they are able to take into account both positive and negative numbers. However, large numbers, or those with a large number of decimal places, may not be completely accurate because there is only a finite amount of space to store the number.
  • Problems with inaccuracy often as many decimal fractions cannot be represented as exact binary fractions. When the number of digits exceeds the space allocated for storage, it must be truncated, not rounded, to avoid and overflow error.

binary arithmetic, including:

  • Addition is the basis of all arithmetic operations inside the computer. The rules for binary addition are 0 + 0 = 0, 1 + 0 = 1, and 1 + 1 = 0 (where the 1 carries into the next position). If the number is outside the bit range, and overflow error results.
  • Subtraction is performed through complementary addition. Computers cannot carry out direct binary subtraction as they do not understand the concept of borrowing digits. Subtracting the number is the same as adding the negative value of the number (i.e. A + [-B]). Therefore the two’s complement of the number to be subtracted is taken and added to the other number.
  • Multiplication is carried out in the exact same way as long hand multiplication.
  • Division can be carried out using long division, using the shift and subtract technique. All binary arithmetic operations can be reduced to addition.

Electronic circuits to perform standard software operations

logic gates, including AND, OR, NOT, NAND, NOR, XOR

  • Logic gates are hardware circuits that produce a 1 or 0 output signal depending if the input requirements are satisfied. They are usually implemented in the computer using integrated circuits; a small silicon chip containing components such as resistors, diodes, transistors, and capacitors.

truth tables

  • Truth tables are a compact way of showing the possible outputs from all possible variations of inputs into a logic gate.

circuit design steps

  • Designing a circuit to perform a particular function requires a systematic procedure:
  1. Identify inputs and outputs: Determine the number of inputs and outputs needed.
  2. Identify required components: Determine which logic gates are needed.
  3. Check the solution with a truth table: Test whether the solution works as required.
  4. Evaluate the circuit design: Ensure circuit is efficient, and meets design criteria.

specialty circuits, including:

  • All circuits are made from a combination of the basic logic gates, and can be designed to perform addition, subtraction, and comparisons. As the number of inputs increases, circuits become more complex.
  • Combinational circuits produce instant output.
  • Sequential circuits contain memory cells and logic gates, and the memory state is determined by previous inputs.
  • When two ones are added, the result consists of two digits, 10 (or in decimal form, 2). The higher bit is called a carry.
  • A half adder is a combinational circuit made by combining the AND and XOR gates allowing for the addition of two bits. It has two inputs (the two bits) and two outputs (Sum and Carry).
  • A full adder is a combinational circuit made by combining two half adders and introducing an OR gate. It has three inputs (the three bits) and two outputs (Sum and Carry). It has the advantage that it can accept a carry bit from a previous addition.
  • A flip flop is a circuit that can store a binary value (1 or 0) as long as power is supplied. When a value has been sent, it remains in this state until told to change. They can be made from a combination of NAND or NOR gates. They have two inputs, Set and Reset (S and R), and two outputs, Q and Q’.
  • Flip flops are the basic building blocks of computer memory.
  • A flip flop requires prior output in order to have complete input. Hence, the flip flop must establish an output somehow so it can be used to store a value. The following examples assume that the flip flop has no previous output.
  • NAND and NOR flip flops establish a state of 1 when one 0 input and one 1 input are sent into the Set and Reset. Sending in two 1 inputs gives no result, and it is impossible to send in two 0 inputs. As a result, and output has been set up so that future input can determine what value is stored.

Programming of hardware devices

the input data stream from sensor and other devices

  • For a computer to be able to communicate with other computers or input/output devices, data transmissions must be structured.
  • A protocol is a set of rules that govern the transmission of data between hardware.
  • A protocol must be established between two devices before they can exchange data. The computer needs to know how data is structured before it can be properly handled. The protocol used will determine the rules for structuring data packets; a group of binary digits containing data and control characters.
  • Data streams are composed of a header, data characters (including control characters), and a trailer.
  • Most interfaces between the CPU and the connected device require at least three transactions:

-the host controller sends a token packet to indicate the status of a device or the desire to transmit data

-the data is transmitted

-the connected device or host will acknowledge the data was received successfully

  • Header information contains a sequence of bits to indicate the start of a block of data, the device from whence the data is coming, and sometimes how much data is to be transmitted. They often contain error-checking data such as parity bits.
  • Data characters make up the body of data and contain the instructions that are to be processed by the CPU.
  • Trailer information contains data bits to indicate the end of a block of data. Headers and trailers help the CPU manage the data it receives. Data for error-checking may also be included in the trailer.
  • Control characters permit the checking and correct interpretation of the packet.
  • Hardware specifications affect the input and data stream in that it will be structured according the protocol followed by the developer. Driver or extension software may be required to enable an operating system to communicate with certain peripherals. A recent hardware standard for data handling is USB.
  • Documentation accompanying hardware devices should specify the protocols used and some details on the handling of data.

processing of data stream

  • The need to recognise and strip control characters is that they are instructions on how to handle data. After they are used they are no longer of any value. Protocols decide how the device does this.
  • Counting the data characters refers to the number and size of the data packets being sent. Header fields contain this data.
  • Extracting the data from the data stream involves removing the header, trailer, and control characters. The hardware extracts the data but the software provides instructions on how it will be handled.

generating output to an appropriate output device

  • The output data stream functions in a similar way to the input data stream. In this case, the CPU is the sending information to the connected device.
  • Output data packets also require header information to specify the device, the number and size of packets, and the type of data, and the trailer information has end of packet characters and error-checking methods. Some control characters will also be included.

control systems

  • A computer-controlled system is a combination of hardware and software designed to instruct the control of a specific device. They are composed of:

-sensors (input)

-a process controller (processing)

-effectors and actuators (output)

  • The sensors provide the input to the system, the controller performs the processing and as a consequence directs the actuators to perform some physical task.
  • Responding to sensor information depends on the type of control system:

-Open loop systems do not respond to their environment. A particular input is processed to produce a specific output.

-Closed loop systems are able to react to its environment and changes within it. They take the output from the system and use it as feedback to control the behaviour of the system.

  • Sensors are used to record both analog and digital data. As computers can only interpret digital data, the signals need to be converted into digital pulses.
  • Specifying motor operations is done by a processor or software. It determines what actions are taken by the control system.

printer operation and control characters for features, including page throw, font change, line spacing

  • Communication with printers requires the use of specialized control characters to generate the correct printer responses. Many printers also use customised control characters to indicate page throw, font change, and line spacing.

specialist devices with digital input and/or output

  • There are a large number of hardware devices that directly transmit digital data to a computer system, such as digital cameras, MIDI, hard drives, and printers. It allows data to be transmitted faster, without errors or conversion losses.

1