Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Simple verilog question

Status
Not open for further replies.
the simulator simply doesn't compile or issue an error
 

This is independent to simulators. The timing model should be defined by in verilog. This question is simply about the concept of concurrency and sequential structure.

All statements inside a always or initial block are processed sequentially and you can only see the final result. That means a = 0.
 

0, becasue verilog definition
 

Simulated with ncverilog...
Code:
always @(posedge clk)
begin
a<=0;
a<=1;
end

Time                    0   a = x clk = 0
Time                    5   a = 1 clk = 1

always @(posedge clk)
begin
a<=1;
a<=0;
end

Time                    0   a = x clk = 0
Time                    5   a = 0 clk = 1


always @(posedge clk)
begin
a<=0;
end

always @(posedge clk)
begin
a<=1;
end

Time                    0   a = x clk = 0
Time                    5   a = 1 clk = 1

always @(posedge clk)
begin
a<=1;
end

always @(posedge clk)
begin
a<=0;
end


Time                    0   a = x clk = 0
Time                    5   a = 0 clk = 1


The second case is dicussed in Janick's book "Writing testbenches with systemverilog" and the simulation results agree to what is discussed in there..

HTH..
 

I think it is in race condition
The result is uncertain
Phehaps dependent on simulator or the context of simulation
 

@verilog_always is right about the second case. This will cause multiple driver issue. And of course its unsynthesizeable.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top