Solving Delays in 8:3 Encoder Design with Verilog

  • Thread starter Thread starter polaris90
  • Start date Start date
  • Tags Tags
    Delay
Click For Summary
SUMMARY

The discussion focuses on the design of an 8 to 3 encoder using Verilog, highlighting issues related to output delays and glitches during simulation. The user implemented a functional simulation of their encoder, which revealed multiple delays in the output due to logic hazards. Specifically, the simulator identified simultaneous events in the input signals, leading to transient states that caused incorrect outputs. The user seeks clarification on the reasons behind these delays and how they relate to the encoder's logic circuit.

PREREQUISITES
  • Understanding of Verilog syntax and modules
  • Knowledge of digital logic design principles
  • Familiarity with functional simulation techniques
  • Concept of logic hazards in digital circuits
NEXT STEPS
  • Research techniques to mitigate logic hazards in Verilog designs
  • Learn about priority encoders and their delay characteristics
  • Explore simulation tools for analyzing timing issues in digital circuits
  • Study the impact of input signal transitions on output stability
USEFUL FOR

Digital circuit designers, Verilog programmers, and students studying digital logic who are looking to understand and resolve timing issues in encoder designs.

polaris90
Messages
45
Reaction score
0
I have a question about encoders. In one of my classes we had to design a 8 to 3 encoder using verilog. my code is the following.


Code:
module encoder( S, D, E);
input E;  //enable
input [7:0] D;  //input x, y, z
output[2:0] S;  //ouput
reg [2:0] S;
always @ (E or D)begin
	if (E==1) begin
	case (D)
	8'b00000001 : S = 3'b000;
	8'b00000010 : S = 3'b001;
	8'b00000100 : S = 3'b010;
	8'b00001000 : S = 3'b011;
	8'b00010000 : S = 3'b100;
	8'b00100000 : S = 3'b101;
	8'b01000000 : S = 3'b110;
	8'b10000000 : S = 3'b111;
	default :S =3'bx;
endcase
end
end
endmodule

I simulated my encoder using a functional simulation and the output is shown in the picture attached. I see that there are many delays in the output(shown my the glitches in the graph). My question, is why are these delays really produced. When looking at the logic circuit, every output corresponds to 8 inputs, in which one of them is a 1. I see it's a single step with only one gate delay unless I'm wrong. Then when looking at the priority encoder the delay seems to be higher. Could someone give me some feedback on this?
 

Attachments

  • functional.jpg
    functional.jpg
    42.7 KB · Views: 536
Engineering news on Phys.org
The simulator is identifying logic hazards.

For example at 20ns we have three events occurring simultaneously:
D[5] rising, D[6] falling, and D[7] falling.

The simulator is showing you that during this transition, the state: D[5] low, D[6] high, D[7] low may be reached, even if very briefly, causing S[0]=low.
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
3K
Replies
2
Views
7K
  • · Replies 6 ·
Replies
6
Views
6K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 1 ·
Replies
1
Views
8K
  • · Replies 12 ·
Replies
12
Views
11K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K