Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- `timescale 1ns / 1ps
- `default_nettype none
- module bcd2segments
- (
- input [3:0] bcd,
- output [6:0] segments
- );
- reg [6:0] LUT[0:15];
- initial begin
- LUT[4'h0] = 7'h3F;
- LUT[4'h1] = 7'h06;
- LUT[4'h2] = 7'h5B;
- LUT[4'h3] = 7'h4F;
- LUT[4'h4] = 7'h66;
- LUT[4'h5] = 7'h6D;
- LUT[4'h6] = 7'h7D;
- LUT[4'h7] = 7'h07;
- LUT[4'h8] = 7'h7F;
- LUT[4'h9] = 7'h67;
- LUT[4'hA] = 7'h7A;
- LUT[4'hB] = 7'h7C;
- LUT[4'hC] = 7'h39;
- LUT[4'hD] = 7'h5E;
- LUT[4'hE] = 7'h79;
- LUT[4'hF] = 7'h71;
- end
- assign segments = LUT[bcd];
- endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement