2014年5月24日 星期六

用Verilog 描述七段顯示器


//===============================
module hex_7seg (hex,seg_out);
  input [3:0] hex;
  output reg [6:0] seg_out;

always@ (hex)

begin
  case (hex)
    //                     gfe_dcba 7-segment
    4'b0000 : seg_out  = 7'b100_0000;
    4'b0001 : seg_out  = 7'b111_1001;
    4'b0010 : seg_out  = 7'b010_0100;
    4'b0011 : seg_out  = 7'b011_0000;
    4'b0100 : seg_out  = 7'b001_1001;
    4'b0101 : seg_out  = 7'b001_0010;
    4'b0110 : seg_out  = 7'b000_0010;
    4'b0111 : seg_out  = 7'b111_1000;
    4'b1000 : seg_out  = 7'b000_0000;
    4'b1001 : seg_out  = 7'b001_0000;
    4'b1010 : seg_out  = 7'b000_1000;
    4'b1011 : seg_out  = 7'b000_0011;
    4'b1100 : seg_out  = 7'b100_0110;
    4'b1101 : seg_out  = 7'b010_0001;
    4'b1110 : seg_out  = 7'b000_0110;
    default : seg_out  = 7'b000_1110;
    endcase
  end
endmodule

沒有留言:

張貼留言

2024年4月24日 星期三 Node-Red Dashboard UI Template + AngularJS 參考 AngularJS教學 --2

 2024年4月24日 星期三 Node-Red Dashboard UI Template + AngularJS 參考 AngularJS教學 --2 AngularJS 實例 <!DOCTYPE html> <html> <head> &...