26
microcomputer 1 Unit-5 Microcomputer

Microcomputer Ppt

Embed Size (px)

Citation preview

Page 1: Microcomputer Ppt

microcomputer 1

Unit-5Microcomputer

Page 2: Microcomputer Ppt

microcomputer 2

What is Microcomputer?

A microcomputer is a general purpose system; i.e.; the system is organized in such a way that it can perform a large

variety of computation.

Page 3: Microcomputer Ppt

microcomputer 3

How to achieve Objective

• Each computation is represented by a sequence of instructions (a program )that is stored in a read write memory and is executed by microcomputer.

• The execution of instructions produces transformations on the data.

Page 4: Microcomputer Ppt

microcomputer 4

Basic components of a microcomputer

Processor

Memory Subsystem I/O Subsystem

I/O devices

Page 5: Microcomputer Ppt

microcomputer 5

A microcomputer consist of three subsystems:

• A Processor• A memory subsystem• An input/output (I/O) subsystem

Page 6: Microcomputer Ppt

microcomputer 6

Processor

• It is the computing engine of the microcomputer; it executes the sequence of instructions i.e.. the program. it is also known as Central Processing Unit.

Page 7: Microcomputer Ppt

microcomputer 7

Memory Subsystem• It stores the program as well as the data

used by the program.

• The memory is divided into locations, such as bytes and words; these locations are identified by their address.

Page 8: Microcomputer Ppt

microcomputer 8

Memory operations

• Read: the processor provides the address and receives the data read from the location addressed.

• Write: the processor provides both address and the data to be stored at the corresponding location.

Page 9: Microcomputer Ppt

microcomputer 9

I/O subsystem

• It contains the interface to devices that allow transferring data input to/ from the computer.

Page 10: Microcomputer Ppt

microcomputer 10

Specification of memory subsystem

Addr(24) data(32)

Length Rdy

Read

Write

Enable

Page 11: Microcomputer Ppt

microcomputer 11

Memory subsystem signals specification

• Enable: enable signal has to be active for the system to be active

• Read/Write: the subsystem responds to an event when one of these control signals are active.

• Length: it tells the size of an operand. length=0 if size is in bytes

1 if size is in words

Page 12: Microcomputer Ppt

microcomputer 12

Memory subsystem signals specification

• Addr: the address of the memory location being accessed.

• Data: data is transferred through signal data.• Rdy: it tells the memory operation

completion. Rdy=0 if operation is in progress

1 if operation completes

Page 13: Microcomputer Ppt

microcomputer 13

How the operation would be performed

• Read Write Enable Operation

0 0 0 No operation

0 1 1 Write Access

1 0 1 Read Access

Page 14: Microcomputer Ppt

microcomputer 14

Entity declaration of Memory subsystem

1. LIBRARY ieee;2. USE ieee.std_logic_1164.all;3. USE WORK.comp_pkg.ALL;4. ENTITY Memory IS5. PORT (Addr : IN MAddrT ; -- memory address bus6. Length : IN STD_LOGIC; -- byte/word operand7. Rd, Wr : IN STD_LOGIC; -- access control signals8. Enable : IN STD_LOGIC; -- enable signal9. Rdy : OUT STD_LOGIC; -- access completion signal10.Data : INOUT WordT ); -- memory data bus11.END Memory;

Page 15: Microcomputer Ppt

microcomputer 15

Specification of I/O subsystem

Addr(11) data(32)

Length Rdy

Read

Write

Enable

Page 16: Microcomputer Ppt

microcomputer 16

Entity declaration of I/O subsystem

1. LIBRARY ieee;2. USE ieee.std_logic_1164.all;3. USE WORK.comp_pkg.ALL;4. ENTITY IO IS5. PORT (Addr : IN IOAddrT ; -- I/O address bus6. Length : IN STD_LOGIC; -- byte/word control7. Rd, Wr : IN STD_LOGIC; -- I/O access control8. Enable : IN STD_LOGIC; -- I/O enable control9. Rdy : OUT STD_LOGIC; -- I/O completion signal10.Data : INOUT WordT ); -- I/O data bus11.END IO;

Page 17: Microcomputer Ppt

microcomputer 17

Arithmetic Logic Unit(ALU)

• Definition:The arithmetic logic unit (ALU) is a digital

circuit that calculates an arithmetic operation (like an addition, subtraction, etc.) and logic operations (like an Exclusive Or) between two numbers. The ALU is a fundamental building block of the central processing unit of a computer.

Page 18: Microcomputer Ppt

microcomputer 18

Entity Declaration of ALU1. library IEEE;2. use IEEE.STD_LOGIC_1164.all; 3. use work.pack.all;4. entity alu is5. port(6. a : in STD_LOGIC_VECTOR( 15 downto 0);7. b : in STD_LOGIC_VECTOR( 15 downto 0);8. sel : in opcode;9. c : out STD_LOGIC_VECTOR( 15 downto 0)10. );11.end alu;

Page 19: Microcomputer Ppt

microcomputer 19

Architecture of ALUarchitecture alu of alu isbegin

aluproc: process (a, b, sel)begin

case sel iswhen alupass =>

c <= a after 1 ns;when andOp =>

c <= (a and b) after 1 ns;

Page 20: Microcomputer Ppt

microcomputer 20

Architecture..

when orOp =>c <= a or b after 1 ns;

when xorOp =>c <= a xor b after 1 ns;

when notOp =>c <= not a after 1 ns;

Page 21: Microcomputer Ppt

microcomputer 21

Architecture..

when plus =>c <= a + b after 1 ns;

when alusub =>c <= a - b after 1 ns;

when inc =>c <= a + "0000000000000001" after 1 ns;

Page 22: Microcomputer Ppt

microcomputer 22

Architecture..when dec =>c <= a - "0000000000000001" after 1 ns;when zero =>c <= "0000000000000000" after 1 ns;when others =>c <= "0000000000000000" after 1 ns;

end case; end process;

end alu;

Page 23: Microcomputer Ppt

microcomputer 23

Package( work.pack.all)Package used in ALUlibrary IEEE;use IEEE.STD_LOGIC_1164.all; package pack is

type opcode is (alupass ,andop ,orop ,xorop ,notop ,plus ,alusub ,inc ,dec ,zero);

function "+"(opd1,opd2:std_logic_vector( 15 downto 0))return std_logic_vector;

function "-"(opd1,opd2:std_logic_vector(15 downto 0))return std_logic_vector;

end package;

Page 24: Microcomputer Ppt

microcomputer 24

Package Body(work.pack.all)package body pack is

function "+"(opd1,opd2:std_logic_vector( 15 downto 0))return std_logic_vector is

variable sum:std_logic_vector(15 downto 0);variable carry:std_logic:='0';beginfor i in 15 downto 0 loopsum(i):= opd1(i) xor opd2(i)xor carry;carry:= (opd1(i) and opd2(i))or(opd2(i) and carry)or (opd1(i) and carry);end loop; return sum;

end function;

Page 25: Microcomputer Ppt

microcomputer 25

Package Body(work.pack.all)..function "-"(opd1,opd2:std_logic_vector( 15 downto 0))return

std_logic_vector is

variable diff:std_logic_vector( 15 downto 0);variable borrow:std_logic:='0';beginfor i in 15 downto 0 loop

diff(i):= opd1(i) xor opd2(i)xor borrow;borrow:= ( (not opd1(i)) and borrow)or((not opd1(i))and opd2(i) )or (opd2(i) and borrow);end loop; \ return diff;

end function;end pack;

Page 26: Microcomputer Ppt

microcomputer 26

Simulation