// VerilogA for mrModels, mr_pas_r_va, veriloga `include "constants.vams" `include "disciplines.vams" module mr_pas_r_va(P1, P2); inout P1, P2; electrical P1, P2; // =================================== Parameters =================================== parameter real R = 1000.0 from (0:inf); // Resistance in Ohms parameter real TC1 = 0.0; // Linear temperature coefficient (1/°C) parameter real TC2 = 0.0; // Quadratic temperature coefficient (1/°C²) // ======== Flicker (1/f) noise parameters (optional - set Kf=0 to disable) ========= parameter real Kf = 0.0; // Flicker noise coefficient (1e-11 to 1e-9) parameter real Af = 1.0; // Flicker noise exponent (usually 1.0) real R_eff; // Effective resistance after temp coeff real T; // Temperature in Kelvin analog begin T = $temperature; // Get simulation temperature (Kelvin) // Effective resistance with temperature dependence R_eff = R * (1 + TC1*(T - 300.15) + TC2*(T - 300.15)*(T - 300.15)); // Ohm's law V(P1, P2) <+ R_eff * I(P1, P2); // ============================ Thermal (white) noise =========================== // Correct formula: voltage noise power = 4 * k * T * R V(P1, P2) <+ white_noise(4 * `P_K * T * R_eff, "thermal"); // ======================== Optional flicker (1/f) noise ======================== // Excess noise that appears in some real resistors (carbon, thick film, etc.) if (Kf > 0) begin // Current noise contribution (common way to model resistor excess noise) V(P1, P2) <+ flicker_noise(Kf * pow(abs(I(P1,P2)), Af), 1.0, "excess"); end end endmodule