1 fdl 2009 forum on specification and design languages automatic transformation of rtl models from...
TRANSCRIPT
![Page 1: 1 FDL 2009 Forum on Specification and Design Languages Automatic Transformation of RTL Models from VHDL to SystemC Ralph Görgen – OFFIS Philipp A. Hartmann](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea45503460f94ba8c1b/html5/thumbnails/1.jpg)
1FDL 2009Forum on Specification and Design Languages
Automatic Transformation of RTL Modelsfrom VHDL to SystemC
Ralph Görgen – OFFISPhilipp A. Hartmann – OFFISFrank Oppenheimer – OFFISJan-Hendrik Oetjens – Robert Bosch GmbHJoachim Gerlach – Robert Bosch GmbH
![Page 2: 1 FDL 2009 Forum on Specification and Design Languages Automatic Transformation of RTL Models from VHDL to SystemC Ralph Görgen – OFFIS Philipp A. Hartmann](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea45503460f94ba8c1b/html5/thumbnails/2.jpg)
Introduction
Development processes are not only top-down … Validation Integration of IP
… and they are not seamless Co-operation of companies or company divisions
Goal: Seamless integration of RTL components into system level simulation for the safety-critical automotive domain
FDL 2009, Sophia-Antipolis2
![Page 3: 1 FDL 2009 Forum on Specification and Design Languages Automatic Transformation of RTL Models from VHDL to SystemC Ralph Görgen – OFFIS Philipp A. Hartmann](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea45503460f94ba8c1b/html5/thumbnails/3.jpg)
Common strategies
Co-simulation Requires …
… expertise in simulation hardware
… simulation environment
… source code
Manually implemented system models Time-consuming Error-prone Must be kept consistent
Automatic generation of system models
FDL 2009, Sophia-Antipolis3
![Page 4: 1 FDL 2009 Forum on Specification and Design Languages Automatic Transformation of RTL Models from VHDL to SystemC Ralph Görgen – OFFIS Philipp A. Hartmann](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea45503460f94ba8c1b/html5/thumbnails/4.jpg)
SC_MODULE ( arbiter ) { vh_in < sc_logic > clk; vh_in < sc_logic > m1_req; vh_out < int > s1_data; … SC_CTOR ( arbiter ) { SC_METHOD ( arbiter_process ) sensitive << clk;};
Matlab/Simulink A tool for …
…modeling
…simulating
…and analyzing For multi domain systems Is widely spread in the automotive domain
SystemC A set of …
…library routines
…and Macros Implemented in C++
VHDL Synthesizable Low level optimizations
SFunc-Wrapper
Modeling Environments
FDL 2009, Sophia-Antipolis4
SC_MODULE ( arbiter ) { vh_in < sc_logic > clk; vh_in < sc_logic > m1_req; vh_out < int > s1_data; … SC_CTOR ( arbiter ) { SC_METHOD ( arbiter_process ) sensitive << clk;};
ENTITY mux is port ( d1, d2, sel : in std_logic; q1 : out std_logic );END ENTITY;ARCHITECTURE struct OF mux ISBEGIN q1 <= d1 when sel = `0` else d2;END ARCHITECTURE;
BoschFDL 08
?
![Page 5: 1 FDL 2009 Forum on Specification and Design Languages Automatic Transformation of RTL Models from VHDL to SystemC Ralph Görgen – OFFIS Philipp A. Hartmann](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea45503460f94ba8c1b/html5/thumbnails/5.jpg)
Outline
Introduction
Transformation Framework
VHDL vs. SystemC
C++-Library for VHDL-Support
Resolution of Overloaded Function Calls
Evaluation of Simulation Performance
Conclusion
FDL 2009, Sophia-Antipolis5
![Page 6: 1 FDL 2009 Forum on Specification and Design Languages Automatic Transformation of RTL Models from VHDL to SystemC Ralph Görgen – OFFIS Philipp A. Hartmann](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea45503460f94ba8c1b/html5/thumbnails/6.jpg)
XML-based Transformation Framework
Allows automation of individual design steps
Definition of transformation rules Translation of transformation rules
to XSLT Automated application to design
descriptions
Supported HDLs VHDL SystemC
Transformation result is Human readable Recognizable
FDL 2009, Sophia-Antipolis6
Designflow Transformation
HDLdescription
XMLdata structure
(AST)
TransformedHDL
description
![Page 7: 1 FDL 2009 Forum on Specification and Design Languages Automatic Transformation of RTL Models from VHDL to SystemC Ralph Görgen – OFFIS Philipp A. Hartmann](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea45503460f94ba8c1b/html5/thumbnails/7.jpg)
VHDL-to-SystemC Transformation
Goal: A transformation rule that … … reads a synthesizable VHDL model and … generates an equivalent SystemC model. Transformation output should look like input.
FDL 2009, Sophia-Antipolis7
BusµP/µC
RAM
BusIF
BusIF
BusArbiter
MemoryController
BusIF
BusµP/µC
RAM
BusIF
BusIF
BusArbiter
MemoryController
BusIF
![Page 8: 1 FDL 2009 Forum on Specification and Design Languages Automatic Transformation of RTL Models from VHDL to SystemC Ralph Görgen – OFFIS Philipp A. Hartmann](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea45503460f94ba8c1b/html5/thumbnails/8.jpg)
VHDL vs. SystemC
Very similar at first sight (at RT level) Both languages offer …
… discrete event simulation
… hierarchical design (modules)
… concurrent design (processes)
… ports and signals for inter process communication
… RT level types (arbitrary integer, logic vector)
FDL 2009, Sophia-Antipolis8
![Page 9: 1 FDL 2009 Forum on Specification and Design Languages Automatic Transformation of RTL Models from VHDL to SystemC Ralph Görgen – OFFIS Philipp A. Hartmann](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea45503460f94ba8c1b/html5/thumbnails/9.jpg)
VHDL vs. SystemC: Basic Mapping
Design units Package declaration namespace Entity declaration SC_MODULE Architecture SC_MODULE derived from entity module
Object declarations Generics template parameter Ports sc_port Signals sc_signal
Statements Process statement SC_METHOD/SC_THREAD Concurrent statement equivalent process statement
FDL 2009, Sophia-Antipolis9
![Page 10: 1 FDL 2009 Forum on Specification and Design Languages Automatic Transformation of RTL Models from VHDL to SystemC Ralph Görgen – OFFIS Philipp A. Hartmann](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea45503460f94ba8c1b/html5/thumbnails/10.jpg)
VHDL vs. SystemC: Syntactical Differences
Syntactical differences i.e. …
… function declaration in another function
… array type expression in case statement
… operator precedence (unary +/- and multiply)
… non-recursive use vs. recursive using
Caused by formal C++ syntax
Solution: workaround …
… function declaration in particular namespace
… if-elsif-statement instead of case statement
… explicit order with brackets
… encapsulated namespace to hide recursive using
FDL 2009, Sophia-Antipolis10
case reg is when “001” =>
v := s1; when “011” => v := s2; …
if ( reg == “001” ) v = s1;else if ( reg == “011” ) v := s2;…
use work.p2.all;package p1 is...
use work.p1.all;entity e is... --p2 not visible
namespace p1 { namespace inner { using namespace p2; void foo(); } using inner::foo;}
![Page 11: 1 FDL 2009 Forum on Specification and Design Languages Automatic Transformation of RTL Models from VHDL to SystemC Ralph Görgen – OFFIS Philipp A. Hartmann](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea45503460f94ba8c1b/html5/thumbnails/11.jpg)
VHDL vs. SystemC: Type System
Differences arising from VHDL type system ...
… boundary checks on variable assignment
… attributes of objects and types
… constrained and unconstrained subtypes
… ascending and descending ranges that do not start with 0
… character literals as enumeration literal
… bit string literals as array objects
… aggregates
Solution: Library containing C++ templates for ... types signals and ports
… that behave and look like VHDL
FDL 2009, Sophia-Antipolis11
![Page 12: 1 FDL 2009 Forum on Specification and Design Languages Automatic Transformation of RTL Models from VHDL to SystemC Ralph Görgen – OFFIS Philipp A. Hartmann](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea45503460f94ba8c1b/html5/thumbnails/12.jpg)
Constrained integer types and subtypes
VH_INT( integer, -255, 255 );
VH_INT_SUBTYPE( natural, integer, 0, integer::high_ );
Boundary checks Operators as in VHDL
base_type_A + sub_type_A1: Correct sub_type_A1 + sub_type_A2: Correct base_type_A + base_type_B: Error
Implicit conversion of literals Attributes: high, low, left, right, next, …
struct A_desc : public int_type_desc<-255,255>{};typedef int_type<A_desc> A;
struct B_desc : public int_type_desc<-255,255>{};typedef int_type<B_desc> B;
var_A + var_B : Error
typedef int_type<-255,255> A;
typedef int_type<-255,255> B;
var_A + var_B : Correct
Integer Types
FDL 2009, Sophia-Antipolis12
![Page 13: 1 FDL 2009 Forum on Specification and Design Languages Automatic Transformation of RTL Models from VHDL to SystemC Ralph Görgen – OFFIS Philipp A. Hartmann](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea45503460f94ba8c1b/html5/thumbnails/13.jpg)
Enumeration types and subtypes
VH_ENUM( boolean ){ IDLE, RUNNING, BLOCKED };
VH_CHAR_ENUM( std_ulogic ){‘U’,‘X’,‘0’,‘1’,‘Z’,‘W’,‘L’,‘H’,‘-’};
VH_CHAR_ENUM_SUBTYPE_CONSTRAINED( x01, std_ulogic, ‘X’, ‘1’ );
Boundary checks for constrained subtypes Operators as in VHDL Implicit conversion of literals Attributes: pos, val, high, low, left, right, …
struct std_ulogic_tag { static const char[] values; };
typedef char_enum_type< std_ulogic_tag > std_ulogic;
const char std_ulogic_tag::values[] =
Enumeration Types
FDL 2009, Sophia-Antipolis13
{‘U’,‘X’,‘0’,‘1’,‘Z’,‘W’,‘L’,‘H’,‘-’};
![Page 14: 1 FDL 2009 Forum on Specification and Design Languages Automatic Transformation of RTL Models from VHDL to SystemC Ralph Görgen – OFFIS Philipp A. Hartmann](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea45503460f94ba8c1b/html5/thumbnails/14.jpg)
Array Types
Constrained and unconstrained array types
VH_UNCONSTRAINED_ARRAY( std_logic_vector, std_logic, natural );
VH_CONSTRAINED_ARRAY( x01_table, x01, range<‘U’,’-’,std_logic> );
VH_CONSTRAINED_ARRAY( std_logic_1d, std_logic, std_logic );
VH_CONSTRAINED_ARRAY_SUBTYPE( rtype, std_logic_vector, 15, 7 );
Index range checks Operators as in VHDL (incl. shift and concat) Attributes: left, right, low, high, … Implicit conversion of string literals Explicit conversion between closely related types (std_logic_vector, unsigned, …) Aggregates
std_logic_vector v ( 15, 7, vh_others() >> ‘0’ );
v = ( vh_at(13) >> ‘1’, vh_at(9) >> ‘X’, vh_others() >> ‘0’ );
FDL 2009, Sophia-Antipolis14
![Page 15: 1 FDL 2009 Forum on Specification and Design Languages Automatic Transformation of RTL Models from VHDL to SystemC Ralph Görgen – OFFIS Philipp A. Hartmann](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea45503460f94ba8c1b/html5/thumbnails/15.jpg)
Signals, Ports, and Parameters
Customized implementations of SystemC templates vh_signal< T > vh_in< T > vh_out< T > vh_inout< T >
Supporting VHDL attributes event, last_value Resolved signals of arbitrary type
Wrapper classes to support in, out, and inout parameters in functions vh_in_param< T > vh_out_param< T > vh_inout_param< T >
Control of read and write operations Conversion functions for out and inout parameters
FDL 2009, Sophia-Antipolis15
![Page 16: 1 FDL 2009 Forum on Specification and Design Languages Automatic Transformation of RTL Models from VHDL to SystemC Ralph Görgen – OFFIS Philipp A. Hartmann](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea45503460f94ba8c1b/html5/thumbnails/16.jpg)
Return type is part of signature in VHDL Solution: add return type to name
function foo( p : integer ) returns integer;
integer foo_ret_integer( p: integer );
function foo( p : integer ) returns std_logic_vector;
std_logic_vector foo_ret_std_logic_vector( p: integer );
Resolution of Overloaded Function Call
FDL 2009, Sophia-Antipolis16
![Page 17: 1 FDL 2009 Forum on Specification and Design Languages Automatic Transformation of RTL Models from VHDL to SystemC Ralph Görgen – OFFIS Philipp A. Hartmann](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea45503460f94ba8c1b/html5/thumbnails/17.jpg)
Ambiguous parameter types in C++
A: function conv_integer( p : integer ) returns integer;
B: function conv_integer( p : std_logic_vector ) returns integer;
conv_integer( integer_variable ) A
conv_integer( std_logic_vector_variable ) B
Resolution of Overloaded Function Call
FDL 2009, Sophia-Antipolis17
conv_integer( 20 ) ?
ambiguous: ‘const int’ and ‘const char*‘
conv_integer( “110011” ) ?
![Page 18: 1 FDL 2009 Forum on Specification and Design Languages Automatic Transformation of RTL Models from VHDL to SystemC Ralph Görgen – OFFIS Philipp A. Hartmann](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea45503460f94ba8c1b/html5/thumbnails/18.jpg)
Resolution of Overloaded Function Call
Ambiguity between ‘const int’ and ‘const char*’ Compiler knows about difference but standard defines equality
Solution: Eliminate undesired candidate Suppress template constructor instantiation with ‘enable_if’-template SFINAE: substitution failure is not an error
template < typename U >
in_param ( U const & val,
typename enable_if <
is_basically_same <
U, param_type::basic_c_type
>::value
>::type * = 0 )
{ … }
FDL 2009, Sophia-Antipolis18
![Page 19: 1 FDL 2009 Forum on Specification and Design Languages Automatic Transformation of RTL Models from VHDL to SystemC Ralph Görgen – OFFIS Philipp A. Hartmann](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea45503460f94ba8c1b/html5/thumbnails/19.jpg)
Bus-arbiter model
Configurable IP block implemented in synthesizable VHDL n master ports m slave ports
Testbench in Simulink
Experiments
FDL 2009, Sophia-Antipolis19
![Page 20: 1 FDL 2009 Forum on Specification and Design Languages Automatic Transformation of RTL Models from VHDL to SystemC Ralph Görgen – OFFIS Philipp A. Hartmann](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea45503460f94ba8c1b/html5/thumbnails/20.jpg)
Results: Automatic Generated Simulink Module
Manual conversion The designer has to …
… understand the design
… have C know-how
… guarantee equivalent behavior Takes several days
Automatic generation Takes a few minutes
Performance 31% overhead for actual component 2% overhead for entire simulation
FDL 2009, Sophia-Antipolis20
Actual Component
Entire Simulation
![Page 21: 1 FDL 2009 Forum on Specification and Design Languages Automatic Transformation of RTL Models from VHDL to SystemC Ralph Görgen – OFFIS Philipp A. Hartmann](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea45503460f94ba8c1b/html5/thumbnails/21.jpg)
Conclusion and Outlook
Presented solution allows …
… automatic integration of VHDL designs into Matlab/Simulink
… distribution of precompiled designs
Transformation of VHDL designs to SystemC Library to instantiate VHDL-like types and objects in SystemC
Allows straight-forward VHDL-to-SystemC transformation Wrapper to convert types to standard SystemC types Acceptable loss of performance
Future work Support for additional VHDL features Specialized implementation of often used VHDL types to improve performance
FDL 2009, Sophia-Antipolis21
![Page 22: 1 FDL 2009 Forum on Specification and Design Languages Automatic Transformation of RTL Models from VHDL to SystemC Ralph Görgen – OFFIS Philipp A. Hartmann](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea45503460f94ba8c1b/html5/thumbnails/22.jpg)
FDL 2009, Sophia-Antipolis22
Thank you for your attention.
Questions?
![Page 23: 1 FDL 2009 Forum on Specification and Design Languages Automatic Transformation of RTL Models from VHDL to SystemC Ralph Görgen – OFFIS Philipp A. Hartmann](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea45503460f94ba8c1b/html5/thumbnails/23.jpg)
For-Loop with Range
FDL 2009, Sophia-Antipolis23