You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[General]: Count_Set_Bits and Extend read an undeclared variable x #98
function Std::Bits::Count_Set_Bits(implicit size : {0..}, a : Bits(size)) -> {0..size}
begin
var result : {0..size} := 0;
for i := 0 to size-1 do
if x[i] == 0b1 then
result := result + 1;
end
end
return result;
end
function Std::Bits::Extend(implicit source_size : {0..}, a : Bits(source_size), target_size : {..}, is_unsigned : Boolean) -> Bits(target_size)
begin
return if is_unsigned then Zero_Extend(x, target_size) else Sign_Extend(x, target_size);
end
Neither body type-checks as published. Both functions are used: POPCNT calls Count_Set_Bits (POPCNT.xml line 138), and Dot_Product calls Extend.
Proposed fix
- if x[i] == 0b1 then+ if a[i] == 0b1 then
- return if is_unsigned then Zero_Extend(x, target_size) else Sign_Extend(x, target_size);+ return if is_unsigned then Zero_Extend(a, target_size) else Sign_Extend(a, target_size);
AI disclosure
Assisted-by: Claude
Claude assisted with source analysis, the proposed correction and drafting this report.
Reviewed with assistance from Codex.
Pinned source: definitions.xml.gz at revision 35eface1b7ee003a1cda95005ec5fd83de658a64.
Activity