<commit_before>;@ map d BUT002

;@ ins k k k
;@ outs k k
opcode FlipFlop, 0, k
  kType xin
  kClk zkr 1 ; CHANGE 
  kIn zkr 2 ; CHANGE 
  kRst zkr 1 ; CHANGE 
  
  kQ init 0 

  ktrig	trigger kClk, 0, 0

  if (ktrig == 0) kgoto Run

  if (kType!=0) kgoto RS
  	kQ = kIn *(kRst>0 ? 0:1)	
  	kgoto Run
  RS:
  	kQ = 1		

Run:
  
  zkw kQ, 1 ; CHANGE
  zkw 1-kQ, 2 ; CHANGE
endop<commit_msg>FlipFlop added.<commit_after>;@ ins k k k
;@ outs k k
opcode FlipFlop, 0, kkkkkk
  kType,kclk,krst,kin,knotq,kq xin
  kClk zkr kclk
  kIn zkr kin
  kRst zkr krst

  kQ init 0

  if kRst != 0 kgoto Reset

  ktrig	trigger kClk, 0, 0

  if (ktrig == 0) kgoto Run

  if (kType!=0) kgoto RS
  	kQ = kIn
  	kgoto Run
  RS:
    if kIn != 0 kgoto Run
  	   kQ = 1 - kQ

Reset:
  kQ = 0
Run:
  zkw kQ, kq
  zkw 1-kQ, knotq
endop

; TODO Time of flip & flop needs checking!

;@ ins a a a
;@ outs a a
opcode FlipFlop, 0, kkkkkk
setksmps 1
  kType,kclk,krst,kin,knotq,kq xin
  aClk zar kclk
  aIn zar kin
  aRst zar krst

  kClk = k(aClk)
  kIn  = k(aIn)
  kRst = k(aRst)

  kQ init 0 

  if kRst != 0 kgoto Reset

  ktrig	trigger kClk, 0, 0

  if (ktrig == 0) kgoto Run

  if (kType!=0) kgoto RS
  	kQ = kIn
  	kgoto Run
  RS:
    if kIn != 0 kgoto Run
  	   kQ = 1 - kQ

Reset:
  kQ = 0
Run:
  zaw a(kQ), kq
  zaw a(1-kQ), knotq
endop
{'fraction_non_alphanumeric': 0.09832317073170732, 'fraction_numerical': 0.03201219512195122, 'mean_word_length': 2.186893203883495, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1549399', 'n_tokens_mistral': 732, 'n_tokens_neox': 665, 'n_words': 217}