00001 `ifndef __teal_latch__ 00002 `define __teal_latch__ 00003 00004 00005 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 00006 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 00007 class latch; 00008 local bit set_; 00009 local bit reset_value_; 00010 local event event_; 00011 local vout log_; 00012 00013 function new (string name, bit reset_on_wait); 00014 log_ = new (name); 00015 set_ = 0; 00016 reset_value_ = !reset_on_wait; 00017 endfunction // new 00018 00019 task signal (); 00020 set_ = 1; 00021 ->event_; 00022 endtask 00023 00024 task clear (); 00025 set_ = 0; 00026 endtask 00027 00028 function bit is_signaled (); return set_; endfunction 00029 00030 task pause (); 00031 // $display ("pause reset val is %0d set value is %0d", reset_value_, set_); 00032 00033 if (set_) begin 00034 set_ = reset_value_; 00035 return; 00036 end 00037 // wait (event_.triggered); //will report again if we reset and wait at the same time. 00038 @(event_); 00039 00040 set_ = reset_value_; 00041 endtask // wait_for_set 00042 00043 task reset_on_wait (bit r); 00044 reset_value_ = !r; 00045 endtask 00046 00047 endclass 00048 `endif
![]() Intelligent Design Verification Project: Teal&Truss, Revision: 1.62c |
Copyright (c) 2008-2010 Intelligent Design Verification. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included here: http://www.intelligentdv.com/licenses/fdl.txt |
![]() Doxygen Version: 1.6.3 IDV SV Filter Version: 2.6.3 Sat Jun 19 12:13:42 2010 |