projects
/
soc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove whitespace
[soc.git]
/
TLB
/
test
/
test_address_encoder.py
diff --git
a/TLB/test/test_address_encoder.py
b/TLB/test/test_address_encoder.py
index dd83208f7e619466e7e67685e122214eabaf2dfd..e43b421ae19b92a98c74e3f5a6e4a3e760927e25 100644
(file)
--- a/
TLB/test/test_address_encoder.py
+++ b/
TLB/test/test_address_encoder.py
@@
-15,7
+15,7
@@
from test_helper import assert_eq, assert_ne, assert_op
def set_encoder(dut, i):
yield dut.i.eq(i)
yield
def set_encoder(dut, i):
yield dut.i.eq(i)
yield
-
+
# Checks the single match of the AddressEncoder
# Arguments:
# dut: The AddressEncoder being tested
# Checks the single match of the AddressEncoder
# Arguments:
# dut: The AddressEncoder being tested
@@
-24,16
+24,16
@@
def set_encoder(dut, i):
def check_single_match(dut, sm, op):
out_sm = yield dut.single_match
assert_op("Single Match", out_sm, sm, op)
def check_single_match(dut, sm, op):
out_sm = yield dut.single_match
assert_op("Single Match", out_sm, sm, op)
-
+
# Checks the multiple match of the AddressEncoder
# Arguments:
# dut: The AddressEncoder being tested
# mm (Multiple Match): The expected match result
# Checks the multiple match of the AddressEncoder
# Arguments:
# dut: The AddressEncoder being tested
# mm (Multiple Match): The expected match result
-# op (Operation): (0 => ==), (1 => !=)
+# op (Operation): (0 => ==), (1 => !=)
def check_multiple_match(dut, mm, op):
out_mm = yield dut.multiple_match
assert_op("Multiple Match", out_mm, mm, op)
def check_multiple_match(dut, mm, op):
out_mm = yield dut.multiple_match
assert_op("Multiple Match", out_mm, mm, op)
-
+
# Checks the output of the AddressEncoder
# Arguments:
# dut: The AddressEncoder being tested
# Checks the output of the AddressEncoder
# Arguments:
# dut: The AddressEncoder being tested
@@
-65,23
+65,23
@@
def testbench(dut):
output = 0
yield from set_encoder(dut, input)
yield from check_all(dut, single_match, multiple_match, output, 0, 0, 0)
output = 0
yield from set_encoder(dut, input)
yield from check_all(dut, single_match, multiple_match, output, 0, 0, 0)
-
+
# Check single bit
input = 1
single_match = 1
multiple_match = 0
output = 0
yield from set_encoder(dut, input)
# Check single bit
input = 1
single_match = 1
multiple_match = 0
output = 0
yield from set_encoder(dut, input)
- yield from check_all(dut, single_match, multiple_match, output, 0, 0, 0)
-
+ yield from check_all(dut, single_match, multiple_match, output, 0, 0, 0)
+
# Check another single bit
input = 4
single_match = 1
multiple_match = 0
output = 2
yield from set_encoder(dut, input)
# Check another single bit
input = 4
single_match = 1
multiple_match = 0
output = 2
yield from set_encoder(dut, input)
- yield from check_all(dut, single_match, multiple_match, output, 0, 0, 0)
-
+ yield from check_all(dut, single_match, multiple_match, output, 0, 0, 0)
+
# Check multiple match
# We expected the lowest bit to be returned which is address 0
input = 5
# Check multiple match
# We expected the lowest bit to be returned which is address 0
input = 5
@@
-89,8
+89,8
@@
def testbench(dut):
multiple_match = 1
output = 0
yield from set_encoder(dut, input)
multiple_match = 1
output = 0
yield from set_encoder(dut, input)
- yield from check_all(dut, single_match, multiple_match, output, 0, 0, 0)
-
+ yield from check_all(dut, single_match, multiple_match, output, 0, 0, 0)
+
# Check another multiple match
# We expected the lowest bit to be returned which is address 1
input = 6
# Check another multiple match
# We expected the lowest bit to be returned which is address 1
input = 6
@@
-98,11
+98,9
@@
def testbench(dut):
multiple_match = 1
output = 1
yield from set_encoder(dut, input)
multiple_match = 1
output = 1
yield from set_encoder(dut, input)
- yield from check_all(dut, single_match, multiple_match, output, 0, 0, 0)
-
-
+ yield from check_all(dut, single_match, multiple_match, output, 0, 0, 0)
if __name__ == "__main__":
dut = AddressEncoder(4)
run_simulation(dut, testbench(dut), vcd_name="Waveforms/test_address_encoder.vcd")
if __name__ == "__main__":
dut = AddressEncoder(4)
run_simulation(dut, testbench(dut), vcd_name="Waveforms/test_address_encoder.vcd")
- print("AddressEncoder Unit Test Success")
\ No newline at end of file
+ print("AddressEncoder Unit Test Success")