// *******************************************************
// **** BSIM-CMG 110.0.0 released by Sourabh Khandelwal on 01/01/2016 ****/
// *  BSIM Common Multi-Gate Model Equations (Verilog-A)
// ********************************************************
//
// ********************************************************
// * Copyright 2016 Regents of the University of California. 
// * All rights reserved.
// *
// * Project Director: Prof. Chenming Hu.
// * Authors: Sriramkumar V., Navid Paydavosi, Juan Duarte, Darsen Lu, Sourabh Khandelwal
// *          Chung-Hsun Lin, Mohan Dunga, Shijing Yao,
// *          Ali Niknejad, Chenming Hu
// ********************************************************
// ********************************************************
// *   NONDISCLOSURE STATEMENT
// Software is distributed as is, completely without warranty or service
// support. The University of California and its employees are not liable
// for the condition or performance of the software.
// The University of California owns the copyright and grants users a perpetual,
// irrevocable, worldwide, non-exclusive, royalty-free license with 
// respect to the software as set forth below.
// The University of California hereby disclaims all implied warranties.
// The University of California grants the users the right to modify, copy,
// and redistribute the software and documentation, both within the user's
// organization and externally, subject to the following restrictions
// 1. The users agree not to charge for the University of California code
// itself but may charge for additions, extensions, or support.
// 2. In any product based on the software, the users agree to acknowledge
// the University of California that developed the software. This
// acknowledgment shall appear in the product documentation.
// 3. The users agree to obey all U.S. Government restrictions governing
// redistribution or export of the software.
// 4. The users agree to reproduce any copyright notice which appears on
// the software on any copy or modification of such made available
// to others
// Agreed to on __Jan 01, 2016_________________
// By: ___University of California, Berkeley____ 
//     ___Chenming Hu_____________________ 
//     ___Professor in Graduate School _______
// ********************************************************
// Source-Drain Resistance Model
case(RDSMOD)
    1: begin 
        Rdsi     =  0.0; 
        Dr       =  1.0; 

        T2       =  vgs_noswap - vfbsd; 
        T3       =  sqrt(T2 * T2 + 1.0e-1); 
        vgs_eff  =  0.5 * (T2 + T3); 
        T4       =  1.0 + PRWGS_i * vgs_eff; 
        T1       =  1.0 / T4; 
        T0       =  0.5 * (T1 + sqrt(T1 * T1 + 0.01));
        T5       =  RSW_i * (1.0 + RSDR_a * lexp(0.5 * PRSDR * lln(V(si,s) * V(si,s) + 1.0E-6))); 
        Rsource  =  rdstemp * (RSourceGeo + (RSWMIN_i + T5 * T0) * WeffWRFactor); 
                            
        T2       =  vgd_noswap - vfbsd; 
        T3       =  sqrt(T2 * T2 + 1.0e-1); 
        vgd_eff  =  0.5 * (T2 + T3); 
        T4       =  1.0 + PRWGD_i * vgd_eff; 
        T1       =  1.0 / T4; 
        T0       =  0.5 * (T1 + sqrt(T1 * T1 + 0.01));
        T5       =  RDW_i * (1.0 + RDDR_a * lexp(0.5 * PRDDR * lln(V(di,d) * V(di,d) + 1.0E-6)));
        Rdrain   =  rdstemp * (RDrainGeo + (RDWMIN_i + T5 * T0) * WeffWRFactor); 
    end
    0: begin
        Rsource  =  RSourceGeo;
        Rdrain   =  RDrainGeo;
        T4       =  1.0 + PRWGS_i * qia; 
        T1       =  1.0 / T4; 
        T0       =  0.5 * (T1 + sqrt(T1 * T1 + 0.01)); 
        Rdsi     =  rdstemp * (RDSWMIN_i + RDSW_i * T0) * WeffWRFactor; 
        Dr       =  1.0 + (NFINtotal) * beta * ids0_ov_dqi / (Dmob * Dvsat) * Rdsi; 
    end
    2: begin
        T4       =  1.0 + PRWGS_i * qia; 
        T1       =  1.0 / T4; 
        T0       =  0.5 * (T1 + sqrt(T1 * T1 + 0.01)); 
        Rdsi     =  rdstemp * (RSourceGeo + RDrainGeo + RDSWMIN_i + RDSW_i * T0) * WeffWRFactor; 
        Dr       =  1.0 + (NFINtotal) * beta * ids0_ov_dqi / (Dmob * Dvsat) * Rdsi;
        Rsource  =  0.0;
        Rdrain   =  0.0;
    end
endcase 
