|  | 
|  |  | 
 |  
|  |  |  |  
|  |  | 
 |  
|  |  | T Flip-Flop |  
|  |  | 
 |  
|  |  |  |  
|  |  | 
 |  
|  |  | Asynchronous reset T - FF |  
|  |  | 
 |  
|  |  | 
  1 //-----------------------------------------------------
  2 // Design Name : tff_async_reset
  3 // File Name   : tff_async_reset.cpp
  4 // Function    : T flip-flop async reset
  5 // Coder       : Deepak Kumar Tala
  6 //-----------------------------------------------------
  7 #include "systemc.h"
  8 
  9 SC_MODULE (tff_async_reset) {
 10   sc_in    <bool> data, clk, reset  ;
 11   sc_out   <bool> q;
 12 
 13   bool q_l ;
 14 
 15   void tff () {
 16     if (~reset.read()) {
 17       q_l = 0;
 18     } else if (data.read()) {
 19       q_l =  ! q_l;
 20     }
 21     q.write(q_l);
 22   }
 23 
 24   SC_CTOR(tff_async_reset) {
 25     SC_METHOD (tff);
 26       sensitive << reset;
 27       sensitive << clk.pos();
 28   }
 29 
 30 };
You could download file sc_examples here |  
|  |  | 
 |  
|  |  | Synchronous reset T - FF |  
|  |  | 
 |  
|  |  | 
  1 //-----------------------------------------------------
  2 // Design Name : tff_sync_reset
  3 // File Name   : tff_sync_reset.cpp
  4 // Function    : T flip-flop sync reset
  5 // Coder       : Deepak Kumar Tala
  6 //-----------------------------------------------------
  7 #include "systemc.h"
  8 
  9 SC_MODULE (tff_sync_reset) {
 10   sc_in    <bool> data, clk, reset  ;
 11   sc_out   <bool> q;
 12 
 13   bool q_l ;
 14 
 15   void tff () {
 16     if (~reset.read()) {
 17       q_l = 0;
 18     } else if (data.read()) {
 19       q_l =  ! q_l;
 20     }
 21     q.write(q_l);
 22   }
 23 
 24   SC_CTOR(tff_sync_reset) {
 25     SC_METHOD (tff);
 26       sensitive << clk.pos();
 27   }
 28 
 29 };
You could download file sc_examples here |  
|  |  | 
 |  
|  |  | 
 |  
|  |  | 
 |  
|  |  |  |  
|  |  | 
 |  |  | 
|  
 |  
 |  
 | 
| 
 | 
|    |  
| Copyright © 1998-2025 |  
| Deepak Kumar Tala - All rights reserved |  
| Do you have any Comment? mail me at:deepak@asic-world.com
 |  |