Add trial of test gpio_all_i_pu still not work

This commit is contained in:
M0stafaRady 2022-10-05 08:22:51 -07:00
parent 4b762da8e6
commit 4610f6b004
4 changed files with 153 additions and 8 deletions

View File

@ -297,12 +297,12 @@ class Caravel_env:
gpio_dm =sum(d * 2**i for i, d in enumerate(gpio_dm)) # convert list to binary int
path.gpio_dm.value = gpio_dm
"""drive the value of mprj bits with spicific data from input pad at the top"""
def release_gpio(self):
io = self.caravel_hdl.padframe.mprj_pads.io
mprj , n_bits = common.signal_valueZ_size(io)
io.value = mprj
cocotb.log.info(f' [caravel] drive_gpio_in pad mprj with {mprj}')
# """drive the value of mprj bits with spicific data from input pad at the top"""
# def release_gpio(self):
# io = self.caravel_hdl.padframe.mprj_pads.io
# mprj , n_bits = common.signal_valueZ_size(io)
# io.value = mprj
# cocotb.log.info(f' [caravel] drive_gpio_in pad mprj with {mprj}')
"""drive the value of mprj bits with spicific data from input pad at the top"""
def drive_gpio_in(self,bits,data):
@ -326,6 +326,20 @@ class Caravel_env:
self.dut._id(f'bin{bits}_en',False).value = 1
cocotb.log.debug(f'[caravel] [drive_gpio_in] drive bin{bits} with {data} and bin{bits}_en with 1')
""" release driving the value of mprj bits """
def release_gpio(self,bits):
data_bits = []
is_list = isinstance(bits, (list,tuple))
if is_list :
cocotb.log.debug(f'[caravel] [drive_gpio_disable] start bits[1] = {bits[1]} bits[0]= {bits[0]}')
for i,bits2 in enumerate(range(bits[1],bits[0]+1)):
self.dut._id(f"bin{bits2}_en",False).value = 0
cocotb.log.debug(f'[caravel] [drive_gpio_disable] release driving bin{bits2}')
else:
self.dut._id(f'bin{bits}_en',False).value = 1
cocotb.log.debug(f'[caravel] [drive_gpio_disable] release driving bin{bits}')
"""drive the value of gpio management"""
def drive_mgmt_gpio(self,data):
mgmt_io = self.dut.gpio_tb

View File

@ -26,7 +26,13 @@
"RTL":["r_rtl","setup","push","push_gl","nightly","weekly","tape_out"],
"GL":["r_gl","push_gl","nightly","weekly","tape_out"],
"GL_SDF":["r_sdf","weekly","tape_out"],
"description":"configure all gpios as mgmt output using automatic approach firmware and check them"}
"description":"configure all gpios as mgmt input using automatic approach firmware and check them"}
,"gpio_all_i_pu" :{"level":0,
"SW":true,
"RTL":["r_rtl","setup","push","push_gl","nightly","weekly","tape_out"],
"GL":["r_gl","push_gl","nightly","weekly","tape_out"],
"GL_SDF":["r_sdf","weekly","tape_out"],
"description":"configure all gpios as mgmt input pull up using automatic approach firmware and check them"}
,"bitbang_cpu_all_10" :{"level":0,
"SW":true,
"RTL":["r_rtl","setup","push","push_gl","nightly","weekly","tape_out"],
@ -194,7 +200,7 @@
"GL":["r_gl","nightly","weekly","tape_out"],
"GL_SDF":["r_sdf","weekly","tape_out"],
"description":"To be deleted"}
,"user_pass_thru_rd" :{"level":0,
"SW":true,
"RTL":["r_rtl","setup","nightly","weekly","tape_out"],

View File

@ -8,6 +8,7 @@ from cocotb.result import TestSuccess
from tests.common_functions.test_functions import *
from tests.bitbang.bitbang_functions import *
from caravel import GPIO_MODE
from cocotb.binary import BinaryValue
reg = Regs()
@ -80,4 +81,47 @@ async def gpio_all_i(dut):
cocotb.log.info(f"[TEST] finish")
@cocotb.test()
@repot_test
async def gpio_all_i_pu(dut):
caravelEnv,clock = await test_configure(dut,timeout_cycles=1245464)
cpu = RiskV(dut)
cpu.cpu_force_reset()
cpu.cpu_release_reset()
uut = dut.uut
# for i in range(200):
# caravelEnv.drive_gpio_in((31,0),0x0)
# await ClockCycles(caravelEnv.clk,10000)
# caravelEnv.drive_gpio_in((31,0),0xFFFFFFFF)
# await ClockCycles(caravelEnv.clk,10000)
# return
await wait_reg1(cpu,caravelEnv,0xAA)
cocotb.log.info(f"[TEST] configuration finished")
await wait_reg1(cpu,caravelEnv,0xB1)
data_in = 0x0
cocotb.log.info(f"[TEST] send {hex(data_in)} to gpio[0:31]")
caravelEnv.drive_gpio_in((31,0),data_in)
await wait_reg1(cpu,caravelEnv,0xB2)
cocotb.log.info(f"[TEST] data {hex(data_in)} sent successfully to gpio[0:31]")
size = 32
data_in = int(size) * 'z'
data_in = 0xFFFFFFFF
cocotb.log.info(f"[TEST] send {data_in} to gpio[0:32]")
caravelEnv.release_gpio((31,0))
await wait_reg1(cpu,caravelEnv,0xB3)
cocotb.log.info(f"[TEST] data {data_in} sent successfully to gpio[0:31]")
data_in = 0x0
cocotb.log.info(f"[TEST] send {hex(data_in)} to gpio[0:16]")
caravelEnv.drive_gpio_in((15,0),data_in)
# await wait_reg2(cpu,caravelEnv,0xFF)
cocotb.log.info(f"[TEST] finish")
await wait_reg1(cpu,caravelEnv,0xFF)

View File

@ -0,0 +1,81 @@
#include <defs.h>
#include <stub.c>
#include "../bitbang/bitbang_functions.c"
void main(){
unsigned int i, j, k;
reg_wb_enable =1; // for enable writing to reg_debug_1 and reg_debug_2
reg_debug_1 = 0x0;
reg_debug_2 = 0x0;
reg_mprj_io_37 = GPIO_MODE_MGMT_STD_INPUT_PULLUP;
reg_mprj_io_36 = GPIO_MODE_MGMT_STD_INPUT_PULLUP;
reg_mprj_io_35 = GPIO_MODE_MGMT_STD_INPUT_PULLUP;
reg_mprj_io_34 = GPIO_MODE_MGMT_STD_INPUT_PULLUP;
reg_mprj_io_33 = GPIO_MODE_MGMT_STD_INPUT_PULLUP;
reg_mprj_io_32 = GPIO_MODE_MGMT_STD_INPUT_PULLUP;
reg_mprj_io_31 = GPIO_MODE_MGMT_STD_INPUT_PULLUP;
reg_mprj_io_30 = GPIO_MODE_MGMT_STD_INPUT_PULLUP;
reg_mprj_io_29 = GPIO_MODE_MGMT_STD_INPUT_PULLUP;
reg_mprj_io_28 = GPIO_MODE_MGMT_STD_INPUT_PULLUP;
reg_mprj_io_27 = GPIO_MODE_MGMT_STD_INPUT_PULLUP;
reg_mprj_io_26 = GPIO_MODE_MGMT_STD_INPUT_PULLUP;
reg_mprj_io_25 = GPIO_MODE_MGMT_STD_INPUT_PULLUP;
reg_mprj_io_24 = GPIO_MODE_MGMT_STD_INPUT_PULLUP;
reg_mprj_io_23 = GPIO_MODE_MGMT_STD_INPUT_PULLUP;
reg_mprj_io_22 = GPIO_MODE_MGMT_STD_INPUT_PULLUP;
reg_mprj_io_21 = GPIO_MODE_MGMT_STD_INPUT_PULLUP;
reg_mprj_io_20 = GPIO_MODE_MGMT_STD_INPUT_PULLUP;
reg_mprj_io_19 = GPIO_MODE_MGMT_STD_INPUT_PULLUP;
reg_mprj_io_18 = GPIO_MODE_MGMT_STD_INPUT_PULLUP;
reg_mprj_io_17 = GPIO_MODE_MGMT_STD_INPUT_PULLUP;
reg_mprj_io_16 = GPIO_MODE_MGMT_STD_INPUT_PULLUP;
reg_mprj_io_15 = GPIO_MODE_MGMT_STD_INPUT_PULLUP;
reg_mprj_io_14 = GPIO_MODE_MGMT_STD_INPUT_PULLUP;
reg_mprj_io_13 = GPIO_MODE_MGMT_STD_INPUT_PULLUP;
reg_mprj_io_12 = GPIO_MODE_MGMT_STD_INPUT_PULLUP;
reg_mprj_io_11 = GPIO_MODE_MGMT_STD_INPUT_PULLUP;
reg_mprj_io_10 = GPIO_MODE_MGMT_STD_INPUT_PULLUP;
reg_mprj_io_9 = GPIO_MODE_MGMT_STD_INPUT_PULLUP;
reg_mprj_io_8 = GPIO_MODE_MGMT_STD_INPUT_PULLUP;
reg_mprj_io_7 = GPIO_MODE_MGMT_STD_INPUT_PULLUP;
reg_mprj_io_6 = GPIO_MODE_MGMT_STD_INPUT_PULLUP;
reg_mprj_io_5 = GPIO_MODE_MGMT_STD_INPUT_PULLUP;
reg_mprj_io_4 = GPIO_MODE_MGMT_STD_INPUT_PULLUP;
reg_mprj_io_3 = GPIO_MODE_MGMT_STD_INPUT_PULLUP;
reg_mprj_io_2 = GPIO_MODE_MGMT_STD_INPUT_PULLUP;
reg_mprj_io_1 = GPIO_MODE_MGMT_STD_INPUT_PULLUP;
reg_mprj_io_0 = GPIO_MODE_MGMT_STD_INPUT_PULLUP;
reg_mprj_io_0 = GPIO_MODE_MGMT_STD_INPUT_PULLUP;
reg_mprj_xfer = 1;
while (reg_mprj_xfer == 1);
reg_debug_1 = 0XAA; // configuration done
// while (true){
// reg_debug_2 = reg_mprj_datal;
// }
reg_debug_1 = 0XB1; // wait environment to send 0x0 to reg_mprj_datal
while (reg_mprj_datal != 0x0);
reg_debug_2 = reg_mprj_datal;
reg_debug_1 = 0XB2; // wait environment to send 0xzzzzzzzz to reg_mprj_datal
while (reg_mprj_datal != 0xFFFFFFFF);
reg_debug_2 = reg_mprj_datal;
reg_debug_1 = 0XB3; // wait environment to send 0xzzzz0000 to reg_mprj_datal
while (reg_mprj_datal != 0xFFFF0000);
reg_debug_2 = reg_mprj_datal;
reg_debug_1 = 0XB5; // wait environment to send 0x0 to reg_mprj_datah
while (reg_mprj_datah != 0x0);
reg_debug_2 = reg_mprj_datah;
reg_debug_1 = 0XB6; // wait environment to send 0xzz to reg_mprj_datah
while (reg_mprj_datah != 0x3F);
reg_debug_2 = reg_mprj_datah;
reg_debug_1 = 0XB7; // wait environment to send 0xz0 to reg_mprj_datah
while (reg_mprj_datah != 0x30);
reg_debug_2 = reg_mprj_datah;
reg_debug_1 = 0xFF;
}