• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Mintz q207
 

Mintz q207

on

  • 354 views

 

Statistics

Views

Total Views
354
Views on SlideShare
354
Embed Views
0

Actions

Likes
0
Downloads
0
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • Mention taken heavily from the book. Mention condensing 2 years of writing 340 pages into one hour Mention relation to Verification – bigger projects, more complicated – OOP lets us be more productive
  • Note that information hiding and data abstraction were techniques within an existing language. Languages either allow, support, or encourage these techniques -- Bjarne’s paper OOP has been the best technique for over 20 years
  • Note that information hiding and data abstraction were techniques within an existing language. Languages either allow, support, or encourage these techniques -- Bjarne’s paper OOP has been the best technique for over 20 years
  • Note that information hiding and data abstraction were techniques within an existing language. Languages either allow, support, or encourage these techniques -- Bjarne’s paper OOP has been the best technique for over 20 years
  • Separates “when to do” from “what to do”
  • The monitor code is now maximally reusable. Could have one that just prints, or connects to a checker, or one that connects via a channel. There is now a separation between the monitor function and what to do with the results of monitoring
  • Separates “what to do” from “who does it”
  • The monitor code is now maximally reusable. Could have one that just prints, or connects to a checker, or one that connects via a channel. There is now a separation between the monitor function and what to do with the results of monitoring
  • Hope this talk was useful OOP is exciting and fun stuff
  • Separates “what to do” from “who does it”

Mintz q207 Mintz q207 Presentation Transcript

  • Mike Mintz Co-author, Hardware Verification with C++ and Hardware Verification with SystemVerilog [email_address] OOP for Hardware Verification ̶ Demystified!
  • Overview
    • Common Currency
    • Data Abstraction
    • Virtual Functions
    • Base Classes
    • Q&A
  • Common Currency *There is nothing new under the sun. Sub sole nihil novi est.*
  • Data Abstraction
    • Procedural code has separate data structures and functions.
    • OOP moves the functions into the data structure,
    • Every possible function for that structure is now in one place.
    • This works well for a driver.
  • Data Abstraction – Code Details Procedural Data Abstraction struct usb_driver {wire d_plus, d_minus;} void usb_init (usb_driver * d); void usb_send_packet (usb_driver * d, int type, int* data, int length); void usb_enumerate (usb_driver * d); struct usb_driver { wire d_plus, d_minus; void init (); void send_packet (int type, int* data, int length); void enumerate (); }; begin usb_driver driver; usb_init (&driver); usb_enumerate (&driver); usb_send (&driver, 0, {0,12}, 2); end begin usb_driver driver; driver. init (); driver.enumerate (); driver.send (0, {0,12}, 2); end
  • Virtual Function
    • Is a run-time function call.
    • Is the “I don’t know” function.
    • Great for separating concerns (and increasing portability).
    • This works well for a monitor.
  • Virtual Functions Monitor class Derived for printing struct usb_printer: public usb_monitor { virtual void packet_completed (int length, int* data) { for (int i(0); i < length; ++i) { printf (“Packet [%d]:0x%x ”, i, data[i]); } } }; Derived for checker struct usb_checker : public usb_monitor { virtual void packet_completed (int length, int* data) { checker_->check (length, data); } checker* checker_; }; Derived for channel struct usb_monitor_agent : public usb_monitor { virtual void packet_completed (int length, int* data) { channel_->put (data_packet (length, data)); } usb_channel* channel_; }; struct usb_monitor { wire d_plus, d_minus; void start_monitor_thread (); virtual void packet_completed (int length, int* data) =0; };
  • Base Class
    • Is a class with one or more virtual methods.
    • Is the “follow my lead” class.
    • Sets up a framework or interface.
    • This works well for a test irritator.
  • Base Classes – Code Details struct irritator { virtual void out_of_reset () =0; virtual void start () =0; virtual void stop () =0; virtual void wait_for_completion () =0; }; Irritator class Derived for USB Derived for PCIE Derived for Ethernet struct usb_irritator : public irritator { virtual void out_of_reset (); virtual void start (); virtual void stop (); virtual void wait_for_completion (); }; struct pcie_irritator: public irritator { virtual void out_of_reset (); virtual void start (); virtual void stop (); virtual void wait_for_completion (); }; struct ethernet_irritator: public irritator { virtual void out_of_reset (); virtual void start (); virtual void stop (); virtual void wait_for_completion (); };
  • Using OOP – Truss Top-Level Components Source: Hardware Verification with C++, page 95, page 100 class verification_component { public: verification_component (const std::string&); virtual void randomize () = 0; virtual void time_zero_setup () = 0; virtual void out_of_reset (reset r) = 0; virtual void start () = 0; virtual void wait_for_completion () = 0; virtual void report (const std::string) = 0; };
  • The “Dance” Source: Hardware Verification with C++, page 97 Source: Hardware Verification with C++, page 117
  • The “Dance” ̶ painfully detailed Source: Hardware Verification with C++, page 120 Source: Hardware Verification with C++, page 121
  • Summary
    • OOP is a little bit of syntax with a large amount of attitude.
    • Learning OOP is gradual process, with making mistakes an integral part.
    • OOP is not really that “different” – just different packaging
    • See www.trusster.com for forums, articles, code, and more.
  • Q & A* *shameless plug