rendered paste bodymodule seg_dec(clk, vin, cry, vout);
input clk;
input [3:0] vin;
input cry;
output reg [6:0] vout;
always @ (posedge clk)
begin
if (cry == 1) vout <= 7'b1111110; //egy - jel látszik
else begin
if (vin == 4'd0) vout <= 7'b0000001; //nulla
else if (vin == 4'd1) vout <= 7'b1001111; //egy
else if (vin == 4'd2) vout <= 7'b0010010; //kettő
else if (vin == 4'd3) vout <= 7'b0000110; //három
else if (vin == 4'd4) vout <= 7'b1001100; //négy
else if (vin == 4'd5) vout <= 7'b0100100; //öt
else if (vin == 4'd6) vout <= 7'b0100000; //hat
else if (vin == 4'd7) vout <= 7'b0001111; //hét
else if (vin == 4'd8) vout <= 7'b0000000; //nyolc
else if (vin == 4'd15) vout <= 7'b1111111; //F-nél üres szegmens
else vout <= 7'b0000100; //kilenc, illegális értéknél is (kivéve F)
end
end
//szegmens dekóder
endmodule