Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*============================================
- Convert 6-bits binary to Binary Coded Decimal
- from 0 to 9
- =============================================*/
- module binary2bcd (
- input [5:0] binary,
- output reg [3:0] bcd1, bcd0);
- always@(binary)
- begin
- bcd0 = binary%10; // Calculation for the first digit
- bcd1 = ((binary - binary%10)/10)%10; // Calculation for the second digit
- end
- endmodule
Advertisement
Add Comment
Please, Sign In to add comment