M
Mike
Guest
Hello,
9.7.2 (Event control) says:
"If the expression evaluates to more than a 1-bit result, the edge
transition shall be detected on the least signifcant bit of the
result. The change of value in any of the operands without a change
in the value of the least signifcant bit of the expression result
shall not be detected as an edge."
so why do I see my "should not see this" messages? I don't have
any X/Z running around in the design, so the least significant bit
in the event_expression (count & 3'b100) is always 0.
Thanks in advance,
Mike
------------- source file -------------------------
module counter;
reg clk;
reg rst_n;
reg [2:0] count;
initial
begin
clk = 1'b0;
rst_n = 1'b0;
count = 3'h0;
rst_n <= #2 1'b1;
forever clk = #1 !clk;
end
initial
#100 $finish;
always @(posedge clk)
count <= {3{rst_n}} & (count + 1'b1);
always @(count & 3'b100)
$display("should see this");
always @(posedge(count & 3'b100))
$display("should not see this");
always @(negedge clk)
$display("time:%d, count=%d", $time, count);
endmodule
--------log file------------------------------
Tool: VERILOG-XL 05.30.002-s Jan 18, 2006 16:46:05
Compiling source file "mike.v"
Highest level modules:
counter
time: 2, count=0
time: 4, count=1
time: 6, count=2
time: 8, count=3
should see this
should not see this
time: 10, count=4
time: 12, count=5
time: 14, count=6
time: 16, count=7
should see this
time: 18, count=0
time: 20, count=1
time: 22, count=2
time: 24, count=3
should not see this
should see this
time: 26, count=4
time: 28, count=5
time: 30, count=6
time: 32, count=7
9.7.2 (Event control) says:
"If the expression evaluates to more than a 1-bit result, the edge
transition shall be detected on the least signifcant bit of the
result. The change of value in any of the operands without a change
in the value of the least signifcant bit of the expression result
shall not be detected as an edge."
so why do I see my "should not see this" messages? I don't have
any X/Z running around in the design, so the least significant bit
in the event_expression (count & 3'b100) is always 0.
Thanks in advance,
Mike
------------- source file -------------------------
module counter;
reg clk;
reg rst_n;
reg [2:0] count;
initial
begin
clk = 1'b0;
rst_n = 1'b0;
count = 3'h0;
rst_n <= #2 1'b1;
forever clk = #1 !clk;
end
initial
#100 $finish;
always @(posedge clk)
count <= {3{rst_n}} & (count + 1'b1);
always @(count & 3'b100)
$display("should see this");
always @(posedge(count & 3'b100))
$display("should not see this");
always @(negedge clk)
$display("time:%d, count=%d", $time, count);
endmodule
--------log file------------------------------
Tool: VERILOG-XL 05.30.002-s Jan 18, 2006 16:46:05
Compiling source file "mike.v"
Highest level modules:
counter
time: 2, count=0
time: 4, count=1
time: 6, count=2
time: 8, count=3
should see this
should not see this
time: 10, count=4
time: 12, count=5
time: 14, count=6
time: 16, count=7
should see this
time: 18, count=0
time: 20, count=1
time: 22, count=2
time: 24, count=3
should not see this
should see this
time: 26, count=4
time: 28, count=5
time: 30, count=6
time: 32, count=7