Commit 1ba5ab27 by Zachary Snow

size using lhs for reg continuous assignment indirection

parent 44afcf5b
......@@ -118,7 +118,7 @@ traverseModuleItem ports scopes =
]
where
t = Net (NetType TWire) Unspecified
[(DimsFn FnBits $ Right expr, RawNum 1)]
[(DimsFn FnBits $ Right $ lhsToExpr lhs, RawNum 1)]
x = "sv2v_tmp_" ++ shortHash (lhs, expr)
-- rewrite port bindings to use temporary nets where necessary
fixModuleItem (Instance moduleName params instanceName rs bindings) =
......
module example(sel, out);
parameter W = 8;
typedef struct packed {
logic [W/2-1:0] x;
logic [W/2-1:0] y;
} line_t;
line_t [3:0] arr;
initial begin
arr[0] = 8'b01000011;
arr[1] = 8'b00010110;
arr[2] = 8'b10001111;
arr[3] = 8'b01100110;
end
input logic [1:0] sel;
output line_t out;
assign out.x = sel ? arr[sel].x : '0;
always @* out.y = sel ? arr[sel].y : '0;
endmodule
module example(sel, out);
parameter W = 8;
reg [7:0] arr [3:0];
initial begin
arr[0] = 8'b01000011;
arr[1] = 8'b00010110;
arr[2] = 8'b10001111;
arr[3] = 8'b01100110;
end
input [1:0] sel;
output [7:0] out;
assign out = sel ? arr[sel] : 8'b0;
endmodule
module top;
reg [1:0] sel;
wire [7:0] out;
example e(.sel, .out);
integer i = 0;
initial
for (i = 0; i < 10; i = i + 1)
#1 sel = i;
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