当前位置:文档之家› 8位超精简CPU设计参考Lattice mico8

8位超精简CPU设计参考Lattice mico8

8位超精简CPU设计参考Lattice mico8
8位超精简CPU设计参考Lattice mico8

LatticeMico8 Processor Reference Manual

December 2012

Copyright

Copyright ? 2012 Lattice Semiconductor Corporation.

This document may not, in whole or part, be copied, photocopied, reproduced, translated, or reduced to any electronic medium or machine-readable form without prior written consent from Lattice Semiconductor Corporation.

Trademarks

Lattice Semiconductor Corporation, L Lattice Semiconductor Corporation (logo), L (stylized), L (design), Lattice (design), LSC, CleanClock, Custom Movile Device, DiePlus, E2CMOS, Extreme Performance, FlashBAK, FlexiClock, flexiFLASH, flexiMAC, flexiPCS, FreedomChip, GAL, GDX, Generic Array Logic, HDL Explorer, iCE Dice, iCE40, iCE65, iCEblink, iCEcable, iCEchip, iCEcube, iCEcube2, iCEman, iCEprog, iCEsab, iCEsocket, IPexpress, ISP, ispATE, ispClock, ispDOWNLOAD, ispGAL, ispGDS, ispGDX, ispGDX2, ispGDXV, ispGENERATOR, ispJTAG, ispLEVER, ispLeverCORE, ispLSI, ispMACH, ispPAC, ispTRACY, ispTURBO, ispVIRTUAL MACHINE, ispVM, ispXP, ispXPGA, ispXPLD, Lattice Diamond, LatticeCORE, LatticeEC, LatticeECP, LatticeECP-DSP, LatticeECP2, LatticeECP2M, LatticeECP3, LatticeECP4, LatticeMico, LatticeMico8, LatticeMico32, LatticeSC, LatticeSCM, LatticeXP, LatticeXP2, MACH, MachXO, MachXO2, MACO, mobileFPGA, ORCA, PAC, PAC-Designer, PAL, Performance Analyst, Platform Manager, ProcessorPM, PURESPEED, Reveal, SiliconBlue, Silicon Forest, Speedlocked, Speed Locking, SuperBIG, SuperCOOL, SuperFAST, SuperWIDE, sysCLOCK, sysCONFIG, sysDSP, sysHSI, sysI/O, sysMEM, The Simple Machine for Complex Design, TraceID, TransFR, UltraMOS, and specific product designations are either registered trademarks or trademarks of Lattice Semiconductor Corporation or its subsidiaries in the United States and/or other countries. ISP, Bringing the Best Together, and More of the Best are service marks of Lattice Semiconductor Corporation.

Other product names used in this publication are for identification purposes only and may be trademarks of their respective companies.

Disclaimers

NO WARRANTIES: THE INFORMATION PROVIDED IN THIS DOCUMENT IS “AS IS” WITHOUT ANY EXPRESS OR IMPLIED WARRANTY OF ANY KIND INCLUDING WARRANTIES OF ACCURACY, COMPLETENESS, MERCHANTABILITY, NONINFRINGEMENT OF INTELLECTUAL PROPERTY, OR FITNESS FOR ANY PARTICULAR PURPOSE. IN NO EVENT WILL LATTICE SEMICONDUCTOR CORPORATION (LSC) OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER (WHETHER DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL, INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF PROFITS, BUSINESS INTERRUPTION, OR LOSS OF INFORMATION) ARISING OUT OF THE USE OF OR INABILITY TO USE THE INFORMATION PROVIDED IN THIS DOCUMENT, EVEN IF LSC HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. BECAUSE SOME JURISDICTIONS PROHIBIT THE EXCLUSION OR LIMITATION OF CERTAIN LIABILITY, SOME OF THE ABOVE LIMITATIONS MAY NOT APPLY TO YOU.

LSC may make changes to these materials, specifications, or information, or to the products described herein, at any time without notice. LSC makes no commitment to update this documentation. LSC reserves the right to discontinue any product or service without notice and assumes no obligation to correct any errors contained herein or to advise any user of this document of any correction if such be made. LSC recommends its customers obtain the latest version of the relevant information to establish, before ordering, that the information being relied upon is current.

Type Conventions Used in This Document

Convention Meaning or Use

Bold Items in the user interface that you select or click. Text that you type into the user interface.

Variables in commands, code syntax, and path names.

Ctrl+L Press the two keys at the same time.

Courier Code examples. Messages, reports, and prompts from the software. ...Omitted material in a line of code.

Omitted lines in code and report examples.

.

.

.

[ ]Optional items in syntax descriptions. In bus specifications, the brackets are required.

( )Grouped items in syntax descriptions.

{ }Repeatable items in syntax descriptions.

| A choice between items in syntax descriptions.

Contents

Introduction 1

Architecture 3

Register Architecture3

General-Purpose Registers3

Control and Status Registers4 Memory Architecture5

Memory Regions5

Memory Modes9

Interrupt Architecture10

Call Stack10

Configuration Options 11

Instruction Set 13

Instruction Formats13

Instruction Set Lookup Table14 Instruction Descriptions16

Programming Model 37

Data Representation37

Procedure Caller-Callee Convention38 Register Usage38

Stack Frame39

Parameter Passing40

Interrupt Convention41

Acessing LatticeMico8 Memory Regions42 Scratchpad42

Peripheral42

PROM43

C ONTENTS

Index 45

Chapter 1 Introduction

The LatticeMico8? is an 8-bit microcontroller optimized for Field Programmable Gate Arrays (FPGAs) and Programmable Logic Device architectures from Lattice Semiconductor. It combines a full 18-bit wide instruction set with 16 or 32 general-purpose registers. It is suitable for a wide variety of markets, including communications, consumer, computer, medical, industrial and automotive. The core consumes minimal device resources— fewer than 250 Look-Up Tables (LUTs) in the smallest configuration—while maintaining a broad feature set.

LatticeMico8 Features

◆8-Bit Data Path

◆18-Bit Instructions

◆Configurable Instruction Memory (PROM)

◆Internal, or external through the WISHBONE Interface

◆Configurable to accommodate 256, 512, 1K, 1.5K, 2K, 2.5K, 3K, 3.5K

or 4K instructions

◆Scratchpad Memory

◆Internal, or external through the WISHBONE Interface

◆Configurable up to 4Gbytes using paged bytes (256 bytes/page)

◆Input/Output Peripheral Space through the WISHBONE Interface

◆Configurable up to 4Gbytes using paged ports (256 ports/page)

◆Minimum Two Cycles per Instruction

◆Configurable 16 or 32 General-purpose Registers

◆Configurable Call Stack size

Figure1 on page2 shows the LatticeMico8 Microcontroller block diagram.

I NTRODUCTION:

Figure 1: LatticeMico8 Microcontroller Core

Chapter 2

Architecture

This chapter describes the LatticeMico8 register and memory architecture

and explains the interrupt architecture and call stack.

Register Architecture

This section describes the general-purpose and control and status registers of

the LatticeMico8 architecture.

General-Purpose Registers

The LatticeMico8 microcontroller can be configured to have either 16 or 32

general-purpose registers. Each register is 8 bits wide. The registers are

implemented using a dual-port distributed memory. The LatticeMico8 opcode

set permits the microcontroller to access 32 registers. When LatticeMico8 is

configured with 16 registers, any opcode reference to R16 to R31 maps to R0

to R15 respectively.

General-purpose registers R13, R14, and R15 can also be used by the

LatticeMico8 microcontroller as page-pointer registers, depending on the

current memory mode. Page pointers (PP) are used when the scratchpad and

peripheral memory spaces are larger than 256 bytes (see “Memory Modes”

on page9). The memory address is formed by concatenating the values in

registers R13, R14, and R15 with an 8-bit value derived from the LatticeMico8

memory instruction. Table1 on page4 highlights the three LatticeMico8

memory modes and corresponding designation of registers R13, R14, and

R15.

In the large memory mode, registers R13, R14, and R15 indicate which of

the 16M pages is currently active. R13 provides the least-significant byte

of page address and R15 provides most-significant byte.

A RCHITECTURE :Register Architecture

In the medium memory mode, register R13 indicates which of the 256 pages is currently active.

Control and Status Registers

Table 2 shows all the names of the control and status registers (CSR), the read and write access, and the index used when the register is accessed. All signal levels are active high.

IP – Interrupt Pending The IP CSR contains a pending bit for each of the 8 external interrupts. A pending bit is set when the corresponding interrupt request line is asserted low. Bit 0 corresponds to interrupt 0. Bits in the IP CSR can be cleared by writing a 1 with the wcsr instruction. Writing a 0 has no effect. After reset, the value of the IP CSR is 0.

IM – Interrupt Mask The IM CSR contains an enable bit for each of the 8 external interrupts. Bit 0 corresponds to interrupt 0. In order for an interrupt to be raised, both an enable bit in this register and the IE flag in the IE CSR must be set to 1. After reset, the value of the IM CSR is 0.

IE – Global Interrupt Enable The IE CSR contains a single-bit (bit position 0) flag, IE, which determines whether interrupts are enabled. This flag has priority over the IM CSR. After reset, the value of the IE CSR is 0.

Table 1: Designation of LatticeMico8 Registers Based on LatticeMico8 Memory Mode

Register Number LatticeMico8 Memory Mode

Small

Medium Large

0 through 12general-purpose general-purpose general-purpose 13general-purpose PP

PP (LSB)14general-purpose general-purpose PP 15

general-purpose general-purpose PP (MSB)16 through 31

general-purpose

general-purpose

general-purpose

Table 2: Control and Status Registers

Name Access Index Description IP R/W 0Interrupt Pending IM R/W 1Interrupt Mask

IE

R/W

2

Global Interrupt Enable/Disable

A RCHITECTURE:Memory Architecture

Memory Architecture

This section describes the memory architecture of the LatticeMico8

microcontroller.

Memory Regions

The LatticeMico8 microcontroller recognizes three independent memory

regions. Each memory region has its own independent input/output interface

and its own instruction set support. These three memory regions are called

the PROM, the Scratchpad, and the Peripheral memory regions respectively.

The size and location of each of these memory regions is configurable as long

as all these three memory regions are located entirely within the 4GB address

space. These memory regions can also be configured to overlap within

LatticeMico System Builder. Figure2 shows the three memory regions and

the address space to which they are confined by LatticeMico System Builder.

See “Acessing LatticeMico8 Memory Regions” on page42 for details on how

to access each of the three memory regions from a software programmer's

perspective.

Figure 2: Memory Organization

A RCHITECTURE:Memory Architecture

PROM Space

The PROM memory region contains the program code that will be executed

by the LatticeMico8 microcontroller core and is accessible via its instruction

fetch engine. The size of the PROM memory region can be configured to

accommodate 256, 512, 1024, 2048, or 4096 instruction opcodes. By default

the memory region is located within the LatticeMico8 microcontroller. The

memory regions can also be configured to be external to the LatticeMico8

microcontroller.

When the PROM memory region is internal to the microcontroller, it is

connected to the LatticeMico8 instruction fetch engine via a dedicated high-

speed bus that fetches one instruction opcode per clock cycle. There is no

instruction set support to write to internal PROM. When the PROM memory

region is external to the microcontroller, it is accessed by the master

WISHBONE interface within the LatticeMico8 instruction fetch engine. This

WISHBONE interface has a 8-bit data bus and it takes three 8-bit WISHBONE

accesses to fetch one LatticeMico8 instruction opcode. The instruction fetch

latency is now dictated by the system WISHBONE latency and the latency of

the PROM memory. The minimum instruction fetch latency is 12 clock cycles.

Table3 shows the WISHBONE interface signals. For more information about

the WISHBONE System-On-Chip (SoC) Interconnection Architecture for

Portable IP Cores, as it is formally known, refer to the https://www.doczj.com/doc/d64401338.html,

Web site at https://www.doczj.com/doc/d64401338.html,/projects.cgi/web/wishbone.

Table 3: PROM WISHBONE Interface Signals

Name Width Direction Description

I_CYC_O1Output A new LatticeMico8 instruction fetch request is initiated by asserting this

signal. This signal remains asserted until I_ACK_I is asserted, which

indicates the completion of the request.

I_STB_O1Output A new LatticeMico8 instruction fetch request is initiated by asserting this

signal. This signal may be valid only for the first cycle.

I_CTI_O2Output Always has a value 2’b00

I_BTE_O3Output Always has a value 3’b000

I_ADR_O32Output The address output array I_ADR_O( ) is used to pass a binary address.

I_WE_O1Output Always has a value 1’b0

I_SEL_O4Output Always has a value 4’b1111

I_DAT_O8Output Unused

I_LOCK_O1Output Unused (signal exists, but it is not implemented)

I_ACK_I1Input When asserted, the signal indicates the normal termination of a bus cycle

and that an instruction is available on I_DAT_I bus.

I_ERR_I1Input Unused (signal exists, but it is not implemented)

I_RTY_I1Input Unused (signal exists, but it is not implemented)

I_DAT_I8Input One byte of the LatticeMico8 18-bit instruction opcode is available on this

bus when I_ACK_I is asserted. It takes three WISHBONE transactions to

complete one LatticeMico8 instruction fetch.

A RCHITECTURE :Memory Architecture

The advantage of configuring the PROM memory region as external to the LatticeMico8 microcontroller is that the PROM memory region can now be configured to overlap with other LatticeMico8 memory regions within Lattice Mico System Builder and, therefore, be directly written to by LatticeMico8 opcodes. This configuration also offers the ability to store and execute

LatticeMico8 instructions from non-volatile memory such as Flash. As shown in Figure 2 on page 5, the external PROM memory region can be placed at any location within a 4GB address range. When the LatticeMico8

microcontroller is instantiated using Lattice Mico System Builder, it will restrict the placement of external PROM between 0x00000000 and 0x80000000.

Scratchpad Space

LatticeMico8 provides an independent memory space that is designed to be used for program read/write and read-only data as well as other user-defined data. The size of this scratchpad memory can be configured from 32 bytes to 4G bytes, in power-of-two increments. Figure 3 shows the structure of this scratchpad space and how data is located within this space. The scratchpad memory space can be placed at any location within a 4GB address range. The first 4 bytes are reserved for LatticeMico8 interrupt handling. Program data is situated above this reserved space. The designer can configure the size of scratchpad memory that is used for program data. User-defined data is optional and is always located after program data.

The scratchpad memory can be configured to be entirely internal to the

LatticeMico8 microcontroller, entirely external to LatticeMico8 microcontroller, or a combination of both.

The internal scratchpad is implemented using single-port EBRs and is hooked up to the LatticeMico8 core through a dedicated bus. Reads or writes to the internal scratchpad take a single clock cycle.

The external scratchpad is accessed through the Peripheral WISHONE interface of the LatticeMico8 microcontroller (see “Interrupt Architecture” on page 10). Each read or write will take a minimum of 2 clock cycles.

Figure 3: Scratchpad Space Structure

A RCHITECTURE:Memory Architecture

Peripheral (Input/Output) Space

LatticeMico8 provides an independent memory space that is designed to be

used for peripherals and other memory-mapped hardware. The size of this

peripheral memory space can be configured from 0 bytes to 4G bytes in

power-of-two increments. While the peripheral memory space can be placed

at any location within a 4GB address range, Lattice Mico System Builder

restricts the peripheral memory space to the addresses between 0x80000000

and 0xFFFFFFFF.

This memory space is always external to the LatticeMico8 microcontroller and

is primarily used to enable LatticeMico8 to communicate with memory-

mapped hardware and peripherals. The LatticeMico8 microcontroller can

communicate with any hardware or peripheral within the peripheral memory

space, through the peripheral WISHBONE interface within LatticeMico8 core,

using LatticeMico8 instruction opcodes. This WISHBONE interface has 8-bit

input and output data busses and a 32-bit address bus. Table4 shows the

Peripheral WISHBONE interface signals.

Table 4: Peripheral WISHBONE Interface Signals

Name Width Direction Description

D_CYC_O1Output A new LatticeMico8 data request is initiated by asserting this signal.

This signal remains asserted until D_ACK_I is asserted, which

indicates completion of the request.

D_STB_O1Output A new LatticeMico8 data request is initiated by asserting this signal.

This signal may be valid only for first cycle.

D_CTI_O2Output This bus will always have a value 2'b00

D_BTE_O3Output This bus will always have a value 3'b000

D_ADR_O32Output The address output array D_ADR_O( ) is used to pass a binary

address. D_ADR_O( ) actually has a full 32 bits.

D_WE_O1Output This signal indicates whether a new data request is a read (0) or a

write (1). This signal must hold its value as long as D_CYC_O is

asserted.

D_SEL_O1Output Always has a value 1'b1

D_DAT_O8Output Has valid data when D_WE_O is 1'b1.

D_LOCK_O1Output Unused (signal exists, but it is not implemented)

D_ACK_I1Input When asserted, the signal indicates the normal termination of a bus

cycle.

D_ERR_I1Input Unused (signal exists, but it is not implemented)

D_RTY_I1Input Unused (signal exists, but it is not implemented)

D_DAT_I8Input Data is available on this bus when D_ACK_I and D_WEO are

asserted.

A RCHITECTURE:Memory Architecture

Memory Modes

The LatticeMico8 microcontroller can be configured for different sizes for the

scratchpad and peripheral memory regions. The size of scratchpad and

peripheral memory regions can be as small as 32 bytes and as large as 4G

bytes. A 32-byte memory region requires only 5 address bits, while a 4GB

memory region requires 32 address bits.

The LatticeMico8 instruction set can directly access only 256 memory

locations, since all general-purpose registers are 8 bits wide. (See “Instruction

Set” on page13.) To access memory regions that are larger than 256 bytes,

LatticeMico8 relies on a concept called “paging,” in which the memory is

logically divided into 256-byte pages. The memory address is composed of

two parts, as shown in Figure4: the page index and the page pointer. The

page index is 8 bits wide and addresses a byte in the currently active page,

while the page pointer provides the address of the currently active page. Figure 4: Memory Modes

The page pointers are essentially general-purpose registers that have been

retargeted to provide a memory address. (See “Memory Regions” on page5.)

Table5 shows the memory modes of the LatticeMico8 microcontroller, the

size of addressable memory space in each mode, and the general-purpose

registers used as page pointers.

Table 5: LatticeMico8 Memory Modes

Memory Mode Maximum Memory Size Address Bits Page Pointer Registers

Small256 bytes8N/A

Medium16K bytes16R13

Large4G bytes32R13, R14, R15

A RCHITECTURE:Interrupt Architecture

Interrupt Architecture

The LatticeMico8 microcontroller supports up to 8 maskable, active-low, level-

sensitive interrupts. Each interrupt line has a corresponding mask bit in the IM

CSR. The mask enable is active high. A global interrupt-enable flag is

implemented in the IE CSR. The software can query the status of the

interrupts and acknowledge them through the IP CSR. If more interrupt

sources or more sophisticated interrupt detection methods are required,

external interrupt controllers can be cascaded onto the microcontroller’s

interrupt pins to provide the needed functionality.

When an interrupt is received, the address of the next instruction is pushed

into the call stack (see “Call Stack” on page10), and the microcontroller

continues execution from the interrupt vector (address 0). The flags (carry and

zero) are pushed onto the call stack along with the return address. An iret

instruction will pop the call stack and transfer control to the address on top of

the stack. The flags (carry and zero) are also popped from the call stack.

See “Interrupt Convention” on page41 for details on the programming model

for interrupts.

Note

The LatticeMico8 microcontroller does not support nested interrupts. Locations 0

through 3 in the scratchpad are reserved for interrupt handling and should not used for

any other purpose.

Call Stack

The LatticeMico8 microcontroller implements a hardware call stack to handle

procedure calls (call instruction) and procedure/interrupt return (ret and iret

instructions). The depth of this call stack determines the number of nested

procedure calls that can be handled by the LatticeMico8 microcontroller, and

designers can choose the depth to be 8, 16, or 32. When a call instruction is

executed, the address of the next instruction is pushed on to the call stack. A

ret or iret instruction will pop the stack and continue execution from the

location at the top of the stack.

Note

There is no mechanism in hardware to detect whether the number of nested procedure

calls has exceeded the depth of the call stack. It is up to the software developer to

ensure that the call stack does not overflow.

Chapter 3

Configuration Options

The LatticeMico8 microcontroller is reconfigurable. Table6 outlines the

various configuration options that are available to a designer.

Table 6: LatticeMico8 Configuration Options

Parameter Name Description

LATTICE_FAMILY The target Lattice FPGA family.

CFG_PROM_INIT_FILE Provides the file that contains the initialization data (program code) for an

internal PROM.

CFG_PROM_INIT_FILE_FORMAT Indicates whether CFG_PROM_INIT_FILE is in hex (default) or binary. CFG_PROM_SIZE Indicates the number of instructions that can be accommodated in the

PROM.

CFG_SP_INIT_FILE Provides the file that contains the initialization data (program data) for an

internal scratchpad.

CFG_SP_INIT_FILE_FORMAT Indicates whether CFG_SP_INIT_FILE_FORMAT is hex (default) or binary. SP_PORT_ENABLE Indicates whether the scratchpad is internal (value 1) or external (value 0).

The default is 1.

SP_SIZE Indicates the number of bytes in the scratchpad.

SP_BASE_ADDRESS Provides the base address of the scratchpad, regardless of whether it is

internal or external.

CFG_IO_BASE_ADDRESS Provides the base address of the peripheral memory region.

CFG_EXT_SIZE_[8|16|32]Indicates the size of address bus for the scratchpad and peripheral memory

regions and, therefore, identifies the LatticeMico8 memory mode. The

default is 16 (medium memory mode).

CFG_REGISTER_[16|32]Indicates the number of general-purpose registers in LatticeMico8. The

default is 8.

C ONFIGURATION O PTIONS:

Table 6: LatticeMico8 Configuration Options (Continued)

Parameter Name Description

CFG_CALL_STACK_[8|16|32]Indicates the depth of the call stack. The default is 16.

CFG_ROM_EN Indicates whether the PROM and Scratchpad memories need to be

initialized from non-volatile storage such as flash at power-up. The default

is 0, i.e., no copying is required.

CFG_ROM_BASE_ADDRESS Provides the base address of the memory which contains the PROM and

Scratchpad images. The PROM image starts at this base address. The

Scratchpad image starts at location (CFG_PROM_SIZE*3).

CFG_XIP Indicates whether the PROM memory is the same as the non-volatile

storage that contains the PROM image. The default is 0, i.e., both

memories are different. 1 indicates that both memories are the same (i.e.,

no copying needs to be done) and the PROM is external to LatticeMico8. INTERRUPTS Indicates the number of external interrupts. The default is 8.

Chapter 4

Instruction Set

This chapter includes descriptions of all the instruction opcodes of the

LatticeMico8 microcontroller.

Instruction Formats

All LatticeMico8 instructions are 18 bits wide. They are in three basic formats,

as shown in Figure5, Figure6, and Figure7.

Figure 5: Register-Register Format

Figure 6: Register-Immediate Format

Figure 7: Immediate Format

I NSTRUCTION S ET:Instruction Set Lookup Table

Instruction Set Lookup Table

Table 7: Instruction Set Reference Card

Operation Action Flags ADD Rd, Rb Rd = Rd + Rb Carry, Zero ADDC Rd, Rb Rd = Rd + Rb + Carry Carry, Zero ADDI Rd, C Rd = Rd + C Carry, Zero ADDIC Rd, C Rd = Rd + C + Carry Carry, Zero AND Rd, Rb Rd = Rd & Rb Zero ANDI Rd, C Rd = Rd & C Zero

B Label P

C = PC + Label

BC Label If Carry = 1, PC = PC + Label

BNC Label If Carry = 0, PC = PC + Label

BNZ Label If Zero = 0, PC = PC + Label

BZ Label If Zero = 1, PC = PC + Label

CALL Label Stack = PC + 1, PC = PC + Label

CALLC Label If Carry = 1, Stack = PC + 1, PC = PC + Label

CALLNC Label If Carry = 0, Stack = PC + 1, PC = PC + Label

CALLNZ Label If Zero = 0, Stack = PC + 1, PC = PC + Label

CALLZ Label If Zero = 1, Stack = PC + 1, PC = PC + Label

CLRC Carry = 0Carry CLRI IE = 0

CLRZ Zero = 0Zero

CMP Rd, Rb Rd – Rb Carry, Zero CMPI Rd, C Rd – C Carry, Zero EXPORT Rd, Port#Peripheral (Port #) = Rd

EXPORTI Rd, Rb Peripheral (Page Pointer, Rb) = Rd

IMPORT Rd, Port#Rd = Peripheral (Port #)

IMPORTI Rd, Rb Rd = Peripheral (Page Pointer, Rb)

IRET PC, Carry, Zero = Stack Carry, Zero LSP RD, SS Rd = Scratchpad (SS)

LSPI Rd, Rb Rd = Scratchpad (Page Pointer, Rb)

MOV Rd, Rb Rd = Rb

MOVI Rd, C Rd = Const

精简8位cpu设计报告

精简8位cpu实验设计报告 实验介绍: 实验分为两个部分,第一部分为16*8 ROM 设计与仿真 第二部分为SAP-1 设计与仿真 实验流程: ①16*8 ROM 的设计与仿真 Rom16_8.VHDL LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.STD_LOGIC_ARITH.ALL; USE IEEE.STD_LOGIC_UNSIGNED.ALL; ENTITY ROM16_8 is PORT( DATAOUT :OUT STD_LOGIC_VECTOR(7 DOWNTO 0); --Data Output ADDR :IN STD_LOGIC_VECTOR(3 DOWNTO 0); --ADDRESS CE :IN STD_LOGIC --Chip Enable ); END ROM16_8; ARCHITECTURE a OF ROM 16_8 IS BEGIN DATA<=“00001001”WHEN ADDR=“0000”AND CE=‘0’--LDA 9H “00011010”WHEN ADDR=“0001”AND CE=‘0’ELSE --ADD AH “00011011”WHEN ADDR=“0010”AND CE=‘0’ELSE --ADD BH “00101100”WHEN ADDR=“0011”AND CE=‘0’ELSE --SUB CH “11100000”WHEN ADDR=“0100”AND CE=‘0’ELSE --OUT “11110000”WHEN ADDR=“0101”AND CE=‘0’ELSE --HLT “00010000”WHEN ADDR=“1001”AND CE=‘0’ELSE “00010100”WHEN ADDR=“1010”AND CE=‘0’ELSE “00011000”WHEN ADDR=“1011”AND CE=‘0’ELSE

计算机组成原理CPU设计

1 CPU的用途 字长:8位D[7…0] 寻址围:64byte,2的6次方=64,A[5…0] 2 确定ISA(包括程序员可访问的寄存器) 1)程序员可访问的寄存器AC—8位累加器 3 CPU设计状态图 为了确定CPU的状态图,对每条指令作以下分析 1)从存贮器中取指令(所有指令均相同) 原理:在CPU能执行指令之前,它必须从存贮器中取出,CPU通过执行如下的操作序列完成这个任务 A)选择存贮单元由A[5…0]确定 B)对工A[5…0]译码,延迟,并向存贮器发一个信号使存贮器将此指令输出到它的输出引脚。这些引脚与CPU的D[7…0]相连。CPU从这些引脚读 入数据。 具体操作:(分为三个状态) A)要取的指令的地址存放在程序计数器(PC)中。第一步就是把PC的容拷贝到AR中。 FETCH1:AR←PC B)CPU必须从存贮器中读取指令,为此CPU必须发一个READ信号到器的RD(RD-RAM,相对于OE-ROM)端上使存贮器将数据发送到D[7…0]上,存入 CPU的DR寄存器中。同时实现PC←PC+1,为取下一条指令作准备。 FETCH2:DR←M,PC←PC+1 C)作为取指令的一部分,CPU还必须完成两件事。 ①DR的高2位拷贝到IR,目的是确定指令的功能 ②DR的低6位拷贝到AR,目的: a. 对于ORT和SUB1指令这6 位包含了指令的一个操作数的存贮器 地址(一个数已经在AC) b. 对于COM和JREL,它们不需要再次访问存贮器,一旦它们返回

到FETCH1周期,FETCH1将把PC的值装到AR,覆盖无用的值。 FETCH3:IR←DR[7,6], AR←DR[5…0] 取指令周期的状态图 2)指令译码(每条指令的操作码都是唯一的) 本CPU有四条指令,因此有四个不同的执行同期,为此用IR中的值来确定即可。 3)指令执行(每条指令的执行周期都是一样的) 每条指令的执行周期的状态分析: 1.COM指令 功能是对AC的容取反,执行周期的状态是 COM1:AC←AC’ 2. JREL指令 代码为01AAAAAA,即转移的相对地址由AAAAAA确定,而AAAAAA在 DR[5…0]中,所以有 JREL1:PC←PC+ DR[5…0] 3.OR指令 为了执行指令,必须完成两件事情 OR1:DR←M;从存贮器取出一个操作数送到数据寄存器 OR2:AC←AC∨DR;与AC相或,并把结果存回AC中 4. SUB1指令 为了执行指令,必须完成两件事情

计算机硬件课程设计报告(cpu设计)

计算机硬件课程设计 设计报告 学号: 姓名:成绩: 学号: 姓名:成绩: 东南大学计算机科学与工程系 二0 10 年11 月

一、设计名称: My CPU的设计 二、本设计的主要特色: 1、熟悉挂总线的逻辑器件的特性和总线传送的逻辑实现方法。 2、掌握半导体静态存储器的存取方法。 三、设计方案: 1. 数据格式——8位二进制定点表示 2. 指令系统——CPU的指令格式尽量简单规整,这样在硬件上更加容易实现。 7条基本指令:输入/输出,数据传送,运算,程序控制。 指令格式:Array 7 6 5 4 3 2 1 0 两种寻址方式: 寄存器寻址Array 7 6 5 4 3 2 1 0 直接地址寻址,由于地址要占用一个字节,所以为双字节指令。 7条机器指令:

IN R目:从开关输入数据到指定的寄存器R目。 OUT R源:从指定的寄存器R源中读取数据送入到输出缓冲寄存器,显示灯亮。 ADD R目,R源:将两个寄存器的数据相加,结果送到R目。 JMP address : 无条件转移指令。 HALT : 停机指令。 LD R目,address : 从内存指定单元中取出数据,送到指定寄存器R 目。 ST address , R 源: 从指定的寄存器R源中取出数据,存入内存指定单元。

Address(内存地址) 3. CPU内部结构 4.数据通路设计 根据指令系统,分析出数据通路中应包括寄存器组、存储器、运算器、多路转换器等,采用单总线结构。 通用寄存器组:

运算器: 存储器: 多路转换器:

输出缓冲器: 5.控制器设计 控制通路负责整个CPU的运行控制,主要由控制单元和多路选择器MUX 完成。在每一个时钟周期的上升沿指令寄存器IR 从内存中读取指令字后,控制单元必须能够根据操作码,为每个功能单元产生相应主控制信号,以及对ALU 提供控制信号。对于不同的指令,同一个功能单元的输入不同,需要多路选择器MUX 来对数据通路中功能单元的输入进行选择。

8位CPU的设计与实现

实验题目 8位CPU的系统设计学号 1115106046 姓名魏忠淋 班级 11电子B 班 指导老师凌朝东

华侨大学电子工程系 8位CPU的系统设计 一、实验要求与任务 完成从指令系统到CPU的设计,编写测试程序,通过运行测试程序对CPU设计进行正确性评定。具体内容包括:典型指令系统(包括运算类、转移类、访存类)设计;CPU结构设计;规则文件与调试程序设计;CPU调试及测试程序运行。 1.1设计指标 能实现加减法、左右移位、逻辑运算、数据存取、有无条件跳转、内存访问等指令; 1.2设计要求 画出电路原理图、仿真波形图; 二、CPU的组成结构

三、元器件的选择 1.运算部件(ALU) ALU181的程序代码: LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.STD_LOGIC_UNSIGNED.ALL; ENTITY ALU181 IS PORT ( S : IN STD_LOGIC_VECTOR(3 DOWNTO 0 ); A : IN STD_LOGIC_VECTOR(7 DOWNTO 0); B : IN STD_LOGIC_VECTOR(7 DOWNTO 0); F : OUT STD_LOGIC_VECTOR(7 DOWNTO 0); COUT : OUT STD_LOGIC_VECTOR(3 DOWNTO 0); M : IN STD_LOGIC; CN : IN STD_LOGIC; CO,FZ: OUT STD_LOGIC ); END ALU181; ARCHITECTURE behav OF ALU181 IS SIGNAL A9 : STD_LOGIC_VECTOR(8 DOWNTO 0); SIGNAL B9 : STD_LOGIC_VECTOR(8 DOWNTO 0); SIGNAL F9 : STD_LOGIC_VECTOR(8 DOWNTO 0); BEGIN A9 <= '0' & A ; B9 <= '0' & B ;

CPU课程设计报告

课程设计报告 课程片上计算机系统 题目 CPU模型机设计 班级 专业 学生 学号 指导教师 2014年7 月 3 日 目录: 1.课程设计的目的及要求 (3) 2.处理器的设计思想和设计内容 (3)

3.设计处理器的结构和实现方法 (3) 4.模型机的指令系统 (4) 5.处理器的状态跳转操作过程 (4) 6. CPU的Verilog代码 (7) 7. 模型机在Quartus II环境下的应用 (19) 8. 仿真波形 (19) 9. 课程设计的总结 (21) 一.课程设计的目的及要求: (一)目的: 1.掌握RISC CPU与内存数据交换的方法。 2.学会指令格式的设计与用汇编语言编写简易程序。 3.能够使用VHDL硬件描述语言在QuartusⅡ软件环境下完成CPU模型机的 设计。

(二)要求: 1.以《计算机组成与设计》书中123页的简化模型为基础更改其指令系 统,形成设计者的CPU, 2.在Quartus II环境下与主存连接,调试程序,观察指令的执行是否达 到设计构想。 二.处理器的设计思想和设计内容: 处理器的字长为16b;包括四种指令格式,格式1、格式2、格式3的指令字长度为8b,格式4的指令字长度为16b;处理器内部的状态机包括七个状态。(一)关于修改后的CPU: 一共设计25条指令,主要包括空操作指令、中断指令、加法指令、减法指令、加法指令、四种逻辑运算指令、比较、算术移位操作指令、逻辑移位操作指令、加减1指令、加减2指令、数据传输指令、转移类指令、读写指令、特权指令等等。 (二)关于RAM: 地址线设置成8bits,主存空间为4096words。 三.设计处理器的结构和实现方法: (指令格式) 格式1:寄存器寻址方式 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 OP Rx Ry 空白 格式2:寄存器变址寻址方式 OP Ry 空白 格式3:立即数寻址方式 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 OP I 空白 格式4:无操作数寻址方式 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 OP 空白空白 格式5:直接寻址方式 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 OP Addr 内存(2的12次方) 四.模型机的指令系统 CPU的指令集: 操作码OP IR(15..1 2) 指令 格式 指令的助记指令的内容

CPU设计实验报告

实验中央处理器的设计与实现 一、实验目的 1、 理解中央处理器的原理图设计方法。 2、 能够设计实现典型MIPS 的11条指令。 二、 实验要求 1、 使用Logisim 完成数据通路、控制器的设计与实现。 2、 完成整个处理器的集成与验证。 3、 撰写实验报告,并提交电路源文件。 三、 实验环境 VMware Workstatio ns Pro + Win dows XP + Logisim-wi n-2.7.1 四、 操作方法与实验步骤 1、数据通路的设计与实现 数据通路主要由NPC 、指令存储器、32位寄存器文件、立即数扩展部件、 ALU 、数据存储器构成。其中指令存储器和数据存储器可直接调用软件库中的 ROM 和RAM 元件直接完成,其余部件的设计如图所示: Cue ------- 吊孙 ----------- n -ar ch Zan [p]~ 图 1.1 NPC G —-- DO jlf* 04 4 D 04 nero & res?l ■&

幣> >曰CXI e Q

图1.3立即数扩展部件 图 1.4 ALU 2、控制器的设计与实现 控制器的主要设计思想如图所示 图2.1控制器设计思想 通过列真值表得到控制器的两部分电路,真值表如下 : 输入 000000 001101 100011 101011 000100 000010 immIC £it£ DOO -DO ooo n Q □□□non UOnflO OOC ?>:>0 DQ 000 指令 lnst :ruction[31:O] OP[5:OJ fu net [5:0] Jump ExBp Branch Mem Write ALUctr * RegWrite MemtoReg * ALUSrc 控制器 控制信号 LLLLLLLLLmM f ZERO A ()-- irnmmmiiiimiiiiifeiiim IIII93 1-] * 11114444 ".'O

8位CPU的设计与实现

计算机组成原理 实验题目8位CPU得系统设计 学号1115106046 姓名魏忠淋 班级 11电子B 班 指导老师凌朝东 华侨大学电子工程系 8位CPU得系统设计 一、实验要求与任务 完成从指令系统到CPU得设计,编写测试程序,通过运行测试程序对CPU设计进行正确性评定。具体内容包括:典型指令系统(包括运算类、转移类、访存类)设计;CPU结构设计;规则文件与调试程序设计;CPU调试及测试程序运行。 1。1设计指标 能实现加减法、左右移位、逻辑运算、数据存取、有无条件跳转、内存访问等指令; 1、2设计要求 画出电路原理图、仿真波形图;

二、CPU得组成结构 三、元器件得选择 1.运算部件(ALU) ALU181得程序代码: LIBRARY IEEE; USEIEEE、STD_LOGIC_1164。ALL; USEIEEE、STD_LOGIC_UNSIGNED.ALL; ENTITY ALU181 IS PORT( S: IN STD_LOGIC_VECTOR(3 DOWNTO0 ); A:IN STD_LOGIC_VECTOR(7 DOWNTO0); B: INSTD_LOGIC_VECTOR(7DOWNTO 0); F : OUT STD_LOGIC_VECTOR(7 DOWNTO 0); ?COUT:OUTSTD_LOGIC_VECTOR(3 DOWNTO0); M :INSTD_LOGIC; CN : IN STD_LOGIC; CO,FZ:OUT STD_LOGIC ); END ALU181; ARCHITECTURE behav OF ALU181 IS SIGNALA9 :STD_LOGIC_VECTOR(8DOWNTO 0); SIGNAL B9 : STD_LOGIC_VECTOR(8 DOWNTO0); SIGNALF9: STD_LOGIC_VECTOR(8 DOWNTO0); BEGIN A9<= '0'& A; B9 <= ’0’&B;

CPU设计实验报告

实验中央处理器的设计与实现 一、实验目的 1、理解中央处理器的原理图设计方法。 2、能够设计实现典型MIPS的11条指令。 二、实验要求 1、使用Logisim完成数据通路、控制器的设计与实现。 2、完成整个处理器的集成与验证。 3、撰写实验报告,并提交电路源文件。 三、实验环境 VMware Workstations Pro + Windows XP + Logisim-win-2.7.1 四、操作方法与实验步骤 1、数据通路的设计与实现 数据通路主要由NPC、指令存储器、32位寄存器文件、立即数扩展部件、ALU、数据存储器构成。其中指令存储器和数据存储器可直接调用软件库中的ROM和RAM元件直接完成,其余部件的设计如图所示: 图1.1 NPC

图1.2 32位寄存器

图1.3 立即数扩展部件 图1.4 ALU 2、控制器的设计与实现 控制器的主要设计思想如图所示 图2.1 控制器设计思想 输入 1 1 0

输出R-type ORI LW SW BEQ JUMP RegDst 1 0 0 x x x ALUSrc 0 1 1 1 0 x MemtoReg0 0 1 x x x RegWrite 1 1 1 0 0 0 MemWrite0 0 0 1 0 0 Branch 0 0 0 0 1 0 Jump 0 0 0 0 0 1 Extop x 0 1 1 1 x ALUop2 1 0 0 0 0 x ALUop1 x 1 0 0 x x ALUop0 x 0 0 0 1 x ALUop[2:0] Funct[3:0] 指令ALUctr[2:0] 111 0000 add 010 111 0010 sub 110 111 0100 and 000 111 0101 or 001 111 1010 slt 111 010 xxxx ori 001 000 xxxx Lw/sw 010 011 xxxx beq 110 表2.1 控制器设计真值表

《单周期CPU设计》实验报告

《计算机组成原理与接口技术实验》 实验报告 学院名称: 学生姓名: 学号: 专业(班级): 合作者: 时间:2016 年4 月25 日 成绩: ________ 实验二: 一. 实验目的 1.掌握单周期CPU数据通路图的构成、原理及其设计方法; 2.掌握单周期CPI的实现方法,代码实现方法; 3.认识和掌握指令与CPU勺关系; 4.掌握测试单周期CPI的方法。 二. 实验内容 设计一个单周期CPU,该CPU至少能实现以下指令功能操作。需设计的指令

与格式如下:

==>算术运算指令 功能:rd Jrs + rt 。 reserved为预留部分,即未用,一般填“0 (2)addi rt , rs , immediate 功能:rt J rs + (sign-extend) immediate ;immediate 符号扩展再参加“加”运算(3) sub rd , rs , rt 完成功能:rd J rs - rt ==>逻辑运算指令 (4)ori rt , rs , immediate 功能:rt Jrs | (zero-extend) immediate ; immediate 做“ o ”扩展再参加“或”运算(5) and rd , rs , rt 功能:rd Jrs & rt ;逻辑与运算 (6)or rd , rs , rt 功能:rd Jrs | rt ;逻辑或运算。 ==>传送指令 功能:rd Jrs + $0 ; $0=$zero=0。 ==>存储器读/写指令 (8)sw rt , immediate( rs)写存储器 功能:memory[rs+ (sign-extend) immediate ] J rt ; immediate 符号扩展再 相加。

8位CPU的设计与实现

计算机组成原理 CPU 实验题目 8位的系统设计1115106046 号学 魏忠淋姓名 B 11电子班班级凌朝东指导老师

华侨大学电子工程系 8位CPU的系统设计 一、实验要求与任务 完成从指令系统到CPU的设计,编写测试程序,通过运行测试程序对CPU设计进行正确性评定。具体内容包括:典型指令系统(包括运算类、转移类、访存类)设计;CPU结构设计;规则文件与调试程序设计;CPU调试及测试程序运行。 1.1设计指标 能实现加减法、左右移位、逻辑运算、数据存取、有无条件跳转、内存访问等指令; 1.2设计要求 画出电路原理图、仿真波形图; 二、CPU的组成结构 三、元器件的选择 1.运算部件(ALU) ALU181的程序代码: LIBRARY IEEE;

USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.STD_LOGIC_UNSIGNED.ALL; ENTITY ALU181 IS PORT ( S : IN STD_LOGIC_VECTOR(3 DOWNTO 0 ); A : IN STD_LOGIC_VECTOR(7 DOWNTO 0); B : IN STD_LOGIC_VECTOR(7 DOWNTO 0); F : OUT STD_LOGIC_VECTOR(7 DOWNTO 0); COUT : OUT STD_LOGIC_VECTOR(3 DOWNTO 0); M : IN STD_LOGIC; CN : IN STD_LOGIC; CO,FZ: OUT STD_LOGIC ); END ALU181; ARCHITECTURE behav OF ALU181 IS SIGNAL A9 : STD_LOGIC_VECTOR(8 DOWNTO 0); SIGNAL B9 : STD_LOGIC_VECTOR(8 DOWNTO 0); SIGNAL F9 : STD_LOGIC_VECTOR(8 DOWNTO 0); BEGIN B9 <= '0' & B ; A9 <= '0' & A ; PROCESS(M,CN,A9,B9) BEGIN CASE S IS WHEN ぜ?尰=> IF M='0' THEN F9<=A9 + CN ; ELSE F9<=NOT A9; END IF; WHEN IF M='0' THEN F9<=(A9 or B9) + CN ; ELSE F9<=NOT(A9 OR B9); END IF; WHEN 0 => IF M='0' THEN F9<=(A9 or (NOT B9))+ CN ; ELSE F9<=(NOT A9) AND B9; END IF; WHEN 1 => IF M='0' THEN F9<= ; ELSE F9<= END IF; WHEN 0 => IF M='0' THEN F9<=A9+(A9 AND NOT B9)+ CN ; ELSE F9<=NOT (A9 AND B9); END IF; WHEN 1 => IF M='0' THEN F9<=(A9 or B9)+(A9 AND NOT B9)+CN ; ELSE F9<=NOT B9; END IF; WHEN 0 => IF M='0' THEN F9<=(A9 - B9) - CN ; ELSE F9<=A9 XOR B9; END IF; WHEN 1 => IF M='0' THEN F9<=(A9 or (NOT B9)) - CN ; ELSE F9<=A9 and (NOT B9); END IF; WHEN @0 => IF M='0' THEN F9<=A9 + (A9 AND B9)+CN ; ELSE F9<=(NOT A9)and B9; END IF; WHEN @1 => IF M='0' THEN F9<=A9 + B9 + CN ; ELSE F9<=NOT(A9 XOR B9); END IF; WHEN A0 => IF M='0' THEN F9<=(A9 or(NOT B9))+(A9 AND B9)+CN ;

8位CPU的设计与实现

计算机组成原理 实验题目 8位CPU的系统设计学号 1115106046 姓名魏忠淋 班级 11电子B 班 指导老师凌朝东 华侨大学电子工程系

8位CPU的系统设计 一、实验要求与任务 完成从指令系统到CPU的设计,编写测试程序,通过运行测试程序对CPU设计进行正确性评定。具体内容包括:典型指令系统(包括运算类、转移类、访存类)设计;CPU结构设计;规则文件与调试程序设计;CPU调试及测试程序运行。 1.1设计指标 能实现加减法、左右移位、逻辑运算、数据存取、有无条件跳转、内存访问等指令; 1.2设计要求 画出电路原理图、仿真波形图; 二、CPU的组成结构

三、元器件的选择 1.运算部件(ALU) ALU181的程序代码: LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.STD_LOGIC_UNSIGNED.ALL; ENTITY ALU181 IS PORT ( S : IN STD_LOGIC_VECTOR(3 DOWNTO 0 ); A : IN STD_LOGIC_VECTOR(7 DOWNTO 0); B : IN STD_LOGIC_VECTOR(7 DOWNTO 0); F : OUT STD_LOGIC_VECTOR(7 DOWNTO 0); COUT : OUT STD_LOGIC_VECTOR(3 DOWNTO 0); M : IN STD_LOGIC; CN : IN STD_LOGIC; CO,FZ: OUT STD_LOGIC ); END ALU181; ARCHITECTURE behav OF ALU181 IS SIGNAL A9 : STD_LOGIC_VECTOR(8 DOWNTO 0); SIGNAL B9 : STD_LOGIC_VECTOR(8 DOWNTO 0); SIGNAL F9 : STD_LOGIC_VECTOR(8 DOWNTO 0); BEGIN A9 <= '0' & A ; B9 <= '0' & B ;

中国32位嵌入式CPU芯片

2015-2020年中国32位嵌入式CPU芯片行业市场调研及未来发展分析报告 Special Statenent特别声明 本报告由华经视点独家撰写并出版发行,报告版权归华经视点所有。本报告是华经视点专家、分析师调研、统计、分析整理而得,具有独立自主知识产权,报告仅为有偿提供给购买报告的客户使用。未经授权,任何网站或媒体不得转载或引用本报告内容,华经视点有权依法追究其法律责任。如需订阅研究报告,请直接联系本网站客服人员(8610-56188812 56188813),以便获得全程优质完善服务。 华经视点是中国拥有研究人员数量最多,规模最大,综合实力最强的研究咨询机构(欢迎客户上门考察),公司长期跟踪各大行业最新动态、资讯,并且每日发表独家观点。 目前华经视点业务范围主要覆盖市场研究报告、投资咨询报告、行业研究报告、市场预测报告、市场调查报告、征信报告、项目可行性研究报告、商业计划书、IPO上市咨询等领域,同时也为个阶层人士提供论文、报告等指导服务,是一家多层次、多维度的综合性信息研究咨询服务机构。 Report Description报告描述 本研究报告由华经视点公司领衔撰写。报告以行业为研究对象,基于行业的现状,行业运行数据,行业供需,行业竞争格局,重点企业经营分析,行业产业链进行分析,对市场的发展状况、供需状况、竞争格局、赢利水平、发展趋势等进行了分析,预测行业的发展前景和投资价值。在周密的市场调研基础上,通过最深入的数据挖掘,从多个角度去评估企业市场地位,准确挖掘企业的成长性,为企业提供新的投资机会和可借鉴的操作模式,对欲在行业从事资本运作的经济实体等单位准确了解目前行业发展动态,把握企业定位和发展方向有重要参考价值。报告还对下游行业的发展进行了探讨,是企业、投资部门、研究机构准确了解目前中国市场发展动态,把握行业发展方向,为企业经营决策提供重要参考的依据。 Report Directory报告目录 第一章研究范围界定及市场特征分析 第一节CPU芯片分类及应用 一、CPU芯片分类 二、CPU芯片应用

CPU与简单模型机设计 实验报告汇总

计算机科学与技术系 实验报告 专业名称计算机科学与技术 课程名称计算机组成与结构 项目名称 CPU与简单模型机设计实验 班级 学号 姓名 同组人员无 实验日期 2015-11-15

一、实验目的 1.掌握一个简单CPU的组成原理; 2.在掌握部件单元电路的基础上,进一步将其构造一台基本模型计算机; 3.为其定义五条机器指令,编写相应的微程序,并上机调试掌握整机概念。 二、实验逻辑原理图与分析 2.1 实验逻辑原理图及分析 本实验要实现一个简单的CPU,并且在此CPU的基础上,继续构建一个简单的模型计算机。CPU由运算器(ALU)、微程序控制器(MC)、通用寄存器(RO)、指令寄存器(IR)、程序计数器(PC)和地址寄存器(AR)组成,如图下图所示。这个CPU在写入相应的微指令后,就具备了执行机器指令的功能,但是机器指令一般存放在主存当中,CPU必须和贮存挂接后,才有实际的意义,所以还需要在该CPU的基础上增加一个主存和基本的输入输出部件,以构成一个简单的模型计算机。 基本CPU构成原理图 系统的程序计数器(PC)和地址寄存器(AR)集成在一片CPLD芯片中。CLR连接至CON单元的纵情断CLR,按下CLR按钮,将是PC清零,LDPC和T3相与后作为计数器的计数时钟,当LOAD为低时,计数时钟到来后将CPU内总线的数据打入PC。 程序计数器(PC)原理图

2.2 逻辑原理图分析 本模型机;和前面微程序控制器实验相比,新增加一条跳转指令JMP,供有五条指令:IN(输入)、ADD(二进制加法)、OUT(输出)、JMP(无条件转移)、HLT(停机)、其指令格式瑞霞(高4为为操作码): 其中JMP为双字节指令,其余均为单字节指令,********为addr对应的二进制地址码。微程序控制器实验的指令是通过手动给出的,现在要求CPU自动从存储器读取指令并执行。 系统涉及到的微程序流程如下图所示,当拟定“取指”微指令时,该微指令的判别测试字段为P<1>测试。由于“取指”微指令是所有微程序都使用的公用微指令,因此P<1>的测试结果出现多分支。本机用指令寄存器的高6位(IR7—IR2)作为测试条件,出现5路分支,占用5个固定为地址单元,剩下的其他地方就可以一条微指令占用控制一个微地址单元随意填写,微程序流程图上的但愿地址为16进制。 当全部为程序设计完毕后,应将每条微指令代码化,下表即为将下图的微程序流程图按微指令格式转化而成的“二进制微代码表”。 简单模型机微程序流程图

哈工大CPU设计报告

计算机设计与实践CPU设计报告

指令格式设计: 注:Ri代表3位该寄存器号的二进制表示,X,sign为8位立即数,add为8为地址

一整体框图

二各模块详细说明(数据流关系、接口说明) 1 时钟管理模块 1.1结构框图: 1.2功能描述:时钟模块为一节拍发生器,以输入时钟信号作为触发,四个节拍循环往复,当“rst”为1时节拍复位。 1.3数据流关系: 1.4接口说明: port( rst: in std_logic; --复位信号 clk: in std_logic; --输入时钟信号 k: out std_logic_vector(3 downto 0) --节拍输出 ); 2 取址模块 2.1 visit_mem_flag pc_out ir_out 2.2功能描述:取指模块主要负责取指操作,当复位信号为1时,pc置零;若pc更新标志(pc_in_flag)为1,则更新当前的pc值;在第一个节拍,将当前pc给到访存控制模块,同时送访存请求信号(visit_mem_flag),取得指令;同时将取得的指令送往运算模块、回写模块,pc送往回写模块。

2.3数据流关系: Port (rst: in std_logic; --复位 k0,k1: in std_logic; --节拍控制 pc_in_flag: in std_logic; --PC回写允许 ir_in : in std_logic_vector(15 downto 0); --IR进入 pc_in : in std_logic_vector(15 downto 0); --PC回写 visit_mem_flag: out std_logic; --访存信号 pc_out : out std_logic_vector(15 downto 0); --PC输出 ir_out : out std_logic_vector(15 downto 0) --IR输出 ); 3 运算模块 3.1结构框图: 3.2功能描述:复位信号为1时,alutou、addr、Cy、Z清零;当回写信号为1时,将回写的数据回写入寄存器中;在第二节拍完成指令的译码工作,并根据译码结果置if_reg(是否更新寄存器),if_pc(是否更新PC),m_r(是否读请求),m_w(是否写请求)四个标志位,并对相关的指令置好addr、aluout和ToHX,以及对一些改变运算标志位的指令置好Cy和Z这两个标志位。

设计报告(电子版)

单片机应用设计实践报告 课程名称:单片机应用设计实践 设计题目:带温度显示的数字万年历设计 院(部):计算机与信息工程学院 学生姓名:******* 学号:************ 专业班级:************ 指导教师:******* 贵州 贵阳 年月日

课程设计任务书 设计题目万年历 学生姓名**** 所在院系***** 专业、年级、班*********** 设计要求: 1、设计制作一个用LCD1602显示的带温度显示的万年历; 2、具有年、月、日、星期、时、分、秒、温度等显示功能; 3、具备年、月、日、星期、时、分、秒校准功能; 4、具有闹钟显示、调节设定、整点鸣叫功能。 学生应完成的工作:设计万年历的工作原理,利用DXP 软件绘制电路原理图,利用Keil uVision4软件编写C语言程序并且生成HEX文件。并设计制作电路的PCB板(或万用板的元件布局和连线)。根据设计原理对电路进行安装、调试,完成课程设计工作,并提交课程设计报告。 参考文献阅读: 51单片机原理与应用案例教程(C51编程)p170的 9.1.2 LCD1602液晶应用实例 工作计划:*月*号:搜集资料;*月*号:方案论证拟定硬件方案;*月*号:讨论优化并确定硬件方案;*月*号—*号:讨论并确定程序流程并绘制流程图;*月*号:根据流程图编写程序并且进行软件的仿真与调试;*月*号—*号:硬件电路的制作并撰写课程设计报告;*月*号:烧录程序并调试;*月*号:完成课程设计报告的撰写。 任务下达日期:2017年11月30 日 任务完成日期:2017年11月01 日 指导教师(签名):学生(签名):田应焕

计算机组成原理课程设计微程序设计报告书

计算机组成原理课程设计微程序设计 报告书

课程设计指导教师评定成绩表

指导教师评定成绩: 指导教师签名: 年月日 重庆大学本科学生课程设计任务书

指导教师 (签名) 学生 (签名) 说明:1、学院、专业、年级均填全称,如:光电工程学院、测控技术、。 2、本表除签名外均可采用计算机打印。本表不够,可另附页,但应在页脚添加页码。 计算机组成原理课程设计报告书 一、设计目的: 综合运用所学过的计算机原理知识,设计并实现较为完整的计算机。 掌握运用计算机原理知识解决问题和设计指令程序的能力。经过课程设计的综合训练,培养实际分析问题,编写程序指令和动手能力、团队协作精神,帮助学生系统掌握计算机组成原理课程的主要内容。二、设计要求: 设计要求: 用微程序控制器实现以下指令功能 调用:CALL addr ;指令功能与80X86相同,addr是8位二进制地址 返回:RET ; 存储器到存储器传送: MOV memi , memj ; memi (memj), i<>j,memi内存单元地址带右移的加法运算: ADD Ri , Rj , N ; Ri (Ri)+(Rj)>>N ,Rj中内容不变 N=0-7根据模型计算机的数据路径以及微程序控制器的工作原理,设计各指令格式以及编码,并实现各机器指令微代码,根据定义的机器指

令,自拟编写包含以下指令的应用程序。 三、微程序控制器的原理: A.微程序控制的基本思想: 1. 若干微命令编制成一条微指令,控制实现一步操作; 2. 若干微指令组成一段微程序,解释执行一条机器指令; 3. 微程序事先存放在控制存储器中,执行机器指令时再取出。 B.基本组成:控制存储器,微指令寄存器,微地址寄存器,地址转移 逻辑框图: 图1 微程序控制器组成原理框图 控制存储器(CM):用来存放实现全部指令系统的微程序,位于CPU 中。它是一种只读型存储器,要求速度快,读出周 期短 微指令寄存器:存放当前由控制存储器读出的一条微指令信息,分为 微地址寄存器和微命令寄存器两个部分。其中微地址

计算机组成原理CPU设计

1C P U的用途 字长:8位 D[7…0] 寻址范围:64byte,2的6次方=64,A[5…0] 2 确定ISA(包括程序员可访问的寄存器) 1)程序员可访问的寄存器 AC—8位累加器 为了确定CPU的状态图,对每条指令作以下分析 1)从存贮器中取指令(所有指令均相同) 原理:在CPU能执行指令之前,它必须从存贮器中取出,CPU通过执行如下的操作序列完成这个任务 A)选择存贮单元由A[5…0]确定 B)对工A[5…0]译码,延迟,并向存贮器发一个信号使存贮器将此指令输出到它的输出引脚。这些引脚与CPU的D[7…0]相连。CPU从这些引脚读入数据。 具体操作:(分为三个状态) A)要取的指令的地址存放在程序计数器(PC)中。第一步就是把PC的内容拷贝到AR中。 FETCH1:AR←PC B)CPU必须从存贮器中读取指令,为此CPU必须发一个READ信号到器的RD (RD-RAM,相对于OE-ROM)端上使存贮器将数据发送到D[7…0]上,存入CPU的 DR寄存器中。同时实现PC←PC+1,为取下一条指令作准备。 FETCH2:DR←M,PC←PC+1 C)作为取指令的一部分,CPU还必须完成两件事。 ①DR的高2位拷贝到IR,目的是确定指令的功能 ②DR的低6位拷贝到AR,目的: a. 对于ORT和SUB1指令这6 位包含了指令的一个操作数的存贮器地址 (一个数已经在AC) b. 对于COM和JREL,它们不需要再次访问存贮器,一旦它们返回到 FETCH1周期,FETCH1将把PC的值装到AR,覆盖无用的值。 FETCH3:IR←DR[7,6], AR←DR[5…0] 取指令周期的状态图

计算机组成原理CPU设计

1 CPU的用途 字长:8位 D[7…0] 寻址范围:64byte,2的6次方=64,A[5…0] 2 确定ISA(包括程序员可访问的寄存器) 1)程序员可访问的寄存器 AC—8位累加器 CPU的指令集(共4条) 2)其他寄存器 3 CPU设计状态图 为了确定CPU的状态图,对每条指令作以下分析 1)从存贮器中取指令(所有指令均相同) 原理:在CPU能执行指令之前,它必须从存贮器中取出,CPU通过执行如下的操作序列完成这个任务 A)选择存贮单元由A[5…0]确定 B)对工A[5…0]译码,延迟,并向存贮器发一个信号使存贮器将此指令输出到它的输出引脚。这些引脚与CPU的D[7…0]相连。CPU从这些引脚读入 数据。 具体操作:(分为三个状态)

A)要取的指令的地址存放在程序计数器(PC)中。第一步就是把PC的内容拷贝到AR中。 FETCH1:AR←PC B)CPU必须从存贮器中读取指令,为此CPU必须发一个READ信号到器的RD (RD-RAM,相对于OE-ROM)端上使存贮器将数据发送到D[7…0]上,存入CPU的DR寄存器中。同时实现PC←PC+1,为取下一条指令作准备。 FETCH2:DR←M,PC←PC+1 C)作为取指令的一部分,CPU还必须完成两件事。 ①DR的高2位拷贝到IR,目的是确定指令的功能 ②DR的低6位拷贝到AR,目的: a. 对于ORT和SUB1指令这6 位包含了指令的一个操作数的存贮器 地址(一个数已经在AC) b. 对于COM和JREL,它们不需要再次访问存贮器,一旦它们返回到 FETCH1周期,FETCH1将把PC的值装到AR,覆盖无用的值。 FETCH3:IR←DR[7,6], AR←DR[5…0] 取指令周期的状态图 2) 本CPU有四条指令,因此有四个不同的执行同期,为此用IR中的值来确定即可。

32位MIPS处理器设计实验报告

数字逻辑与处理器基础实验 32位MIPS处理器设计实验报告 王晗 (2013011076) July26,2015 Date Performed:July15,2015 Partners:耿天毅(2012011119) 陈志杰withdrawn 1实验目的 熟悉现代处理器的基本工作原理;掌握单周期和流水线处理器的设计方法。 2设计方案 2.1总体结构 由于这次实验涉及的功能较多,我们将完整的CPU分成多个模块。指令存储器、寄存器堆、控制器、ALU控制器、ALU、数据存储器、UART等功能单元均在单独的Module中实现。其中指令存储器、寄存器堆、控制器、ALU控制器、ALU等单元在Single Cycle Core中实例化,作为单周期处理器的核心;数据存储器、UART和定时器、LED、七段数码管、开关在Peripheral中实现,作为处理器的外设。处理器核心和外设在顶层模块中实例化,互相通信。 单周期CPU模块的结构关系如Figure1所示:

Figure1:单周期处理器结构 对于流水线CPU,我们还在Pipeline Core中加入了流水线寄存器、冒险检测单元、数据转发单元: Figure2:流水线处理器结构

2.2ALU1 ALU模块的结构如图所示,输入两个操作数A、B和控制信号ALUFun、Signed,在ARITH子模块中做加减法运算,CMP子模块根据ARITH模块的输出进行比较判断,LOGIC和SHIFT模块分别进行逻辑运算和移位运算,ALUFun的最高两位用于控制多路选择器的输出。 Figure3:ALU结构 ARITH模块ARITH模块中包括减法和加法两个模块,加法模块直接通过+号运算,减法模块先对第二个操作数取补码,再调用加法模块做加法运算。Overflow和Negative信号的产生是ALU中的难点: Figure4:ADD中的Overflow和Negative 1原作者:陈志杰;修改:王晗

8位CPU设计与实现

计 算 机 组 成 原 理 论 文 姓名:某某 班级:计科一班学号:

8位CPU的设计与实现论文 CPU 的主要功能是执行指令,控制完成计算机的各项操作,包括运算操作、传送操作、输入/输出操作等。作为模型计算机设计,将重点放在寄存器组,采取较简单的组成模式,以尽量简洁的设计帮助读者掌握CPU 的基本原理。 此次设计CPU就是为了了解CPU运行的原理,从而完成从指令系统到CPU 的设计,并且通过仿真对CPU设计进行正确性评定。 关键词:CPU,设计指标,电路原理图,运算部件,寄存器组,模型 机指令系统,微命令序列,数据通路 1. 设计的任务与要求 1.1设计指标 1. 能实现IN(输入)、ADD(二进制加法)、STA(存数)、OUT(输出)、 JMP(无条件转移)这五种指令; 2. 整个系统能正常稳定工作。 1.2 设计要求 1. 画出电路原理图; 2.写出设计的全过程,附上有关资料和图纸(也可直接写在相关章节中), 有心得体会。 2. 方案论证与选择 2.1 CPU的系统方案

CPU 主要由算术逻辑单元ALU,数据暂存寄存器DR1、DR2,数据寄存器R0~R2,程序计数器PC,地址寄存器AR,程序/数据存储器MEMORAY,指令寄存器IR,微控制器uC,输入单元INPUT 和输出单元OUTPUT 所组成。图中虚线框内部分包括运算器、控制器、程序存储器、数据存储器和微程序存储器等,实测时,它们都可以在单片FPGA 中实现。虚线框外部分主要是输入/输出装置,包括键盘、数码管、LCD 显示器等,用于向CPU 输入数据,或CPU 向外输出数据,以及观察CPU 内部工作情况及运算结果。 1.运算部件 运算部件的任务是对操作数进行加工处理。主要由三部分组成: (1)输入逻辑。(2)算术/逻辑运算部件ALU。(3)输出逻辑 2.寄存器组 计算机工作时,CPU 需要处理大量的控制信息和数据信息。例如对指令信息进行译码,以便产生相应控制命令对操作数进行算术或逻辑运算加工,并且根据运算结果决定后续操作等。因此,在CPU 中需要设置若干寄存器,暂时存放这些信息。在模型CPU中,寄存器组由R0、R1、R2 所组成。 3.指令寄存器指令寄存器(IR) 指令寄存器指令寄存器(IR)用来存放当前正在执行的指令,它的输出包括操作码信息、地址信息等,是产生微命令的主要逻辑依据。 4.程序计数器程序计数器(PC) 程序计数器程序计数器也称指令指针,用来指示指令在存储器中的存放位置。当程序顺序执行时,每次从主存取出一条指令,PC 内容就增量计数,指向下一条指令的地址。增量值取决于现行指令所占的存储单元数。如果现行指令只占一个存储单元,则PC 内容加1;若现行指令占了两个存储单元,那么PC 内容就要加2。当程序需要转移时,将转移地址送入PC,使PC 指向新的指令地址。因此,当现行指令执行完,PC 中存放的总是后续指令的地址;将该地址送往主存的地址寄存器AR,便可从存储器读取下一条指令。 5.地址寄存器 CPU 访问存储器,首先要找到需要访问的存储单元,因此设置地址寄存器(AR)来存放被访单元的地址。当需要读取指令时,CPU 先将PC 的内容送入AR,再由AR将指令地址送往存储器。当需要读取或存放数据时,也要先将该数据的有效地址送入AR,再对存储器进行读写操作。 6.标志寄存器 标志寄存器F是用来记录现行程序的运行状态和指示程序的工作方式的,标志位则用来反映当前程序的执行状态。一条指令执行后,CPU 根据执行结果设置相应特征位,作为决定程序流向的判断依据。例如,当特征位的状态与转移条件符合时,程序就进行转移;如果不符合,则顺序执行。在后面将要介绍的较复杂模型计算机设计中设置了两个标志位:进位Fc、零位Fz。 7.微指令产生部件 实现信息传送要靠微命令的控制,因此在CPU 中设置微命令产生部 件,根据控制信息产生微命令序列,对指令功能所要求的数据传送进行控 制,同时在数据传送至运算部件时控制完成运算处理。 微命令产生部件可由若干组合逻辑电路组成,也可以由专门的存储逻辑组成。产生微命令的方式可分为组合逻辑控制方式和微程序控制方式两种。在本章所介绍的8 位模型CPU 设计中,采用微程序控制方式通过微程序控制器和微指令

相关主题
文本预览
相关文档 最新文档