Cored Programming Building Systems on Your Own Soft Core OR Blurring the Hardware / Software Interface Klaus.Schleisiek AT freenet.de www.microcore.org.

Slides:



Advertisements
Similar presentations
Intel 8086.
Advertisements

Virtual Memory. Invented on Manchester atlas 1962 It embodied many pioneering features, which we now take for granted. These include system features such.
CPU Structure and Function
Structured Programming Dr. Atif Alhejali Lecture 4 Inheritance 1Structured Programming.
Computer Science Department FTSM Algorithm Knowledge: Understand algorithm representation using flowchart and pseudocode Skill: Map problem to solution.
ARM versions ARM architecture has been extended over several versions.
Cosc 2150: Computer Organization
Control Structure: Loop (Part 1) Knowledge: Understand the various concepts of loop control structure Skill: Be able to develop a program involving loop.
Chapter 3 Instruction Set Architecture Advanced Computer Architecture COE 501.
ISA Issues; Performance Considerations. Testing / System Verilog: ECE385.
Advanced Pipelining Optimally Scheduling Code Optimally Programming Code Scheduling for Superscalars (6.9) Exceptions (5.6, 6.8)
9/20/6Lecture 3 - Instruction Set - Al Instruction Set.
1/1/ / faculty of Electrical Engineering eindhoven university of technology Architectures of Digital Information Systems Part 1: Interrupts and DMA dr.ir.
Chapter 2 HARDWARE SUMMARY
Processor System Architecture
Set 20 Interrupts. INTERRUPTS The Pentium has a mechanism whereby external devices can interrupt it. Devices such as the keyboard, the monitor, hard disks.
By Tien Phung CS 147 Dr. Sin-Min Lee. High-level Languages Assembly Languages Machine Languages.
Recap – Our First Computer WR System Bus 8 ALU Carry output A B S C OUT F 8 8 To registers’ input/output and clock inputs Sequence of control signal combinations.
Choice for the rest of the semester New Plan –assembler and machine language –Operating systems Process scheduling Memory management File system Optimization.
Computer System Organization S H Srinivasan
Microprocessors Introduction to RISC Mar 19th, 2002.
Introduction to Computer Engineering by Richard E. Haskell Interrupts Module M17.3 Sections 11.3, 14.1.
Group 5 Alain J. Percial Paula A. Ortiz Francis X. Ruiz.
Embedded System Design Center Sai Kumar Devulapalli ARM7TDMI Microprocessor Thumb Instruction Set.
© 2009, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction  Purpose:  This course provides an overview of the SH-2 32-bit RISC.
Memory Addressing Byte ( 8 bits) – smallest addressable unit in memory Bytes:
Machine Instruction Characteristics
PC Assembler Ing. E.E. Mak MSc. Cluster1 Introduction Microprocessors Numbers, Binary, Hexadecimal, ASCII Adding and subtracting Instructions and Flags.
Prepared by Eng. Musa Alyaman1 Chapter Seven Chapter Seven PIC16F87x.
Processor Design ELEC 418 Advanced Digital Systems Dr. Ron Hayne Images Courtesy of Thomson Engineering.
Atmel Atmega128 Overview ALU Particulars RISC Architecture 133, Mostly single cycle instructions 2 Address instructions (opcode, Rs, Rd, offset) 32x8 Register.
What is µP? “An integrated circuit containing … a central processing unit (CPU) and a means to access external memory” -- (Ball 2000)
CSNB374: Microprocessor Systems Chapter 5: Procedures and Interrupts.
Microprocessors The ia32 User Instruction Set Jan 31st, 2002.
8085. Microcomputer Major components of the computer - the processor, the control unit, one or more memory ICs, one or more I/O ICs, and the clock Major.
Lecture Set 4 Programming the 8051.
DIGITAL SIGNAL PROCESSORS. Von Neumann Architecture Computers to be programmed by codes residing in memory. Single Memory to store data and program.
Topics covered: Instruction Set Architecture CSE243: Introduction to Computer Architecture and Hardware/Software Interface.
October 1, 2003Serguei A. Mokhov, 1 SOEN228, Winter 2003 Revision 1.2 Date: October 25, 2003.
Execution Architecture MTT CPU08 Core M CPU08 INTRODUCTION.
Picoblaze Overview EENG Introduction 8-bit microcontroller for Xilinx devices Soft Core – Soft Processor 5% of the resources of spartan 3 (3S200.
Architectural Considerations A Review of Some Architectural Concepts.
بسم الله الرحمن الرحيم MEMORY AND I/O.
8085 INTERNAL ARCHITECTURE.  Upon completing this topic, you should be able to: State all the register available in the 8085 microprocessor and explain.
Architectures of Digital Information Systems Part 1: Interrupts and DMA dr.ir. A.C. Verschueren Eindhoven University of Technology Section of Digital.
UNIT – Microcontroller.
Anton Burtsev February, 2017
Introduction to microprocessor (Continued) Unit 1 Lecture 2
Introduction of microprocessor
Machine control instruction
Assembly Language Programming Part 2
Intel 8088 (8086) Microprocessor Structure
Falcon-E : Introduction
DSP56800E System Architecture
Introduction to Assembly Chapter 2
Intel 8088 (8086) Microprocessor Structure
Chapter 8 Central Processing Unit
Microprocessors And Microcontrollers
Instruction encoding We’ve already seen some important aspects of processor design. A datapath contains an ALU, registers and memory. Programmers and compilers.
Introduction to Assembly Chapter 2
Review.
Midterm 2 review Chapter
Instruction encoding We’ve already seen some important aspects of processor design. A datapath contains an ALU, registers and memory. Programmers and compilers.
ECE 352 Digital System Fundamentals
CS501 Advanced Computer Architecture
Lecture 5: Pipeline Wrap-up, Static ILP
Register sets The register section/array consists completely of circuitry used to temporarily store data or program codes until they are sent to the.
Computer Operation 6/22/2019.
Interrupts and System Calls
Presentation transcript:

Cored Programming Building Systems on Your Own Soft Core OR Blurring the Hardware / Software Interface Klaus.Schleisiek AT freenet.de

Klaus Schleisiek 21C3 Cored Programming2 Topics Architecture Opcodes Co-Design Environment Debug Environment Geolon-MCS (a concrete product) Interrupts and Exceptions Special Instructions Scalability Prototyping Board Licensing Next Steps

Klaus Schleisiek 21C3 Cored Programming3

Klaus Schleisiek 21C3 Cored Programming4 uCore Architecture Dual Stack Forth oriented instruction set Harvard Prefix Code (Transputer Style) Scalable data width Object code compatibility Interrupt after every instruction Exception hardware mechanism for multi tasking

Klaus Schleisiek 21C3 Cored Programming5 uCore 1.20 Opcodes by Functionality NEVER NONE BRA Op: nop( -- ) Unary Operators NOT BOTH ALU Op: invert( n1 -- n2 ) SL BOTH ALU Op: 2*( n1 -- n2 ) ASR BOTH ALU Op: 2/( n1 -- n2 ) LSR BOTH ALU Op: u2/( n1 -- n2 ) ROR BOTH ALU Op: ror( n1 -- n2 ) ROL BOTH ALU Op: rol( n1 -- n2 ) ZEQU BOTH ALU Op: 0=( n1 -- flag ) CC BOTH ALU Op: cc( -- )

Klaus Schleisiek 21C3 Cored Programming6 uCore 1.20 Opcodes by Functionality Binary operators ADD POP ALU Op: +( n1 n2 -- n1+n2 ) ADC POP ALU Op: +c( n1 n2 -- n1+n2+carry ) SUB POP ALU Op: -( n1 n2 -- n1-n2 ) SSUB POP ALU Op: swap-( n1 n2 -- n2-n1 ) AND POP ALU Op: and( n1 n2 -- n1_and_n2 ) OR POP ALU Op: or( n1 n2 -- n1_or_n2 ) XOR POP ALU Op: xor( n1 n2 -- n1_xor_n2 ) ADD PUSH ALU Op: 2dup +( n1 n2 -- n1 n2 n1+n2 ) ADC PUSH ALU Op: 2dup +c( n1 n2 -- n1 n2 n1+n2+carry ) SUB PUSH ALU Op: 2dup -( n1 n2 -- n1 n2 n1-n2 ) SSUB PUSH ALU Op: 2dup swap-( n1 n2 -- n1 n2 n2-n1 ) AND PUSH ALU Op: 2dup and( n1 n2 -- n1 n2 n1_and_n2 ) OR PUSH ALU Op: 2dup or( n1 n2 -- n1 n2 n1_or_n2 ) XOR PUSH ALU Op: 2dup xor( n1 n2 -- n1 n2 n1_xor_n2 )

Klaus Schleisiek 21C3 Cored Programming7 uCore 1.20 Opcodes by Functionality Complex Math Steps MULTS NONE ALU Op: mults( u1 u2 -- u1 u3 ) 0DIVS NONE ALU Op: 0divs( ud1 u2 -- u2 u3 ) UDIVS NONE ALU Op: udivs( u2 u3 -- u2 u3' ) LDIVS NONE ALU Op: ldivs( u2 u3 -- u2 u3' ) Stack manipulation DUP PUSH BRA Op: dup( n -- n n ) QDUP PUSH BRA Op: ?dup( n -- n n | 0 ) NEVER BOTH BRA Op: drop( n -- ) SWAPS NONE ALU Op: swap( n1 n2 -- n2 n1 ) NOS PUSH ALU Op: over( n1 n2 -- n1 n2 n1 ) NOS POP ALU Op: nip( n1 n2 -- n2 ) RSTACK BOTH MEM Op: r>( -- n ) RSTACK NONE MEM Op: >r( n -- ) TOR BOTH MEM Op: -- n ) TOR NONE MEM Op: r!( n -- )

Klaus Schleisiek 21C3 Cored Programming8 uCore 1.20 Opcodes by Functionality Registers STATUS BOTH MEM Op: -- status ) STATUS NONE MEM Op: status!( status -- ) RSP BOTH MEM Op: -- rstack_addr ) RSP NONE MEM Op: rsp!( rstack_addr -- ) DSP BOTH MEM Op: -- dstack_ptr ) DSP NONE MEM Op: dsp!( dstack_ptr -- ? ) Data Memory access N PUSH MEM Op: +ld( addr -- n addr+i ) N POP MEM Op: +st( n addr -- addr+i ) LOCAL BOTH MEM Op: +lld( i -- n rstack+i ) LOCAL NONE MEM Op: +lst( n i -- rstack+i ) TASK BOTH MEM Op: +tld( i -- n task+i ) TASK NONE MEM Op: +tst( n i -- task+i )

Klaus Schleisiek 21C3 Cored Programming9 uCore 1.20 Opcodes by Functionality Exits ALWAYS NONE BRA Op: exit( -- ) ZERO NONE BRA Op: z-exit( flag -- ) NZERO NONE BRA Op: nz-exit( flag -- ) SIGN NONE BRA Op: s-exit( -- ) NSIGN NONE BRA Op: ns-exit( -- ) NOVL NONE BRA Op: no-exit( -- ) NCARRY NONE BRA Op: nc-exit( -- ) Branches ALWAYS POP BRA Op: branch( offset -- ) ZERO POP BRA Op: z-branch( offset -- ) NZERO POP BRA Op: nz-branch( offset -- ) SIGN POP BRA Op: s-branch( offset -- ) NSIGN POP BRA Op: ns-branch( offset -- ) NOVL POP BRA Op: no-branch( offset -- ) NCARRY POP BRA Op: nc-branch( offset -- )

Klaus Schleisiek 21C3 Cored Programming10 uCore 1.20 Opcodes by Functionality Calls ALWAYS BOTH BRA Op: call( offset -- ) ZERO BOTH BRA Op: z-call( offset -- ) NZERO BOTH BRA Op: nz-call( offset -- ) SIGN BOTH BRA Op: s-call( offset -- ) NSIGN BOTH BRA Op: ns-call( offset -- ) NOVL BOTH BRA Op: no-call( offset -- ) NCARRY BOTH BRA Op: nc-call( offset -- ) QOVL PUSH BRA Op: ?ovl( -- ) N USR Op: user_call 32 uncommitted instructions Complex Branches INT PUSH BRA Op: int( -- status ) IRET PUSH BRA Op: iret( status -- ) EXC PUSH BRA Op: exc ( -- ) TIMES PUSH BRA Op: times ( n-1 -- ) NEVER POP BRA Op: drop_flag( flag offset -- offset )

Klaus Schleisiek 21C3 Cored Programming11

Klaus Schleisiek 21C3 Cored Programming12

Klaus Schleisiek 21C3 Cored Programming13 uCore instantiation for Geolon-MCS Booting FPGA Technology Issues

Klaus Schleisiek 21C3 Cored Programming14

Klaus Schleisiek 21C3 Cored Programming15 Interrupt An event did happen that was not expected by software Exception An event did not happen that was hoped for by software The Interrupt and Exception Duality

Klaus Schleisiek 21C3 Cored Programming16 Time Services using Exceptions Traditional Method using a Timer Interrupt : ahead ( ticks -- time.ahead ) + ; : timeout? ( ticks -- ticks f ) dup - 0< ; : continue ( ticks -- ) BEGIN pause timeout? UNTIL drop ; : sleep ( ticks -- ) ahead continue ; Using an Exception : continue ( ticks -- ) Timer ! ; and now we can afford sub millisecond resolution as well

Klaus Schleisiek 21C3 Cored Programming17 Pseudo DMA Transferring 16 bit data between IDE interface and Buffer memory 0 PUSH USR Opcode: ( bufaddr -- bufaddr+1 ) 0 POP USR Opcode: ide! ( bufaddr -- bufaddr+1 ) and these types of instructions can be iterated using TIMES: $FF times loads a sector into the buffer at one transfer/cycle plus 3 cycles overhead. Repeated instructions are fully interruptible without latency.

Klaus Schleisiek 21C3 Cored Programming18 Data Encoding and Buffering, soft encoded (just appreciate its long winded complications) : split ( 32b -- l16b h16b ) dup $FFFF and swap u256/ u256/ ; : wsplit ( 16b -- l8b h8b ) dup $FF and swap u256/ ; : buf8! ( 8bit -- ) >r 2/ carry IF ld swap r> 256* or swap ! ELSE r> $FF and swap ! THEN idebuf_ptr ld swap 1+ dup [ #idebuf_top 2* ] literal u> IF idebuf_flush drop #idebuf_addr 2* THEN swap ! ; : buf16! ( 16bit -- ) wsplit buf8! buf8! ; : buf24! ( 24bit -- ) split buf8! buf16! ; : buf32! ( 32bit -- ) split buf16! buf16! ; : abs ( n -- u ) neg IF 0 swap- THEN ; : encode ( sample channel# -- ) under \ val val ch samples + \ val val addr ld >r swap r> ! \ val old store val in samples buffer under - \ val difference dup abs \ val difference |difference| dup $40 < IF drop $7f and buf8! drop EXIT THEN dup $1000 < IF drop $1FFF and $C000 or buf16! drop EXIT THEN $80000 < IF $FFFFF and $E00000 or buf24! drop EXIT THEN drop $7FFFFFF and $F or buf32! ;

Klaus Schleisiek 21C3 Cored Programming19 Data Encoding and Buffering, hardware supported 1 POP USR Opcode: buf8! ( 8b -- ) 2 POP USR Opcode: buf16! ( 16b -- ) 1 NONE USR Opcode: buf24! ( 24b -- 16b ) 2 NONE USR Opcode: buf32! ( 32b -- 16b ) ENCODE NONE ALU Opcode: tag ( sample previous -- sample code ) : encode ( val ch# -- ) samples + ld >r tag carry IF buf8! ELSE ovl IF buf32! THEN buf16! THEN r> ! ; The core can be clocked at 1/4 speed, saving 20 mW. The code is also more understandable and therefore, reliable beyond doubt ©.

Klaus Schleisiek 21C3 Cored Programming20 uCore Scalability CONSTANT data_width : NATURAL := 32; CONSTANT data_addr_width : NATURAL := 21; CONSTANT dcache_addr_width : NATURAL := 0; CONSTANT prog_addr_width : NATURAL := 19; CONSTANT pcache_addr_width : NATURAL := 0; CONSTANT prog_ram_width : NATURAL := 16; CONSTANT ds_addr_width : NATURAL := 6; CONSTANT rs_addr_width : NATURAL := 8; CONSTANT tasks_addr_width : NATURAL := 3; CONSTANT interrupts : NATURAL := 2;

Klaus Schleisiek 21C3 Cored Programming21 uCore100 Prototyping Board XC2S200 FPGA 256k x 8 program memory 256k x 32 data memory/return stack User USB port USB configuration port (to be programmed!) Umbilical Interface Centronics RS232 Lots of uncommitted I/O pins

Klaus Schleisiek 21C3 Cored Programming22 uCore Licensing uCore Exploratory License Equivalent terms to FreeBSD My Business Interest tayloring instructions certifying compatibility with the original model

Klaus Schleisiek 21C Cored Programming23 Next Steps Building a Development Community GCC backend Simulator for Windows/Linux USB Programming Interface (8051 no fun )