Skip to content

Commit

Permalink
Merge branch 'isa_ver_pcie_cfg_clone' into 'devel'
Browse files Browse the repository at this point in the history
Update dma medusa verification

See merge request ndk/ndk-fpga!121
  • Loading branch information
jakubcabal committed Dec 10, 2024
2 parents cdbc5e6 + d4d328c commit 0d12f0a
Show file tree
Hide file tree
Showing 4 changed files with 162 additions and 8 deletions.
15 changes: 8 additions & 7 deletions build/scripts/multi_ver/multi_ver.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,13 @@ def run_modelsim(fdo_file, test_name, manual=False, gui=False, coverage=False, e

comb_name = " ".join(comb)
print(f"Running combination: {key} ({comb_name})")
result = run_modelsim(args.fdo_file, f'{test_name_prefix}{key}', coverage=args.coverage, env=env)
if result == 0: # detect failure
print(f"Run SUCCEEDED ({test_name_prefix}{key})")
else:
print(f"Run FAILED ({test_name_prefix}{key})")
FAIL = True
if (not args.dry_run):
result = run_modelsim(args.fdo_file, f'{test_name_prefix}{key}', coverage=args.coverage, env=env)
if result == 0: # detect failure
print(f"Run SUCCEEDED ({test_name_prefix}{key})")
else:
print(f"Run FAILED ({test_name_prefix}{key})")
FAIL = True

# backup transcript
# system("cp transcript transcript_"+"_".join(c))
Expand All @@ -226,8 +227,8 @@ def run_modelsim(fdo_file, test_name, manual=False, gui=False, coverage=False, e
SETTING = create_setting_from_combination(SETTINGS, test_setings)
env = apply_setting(args.test_pkg_file, SETTING, PKG_MOD_SED)

print("Running combination: " + " ".join(test_setings))
if (not args.dry_run):
print("Running combination: " + " ".join(test_setings))
result = run_modelsim(args.fdo_file, f'{test_name_prefix}{test_name}', True, (not args.command_line), coverage=args.coverage, env=env)
if (result == 0): # detect failure
print("Run SUCCEEDED (" + " ".join(test_setings) + ")")
Expand Down
72 changes: 72 additions & 0 deletions comp/ver/pcie/ifg_setup.sv
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,20 @@ class ifg_config_setup;
int unsigned ifg_low = 0;
int unsigned ifg_high = 18;

virtual function ifg_config_setup clone();
ifg_config_setup ret = new();
this.copy(ret);
return ret;
endfunction

function void copy(ifg_config_setup cl);
cl.rand_count = this.rand_count;
cl.ifg_enabled = this.ifg_enabled;
cl.ifg_disabled = this.ifg_disabled;
cl.ifg_low = this.ifg_low;
cl.ifg_high = this.ifg_high;
endfunction

function void display(string prefix = "");
$write("=================================================\n");
$write("== %s\n", prefix);
Expand All @@ -38,6 +52,18 @@ class ifg_config_setup_slow extends ifg_config_setup;
rand_rand_count inside {[rand_count_min:rand_count_max]};
};

virtual function ifg_config_setup clone();
ifg_config_setup_slow ret = new();
this.copy(ret);
return ret;
endfunction

function void copy(ifg_config_setup_slow cl);
super.copy(cl);
cl.rand_count_min = this.rand_count_min;
cl.rand_count_max = this.rand_count_max;
endfunction

function void post_randomize();
this.rand_count = rand_rand_count;
this.ifg_enabled = 90;
Expand All @@ -59,6 +85,18 @@ class ifg_config_setup_fast extends ifg_config_setup;
rand_rand_count inside {[rand_count_min:rand_count_max]};
};

virtual function ifg_config_setup clone();
ifg_config_setup_fast ret = new();
this.copy(ret);
return ret;
endfunction

function void copy(ifg_config_setup_fast cl);
super.copy(cl);
cl.rand_count_min = this.rand_count_min;
cl.rand_count_max = this.rand_count_max;
endfunction

function void post_randomize();
this.rand_count = rand_rand_count;
this.ifg_enabled = 0;
Expand Down Expand Up @@ -104,6 +142,25 @@ class ifg_config_setup_rand extends ifg_config_setup;
rand_ifg_high inside {[ifg_high_min:ifg_high_max]};
};

virtual function ifg_config_setup clone();
ifg_config_setup_rand ret = new();
this.copy(ret);
return ret;
endfunction

function void copy(ifg_config_setup_rand cl);
cl.ifg_enabled_min = this.ifg_enabled_min;
cl.ifg_enabled_max = this.ifg_enabled_max;
cl.ifg_disabled_min = this.ifg_disabled_min;
cl.ifg_disabled_max = this.ifg_disabled_max;
cl.ifg_low_min = this.ifg_low_min;
cl.ifg_low_max = this.ifg_low_max;
cl.ifg_high_min = this.ifg_high_min;
cl.ifg_high_max = this.ifg_high_max;
cl.rand_count_min = this.rand_count_min;
cl.rand_count_max = this.rand_count_max;
endfunction

function void post_randomize();
this.rand_count = rand_rand_count;
this.ifg_enabled = rand_ifg_enabled;
Expand Down Expand Up @@ -202,6 +259,21 @@ class ifg_config_setup_lib extends ifg_config_setup;
IFG_RAND_SLOW :/ dist_rand_slow, IFG_RAND_FAST :/ dist_rand_fast, IFG_RAND_LONG_SPACES :/ dist_rand_long_spaces};
};

virtual function ifg_config_setup clone();
ifg_config_setup_lib ret = new();
this.copy(ret);
return ret;
endfunction

function void copy(ifg_config_setup_lib cl);
cl.dist_slow = this.dist_slow;
cl.dist_fast = this.dist_fast;
cl.dist_rand_slow = this.dist_rand_slow;
cl.dist_rand_medium = this.dist_rand_medium;
cl.dist_rand_fast = this.dist_rand_fast;
cl.dist_rand_long_spaces = this.dist_rand_long_spaces;
endfunction

function void post_randomize();
assert(ifg[ifg_type].randomize());
this.rand_count = ifg[ifg_type].rand_count;
Expand Down
2 changes: 1 addition & 1 deletion extra/dma-medusa
81 changes: 81 additions & 0 deletions tests/jenkins/ver_dma_medusa_new.jenkins
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/*
* ver_dma_medusa.jenkins: Jenkins configuration script
* Copyright (C) 2021 CESNET z. s. p. o.
* Author(s): Jakub Cabal <[email protected]>
*/

// /////////////////////////////////////////////////////////////////////////////
// Add engines for automatic Jenkins verifications into the following list
// FORMAT:
// [ 'name' , 'path_to_ver' , 'fdo_file.fdo' , 'test_pkg.sv/.vhd' , 'settings.py' ]
def COMPONENTS = [\
['Basic Tests' , 'extra/dma-medusa/ver' , 'top_level.fdo' , 'tbench/test_pkg.sv' , 'ver_setings_new.py' ],\
]
// /////////////////////////////////////////////////////////////////////////////

library 'liberouter'

// Set triggering only once every 2 days
properties([
pipelineTriggers([cron('H H(0-2) */2 * *')])
])

// Jenkins configuration for multiple modules
node('preklad') {
lock(label:"resources-${env.NODE_NAME}", quantity: 1) {
// Clean old builds
cleanBuilds()

// fetch sources from GIT
checkout scm
// clean artifacts possibly left by previous builds
sh "git clean -df"

def failed = []
// run verification of every component
for(c in COMPONENTS) {
// parse
def name = c[0]
def path = c[1]
def fdo = c[2]
def pkg = c[3]
def settings = c[4]
def repo_root = pwd()
def multi_ver = "$repo_root/build/scripts/multi_ver/multi_ver.py"
// exec vsim
try { // try-catch is a hack to continue even after the first failed verification
timeout(time: 12, unit: 'HOURS') {
stage("$name") {
dir("$path") {
sh "python3 $multi_ver -p \"$name\" $fdo $pkg $settings"
}
}
}
} catch(err) {
currentBuild.result = 'FAILURE' // still propagate failure status to Jenkins
failed.add("$name")
} finally { // collect interesting files
archiveArtifacts "$path/transcript*" // verification log
}
}

// send out emails if failure is detected
if(currentBuild.result == "FAILURE") {
println "FAILED on components: ${failed}."
emailext \
recipientProviders: [culprits(), developers()],
to: '[email protected], [email protected]',
subject: "[Jenkins] ${currentBuild.currentResult} ${env.JOB_NAME} #${currentBuild.number}",
body: """\
The build of the repository ${env.JOB_NAME} #${currentBuild.number} ends up with status ${currentBuild.currentResult} on components: ${failed}. You can find build log in the attachments.

For more details see ${env.BUILD_URL}.

Yours sincerely
Jenkins\
""".stripIndent(),
attachLog: true,
compressLog: true
}
}
}

0 comments on commit 0d12f0a

Please sign in to comment.