Applications t k prasadwright edu http www knoesis
- Slides: 31
Applications t. k. prasad@wright. edu http: //www. knoesis. org/tkprasad/ cs 774 (Prasad) L 13 Applications 1
VHDL-Parser Pretty-Printer System t. k. prasad@wright. edu http: //www. knoesis. org/tkprasad/ cs 774 (Prasad) L 13 Applications 2
URLs • Online Parser Documentation – http: //www. cs. wright. edu/~tkprasad/VHDL/VH DL-AMS/START. html • Public Distribution – http: //www. cs. wright. edu/~tkprasad/VHDL/VH DL-AMS. zip cs 774 (Prasad) L 13 Applications 3
A Meta-Interpreter for circuit Extraction t. k. prasad@wright. edu http: //www. knoesis. org/tkprasad/ cs 774 (Prasad) L 13 Applications 4
Outline • Formal Description of Digital Circuits • Design Verification • Motivation for Applying Metaprogramming Techniques • Implementation and Correctness Considerations • Conclusions cs 774 (Prasad) L 13 Applications 5
Hierarchical Description of Circuit Design Full. Adder Component Half-Adder Sub-Components Abstraction Gate-level Description CMOS Transistors Transistor Netlist cs 774 (Prasad) AND-ORNAND Gates L 13 Applications 6
Declarative Specification of the Structure: Inverter and Netlist GND cs 774 (Prasad) Single Inverter: inv(In, Out, X, Y) : pt(In, vdd, Out, X, Y), nt(In, gnd, Out, _, _). Netlist: pt(in 1, vdd, out 1, 50). nt(in 1, gnd, out 1, 50, 40). pt(out 1, vdd, out 2, 100, 50). nt(out 1, gnd, out 2, 100, 40). L 13 Applications 7
Problem and Solution Strategy • Verify structural correctness of a component layout by reverse engineering the top-level design. • Use automatically generated Prolog extraction rules – Prolog specifications are executable and can be used to simulate the circuit or check for faults by designing suitable queries cs 774 (Prasad) L 13 Applications 8
Circuit Extraction MAGIC (CAD Tool) Layout TRANSLATE Netlist : Prolog Facts EXTRACT Higher-level Components cs 774 (Prasad) L 13 Applications 9
Extraction Rules in Prolog extract_inverter : pt(In, vdd, Out, X, Y), nt(In, gnd, Out, _, _), remove_pt(In, vdd, Out), remove_nt(In, gnd, Out), asserta(inverter(In, Out, X, Y)). cs 774 (Prasad) L 13 Applications 10
Finer Points • Retracts not undone on backtracking => Identify complete component before retracting • Retract all occurrences of a component => Use “fail” appropriately. cs 774 (Prasad) L 13 Applications 11
Spec vs Extraction Template component : subcomponent_1 subcomponent_2. cs 774 (Prasad) extract_component : subcomponent_1 subcomponent_2, retract(subcomponent_1), retract(subcomponent_2), assert(component), fail. L 13 Applications 12
Problem and Our Solution • Requires generation of customized extraction rules (for each component) explicitly (which causes duplication of information). • Use meta-programming techniques to perform extraction “on-the-fly” using declarative specification of the structure of the component. cs 774 (Prasad) L 13 Applications 13
• Advantage: Avoids explicit creation and storing of extraction rules • Disadvantage: Meta-interpretation is slower than using customized extraction rules • Pragmatically: Explicit rules are good for extracting low-level components, while meta-interpreter is good for extracting highlevel component extraction cs 774 (Prasad) L 13 Applications 14
Meta-Rule extract(Comp) : clause(Comp, Sub_Comps), Sub_Comps == true, call(Sub_Comps), remove_primitive(Sub_Comps), asserta(Comp), fail. extract(_). cs 774 (Prasad) L 13 Applications 15
remove_primitive((C 1, C 2)) : !, remove_primitive(C 1), remove_primitive(C 2). remove_primitive(C) : clause(C, true), !, retract(C). remove_primitive(C) : clause(Comp, Sub_Comps), remove_primitive(Sub_Comps). cs 774 (Prasad) L 13 Applications 16
(cont’d) • The interpreter does not work properly if the definition also contains ordinary predicates, written to capture connectivity constraints, position calculations, etc. • Introduce special meta-predicate constraint as follows: constraint(Test) : - call(Test). remove_primitive(constraint(_)): -!. cs 774 (Prasad) L 13 Applications 17
Example inv. Z(P, N, I, O, X, Y) : pt(I, vdd, Q, X 1, Y 1), pt(P, Q, O, X 2, Y 2), nt(N, O, R, X 3, Y 3), nt(I, R, gnd, X 4, Y 4), constraint( + connected([Q, R, vdd, gnd]) ), constraint( X is (X 1+X 2+X 3+X 4)/4, Y is (Y 1+Y 2+Y 3+Y 4)/4 ). cs 774 (Prasad) L 13 Applications 18
Correctness Issue • Facts and rule-heads are disjoint. The lowest -level is represented as facts. Retraction of facts is sufficient. • Each fact contributes to just one rule. Subcomponents are not shared. Retraction of a fact does not interfere with the extraction of other components. (Stratification of sorts) cs 774 (Prasad) L 13 Applications 19
Conclusion • Meta-interpreter approach uses the declarative specification of a design directly, to perform extraction. • This approach is flexible, for higher-level components. The trade-off is that it is inefficient for lower-level components. cs 774 (Prasad) L 13 Applications 20
Meta-Interpreters Ref: Yoav Shoham’s AI Techniques in Prolog cs 774 (Prasad) L 13 Applications 21
Types Extensions • Backward Chaining (Topdown) • Expert systems • Mycin – Depth-first • Prolog – Breadth-first • Abductive Reasoning • Diagnosis • Forward Chaining (Bottomup) • Production Systems cs 774 (Prasad) • Annotated Logic Programming L 13 Applications 22
Representing forward chaining rules op(1000, xfy, ‘, ’). op(1150, xfx, ‘-: ’). p -: q. r, s -: p. q -: t. • Forward chaining adds new conclusions using rules in response to facts of the database and the newly asserted conclusions. cs 774 (Prasad) L 13 Applications 23
Membership in and-list amember(X, (A, B)) : !, ( X = A; amember(X, B)). amember(A, A). • Recall op(_, xfy, ‘, ’). cs 774 (Prasad) L 13 Applications 24
Propagating the effect of facts • Forward chaining interpreter recursively determines the conclusions forced by the facts and the rules, and asserts them explicitly. – Given the set of rules, each fact is asserted one by one (using the code shown on the next slide) and the conclusions implied by them are determined. • Specifically, the head of a rule is asserted after all the literals in the body of the rule have been asserted. cs 774 (Prasad) L 13 Applications 25
Propagating the effects of facts update(X) : - clause(X, true), !. update(X) : assert(X), ( If -: Then ), amember(X, If), + ((amember(Y, If), +(clause(Y, true)))), update(Then), fail. cs 774 (Prasad) L 13 Applications 26
Propagating the effect of facts • Complexity of update() • O( number of rules * number of body literals) • Can be optimized and extended to include negative literals, deletion, and maintaining justifications. • Reference: Chapter 4 of Yoav Shoham’s AI Techniques in Prolog cs 774 (Prasad) L 13 Applications 27
Pooling of Evidence : The Mycin approach Ref: Yoav Shoham’s AI Techniques in Prolog cs 774 (Prasad) L 13 Applications 28
Introducing Certainty Factor • Facts => CF = 1 • Rules => CF in [0, 1] high_fever. (1) malaria : - high_fever, recently_in_jungle. (0. 8) malaria : - … cs 774 (Prasad) L 13 Applications 29
Mycin Interpreter cert(true, 1). cert( (A, B), C) : - !, cert(A , C 1), cert(B, C 2), comb_fn_serial(C 1, C 2, C). cert( A, C) : - !, findall(CC, (clause(A, B, CF), cert(B , CC)), CLst), comb_fn_parallel(CLst, C). cs 774 (Prasad) L 13 Applications 30
Other Static Analysis Tools • Type Checking/Inference append(list(X), list(X)). fact(int, int). • Mode Inference append(+, +, _) cs 774 (Prasad) L 13 Applications 31
- Edu.sharif.edu
- Gestalt leveling
- Teachertech.rice.edu
- Learn.genetics.utah.edu
- Htpp://scratch.mit.edu
- Dlib.nyu.edu/aco/
- Optics topics
- Reshuege math
- Naplan online practise
- Handbook for principals and naplan coordinators
- Http://evolution.berkeley.edu -
- Https//scratch.mit.edu
- " title="" />
- Isaac chewed pen
- Numericalmethods.eng.usf.edu
- Http sinhvien hufi edu vn
- Scratch animate your name
- Http://teachertech.rice.edu/participants/louviere/newton/
- Http://numericalmethods.eng.usf.edu
- Http://weather.uwyo.edu/upperair/sounding.html
- Http//scratch.mit.edu/
- Http //www.phys.hawaii.edu/ teb/optics/java/slitdiffr/
- Http://www.colorado.edu/physics/phet
- Http://learn.genetics.utah.edu/content/addiction/
- Faculty marshall usc advertising csv
- Http://dendro.cnre.vt.edu/forestbiology/photosynthesis.swf
- Htttps://scratch.mit.edu/
- 2learner.hcmup.edu.vn
- Http //scratch.mit.edu
- Https //scratch.mit.edu/
- Http://weather.uwyo.edu/upperair/sounding.html
- Http://numericalmethods.eng.usf.edu