Test program generation

MicroTESK: An Extendable
Framework for
Test Program Generation
Alexander Kamkin, Tatiana Sergeeva, Andrei Tatarnikov,
Artemiy Utekhin
{kamkin, leonsia, andrewt, utekhin}@ispras.ru
Institute for System Programming of the Russian Academy of Sciences (ISPRAS)
http://hardware.ispras.ru
SYRCoSE 2013 – May 30, 2013 – Kazan, Russia
CPU design

Hardware Description Languages (HDL)


Verilog
VHDL
SYRCoSE 2013 – May 30, 2013 – Kazan, Russia
CPU verification
Target CPU
(HDL)
Execution traces
(formatted text)
Test programs
(assembler)
lui
ori
lui
ori
add
sub
add
s1,
s1,
s3,
s3,
v0,
t1,
t7,
0xdead
s1, 0x0
0xbeef
s3, 0xf
a0, a2
t3, t5
s1, s3
0x2000:
0x2004:
0x2008:
0x200c:
0x2010:
0x2014:
0x2018:
lui
ori
ori
lui
add
sub
add
...
...
...
...
...
...
...
0x2000:
0x2004:
0x2008:
0x200c:
0x2010:
0x2014:
0x2018:
lui
ori
ori
lui
add
sub
add
...
...
...
...
...
...
...
Reference simulator
(C/C++)
SYRCoSE 2013 – May 30, 2013 – Kazan, Russia
Trace
comparator
(Perl, Python)
Test program generation
Design
Requirements
•
•
•
•
?
Test programs
Random (RAVEN)
Combinatorial (MicroTESK v1)
Template-based (Genesys-Pro)
Model-based (research projects)
SYRCoSE 2013 – May 30, 2013 – Kazan, Russia
Framework
Random
?
Combinatorial
Model-based
Template-based
SYRCoSE 2013 – May 30, 2013 – Kazan, Russia
MicroTESK framework
Modeling Framework
Specifications
Translator
Modeling Library
Model Generator
Coverage Library
Coverage Extractor
Design Library
Model
Design Model
Testing Framework
Test Templates
Test Template Processor
Coverage Model
Testing Library
Test Data Generators
Constraint Solver Engine Test Sequence Generators
External Solvers
Test Programs
MicroTESK plugin
Framework Plugin
Core
Modeling
Translator
Instruction Set
Library
Extensions
Memory Management
Testing
Test Generators
Solvers
Design Aspect
Pipelining
User Defined
SYRCoSE 2013 – May 30, 2013 – Kazan, Russia
Specification example
op ADD(rd:GPR, rs:GPR, rt:GPR)
action = {
if(NotWordValue(rs) || NotWordValue(rt)) then
Precondition
UNPREDICTABLE();
endif;
tmp_word = rs<31..31>::rs<31..0> + rt<31..31>::rt<31..0>;
if(tmp_word<32..32> != tmp_word<31..31>) then
SignalException("IntegerOverflow");
else
Test Situations
rd = sign_extend(tmp_word<31..0>);
endif;
}
syntax = format("add %s, %s, %s",
rd.syntax, rs.syntax, rt.syntax)
op ALU = ADD | SUB | …
Equivalence Classes
SYRCoSE 2013 – May 30, 2013 – Kazan, Russia
Template example
# Assembly -Style Code
add r[1], r[2], r[3]
sub r[1], r[1], r[4]
# Ruby Control Statements
(1..3).each do |i|
add r[i], r[i+1], r[i+2]
sub r[i], r[i], r[i+3]
end
# Test Sequence Block
block (:engine => ”random”, :count => 2013)
{
add r[1], r[2], r[3]
sub r[1], r[2], r[3]
# Test Situation Reference
do overflow end
}
SYRCoSE 2013 – May 30, 2013 – Kazan, Russia
Test sequence generator
# Test Sequence Block
block (:combine => ”product”, :compose
=> ”random”) {
# Nested Block A
block (:engine => ”random”,
:length => 3, :count => 2) {
add r[a], r[b], r[c]
sub r[d], r[e], r[f]
mult r[g], r[h]
div r[i], r[j] }
# Nested Block B
block (:engine => ”permutate” ) {
ld r[k], r[l]
• Combinator
st r[m], r[n] }
• Compositor
}
# Combination (1, 1)
sub r[d], r[e], r[f]
ld r[k], r[l]
div r[i], r[j]
st r[m], r[n]
add r[a], r[b], r[c]
# Combination (1, 2)
st r[m], r[n]
sub r[d], r[e], r[f]
ld r[k], r[l]
div r[i], r[j]
add r[a], r[b], r[c]
# Combination (2, 1)
mult r[g], r[h]
mult r[g], r[h]
ld r[k], r[l]
add r[a], r[b], r[c]
st r[m], r[n]
# Combination (2, 2)
mult r[g], r[h]
st r[m], r[n]
mult r[g], r[h]
ld r[k], r[l]
add r[a], r[b], r[c]
SYRCoSE 2013 – May 30, 2013 – Kazan, Russia
# Block A
# Block B
# Block A
# Block B
# Block A
# Block B
# Block A
# Block B
# Block A
# Block A
# Block A
# Block A
# Block B
# Block A
# Block B
# Block A
# Block B
# Block A
# Block B
# Block A
Constraint solver engine
Collection of solvers:
Universal
Custom
MicroTESK framework uses Java Constraint
Solver API
http://forge.ispras.ru/projects/solver-api
SYRCoSE 2013 – May 30, 2013 – Kazan, Russia
Conclusion
• Framework architecture
• Support for common generation techniques
• Extendibility with other methods
• Flexible open-source environment
SYRCoSE 2013 – May 30, 2013 – Kazan, Russia
Contact information
• Institute for System Programming of RAS (ISPRAS)
http://www.ispras.ru
• MicroTESK Test Program Generator
http://forge.ispras.ru/projects/microtesk
• Tatiana Sergeeva
[email protected]
SYRCoSE 2013 – May 30, 2013 – Kazan, Russia
Thank you!
Questions?
SYRCoSE 2013 – May 30, 2013 – Kazan, Russia