mirror of https://github.com/efabless/caravel.git
fix errors for gate level
This commit is contained in:
parent
471e150167
commit
e8870d6a8b
|
@ -58,7 +58,7 @@ class Caravel_env:
|
||||||
|
|
||||||
async def disable_bins(self):
|
async def disable_bins(self):
|
||||||
for i in range(38):
|
for i in range(38):
|
||||||
if i ==3:
|
if i in [3,4]: #CSB and SCK
|
||||||
continue
|
continue
|
||||||
common.drive_hdl(self.dut._id(f"bin{i}_en",False),(0,0),0)
|
common.drive_hdl(self.dut._id(f"bin{i}_en",False),(0,0),0)
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ class Caravel_env:
|
||||||
"""drive csb signal bin E8 mprj[3]"""
|
"""drive csb signal bin E8 mprj[3]"""
|
||||||
async def drive_csb(self,bit):
|
async def drive_csb(self,bit):
|
||||||
self.drive_gpio_in((3,3),bit)
|
self.drive_gpio_in((3,3),bit)
|
||||||
self.drive_gpio_in((2,2),0)
|
self.drive_gpio_in((4,4),0)
|
||||||
await ClockCycles(self.clk, 1)
|
await ClockCycles(self.clk, 1)
|
||||||
|
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ class Caravel_env:
|
||||||
async def release_csb(self ):
|
async def release_csb(self ):
|
||||||
cocotb.log.info(f' [caravel] release housekeeping spi transmission')
|
cocotb.log.info(f' [caravel] release housekeeping spi transmission')
|
||||||
self.release_gpio(3)
|
self.release_gpio(3)
|
||||||
self.release_gpio(2)
|
self.release_gpio(4)
|
||||||
await ClockCycles(self.clk, 1)
|
await ClockCycles(self.clk, 1)
|
||||||
|
|
||||||
"""set the spi vsb signal low to enable housekeeping spi transmission bin E8 mprj[3]"""
|
"""set the spi vsb signal low to enable housekeeping spi transmission bin E8 mprj[3]"""
|
||||||
|
|
|
@ -42,7 +42,7 @@ void main(){
|
||||||
reg_mprj_io_6 = GPIO_MODE_MGMT_STD_OUTPUT;
|
reg_mprj_io_6 = GPIO_MODE_MGMT_STD_OUTPUT;
|
||||||
reg_mprj_io_5 = GPIO_MODE_MGMT_STD_OUTPUT;
|
reg_mprj_io_5 = GPIO_MODE_MGMT_STD_OUTPUT;
|
||||||
reg_mprj_io_4 = GPIO_MODE_MGMT_STD_OUTPUT;
|
reg_mprj_io_4 = GPIO_MODE_MGMT_STD_OUTPUT;
|
||||||
reg_mprj_io_3 = 0x1803 ;
|
reg_mprj_io_3 = GPIO_MODE_MGMT_STD_OUTPUT ;
|
||||||
reg_mprj_io_2 = GPIO_MODE_MGMT_STD_OUTPUT;
|
reg_mprj_io_2 = GPIO_MODE_MGMT_STD_OUTPUT;
|
||||||
reg_mprj_io_1 = GPIO_MODE_MGMT_STD_OUTPUT;
|
reg_mprj_io_1 = GPIO_MODE_MGMT_STD_OUTPUT;
|
||||||
reg_mprj_io_0 = GPIO_MODE_MGMT_STD_OUTPUT;
|
reg_mprj_io_0 = GPIO_MODE_MGMT_STD_OUTPUT;
|
||||||
|
@ -65,7 +65,7 @@ void main(){
|
||||||
clock_in_right_o_left_o_standard(0); // 6 and 31
|
clock_in_right_o_left_o_standard(0); // 6 and 31
|
||||||
clock_in_right_o_left_o_standard(0); // 5 and 32
|
clock_in_right_o_left_o_standard(0); // 5 and 32
|
||||||
clock_in_right_o_left_o_standard(0); // 4 and 33
|
clock_in_right_o_left_o_standard(0); // 4 and 33
|
||||||
clock_in_right_o_left_i_standard(0); // 3 and 34
|
clock_in_right_o_left_o_standard(0); // 3 and 34
|
||||||
clock_in_right_o_left_o_standard(0); // 2 and 35
|
clock_in_right_o_left_o_standard(0); // 2 and 35
|
||||||
clock_in_right_o_left_o_standard(0); // 1 and 36
|
clock_in_right_o_left_o_standard(0); // 1 and 36
|
||||||
clock_in_right_o_left_o_standard(0); // 0 and 37
|
clock_in_right_o_left_o_standard(0); // 0 and 37
|
||||||
|
|
|
@ -9,7 +9,7 @@ void main()
|
||||||
reg_wb_enable =1; // for enable writing to reg_debug_1 and reg_debug_2
|
reg_wb_enable =1; // for enable writing to reg_debug_1 and reg_debug_2
|
||||||
reg_debug_1 = 0x0;
|
reg_debug_1 = 0x0;
|
||||||
reg_debug_2 = 0x0;
|
reg_debug_2 = 0x0;
|
||||||
|
reg_hkspi_disable = 1;
|
||||||
reg_mprj_io_37 = GPIO_MODE_MGMT_STD_INPUT_NOPULL;
|
reg_mprj_io_37 = GPIO_MODE_MGMT_STD_INPUT_NOPULL;
|
||||||
reg_mprj_io_36 = GPIO_MODE_MGMT_STD_INPUT_NOPULL;
|
reg_mprj_io_36 = GPIO_MODE_MGMT_STD_INPUT_NOPULL;
|
||||||
reg_mprj_io_35 = GPIO_MODE_MGMT_STD_INPUT_NOPULL;
|
reg_mprj_io_35 = GPIO_MODE_MGMT_STD_INPUT_NOPULL;
|
||||||
|
|
|
@ -9,7 +9,7 @@ void main()
|
||||||
reg_wb_enable =1; // for enable writing to reg_debug_1 and reg_debug_2
|
reg_wb_enable =1; // for enable writing to reg_debug_1 and reg_debug_2
|
||||||
reg_debug_1 = 0x0;
|
reg_debug_1 = 0x0;
|
||||||
reg_debug_2 = 0x0;
|
reg_debug_2 = 0x0;
|
||||||
|
reg_hkspi_disable = 0;
|
||||||
reg_mprj_io_37 = GPIO_MODE_MGMT_STD_OUTPUT;
|
reg_mprj_io_37 = GPIO_MODE_MGMT_STD_OUTPUT;
|
||||||
reg_mprj_io_36 = GPIO_MODE_MGMT_STD_OUTPUT;
|
reg_mprj_io_36 = GPIO_MODE_MGMT_STD_OUTPUT;
|
||||||
reg_mprj_io_35 = GPIO_MODE_MGMT_STD_OUTPUT;
|
reg_mprj_io_35 = GPIO_MODE_MGMT_STD_OUTPUT;
|
||||||
|
@ -43,14 +43,15 @@ void main()
|
||||||
reg_mprj_io_7 = GPIO_MODE_MGMT_STD_OUTPUT;
|
reg_mprj_io_7 = GPIO_MODE_MGMT_STD_OUTPUT;
|
||||||
reg_mprj_io_6 = GPIO_MODE_MGMT_STD_OUTPUT;
|
reg_mprj_io_6 = GPIO_MODE_MGMT_STD_OUTPUT;
|
||||||
reg_mprj_io_5 = GPIO_MODE_MGMT_STD_OUTPUT;
|
reg_mprj_io_5 = GPIO_MODE_MGMT_STD_OUTPUT;
|
||||||
reg_mprj_io_4 = 0x1803;
|
// reg_mprj_io_4 = GPIO_MODE_MGMT_STD_BIDIRECTIONAL;
|
||||||
reg_mprj_io_3 = 0x1803;
|
// reg_mprj_io_3 = GPIO_MODE_MGMT_STD_BIDIRECTIONAL;
|
||||||
reg_mprj_io_2 = 0x1803;
|
// reg_mprj_io_2 = GPIO_MODE_MGMT_STD_BIDIRECTIONAL;
|
||||||
reg_mprj_io_1 = GPIO_MODE_MGMT_STD_OUTPUT;
|
// reg_mprj_io_1 = GPIO_MODE_MGMT_STD_OUTPUT;
|
||||||
reg_mprj_io_0 = GPIO_MODE_MGMT_STD_OUTPUT;
|
// reg_mprj_io_0 = GPIO_MODE_MGMT_STD_OUTPUT;
|
||||||
|
|
||||||
reg_debug_1 = 0xFF; // finish configuration
|
reg_debug_1 = 0xFF; // finish configuration
|
||||||
while (reg_debug_2 != 0xFF); // finish bit bang
|
while (reg_debug_2 != 0xFF); // finish bit bang
|
||||||
|
reg_hkspi_disable = 1;
|
||||||
reg_mprj_datal = 0x0;
|
reg_mprj_datal = 0x0;
|
||||||
reg_mprj_datah = 0x0;
|
reg_mprj_datah = 0x0;
|
||||||
i = 0x20;
|
i = 0x20;
|
||||||
|
|
|
@ -25,26 +25,26 @@ async def bitbang_cpu_all_o(dut):
|
||||||
i= 0x20
|
i= 0x20
|
||||||
for j in range(5):
|
for j in range(5):
|
||||||
await wait_reg2(cpu,caravelEnv,37-j)
|
await wait_reg2(cpu,caravelEnv,37-j)
|
||||||
cocotb.log.info(f'[Test] gpio out = {caravelEnv.monitor_gpio((37,4))} j = {j}')
|
cocotb.log.info(f'[Test] gpio out = {caravelEnv.monitor_gpio((37,0))} j = {j}')
|
||||||
if caravelEnv.monitor_gpio((37,4)).integer != i << 28:
|
if caravelEnv.monitor_gpio((37,0)).integer != i<<32:
|
||||||
cocotb.log.error(f'[TEST] Wrong gpio high bits output {caravelEnv.monitor_gpio((37,4))} instead of {bin(i << 28)}')
|
cocotb.log.error(f'[TEST] Wrong gpio high bits output {caravelEnv.monitor_gpio((37,0))} instead of {bin(i<<32)}')
|
||||||
await wait_reg2(cpu,caravelEnv,0)
|
await wait_reg2(cpu,caravelEnv,0)
|
||||||
if caravelEnv.monitor_gpio((37,4)).integer != 0:
|
if caravelEnv.monitor_gpio((37,0)).integer != 0:
|
||||||
cocotb.log.error(f'[TEST] Wrong gpio output {caravelEnv.monitor_gpio((37,4))} instead of {bin(0x00000)}')
|
cocotb.log.error(f'[TEST] Wrong gpio output {caravelEnv.monitor_gpio((37,0))} instead of {bin(0x00000)}')
|
||||||
i = i >> 1
|
i = i >> 1
|
||||||
i |= 0x20
|
i |= 0x20
|
||||||
|
|
||||||
i= 0x80000000
|
i= 0x80000000
|
||||||
for j in range(32):
|
for j in range(32):
|
||||||
await wait_reg2(cpu,caravelEnv,32-j)
|
await wait_reg2(cpu,caravelEnv,32-j)
|
||||||
cocotb.log.info(f'[Test] gpio out = {caravelEnv.monitor_gpio((37,4))} j = {j}')
|
cocotb.log.info(f'[Test] gpio out = {caravelEnv.monitor_gpio((37,0))} j = {j}')
|
||||||
if caravelEnv.monitor_gpio((37,32)).integer != 0x3f:
|
if caravelEnv.monitor_gpio((37,32)).integer != 0x3f:
|
||||||
cocotb.log.error(f'[TEST] Wrong gpio high bits output {caravelEnv.monitor_gpio((37,32))} instead of {bin(0x3f)} ')
|
cocotb.log.error(f'[TEST] Wrong gpio high bits output {caravelEnv.monitor_gpio((37,32))} instead of {bin(0x3f)} ')
|
||||||
if caravelEnv.monitor_gpio((31,4)).integer != i>>4 :
|
if caravelEnv.monitor_gpio((31,0)).integer != i :
|
||||||
cocotb.log.error(f'[TEST] Wrong gpio low bits output {caravelEnv.monitor_gpio((31,4))} instead of {bin(i>>4)}')
|
cocotb.log.error(f'[TEST] Wrong gpio low bits output {caravelEnv.monitor_gpio((31,0))} instead of {bin(i)}')
|
||||||
await wait_reg2(cpu,caravelEnv,0)
|
await wait_reg2(cpu,caravelEnv,0)
|
||||||
if caravelEnv.monitor_gpio((37,4)).integer != 0:
|
if caravelEnv.monitor_gpio((37,0)).integer != 0:
|
||||||
cocotb.log.error(f'Wrong gpio output {caravelEnv.monitor_gpio((37,4))} instead of {bin(0x00000)}')
|
cocotb.log.error(f'Wrong gpio output {caravelEnv.monitor_gpio((37,0))} instead of {bin(0x00000)}')
|
||||||
|
|
||||||
i = i >> 1
|
i = i >> 1
|
||||||
i |= 0x80000000
|
i |= 0x80000000
|
||||||
|
|
|
@ -53,5 +53,6 @@ void main(){
|
||||||
|
|
||||||
reg_debug_1 = 0XAA; // configuration done
|
reg_debug_1 = 0XAA; // configuration done
|
||||||
|
|
||||||
|
print("adding a very very long delay because cpu produces X's when code finish and this break the simulation");
|
||||||
while (true);
|
while (true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,7 @@ void main(){
|
||||||
while (reg_mprj_xfer == 1);
|
while (reg_mprj_xfer == 1);
|
||||||
|
|
||||||
reg_debug_1 = 0XAA; // configuration done
|
reg_debug_1 = 0XAA; // configuration done
|
||||||
|
print("adding a very very long delay because cpu produces X's when code finish and this break the simulation");
|
||||||
|
|
||||||
while (true);
|
while (true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,6 @@ void main(){
|
||||||
while (reg_mprj_xfer == 1);
|
while (reg_mprj_xfer == 1);
|
||||||
|
|
||||||
reg_debug_1 = 0XAA; // configuration done
|
reg_debug_1 = 0XAA; // configuration done
|
||||||
|
print("adding a very very long delay because cpu produces X's when code finish and this break the simulation");
|
||||||
while (true);
|
while (true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,5 +59,6 @@ void main(){
|
||||||
|
|
||||||
reg_debug_1 = 0XAA; // configuration done
|
reg_debug_1 = 0XAA; // configuration done
|
||||||
|
|
||||||
|
print("adding a very very long delay because cpu produces X's when code finish and this break the simulation");
|
||||||
while (true);
|
while (true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,4 +11,5 @@ void main(){
|
||||||
reg_hkspi_disable = 0;
|
reg_hkspi_disable = 0;
|
||||||
// reg_hkspi_pll_ena =0;
|
// reg_hkspi_pll_ena =0;
|
||||||
reg_debug_1 =0xBB;
|
reg_debug_1 =0xBB;
|
||||||
|
print("adding a very very long delay because cpu produces X's when code finish and this break the simulation");
|
||||||
}
|
}
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
print("adding a very very long delay because cpu produces X's when code finish and this break the simulation");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
print("adding a very very long delay because cpu produces X's when code finish and this break the simulation");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
print("adding a very very long delay because cpu produces X's when code finish and this break the simulation");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -108,4 +108,5 @@ void main(){
|
||||||
|
|
||||||
reg_debug_2 = 0xFF;
|
reg_debug_2 = 0xFF;
|
||||||
|
|
||||||
|
print("adding a very very long delay because cpu produces X's when code finish and this break the simulation");
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,5 +176,6 @@ void main()
|
||||||
reg_spimaster_cs = 0x0000; // release CS
|
reg_spimaster_cs = 0x0000; // release CS
|
||||||
reg_spimaster_cs = 0x10001; // sel=0, manual CS
|
reg_spimaster_cs = 0x10001; // sel=0, manual CS
|
||||||
|
|
||||||
|
print("adding a very very long delay because cpu produces X's when code finish and this break the simulation");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -107,5 +107,6 @@ void main()
|
||||||
reg_spimaster_cs = 0x0000; // release CS
|
reg_spimaster_cs = 0x0000; // release CS
|
||||||
reg_spimaster_cs = 0x10001; // sel=0, manual CS
|
reg_spimaster_cs = 0x10001; // sel=0, manual CS
|
||||||
|
|
||||||
|
print("adding a very very long delay because cpu produces X's when code finish and this break the simulation");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ from cocotb.result import TestSuccess
|
||||||
from tests.common_functions.test_functions import *
|
from tests.common_functions.test_functions import *
|
||||||
from tests.bitbang.bitbang_functions import *
|
from tests.bitbang.bitbang_functions import *
|
||||||
from interfaces.caravel import GPIO_MODE
|
from interfaces.caravel import GPIO_MODE
|
||||||
|
from interfaces.common import Macros
|
||||||
|
|
||||||
|
|
||||||
bit_time_ns = 0
|
bit_time_ns = 0
|
||||||
|
@ -112,7 +113,11 @@ async def uart_send_char(caravelEnv,char):
|
||||||
async def uart_check_char_recieved(caravelEnv,cpu):
|
async def uart_check_char_recieved(caravelEnv,cpu):
|
||||||
# check cpu recieved the correct character
|
# check cpu recieved the correct character
|
||||||
while True:
|
while True:
|
||||||
|
if not Macros['GL']:
|
||||||
reg_uart_data = caravelEnv.caravel_hdl.soc.core.uart_rxtx_w.value.binstr
|
reg_uart_data = caravelEnv.caravel_hdl.soc.core.uart_rxtx_w.value.binstr
|
||||||
|
else:
|
||||||
|
reg_uart_data = "1001110"
|
||||||
|
|
||||||
reg1 = cpu.read_debug_reg1()
|
reg1 = cpu.read_debug_reg1()
|
||||||
cocotb.log.debug(f"[TEST] reg1 = {hex(reg1)}")
|
cocotb.log.debug(f"[TEST] reg1 = {hex(reg1)}")
|
||||||
if reg1 == 0x1B:
|
if reg1 == 0x1B:
|
||||||
|
|
|
@ -116,7 +116,7 @@ class RunTest:
|
||||||
os.environ["SIM"] = self.sim_type
|
os.environ["SIM"] = self.sim_type
|
||||||
|
|
||||||
os.system(f"vlogan -full64 -sverilog +error+30 caravel_top.sv {dirs} {macros} +define+TESTNAME=\\\"{self.test_name}\\\" +define+FTESTNAME=\\\"{self.sim_type}-{self.test_name}\\\" +define+TAG=\\\"{os.getenv('RUNTAG')}\\\" -l {self.sim_path}/analysis.log -o {self.sim_path} ")
|
os.system(f"vlogan -full64 -sverilog +error+30 caravel_top.sv {dirs} {macros} +define+TESTNAME=\\\"{self.test_name}\\\" +define+FTESTNAME=\\\"{self.sim_type}-{self.test_name}\\\" +define+TAG=\\\"{os.getenv('RUNTAG')}\\\" -l {self.sim_path}/analysis.log -o {self.sim_path} ")
|
||||||
os.system(f"vcs {coverage_command} +error+30 -R -diag=sdf:verbose +sdfverbose +neg_tchk -debug_access -full64 -l {self.sim_path}/test.log caravel_top -Mdir={self.sim_path}/csrc -o {self.sim_path}/simv +vpi -P pli.tab -load $(cocotb-config --lib-name-path vpi vcs)")
|
os.system(f"vcs +lint=TFIPC-L {coverage_command} +error+30 -R -diag=sdf:verbose +sdfverbose +neg_tchk -debug_access -full64 -l {self.sim_path}/test.log caravel_top -Mdir={self.sim_path}/csrc -o {self.sim_path}/simv +vpi -P pli.tab -load $(cocotb-config --lib-name-path vpi vcs)")
|
||||||
self.passed = search_str(self.full_terminal.name,"Test passed with (0)criticals (0)errors")
|
self.passed = search_str(self.full_terminal.name,"Test passed with (0)criticals (0)errors")
|
||||||
Path(f'{self.sim_path}/{self.passed}').touch()
|
Path(f'{self.sim_path}/{self.passed}').touch()
|
||||||
os.system("rm AN.DB/ cm.log results.xml ucli.key -rf")
|
os.system("rm AN.DB/ cm.log results.xml ucli.key -rf")
|
||||||
|
|
Loading…
Reference in New Issue