📄 adc_lut.v
字号:
//*****************************************************************************************//
// Project : FPGA based Digital Design using Verilog HDL
// File : adc_top.v
// Author : Irfan Faisal Mir & Nauman Mir
// Company : Chip Designing Course
// Start Date :
// Last Updated :
// Version : 0.1
// Abstract : This module implements...........
//
// Modification History:
//==========================================================================================
// Date By Version Change Description
//==========================================================================================
// Irfan & Nauman 0.1 Original Version
//
//******************************************************************************************//
// Lookup Table for ADC Data
module adc_lut(// Inputs
clk,
rst_n,
montring_enb,
adc_data_rdy,
adc_data,
// Outputs
adc_val_volts
);
//====== Port Declaration ========//
input clk ;
input rst_n ;
input montring_enb ;
input adc_data_rdy ;
input [11:0] adc_data ;
output [7:0] adc_val_volts ;
reg [7:0] adc_val_volts ;
always @(posedge clk or negedge rst_n)
begin
if(~rst_n)
adc_val_volts <= #1 8'd0 ;
else begin
casex({montring_enb,adc_data_rdy,adc_data})
//====== 2048-1024-512-256-128-64 32-16-8-4-2-1 =========================
14'b0_0_xx_xxxx_xxxxxx : adc_val_volts <= #1 8'b0000_0000 ;
14'b1_1_00_0000_xxxxxx : adc_val_volts <= #1 8'b0000_0000 ;
14'b1_1_00_0001_xxxxxx : adc_val_volts <= #1 8'b0000_0001 ;
14'b1_1_00_0011_xxxxxx : adc_val_volts <= #1 8'b0000_0010 ;
14'b1_1_00_0101_xxxxxx : adc_val_volts <= #1 8'b0000_0011 ;
14'b1_1_00_0111_xxxxxx : adc_val_volts <= #1 8'b0000_0100 ;
14'b1_1_00_1001_xxxxxx : adc_val_volts <= #1 8'b0000_0101 ;
14'b1_1_00_1011_xxxxxx : adc_val_volts <= #1 8'b0000_0110 ;
14'b1_1_00_1101_xxxxxx : adc_val_volts <= #1 8'b0000_0111 ;
14'b1_1_00_1111_xxxxxx : adc_val_volts <= #1 8'b0000_1000 ;
14'b1_1_01_0000_xxxxxx : adc_val_volts <= #1 8'b0000_1001 ;
14'b1_1_01_0001_xxxxxx : adc_val_volts <= #1 8'b0001_0000 ;
14'b1_1_01_0010_xxxxxx : adc_val_volts <= #1 8'b0001_0001 ;
14'b1_1_01_0011_xxxxxx : adc_val_volts <= #1 8'b0001_0010 ;
14'b1_1_01_0100_xxxxxx : adc_val_volts <= #1 8'b0001_0011 ;
14'b1_1_01_0101_xxxxxx : adc_val_volts <= #1 8'b0001_0100 ;
14'b1_1_01_0110_xxxxxx : adc_val_volts <= #1 8'b0001_0101 ;
14'b1_1_01_0111_xxxxxx : adc_val_volts <= #1 8'b0001_0110 ;
14'b1_1_01_1000_xxxxxx : adc_val_volts <= #1 8'b0001_0111 ;
14'b1_1_01_1001_xxxxxx : adc_val_volts <= #1 8'b0001_1000 ;
14'b1_1_01_1010_xxxxxx : adc_val_volts <= #1 8'b0001_1001 ;
14'b1_1_01_1011_xxxxxx : adc_val_volts <= #1 8'b0010_0000 ;
14'b1_1_01_1100_xxxxxx : adc_val_volts <= #1 8'b0010_0001 ;
14'b1_1_01_1101_xxxxxx : adc_val_volts <= #1 8'b0010_0010 ;
14'b1_1_01_1110_xxxxxx : adc_val_volts <= #1 8'b0010_0011 ;
14'b1_1_01_1111_xxxxxx : adc_val_volts <= #1 8'b0010_0100 ;
14'b1_1_10_0000_xxxxxx : adc_val_volts <= #1 8'b0010_0101 ;
14'b1_1_10_0001_xxxxxx : adc_val_volts <= #1 8'b0010_0110 ;
14'b1_1_10_0010_xxxxxx : adc_val_volts <= #1 8'b0010_0111 ;
14'b1_1_10_0011_xxxxxx : adc_val_volts <= #1 8'b0010_1000 ;
14'b1_1_10_0100_xxxxxx : adc_val_volts <= #1 8'b0010_1001 ;
14'b1_1_10_0101_xxxxxx : adc_val_volts <= #1 8'b0011_0000 ;
14'b1_1_10_0110_xxxxxx : adc_val_volts <= #1 8'b0011_0001 ;
14'b1_1_10_0111_xxxxxx : adc_val_volts <= #1 8'b0011_0010 ;
14'b1_1_10_1000_xxxxxx : adc_val_volts <= #1 8'b0011_0011 ;
14'b1_1_10_1001_xxxxxx : adc_val_volts <= #1 8'b0011_0100 ;
14'b1_1_10_1010_xxxxxx : adc_val_volts <= #1 8'b0011_0101 ;
14'b1_1_10_1011_xxxxxx : adc_val_volts <= #1 8'b0011_0110 ;
14'b1_1_10_1100_xxxxxx : adc_val_volts <= #1 8'b0011_0111 ;
14'b1_1_10_1101_xxxxxx : adc_val_volts <= #1 8'b0011_1000 ;
14'b1_1_10_1110_xxxxxx : adc_val_volts <= #1 8'b0011_1001 ;
14'b1_1_10_1111_xxxxxx : adc_val_volts <= #1 8'b0100_0000 ;
14'b1_1_11_0000_xxxxxx : adc_val_volts <= #1 8'b0100_0001 ;
14'b1_1_11_0001_xxxxxx : adc_val_volts <= #1 8'b0100_0010 ;
14'b1_1_11_0010_xxxxxx : adc_val_volts <= #1 8'b0100_0011 ;
14'b1_1_11_0011_xxxxxx : adc_val_volts <= #1 8'b0100_0100 ;
14'b1_1_11_0101_xxxxxx : adc_val_volts <= #1 8'b0100_0101 ;
14'b1_1_11_0111_xxxxxx : adc_val_volts <= #1 8'b0100_0110 ;
14'b1_1_11_1001_xxxxxx : adc_val_volts <= #1 8'b0100_0111 ;
14'b1_1_11_1011_xxxxxx : adc_val_volts <= #1 8'b0100_1000 ;
14'b1_1_11_1101_xxxxxx : adc_val_volts <= #1 8'b0100_1001 ;
14'b1_1_11_1111_xxxxxx : adc_val_volts <= #1 8'b0101_0000 ;
default : adc_val_volts <= #1 adc_val_volts ;
endcase
end
end
endmodule
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -