1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
module ex7_top( KEY, HEX0, HEX1 ); input [3:0] KEY; output [6:0] HEX0, HEX1; reg [6:0] SHIFT; initial SHIFT = 7'd1; always @ (posedge KEY[3]) SHIFT <= {SHIFT[5:0],SHIFT[6] ^ SHIFT[0]}; hex_to_7seg SEG0 (HEX0,SHIFT[3:0]); hex_to_7seg SEG1 (HEX1,SHIFT[6:4]); endmodule