GDS DRC LVS DOCS

Who

Ardit Uka, Jonas Hilbich, Iver Abrahamsen & Simen Eilevstjønn

Why

Creating this module is part of the Analog Integrated Circuits course at NTNU. The goal is to create a basic temperature sensor and get it to tape out in the TinyTapeout project. Along the way we will learn about the analog design and layout required and gain practical experience working with the tools and understanding the design workflow.

How

This module was developed through four separate milestones, each building on the results of the previous one. A detailed explanation of each circuit can be found under the Schematic section when generating the docs.

Milestone 1 - The Bandgap Circuit.

The first step of the project involves designing a bandgap reference circuit. The bandgap is a component used for temperature sensing and voltage references in integrated circuits. This circuit generates two key outputs:

  • V_CTAT (Complementary to Absolute Temperature voltage): This voltage decreases linearly as temperature increases.

  • I_PTAT (Proportional to Absolute Temperature current): This current increases linearly with temperature.

The combination of V_CTAT and I_PTAT allows the system to produce a temperature-dependent signal with a controlled linear relationship. By feeding these outputs into a subsequent oscillator circuit, the temperature-induced changes in voltage and current modulate the oscillator frequency. This frequency can then be measured using a digital counter to accurately determine the temperature of the system

Bandgap Circuit Outputs

Observations from the simulation

  • I_PTAT shows a decreasing trend with temperature (negative slope).
  • V_CTAT increases with temperature (positive slope).
  • Despite opposite slopes, both outputs maintain linearity which is important for temperature sensing.

To simulate the bandgap and view plots:

cd sim/BANDGAP/
make typical

This will display plots for I_PTAT, V_CTAT, and their errors.

Optional: If you do not wish to see the plots, open tran.py in the BANDGAP folder and set:

DO_PLOT = False

Milestone 2 - The Oscillator

The I_PTAT and V_CTAT from Milestone 1 are used to control the frequency of the oscillator clock. The change in frequency caused by the linear variation of I_PTAT and V_CTAT is how the temperature is measured. As the temperature changes, it affects I_PTAT and V_CTAT, which in turn changes the oscillator frequency. This frequency is fed into a counter (developed in Milestone 3). The counter value is then used to determine the temperature of the bandgap reference.

Observations from the simulation

image

The figure above is an illustration of the output of the oscillator circuit during transient simulation.

The simulations were run for temperatures -5, 0, 10, 25, 30, 40, 50, 60, 70 and 75 degrees Celsium. The resulting frequency curve is shown below.

osc_freq

To quantify the nonlinearity of the output frequencies, a regression fit was performed and the deviations from the straight line frequency relative to the full scale was plotted below.

osc_freq_err

This shows that the error from the straight line is between 0.5% and 2.5%.

The regression model and the r^2 correlation figure for both the typical, extreme test case and Monte Carlo simulations can be found on the results page.

The same page contains the power usage measurements. Average active current is currently slightly out of spec at 104 μA typical, 146 μA maximum. The leakage current is currently 19 nA typically, up to 266 nA maximum, way above the 1 nA specification.

The leakage current can possibly be attribtuted to the floating output node. This may be pulled to gnd to possibly reduce leakage. Further optimisations will be performed later.

To simulate the oscillator alone:

cd sim/OSCILLATOR
make typical
cicsim wave output_tran/tran_SchGtKttTtVt.raw 

In cicsim, select v(osc_temp_1V8) to see the output of the oscillator.

To simulate the whole system:

cd sim/LELO_GR02
make typical

Milestone 3 - The Measurement

With the oscillator from Milestone 2 and the bandgap from Milestone 1 implemented, the next step is to measure the oscillator frequency. The implemented temperature sensor only oscillates while the PWRUP signal remains high (1.8 V). To count the oscillations per system clock cycle, and thus measure the frequency, a circuit that controlls the PWRUP signal is required. This functionality will be implemented in Verilog.

The Counter (counter.v)

image

First, the clock cycles generated by the oscillator must be counted. To accomplish this, an 8-bit ripple counter is implemented in Verilog. The microarchitecture of the counter is shown above. The counter is parametrized to allow for easy arbitrary widths. It is designed to clamp to the maximum value instead of rolling over. This decision was made to have the sensor indicate overtemperature conditions instead of giving a false sense of security by indicating a low temperature.

The counter receives the oscillation signal from the temperature sensor as its clock input and increments its value by one for each clock cycle. For a given oscillation frequency and PVT (process, voltage, and temperature) variation, the counter will reach a specific number of clock cycles within a defined measurement period.

To reset the counter, a reset signal is applied, which forces the counter value to zero. This reset signal is controlled by the state machine.

You can find the implementation of the counter in rtl/counter.v and it’s accompanying testbench in rtl/counter_tb.v. Use make sim_counter in the rtl directory to run the automated tests and check out sim/LELO_GR02/sensor_tb_sim.vcd in your waveform viewer of choice to see the waveform produced by the testbench.

The Finite State Machine (fsm.v)

With the counter implemented as shown above, it is now possible to count the clock cycles from the temperature sensor. To control both the counter and the sensor signal, a finite state machine (FSM) is used.

Module Ports

Port Type Name Description Connection
Input clk System clock (from Tiny Tapeout). External signal
Input rst_n Active-low reset signal used to reset the entire FSM. External signal (User)
Input start_i Starts the temperature measurement. External signal (User)
Input cnt_i Counter value from the counter module. Connected to counter’s output.
Output pwrup_osc_o Power-up signal used to turn on the analog temperature sensor. Connected to PWRUP port on analog design.
Output reset_cnt_o Active-high signal that resets the counter. Connected to counter’s reset.
Output completed_o Flag indicating that the measurement is finished and data is ready. Use as needed.
Output clk_cycles_o Number of counted clock cycles. Use as needed.

image

State Flow & Behavior

The state machine uses three states:

  • Global Reset: At any time, pulling rst_n low will asynchronously reset the FSM back to the IDLE state.
  • IDLE: The FSM rests here by default. It holds the counter in reset (reset_cnt_o = 1) and keeps the temperature sensor powered off (pwrup_osc_o = 0). It waits here until the user drives the start signal high. After a transistion from CAPTURE, the clk_cycles_o contains the last oscialltor count with it’s validity indicated by completed_o (1 means valid).
  • CNT: Entered with a high start signal. The counter reset is released (reset_cnt_o = 0), and the temperature sensor is powered on (pwrup_osc_o = 1). After one clock cycle, it automatically transitions to CAPTURE. The counter counts the osciallations of the temperature sensor.
  • CAPTURE: The FSM powers down the temperature sensor and propagates the counter value and a completed_o signal to the output in the next cycle. After one clock cycle, it automatically transitions back to the IDLE state.

Sensor (sensor.v)

The FSM and counter are combined in the sensor module. This module contains a reduced set of the in- and outputs as discussed above as well as an input for the oscillator signal (osc_i). The module also features two parameters:

  • CNT_WIDTH: Sets the width of the counter in bits (default: 8). This parameter also exists in and is linked to the submodules for the counter and fsm.
  • SYNC_START: This decides if a two flip-flop synchronizer is added in the module to synchronize the start_i signal into the digial logic’s clock domain (default: 0 (false)). If the synchronizer is added, the start signal is delayed by two clock cycles.

Milestone 4 - The Physical Design

What

What Cell/Name
Schematic design/LELO_GR02_SKY130A/LELO_GR02.sch
Schematic design/LELO_GR02_SKY130A/BANDGAP.sch
Schematic design/LELO_GR02_SKY130A/BANDGAP_OPAMP.sch
Schematic design/LELO_GR02_SKY130A/BANDGAP_DIODE.sch
Schematic design/LELO_GR02_SKY130A/OSCILLATOR.sch
Schematic design/LELO_GR02_SKY130A/OSCILLATOR_OPAMP.sch
RTL rtl/Counter.v
RTL rtl/FSM.v

Signal interface

Signal Direction Domain Description
VDD_1V8 Input VDD_1V8 Main supply
OSC_TEMP_1V8 Output VDD_1V8 Temperature dependent oscillation frequency
PWRUP_1V8 Input VDD_1V8 Power up the circuit
VSS Input Ground  

Key parameters

Parameter Min Typ Max Unit
Technology   Skywater 130 nm    
AVDD 1.7 1.8 1.9 V
Temperature -40 27 125 C