The document describes the design of a CPU with an 8-bit instruction set. It includes the design of the instruction set architecture, microarchitecture, and implementation in VHDL. The CPU was tested using assembly programs loaded into program memory to perform operations like decrement, increment, shift left, and logic complement. The design and testing demonstrate the basic functioning of the CPU.
Microchip's PIC Micro Controller - Presentation Covers- Embedded system,Application, Harvard and Von Newman Architecture, PIC Microcontroller Instruction Set, PIC assembly language programming, PIC Basic circuit design and its programming etc.
PIC Introduction and explained in detailedAnkita Tiwari
The document provides an introduction to the PIC microcontroller. It discusses what a microcontroller is, compares microcontrollers to general purpose microprocessors, and briefly outlines the history of the PIC microcontroller. It then describes features of the PIC16F84 microcontroller including its clock generator, reset function, ports, central processing unit, and memory organization including flash memory, RAM, and ROM. It also covers the timer and prescalar functions.
EE6008 MCBSD - Introduction to PIC Micro controller pavihari
This document outlines the syllabus for the course EE6008 Microcontroller Based System Design. It covers 5 units:
1. Introduction to PIC microcontrollers including architecture of PIC16C6x and PIC16C7x families.
2. Interrupts and timers in PIC microcontrollers including external interrupts, timer programming.
3. Peripherals and interfacing including I2C, serial EEPROM, ADC, UART, LCD interfacing.
4. Introduction to ARM processor architecture including programmer's model, development tools, memory hierarchy.
5. ARM organization including pipeline organization, instruction execution, instruction set, coprocessor interface.
This document provides an overview of the PIC-18 microcontroller. It describes the PIC-18's features such as its 8-bit architecture with 16-bit instruction sets, memory sizes including 256 bytes of EPROM and 2KB of SRAM. The document also discusses the PIC-18's addressing modes, memory organization with separate program and data memory spaces, and instruction pipelining capability.
The document discusses interrupts for the PIC18 microcontroller. It explains that interrupts allow the microcontroller to instantly respond to events like pin changes or timer overflows. When an interrupt occurs, the microcontroller stops executing the main program and jumps to the interrupt service routine (ISR) to handle the interrupt. It provides details on enabling and disabling interrupts, the interrupt vector table, and examples of using interrupts for external pins, timers, and serial communication.
This document provides an introduction to PIC microcontrollers. It discusses why PICs have become popular, including their low cost, wide availability, and support tools. It then describes the basic architecture of PIC microcontrollers, including their Harvard architecture, RISC design, and peripheral features like timers and serial communication. Finally, it discusses the architecture of the PIC16C6x line specifically, outlining its registers, addressing modes, and peripheral modules.
Microchip's PIC Micro Controller - Presentation Covers- Embedded system,Application, Harvard and Von Newman Architecture, PIC Microcontroller Instruction Set, PIC assembly language programming, PIC Basic circuit design and its programming etc.
PIC Introduction and explained in detailedAnkita Tiwari
The document provides an introduction to the PIC microcontroller. It discusses what a microcontroller is, compares microcontrollers to general purpose microprocessors, and briefly outlines the history of the PIC microcontroller. It then describes features of the PIC16F84 microcontroller including its clock generator, reset function, ports, central processing unit, and memory organization including flash memory, RAM, and ROM. It also covers the timer and prescalar functions.
EE6008 MCBSD - Introduction to PIC Micro controller pavihari
This document outlines the syllabus for the course EE6008 Microcontroller Based System Design. It covers 5 units:
1. Introduction to PIC microcontrollers including architecture of PIC16C6x and PIC16C7x families.
2. Interrupts and timers in PIC microcontrollers including external interrupts, timer programming.
3. Peripherals and interfacing including I2C, serial EEPROM, ADC, UART, LCD interfacing.
4. Introduction to ARM processor architecture including programmer's model, development tools, memory hierarchy.
5. ARM organization including pipeline organization, instruction execution, instruction set, coprocessor interface.
This document provides an overview of the PIC-18 microcontroller. It describes the PIC-18's features such as its 8-bit architecture with 16-bit instruction sets, memory sizes including 256 bytes of EPROM and 2KB of SRAM. The document also discusses the PIC-18's addressing modes, memory organization with separate program and data memory spaces, and instruction pipelining capability.
The document discusses interrupts for the PIC18 microcontroller. It explains that interrupts allow the microcontroller to instantly respond to events like pin changes or timer overflows. When an interrupt occurs, the microcontroller stops executing the main program and jumps to the interrupt service routine (ISR) to handle the interrupt. It provides details on enabling and disabling interrupts, the interrupt vector table, and examples of using interrupts for external pins, timers, and serial communication.
This document provides an introduction to PIC microcontrollers. It discusses why PICs have become popular, including their low cost, wide availability, and support tools. It then describes the basic architecture of PIC microcontrollers, including their Harvard architecture, RISC design, and peripheral features like timers and serial communication. Finally, it discusses the architecture of the PIC16C6x line specifically, outlining its registers, addressing modes, and peripheral modules.
The document summarizes key aspects of the PIC18 microcontroller including its features, memory organization, registers, and instruction set. It provides an overview of the PIC18's 8-bit CPU, program memory up to 128KB, SRAM up to 4KB, and peripheral functions. The summary describes the separation of the PIC18's program and data memories, its banked memory architecture, and addresses of important registers like the WREG, STATUS, and BSR registers.
1 Microcontroller overview
1.1 Industrial automation systems overview
1.2 Microcontroller architecture
1.3 The pedagogical robot
1.4 Digital Inputs/Outputs
1.5 Embedded C Language
This document provides an overview of basic non-pipelined CPU architecture, including:
- The main components of a CPU including registers, ALU, and control unit.
- Different CPU architecture types such as accumulator, stack, register-memory, and register-register architectures.
- The fetch-decode-execute cycle that CPUs follow to process instructions step-by-step.
- Approaches for implementing the control unit including hardwired and microprogrammed approaches.
- How to calculate parameters like CPI (cycles per instruction) and MIPS (millions of instructions per second) to evaluate CPU performance.
This document provides an overview of basic computer organization and design. It discusses memory reference instructions, input/output and interrupts, and the design of a basic computer. The computer consists of a memory unit, nine registers, flags, decoders, buses, and control logic. It describes the control functions for memory reading and writing, register selection, flag manipulation, and arithmetic operations using an adder and logic circuit. The document aims to provide a complete description of the basic components and design of a computer system.
This document provides an overview and agenda for a presentation on the ARM Cortex-M4 embedded system and the Tiva TM4C123GH6PM microcontroller. The presentation covers the microcontroller overview, general purpose input/outputs, bitwise operators, the system timer SysTick, delay libraries, and interfacing with the 74595 chip. The agenda includes slides on each of these topics.
The PIC microcontroller uses a Harvard architecture with separate program and data memories. It has a CPU with an ALU, memory unit, and control unit. The memory includes program memory to store instructions, data memory including registers for temporary data storage, and EEPROM for storing variables. It has advantages like a small instruction set, low cost, and built-in interfaces like I2C, SPI, and analog components.
The document discusses interrupt-initiated input/output in computer systems. It explains that when an I/O device is ready to transfer data, it generates an interrupt request to the CPU. The CPU then stops its current task, branches to an interrupt service routine to process the data transfer, before returning to its original task. It provides a flowchart of the interrupt cycle and describes the register transfer operations that occur, including saving the return address and branching to an interrupt handling location in memory. Finally, it outlines the basic hardware components of a computer, including memory, registers, decoders, and control logic gates.
The PIC 16F877A microcontroller uses a Harvard architecture with separate program and data buses. It has 8kB of flash memory, 368 bytes of RAM, and 256 bytes of EEPROM. It features five I/O ports, three timers, USART serial communication, and 15 interrupt sources. Instructions are in RISC format and execute in 4 machine cycles, with most instructions completing in one cycle.
The document discusses various peripherals on microcontrollers including parallel I/O ports (P0-3), timers/counters, DAC, ADC, PWM, UART. It provides details on how each peripheral works, the registers used to control them, and examples of using timers/counters and DAC to generate waveforms.
AAME ARM Techcon2013 003v02 Software DevelopmentAnh Dung NGUYEN
This document provides an overview of the Keil MDK development tools and environment for software development on ARM Cortex-M microcontrollers. It describes the μVision IDE, ARM compiler, debugger and other tools. It discusses the embedded development process, including considerations when moving from a development environment to a standalone application such as memory maps, application startup, and C library usage. It also covers optimization levels, language support, variable types, and default memory maps and C libraries provided by the tools.
Firmware is a program that provides low-level control for a device's specific hardware. It performs control, monitoring and data manipulation functions. Firmware is stored in non-volatile memory like EPROM or flash memory. Common reasons for updating firmware include fixing bugs or adding new features. Firmware may be the only program that runs on an embedded system and provides all of its functions.
AVR_Course_Day6 external hardware interrupts and analogue to digital converterMohamed Ali
The document discusses external hardware interrupts and analog to digital converters (ADCs) for AVR microcontrollers. It covers:
1. External interrupt registers and programming, describing how to enable/disable interrupts using SREG and EIMSK registers.
2. ADC features of AVRs, including its 10-bit resolution, registers like ADMUX for selecting channels and references, and ADCSRA for control.
3. Programming ADC using polling or interrupts in C, with examples provided. ADC polling requires waiting for conversion to complete by checking ADIF, while interrupts use ADIE.
The document discusses CPU architecture and microcontroller components. It describes how the CPU is divided into three main parts: the datapath, control unit, and instruction set. The datapath performs data processing, the control unit uses instructions to direct the datapath, and the instruction set is the programmer interface. It then focuses on explaining the datapath in more detail, including the arithmetic logic unit, register file, and their functions. Finally, it provides an overview of different microcontroller families that can be selected based on application requirements like I/O needs, memory, speed, and more.
This document discusses machine cycles and timing diagrams in microprocessors. It focuses on the 8085 microprocessor. It describes that a machine cycle is the time required to access memory or input/output devices, while an instruction cycle is the time to execute an instruction. For the 8085, there are 5 basic machine cycles - opcode fetch, memory read, memory write, I/O read, and I/O write. Each takes a certain number of T-states. For example, the opcode fetch cycle takes 4 T-states to fetch the opcode from memory. The document provides details on the timing and signals involved in each type of machine cycle.
The document discusses the PIC16F877A microcontroller. It describes the essential elements as having a 8K flash program memory, 368 bytes of data RAM, 256-byte EEPROM, 5 I/O ports, a 10-bit analog-to-digital converter, timers, and interrupts. The pinout and internal architecture are also summarized, including the CPU, memory types, clock, ports, timers, and analog-to-digital converter. The basic elements of the microcontroller are outlined as the clock, ALU, accumulator, RAM memory types, and permanent memories.
This document discusses computer architecture and microprocessors. It explains how to set up a counter using a register loaded with a number that is then incremented or decremented. It discusses time delay, which uses a counter concept where the number of clock cycles depends on T-states. A simple example program is provided and calculated to take 1.8 milliseconds to execute based on a 2MHz processor frequency. Additional examples are given to illustrate using register pairs or nested loops to create longer time delays. The document also covers stacks, stack instructions, and using subroutines to avoid repeatedly writing time delay code.
The document discusses the timing cycles of a microprocessor including T-states, machine cycles, and instruction cycles. A T-state is one clock period. A machine cycle is the time required to complete an operation like memory access and can comprise multiple T-states. There are five types of machine cycles including opcode fetch, memory read/write, and input/output read/write. An instruction cycle is the total time to fetch and execute a full instruction and can include one or more machine cycles. Examples are provided to illustrate how different instructions take different numbers of T-states and machine cycles to complete.
This document discusses analog to digital conversion using a microcontroller. It describes configuring the microcontroller's analog to digital converter to take readings from sensors connected to analog input pins. It explains concepts like reference voltages, conversion time, and reading the digital output. The document provides an example of reading an analog potentiometer input using Microchip's ADC functions in C. It also outlines some workshops involving reading sensors and controlling a robot using the analog to digital converter.
This guide provides information to help consumers choose the right refrigerator. It discusses the different types of refrigerators categorized by compartments (top freezer, bottom freezer, side-by-side, French door), capacity (single door, double door), and other attributes. Key features to consider include storage capacity needed, door configuration, included features, price, and brand reliability. Proper use and regular maintenance can maximize a refrigerator's efficiency and lifespan. Consumers should clean coils and shelves, avoid leaving the door open, and defrost the freezer periodically.
Web based control of pressure loop apparatusOsama Azim
The document summarizes a student project on web-based control of a pressure loop apparatus using LabVIEW. The project involved designing a closed-loop feedback control system using proportional, integral and derivative (PID) control to regulate air pressure. A virtual laboratory system was created using G-Web Server in LabVIEW to allow web-based monitoring and control of the pressure loop. The system could enable applications such as remote experimentation and industrial process monitoring over a network.
The document summarizes key aspects of the PIC18 microcontroller including its features, memory organization, registers, and instruction set. It provides an overview of the PIC18's 8-bit CPU, program memory up to 128KB, SRAM up to 4KB, and peripheral functions. The summary describes the separation of the PIC18's program and data memories, its banked memory architecture, and addresses of important registers like the WREG, STATUS, and BSR registers.
1 Microcontroller overview
1.1 Industrial automation systems overview
1.2 Microcontroller architecture
1.3 The pedagogical robot
1.4 Digital Inputs/Outputs
1.5 Embedded C Language
This document provides an overview of basic non-pipelined CPU architecture, including:
- The main components of a CPU including registers, ALU, and control unit.
- Different CPU architecture types such as accumulator, stack, register-memory, and register-register architectures.
- The fetch-decode-execute cycle that CPUs follow to process instructions step-by-step.
- Approaches for implementing the control unit including hardwired and microprogrammed approaches.
- How to calculate parameters like CPI (cycles per instruction) and MIPS (millions of instructions per second) to evaluate CPU performance.
This document provides an overview of basic computer organization and design. It discusses memory reference instructions, input/output and interrupts, and the design of a basic computer. The computer consists of a memory unit, nine registers, flags, decoders, buses, and control logic. It describes the control functions for memory reading and writing, register selection, flag manipulation, and arithmetic operations using an adder and logic circuit. The document aims to provide a complete description of the basic components and design of a computer system.
This document provides an overview and agenda for a presentation on the ARM Cortex-M4 embedded system and the Tiva TM4C123GH6PM microcontroller. The presentation covers the microcontroller overview, general purpose input/outputs, bitwise operators, the system timer SysTick, delay libraries, and interfacing with the 74595 chip. The agenda includes slides on each of these topics.
The PIC microcontroller uses a Harvard architecture with separate program and data memories. It has a CPU with an ALU, memory unit, and control unit. The memory includes program memory to store instructions, data memory including registers for temporary data storage, and EEPROM for storing variables. It has advantages like a small instruction set, low cost, and built-in interfaces like I2C, SPI, and analog components.
The document discusses interrupt-initiated input/output in computer systems. It explains that when an I/O device is ready to transfer data, it generates an interrupt request to the CPU. The CPU then stops its current task, branches to an interrupt service routine to process the data transfer, before returning to its original task. It provides a flowchart of the interrupt cycle and describes the register transfer operations that occur, including saving the return address and branching to an interrupt handling location in memory. Finally, it outlines the basic hardware components of a computer, including memory, registers, decoders, and control logic gates.
The PIC 16F877A microcontroller uses a Harvard architecture with separate program and data buses. It has 8kB of flash memory, 368 bytes of RAM, and 256 bytes of EEPROM. It features five I/O ports, three timers, USART serial communication, and 15 interrupt sources. Instructions are in RISC format and execute in 4 machine cycles, with most instructions completing in one cycle.
The document discusses various peripherals on microcontrollers including parallel I/O ports (P0-3), timers/counters, DAC, ADC, PWM, UART. It provides details on how each peripheral works, the registers used to control them, and examples of using timers/counters and DAC to generate waveforms.
AAME ARM Techcon2013 003v02 Software DevelopmentAnh Dung NGUYEN
This document provides an overview of the Keil MDK development tools and environment for software development on ARM Cortex-M microcontrollers. It describes the μVision IDE, ARM compiler, debugger and other tools. It discusses the embedded development process, including considerations when moving from a development environment to a standalone application such as memory maps, application startup, and C library usage. It also covers optimization levels, language support, variable types, and default memory maps and C libraries provided by the tools.
Firmware is a program that provides low-level control for a device's specific hardware. It performs control, monitoring and data manipulation functions. Firmware is stored in non-volatile memory like EPROM or flash memory. Common reasons for updating firmware include fixing bugs or adding new features. Firmware may be the only program that runs on an embedded system and provides all of its functions.
AVR_Course_Day6 external hardware interrupts and analogue to digital converterMohamed Ali
The document discusses external hardware interrupts and analog to digital converters (ADCs) for AVR microcontrollers. It covers:
1. External interrupt registers and programming, describing how to enable/disable interrupts using SREG and EIMSK registers.
2. ADC features of AVRs, including its 10-bit resolution, registers like ADMUX for selecting channels and references, and ADCSRA for control.
3. Programming ADC using polling or interrupts in C, with examples provided. ADC polling requires waiting for conversion to complete by checking ADIF, while interrupts use ADIE.
The document discusses CPU architecture and microcontroller components. It describes how the CPU is divided into three main parts: the datapath, control unit, and instruction set. The datapath performs data processing, the control unit uses instructions to direct the datapath, and the instruction set is the programmer interface. It then focuses on explaining the datapath in more detail, including the arithmetic logic unit, register file, and their functions. Finally, it provides an overview of different microcontroller families that can be selected based on application requirements like I/O needs, memory, speed, and more.
This document discusses machine cycles and timing diagrams in microprocessors. It focuses on the 8085 microprocessor. It describes that a machine cycle is the time required to access memory or input/output devices, while an instruction cycle is the time to execute an instruction. For the 8085, there are 5 basic machine cycles - opcode fetch, memory read, memory write, I/O read, and I/O write. Each takes a certain number of T-states. For example, the opcode fetch cycle takes 4 T-states to fetch the opcode from memory. The document provides details on the timing and signals involved in each type of machine cycle.
The document discusses the PIC16F877A microcontroller. It describes the essential elements as having a 8K flash program memory, 368 bytes of data RAM, 256-byte EEPROM, 5 I/O ports, a 10-bit analog-to-digital converter, timers, and interrupts. The pinout and internal architecture are also summarized, including the CPU, memory types, clock, ports, timers, and analog-to-digital converter. The basic elements of the microcontroller are outlined as the clock, ALU, accumulator, RAM memory types, and permanent memories.
This document discusses computer architecture and microprocessors. It explains how to set up a counter using a register loaded with a number that is then incremented or decremented. It discusses time delay, which uses a counter concept where the number of clock cycles depends on T-states. A simple example program is provided and calculated to take 1.8 milliseconds to execute based on a 2MHz processor frequency. Additional examples are given to illustrate using register pairs or nested loops to create longer time delays. The document also covers stacks, stack instructions, and using subroutines to avoid repeatedly writing time delay code.
The document discusses the timing cycles of a microprocessor including T-states, machine cycles, and instruction cycles. A T-state is one clock period. A machine cycle is the time required to complete an operation like memory access and can comprise multiple T-states. There are five types of machine cycles including opcode fetch, memory read/write, and input/output read/write. An instruction cycle is the total time to fetch and execute a full instruction and can include one or more machine cycles. Examples are provided to illustrate how different instructions take different numbers of T-states and machine cycles to complete.
This document discusses analog to digital conversion using a microcontroller. It describes configuring the microcontroller's analog to digital converter to take readings from sensors connected to analog input pins. It explains concepts like reference voltages, conversion time, and reading the digital output. The document provides an example of reading an analog potentiometer input using Microchip's ADC functions in C. It also outlines some workshops involving reading sensors and controlling a robot using the analog to digital converter.
This guide provides information to help consumers choose the right refrigerator. It discusses the different types of refrigerators categorized by compartments (top freezer, bottom freezer, side-by-side, French door), capacity (single door, double door), and other attributes. Key features to consider include storage capacity needed, door configuration, included features, price, and brand reliability. Proper use and regular maintenance can maximize a refrigerator's efficiency and lifespan. Consumers should clean coils and shelves, avoid leaving the door open, and defrost the freezer periodically.
Web based control of pressure loop apparatusOsama Azim
The document summarizes a student project on web-based control of a pressure loop apparatus using LabVIEW. The project involved designing a closed-loop feedback control system using proportional, integral and derivative (PID) control to regulate air pressure. A virtual laboratory system was created using G-Web Server in LabVIEW to allow web-based monitoring and control of the pressure loop. The system could enable applications such as remote experimentation and industrial process monitoring over a network.
This document describes a waste heat recovery system from a domestic refrigerator. It discusses how part of the heat from the refrigerator condenser is wasted and can be utilized. The system designed recovers this waste heat using a heat exchanger and utilizes it to power a small oven. It provides details on the design of the heat exchanger and oven, fabrication of parts, results which show a 3.3% improvement in refrigerator COP, and concludes the system is technically feasible and economically viable for heat recovery from household refrigerators.
This document provides a final status report for a senior design team's mechanical engineering project. The project aimed to address lack of access to water and electricity in developing countries by designing a portable system that can pump water and generate electricity through pedal power on a standard bicycle. The system attaches to any bike and allows it to still be ridden while powering a water pump and generator. The report describes the overall design, testing results, cost, and how the design meets the goals of providing potable water and phone charging capabilities through a low-cost and easy to use system.
The document provides information about a solar tracking system project being conducted by students. It includes an index listing the topics that will be covered in the report such as design thinking, introduction to solar tracking systems, reverse engineering, idea generation techniques, and prototypes. Reverse engineering is discussed as a way to understand existing solar tracking systems and aid in the design of a new system. Several idea generation methods like SCAMPER are explained that could be applied to the solar tracking system design. An introduction to design canvases like mind maps, empathy maps, and ideation canvases is also provided to outline the approach that will be taken.
Magnetic refrigeration uses the magnetocaloric effect to achieve cooling through a thermodynamic cycle that involves magnetizing and demagnetizing a material. It was discovered in 1881 and further developed in the 1920s-1930s to achieve temperatures below 1K. Recent research has focused on materials with giant magnetocaloric effects and developing practical refrigerator designs. Magnetic refrigeration offers higher efficiency and lower costs than vapor compression refrigeration, with benefits for the environment and new technologies. Further development is still needed to address challenges like improving magnetocaloric materials and precision moving parts.
1. The document provides guidelines for students in the 4th semester of their design engineering program. It outlines an observation and prototyping process using the AEIOU framework to understand user needs based on activities, environments, interactions, objects, and users.
2. Students are instructed to create a Learning Needs Matrix to identify learning requirements and prioritize skills to develop. They then create "dirty mock-ups" or fast prototypes based on their observations to validate concepts with users.
3. At the end of the 4th semester, students will submit a report summarizing their findings, modifications to initial canvases, pre-design calculations, and validation/refinement of their first prototype, along with their Learning Needs
This document provides an introduction and overview for Section 1b of the A2 Media Studies exam. It discusses:
- The structure of the exam, which will focus on analyzing one of the student's coursework productions using relevant media theory.
- The five key concepts that may be examined: representation, media language, narrative, audience, and genre.
- Examples of relevant media theories for each concept.
- Homework requiring students to analyze their music video production using some of the media theories from the provided "critic sheet."
The document describes the development of a self-powered generator project. It includes canvases for AEIOU, empathy mapping, ideation, and product development. The AEIOU canvas outlines activities, environment, interactions, objects, and users observed at a power plant. The empathy canvas describes affected users, stakeholders, activities, and stories. The ideation canvas lists people, activities, situations where power cuts occur, and possible solutions. The product development canvas defines the product's purpose, users, experience, functions, features, components, and revalidation based on customer feedback. It was redesigned without an auto-charging function requiring manual battery charging.
The document is a project report submitted by 4 students - Yash Ambekar, Jaykumar Desai, Yash Prajapati and Rocky Yadav - for their 4th semester Automobile Engineering course at Gujarat Technological University. The report details their project on developing a "Next Gen Biodiesel Engine" and includes sections on introduction, AEIOU sheets, empathy mapping, ideation canvas, product development canvas and a learning needs matrix. The summary focuses on providing a high-level overview of the contents and purpose of the report in 3 sentences or less.
This document provides information about a student project on designing a solar energy system. It includes the names and locations of the five students in the group and their faculty guide. It then covers various canvases used in the design process, including storyboarding, AEIOU analysis, ideation, and product development. The storyboarding canvas explores potential users and activities. The AEIOU analysis outlines the environment, interactions, objects, activities, and users. The ideation canvas generates possible solutions based on activities, contexts, and people. Finally, the product development canvas details the product experience, features, functions, components, and target users.
This document is a project report submitted by a group of 4 students - Ravi Patel, Rai Narendra, Shah Viraj, and Sumara Anish - to their professor Sanjay Patel on reducing electricity bills. The report details the 5 required sheets for the project: A) Activity sheet, E) Environment sheet, I) Interaction sheet, O) Object sheet, and U) Users sheet. For each sheet, the report describes the observations and notes recorded by the group related to power consumption at their college laboratory and home appliances, with the goal of understanding how to reduce electricity bills.
The document provides instructions for Project 1B which involves measuring, drawing diagrams, and presenting drawings of a given space. Students must measure and draw the space to scale, including a plan, elevations, section, bubble diagrams, axonometric sketch, and two detail drawings. They must compile the 8 drawings into an A3 folder presentation. The drawings will be evaluated based on proper techniques, measurements, annotations, ordering, and workmanship. Students will work in groups to measure the same space but complete individual drawings for submission by the deadline of 3PM on November 29th, 2013.
This document describes a project on road safety done by students of the Department of Electrical Engineering at Gujarat Power Engineering and Research Institute. It involves three canvases where they empathized with users of roads to understand risks, ideated potential solutions, and developed product concepts aimed at improving safety. In the first canvas, they identified stakeholders like drivers, traffic police and activities like driving, parking that impact safety. The second canvas explored solutions like better signage and speed limits. Their final canvas focused on developing vehicle features using sensors and notifications to prevent accidents and alert authorities.
This document describes a project to design an LPG refrigerator. A group of mechanical engineering students submitted the project, guided by their professor. The document includes an abstract, introduction, working principle, components, specifications, cost sheet, results, advantages/disadvantages, applications, and conclusion. It finds that using LPG as the refrigerant can achieve a coefficient of performance of 2.25 and final evaporator temperature of -10°C, while eliminating issues with electricity availability. The system works by reducing the pressure and temperature of LPG in a capillary tube to produce cooling.
It is a technolgy by which we can produce cooling Effect Using MAgnets and Magnetic Materials......
For any other enquiry u can contact me on +919540278218....
and can join my Page www.facebook.com/engineeringindia
This document summarizes methods for setting out simple circular curves based on linear and angular methods. The linear methods discussed are by offsets from the long chord, successive bisection of arcs, offsets from tangents, and offsets from chords produced. The angular methods discussed are Rankine's method of tangential angles, the two theodolite method, and the tacheometric method. Each method is briefly described in one or two sentences.
This document discusses magnetic refrigeration, which provides cooling through the magnetocaloric effect. It begins by introducing magnetic refrigeration and the magnetocaloric effect. It then covers the basic principles and mechanism of magnetic refrigeration, including the thermodynamic cycle and components required. Potential magnetocaloric materials are discussed. Applications for magnetic refrigeration include household appliances, buildings, transportation, food storage, and electronics cooling. Benefits include higher efficiency and lower environmental impact compared to traditional refrigeration. Further research is still needed to improve temperature changes and develop stronger permanent magnets for widespread commercial use.
La Biotecnología - Felipe Rogers - 1° Medio B - Colegio Presidente AlessandriElPipe RogersXD
Este documento define y explica los diferentes tipos de biotecnología, incluyendo la biotecnología roja, blanca, verde y azul. La biotecnología roja se aplica a procesos médicos, la biotecnología blanca a procesos industriales, la biotecnología verde a procesos agrícolas, y la biotecnología azul al uso de organismos marinos. El documento proporciona ejemplos de cada tipo de biotecnología.
The document discusses the benefits of exercise for both physical and mental health. It notes that regular exercise can reduce the risk of diseases like heart disease and diabetes, improve mood, and reduce feelings of stress and anxiety. The document recommends that adults get at least 150 minutes of moderate exercise or 75 minutes of vigorous exercise per week to gain these benefits.
The 4-bit CPU was designed to execute 18 distinct operations from a lookup table. It was tested by executing an instruction set that performed operations like load, store, add, and jump instructions. The accumulator and program counter displays were observed after each instruction to verify the correct operations. Various components like a RAM, ALU, program counter, and decoders were used in the design. The group members demonstrated different parts of the instruction set to verify the CPU was functioning properly.
The document provides an introduction to microprocessors, including:
1. The basic components of a computer system including the CPU, memory, and input/output units.
2. The evolution of microprocessors from 4-bit to 64-bit sizes.
3. An overview of the internal structure of a microprocessor, including the arithmetic logic unit, control unit, register sets, accumulator, program counter, and condition code register.
4. A description of the bus system including the data bus, address bus, and control bus that allow communication between the microprocessor and other computer components.
The document provides an introduction to microprocessors, including:
- The basic components of a computer system using block diagrams including the CPU, memory, and input/output units.
- The evolution of microprocessors from 4 to 64 bytes.
- The internal structure and basic operation of a microprocessor including the arithmetic logic unit, control unit, register sets, accumulator, condition code register, program counter, and stack pointer.
- Examples of microprocessors such as the Intel 8085 and 8086.
The document provides an overview of computer organization and architecture. It discusses the basic components of a computer including the CPU, memory, and registers. It then describes the specific architecture of a basic computer model, including its instruction set, addressing modes, and register set. The basic computer uses a 16-bit word size and has instructions for memory access, register operations, and input/output. It connects its registers through a common 16-bit bus controlled by three lines.
The document discusses digital signal processors and digital signal controllers. It begins with an overview of microprocessors and microcontrollers before explaining that digital signal processors have additional hardware units that allow them to perform mathematical operations more efficiently compared to general purpose microprocessors. Digital signal controllers combine the computational power of a digital signal processor with integrated memory and peripherals on a single chip for embedded real-time control applications involving intensive math operations. Texas Instruments is a major manufacturer of digital signal processors and produces the C2000 family of digital signal controllers.
The document describes the design of an arithmetic logic unit (ALU) for an embedded system as a final project. Key details include:
1. The ALU is designed with a 5-stage pipeline and performs operations like addition, subtraction, logical operations, and multiplication on 16-bit operands from registers.
2. It includes modules for basic logic functions like AND, OR, XOR, and NOT as well as a carry look-ahead adder and multiplier.
3. The project is implemented in Verilog HDL with modules, registers, and always blocks to control the flow through each pipeline stage on each clock cycle.
The document describes the basic components and organization of a computer system called the Basic Computer. It has two main components - a processor and memory. The processor contains registers like the Program Counter, Accumulator, and others that are connected via a common bus. Memory contains 4096 16-bit words. Instructions are also 16 bits long and can specify direct or indirect addressing modes. The instructions include operations to perform logic and arithmetic on memory words and registers, as well as input/output and branching functions.
This presentation discusses an embedded system project to control a fan based on temperature. It includes:
- An overview of Skyphi Technologies, an organization that provides training in embedded systems and other domains.
- A definition of embedded systems and examples like ATMs, aircraft systems, and more.
- An introduction to the AVR microcontroller and its features like the ATmega8, programming tools, and pin diagram.
- Explanations of embedded C programming structure, I/O ports, registers, and programming the AVR microcontroller.
- Details of the temperature controlled fan project including components, working principle, circuit diagram, and code overview.
- Applications of the temperature controlled fan
This document provides an introduction to PIC microcontrollers, including:
- An overview of PIC architecture and why they are popular
- Differences between Harvard and Von Neumann architectures used in PICs
- Variations in core architectures, memory sizes, and instruction sets across the PIC family
- Details on the features, memory, peripherals, and instruction set of the PIC16F877A microcontroller
- Examples of common PIC applications like an LED flasher and button reader
The document describes the design of a basic computer. It includes:
- Hardware components such as a 4096x16 memory, nine registers including the accumulator and program counter, and seven flip-flops.
- An instruction set with memory reference instructions like LDA, STA, BUN, and ISZ for data transfers, program flow, and I/O.
- Registers like the program counter, data register, and accumulator that are used by instructions.
- Control logic gates that control components like registers and memory access based on the instruction and status.
- Interrupt handling that allows I/O without continuous CPU involvement through interrupt requests and a service routine.
Computer Organization : CPU, Memory and I/O organizationAmrutaMehata
This document provides information on CPU, memory, and I/O organization. It begins with an overview of the main components of a computer including the processor unit, memory unit, and input/output unit. It then describes the CPU in more detail including the arithmetic logic unit, control unit, and CPU block diagram. The document discusses the system bus and its various lines. It also covers CPU registers, instruction cycles, and status and control flags. The document provides an overview of instruction set architecture and compares RISC and CISC processor designs.
PIC 16F877 micro controller by Gaurav raikarGauravRaikar3
The document discusses configuring the on-chip analog to digital converter (ADC) on the PIC16F877 microcontroller. It first provides an overview of the PIC microcontroller family and key features of the PIC16F877. It then describes the ADC registers and conversion process, including configuring the ADC module, selecting the input channel, starting the conversion, and reading the result. It includes a diagram of the ADC conversion timing and flowchart of the conversion process. An example code for reading the ADC and printing the result is also provided.
8085 MICROPROCESSOR ARCHITECTURE AND ITS OPERATIONSRamaPrabha24
This document discusses the architecture and operations of microprocessors. It focuses on the Intel 8085 microprocessor. The 8085 architecture consists of a register array, ALU and logic group, instruction decoder and encoder, interrupt control group, and serial I/O control group. The register array contains general purpose registers, temporary registers, special purpose registers like the accumulator, flags register, and instruction register, and 16-bit registers like the program counter and stack pointer. The ALU performs arithmetic and logical operations. The instruction decoder decodes instructions and the timing and control circuitry manages the sequencing of operations. Microprocessor operations include memory reads/writes, I/O reads/writes using address, data and control buses, internal data operations
The document discusses computer organization and architecture. It covers topics related to basic processing units including fundamental concepts, register transfer, execution of instructions, and multiple bus organization. It also describes hardwired control, microprogrammed control, and microinstruction sequencing. Specifically, it explains how basic processing units work, the components of a CPU, register transfer, executing instructions via fetch-decode-execute cycles, and address generation techniques for microprogrammed control units.
The CPU is the central processing unit of a computer and consists of three main parts - the control unit, register set, and ALU. The control unit directs operations between the register set and ALU. The register set stores intermediate data and the ALU performs arithmetic and logic operations. The CPU follows a fetch-execute cycle where it fetches instructions from memory and stores them in the instruction register before executing them. Common instruction types include processor-memory operations, I/O operations, data processing, and control operations.
The document provides information about the 8085 microprocessor. It begins with definitions of key terms like microprocessor, CPU, ALU, and bus. It then discusses the evolution of microprocessors from early 4-bit models to later 8-bit, 12-bit, and 16-bit models like the Intel 8085. The document details the architecture of the 8085, including its pin descriptions and addressing modes. It categorizes the instruction set into groups for data transfer, arithmetic, logical, branch, and machine control operations. Memory-mapped I/O is also introduced.
1. The document discusses embedded systems and Microchip PIC microcontrollers. It describes what embedded systems are and provides examples of application areas.
2. It explains the differences between microprocessors and microcontrollers, and discusses the architecture and features of Microchip's PIC microcontrollers.
3. The document provides an overview of programming PIC microcontrollers, including the instruction set, device structure, and basic circuit requirements.
A microcontroller is a computer system on a single chip that contains a processor core, memory, and programmable input/output peripherals. Microcontrollers are commonly used to control objects, processes, or events. They are often embedded in devices to control their functions. A microcontroller contains a CPU, RAM, ROM, flash memory, I/O ports, an ADC, and timers. Common microcontrollers include the Intel 8051, Atmel ATmega 16, and PIC microcontrollers. The microcontroller reads programmed instructions from flash memory and executes them via the CPU to control its I/O pins based on inputs.
The document describes the basic components and instruction cycle of a simple computer called the Basic Computer. It consists of a processor and memory. The processor contains registers like the Program Counter, Instruction Register, and Accumulator. It has instructions to perform arithmetic, logic, data transfer, and input/output operations. An instruction cycle fetches an instruction from memory, decodes it, executes the appropriate operation, then fetches the next instruction. Memory-reference instructions read an operand from memory into the Data Register before executing.
The document describes the basic components and instruction cycle of a simple computer called the Basic Computer. It consists of a processor and memory. The processor contains registers like the Program Counter, Instruction Register, and Accumulator. It has instructions to perform arithmetic, logic, data transfer, and input/output operations. An instruction cycle fetches an instruction from memory, decodes it, executes the appropriate operation, then fetches the next instruction. Memory-reference instructions read an operand from memory into the Data Register before executing.
1. The University of Nottingham,
Malaysia Campus
Department of Electrical and Electronic Engineering
H64CSA - Hardware Accelerated Computing
Coursework-1B Report
Title: CPU Design
Submitted by:
Name: Osama Azim
Student Id: 023799
Date: 22nd
April '16
2. Coursework 1B - CPU Design
Index | H64CSA - Hardware Accelerated Computing Osama Azim
Contents
Index Title Pg.
1. Introduction 1
2. ISA Design 1
3. Micro-architecture Design 2
4. Implementation Model 4
5. Assembly Programs and Test Results 8
6. Discussion and Conclusion 14
-- Appendix - VHDL codes 15
1. Test Bench 15
2. Top Level 19
3. Control Unit 22
4. Instruction Register 25
5. Program Counter 26
6. PC register 28
7. PC increment 29
8. Logic Unit 30
9. A register 33
10. DCR 34
11. INC 35
12. SHL 35
13. cNOT 36
3. Coursework 1B - CPU Design
1 | H64CSA - Hardware Accelerated Computing Osama Azim
1. Introduction
A Central Processing Unit (CPU) usually comprises of instruction register (IR) and decoder, program controller (PC)
and control unit (CU) for its functioning and an arithmetic logic unit (ALU) executes, as per the programmed
instructions, various logical and math functions on the input data, thus providing a processed output.
The CPU designed for the following coursework has fixed length instructions similar to those of the 8-bit
microprocessors and executes logical operations on 8-bit input data. It consists of a 16 x 8 bit program memory
that can be loaded externally. The CPU design is implemented using VHDL and can be tested on a FPGA for further
development.
The top-level input/output ports of the CPU are shown in block diagram below:
2. ISA Design
The designed CPU has 8 instructions in total, with 4 logical operations and 4 data movement, jump and control
functions. The instruction set is listed in following table:
Instruction Encoding Operation Description
IN A 0011 xxxx A <-- Input Input to A register
OUT A 0100 xxxx Output <-- A Output from A register
DEC 0101 xxxx A == A - 1 Decrement A register
INC 0110 xxxx A == A + 1 Increment A register
JNZ <addr> 0111 aaaa If (A != 0) then PC = aaaa Jump to address if A is not zero
SHL 1000 xxxx A == Left shifted A Shift Left A register
NOT 1001 xxxx A == not A Compliment A
HALT 1111 xxxx Halt Halt execution
Where:
A = Accumulator, PC = Program Counter, aaaa = memory address, xx = don't cares
Diagram 1: CPU input/output ports
Clock
Input <7..0>
Reset
Output <7..0>
Halt
ROMaddress <3..0>
ROMwea
ROMdata <7..0>
4. Coursework 1B - CPU Design
2 | H64CSA - Hardware Accelerated Computing Osama Azim
The 4 data movement and program control instructions were designed as per the CPU architecture design, and are
minimum requirement for loading input port data, giving an output from A register and program control such as
loop and end cycle. The 3 logic operation instructions - DEC, INC and SHL were coursework requirements which
include NOT (or compliment) as an extra function for its simplicity and similarity to other logic functions such as
AND, OR and XOR that could be easily expanded in further development.
With 8 total instructions, the instruction length is chosen to be of 8-bit width. The 4 MSBs are selected as opcode,
since it can accommodate 24
or 16 instructions (for easy modification of > 8 instructions) and remaining 4 LSBs are
operand or address bits.
Figure 1: Instruction Set partitioning
It can be also noted that the ISA is of fixed length instructions, because of its design simplicity.
3. Micro-architecture Design
After the design of the ISA, a basic architecture for the processor was designed. An overview plan of all the
elements through which data would flow, the data-path design is shown in following figure. The elements in the
designed CPU are listed below:
Memory: 16 locations x 8 bits wide
Registers:
o Instruction Register (IR): 8 Bit
o Program Count Register (PC): 4 Bit
o A Register (Accumulator): 8 Bit
o Output Register: 8 Bit
Multiplexors:
o PC register source, JNZmux: 2 inputs
o A register source, INmux: 2 inputs
o Logic operation select, LUmux: 4 inputs
Logic Operations: 4 operations, 8 bit each
Data Width: 8 Bit
5. Coursework 1B - CPU Design
3 | H64CSA - Hardware Accelerated Computing Osama Azim
Figure 2: Datapath Design
The ROM is to be written by inputs ROMaddress, ROMdata and ROMwea (write enable), this is discussed in CPU
testing. Although not shown in datapath, the Input data flow along with Input mux (INmux), A register, Logic
operation blocks and output registers are collectively termed as Logic Unit (LU) block. Also, the LUmux selects no
operation when LUmux = "000", this allows for NULL operation.
Instruction Register:
The Instruction Register (IR) performs two operations:
1. Load the instruction from PC specified address location in the ROM
2. Separate the 4 bit opcode and 4 bit address contained in the MSB and LSB of instruction respectively
Control Unit:
The control unit (CU) is a critical component in a CPU; it selects the multiplexor inputs and decides which register
will be written every clock cycle, based on the operation being performed.
The CU provides its outputs as per following Control Output Table:
6. Coursework 1B - CPU Design
4 | H64CSA - Hardware Accelerated Computing Osama Azim
Control
Word
State,
Q3Q2Q1Q0
IRload PCload INmux Aload JNZmux Aread LUmux Halt
0 0000, Start 0 0 0 0 0 0 000 0
1 0001, Fetch 1 1 0 0 0 0 000 0
2 0010, Decode 0 0 0 0 0 0 000 0
3 0011, IN A 0 0 1 1 0 0 000 0
4 0100, OUT A 0 0 0 0 0 1 000 0
5 0101, DEC 0 0 0 1 0 0 001 0
6 0110, INC 0 0 0 1 0 0 010 0
7 0111, JNZ 0 0 0 0 If Aneq0=1 0 000 0
8 1000, SHL 0 0 0 1 0 0 011 0
9 1001, NOT 0 0 0 1 0 0 100 0
10 1111, HALT 0 0 0 0 0 0 000 1
The CU implements a state diagram which controls the CPU execution cycle. Each CU state has outputs as defined
in the control output table.
Start
0000
Fetch
0001
Decode
0010
Output
0100
DEC
0101 INC
0110
JNZ
0111
SHL
1000
NOT
1001
Input
0011
HALT
1111
IR = 0000 or 0001 or 0010
IR = 0011
IR = 0100
IR = 0101
IR = 0110 IR = 0111
IR = 1000
IR = 1001
IR = 1111
Diagram 2: CU State Diagram
7. Coursework 1B - CPU Design
5 | H64CSA - Hardware Accelerated Computing Osama Azim
With 4 bit state addressing, 24
or 16 states can be encoded. Hence, additional instruction states can be easily
expanded.
4. Implementation Model
The CPU design was implemented and tested using VHDL on Xilinx ISE. The implementation consisted of various
components as explained earlier, the Top Level code consists of all the component instantiation.
Figure 3: VHDL components
ROM 16x8 Bit: The Program ROM was implemented using Xilinx ISE built in IP cores, a dual port memory
was selected with following specification:
Figure 4: 16 x 8 ROM
8. Coursework 1B - CPU Design
6 | H64CSA - Hardware Accelerated Computing Osama Azim
For simplicity in implementation, minimum possible memory control signals were selected. Program writing is
performed by ROMaddress, ROMwea and ROMdata - which are CPU input ports.
Control Unit: The control unit implements the execution state diagram as described earlier. It also issues
register clear command based on reset signal. VHDL code for this component is straight forward
implementation of states and is included in the Appendix.
Instruction Register: This 8-bit register separates the opcode (4-bit MSB of Instruction) and address (4-bit
LSB of Instruction) using slices of the 8-bit Instruction. Implemented in VHDL as follows:
process(Clock, Load, Clear)
begin
if rising_edge(Clock) then -- reset register
if Clear = '1' then
iIR <= (others => '0');
elsif Load = '1' then -- load Instruction
iIR <= Din;
iAddressOut <= iIR(3 downto 0); -- 4-Bit LSB
iInstructionOut <= iIR(7 downto 4); -- 4-Bit MSB
end if;
end if;
end process;
Program Counter: The program counter combines the PC register and PC increment components. It also
implements the JNZ multiplexer using following concurrent code:
iAddressIn <= AddressIn when JNZmux = '1' else -- Address from IR
iPCincr; -- Address from 4-bit increment
The PC register has similar 4-bit implementation as the Instruction Register. The PC increment component
adds upon the current address using VHDL as follows:
Process (Clock)
begin
if rising_edge(Clock) then
if Clear = '1' then
PCincrOut <= (others => '0'); -- clear address
else
PCincrOut <= PCincrIn + '1'; -- increment address
end if;
end if;
end process;
9. Coursework 1B - CPU Design
7 | H64CSA - Hardware Accelerated Computing Osama Azim
Logic Unit: The logic unit acts as top-level for the accumulator and various logical function blocks, it also
incorporates the INmux and LUmux multiplexors. The Aneq0 signal is provided by logical OR operation on
accumulator output bits. An output 8-bit buffer loads the accumulator output contents when OUT
instruction is executed. The 8-bit A register acts as an accumulator and is implemented in VHDL similar to
the instruction register code described earlier.
The various logical operations are performed in their respective blocks, and the output is selected
using the 4 to 1 LUmux multiplexor.
o DCR: Executes the decrement operation by subtraction of input bits. In VHDL:
Process (Clock)
begin
if rising_edge(Clock) then
Dout <= Din - '1';
end if;
end process;
o INC: Executes the increment operation by addition of 1 at each clock cycle, VHDL code is similar to
DEC.
o SHL: Executes the binary shift left operation by logical manipulation, In VHDL:
process (Clock)
begin
iShiftReg <= Din; -- load input to shift register
if rising_edge(Clock) then
iShiftReg(7 downto 1) <= iShiftReg(6 downto 0);
iShiftReg(0) <= '0'; -- '0' loaded at right of bit stream
end if;
end process;
o NOT: Provides a compliment output to A register bits, implemented using concurrent logical not
operations in VHDL:
begin
Dout(7) <= NOT Din(7);
Dout(6) <= NOT Din(6);
Dout(5) <= NOT Din(5);
Dout(4) <= NOT Din(4);
Dout(3) <= NOT Din(3);
Dout(2) <= NOT Din(2);
Dout(1) <= NOT Din(1);
Dout(0) <= NOT Din(0);
10. Coursework 1B - CPU Design
8 | H64CSA - Hardware Accelerated Computing Osama Azim
5. Assembly Programs and Test Results
The VHDL implementation of CPU was tested using the Xilinx Test Bench. Appropriate programs were loaded into
the program ROM and test input was provided.
A clock period of 20ns (50 MHz) was selected for testing. In VHDL:
constant period : time := 20ns;
-- Clock ------------------------------------
process
begin
tb_Clock <= '0';
wait for period/2;
tb_Clock <= '1';
wait for period/2;
end process;
To write to the dual port ROM, following VHDL test bench was written:
-- control signals --------------------
process
begin
tb_Reset <= '1';
tb_ROMwea <= '1';
wait for 8*period;
tb_Reset <= '0'; -- CPU is reset until Program is loaded
tb_ROMwea <= '0';
wait;
end process;
-- Assembly program load --------------------
process
begin
-- Program for decrement
wait for period/2;
tb_ROMaddr <= "0000"; tb_ROMdata <= "00110000"; -- IN A
wait for period;
tb_ROMaddr <= "0001"; tb_ROMdata <= "01010000"; -- DEC
wait for period;
tb_ROMaddr <= "0010"; tb_ROMdata <= "01000000"; -- OUT
wait for period;
tb_ROMaddr <= "0011"; tb_ROMdata <= "01110001"; -- JNZ Addr (0001)
wait for period;
tb_ROMaddr <= "0100"; tb_ROMdata <= "00000000"; -- NULL
wait for period;
tb_ROMaddr <= "0101"; tb_ROMdata <= "00000000"; -- NULL
wait for period;
11. Coursework 1B - CPU Design
9 | H64CSA - Hardware Accelerated Computing Osama Azim
tb_ROMaddr <= "0110"; tb_ROMdata <= "11111111"; -- HALT
wait;
end process;
Logic Input was provided using test bench as follows:
-- Logic Input --------------------
process
begin
wait for 4*period;
tb_Input <= "00000011";
wait;
end process;
The Program load onto ROM performed using test bench can be viewed in following screen shot:
Figure 5: ROM program load
The CPU execution states can be seen here:
Figure 6: CPU execution states
12. Coursework 1B - CPU Design
10 | H64CSA - Hardware Accelerated Computing Osama Azim
Program for Decrement from <Input> to 0:
In Assembly:
IN A -- input to A register
loop: DEC -- decrement from A register
OUT -- output A register content
JNZ loop -- return to loop if A register is not zero
NULL -- do nothing, delay
NULL -- do nothing, delay
HALT -- Halt if A register is zero
In Binary:
0000: 00110000;
0001: 01010000;
0010: 01000000;
0011: 01110001;
0100: 00000000;
0101: 00000000;
0110: 11111111;
Program for Increment from <Input> to FF, then 0:
In Assembly:
IN A -- input to A register
loop: INC -- Increment from A register
OUT -- output A register content
JNZ loop -- return to loop if A register is not zero
NULL -- do nothing, delay
NULL -- do nothing, delay
HALT -- Halt if A register is zero
In Binary:
0000: 00110000;
0001: 01100000;
0010: 01000000;
0011: 01110001;
0100: 00000000;
0101: 00000000;
0110: 11111111;
Program for Shift Left:
In Assembly:
IN A -- input to A register
SHL -- Shift left A register contents
OUT -- output A register content
NULL -- do nothing, delay
NULL -- do nothing, delay
HALT -- Halt if A register is zero
13. Coursework 1B - CPU Design
11 | H64CSA - Hardware Accelerated Computing Osama Azim
In Binary:
0000: 00110000;
0001: 10000000;
0010: 01000000;
0100: 00000000;
0101: 00000000;
0110: 11111111;
Program for Logic Compliment:
In Assembly:
IN A -- input to A register
NOT -- Compliment A register
OUT -- output A register content
NULL -- do nothing, delay
NULL -- do nothing, delay
HALT -- Halt if A register is zero
In Binary:
0000: 00110000;
0001: 10010000;
0010: 01000000;
0100: 00000000;
0101: 00000000;
0110: 11111111;
Simulation Results:
Decrement from 3 to 0 (to view IR opcode at InstructionIn):
Figure 7: 8-bit decrement from 3 to 0
14. Coursework 1B - CPU Design
12 | H64CSA - Hardware Accelerated Computing Osama Azim
Decrement from 7 to 0:
Figure 8: 8-bit decrement from 7 to 0
8 bit Increment :
Figure 9: 8-bit Increment
Although not shown in test bench, the Increment operation can go until 0xFF and then stop at the
consecutive 0x00.
Logical Shift Left :
16. Coursework 1B - CPU Design
14 | H64CSA - Hardware Accelerated Computing Osama Azim
6. Discussion and Conclusion
An 8-bit CPU was designed and simulated using VHDL. Although limited number of instructions were implemented,
expanding on the instruction set would be relatively easier than designing a new CPU architecture. Various
limitations and further improvement scope of this CPU are:
The instruction set is largely designed without operands, and only JNZ instruction utilizes the 4-bit LSB of
instruction. Encoding operands and other functions into the instruction would require a more elaborate
instruction decoder and complex control unit.
The execution cycle of JNZ instruction could not be implemented perfectly, and hence at-least one NULL
operations is required after JNZ in program. This allows the consecutive address to be loaded correctly into
the Program Counter.
Further implementation of shift and rotate operations would be similar in design as that of the SHL
instruction. The same applies for implementation of logical operations such as AND, XOR, which can be
implemented similar to the NOT operation.
The VHDL code developed would require further effective design, especially concerning actions that are
clock edge triggered, for hardware implementation.
17. Coursework 1B - CPU Design
15 | H64CSA - Hardware Accelerated Computing Osama Azim
Appendix - VHDL codes
1. Test Bench:
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE ieee.std_logic_unsigned.all;
USE ieee.numeric_std.ALL;
ENTITY tb_TopLevel IS
END tb_TopLevel;
ARCHITECTURE behavior OF tb_TopLevel IS
-- Component Declaration for the Unit Under Test (UUT)
COMPONENT TopLevel
PORT(
Input : IN std_logic_vector(7 downto 0);
Clock : IN std_logic;
Reset : IN std_logic;
ROMaddr : IN std_logic_vector(3 downto 0);
ROMwea : IN std_logic;
ROMdata : IN std_logic_vector(7 downto 0);
Output : OUT std_logic_vector(7 downto 0);
Halt : OUT std_logic
);
END COMPONENT;
--Inputs
signal tb_Input : std_logic_vector(7 downto 0) := (others => '0');
signal tb_Clock : std_logic := '0';
signal tb_Reset : std_logic := '0';
signal tb_ROMaddr : std_logic_vector(3 downto 0) := (others => '0');
signal tb_ROMwea : std_logic := '0';
signal tb_ROMdata : std_logic_vector(7 downto 0) := (others => '0');
--Outputs
signal tb_Output : std_logic_vector(7 downto 0);
signal tb_Halt : std_logic;
constant period : time := 20ns;
BEGIN
-- Instantiate the Unit Under Test (UUT)
uut: TopLevel PORT MAP (
Input => tb_Input,
18. Coursework 1B - CPU Design
16 | H64CSA - Hardware Accelerated Computing Osama Azim
Clock => tb_Clock,
Reset => tb_Reset,
ROMaddr => tb_ROMaddr,
ROMwea => tb_ROMwea,
ROMdata => tb_ROMdata,
Output => tb_Output,
Halt => tb_Halt
);
-- Clock ------------------------------------
process
begin
tb_Clock <= '0';
wait for period/2;
tb_Clock <= '1';
wait for period/2;
end process;
-- control signals --------------------
process
begin
tb_Reset <= '1';
tb_ROMwea <= '1';
wait for 8*period;
tb_Reset <= '0'; -- CPU is reset until Program is loaded
tb_ROMwea <= '0';
wait;
end process;
-- Assembly program load --------------------
process
begin
-- Program for decrement ------------------------
-- wait for period/2;
-- tb_ROMaddr <= "0000"; tb_ROMdata <= "00110000"; -- IN A
-- wait for period;
-- tb_ROMaddr <= "0001"; tb_ROMdata <= "01010000"; -- DEC
-- wait for period;
-- tb_ROMaddr <= "0010"; tb_ROMdata <= "01000000"; -- OUT
-- wait for period;
19. Coursework 1B - CPU Design
17 | H64CSA - Hardware Accelerated Computing Osama Azim
-- tb_ROMaddr <= "0011"; tb_ROMdata <= "01110001"; -- JNZ Addr (0001)
-- wait for period;
-- tb_ROMaddr <= "0100"; tb_ROMdata <= "00000000"; -- NULL
-- wait for period;
-- tb_ROMaddr <= "0101"; tb_ROMdata <= "00000000"; -- NULL
-- wait for period;
-- tb_ROMaddr <= "0110"; tb_ROMdata <= "11111111"; -- HALT
-- wait;
-- end process;
-- Program for Increment-------------------------
wait for period/2;
tb_ROMaddr <= "0000"; tb_ROMdata <= "00110000"; -- IN A
wait for period;
tb_ROMaddr <= "0001"; tb_ROMdata <= "01100000"; -- INC
wait for period;
tb_ROMaddr <= "0010"; tb_ROMdata <= "01000000"; -- OUT
wait for period;
tb_ROMaddr <= "0011"; tb_ROMdata <= "01110001"; -- JNZ Addr (0001)
wait for period;
tb_ROMaddr <= "0100"; tb_ROMdata <= "00000000"; -- NULL
wait for period;
tb_ROMaddr <= "0101"; tb_ROMdata <= "00000000"; -- NULL
wait for period;
tb_ROMaddr <= "0110"; tb_ROMdata <= "11111111"; -- HALT
wait;
end process;
-- Program for Shift Left------------------------------
-- wait for period/2;
-- tb_ROMaddr <= "0000"; tb_ROMdata <= "00110000"; -- IN A
-- wait for period;
-- tb_ROMaddr <= "0001"; tb_ROMdata <= "10000000"; -- SHL
-- wait for period;
-- tb_ROMaddr <= "0010"; tb_ROMdata <= "01000000"; -- OUT
-- wait for period;
-- tb_ROMaddr <= "0100"; tb_ROMdata <= "00000000"; -- NULL
-- wait for period;
-- tb_ROMaddr <= "0101"; tb_ROMdata <= "00000000"; -- NULL
-- wait for period;
-- tb_ROMaddr <= "0110"; tb_ROMdata <= "11111111"; -- HALT
-- wait;
-- end process;
-- Program for Logical Compliment--------------------------
20. Coursework 1B - CPU Design
18 | H64CSA - Hardware Accelerated Computing Osama Azim
-- wait for period/2;
-- tb_ROMaddr <= "0000"; tb_ROMdata <= "00110000"; -- IN A
-- wait for period;
-- tb_ROMaddr <= "0001"; tb_ROMdata <= "10010000"; -- NOT
-- wait for period;
-- tb_ROMaddr <= "0010"; tb_ROMdata <= "01000000"; -- OUT
-- wait for period;
-- tb_ROMaddr <= "0100"; tb_ROMdata <= "00000000"; -- NULL
-- wait for period;
-- tb_ROMaddr <= "0101"; tb_ROMdata <= "00000000"; -- NULL
-- wait for period;
-- tb_ROMaddr <= "0110"; tb_ROMdata <= "11111111"; -- HALT
-- wait;
-- end process;
-- Logic Input ----------------------------------
process
begin
-- for decrement from 7 to 0--------------------
-- wait for 4*period;
-- tb_Input <= "00000111";
-- wait;
-- end process;
-- for decrement from 3 to 0--------------------
-- wait for 4*period;
-- tb_Input <= "00000011";
-- wait;
-- end process;
-- for Incremet from 0 to FF--------------------
wait for 4*period;
tb_Input <= "00000000";
wait;
end process;
END;
21. Coursework 1B - CPU Design
19 | H64CSA - Hardware Accelerated Computing Osama Azim
2. Top Level:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity TopLevel is
port (
Input: in std_logic_vector (7 downto 0);
Clock: in std_logic;
Reset: in std_logic;
ROMaddr: in std_logic_vector (3 downto 0);
ROMwea: in std_logic;
ROMdata: in std_logic_vector (7 downto 0);
Output: out std_logic_vector (7 downto 0);
Halt: out std_logic
);
end TopLevel;
architecture Behavioral of TopLevel is
component ControlUnit
port(
Clock : in STD_LOGIC;
GReset : in STD_LOGIC;
Aneq0 : in STD_LOGIC;
InstructionIn : in STD_LOGIC_VECTOR (3 downto 0);
Reset : out STD_LOGIC;
Halt : out STD_LOGIC;
IRload : out STD_LOGIC;
JNZmux : out STD_LOGIC;
PCload : out STD_LOGIC;
INmux : out STD_LOGIC;
Aload : out STD_LOGIC;
Aread : out STD_LOGIC;
LUmux : out STD_LOGIC_VECTOR (2 downto 0)
);
end component;
component InstructionRegister
port(
Clock : in STD_LOGIC;
Load : in STD_LOGIC;
Clear : in STD_LOGIC;
Din : in STD_LOGIC_VECTOR (7 downto 0);
22. Coursework 1B - CPU Design
20 | H64CSA - Hardware Accelerated Computing Osama Azim
InstructionOut : out STD_LOGIC_VECTOR (3 downto 0);
AddressOut : out STD_LOGIC_VECTOR (3 downto 0)
);
end component;
component ProgramCounter
port(
Clock : in STD_LOGIC;
Load : in STD_LOGIC;
Clear : in STD_LOGIC;
JNZmux : in STD_LOGIC;
AddressIn : in STD_LOGIC_VECTOR (3 downto 0);
PCaddress : out STD_LOGIC_VECTOR (3 downto 0)
);
end component;
component LogicUnit
port(
Clock : in STD_LOGIC;
Load : in STD_LOGIC;
ARead : in STD_LOGIC;
Clear : in STD_LOGIC;
INmux : in STD_LOGIC;
LUmux : in STD_LOGIC_VECTOR (2 downto 0);
Input : in STD_LOGIC_VECTOR (7 downto 0);
Aneq0 : out STD_LOGIC;
Output : out STD_LOGIC_VECTOR (7 downto 0)
);
end component;
component ROM_16x8
port (
addra: IN std_logic_VECTOR(3 downto 0);
addrb: IN std_logic_VECTOR(3 downto 0);
clka: IN std_logic;
clkb: IN std_logic;
dina: IN std_logic_VECTOR(7 downto 0);
doutb: OUT std_logic_VECTOR(7 downto 0);
wea: IN std_logic);
end component;
signal iAneq0, iIRload, iPCload, iINmux, iJNZmux, iAload, iAread, iReset: std_logic := '0';
signal iInstruction: std_logic_VECTOR(3 downto 0) := (others=>'0');
signal iAddress: std_logic_VECTOR(3 downto 0) := (others=>'0');
signal iPCaddress: std_logic_VECTOR(3 downto 0) := (others=>'0');
signal iLUmux: std_logic_VECTOR(2 downto 0) := (others=>'0');
signal iData: std_logic_VECTOR(7 downto 0) := (others=>'0');
begin
U1: ControlUnit
24. Coursework 1B - CPU Design
22 | H64CSA - Hardware Accelerated Computing Osama Azim
addra => ROMaddr,
addrb => iPCaddress,
clka => clock,
clkb => clock,
dina => ROMdata,
doutb => iData,
wea => ROMwea
);
end Behavioral;
3. Control Unit:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity ControlUnit is
port(
Clock : in STD_LOGIC;
GReset : in STD_LOGIC;
Aneq0 : in STD_LOGIC;
InstructionIn : in STD_LOGIC_VECTOR (3 downto 0);
Reset : out STD_LOGIC;
Halt : out STD_LOGIC;
IRload : out STD_LOGIC;
JNZmux : out STD_LOGIC;
PCload : out STD_LOGIC;
INmux : out STD_LOGIC;
Aload : out STD_LOGIC;
Aread : out STD_LOGIC;
LUmux : out STD_LOGIC_VECTOR (2 downto 0)
);
end ControlUnit;
architecture Behavioral of ControlUnit is
type state_type is ( s_start, s_fetch, s_decode,
s_input, s_output, s_dec, s_inc, s_jnz, s_shl,
s_not,
s_halt
);
signal pres_state, next_state: state_type;
signal iReset, iIRload, iJNZmux, iPCload, iINmux, iAload, iAread, iHalt : std_logic :='0';
signal iLUmux: std_logic_vector (2 downto 0) := (others => '0');
begin
process (Clock, GReset) -- state machine increment and reset process
25. Coursework 1B - CPU Design
23 | H64CSA - Hardware Accelerated Computing Osama Azim
begin
iReset <= GReset;
if rising_edge(Clock) then
if iReset = '1' then -- global reset
-- clear all registers
pres_state <= s_start; -- start of state machine
elsif iReset = '0' then
pres_state <= next_state; -- state change
end if;
end if;
end process;
process (pres_state, Clock)
begin
case pres_state is
when s_start =>
if iReset = '1' then
iIRload <= '0'; iJNZmux <= '0'; iPCload <= '0'; -- reset all control outputs
iINmux <= '0'; iAload <= '0'; iAread <= '0'; iLUmux <= (others => '0');
next_state <= s_start;
else
iIRload <= '0'; iPCload <= '0'; -- reset all control outputs
iINmux <= '0'; iAload <= '0'; iAread <= '0'; iLUmux <= (others => '0');
-- iJNZmux <= '0';
next_state <= s_fetch;
end if;
when s_fetch =>
iIRload <= '1'; iPCload <= '1';
iINmux <= '0'; iAload <= '0'; iAread <= '0'; iLUmux <= (others => '0');
-- iJNZmux <= '0';
next_state <= s_decode;
when s_decode =>
if InstructionIn = "0000" then -- return to s_start
next_state <= s_start;
elsif InstructionIn = "0001" then
next_state <= s_start;
elsif InstructionIn = "0010" then
next_state <= s_start;
elsif InstructionIn = "0011" then
next_state <= s_input;
26. Coursework 1B - CPU Design
24 | H64CSA - Hardware Accelerated Computing Osama Azim
elsif InstructionIn = "0100" then
next_state <= s_output;
elsif InstructionIn = "0101" then
next_state <= s_dec;
elsif InstructionIn = "0110" then
next_state <= s_inc;
elsif InstructionIn = "0111" then
next_state <= s_jnz;
elsif InstructionIn = "1000" then
next_state <= s_shl;
elsif InstructionIn = "1001" then
next_state <= s_not;
elsif InstructionIn = "1111" then
next_state <= s_halt;
end if;
iIRload <= '0'; iJNZmux <= '0'; iPCload <= '0'; -- reset all control outputs
iINmux <= '0'; iAload <= '0'; iAread <= '0'; iLUmux <= (others => '0');
when s_input =>
iINmux <= '1'; -- as per control output table
iAload <= '1';
next_state <= s_start; -- return to start state
when s_output =>
iAread <= '1'; -- as per control output table
next_state <= s_start; -- return to start state
when s_dec =>
iAload <= '1'; -- as per control output table
iLUmux <= "001";
next_state <= s_start; -- return to start state
when s_inc =>
iAload <= '1'; -- as per control output table
iLUmux <= "010";
next_state <= s_start; -- return to start state
when s_jnz =>
if Aneq0 = '1' then
iJNZmux <= '1'; -- as per control output table
next_state <= s_start; -- return to start state
else
iJNZmux <= '0';
next_state <= s_start; -- return to start state
end if;
when s_shl =>
iAload <= '1'; -- as per control output table
iLUmux <= "011";
next_state <= s_start; -- return to start state
27. Coursework 1B - CPU Design
25 | H64CSA - Hardware Accelerated Computing Osama Azim
when s_not =>
iAload <= '1'; -- as per control output table
iLUmux <= "100";
next_state <= s_start; -- return to start state
when s_halt =>
iHalt <= '1'; -- as per control output table
end case;
end process;
Reset <= iReset;
Halt <= iHalt;
IRload <= iIRload;
JNZmux <= iJNZmux;
PCload <= iPCload;
INmux <= iINmux;
Aload <= iAload;
Aread <= iAread;
LUmux <= iLUmux;
end Behavioral;
4. Instruction Register:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity InstructionRegister is
port(
Clock : in STD_LOGIC;
Load : in STD_LOGIC;
Clear : in STD_LOGIC;
Din : in STD_LOGIC_VECTOR (7 downto 0);
InstructionOut : out STD_LOGIC_VECTOR (3 downto 0);
AddressOut : out STD_LOGIC_VECTOR (3 downto 0)
);
end InstructionRegister;
architecture Behavioral of InstructionRegister is
28. Coursework 1B - CPU Design
26 | H64CSA - Hardware Accelerated Computing Osama Azim
signal iInstructionOut, iAddressOut: STD_LOGIC_VECTOR (3 downto 0) := (others =>
'0');
signal iIR: STD_LOGIC_VECTOR (7 downto 0) := (others => '0');
begin
process(Clock, Load, Clear)
begin
if rising_edge(Clock) then
if Clear = '1' then -- reset register
iIR <= (others => '0');
elsif Load = '1' then -- load Instruction
iIR <= Din;
iAddressOut <= iIR(3 downto 0); -- 4-Bit LSB
iInstructionOut <= iIR(7 downto 4); -- 4-Bit MSB
end if;
end if;
end process;
AddressOut <= iAddressOut;
InstructionOut <= iInstructionOut;
end Behavioral;
5. Program Counter:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity ProgramCounter is
port(
Clock : in STD_LOGIC;
Load : in STD_LOGIC;
Clear : in STD_LOGIC;
JNZmux : in STD_LOGIC;
AddressIn : in STD_LOGIC_VECTOR (3 downto 0);
PCaddress : out STD_LOGIC_VECTOR (3 downto 0)
);
29. Coursework 1B - CPU Design
27 | H64CSA - Hardware Accelerated Computing Osama Azim
end ProgramCounter;
architecture Behavioral of ProgramCounter is
component PCregister
port(
Clock : in STD_LOGIC;
Load : in STD_LOGIC;
Clear : in STD_LOGIC;
PCregIn : in STD_LOGIC_VECTOR (3 downto 0);
PCregOut : out STD_LOGIC_VECTOR (3 downto 0)
);
end component;
component PCincrement
port(
Clock : in STD_LOGIC;
Clear : in STD_LOGIC;
PCincrIn : in STD_LOGIC_VECTOR (3 downto 0);
PCincrOut : out STD_LOGIC_VECTOR (3 downto 0)
);
end component;
signal iAddressIn, iPCaddress, iPCincr: std_logic_vector(3 downto 0) := (others
=> '0');
begin
U1: PCregister
port map(
Clock => Clock,
Load => Load,
Clear => Clear,
PCregIn => iAddressIn,
PCregOut => iPCaddress
);
U2: PCincrement
port map(
Clock => Clock,
Clear => Clear,
PCincrIn => iPCaddress,
PCincrOut => iPCincr
);
PCaddress <= iPCaddress;
-- JNZ multiplexer ---------------
iAddressIn <= AddressIn when JNZmux = '1' else -- Address from IR
30. Coursework 1B - CPU Design
28 | H64CSA - Hardware Accelerated Computing Osama Azim
iPCincr; -- Address from 4-bit increment
-- process (clock)
-- begin
-- if rising_edge(clock) then
-- if JNZmux = '1' then
-- iAddressIn <= AddressIn;
-- else
-- iAddressIn <= iPCincr;
-- end if;
-- end if;
-- end process;
end Behavioral;
6. PCregister:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity PCregister is
port(
Clock : in STD_LOGIC;
Load : in STD_LOGIC;
Clear : in STD_LOGIC;
PCregIn : in STD_LOGIC_VECTOR (3 downto 0);
PCregOut : out STD_LOGIC_VECTOR (3 downto 0)
);
end PCregister;
architecture Behavioral of PCregister is
signal iPCregister: STD_LOGIC_VECTOR (3 downto 0) := (others => '0');
begin
process(Clock, Load, Clear)
begin
if rising_edge(Clock) then
if Clear = '1' then
31. Coursework 1B - CPU Design
29 | H64CSA - Hardware Accelerated Computing Osama Azim
iPCregister <= (others => '0');
elsif Load = '1' then
iPCregister <= PCregIn;
end if;
end if;
end process;
PCregOut <= iPCregister;
end Behavioral;
7. PCincrement:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity PCincrement is
port(
Clock : in STD_LOGIC;
Clear : in STD_LOGIC;
PCincrIn : in STD_LOGIC_VECTOR (3 downto 0);
PCincrOut : out STD_LOGIC_VECTOR (3 downto 0)
);
end PCincrement;
architecture Behavioral of PCincrement is
begin
Process (Clock)
begin
if rising_edge(Clock) then
if Clear = '1' then
PCincrOut <= (others => '0'); -- clear address
else
PCincrOut <= PCincrIn + '1'; -- increment address
end if;
32. Coursework 1B - CPU Design
30 | H64CSA - Hardware Accelerated Computing Osama Azim
end if;
end process;
end Behavioral;
8. LogicUnit:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity LogicUnit is
port(
Clock : in STD_LOGIC;
Load : in STD_LOGIC;
ARead : in STD_LOGIC;
Clear : in STD_LOGIC;
INmux : in STD_LOGIC;
LUmux : in STD_LOGIC_VECTOR (2 downto 0);
Input : in STD_LOGIC_VECTOR (7 downto 0);
Aneq0 : out STD_LOGIC;
Output : out STD_LOGIC_VECTOR (7 downto 0)
);
end LogicUnit;
architecture Behavioral of LogicUnit is
component Aregister
port(
Clock : in STD_LOGIC;
Load : in STD_LOGIC;
Clear : in STD_LOGIC;
Din : in STD_LOGIC_VECTOR (7 downto 0);
Aout : out STD_LOGIC_VECTOR (7 downto 0)
);
end component;
component DCR
port(
Clock : in STD_LOGIC;
33. Coursework 1B - CPU Design
31 | H64CSA - Hardware Accelerated Computing Osama Azim
Din : in STD_LOGIC_VECTOR (7 downto 0);
Dout : out STD_LOGIC_VECTOR (7 downto 0)
);
end component;
component INC
port(
Clock : in STD_LOGIC;
Din : in STD_LOGIC_VECTOR (7 downto 0);
Dout : out STD_LOGIC_VECTOR (7 downto 0)
);
end component;
component SHL
port(
Clock : in STD_LOGIC;
Din : in STD_LOGIC_VECTOR (7 downto 0);
Dout : out STD_LOGIC_VECTOR (7 downto 0)
);
end component;
component cNOT
port(
Clock : in STD_LOGIC;
Din : in STD_LOGIC_VECTOR (7 downto 0);
Dout : out STD_LOGIC_VECTOR (7 downto 0)
);
end component;
signal iData, iAreg, iDataMod, iDataDCR, iDataINC, iDataSHL, iDataNOT, iOutput:
std_logic_VECTOR(7 downto 0) := (others=>'0');
begin
U1: Aregister
port map(
Clock => Clock,
Clear => Clear,
Load => Load,
Din => iData,
Aout => iAreg
);
U2: DCR
port map(
Clock => Clock,
Din => iAreg,
Dout => iDataDCR
34. Coursework 1B - CPU Design
32 | H64CSA - Hardware Accelerated Computing Osama Azim
);
U3: INC
port map(
Clock => Clock,
Din => iAreg,
Dout => iDataINC
);
U4: SHL
port map(
Clock => Clock,
Din => iAreg,
Dout => iDataSHL
);
U5: cNOT
port map(
Clock => Clock,
Din => iAreg,
Dout => iDataNOT
);
-- INmux ---------------------
iData <= Input when INmux = '1' else
iDataMod;
-- LUmux ---------------------
iDataMod <= iDataDCR when LUmux = "001" else
iDataINC when LUmux = "010" else
iDataSHL when LUmux = "011" else
iDataNOT when LUmux = "100";
-- Aneq0 signal ---------------
Aneq0 <= iAreg(7) or iAreg(6) or iAreg(5) or iAreg(4) or iAreg(3) or
iAreg(2) or iAreg(1) or iAreg(0);
-- Aneq0 <= iData(7) or iData(6) or iData(5) or iData(4) or iData(3) or
iData(2) or iData(1) or iData(0);
-- Output register -----------
Process (clock)
begin
if rising_edge(clock) then
if Clear = '1' then
35. Coursework 1B - CPU Design
33 | H64CSA - Hardware Accelerated Computing Osama Azim
iOutput <= (others=>'0');
elsif ARead = '1' then
iOutput <= iAreg;
end if;
end if;
end process;
Output <= iOutput;
--------------------------------
end Behavioral;
9. Aregister:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity Aregister is
port(
Clock : in STD_LOGIC;
Load : in STD_LOGIC;
Clear : in STD_LOGIC;
Din : in STD_LOGIC_VECTOR (7 downto 0);
Aout : out STD_LOGIC_VECTOR (7 downto 0)
);
end Aregister;
architecture Behavioral of Aregister is
signal iAregister: STD_LOGIC_VECTOR (7 downto 0) := (others => '0');
begin
process(Clock, Load, Clear)
begin
if rising_edge(Clock) then
if Clear = '1' then
iAregister <= (others => '0');
36. Coursework 1B - CPU Design
34 | H64CSA - Hardware Accelerated Computing Osama Azim
elsif Load = '1' then
iAregister <= Din;
end if;
end if;
end process;
Aout <= iAregister;
end Behavioral;
10. DCR:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity DCR is
port(
Clock : in STD_LOGIC;
Din : in STD_LOGIC_VECTOR (7 downto 0);
Dout : out STD_LOGIC_VECTOR (7 downto 0)
);
end DCR;
architecture Behavioral of DCR is
begin
Process (Clock)
begin
if rising_edge(Clock) then
Dout <= Din - '1';
end if;
end process;
end Behavioral;
37. Coursework 1B - CPU Design
35 | H64CSA - Hardware Accelerated Computing Osama Azim
11. INC:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity INC is
port(
Clock : in STD_LOGIC;
Din : in STD_LOGIC_VECTOR (7 downto 0);
Dout : out STD_LOGIC_VECTOR (7 downto 0)
);
end INC;
architecture Behavioral of INC is
begin
Process (Clock)
begin
if rising_edge(Clock) then
Dout <= Din + '1';
end if;
end process;
end Behavioral;
12. SHL:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
38. Coursework 1B - CPU Design
36 | H64CSA - Hardware Accelerated Computing Osama Azim
--library UNISIM;
--use UNISIM.VComponents.all;
entity SHL is
port(
Clock : in STD_LOGIC;
Din : in STD_LOGIC_VECTOR (7 downto 0);
Dout : out STD_LOGIC_VECTOR (7 downto 0)
);
end SHL;
architecture Behavioral of SHL is
signal iShiftReg: std_logic_vector (7 downto 0) := (others => '0');
begin
process (Clock)
begin
iShiftReg <= Din;
if rising_edge(Clock) then
iShiftReg(7 downto 1) <= iShiftReg(6 downto 0);
iShiftReg(0) <= '0';
end if;
end process;
Dout <= iShiftReg;
end Behavioral;
13. cNOT:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity cNOT is
port(
39. Coursework 1B - CPU Design
37 | H64CSA - Hardware Accelerated Computing Osama Azim
Clock : in STD_LOGIC;
Din : in STD_LOGIC_VECTOR (7 downto 0);
Dout : out STD_LOGIC_VECTOR (7 downto 0)
);
end cNOT;
architecture Behavioral of cNOT is
begin
Dout(7) <= NOT Din(7);
Dout(6) <= NOT Din(6);
Dout(5) <= NOT Din(5);
Dout(4) <= NOT Din(4);
Dout(3) <= NOT Din(3);
Dout(2) <= NOT Din(2);
Dout(1) <= NOT Din(1);
Dout(0) <= NOT Din(0);
end Behavioral;