UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Newbie habibsa
Newbie
11,539 Views
Registered: ‎11-12-2010

ERROR:HDLCompilers:26

hi i write this cod dut it has an error please help me.

ERROR:HDLCompilers:26 - "alu.v" line 28 expecting 'endmodule', found 'case'

 

module alu(out,a,b,m);

input [3:0]a,b;
input [2:0]m;
output [3:0]out;


    case(m)
        0:assign out=a;
        1:assign out=a+b;
        2:assign out=a-b;
        3:assign out=a&b;
        4:assign out=a|b;
        5:assign out=a^b;
        6:assign out=~a;
        7:assign out=b;
    endcase


endmodule

 

0 Kudos
5 Replies
Newbie habibsa
Newbie
11,537 Views
Registered: ‎11-12-2010

Re: ERROR:HDLCompilers:26

please send answers to hbbsadeghi@gmail.com.

merci.

0 Kudos
Mentor awillen
Mentor
11,529 Views
Registered: ‎11-29-2007

Re: ERROR:HDLCompilers:26

You can't use a case-statement outside of a procedural block (remember that you'll have to declare "out" as reg then. Furthermore, use ANSI-style port lists. Result:

 

module alu (
	input [3:0] a, b,
	input [2:0] m,
	output reg [3:0] out
);

always @(*) begin
    case(m)
        0: out=a;
        1: out=a+b;
        2: out=a-b;
        3: out=a&b;
        4: out=a|b;
        5: out=a^b;
        6: out=~a;
        default: out=b;
    endcase
end

endmodule

 I also suggest that you get a good book on Verilog, or at least an online tutorial.

 

I will not send you an e-mail, though. Click on "Options" in the upper right corner, then on subscribe.

 

 

Adrian

 



Please google your question before asking it.
If someone answers your question, mark the post with "Accept as solution". If you see a particularly good and informative post, consider giving it Kudos (the star on the left).
0 Kudos
Xilinx Employee
Xilinx Employee
11,508 Views
Registered: ‎04-06-2010

Re: ERROR:HDLCompilers:26

Adrian is correct.  A good book should help you out with rules, however, you can get a lot of example within the ISE GUI.  There's a section called language templates and this would have shown you that what you did is not allowed.  The language templates is the button that has a yellow light bulb.  Give this a try and you'll be surprised with how helpful this can be if you're not a coding expert.

 

Hope this helps.

0 Kudos
Newbie habibsa
Newbie
11,507 Views
Registered: ‎11-12-2010

Re: ERROR:HDLCompilers:26

thank u so much for guide.

0 Kudos
Highlighted
9,540 Views
Registered: ‎03-27-2013

Re: ERROR:HDLCompilers:26

could notfind module/primitive'registers r11'

could notfind module/primitive'registers r12'could notfind module/primitive'registers r13'

 and other

 

plz. reply to my error. i am using 10.1 Xilinx

 

Tags (1)
0 Kudos