Commit a6b872bf by Zachary Snow

don't pack arrays passed to system tasks

- avoid packing memories used with read mem tasks
- fix detection of $readmem[hb] in logic conversion
parent 5b063ec9
...@@ -206,7 +206,7 @@ traverseStmtM (Timing timing stmt) = ...@@ -206,7 +206,7 @@ traverseStmtM (Timing timing stmt) =
return $ Timing timing stmt return $ Timing timing stmt
traverseStmtM (Subroutine (Ident f) args) = do traverseStmtM (Subroutine (Ident f) args) = do
case args of case args of
Args [_, Ident x, _] [] -> Args (_ : Ident x : _) [] ->
if f == "$readmemh" || f == "$readmemb" if f == "$readmemh" || f == "$readmemb"
then collectLHSM $ LHSIdent x then collectLHSM $ LHSIdent x
else return () else return ()
......
...@@ -94,6 +94,8 @@ traverseStmtM = ...@@ -94,6 +94,8 @@ traverseStmtM =
traverseStmtArgsM traverseStmtArgsM
traverseStmtArgsM :: Stmt -> ST Stmt traverseStmtArgsM :: Stmt -> ST Stmt
traverseStmtArgsM stmt @ (Subroutine (Ident ('$' : _)) _) =
return stmt
traverseStmtArgsM stmt @ (Subroutine _ (Args args [])) = traverseStmtArgsM stmt @ (Subroutine _ (Args args [])) =
mapM_ flatUsageM args >> return stmt mapM_ flatUsageM args >> return stmt
traverseStmtArgsM stmt = return stmt traverseStmtArgsM stmt = return stmt
......
...@@ -20,4 +20,7 @@ module top; ...@@ -20,4 +20,7 @@ module top;
#1 arr2[2] = 9; dump(arr2); #1 arr2[2] = 9; dump(arr2);
#1 arr2[3] = 7; dump(arr2); #1 arr2[3] = 7; dump(arr2);
end end
byte arr3 [4];
wire [31:0] arr3_flat = {arr3[0], arr3[1], arr3[2], arr3[3]};
initial $readmemh("tf_unpacked_input.mem", arr3);
endmodule endmodule
...@@ -19,4 +19,7 @@ module top; ...@@ -19,4 +19,7 @@ module top;
#1 arr2[2] = 9; dump(arr2); #1 arr2[2] = 9; dump(arr2);
#1 arr2[3] = 7; dump(arr2); #1 arr2[3] = 7; dump(arr2);
end end
reg [7:0] arr3 [0:3];
wire [31:0] arr3_flat = {arr3[0], arr3[1], arr3[2], arr3[3]};
initial $readmemh("tf_unpacked_input.mem", arr3);
endmodule endmodule
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment