I am trying to compile SystemVerilog code that will generate an output on a 4-digit 7-segment display based on two buttons. I was given the hint to use a concatenation operator but kept getting a "Can't resolve multiple constant drivers" error. I believe this meant there were multiple assignments to the same signal. I corrected this by removing the latter 3 assign
statements and using an array instead, but I am not sure on how the syntax would work for having two outputs in each register. Adding brackets did not work.
(
output logic [3:0]en, //7 segment digit selector
output logic a,b,c,d,e,f,g, //7 segment display
input logic [1:0] x //button input
);
logic [3:0] lut [4] = {(4'b1000,7'h01), (4'b0100,7'h04), (4'b0010,7'h01),(4'b001,7'h01)};
assign [en,a,b,c,d,e,f,g] = lut[x]
//this was my original code
//assign {en,a,b,c,d,e,f,g} = x == 2'b11 ? {4'b1000,7'h01}:0;
//assign {en,a,b,c,d,e,f,g} = x == 2'b10 ? {4'b0100,7'h0f}:0;
//assign {en,a,b,c,d,e,f,g} = x == 2'b01 ? {4'b0010,7'h01}:0;
//assign {en,a,b,c,d,e,f,g} = x == 2'b00 ? 0:{4'b0001,7'h01};
question from:https://stackoverflow.com/questions/65910278/how-to-use-an-array-to-output-multiple-values-from-one-input