SlideShare a Scribd company logo
Algorithm Verification with
Open Source and System Verilog
*
Andra Socianu Daniel Ciupitu
• Verification of algorithmic blocks using Octave
• Case study I : SV – SHA-3 – Octave
• Case study II : SV – DSP functions – Octave
• Case study III : SV – DSP functions – SystemC
• Conclusions
• Q&A
*
Agenda
Algorithmic Blocks
• Speech/signal/image processing and analysis
• Data encryption/decryption
• BB/radio signal modulation/demodulation
• Signal filtering
• Error detection and correction
• Data compression
• etc.
*
GSM Vocoder
*
Pre-processing
Short term
LPC analysis
Short term
analysis filter
RPE grid
selection and
coding
Long term
analysis filter
LTP analysis
RPE grid
decoding and
positioning
To radio subsystem
Input
signal
RPE parameters
(47 bits/ 5 ms)
Reflection coefficients
coded as
Log. - Area ratios
(36 bits/ 20 ms)
LTP parameters
(9 bits/ 5 ms)
Implementation Challenges
• Complexity
• Performance
• Debug
• Verification language limitations
*
Alternatives
• Matlab or Octave
• SystemC
• C++
• etc.
*
What is Octave?
GNU Octave is:
• a high-level interpreted language for
numerical computations
• usually used through its interactive command
line interface, but it can also be used to write
non-interactive programs
• allows cross language communication
• open source (GNU-GPL)
*
Where to Get It
There are two Octave packages that need to be
installed:
• Main application: ftp://ftp.gnu.org/gnu/octave
• Development package: http://goo.gl/yjHGbp
This paper uses version 3.4.3 of the above
packages.
*
How to Install It
• Create a Makefile by running the script
`configure‘ which you can find in the Octave
package
• Run `make‘ to compile the sources
• Run `make install‘ to install octave and a copy
of its libraries and its documentation
*
How to Test It
• Start Octave by typing octave in the Linux
prompt
• Search for a known function
• Test a known function output
*
$: octave
octave:1> which fft
`fft' is a function from the file /usr/lib64/octave/3.4.3/oct/x86_64-redhat-linux-gnu/fft.oct
octave:2> cos(2*pi)
ans = 1
Verification Environment
*
Score Boarding
*
ScoreboardInput
Monitor
Output
Monitor
Bridge
Octave
How to Connect SV and Octave
External interfaces:
• DPI-C (Direct Programming Interface)
• VPI (Verilog Procedural Interface)
• PLI (Programming Language Interface)
• etc.
*
The Bridge
*
How to Use DPI-C API
External interfaces:
• import functions and tasks: implemented in C
and called from SV
• export functions and tasks: implemented in
SV and called from C
*
import "DPI-C" function int c_function (input int a, output int b,
inout int c);
export "DPI-C" sv_function;
System Verilog <-> C
*
import "DPI-C" function void c_hello_world();
class amiq_hello_world extends uvm_component;
function sv_hello_world();
`uvm_info("AMIQ_HELLO_WORLD", "Hello world from SV file", UVM_NONE);
c_hello_world();
endfunction
endclass
SV
extern "C" {
void c_hello_world() {
printf("[AMIQ_HELLO_WORLD] Hello world from C filen");
cpp_hello_world();
}
}
C
C <-> C++
*
extern "C" {
void c_hello_world() {
printf("[AMIQ_HELLO_WORLD] Hello world from C filen");
cpp_hello_world();
}
}
C
void cpp_hello_world() {
cout << "[AMIQ_HELLO_WORLD] Hello world from C++ file" << endl;
oct_hello = load_fcn_from_file("hello.m", "", "", "hello", true);
feval("hello", oct_in_list, 1);
}
C++
Octave C++ Library
To get access to the octave C++ API you need to
include its libraries. This will allow you to use script
files, oct-files and built-in functions.
Libraries:
• main C++ library:
#include <octave/octave.h>
• Octave main() function:
#include <octave/oct.h>
• virtual terminal support:
#include <octave/parse.h>
*
C++ <-> Octave
*
void cpp_hello_world() {
cout << "[AMIQ_HELLO_WORLD] Hello world from C++ file" << endl;
oct_hello = load_fcn_from_file("hello.m", "", "", "hello", true);
feval("hello", oct_in_list, 1);
}
C++
function hello ();
disp("[AMIQ_HELLO_WORLD] Hello world from Octave file");
end
Oct
Octave Initialization
*
Octave Initialization
*
// Initialize the Octave interpreter
void initialize_octave_cpp() {
string_vector argv(2);
argv(0) = "embedded";
argv(1) = "-q";
octave_main(2, argv.c_str_vec(), 1);
}
Calling Octave Built-In Functions
// Input parameters list for octave function
octave_value_list oct_in_list;
// Output message as a Matrix
Matrix oct_output_data(1, output_size);
// Get computed convolution to oct_output_data
oct_output_data = feval("conv", oct_in_list, 1)(0).matrix_value();
*
Calling Octave User-Written Functions
// Input parameters list for octave function
octave_value_list oct_in_list;
// Output message as a Matrix
Matrix oct_output_data(1, output_size);
// Pointer to Octave custom function
octave_function *conv_fct;
// Load Octave custom function
conv_fct = load_fcn_from_file ("amiq_conv.m", "", "", "amiq_conv ", true);
// Get computed convolution to oct_output_data
oct_output_data = feval("amiq_conv ", oct_in_list, 1)(0).matrix_value();
*
Compiling
Create a shared library that contains the Octave
library and the C++ code. This library will be
passed to the simulator which runs System
Verilog.
TIP: Compiler options can be easily obtained by running:
*
$: mkoctfile -link-stand-alone -v cpp_code.cpp
Compile Command
mkoctfile -link-stand-alone -v my_file.cpp
g++ -c -fPIC -I/usr/include/octave-3.4.3/octave/.. -
I/usr/include/octave-3.4.3/octave -I/usr/include/freetype2 -O2 -
g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -
fstack-protector --param=ssp-buffer-size=4 -m64 -
mtune=generic my_file.cpp -o my_file.o
g++ -shared -Wl,-Bsymbolic -o my_file.oct my_file.o -link-
stand-alone -L/usr/lib64/octave/3.4.3 -L/usr/lib64 -loctinterp -
loctave -lcruft -L/usr/lib64/atlas -llapack -L/usr/lib64/atlas -
lf77blas -latlas -lfftw3 -lfftw3f -lm -L/usr/lib/gcc/x86_64-redhat-
linux/4.4.6 -L/usr/lib/gcc/x86_64-redhat-
linux/4.4.6/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -
L/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../.. -lgfortranbegin -
lgfortran -lm
*
Compile Command
g++ 
-Wall 
-m64 
-I${PROJ_HOME}/octave 
-I${PROJ_HOME}/c 
-I${PROJ_HOME}/sim 
-I/usr/include/octave-3.4.3/octave/.. 
-I/usr/include/octave-3.4.3/octave 
-I/usr/include/freetype2 
-L${PROJ_HOME}/sim 
-L/usr/lib64/octave/3.4.3 
-L/usr/lib64 
-L/usr/lib64/atlas 
-L/usr/lib/gcc/x86_64-redhat-linux/4.4.6 
-L/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../lib64 
-L/lib/../lib64 
-L/usr/lib/../lib64 
-L/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../.. 
-Wl,-rpath 
-Wl,/usr/lib64/octave/3.4.3 
-loctinterp 
-loctave 
-lcruft 
-llapack 
-lf77blas 
-latlas 
-lfftw3 
-lfftw3f 
-lreadline 
-lm 
-lgfortranbegin 
-lgfortran 
-shared 
-fPIC 
-o libcpp_oct.so ${PROJ_HOME}/c/amiq_fft256_c_oct_container.cpp
*
Running
You can compile and run simulations with any of
the 3 major EDA vendors simulators:
• irun (Cadence) and vcs (Synopsys): include
the shared library at compile time
• vlog/vsim (Mentor): include the shared library
at run time
TIP: If you run into errors related to octave main()
calls, the macro call "OCTINTERP_API" from
"octave.h" library file has to be removed.
*
Success!!!
UVM_INFO @ 0 [AMIQ_HELLO_WORLD]: Hello world from SV file
[AMIQ_HELLO_WORLD]: Hello world from C file
[AMIQ_HELLO_WORLD]: Hello world from C++ file
[AMIQ_HELLO_WORLD]: Hello world from Octave file
*
Octave Data Types
Special Octave types:
• octave_value_list (generic type)
• RowVector
• ColumnVector
• Matrix
• DiagMatrix
• etc.
*
How to Pass Data to/from DPI-C
*direction is relative to System Verilog argument
*
System Verilog C (input*) C (output/inout*)
byte char char*
string const char* char**
real double double*
bit unsigned char unsigned char
logic unsigned char unsigned char*
int int int*
shortreal float float*
open array [] const
svOpenArrayHandler
svOpenArrayHandler
Recap
• What is Octave
• How to install Octave
• How to test Octave
• How to create a SV-Octave bridge
• How to compile and run a simulation
*
Case study I
SV – SHA 3 – Octave
*
Verification Environment
*
DUT
*
What is SHA-3/Keccak?
SHA-3 is:
• a cryptographic hash function
• a subset of the cryptographic primitive
family Keccak
• an alternative to SHA-1 and SHA-2 which in
theory are vulnerable
*
Performance – Simulator 1
*
Performance – Simulator 2
*
Performance – Simulator 3
*
Implementation Effort
*
System Verilog Octave
Number of code lines 223 132
Implementation time 1 day 1 day
Debug time 2 days 1 day
Why did we pushed forward?
• Keccak deals mainly with matrix operations
• System Verilog is optimized to work with
multi-dimension arrays
• Things could be different for other types of
functions
TIP: A simple multiplication of two matrixes takes
9.32 ms for the Octave computation and context
switch, while the same operation takes 8.27 ms
in SV.
*
Case study II
SV – DSP functions – Octave
*
Test Bench
*
Octave
UVM component
Input feeder
Test bench
SV
DSP Functions We Used
• FFT or Fast Fourier Transform
• DCT or Discrete Cosine Transform
• FIR or Finite Impulse Response filter
• Convolution
*
0
10
20
30
40
50
60
FFT with
optimization
FFT without
optimization
DCT with
optimization
DCT without
optimization
FIR with
optimization
FIR without
optimization
Convolution
with
optimization
Convolution
without
optimization
Duration(s)
SV Duration
Octave duration
Performance – Simulator 1
*
Performance – Simulator 2
*
0
10
20
30
40
50
60
FFT with
optimization
FFT without
optimization
DCT with
optimization
DCT without
optimization
FIR with
optimization
FIR without
optimization
Convolution
with
optimization
Convolution
without
optimization
Duration(s)
SV Duration
Octave duration
Performance – Simulator 3
*
0
10
20
30
40
50
60
FFT with
optimization
FFT without
optimization
DCT with
optimization
DCT without
optimization
FIR with
optimization
FIR without
optimization
Convolution
with
optimization
Convolution
without
optimization
Duration(s)
SV Duration
Octave duration
Implementation Effort
*
System Verilog Octave
FFT
Number of code lines 30 3
Implementation time 1 day 0,5 days
Debug time 1 day 0,5 days
DCT
Number of code lines 19 3
Implementation time 1 day 0,5 days
Debug time 1 day 0,5 days
FIR
Number of code lines 21 3
Implementation time 1 day 0,5 days
Debug time 1 day 0,5 days
Convolution
Number of code lines 12 3
Implementation time 1 day 0,5 days
Debug time 1 day 0,5 days
Case study III
SV – DSP functions – SystemC
*
Test Bench
*
SystemC
UVM component
Input feeder
Test bench
SV
What is SystemC?
• a C++ library
• provides an event-driven simulation interface
• supports system level design
• inherits all C++ features
• adds new data types
• fixed point computation
*
SystemC Specific Data Types
*
System Verilog SystemC
bit, logic, reg wire bool, sc_bit, sc_logic
bit, logic, reg, wire vector sc_bv, sc_lv, sc_int, sc_uint
integer, int [unsigned] [unsigned] int
real, shortreal double/float
byte [unsigned] [unsigned] char
enum Enum
struct Struct
- sc_fixed, sc_ufixed
Performance – Simulator 1
*
Performance – Simulator 2
*
Implementation Effort
*
System Verilog SystemC
FFT
Number of code lines 30 37
Implementation time 2 days 1 day
Debug time 4 days 3 days
DCT
Number of code lines 20 20
Implementation time 1 day 1 day
Debug time 2 days 2 days
FIR
Number of code lines 13 16
Implementation time 1 day 1 day
Debug time 2 days 2 days
Convolution
Number of code lines 23 21
Implementation time 1 day 1 day
Debug time 1 day 1 day
Conclusions
Both Octave and SystemC can offer:
• greater performance
• lower implementation
• lower debug time
*
Conclusions
• SV is better when multi-dimensional vectors
are involved
• Octave is better for particular functions (e.g.
FFT, DCT, Convolution or FIR), but language
context switch comes at a cost (~2.3 ms/call)
• SystemC can help you if you miss Octave
fixed point libraries
*
Q&A
*
Q&A
*
Thank you!

More Related Content

What's hot

Intel microprocessor history
Intel microprocessor historyIntel microprocessor history
Intel microprocessor historyRamzi Alqrainy
 
Study on Android Emulator
Study on Android EmulatorStudy on Android Emulator
Study on Android Emulator
Samael Wang
 
Linux Device Driver’s
Linux Device Driver’sLinux Device Driver’s
Linux Device Driver’s
Rashmi Warghade
 
Linux Boot Process
Linux Boot ProcessLinux Boot Process
Linux Boot Process
darshhingu
 
Virtualization Support in ARMv8+
Virtualization Support in ARMv8+Virtualization Support in ARMv8+
Virtualization Support in ARMv8+
Aananth C N
 
Root file system for embedded systems
Root file system for embedded systemsRoot file system for embedded systems
Root file system for embedded systems
alok pal
 
Java project
Java projectJava project
Java project
Rishabh Jain
 
The Intel 8086 microprocessor
The Intel 8086 microprocessorThe Intel 8086 microprocessor
The Intel 8086 microprocessor
George Thomas
 
Andes building a secure platform with the enhanced iopmp
Andes building a secure platform with the enhanced iopmpAndes building a secure platform with the enhanced iopmp
Andes building a secure platform with the enhanced iopmp
RISC-V International
 
internal_memory
internal_memoryinternal_memory
internal_memory
limyamahgoub
 
Linux Porting
Linux PortingLinux Porting
Linux Porting
Champ Yen
 
What is Diagnostic over Internet Protocol (DoIP) and How it Supports Remote V...
What is Diagnostic over Internet Protocol (DoIP) and How it Supports Remote V...What is Diagnostic over Internet Protocol (DoIP) and How it Supports Remote V...
What is Diagnostic over Internet Protocol (DoIP) and How it Supports Remote V...
Embitel Technologies (I) PVT LTD
 
linux device driver
linux device driverlinux device driver
linux device driver
Rahul Batra
 
Linux Initialization Process (1)
Linux Initialization Process (1)Linux Initialization Process (1)
Linux Initialization Process (1)
shimosawa
 
DMA operation
DMA operationDMA operation
DMA operation
Imran Khan
 
Heterogeneous Systems Architecture: The Next Area of Computing Innovation
Heterogeneous Systems Architecture: The Next Area of Computing Innovation Heterogeneous Systems Architecture: The Next Area of Computing Innovation
Heterogeneous Systems Architecture: The Next Area of Computing Innovation
AMD
 
Bluetooth low energy(ble) wireless technology
Bluetooth low energy(ble) wireless technologyBluetooth low energy(ble) wireless technology
Bluetooth low energy(ble) wireless technologyLin Steven
 

What's hot (20)

Intel microprocessor history
Intel microprocessor historyIntel microprocessor history
Intel microprocessor history
 
UDS PPT
UDS PPTUDS PPT
UDS PPT
 
Study on Android Emulator
Study on Android EmulatorStudy on Android Emulator
Study on Android Emulator
 
Misra c
Misra cMisra c
Misra c
 
Linux Device Driver’s
Linux Device Driver’sLinux Device Driver’s
Linux Device Driver’s
 
FreeRTOS Course - Semaphore/Mutex Management
FreeRTOS Course - Semaphore/Mutex ManagementFreeRTOS Course - Semaphore/Mutex Management
FreeRTOS Course - Semaphore/Mutex Management
 
Linux Boot Process
Linux Boot ProcessLinux Boot Process
Linux Boot Process
 
Virtualization Support in ARMv8+
Virtualization Support in ARMv8+Virtualization Support in ARMv8+
Virtualization Support in ARMv8+
 
Root file system for embedded systems
Root file system for embedded systemsRoot file system for embedded systems
Root file system for embedded systems
 
Java project
Java projectJava project
Java project
 
The Intel 8086 microprocessor
The Intel 8086 microprocessorThe Intel 8086 microprocessor
The Intel 8086 microprocessor
 
Andes building a secure platform with the enhanced iopmp
Andes building a secure platform with the enhanced iopmpAndes building a secure platform with the enhanced iopmp
Andes building a secure platform with the enhanced iopmp
 
internal_memory
internal_memoryinternal_memory
internal_memory
 
Linux Porting
Linux PortingLinux Porting
Linux Porting
 
What is Diagnostic over Internet Protocol (DoIP) and How it Supports Remote V...
What is Diagnostic over Internet Protocol (DoIP) and How it Supports Remote V...What is Diagnostic over Internet Protocol (DoIP) and How it Supports Remote V...
What is Diagnostic over Internet Protocol (DoIP) and How it Supports Remote V...
 
linux device driver
linux device driverlinux device driver
linux device driver
 
Linux Initialization Process (1)
Linux Initialization Process (1)Linux Initialization Process (1)
Linux Initialization Process (1)
 
DMA operation
DMA operationDMA operation
DMA operation
 
Heterogeneous Systems Architecture: The Next Area of Computing Innovation
Heterogeneous Systems Architecture: The Next Area of Computing Innovation Heterogeneous Systems Architecture: The Next Area of Computing Innovation
Heterogeneous Systems Architecture: The Next Area of Computing Innovation
 
Bluetooth low energy(ble) wireless technology
Bluetooth low energy(ble) wireless technologyBluetooth low energy(ble) wireless technology
Bluetooth low energy(ble) wireless technology
 

Viewers also liked

SystemVerilog Assertions (SVA) in the Design/Verification Process
SystemVerilog Assertions (SVA) in the Design/Verification ProcessSystemVerilog Assertions (SVA) in the Design/Verification Process
SystemVerilog Assertions (SVA) in the Design/Verification ProcessDVClub
 
Top five reasons why every DV engineer will love the latest systemverilog 201...
Top five reasons why every DV engineer will love the latest systemverilog 201...Top five reasons why every DV engineer will love the latest systemverilog 201...
Top five reasons why every DV engineer will love the latest systemverilog 201...
Srinivasan Venkataramanan
 
Tokyo r47 beginner
Tokyo r47 beginnerTokyo r47 beginner
Tokyo r47 beginner
Takashi Minoda
 
C++ process new
C++ process newC++ process new
C++ process new
敬倫 林
 
Track c-High speed transaction-based hw-sw coverification -eve
Track c-High speed transaction-based hw-sw coverification -eveTrack c-High speed transaction-based hw-sw coverification -eve
Track c-High speed transaction-based hw-sw coverification -evechiportal
 
Concurrency 2010
Concurrency 2010Concurrency 2010
Concurrency 2010
敬倫 林
 
Week1 Electronic System-level ESL Design and SystemC Begin
Week1 Electronic System-level ESL Design and SystemC BeginWeek1 Electronic System-level ESL Design and SystemC Begin
Week1 Electronic System-level ESL Design and SystemC Begin
敬倫 林
 
Systemc overview 2010
Systemc overview 2010Systemc overview 2010
Systemc overview 2010
敬倫 林
 
Thread and method_2010
Thread and method_2010Thread and method_2010
Thread and method_2010
敬倫 林
 
Channel 2010
Channel 2010Channel 2010
Channel 2010
敬倫 林
 
SystemC Ports
SystemC PortsSystemC Ports
SystemC Ports
敬倫 林
 
A Systematic Approach to Creating Behavioral Models (white paper) v1.0
A Systematic Approach to Creating Behavioral Models (white paper) v1.0A Systematic Approach to Creating Behavioral Models (white paper) v1.0
A Systematic Approach to Creating Behavioral Models (white paper) v1.0Robert O. Peruzzi, PhD, PE, DFE
 
Esl basics
Esl basicsEsl basics
Esl basics
敬倫 林
 
UVM Ral model usage
UVM Ral model usageUVM Ral model usage
UVM Ral model usage
Parth Pandya
 
UVM Update: Register Package
UVM Update: Register PackageUVM Update: Register Package
UVM Update: Register PackageDVClub
 
SystemVerilog Assertions verification with SVAUnit - DVCon US 2016 Tutorial
SystemVerilog Assertions verification with SVAUnit - DVCon US 2016 TutorialSystemVerilog Assertions verification with SVAUnit - DVCon US 2016 Tutorial
SystemVerilog Assertions verification with SVAUnit - DVCon US 2016 Tutorial
Amiq Consulting
 
stack
stackstack
stack
Raj Sarode
 
Design and Implementation of an Advanced DMA Controller on AMBA-Based SoC
Design and Implementation of an Advanced DMA Controller on AMBA-Based SoCDesign and Implementation of an Advanced DMA Controller on AMBA-Based SoC
Design and Implementation of an Advanced DMA Controller on AMBA-Based SoC
Rabindranath Tagore University, Bhopal
 
Queue
QueueQueue
Queue
Raj Sarode
 

Viewers also liked (20)

SystemVerilog Assertions (SVA) in the Design/Verification Process
SystemVerilog Assertions (SVA) in the Design/Verification ProcessSystemVerilog Assertions (SVA) in the Design/Verification Process
SystemVerilog Assertions (SVA) in the Design/Verification Process
 
Top five reasons why every DV engineer will love the latest systemverilog 201...
Top five reasons why every DV engineer will love the latest systemverilog 201...Top five reasons why every DV engineer will love the latest systemverilog 201...
Top five reasons why every DV engineer will love the latest systemverilog 201...
 
Tokyo r47 beginner
Tokyo r47 beginnerTokyo r47 beginner
Tokyo r47 beginner
 
MixedSignal UVM Demo CDNLive
MixedSignal UVM Demo CDNLiveMixedSignal UVM Demo CDNLive
MixedSignal UVM Demo CDNLive
 
C++ process new
C++ process newC++ process new
C++ process new
 
Track c-High speed transaction-based hw-sw coverification -eve
Track c-High speed transaction-based hw-sw coverification -eveTrack c-High speed transaction-based hw-sw coverification -eve
Track c-High speed transaction-based hw-sw coverification -eve
 
Concurrency 2010
Concurrency 2010Concurrency 2010
Concurrency 2010
 
Week1 Electronic System-level ESL Design and SystemC Begin
Week1 Electronic System-level ESL Design and SystemC BeginWeek1 Electronic System-level ESL Design and SystemC Begin
Week1 Electronic System-level ESL Design and SystemC Begin
 
Systemc overview 2010
Systemc overview 2010Systemc overview 2010
Systemc overview 2010
 
Thread and method_2010
Thread and method_2010Thread and method_2010
Thread and method_2010
 
Channel 2010
Channel 2010Channel 2010
Channel 2010
 
SystemC Ports
SystemC PortsSystemC Ports
SystemC Ports
 
A Systematic Approach to Creating Behavioral Models (white paper) v1.0
A Systematic Approach to Creating Behavioral Models (white paper) v1.0A Systematic Approach to Creating Behavioral Models (white paper) v1.0
A Systematic Approach to Creating Behavioral Models (white paper) v1.0
 
Esl basics
Esl basicsEsl basics
Esl basics
 
UVM Ral model usage
UVM Ral model usageUVM Ral model usage
UVM Ral model usage
 
UVM Update: Register Package
UVM Update: Register PackageUVM Update: Register Package
UVM Update: Register Package
 
SystemVerilog Assertions verification with SVAUnit - DVCon US 2016 Tutorial
SystemVerilog Assertions verification with SVAUnit - DVCon US 2016 TutorialSystemVerilog Assertions verification with SVAUnit - DVCon US 2016 Tutorial
SystemVerilog Assertions verification with SVAUnit - DVCon US 2016 Tutorial
 
stack
stackstack
stack
 
Design and Implementation of an Advanced DMA Controller on AMBA-Based SoC
Design and Implementation of an Advanced DMA Controller on AMBA-Based SoCDesign and Implementation of an Advanced DMA Controller on AMBA-Based SoC
Design and Implementation of an Advanced DMA Controller on AMBA-Based SoC
 
Queue
QueueQueue
Queue
 

Similar to How to Connect SystemVerilog with Octave

Digital design with Systemc
Digital design with SystemcDigital design with Systemc
Digital design with Systemc
Marc Engels
 
SDAccel Design Contest: Vivado HLS
SDAccel Design Contest: Vivado HLSSDAccel Design Contest: Vivado HLS
SDAccel Design Contest: Vivado HLS
NECST Lab @ Politecnico di Milano
 
DvClub 2102 tlm based software control of uvcs for vertical verification re...
DvClub 2102   tlm based software control of uvcs for vertical verification re...DvClub 2102   tlm based software control of uvcs for vertical verification re...
DvClub 2102 tlm based software control of uvcs for vertical verification re...
Amit Bhandu
 
MattsonTutorialSC14.pptx
MattsonTutorialSC14.pptxMattsonTutorialSC14.pptx
MattsonTutorialSC14.pptx
gopikahari7
 
MattsonTutorialSC14.pdf
MattsonTutorialSC14.pdfMattsonTutorialSC14.pdf
MattsonTutorialSC14.pdf
George Papaioannou
 
CodeChecker summary 21062021
CodeChecker summary 21062021CodeChecker summary 21062021
CodeChecker summary 21062021
Olivera Milenkovic
 
Harmonia open iris_basic_v0.1
Harmonia open iris_basic_v0.1Harmonia open iris_basic_v0.1
Harmonia open iris_basic_v0.1
Yongyoon Shin
 
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres..."The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...
Edge AI and Vision Alliance
 
Onnc intro
Onnc introOnnc intro
Onnc intro
Luba Tang
 
Virtual platform
Virtual platformVirtual platform
Virtual platformsean chen
 
Web Template Mechanisms in SOC Verification - DVCon.pdf
Web Template Mechanisms in SOC Verification - DVCon.pdfWeb Template Mechanisms in SOC Verification - DVCon.pdf
Web Template Mechanisms in SOC Verification - DVCon.pdf
SamHoney6
 
Hands on with CoAP and Californium
Hands on with CoAP and CaliforniumHands on with CoAP and Californium
Hands on with CoAP and Californium
Julien Vermillard
 
Using Smalltalk for controlling robotics systems
Using Smalltalk for controlling robotics systemsUsing Smalltalk for controlling robotics systems
Using Smalltalk for controlling robotics systemsSerge Stinckwich
 
Cotopaxi - IoT testing toolkit (Black Hat Asia 2019 Arsenal)
Cotopaxi - IoT testing toolkit (Black Hat Asia 2019 Arsenal)Cotopaxi - IoT testing toolkit (Black Hat Asia 2019 Arsenal)
Cotopaxi - IoT testing toolkit (Black Hat Asia 2019 Arsenal)
Jakub Botwicz
 
Labs_BT_20221017.pptx
Labs_BT_20221017.pptxLabs_BT_20221017.pptx
Labs_BT_20221017.pptx
ssuserb4d806
 
Protocol T50: Five months later... So what?
Protocol T50: Five months later... So what?Protocol T50: Five months later... So what?
Protocol T50: Five months later... So what?
Nelson Brito
 
OSGi Remote Services - Alexander Broekhuis, Bram de Kruijff
OSGi Remote Services - Alexander Broekhuis, Bram de Kruijff OSGi Remote Services - Alexander Broekhuis, Bram de Kruijff
OSGi Remote Services - Alexander Broekhuis, Bram de Kruijff
mfrancis
 
3 Open-Source-SYCL-Intel-Khronos-EVS-Workshop_May19.pdf
3 Open-Source-SYCL-Intel-Khronos-EVS-Workshop_May19.pdf3 Open-Source-SYCL-Intel-Khronos-EVS-Workshop_May19.pdf
3 Open-Source-SYCL-Intel-Khronos-EVS-Workshop_May19.pdf
JunZhao68
 
CodeChecker Overview Nov 2019
CodeChecker Overview Nov 2019CodeChecker Overview Nov 2019
CodeChecker Overview Nov 2019
Olivera Milenkovic
 
E yantra robot abstractions
E yantra robot abstractionsE yantra robot abstractions
E yantra robot abstractionsAkshar Desai
 

Similar to How to Connect SystemVerilog with Octave (20)

Digital design with Systemc
Digital design with SystemcDigital design with Systemc
Digital design with Systemc
 
SDAccel Design Contest: Vivado HLS
SDAccel Design Contest: Vivado HLSSDAccel Design Contest: Vivado HLS
SDAccel Design Contest: Vivado HLS
 
DvClub 2102 tlm based software control of uvcs for vertical verification re...
DvClub 2102   tlm based software control of uvcs for vertical verification re...DvClub 2102   tlm based software control of uvcs for vertical verification re...
DvClub 2102 tlm based software control of uvcs for vertical verification re...
 
MattsonTutorialSC14.pptx
MattsonTutorialSC14.pptxMattsonTutorialSC14.pptx
MattsonTutorialSC14.pptx
 
MattsonTutorialSC14.pdf
MattsonTutorialSC14.pdfMattsonTutorialSC14.pdf
MattsonTutorialSC14.pdf
 
CodeChecker summary 21062021
CodeChecker summary 21062021CodeChecker summary 21062021
CodeChecker summary 21062021
 
Harmonia open iris_basic_v0.1
Harmonia open iris_basic_v0.1Harmonia open iris_basic_v0.1
Harmonia open iris_basic_v0.1
 
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres..."The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...
 
Onnc intro
Onnc introOnnc intro
Onnc intro
 
Virtual platform
Virtual platformVirtual platform
Virtual platform
 
Web Template Mechanisms in SOC Verification - DVCon.pdf
Web Template Mechanisms in SOC Verification - DVCon.pdfWeb Template Mechanisms in SOC Verification - DVCon.pdf
Web Template Mechanisms in SOC Verification - DVCon.pdf
 
Hands on with CoAP and Californium
Hands on with CoAP and CaliforniumHands on with CoAP and Californium
Hands on with CoAP and Californium
 
Using Smalltalk for controlling robotics systems
Using Smalltalk for controlling robotics systemsUsing Smalltalk for controlling robotics systems
Using Smalltalk for controlling robotics systems
 
Cotopaxi - IoT testing toolkit (Black Hat Asia 2019 Arsenal)
Cotopaxi - IoT testing toolkit (Black Hat Asia 2019 Arsenal)Cotopaxi - IoT testing toolkit (Black Hat Asia 2019 Arsenal)
Cotopaxi - IoT testing toolkit (Black Hat Asia 2019 Arsenal)
 
Labs_BT_20221017.pptx
Labs_BT_20221017.pptxLabs_BT_20221017.pptx
Labs_BT_20221017.pptx
 
Protocol T50: Five months later... So what?
Protocol T50: Five months later... So what?Protocol T50: Five months later... So what?
Protocol T50: Five months later... So what?
 
OSGi Remote Services - Alexander Broekhuis, Bram de Kruijff
OSGi Remote Services - Alexander Broekhuis, Bram de Kruijff OSGi Remote Services - Alexander Broekhuis, Bram de Kruijff
OSGi Remote Services - Alexander Broekhuis, Bram de Kruijff
 
3 Open-Source-SYCL-Intel-Khronos-EVS-Workshop_May19.pdf
3 Open-Source-SYCL-Intel-Khronos-EVS-Workshop_May19.pdf3 Open-Source-SYCL-Intel-Khronos-EVS-Workshop_May19.pdf
3 Open-Source-SYCL-Intel-Khronos-EVS-Workshop_May19.pdf
 
CodeChecker Overview Nov 2019
CodeChecker Overview Nov 2019CodeChecker Overview Nov 2019
CodeChecker Overview Nov 2019
 
E yantra robot abstractions
E yantra robot abstractionsE yantra robot abstractions
E yantra robot abstractions
 

Recently uploaded

Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...
Zilliz
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
Neo4j
 

Recently uploaded (20)

Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
 

How to Connect SystemVerilog with Octave

  • 1. Algorithm Verification with Open Source and System Verilog * Andra Socianu Daniel Ciupitu
  • 2. • Verification of algorithmic blocks using Octave • Case study I : SV – SHA-3 – Octave • Case study II : SV – DSP functions – Octave • Case study III : SV – DSP functions – SystemC • Conclusions • Q&A * Agenda
  • 3. Algorithmic Blocks • Speech/signal/image processing and analysis • Data encryption/decryption • BB/radio signal modulation/demodulation • Signal filtering • Error detection and correction • Data compression • etc. *
  • 4. GSM Vocoder * Pre-processing Short term LPC analysis Short term analysis filter RPE grid selection and coding Long term analysis filter LTP analysis RPE grid decoding and positioning To radio subsystem Input signal RPE parameters (47 bits/ 5 ms) Reflection coefficients coded as Log. - Area ratios (36 bits/ 20 ms) LTP parameters (9 bits/ 5 ms)
  • 5. Implementation Challenges • Complexity • Performance • Debug • Verification language limitations *
  • 6. Alternatives • Matlab or Octave • SystemC • C++ • etc. *
  • 7. What is Octave? GNU Octave is: • a high-level interpreted language for numerical computations • usually used through its interactive command line interface, but it can also be used to write non-interactive programs • allows cross language communication • open source (GNU-GPL) *
  • 8. Where to Get It There are two Octave packages that need to be installed: • Main application: ftp://ftp.gnu.org/gnu/octave • Development package: http://goo.gl/yjHGbp This paper uses version 3.4.3 of the above packages. *
  • 9. How to Install It • Create a Makefile by running the script `configure‘ which you can find in the Octave package • Run `make‘ to compile the sources • Run `make install‘ to install octave and a copy of its libraries and its documentation *
  • 10. How to Test It • Start Octave by typing octave in the Linux prompt • Search for a known function • Test a known function output * $: octave octave:1> which fft `fft' is a function from the file /usr/lib64/octave/3.4.3/oct/x86_64-redhat-linux-gnu/fft.oct octave:2> cos(2*pi) ans = 1
  • 13. How to Connect SV and Octave External interfaces: • DPI-C (Direct Programming Interface) • VPI (Verilog Procedural Interface) • PLI (Programming Language Interface) • etc. *
  • 15. How to Use DPI-C API External interfaces: • import functions and tasks: implemented in C and called from SV • export functions and tasks: implemented in SV and called from C * import "DPI-C" function int c_function (input int a, output int b, inout int c); export "DPI-C" sv_function;
  • 16. System Verilog <-> C * import "DPI-C" function void c_hello_world(); class amiq_hello_world extends uvm_component; function sv_hello_world(); `uvm_info("AMIQ_HELLO_WORLD", "Hello world from SV file", UVM_NONE); c_hello_world(); endfunction endclass SV extern "C" { void c_hello_world() { printf("[AMIQ_HELLO_WORLD] Hello world from C filen"); cpp_hello_world(); } } C
  • 17. C <-> C++ * extern "C" { void c_hello_world() { printf("[AMIQ_HELLO_WORLD] Hello world from C filen"); cpp_hello_world(); } } C void cpp_hello_world() { cout << "[AMIQ_HELLO_WORLD] Hello world from C++ file" << endl; oct_hello = load_fcn_from_file("hello.m", "", "", "hello", true); feval("hello", oct_in_list, 1); } C++
  • 18. Octave C++ Library To get access to the octave C++ API you need to include its libraries. This will allow you to use script files, oct-files and built-in functions. Libraries: • main C++ library: #include <octave/octave.h> • Octave main() function: #include <octave/oct.h> • virtual terminal support: #include <octave/parse.h> *
  • 19. C++ <-> Octave * void cpp_hello_world() { cout << "[AMIQ_HELLO_WORLD] Hello world from C++ file" << endl; oct_hello = load_fcn_from_file("hello.m", "", "", "hello", true); feval("hello", oct_in_list, 1); } C++ function hello (); disp("[AMIQ_HELLO_WORLD] Hello world from Octave file"); end Oct
  • 21. Octave Initialization * // Initialize the Octave interpreter void initialize_octave_cpp() { string_vector argv(2); argv(0) = "embedded"; argv(1) = "-q"; octave_main(2, argv.c_str_vec(), 1); }
  • 22. Calling Octave Built-In Functions // Input parameters list for octave function octave_value_list oct_in_list; // Output message as a Matrix Matrix oct_output_data(1, output_size); // Get computed convolution to oct_output_data oct_output_data = feval("conv", oct_in_list, 1)(0).matrix_value(); *
  • 23. Calling Octave User-Written Functions // Input parameters list for octave function octave_value_list oct_in_list; // Output message as a Matrix Matrix oct_output_data(1, output_size); // Pointer to Octave custom function octave_function *conv_fct; // Load Octave custom function conv_fct = load_fcn_from_file ("amiq_conv.m", "", "", "amiq_conv ", true); // Get computed convolution to oct_output_data oct_output_data = feval("amiq_conv ", oct_in_list, 1)(0).matrix_value(); *
  • 24. Compiling Create a shared library that contains the Octave library and the C++ code. This library will be passed to the simulator which runs System Verilog. TIP: Compiler options can be easily obtained by running: * $: mkoctfile -link-stand-alone -v cpp_code.cpp
  • 25. Compile Command mkoctfile -link-stand-alone -v my_file.cpp g++ -c -fPIC -I/usr/include/octave-3.4.3/octave/.. - I/usr/include/octave-3.4.3/octave -I/usr/include/freetype2 -O2 - g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions - fstack-protector --param=ssp-buffer-size=4 -m64 - mtune=generic my_file.cpp -o my_file.o g++ -shared -Wl,-Bsymbolic -o my_file.oct my_file.o -link- stand-alone -L/usr/lib64/octave/3.4.3 -L/usr/lib64 -loctinterp - loctave -lcruft -L/usr/lib64/atlas -llapack -L/usr/lib64/atlas - lf77blas -latlas -lfftw3 -lfftw3f -lm -L/usr/lib/gcc/x86_64-redhat- linux/4.4.6 -L/usr/lib/gcc/x86_64-redhat- linux/4.4.6/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 - L/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../.. -lgfortranbegin - lgfortran -lm *
  • 26. Compile Command g++ -Wall -m64 -I${PROJ_HOME}/octave -I${PROJ_HOME}/c -I${PROJ_HOME}/sim -I/usr/include/octave-3.4.3/octave/.. -I/usr/include/octave-3.4.3/octave -I/usr/include/freetype2 -L${PROJ_HOME}/sim -L/usr/lib64/octave/3.4.3 -L/usr/lib64 -L/usr/lib64/atlas -L/usr/lib/gcc/x86_64-redhat-linux/4.4.6 -L/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../.. -Wl,-rpath -Wl,/usr/lib64/octave/3.4.3 -loctinterp -loctave -lcruft -llapack -lf77blas -latlas -lfftw3 -lfftw3f -lreadline -lm -lgfortranbegin -lgfortran -shared -fPIC -o libcpp_oct.so ${PROJ_HOME}/c/amiq_fft256_c_oct_container.cpp *
  • 27. Running You can compile and run simulations with any of the 3 major EDA vendors simulators: • irun (Cadence) and vcs (Synopsys): include the shared library at compile time • vlog/vsim (Mentor): include the shared library at run time TIP: If you run into errors related to octave main() calls, the macro call "OCTINTERP_API" from "octave.h" library file has to be removed. *
  • 28. Success!!! UVM_INFO @ 0 [AMIQ_HELLO_WORLD]: Hello world from SV file [AMIQ_HELLO_WORLD]: Hello world from C file [AMIQ_HELLO_WORLD]: Hello world from C++ file [AMIQ_HELLO_WORLD]: Hello world from Octave file *
  • 29. Octave Data Types Special Octave types: • octave_value_list (generic type) • RowVector • ColumnVector • Matrix • DiagMatrix • etc. *
  • 30. How to Pass Data to/from DPI-C *direction is relative to System Verilog argument * System Verilog C (input*) C (output/inout*) byte char char* string const char* char** real double double* bit unsigned char unsigned char logic unsigned char unsigned char* int int int* shortreal float float* open array [] const svOpenArrayHandler svOpenArrayHandler
  • 31. Recap • What is Octave • How to install Octave • How to test Octave • How to create a SV-Octave bridge • How to compile and run a simulation *
  • 32. Case study I SV – SHA 3 – Octave *
  • 34. DUT *
  • 35. What is SHA-3/Keccak? SHA-3 is: • a cryptographic hash function • a subset of the cryptographic primitive family Keccak • an alternative to SHA-1 and SHA-2 which in theory are vulnerable *
  • 39. Implementation Effort * System Verilog Octave Number of code lines 223 132 Implementation time 1 day 1 day Debug time 2 days 1 day
  • 40. Why did we pushed forward? • Keccak deals mainly with matrix operations • System Verilog is optimized to work with multi-dimension arrays • Things could be different for other types of functions TIP: A simple multiplication of two matrixes takes 9.32 ms for the Octave computation and context switch, while the same operation takes 8.27 ms in SV. *
  • 41. Case study II SV – DSP functions – Octave *
  • 43. DSP Functions We Used • FFT or Fast Fourier Transform • DCT or Discrete Cosine Transform • FIR or Finite Impulse Response filter • Convolution *
  • 44. 0 10 20 30 40 50 60 FFT with optimization FFT without optimization DCT with optimization DCT without optimization FIR with optimization FIR without optimization Convolution with optimization Convolution without optimization Duration(s) SV Duration Octave duration Performance – Simulator 1 *
  • 45. Performance – Simulator 2 * 0 10 20 30 40 50 60 FFT with optimization FFT without optimization DCT with optimization DCT without optimization FIR with optimization FIR without optimization Convolution with optimization Convolution without optimization Duration(s) SV Duration Octave duration
  • 46. Performance – Simulator 3 * 0 10 20 30 40 50 60 FFT with optimization FFT without optimization DCT with optimization DCT without optimization FIR with optimization FIR without optimization Convolution with optimization Convolution without optimization Duration(s) SV Duration Octave duration
  • 47. Implementation Effort * System Verilog Octave FFT Number of code lines 30 3 Implementation time 1 day 0,5 days Debug time 1 day 0,5 days DCT Number of code lines 19 3 Implementation time 1 day 0,5 days Debug time 1 day 0,5 days FIR Number of code lines 21 3 Implementation time 1 day 0,5 days Debug time 1 day 0,5 days Convolution Number of code lines 12 3 Implementation time 1 day 0,5 days Debug time 1 day 0,5 days
  • 48. Case study III SV – DSP functions – SystemC *
  • 50. What is SystemC? • a C++ library • provides an event-driven simulation interface • supports system level design • inherits all C++ features • adds new data types • fixed point computation *
  • 51. SystemC Specific Data Types * System Verilog SystemC bit, logic, reg wire bool, sc_bit, sc_logic bit, logic, reg, wire vector sc_bv, sc_lv, sc_int, sc_uint integer, int [unsigned] [unsigned] int real, shortreal double/float byte [unsigned] [unsigned] char enum Enum struct Struct - sc_fixed, sc_ufixed
  • 54. Implementation Effort * System Verilog SystemC FFT Number of code lines 30 37 Implementation time 2 days 1 day Debug time 4 days 3 days DCT Number of code lines 20 20 Implementation time 1 day 1 day Debug time 2 days 2 days FIR Number of code lines 13 16 Implementation time 1 day 1 day Debug time 2 days 2 days Convolution Number of code lines 23 21 Implementation time 1 day 1 day Debug time 1 day 1 day
  • 55. Conclusions Both Octave and SystemC can offer: • greater performance • lower implementation • lower debug time *
  • 56. Conclusions • SV is better when multi-dimensional vectors are involved • Octave is better for particular functions (e.g. FFT, DCT, Convolution or FIR), but language context switch comes at a cost (~2.3 ms/call) • SystemC can help you if you miss Octave fixed point libraries *
  • 57. Q&A *