Akisha11 / Dise-o-digital-en-HDL-

0 stars 0 forks source link

Subsistema de despliegue de número binario de 14 bits en hexadecimal #6

Open Akisha11 opened 1 year ago

Akisha11 commented 1 year ago

Crear e implementar el subsistema que tome el resultado derivado del subsistema de conversión de binario a hexadecimal y despliegue el resultado.

Akisha11 commented 1 year ago
module binary_to_hex (
    input [13:0] binary,
    output reg [3:0] hex
);

always @(*) begin
    case(binary)
        14'b00000000000000: hex = 4'h0;
        14'b00000000000001: hex = 4'h1;
        14'b00000000000010: hex = 4'h2;
        14'b00000000000011: hex = 4'h3;
        14'b00000000000100: hex = 4'h4;
        14'b00000000000101: hex = 4'h5;
        14'b00000000000110: hex = 4'h6;
        14'b00000000000111: hex = 4'h7;
        14'b00000000001000: hex = 4'h8;
        14'b00000000001001: hex = 4'h9;
        14'b00000000001010: hex = 4'hA;
        14'b00000000001011: hex = 4'hB;
        14'b00000000001100: hex = 4'hC;
        14'b00000000001101: hex = 4'hD;
        14'b00000000001110: hex = 4'hE;
        14'b00000000001111: hex = 4'hF;
        default: hex = 4'hX;
    endcase
end

endmodule