Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Updating multiple variables in case statement

I've been looking around for a while so forgive me if maybe I'm using improper terminology...

The goal of the code is to update Aout1 and Aout0 if the input is 0, with the output corresponding to a 7-segment display, but I'm getting the following error:

"Error (10170): Verilog HDL syntax error at FourBitAdder.v(55) near text: ","; expecting ";". Check for and fix any syntax errors that appear immediately before or at the specified keyword."

Below is a snippet of the code giving me issues...

always @*
case (A)
4'b0000 : Aout1 = 7'b1000000, Aout0 = 7'b1000000; //00

I tried changing the code to the following and while I didn't get any errors on my software, my hardware (7-segment display) isn't working like it was when I was trying to just change one variable per case.

always @*
case (A)
4'b0000 : Aout1 = 7'b1000000; 4'b0000 : Aout0 = 7'b1000000; //00

Thank you in advance :)

like image 428
gdagis Avatar asked Feb 05 '26 16:02

gdagis


1 Answers

Use a begin and end statement after the colon.

always @* begin
    case(A)
        4'b0000: begin
            Aout1 = 7'b1000000;
            Aout0 = 7'b1000000;
        end
        4'b0001: begin
            Aout1 = 7'b0000011;
            Aout0 = 7'b0000011;
        end

    endcase
end
like image 142
Charles Clayton Avatar answered Feb 09 '26 07:02

Charles Clayton



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!