Advertisement
Guest User

bcd2segments_lut

a guest
Mar 23rd, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. `timescale 1ns / 1ps
  2. `default_nettype none
  3.  
  4. module bcd2segments
  5. (
  6.     input [3:0] bcd,
  7.     output [6:0] segments
  8. );
  9.  
  10.  
  11. reg [6:0] LUT[0:15];
  12.  
  13. initial begin
  14.    
  15.     LUT[4'h0] = 7'h3F;
  16.     LUT[4'h1] = 7'h06;
  17.     LUT[4'h2] = 7'h5B;
  18.     LUT[4'h3] = 7'h4F;
  19.     LUT[4'h4] = 7'h66;
  20.     LUT[4'h5] = 7'h6D;
  21.     LUT[4'h6] = 7'h7D;
  22.     LUT[4'h7] = 7'h07;
  23.     LUT[4'h8] = 7'h7F;
  24.     LUT[4'h9] = 7'h67;
  25.     LUT[4'hA] = 7'h7A;
  26.     LUT[4'hB] = 7'h7C;
  27.     LUT[4'hC] = 7'h39;
  28.     LUT[4'hD] = 7'h5E;
  29.     LUT[4'hE] = 7'h79;
  30.     LUT[4'hF] = 7'h71;
  31.  
  32. end
  33.  
  34. assign segments = LUT[bcd];
  35.  
  36. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement