OOP for Hardware Verification--Demystified!
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
717
On Slideshare
704
From Embeds
13
Number of Embeds
3

Actions

Shares
Downloads
6
Comments
0
Likes
0

Embeds 13

http://www.dvclub.org 11
http://dubai.directrouter.com 1
http://dvclub.org 1

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide
  • 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”

Transcript

  • 1. OOP for Hardware Verification ̶ Demystified! Mike Mintz Co-author, Hardware Verification with C++and Hardware Verification with SystemVerilog mike@trusster.com www.trusster.com 1
  • 2. Overview• Common Currency• Data Abstraction• Virtual Functions• Base Classes• Q&A www.trusster.com 2
  • 3. Common Currency Sub sole nihil novi est.**There is nothing new under the sun. www.trusster.com 3
  • 4. 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. www.trusster.com 4
  • 5. Data Abstraction – Code DetailsProcedural Data Abstraction struct usb_driver {struct usb_driver {wire d_plus, d_minus;} wire d_plus, d_minus;void usb_init (usb_driver * d); void init ();void usb_send_packet (usb_driver * d, void send_packet (int type, int* data, int type, int* data, int length); int length);void usb_enumerate (usb_driver * d); void enumerate (); };begin begin usb_driver driver; usb_driver driver; driver. init (); usb_init (&driver); driver.enumerate (); usb_enumerate (&driver); driver.send (0, {0,12}, 2); usb_send (&driver, 0, {0,12}, 2); endend www.trusster.com 5
  • 6. 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. www.trusster.com 6
  • 7. Virtual FunctionsMonitor class Derived for printing struct usb_printer: public usb_monitor { struct usb_monitor { virtual void packet_completed (int length, int* data) { wire d_plus, d_minus; for (int i(0); i < length; ++i) { void start_monitor_thread (); printf (“Packet [%d]:0x%xn”, i, data[i]); } virtual void packet_completed } (int length, int* data) =0; }; };Derived for checker Derived for channelstruct usb_checker : public usb_monitor { struct usb_monitor_agent : public usb_monitor { virtual void packet_completed (int virtual void packet_completed (int length, length, int* data) { int* data) { checker_->check (length, data); channel_->put (data_packet (length, data)); } }checker* checker_; usb_channel* channel_;}; }; www.trusster.com 7
  • 8. 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. www.trusster.com 8
  • 9. Base Classes – Code Details Irritator class Derived for USBstruct irritator { struct usb_irritator : public irritator { virtual void out_of_reset () =0; virtual void out_of_reset (); virtual void start () =0; virtual void start (); virtual void stop () =0; virtual void stop (); virtual void wait_for_completion () =0; virtual void wait_for_completion ();}; }; Derived for PCIE Derived for Ethernetstruct pcie_irritator: public irritator { struct ethernet_irritator: public irritator { virtual void out_of_reset (); virtual void out_of_reset (); virtual void start (); virtual void start (); virtual void stop (); virtual void stop (); virtual void wait_for_completion (); virtual void wait_for_completion ();}; }; www.trusster.com 9
  • 10. Using OOP – Truss Top-Level Components 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; };Source: Hardware Verification with C++, page 95, page 100 www.trusster.com 10
  • 11. The “Dance”Source: Hardware Verification with C++, page 97 Source: Hardware Verification with C++, page 117 www.trusster.com 11
  • 12. The “Dance” ̶ painfully detailed Source: Hardware Verification with C++, page 120 Source: Hardware Verification with C++, page 121 www.trusster.com 12
  • 13. 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. www.trusster.com 13
  • 14. Q & A**shameless plug www.trusster.com 14