Fix gpio control block access in gatelevel

This commit is contained in:
M0stafaRady 2022-10-15 09:30:11 -07:00
parent 2794932853
commit fb1259dd56
1 changed files with 39 additions and 11 deletions

View File

@ -57,7 +57,7 @@ async def bitbang_cpu_all_o(dut):
@cocotb.test()
@repot_test
async def bitbang_cpu_all_10(dut):
caravelEnv = await test_configure(dut,timeout_cycles=2863378)
caravelEnv,clock = await test_configure(dut,timeout_cycles=1581680)
cpu = RiskV(dut)
cpu.cpu_force_reset()
cpu.cpu_release_reset()
@ -68,11 +68,17 @@ async def bitbang_cpu_all_10(dut):
gpios_h= ("gpio_control_in_2[0]","gpio_control_in_2[1]","gpio_control_in_2[2]","gpio_control_in_2[3]","gpio_control_in_2[4]","gpio_control_in_2[5]","gpio_control_in_2[6]","gpio_control_in_2[7]","gpio_control_in_2[8]","gpio_control_in_2[9]","gpio_control_in_2[10]","gpio_control_in_2[11]","gpio_control_in_2[12]","gpio_control_in_2[13]","gpio_control_in_2[14]","gpio_control_in_2[15]","gpio_control_bidir_2[0]","gpio_control_bidir_2[1]","gpio_control_bidir_2[2]")
type = True # type of shifting 01 or 10
for gpio in gpios_l:
shift(uut._id(gpio,False),type)
if not Macros['GL']:
shift(uut._id(gpio,False),type)
else:
shift(uut._id(f'\\{gpio} ',False),type)
type = not type
type = True # type of shifting 01 or 10
for gpio in reversed(gpios_h):
shift(uut._id(gpio,False),type)
if not Macros['GL']:
shift(uut._id(gpio,False),type)
else:
shift(uut._id(f'\\{gpio} ',False),type)
type = not type
@ -82,9 +88,14 @@ def shift(gpio,shift_type):
else:
bits = "1010101010101"
fail = False
cocotb.log.info(f"[TEST] gpio {gpio} shift {gpio._id(f'shift_register',False).value} expected {bits}")
if not Macros['GL']:
cocotb.log.info(f"[TEST] gpio {gpio} shift {gpio._id(f'shift_register',False).value} expected {bits}")
for i in range(13):
if gpio._id(f"shift_register",False).value.binstr[i] != bits[i]:
if not Macros['GL']:
shift_register = gpio._id(f"shift_register",False).value.binstr[i]
else:
shift_register = gpio._id(f"\\shift_register[{i}] ",False).value.binstr
if shift_register != bits[i]:
fail = True
cocotb.log.error(f"[TEST] wrong shift register {i} in {gpio}")
if not fail:
@ -125,11 +136,17 @@ async def bitbang_cpu_all_0011(dut):
gpios_h= ("gpio_control_in_2[0]","gpio_control_in_2[1]","gpio_control_in_2[2]","gpio_control_in_2[3]","gpio_control_in_2[4]","gpio_control_in_2[5]","gpio_control_in_2[6]","gpio_control_in_2[7]","gpio_control_in_2[8]","gpio_control_in_2[9]","gpio_control_in_2[10]","gpio_control_in_2[11]","gpio_control_in_2[12]","gpio_control_in_2[13]","gpio_control_in_2[14]","gpio_control_in_2[15]","gpio_control_bidir_2[0]","gpio_control_bidir_2[1]","gpio_control_bidir_2[2]")
type = 0 # type of shifting 01 or 10
for gpio in gpios_l:
shift_2(uut._id(gpio,False),type)
if not Macros['GL']:
shift_2(uut._id(gpio,False),type)
else:
shift_2(uut._id(f'\\{gpio} ',False),type)
type = (type + 1) %4
type = 0 # type of shifting 01 or 10
for gpio in reversed(gpios_h):
shift_2(uut._id(gpio,False),type)
if not Macros['GL']:
shift_2(uut._id(gpio,False),type)
else:
shift_2(uut._id(f'\\{gpio} ',False),type)
type = (type + 1) %4
@cocotb.test()
@ -146,11 +163,17 @@ async def bitbang_cpu_all_1100(dut):
gpios_h= ("gpio_control_in_2[0]","gpio_control_in_2[1]","gpio_control_in_2[2]","gpio_control_in_2[3]","gpio_control_in_2[4]","gpio_control_in_2[5]","gpio_control_in_2[6]","gpio_control_in_2[7]","gpio_control_in_2[8]","gpio_control_in_2[9]","gpio_control_in_2[10]","gpio_control_in_2[11]","gpio_control_in_2[12]","gpio_control_in_2[13]","gpio_control_in_2[14]","gpio_control_in_2[15]","gpio_control_bidir_2[0]","gpio_control_bidir_2[1]","gpio_control_bidir_2[2]")
type = 2 # type of shifting 01 or 10
for gpio in gpios_l:
shift_2(uut._id(gpio,False),type)
if not Macros['GL']:
shift_2(uut._id(gpio,False),type)
else:
shift_2(uut._id(f'\\{gpio} ',False),type)
type = (type + 1) %4
type = 2 # type of shifting 01 or 10
for gpio in reversed(gpios_h):
shift_2(uut._id(gpio,False),type)
if not Macros['GL']:
shift_2(uut._id(gpio,False),type)
else:
shift_2(uut._id(f'\\{gpio} ',False),type)
type = (type + 1) %4
def shift_2(gpio,shift_type):
@ -163,9 +186,14 @@ def shift_2(gpio,shift_type):
elif shift_type == 3:
bits = "0011001100110"
fail = False
cocotb.log.info(f"[TEST] gpio {gpio} shift {gpio._id(f'shift_register',False).value} expected {bits}")
if not Macros['GL']:
cocotb.log.info(f"[TEST] gpio {gpio} shift {gpio._id(f'shift_register',False).value} expected {bits}")
for i in range(13):
if gpio._id(f"shift_register",False).value.binstr[i] != bits[i]:
if not Macros['GL']:
shift_register = gpio._id(f"shift_register",False).value.binstr[i]
else:
shift_register = gpio._id(f"\\shift_register[{i}] ",False).value.binstr
if shift_register != bits[i]:
fail = True
cocotb.log.error(f"[TEST] wrong shift register {i} in {gpio}")
if not fail: