Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Good news everyone: I've refactored the tests again! #7

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/workflows/verif.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,11 @@ jobs:
- name: Verify with cocotb & verilator
working-directory: ./hdl/verif/cocotb
run: |
source workflow_cfg.sh
pytest --junitxml=pytest_report.xml --report-log=logs/pytest.log -n auto
export COCOTB_TOP=$( realpath . )
export HDL_TOP=$( realpath $COCOTB_TOP/../.. )
export RTL_TOP=$( realpath $HDL_TOP/rtl )
pytest --junitxml=pytest_report.xml --report-log=logs/pytest.log \
-n auto -W ignore::UserWarning

- name: Generate report
if: always()
Expand Down
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
"python.testing.pytestArgs": [
"hdl/verif/cocotb",
"softmodels/tests",
"-n=auto"
"-n=auto",
"-W ignore::UserWarning",
"-s"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
Expand Down
8 changes: 0 additions & 8 deletions cocotb_env
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
COCOTB_TOP="hdl/verif/cocotb"
HDL_TOP="hdl"
RTL_TOP="hdl/rtl"

COCOTB_HDL_TIMEUNIT=1ns
COCOTB_HDL_TIMEPRECISION=1ps

TOPLEVEL_LANG=verilog

SIM=verilator
SIM_BUILD_ARGS="--trace --trace-fst --trace-structs --coverage"
39 changes: 0 additions & 39 deletions hdl/rtl/alu/posit32_alu.sv

This file was deleted.

23 changes: 0 additions & 23 deletions hdl/rtl/alu/posit64_alu.sv

This file was deleted.

24 changes: 0 additions & 24 deletions hdl/rtl/decode/henry_decoder/posit32_decode.sv

This file was deleted.

24 changes: 0 additions & 24 deletions hdl/rtl/decode/henry_decoder/posit64_decode.sv

This file was deleted.

39 changes: 0 additions & 39 deletions hdl/rtl/decode/henry_decoder/posit_variable_count_regime.sv

This file was deleted.

23 changes: 0 additions & 23 deletions hdl/rtl/decode/henry_decoder/posit_variable_decode.sv

This file was deleted.

5 changes: 5 additions & 0 deletions hdl/rtl/typedef/common.sv → hdl/rtl/include/common.svh
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
`ifndef _COMMON_VH_
`define _COMMON_VH_

package common;
typedef enum logic { POS, NEG } sign_t;
endpackage

`endif // _COMMON_VH_
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
`ifndef _POSIT_VH_
`define _POSIT_VH_

package posit_types;

/* handy logic type for sign bit */
Expand All @@ -21,3 +24,5 @@ package posit_types;
} posit64_t;

endpackage

`endif // _POSIT_VH_
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion hdl/rtl/alu/alu_ctrl.sv → hdl/rtl/src/alu/alu_ctrl.sv
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ package alu_ctrl;
ADD,
SUB
} operations_t;
endpackage
endpackage
3 changes: 2 additions & 1 deletion hdl/rtl/alu/comparator.sv → hdl/rtl/src/alu/comparator.sv
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
`include "common.svh"

import common::*;

module comparator #(
Expand Down Expand Up @@ -44,4 +46,3 @@ module comparator #(


endmodule : comparator

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
`include "common.svh"

import common::*;

module posit_32b_add (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
`include "common.svh"

import common::*;

module posit_32b_sub (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
`include "common.svh"

import common::*;

module posit_7b_add (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
`include "common.svh"

import common::*;

module posit_7b_sub (
Expand Down
2 changes: 2 additions & 0 deletions hdl/rtl/alu/two_comp.sv → hdl/rtl/src/alu/two_comp.sv
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// takes a logic bus and reports the twos complement of it
`include "common.svh"

import common::*;

module two_comp #(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
`include "posit_types.svh"

import posit_types::*;

module count_regime_16 (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// returns the input with only the MSB 1 set
`include "common.svh"

import common::*;

module find_first_n_ones #(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// returns the input with only the MSB 1 set
`include "common.svh"

import common::*;

module find_first_one #(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// takes a posit bus and extracts the relevant
// regions as digital signed byte values
`include "common.svh"

import common::*;

// Comb
Expand Down
1 change: 0 additions & 1 deletion hdl/rtl/dff.sv → hdl/rtl/src/dff/dff.sv
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ end
// end
// `endif
endmodule : dff

Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
`include "common.svh"

import common::*;

module format_encoder #(
Expand Down
26 changes: 17 additions & 9 deletions hdl/verif/cocotb/postrun_util/process_results.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
import xml.etree.ElementTree as ET

tree = ET.parse('../pytest_report.xml')
from pathlib import Path


root_filepath = (Path(__file__).parent / '..').resolve()

tree = ET.parse(root_filepath / 'pytest_report.xml')
root = tree.getroot()

print('# Test Results')

## GENERATE SUMMARY
###################
######################
## GENERATE SUMMARY ##
######################

modules = {}
failures = {}
Expand All @@ -30,9 +36,9 @@
split_idx = module_name.rindex('.')
mod_path = module_name[:split_idx].replace('.', '/')
mod_name = module_name[split_idx+1:]
dir_name = test_name.replace('test_', '')
result_filename = (
f"../sim_build/{mod_path}/{dir_name}/{test_name}.results.xml"
result_filename = str(
root_filepath /
f"sim_build/{mod_name}/{test_name}/{test_name}.results.xml"
)

if mod_path not in modules:
Expand Down Expand Up @@ -72,8 +78,8 @@

try:
test_tree = ET.parse(test['filename'])
except:
print("<h5>Internal error displaying test results.</h5>")
except Exception as e:
print(f"<h5>Internal error displaying test results: {e}.</h5>")
continue

test_root = test_tree.getroot()
Expand All @@ -83,7 +89,9 @@
errors = {}
to_process = {}

with open(f"../logs/generated/{item}/{test['test_name']}.log") as logfile:
log_filepath = root_filepath / f"logs/generated/{item}/{test['test_name']}.log"

with open(log_filepath) as logfile:
for i, line in enumerate(logfile):
if 'failed' in line:
test_name = line.split(' ')[-2]
Expand Down
Loading