#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import unittest

from hwt.hdlObjects.specialValues import Time
from hwt.simulator.shortcuts import simPrepare, simUnitVcd
from hwtLib.i2c.masterBitCntrl import I2cMasterBitCtrl


class I2CMasterBitCntrlTC(unittest.TestCase):
    def setUp(self):
        u = I2cMasterBitCtrl()
        self.u, self.model, self.procs = simPrepare(u)
        

    def testNop(self):
        u = self.u
        u.clk_cnt_initVal._ag.data = [4]
    
    
    def runSim(self, name, time=1 * Time.ms):
        simUnitVcd(self.model, self.procs,
                   "tmp/i2cm_bitcntrl_" + name + ".vcd", time=time)
    
if __name__ == "__main__":
    suite = unittest.TestSuite()
    # suite.addTest(TwoCntrsTC('test_withStops'))
    suite.addTest(unittest.makeSuite(I2CMasterBitCntrlTC))
    runner = unittest.TextTestRunner(verbosity=3)
    runner.run(suite)
@@ -154,20 +154,58 @@
 pare
-, simUnitVcd
+%0Afrom hwt.simulator.simTestCase import SimTestCase
 %0Afro
@@ -284,25 +284,19 @@
 CntrlTC(
-unittest.
+Sim
 TestCase
@@ -506,170 +506,46 @@
     
-%0A
     
-%0A    def runSim(self, name, time=1 * Time.ms):%0A        simUnitVcd(self.model, self.procs,%0A                   %22tmp/i2cm_bitcntrl_%22 + name + %22.vcd%22, time=time)
+self.doSim(10 * 10 * Time.ns)%0A    
 %0A   
@@ -786,8 +786,9 @@
 n(suite)
+%0A

standardize I2CMasterBitCntrlTC