Initial commit
This commit is contained in:
39
verilog/dv/cocotb/user_proj_tests/counter_la/counter_la.c
Normal file
39
verilog/dv/cocotb/user_proj_tests/counter_la/counter_la.c
Normal file
@@ -0,0 +1,39 @@
|
||||
// SPDX-FileCopyrightText: 2023 Efabless Corporation
|
||||
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
|
||||
#include <firmware_apis.h>
|
||||
|
||||
void main(){
|
||||
// Enable managment gpio as output to use as indicator for finishing configuration
|
||||
ManagmentGpio_outputEnable();
|
||||
ManagmentGpio_write(0);
|
||||
enableHkSpi(0); // disable housekeeping spi
|
||||
// configure all gpios as user out then chenge gpios from 32 to 37 before loading this configurations
|
||||
GPIOs_configureAll(GPIO_MODE_USER_STD_OUT_MONITORED);
|
||||
GPIOs_configure(32,GPIO_MODE_USER_STD_OUT_MONITORED);
|
||||
GPIOs_configure(33,GPIO_MODE_USER_STD_OUT_MONITORED);
|
||||
GPIOs_configure(34,GPIO_MODE_USER_STD_OUT_MONITORED);
|
||||
GPIOs_configure(35,GPIO_MODE_USER_STD_OUT_MONITORED);
|
||||
GPIOs_configure(36,GPIO_MODE_USER_STD_OUT_MONITORED);
|
||||
GPIOs_configure(37,GPIO_MODE_USER_STD_OUT_MONITORED);
|
||||
GPIOs_loadConfigs(); // load the configuration
|
||||
ManagmentGpio_write(1); // configuration finished
|
||||
// configure la [63:32] as output from cpu
|
||||
LogicAnalyzer_write(1,7<<16);
|
||||
LogicAnalyzer_outputEnable(1,0);
|
||||
ManagmentGpio_write(0); // configuration finished
|
||||
LogicAnalyzer_outputEnable(1,0xFFFFFFFF);
|
||||
return;
|
||||
}
|
||||
53
verilog/dv/cocotb/user_proj_tests/counter_la/counter_la.py
Normal file
53
verilog/dv/cocotb/user_proj_tests/counter_la/counter_la.py
Normal file
@@ -0,0 +1,53 @@
|
||||
# SPDX-FileCopyrightText: 2023 Efabless Corporation
|
||||
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
|
||||
from caravel_cocotb.caravel_interfaces import test_configure
|
||||
from caravel_cocotb.caravel_interfaces import report_test
|
||||
import cocotb
|
||||
|
||||
@cocotb.test()
|
||||
@report_test
|
||||
async def counter_la(dut):
|
||||
caravelEnv = await test_configure(dut, timeout_cycles=59844)
|
||||
|
||||
cocotb.log.info(f"[TEST] Start counter_la test")
|
||||
# wait for start of sending
|
||||
await caravelEnv.release_csb()
|
||||
await caravelEnv.wait_mgmt_gpio(1)
|
||||
cocotb.log.info(f"[TEST] finish configuration")
|
||||
overwrite_val = 7 # value will be written to the counter by la
|
||||
# expect value bigger than 7
|
||||
await caravelEnv.wait_mgmt_gpio(0) # wait until writing 7 through la
|
||||
received_val = int ((caravelEnv.monitor_gpio(37,30).binstr + caravelEnv.monitor_gpio(7,0).binstr ),2)
|
||||
counter = overwrite_val
|
||||
|
||||
if received_val != counter :
|
||||
cocotb.log.fatal(f"LA writing is incorrect: {overwrite_val} receieved: {received_val}")
|
||||
await cocotb.triggers.ClockCycles(caravelEnv.clk,1)
|
||||
|
||||
# wait until the LA writing is disabled
|
||||
while (received_val == counter):
|
||||
await cocotb.triggers.ClockCycles(caravelEnv.clk,1)
|
||||
received_val = int ((caravelEnv.monitor_gpio(37,30).binstr + caravelEnv.monitor_gpio(7,0).binstr ),2)
|
||||
|
||||
counter = received_val
|
||||
for i in range(100):
|
||||
if counter != int ((caravelEnv.monitor_gpio(37,30).binstr + caravelEnv.monitor_gpio(7,0).binstr ),2) :
|
||||
cocotb.log.error(f"counter have wrong value expected = {counter} recieved = {int ((caravelEnv.monitor_gpio(37,30).binstr + caravelEnv.monitor_gpio(7,0).binstr ),2) }")
|
||||
await cocotb.triggers.ClockCycles(caravelEnv.clk,1)
|
||||
counter +=1
|
||||
|
||||
21
verilog/dv/cocotb/user_proj_tests/counter_la/counter_la.yaml
Normal file
21
verilog/dv/cocotb/user_proj_tests/counter_la/counter_la.yaml
Normal file
@@ -0,0 +1,21 @@
|
||||
# SPDX-FileCopyrightText: 2023 Efabless Corporation
|
||||
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# Yalm file contain general design information that would mostly need to be updated in the first run only
|
||||
|
||||
Tests:
|
||||
- {name: counter_la, sim: RTL}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user