-1

I write the code like this:

module alu(input[7:0] a,input[7:0]  b,input [2:0] op,output reg [7:0] y);
always@(a or b or op) begin
 case(op)
  3'b000: y = a + b;
  3'b001: y = a - b;
  3'b010: y = a * b;
  3'b011: y = a / b;
  3'b100: y = a & b;
  3'b101: y = a | b;
  3'b110: y = ~a;
  3'b111: y = a ^ b;
endcase
 $display("base 10 : %dns : op=%d b=%d y=%d" , $stime, op, a, b, y);
 $display("base  2 : %dns : op=%b a=%b y=%b" , $stime, op, a, b, y);
end
endmodule

module main;
 reg [7:0] a,b;
 wire [7:0] y;
 reg [2:0] op;

alu alu1(a, b, op, y);
initial begin
 a = 8'h07;
 b = 8'h03;
 op = 3'b000;
 $dumpfile("alu.vcd");
 $dumpvars;
end

 always #50 begin
 op = op + 1;
end
initial #1000 $finish;

endmodule

and Icarus showed me the answer as the image, enter image description here , I don't understand what is going on.

Maybe it would be a simple problem itself, but I really need to know how to resolve it, thank for everyone if you have seen my question.

  • 1
    See [mcve], and post text as text, not pictures of text (and especially not screenshots in JPG format, WTF). – melpomene Aug 03 '17 at 17:58

1 Answers1

6
$display("base 10 : %dns : op=%d b=%d y=%d" , $stime, op, a, b, y);
                          ^

There is a weird Unicode character (U+3000 IDEOGRAPHIC SPACE) after the second colon in this string, right above the ^ mark I've placed in the second line.

Replace it with a normal space character.