DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Dual Seven Segment Display

07.01.2011
| 1508 views |
  • submit to reddit
        // Dual Seven Segment Display

module DualSevenSegment(O, AN, I1, I2, CLK);
  output [6:0] O ;
  output [3:0] AN;
  input [6:0] I1, I2;
  input CLK;
  
  reg bool;
  reg [15:0] count;
  reg [6:0] O ;
  reg [3:0] AN;
  
  initial
  begin
		bool = 0;
		count = 0;
  end
  
  always @(posedge CLK)
  begin
		count = count + 1;
		if (count == 0)
		begin
		case(bool)
		0: begin
			AN = 4'b1110;
			O = I1;
		end
		1: begin
			AN = 4'b1101;
			O = I2;
		end
		endcase
		bool = ~bool;
  end
  end
  
  
endmodule