2013-12-02 19:19:32 -05:00
|
|
|
import unittest
|
|
|
|
|
2015-09-12 07:34:07 -04:00
|
|
|
from migen import *
|
2013-12-02 19:19:32 -05:00
|
|
|
|
2015-04-13 14:45:35 -04:00
|
|
|
|
2014-11-02 23:08:43 -05:00
|
|
|
def _same_slices(a, b):
|
2015-04-13 14:07:07 -04:00
|
|
|
return a.value is b.value and a.start == b.start and a.stop == b.stop
|
2014-11-02 23:08:43 -05:00
|
|
|
|
2015-04-13 14:45:35 -04:00
|
|
|
|
2013-12-02 19:19:32 -05:00
|
|
|
class SignalSizeCase(unittest.TestCase):
|
2015-04-13 14:07:07 -04:00
|
|
|
def setUp(self):
|
2015-09-17 05:23:19 -04:00
|
|
|
self.i = C(0xaa)
|
|
|
|
self.j = C(-127)
|
2015-04-13 14:07:07 -04:00
|
|
|
self.s = Signal((13, True))
|
|
|
|
|
2015-09-26 06:45:10 -04:00
|
|
|
def test_len(self):
|
|
|
|
self.assertEqual(len(self.s), 13)
|
|
|
|
self.assertEqual(len(self.i), 8)
|
|
|
|
self.assertEqual(len(self.j), 8)
|