|
From: Patrick M. <pat...@gm...> - 2020-08-14 12:58:01
|
Hello everyone, found an error "segmentation fault (core dumped)" when trying to save mosfet internal parameters and export them (as ascii). Besides this, with a modified code (without segmentation error) the behavior of NGSpice in interactive mode was different from the expected using the commands directly inside the control section. The two(?) bugs occurred using NGSpice 31.3 from Ubuntu 20.04 repository (could be updated) from the command line. One of the bugs (first one) was confirmed in NGSpice 32 in Windows 10 downloaded from Sourceforge in April. I created this code (below) to simulate NMOS characteristics using the models from cmosedu.com (http://cmosedu.com/cmos1/book.htm) from the book of R. J. Baker. The bugs occurred with both models 1u technology model (level=3) and 50 nm (BSIM4, level=49). Put the file with the models attached since it's public for download. *First bug:* The segmentation fault occurred with the lines associating the internal capacitances and voltages (vgs, vds, vbd, vbs) to their variables. Uncommenting those lines I get the error. I commented the lines of the file writing with these variables. The first line shows the second bug. With the problematic lines commented. I've got into the interactive mode and put the commands in the commented lines directly into NGSpice prompt. They were accepted WITHOUT errors!!! *NGSpice couldn't process them from the script but could from the command line!* *Second bug:* Ok. With the lines commented, as I said I've entered the faulty commands and save the variables that I wanted from the command line. And finally "wrote" the file that I wanted also using the command line. Here is the second bug. The variables that were saved with non-faulty lines were corrupted (ngspice_bug_screen1.png attached) presented errors. Tried to plot them and saw nothing. Then I checked the test.dat, also attached, and *saw the bug: there were no points saved into the variables even with the original vectors correctly calculated and available*. With the "*display*" command I've got the ngspice_bug_screen2.png (attached): the variables are there. Their plots work fine. I thought it could be an error in my code and reentered the non-faulty lines directly in the command line. Same error. The only way I could save the file with the results that I wanted was substituting my variables for the original ones: mn.id for @mn[id] and so on. *Important remarks:* - I've already used this kind of variable attribution before with the same version of NGSpice (and others) and they worked perfectly. Have processed data with codes bigger and more complex than this that were saved correctly; - To save the data I've set *wr_singlescale* and couldn't reproduce the original buggy file with the first variables different from the others because they have no scale to be saved by; - I tried similar codes with other types of models, and they presented the same segmentation fault error. Didn't try the second bug (no time for this). *The code:* ----------------------------------------------------------------- ** Caracterização do NMOS .options savecurrents .options filetype=ascii .temp 25 .include ../modelos/cmosedu_models.txt *** Circuito mn d g 0 b N_1u l=2.5u w=10u *mn d g 0 b N_50n l=2.5u w=10u vdd d 0 dc 5 vgg g 0 dc 1 vbb b 0 dc 0 .end .control set color0=white set color1=black set appendwrite set wr_vecnames set width = 4098 *set wr_singlescale save all @mn[id] @mn[ibs] @mn[gm] @mn[gds] @mn[gmbs] @mn[vdsat] +@mn[cgs] @mn[cgd] @mn[cgb] @mn[cbd] @mn[cbs] +@mn[vgs] @mn[vds] @mn[vbd] @mn[vbs] * +@mn[vt0] let mn.id = @mn[id] let mn.ibs = @mn[ibs] let mn.gm = @mn[gm] let mn.gds = @mn[gds] let mn.gmbs = @mn[gmbs] *let mn.vth = @mn[vt0] * Disponível apenas para o BSIM4 let mn.vsat = @mn[vdsat] * let mn.cgs = @mn[cgs] * let mn.cgd = @mn[cgd] * let mn.cgb = @mn[cgb] * let mn.cbd = @mn[cbd] * let mn.cbs = @mn[cbs] * let mn.vgs = @mn[vgs] * let mn.vds = @mn[vds] * let mn.vbd = @mn[vbd] * let mn.vbs = @mn[vbs] echo "Realizando simulação variando tensão na porta Vgg." dc vgg 0 5 1m wrdata test.dat mn.id mn.ibs mn.gm mn.gds mn.gmbs mn.vsat * +mn.cgs mn.cgd mn.cgb mn.cbd mn.cbs * +mn.vgs mn.vds mn.vbd mn.vbs .endc ----------------------------------------------------------------- If anyone of you has thoughts or ideas about this it would save me hours of works. Any way, I didn't find much about segmentation fault error here in this list and decided to contribute because it can be another one's problem. Kind regards, -- Patrick Mendes dos Santos, Professor, M.Sc. Departamento de Engenharia Elétrica / Electrical Engineering Department Federal Center of Technological Education of Minas Gerais (CEFET-MG). Campus II, Av. Amazonas, 7675, Nova Gameleira. CEP: 30510-000. Belo Horizonte, Minas Gerais. Brazil. Phone: +55 31 3319 6834. e-mail: pat...@gm... Website: http://www.eng-eletrica.bh.cefetmg.br/ <http://www.engenhariaeletrica.cefetmg.br> |