1 / 28

The e Language

The e Language. Meir Ovadia. Tel-Aviv university 05-28, 2004. Agenda. The e language Syntax and Semantic Examples of usage Comparing to AspectJ e as predicate classes language Conclusions. Tel-Aviv University. About us. We are Verisity ( www.verisity.com )

KeelyKia
Download Presentation

The e Language

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. The e Language Meir Ovadia Tel-Aviv university 05-28, 2004

  2. Agenda • The e language • Syntax and Semantic • Examples of usage • Comparing to AspectJ • e as predicate classes language • Conclusions Tel-Aviv university Tel-Aviv University

  3. About 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 Tel-Aviv University

  4. Verifying a DUT using Specman Tel-Aviv university Tel-Aviv University

  5. The e language • A lexically-scoped, single-inheritance, general-purpose AO language • constructs: • Constraints • Coverage definitions • Parallelism • Temporal constructs • Bit-access • sequences Tel-Aviv university Tel-Aviv University

  6. The e language • Compilation and interpretation • No pre-processor • Aspects (modules) can loaded/compiled on top of existing environment Tel-Aviv university Tel-Aviv University

  7. Syntax: struct declaration // env.e struct packet {i : int; j : int; keep i < j + 1; keep j in [1..5]; foo() is { out(“I’m in foo”); }; }; Tel-Aviv university Tel-Aviv University

  8. // special.e import env.e; extend packet {keep j == 3; foo() is also { print j; }; }; Syntax: Struct extension Tel-Aviv university Tel-Aviv University

  9. // cell.e import env.e; struct cell like packet { header: list of bit;keepsoft header.size() == 56; foo() is first { header[0..31] = pack(NULL,j); }; }; Syntax: Inheritance Tel-Aviv university Tel-Aviv University

  10. Semantic: struct’s 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 layer’s order is the load order Tel-Aviv university Tel-Aviv University

  11. Aspect: example //display.e importenv.e; extend dog{ display()is{ …}; }; extendpoodle{ display()is only {…};}; extendcat{display()is{…};}; extendsnake{ display()is{…};}; extendpacket{ display()is{…};}; Tel-Aviv university Tel-Aviv University

  12. Semantic: Method’s 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 Tel-Aviv University

  13. Method 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 Tel-Aviv University

  14. Encapsulation 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 Tel-Aviv University

  15. Monitoring • Logging <‘ //logging.e importenv.e; extend packet{ foo()isalso{ log(…);}; doo()isalso{ log(…);}; goo()isalso { log(…);}; }; ‘> Tel-Aviv university Tel-Aviv University

  16. Monitoring (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 Tel-Aviv University

  17. Linting • Forcing access to fields only via setters and getters <‘ //point.e importenv.e; extend Point { layer privatex: int; layer privatey: int; public setX(val: int)is{ x = val;}; publicsetY(val: int)is{ y = val;}; publicgetX(): intis{returnx;}; publicgetY(): intis{ returny;}; }; ‘> Tel-Aviv university Tel-Aviv University

  18. Aspect encapsulation //eat.e packageeating; importenv.e; extend Animal { eat()is undefined; }; extendMammal { eat()is only{…};}; extendDog { eat()isalso{…};}; extendFowl { eat()isonly{…};}; extendLoveBird { eat()isfirst{…};}; Tel-Aviv university Tel-Aviv University

  19. Patches • Very easy to send a patch to customers <‘ extend my_struct { foo() is only {….}; div(i: int; j: int) is first { if (j == 0) { error(…); }; }; }; ‘> Tel-Aviv university

  20. Testing • Each test extend the core environment and modify it. <‘ //Test2.e extend packet { keep kind == error; send() is only { … }; check() is only {…}; }; ‘> <‘ //Test1.e extend packet { keep data.size() == 50; send() is first { data[0] = data[5] }; check() is also {…}; }; ‘> Tel-Aviv university

  21. Predicate 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 Tel-Aviv University

  22. Predicate 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 Tel-Aviv University

  23. Local optimization // opt.e importenv.e; extend Algorithm { keep cond => kind == opt; }; extend opt Algorithm { calc() is only { …}; }; Tel-Aviv university

  24. Disadvantage 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 Tel-Aviv University

  25. Advantage 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 Tel-Aviv University

  26. Conclusion • 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 Tel-Aviv University

  27. Other 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 Tel-Aviv university

  28. Thank you Tel-Aviv university Tel-Aviv University

More Related