I am writing verilog code (behavioural) for a 16-bit ALU. I am facing compilation error:
module alu_16bit(out,a,b,op);
output reg [15:0] out;
input [15:0] a,b;
input [2:0] op;
reg [15:0] e ;
reg [15:0] d ;
parameter op_add = 3'b000 ;
parameter op_sub = 3'b001 ;
parameter op_sl = 3'b010 ; // shift left
parameter op_sr = 3'b011 ; // shift right
parameter op_sar = 3'b100 ; // shift arithmetic right
parameter op_nand = 3'b101 ;
parameter op_or = 3'b110 ;
always @(*)
begin
case(op)
op_add : out <= a+b ;
op_sub : out <= a-b ;
op_nand : out <= ~(a&b) ;
op_or : out <= a|b ;
op_sr : out <= a >> b ;
op_sl : out <= a << b ;
op_sar : begin
if(b>16'd15)
out <= {16{a[15]}} ;
else
out <= {b{a[15]},a[15:b]} ;
end
default: out <= 4'bzzzz ;
endcase
end
endmodule
I am facing compilation error in this line of op_sar:
out <= {b{a[15]},a[15:b]} ;
This is the error I am receiving:
alu_16bit.v:65: error: Syntax error between internal '}' and closing '}' of repeat concatenation.