This code will take a four bit number and decode it into the seven individual segments to drive a seven segment display. nIn is the four bit number to be decoded and ssOut is the array of segments for the display going from a, being the LSB, to g being the MSB.
module DualSevenSegmentDriver(ssOut, bIn, CLK);
output [6:0] ssOut;
input [7:0] bIn;
// Current nibble to display on LED's
reg [3:0] dNibble;
// Select the upper or lower nibble depending on CLK
dNibble = CLK?bIn[7:4]:bIn[3:0];
// Decode nibble into LED segments
SevenSegmentDisplayDecoder SSDD(ssOut, dNibble);
11/1/2010: Added default case statement to prevent possible latching.