2
C3PU: A 16-BIT SOFT-CORE PROCESSOR (1) Lycée Toulouse-Lautrec, Toulouse, France (2) XV. gi mnazija, Za greb, Cr oatia (3) III. gimnazija, Osijek, Croatia (4)Ruđer Bošković Institute/Centre for Informatics and Computing, Zagreb, Croatia Introduction A processor is a small chip that can be found in electronic devices whose job is to receive input and provide the appropriate output. The main goal of this project was to design and implement a 16-bit soft-core CPU using FPGA boa rd and VHDL langua ge. We des igned al l the component s of our CPU, and checked if the y wor k separately. We also defined our assembly language and implemented two assemblers that translate our assembly code to the CPUs machine code. Simon Cossart  1 , Filip Keri  2 , Luka Kovač  3 and Ivan Sović  4 FPGA board Spartan 3-AN model Chip Power Connectionwith the computer Example of an output Example of an input FPGAs are logic devices that contain configurable logic blocks( CLBs ) and connections between them. CLBs can perform any logic operation we want   we have to define which one( unlik e hard- core CPU, which isn’t  so reconfigurable ). Since we have many empty CLBs, we are able to make a complex logic design su ch as CPU. C3PU how it works? Memory ( program+data ) RESET FETCH DECODE EXECUTE Puts the zero value in all the registers Retrieves commands from RAM on the address from PC register Checks the opcode of retrieved command Performs the instruction CPU’s finite state machine (pipeline) AL U operatio ns opcod e AND c= a and b 01001 OR c = a or b 01010 NOT c = not a 01100 XOR c = a xor b 01011 ADD c = a + b 01101 SUB c = a  b 01110 INC c = a+ 1 00111 DEC c = a  1 01100 ZERO c = 0 01111 Shift er oper ation s opco de SHL Sh ift1 bi t to the left 10000 SHR Sh ift1 bit to the right 10001 ROTR Rotat e 1 bit to the right 10010 ROT L Rot ate 1 bit to the left 10011 Control operations NOP 00000 LOAD 00 001 MOV 00011 LOA DI 00100 JMPI 00101 JMPC I 00110 END 10110 Sample command: 00011_00000_001_010 Results We made a code for our processor to make a Fibonacci sequence. It was ran through the assembly, and then we put the machine code inthe memory of our C3PU. assembly Our simulation results showed us the expected sequence, so we can say that our processor works. Conclusion We reached our goal in designing a soft-core CPU. The simulation results proved that our processor works. In the future we want to include I/O components to our design, so our C3PU is more practical. Acknowledgements Authors would like to thank the Society for Out-of-Frame Education, as well as the organizers and participants of the Summer Sch ool of Sci ence 2013 in Požega  for endorsing and supporting this project.

elmar1

Embed Size (px)

Citation preview

Page 1: elmar1

7/27/2019 elmar1

http://slidepdf.com/reader/full/elmar1 1/1

C3PU: A 16-BIT SOFT-CORE PROCESSOR

(1) Lycée Toulouse-Lautrec, Toulouse, France (2) XV. gimnazija, Zagreb, Croatia (3) III. gimnazija, Osijek, Croatia (4) Ruđer Bošković Institute/Centre for Informatics and Computing, Zagreb, Croatia

Introduction

A processor is a small chip that can be found in electronic

devices whose job is to receive input and provide theappropriate output. The main goal of this project was to

design and implement a 16-bit soft-core CPU using FPGA

board and VHDL language. We designed all the

components of our CPU, and checked if they work

separately. We also defined our assembly language and

implemented two assemblers that translate our assembly

code to the CPUs machine code.

Simon Cossart(1), Filip Keri(2), Luka Kovač(3) and Ivan Sović(4)

FPGA board

Spartan 3-AN model

Chip

Power

Connection withthe computer

Example ofan output

Example ofan input

FPGAs are logic devices that contain configurable logic

blocks( CLBs ) and connections between them. CLBs can

perform any logic operation we want – we have to define

which one( unlike hard-core CPU, which isn’t so

reconfigurable ). Since we have many empty CLBs, we are

able to make a complex logic design such as CPU.

C3PU – how it works?

Memory( program+data )

RESETFETCH

DECODE

EXECUTE

Puts the zero valuein all the registers

Retrieves commands fromRAM on the address

from PC registerChecks the opcode

of retrieved commandPerforms the instruction

CPU’s finite state machine (pipeline)

ALU operations opcode

AND c = a and b 01001

OR c = a or b 01010

NOT c = not a 01100

XOR c = a xor b 01011

ADD c = a + b 01101

SUB c = a – b 01110

INC c = a + 1 00111

DEC c = a  – 1 01100

ZERO c = 0 01111

Shifter operations opcode

SHL Shi ft1 b it to

the left

10000

SHR Shi ft1 b it to

the right

10001

ROTR Rotate 1 bit

to the right

10010

ROTL Rotate 1 bit

to the left

10011

Control

operations

NOP 00000

LOAD 0 00 01

MOV 00011

L OA DI 0 01 00

JMPI 00101

J MP CI 0 01 10

END 10110

Sample command: 00011_00000_001_010

Results

We made a code for our processor to make a Fibonacci

sequence. It was ran through the assembly, and then weput the machine code inthe memory of our C3PU.

assembly

Our simulation results showed us the expected sequence,

so we can say that our processor works.

Conclusion

We reached our goal in designing a soft-core CPU. The

simulation results proved that our processor works. In the

future we want to include I/O components to our design,

so our C3PU is more practical.

Acknowledgements

Authors would like to thank the Society for Out-of-Frame

Education, as well as the organizers and participants of

the Summer School of Science 2013 in Požega for

endorsing and supporting this project.