Created Feb 24, 2026Updated Feb 24, 2026Aleksandr SidunSuggest Edit

Analog-to-Digital (ADC) Verilog-A model

This article contains Verilog-A model for an Analog-to-Digital Converter (ADC).

Usage:

  1. Create a new cell in Library Manager named ADC and select cell type Verilog A;
  2. Copy and paste the code provided;
  3. Modify bits variable to define ADC resolution;
  4. Specify vmin and vmax variables to define the input signal swing;
  5. Specify vdd and vss variables to define output voltage levels;
  6. Specify tt and td variables to define rising/falling edge times and output signal delay;
  7. Specify dir variable to be +1 for rising and -1 for falling clock edge triggering;
  8. Perform Check and Save;
  9. A cell symbol will be created;
  10. Instantiate ADC cell into your design;
  11. Perform Check and Save and run the simulation.


ADC-DAC testbench

ADC-DAC testbench


ADC-DAC simulation result

ADC-DAC simulation result


Cell name: ADC

Model type: Verilog-A

Download from GitHub

1// N-bit Analog to Digital Converter 2// LSB is <0> 3// Change binary_bits variable for your needs! 4// Author: A. Sidun 5// Source: AnalogHub.ie 6 7\`include "constants.vams" 8\`include "disciplines.vams" 9\`define bits 12\t\t\t\t\t// define number of binary bits here 10module ADC (out, in, clk); 11 parameter real vmin = 0.0;\t\t\t// minimum input voltage (V) 12 parameter real vmax = 1.0 from (vmin:inf);\t// maximum input voltage (V) 13 parameter real td = 0 from [0:inf);\t\t// delay from clock edge to output (s) 14 parameter real tt = 0 from [0:inf);\t\t// transition time of output (s) 15 parameter real vdd = 5;\t\t\t// voltage level of logic 1 (V) 16 parameter real vss = 0;\t\t\t// voltage level of logic 0 (V) 17 parameter real thresh = (vdd+vss)/2;\t// logic threshold level (V) 18 parameter integer dir = +1 from [-1:1] exclude 0; 19 \t\t\t\t\t\t// 1 for trigger on rising edge 20\t\t\t\t\t\t// -1 for falling 21 localparam integer levels = 1<<\`bits; 22 input in, clk; 23 output [\`bits-1:0] out; 24 voltage in, clk; 25 voltage [\`bits-1:0] out; 26 integer result; 27 genvar i; 28 29 analog begin 30 @(cross(V(clk)-thresh, dir) or initial_step) begin 31\t result = levels*((V(in) - vmin))/(vmax - vmin); 32\t if (result > levels-1) 33\t result = levels-1; 34\t else if (result < 0) 35\t result = 0; 36\tend 37 38\tfor (i=0; i<\`bits; i=i+1) 39\t V(out[i]) <+ transition(result & (1<<i) ? vdd : vss, td, tt); 40 end 41endmodule