line use and diff
This commit is contained in:
1 parent
fccf5e0d84
commit
aa7536b8b0
3 files changed
+124
-19
No files matched your search
@@ -8,9 +8,10 @@ from kyupy.logic import mvarray
|
||||
def test_xnor2_delays():
|
||||
op = (sim.XNOR2, 2, 0, 1, 3, 3, -1, 0, 0)
|
||||
#op = (0b0111, 4, 0, 1)
|
||||
c = np.full((4*16, 1), TMAX) # 4 waveforms of capacity 16
|
||||
c = np.full((4*16, 1), TMAX, dtype=np.float32) # 4 waveforms of capacity 16
|
||||
c_locs = np.zeros((4,), dtype='int')
|
||||
c_caps = np.zeros((4,), dtype='int')
|
||||
h = np.zeros((4, 1), dtype=np.float32)
|
||||
|
||||
for i in range(4): c_locs[i], c_caps[i] = i*16, 16 # 1:1 mapping
|
||||
delays = np.zeros((1, 4, 2, 2))
|
||||
@@ -27,7 +28,7 @@ def test_xnor2_delays():
|
||||
|
||||
def wave_assert(inputs, output):
|
||||
for i, a in zip(inputs, c.reshape(-1,16)): a[:len(i)] = i
|
||||
wave_eval_cpu(op, c, c_locs, c_caps, 0, delays, simctl_int)
|
||||
wave_eval_cpu(op, c, c_locs, c_caps, h, 0, delays, simctl_int, 0)
|
||||
for i, v in enumerate(output): np.testing.assert_allclose(c.reshape(-1,16)[2,i], v)
|
||||
|
||||
wave_assert([[TMIN,TMAX],[TMIN,TMAX]], [TMIN,TMAX]) # XNOR(1,1) => 1
|
||||
@@ -40,9 +41,10 @@ def test_xnor2_delays():
|
||||
def test_nand_delays():
|
||||
op = (sim.NAND4, 4, 0, 1, 2, 3, -1, 0, 0)
|
||||
#op = (0b0111, 4, 0, 1)
|
||||
c = np.full((5*16, 1), TMAX) # 5 waveforms of capacity 16
|
||||
c = np.full((5*16, 1), TMAX, dtype=np.float32) # 5 waveforms of capacity 16
|
||||
c_locs = np.zeros((5,), dtype='int')
|
||||
c_caps = np.zeros((5,), dtype='int')
|
||||
h = np.zeros((5, 1), dtype=np.float32)
|
||||
|
||||
for i in range(5): c_locs[i], c_caps[i] = i*16, 16 # 1:1 mapping
|
||||
|
||||
@@ -64,7 +66,7 @@ def test_nand_delays():
|
||||
|
||||
def wave_assert(inputs, output):
|
||||
for i, a in zip(inputs, c.reshape(-1,16)): a[:len(i)] = i
|
||||
wave_eval_cpu(op, c, c_locs, c_caps, 0, delays, simctl_int)
|
||||
wave_eval_cpu(op, c, c_locs, c_caps, h, 0, delays, simctl_int, 0)
|
||||
for i, v in enumerate(output): np.testing.assert_allclose(c.reshape(-1,16)[4,i], v)
|
||||
|
||||
wave_assert([[TMAX,TMAX],[TMAX,TMAX],[TMIN,TMAX],[TMIN,TMAX]], [TMIN,TMAX]) # NAND(0,0,1,1) => 1
|
||||
|
||||
Reference in new issue
Block a user