# DpgenDfft

- Name : DpgenDfft - Dynamic Flip-Flop with Scan-Path Macro-Generator
- Synopsys :

      Generate ( 'DpgenDfft', modelname
               , param = { 'nbit'       : n
                         , 'physical'   : True
                         , 'behavioral' : True
                         }
               )

- Description : Generates a n bits dynamic flip-flop with scan-path named `modelname`. The two latches of this flip-flop are dynamic, i.e. the data is stored in a capacitor.
- Terminal Names :
  - scan : scan-path mode (input, 1 bit)
  - scin : scan path in (input, 1 bit)
  - wen : write enable (1 bit)
  - ck : clock signal (1 bit)
  - i0 : data input (`n` bits)
  - q : output (`n` bits)
  - vdd : power
  - vss : ground
- Parameters : Parameters are given in the map `param`.
  - nbit (mandatory) : Defines the size of the generator
  - physical (optional, default value : False) : In order to generate a layout
  - behavioral (optional, default value : False) : In order to generate a behavior
- How it works :
  - When scan is set to `one`, it enables the scan-path mode. Note that in scan-path mode, the wen signal is not effective
  - scin is the input of the scan-path. This terminal is different from `i0[0]`. The scout is q[N-1] (in the following example this is `q[31]`)
  - When wen is set to `one` enables the writing of the flip-flop
- Example :

      from stratus import *

      class inst_dfft ( Model ) :

        def Interface ( self ) :
          self.scan = SignalIn  ( "scin", 1 )
          self.scin = SignalIn  ( "scan", 1 )
          self.ck   = SignalIn  (   "ck", 1 )
          self.wen  = SignalIn  (  "wen", 1 )
          self.i    = SignalIn  (    "i", 4 )
          self.o    = SignalOut (    "o", 4 )

          self.vdd = VddIn ( "vdd" )
          self.vss = VssIn ( "vss" )

        def Netlist ( self ) :
          Generate ( 'DpgenDfft', 'dfft_4'
                   , param = { 'nbit' : 4
                             , 'physical' : True
                             }
                   )
          self.I = Inst ( 'dfft_4', 'inst'
                        , map = { "wen"  : self.wen
                                , "ck"   : self.ck
                                , "scan" : self.scan
                                , "scin" : self.scin
                                , "i0"   : self.i
                                ,  "q"   : self.o
                                , 'vdd'  : self.vdd
                                , 'vss'  : self.vss
                                }
                        )

        def Layout ( self ) :
          Place ( self.I, NOSYM, Ref(0, 0) )