Is it expected the `sim_pinnumber` stuff has no ef...
# xschem
t
Is it expected the
sim_pinnumber
stuff has no effect if you just have a schematic ? Unless I create a
.sym
, when generating the LVS netlist, the pins won't have the right order, it ignores the attribute in the
.sch
.
s
@tnt yes this is current behavior, I will add the feature for top schematic without a symbol. Thank you for pointing this out.
1
t
Thanks, it's not a huge deal, but it took me a minute to understand what was going on 😅
While we're in slightly unexpected behavior, when I have a .sym in the current dir, I can just use 'xxx.sym' without the full path when referring to it. But when it's in a subdir that's symlinked into the current path, then that doesn't work out. ( so I have
xxx/dev.sym
in the
.sch
and
xxx
is a symlink in the same directory as the
.sch
)
s
@tnt Keep in mind how xschem finds components. If a component reference like
xxx/dev.sym
is found in a schematic xschem tries to append this reference to all search paths defined in
XSCHEM_LIBRARY_PATH
, in the order they are listed. The first existing file is used, so if I have:
set XSCHEM_LIBRARY_PATH /a/b/c:/a/b:/c
and
/a/b/xxx/dev.sym
is an existing file this symbol will be loaded. If no matching file is found the component reference is assumed to be in the same directory of the parent schematic. This is a last resort and not recommended way. Always provide the list of component libraries to search for in XSCHEM_LIBRARY_PATH. If you want to include the current dir into XSCHEM_LIBRARY_PATH use
[pwd]
(and not
.
) :
set XSCHEM_LIBRARY_PATH ...:...:[pwd]:...:...
That said I don't understand well your case, what is the directory layout what are the symlinks there? Can you please elaborate? https://xschem.sourceforge.io/stefan/xschem_man/tutorial_xschem_libraries.html
t
I know about
XSCHEM_LIBRARY_PATH
but the use case is for project specific symbols, I don't really want to put them in my global
xschemrc
and have them everywhere. So instead I just assumed it would look into current dir which it did as a fallback. But then for a bigger project I wanted some "local" symbols that happened to be maintained in another git repo so I just tried symlinking. So say in a directory I have
main.sch
and next to it, a symlink
sub
to a directory somewhere completely different. And that directory has a
xxx.sym
in it. And in
main.sch
I try to use
sub/xxx.sym
that doesn't work properly. When loading it the first time it works fine and everything is there. But then when I click "netlist" button, it will print
l_s_d(): Symbol not found: sub/xxx.sym
and then it won't work anymore.
Looking at
strace
I see at the beginning (initial load):
Copy code
access("/opt/asic/share/xschem/xschem_library/usb/digital.sym", F_OK) = -1 ENOENT (No such file or directory)
access("/home/tnt/.local/share/xschem/library/usb/digital.sym", F_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/tnt/projects/asic/tinytapeout/tt07-diff-rx/xschem/usb/digital.sym", O_RDONLY) = 8
But then after I get :
Copy code
access("/opt/asic/share/xschem/xschem_library/usb/digital.sym", F_OK) = -1 ENOENT (No such file or directory)
access("/home/tnt/.local/share/xschem/library/usb/digital.sym", F_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/tnt/projects/asic/tinytapeout/tt07-diff-rx/xschem/usb/usb/digital.sym", O_RDONLY) = -1 ENOENT (No such file or directory)
write(2, "l_s_d(): Symbol not found: usb/d"..., 43l_s_d(): Symbol not found: usb/digital.sym
See how the
usb
(which is the symlinked dir) is repeated twice in the path above.
s
@tnt please do this in the xschem terminal and send me the result:
puts $XSCHEM_LIBRARY_PATH
in the session that has problems.
@tnt you can also query xschem where it expects to find a symbol:
abs_sym_path usb/digital.sym
it will return the assumed absolute path of the symbol.
t
abs_sym_path usb/digital.sym
returns the right path when typed in the console, I tried it when I was looking at how thing worked. But at somepoint it's almost like
$curr_dirname
ends up pointing to
/home/tnt/projects/asic/tinytapeout/tt07-diff-rx/xschem/usb/
instead of
/home/tnt/projects/asic/tinytapeout/tt07-diff-rx/xschem/
Copy code
tnt@rei ~/projects/asic/tinytapeout/tt07-diff-rx/xschem $ xschem tt_um_tnt_diff_rx.sch 
open_pdks installation: using /home/tnt/projects/asic/pdk/
SKYWATER_MODELS: /home/tnt/projects/asic/pdk//sky130A/libs.tech/combined
SKYWATER_STDCELLS: /home/tnt/projects/asic/pdk//sky130A/libs.ref/sky130_fd_sc_hd/spice
setup_tcp_bespice: success : listening to TCP port: 2022
% puts $XSCHEM_LIBRARY_PATH
/opt/asic/share/xschem/xschem_library:~/.local/share/xschem/library
% abs_sym_path usb/digital.sym
/home/tnt/projects/asic/tinytapeout/tt07-diff-rx/xschem/usb/digital.sym
% l_s_d(): Symbol not found: usb/digital.sym
l_s_d(): Symbol not found: usb/bias_gen.sym
l_s_d(): Symbol not found: usb/diff_rx.sym

%  abs_sym_path usb/digital.sym
/home/tnt/projects/asic/tinytapeout/tt07-diff-rx/xschem/usb/digital.sym
% 
tnt@rei ~/projects/asic/tinytapeout/tt07-diff-rx/xschem $ ls /home/tnt/projects/asic/tinytapeout/tt07-diff-rx/xschem/usb/digital.sym -l
-rw-r--r-- 1 tnt tnt 1032 May 28 15:48 /home/tnt/projects/asic/tinytapeout/tt07-diff-rx/xschem/usb/digital.sym
As I said, it will find the symbol just fine at the beginning, it's just when clicking the "netlist" button that things go wrong.
s
@tnt what is the content of $XSCHEM_LIBRARY_PATH in your runnng xschem session that has this problem?
t
See above :
Copy code
% puts $XSCHEM_LIBRARY_PATH
/opt/asic/share/xschem/xschem_library:~/.local/share/xschem/library
s
@tnt Thank you. Apologies, I did not see the path at first look :-) add this directory to XSCHEM_LIBRARY_PATH:
/home/tnt/projects/asic/tinytapeout/tt07-diff-rx/xschem
Copy code
% puts $XSCHEM_LIBRARY_PATH
/opt/asic/share/xschem/xschem_library:~/.local/share/xschem/library:/home/tnt/projects/asic/tinytapeout/tt07-diff-rx/xschem
you can easily do this in the xschemrc file:
append XSCHEM_LIBRARY_PATH :[pwd]
t
Well yes and no ... that only works if I start xschem from that directory ...
s
yes, if you want this to work from any directory add the full qualified path.
t
That's not ideal either, I don't want to put project specific path in my xschemrc. symbol name relative to the schematic they are in is really what I want and it mostly works... expect when I press the "SPICE netlist" button because looking at it it messes with
curr_dirname
and doesn't properly put it back or something ...
s
@tnt ok, I have pushed a commit to xschem. This new xschemrc variable:
use_pwd_instead_of_current_dirname
will use (if set to 1)
[pwd]
as the base path of referenced symbols (if not found in any of the
XSCHEM_LIBRARY_PATH
paths) instead of the directory of currently loaded schematic (which changes depending on the hierarchy level you are in and will mess up if using a hierarchic netlist command). Update xschem and add this:
set use_pwd_instead_of_current_dirname 1
to your xschemrc file. The default value for this variable is
0
, after some time may be I will flip to
1
as default (if no design breaks as a consequence of this).
To better identify your issue (which looks like a unique case) can you please send a complete tar file containing the full directory structure, the xschemrc setting you are using, all the needed .sch and .sym files (excluding the xschem devices/ base symbols) , the top cell to load and from what directory to see the problem after pressing the netlist button?
is
usb/digital.sym
used only in the top level schematic or also (or only) in some sub schematic?
t
It's only used in the top level.
s
@tnt if you add this to your xschemrc:
append XSCHEM_LIBRARY_PATH :[file dirname [info script]]
it will add the path of the directory where the xschemrc file is read from. This works also if you call xschem from a different directory. PS: no more need to set the
use_pwd_instead_of_current_dirname
variable in xschemrc. I have made the switch and a . in search path is a synonim of [pwd] so this setting is no more needed.