Fangfang Yuan, Stephen Wright , Kerstin Eder, David May

21
Fangfang Yuan, Stephen Wright, Kerstin Eder, David May Department of COMPUTER SCIENCE Managing Complexity through Abstraction: A refinement-based approach to formalize Instruction Set Architectures

description

Fangfang Yuan, Stephen Wright , Kerstin Eder, David May . Managing Complexity through Abstraction:. A refinement-based approach to formalize Instruction Set Architectures. Department of COMPUTER SCIENCE. Instruction Set Architecture. Instructions Basic data types - PowerPoint PPT Presentation

Transcript of Fangfang Yuan, Stephen Wright , Kerstin Eder, David May

Page 1: Fangfang  Yuan,  Stephen Wright , Kerstin Eder, David May

Fangfang Yuan, Stephen Wright, Kerstin Eder, David May

Department of COMPUTER SCIENCE

Managing Complexity through Abstraction:

A refinement-based approach to formalize

Instruction Set Architectures

Page 2: Fangfang  Yuan,  Stephen Wright , Kerstin Eder, David May

Instruction Set Architecture

• Instructions• Basic data types

• Register file definition• Memory space(s) definition

• Exception handing

Page 3: Fangfang  Yuan,  Stephen Wright , Kerstin Eder, David May

ARM: SMLALD

Page 4: Fangfang  Yuan,  Stephen Wright , Kerstin Eder, David May

XS1: LMUL

Page 5: Fangfang  Yuan,  Stephen Wright , Kerstin Eder, David May

Motivation

• Assembler programming

• Spec for design verification

• ISA evolution

• Tools development

Page 6: Fangfang  Yuan,  Stephen Wright , Kerstin Eder, David May

Motivation

Specification,Tools,

Software

Specification

Tools,Software

ComponentManufacturer

ProductManufacturer

3rd Party

Page 7: Fangfang  Yuan,  Stephen Wright , Kerstin Eder, David May

Formal Analysis of ISAs

Examples:• 6800 (Z)• 68020 (Nqthm)• VIPER (LCF-LSM/HOL)• DLX (PVS)• JVM (HOL,ACL2)• ARM6 (HOL)

– 6500 Lines HOL4 script

…etc, etc

Objectives:• Specification checking• Micro-architecture

verification • Binary executable

checking

Page 8: Fangfang  Yuan,  Stephen Wright , Kerstin Eder, David May

Can we do better?

Need to introduce more structure:J. P. Bowen. Formal specification and documentation of

microprocessor instruction sets. Microprocess. Microprogram.,21(1-5):223–230, 1987.

– Define a set of “easily assimilated concepts” – each “readily understandable” to – layer such a formal specification with the – aim to facilitate its construction, – to ease readability and comprehension, and – to enable re-use.

Page 9: Fangfang  Yuan,  Stephen Wright , Kerstin Eder, David May

Event-B

• Set-based• Events are guarded atomic actions

• Step-wise formal refinement–Property-preserving– Maintain consistency

• Hierarchy of abstraction levels• Mature tool support: Rodin platform

Page 10: Fangfang  Yuan,  Stephen Wright , Kerstin Eder, David May

A Fresh Approach to Formally Constructing ISAs

Objective:– Complete formal derivation of an ISA

• From first principles• Down to code generation

Method:– Rigorous use of Abstraction/Refinement

• Stepwise refinement in Event-B based on Common ISA properties

– Hierarchy of abstraction levels• Top-down “narrative” of overall functionality• Individual instructions at leaves

– Systematic use of Formal Proof

Page 11: Fangfang  Yuan,  Stephen Wright , Kerstin Eder, David May

Atomic Actions vs IF/ELSE

Event1a refines Evt1

Event1b refines Evt1

Event2 refines Evt2

Event3a refines Evt3

Event3b refines Evt3

If Guard1 Then Action1Action1

ElseIf Guard2 Then Action2

ElseIf Guard3 Then Action3

Else Guard4 Then Action4

???

?

??

Page 12: Fangfang  Yuan,  Stephen Wright , Kerstin Eder, David May

ISA Formalization Portfolio

• MIDAS – 33 instructions

Page 13: Fangfang  Yuan,  Stephen Wright , Kerstin Eder, David May

Model Structure - Reuse

Generic

ProcessorSpecific

StateMch

RegMch

MemMch

ControlFlowMch

XMch1

Reusable Formal

Modelling Framework(Template)

Page 14: Fangfang  Yuan,  Stephen Wright , Kerstin Eder, David May

ISA Formalization Portfolio

• MIDAS – 33 instructions

• CRISP – 50 instructions

• XCore – 209 instructions

Page 15: Fangfang  Yuan,  Stephen Wright , Kerstin Eder, David May

Refinements

Page 16: Fangfang  Yuan,  Stephen Wright , Kerstin Eder, David May

Benefits of Modelling Framework

• Step-wise refinement – abstraction levels– Provides structure– Remains comprehensible

• Property-preserving refinement– Maintains consistency within model– Early definition of properties

• Source for code/document generation– Animation/Simulation

• Traceability of requirements

Page 17: Fangfang  Yuan,  Stephen Wright , Kerstin Eder, David May

Summary

• Method and Framework for formal ISA Modelling and Analysis– Framework is generic (template) – Method is transferable

• Proof of concept: – MIDAS, CRISP

• 1st industrial application completed: – XCore ISA– Available from http://deploy-eprints.ecs.soton.ac.uk/346/

Page 18: Fangfang  Yuan,  Stephen Wright , Kerstin Eder, David May

Demo

!

Page 19: Fangfang  Yuan,  Stephen Wright , Kerstin Eder, David May

Tool FlowRodin

Testsuite .c

XCore

B2C

XCoreB .cSupport .c/h

MSDev

Studio

XCoreB.exe

XCoreGcc

Test .out

Page 20: Fangfang  Yuan,  Stephen Wright , Kerstin Eder, David May

Testsuite Execution

XCoreVM

Loader

Console

ServerExecutable

Text Output

Socket

Page 21: Fangfang  Yuan,  Stephen Wright , Kerstin Eder, David May

Thank you

Questions?

Department of COMPUTER SCIENCE