Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

print control code meanings #12

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
30 changes: 29 additions & 1 deletion lib/MaxAs/MaxAsGrammar.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1353,7 +1353,35 @@ sub printCtrl
$readb = $readb == 7 ? '-' : $readb + 1;
$watdb = $watdb ? sprintf('%02x', $watdb) : '--';

return sprintf '%s:%s:%s:%s:%x', $watdb, $readb, $wrtdb, $yield, $stall;
my @codes;
if($readb ne '-') {
push @codes, "setReadBarrier($readb)";
}
if($wrtdb ne '-') {
push @codes, "setWriteBarrier($wrtdb)";
}
if($watdb ne '--') {
my @barriers;
for(my $barrier=1; $barrier <= 6; $barrier++) {
my $bitvalue = 1 << ($barrier - 1);
if($watdb & $bitvalue) {
push @barriers, $barrier;
}
}
my $barrierstring = sprintf "waitBarriers([%s])", join(",", @barriers);
push @codes, $barrierstring;
}
if($yield ne '-') {
push @codes, "yield()";
}
if($stall > 0) {
push @codes, "stall($stall)";
}
my $res = join(";", @codes);
if($res ne "") {
$res = join("", "# ", $res, "\n");
}
return sprintf "%s%s:%s:%s:%s:%x", $res, $watdb, $readb, $wrtdb, $yield, $stall;
}
sub readCtrl
{
Expand Down