0

I am working on a cordic project, but it seems that I am having trouble with the 16 to 1 multiplexer.

I already tried re-writing the code, but still no clue.

module mux_16(operand, reg_in, select);

output operand;
input [15:0] reg_in;
input [3:0] select;

always@(select, reg_in) begin
case(select)
0: operand = reg_in[0];
1: operand = reg_in[1];
2: operand = reg_in[2];
3: operand = reg_in[3];
4: operand = reg_in[4];
5: operand = reg_in[5];
6: operand = reg_in[6];
7: operand = reg_in[7];
8: operand = reg_in[8];
9: operand = reg_in[9];
10: operand = reg_in[10];
11: operand = reg_in[11];
12: operand = reg_in[12];
13: operand = reg_in[13];
14: operand = reg_in[14];
15: operand = reg_in[15];
default: operand = 0;
endcase
end

endmodule

  • 2
    `operand` must be declared as a `reg` in order to be assigned inside of an `always` block. – Serge Jul 29 '19 at 02:06
  • 2
    Possible duplicate of [Error "procedural assignment to a non-register result is not permitted"](https://stackoverflow.com/questions/31472546/error-procedural-assignment-to-a-non-register-result-is-not-permitted) – Qiu Jul 29 '19 at 12:47

1 Answers1

0

In your code, output operand should be declared as reg, because in procedural block "always", you can not assign any value to a non-reg type. More informations here

barbsan
  • 3,418
  • 11
  • 21
  • 28