Title: Tel-Aviv university 05-28, 2004
1The e Language
- Tel-Aviv university 05-28, 2004
Meir Ovadia
2Agenda
- The e language
- Syntax and Semantic
- Examples of usage
- Comparing to AspectJ
- e as predicate classes language
- Conclusions
Tel-Aviv University
3About us
- We are Verisity (www.verisity.com)
- We deal in functional verification
- Verification of chips, boards, boxes
- DUT simulated e.g. in VHDL / Verilog
- Main product Specman Elite
- Language e
Tel-Aviv University
4Verifying a DUT using Specman
Tel-Aviv University
5The e language
- A lexically-scoped, single-inheritance,
general-purpose AO language - constructs
- Constraints
- Coverage definitions
- Parallelism
- Temporal constructs
- Bit-access
- sequences
Tel-Aviv University
6The e language
- Compilation and interpretation
- No pre-processor
- Aspects (modules) can loaded/compiled on top of
existing environment
Tel-Aviv University
7Syntax struct declaration
// env.e struct packet i int j
int keep i lt j 1 keep j in 1..5 foo()
is out(Im in foo)
Tel-Aviv University
8Syntax Struct extension
- // special.e
- import env.e
- extend packet keep j 3
- foo() is also
- print j
-
Tel-Aviv University
9Syntax Inheritance
- // cell.e
- import env.e
- struct cell like packet
- header list of bit keep soft header.size()
56 - foo() is first
- header0..31 pack(NULL,j)
-
Tel-Aviv University
10Semantic structs layers
- Each struct declaration or extension called
struct layer - Each layer encapsulate behavior (and data)
- Collections of layers (from different struct)
called aspect. - The struct layers order is the load order
Tel-Aviv University
11Aspect example
// display.e import env.e extend dog
display() is extend poodle display()
is only extend cat display() is
extend snake display() is extend
packet display() is
Tel-Aviv University
12Semantic Methods layers
- Each method declaration or extension called
method layer - Method can declared by
- undefined (i.e. run time error)
- empty
- is
- Method can extended by
- is also (add new layer after existing behavior)
- is first (add new layer before existing
behavior) - is only (new layer override existing behavior)
Tel-Aviv University
13Method layers example
struct A do() int is empty do() int
is also out(1) return 0 struct B like A
do() int is only out(3) return 10 struct
C like A do() int is first out(4) extend
A do() int is also out(5) extend B
do() int is also out(6) result a.do()
1,5 (result 0) result b.do() 3,5,6
(result 10) result c.do() 4,1,5 (result
0) extend dog display() is
extend poodle display() is only
extend cat display() is extend snake
display() is extend packet display() is
Tel-Aviv University
14Encapsulation in e
- Packages (like in Java)
- Types namespace (like in Java)
- Access control
- Public for all packages
- Private to one package
- Private to one struct (i.e. for all layers
including descendants layers) - Private to only one layer
- Friend
Tel-Aviv University
15Monitoring
- Logging
- lt
- // logging.e
- import env.e
- extend packet
- foo() is also log()
- doo() is also log()
- goo() is also log()
-
- gt
Tel-Aviv University
16Monitoring (cont.)
- Tracing Specman has trace package build in.
- Profiling e has profiler as part of the
language. (same as other languages has garbage
collector). - Code style use the reflection.
-
Tel-Aviv University
17Linting
- Forcing access to fields only via setters and
getters - lt
- // point.e
- import env.e
- extend Point
- layer private x int
- layer private y int
- public setX(val int) is x val
- public setY(val int) is y val
- public getX() int is return x
- public getY() int is return y
-
- gt
Tel-Aviv University
18Aspect encapsulation
// eat.e package eating import env.e extend
Animal eat() is undefined extend Mammal
eat() is only extend Dog eat() is also
extend Fowl eat() is only extend
LoveBird eat() is first
Tel-Aviv University
19Patches
- Very easy to send a patch to customers
- lt
- extend my_struct
- foo() is only .
-
- div(i int j int) is first
- if (j 0) error()
-
-
- gt
-
20Testing
- Each test extend the core environment and modify
it.
lt //Test2.e extend packet keep kind
error send() is only
check() is only gt
lt //Test1.e extend packet keep
data.size() 50 send() is first
data0 data5 check() is
also gt
21Predicate Classes
- Similar to Craig Chambers Predicate Class
- Useful for specifying multiple, almost-orthogonal
dimensions. - Metamorphism
- No need to explicitly enumerate all combinations
- Security and factory.
Tel-Aviv University
22Predicate classes Example
type color_t red, green, blue type size_t
big, small extend packet color color_t
size size_t when red packet keep
data.size() 40 when green small packet
show() is also when green packet foo()
is when big packet . when red
big packet
Tel-Aviv University
23Local optimization
// opt.e import env.e extend Algorithm
keep cond gt kind opt extend opt
Algorithm calc() is only
24Disadvantage of e
- Private language (private BNF)
- No abstract classes
- Small users community (comparing to C)
- Java has some advantages on e. (like Jbuilder or
databases packages)
Tel-Aviv University
25Advantage of e
- Powerful AOP but yet no new concepts
- Easy to manage
- Easy to collect struct layers
- Easy to collect method layer (by declare order or
run time order) - Easy to debug (break on layer or on all layers)
- Aspect can loaded on top of compiled env
- Good performance (method layer equal to method
call) - Many commercial tools use e (as AO language)
- Not break the OOP encapsulation
Tel-Aviv University
26Conclusion
- AO is not a keyword to mess oriented
- AOP can not replace good modeling
- Someday in the future someone will write NEW open
source AOP language and it will looks like e
(same ideas). - We need do declare how to model problems using
AOP?
Tel-Aviv University
27Other issues related to e
- The e parser (backtracking)
- The temporal language in e
- The constraint solver in e
- The define as and define as computed
- Ports to any simulator
- The eCel
- Bit slice algorithms
28Thank you
Tel-Aviv University