When using the "schematic" property on a symbol in...
# xschem
c
When using the "schematic" property on a symbol instance to point to an alternative schematic, the path seems to point relative to schematic where the symbol is instantiated and not relative to the symbol path. Is this intended? I find it rather annoying because the normal way xschem handles this is to find the schematic located next to the symbol.
j
when I use symbols, they seem to point to relative path of symbol. I am not sure I understood what you mean clearly.
c
Right. But if you use the "schematic=alternative.sch" property to point to "alternative.sch" as a alternative representation for the symbol, then the path is relative to the schematic where the symbol is instanciated.
1
s
@Christoph Weiser are you using schematic=... in the instance ? Like in picture?
In the case above
comp3_empty.sch
will be searched for in the search paths in the order they are given in XSCHEM_LIBRARY_PATH. The first match will be used.
@Christoph Weiser ensure you don't have
.
listed in XSCHEM_LIBRARY_PATH. Use
[pwd]
. example:
append XSCHEM_LIBRARY_PATH :[pwd]
instead of:
append XSCHEM_LIBRARY_PATH :.
this because
.
in
XSCHEM_LIBRARY_PATH
does NOT mean the current working directory (ie where xschem is started) but the directory of the current schematic (the one containing the symbols we are discussing about).
c
Yes I'm using it as in the picture above. My xschemrc contains the the following:
Copy code
set DESIGN_PATH [exec pwd]
set XSCHEM_LIBRARY_PATH :${DESIGN_PATH}/xschem/symbols
append XSCHEM_LIBRARY_PATH :${DESIGN_PATH}
I cannot exactly recall why I did what i did, but there was some reason for why I did it in this order.
s
using
pwd
is ok. Just don't use '`.
' which has in xschem a different meaning. (
.` is an alias for the directory where the current schematic is stored, so it is not a fixed path. This could be useful in some use cases but definitely not in other cases). PS: Do not use
exec pwd
,
pwd
is also a tcl builtin, much faster.
Copy code
tclsh8.6 [~] time {pwd}
22 microseconds per iteration
tclsh8.6 [~] time {exec pwd}
2666 microseconds per iteration
c
Ok thanks for the explanation. But if I understand correctly then i need to reverse the order, such that the first path found is $DESIGN_PATH and not ${DESIGN_PATH}/xschem/symbols
No still does it. Even with the new setup.
Copy code
set DESIGN_PATH [pwd]
set XSCHEM_LIBRARY_PATH :${DESIGN_PATH}
append XSCHEM_LIBRARY_PATH :${DESIGN_PATH}/xschem/symbols
The symbol instance looks like this.
Copy code
name=xcd
schematic=alternative.sch
When i try to netlist the testbench it will point down the tesbench direction path and not down into the path where the symbol is.
s
Ok, thank you, will do some tests.
Where is the symbol located? under ${DESIGN_PATH} ?
c
So the structure is such that at the root which is ${DESIGN_PATH} there are three folders sch/ contains all my schematics and symbols. tb/ contains all testbenches xschem/ contains primitive device symbols etc. xschemrc is at the root. from here i launch xschem.
The testbench is located in lets say: tb/experiment/mytb.sch in that testbench there is a instance of a symbol from sch/experiment/comp.sym. similiar there is a corresponding schematic in sch/experiment/comp.sch. Then there is the alternative schematic also in sch/experiment/comp_alt.sch.
s
@Christoph Weiser ok, clear, thank you. If you do a 'q' on the symbol what is the content of the
Symbol
textbox (see red ellipse) ?
c
Copy code
sch/experiment/comp.sym
s
I think you should set:
schematic="sch/experiment/comp_alt.sch"
or add
$DESIGN_PATH/sch/experiment
to the
XSCHEM_LIBRARY_PATH
.
append XSCHEM_LIBRARY_PATH :$DESIGN_PATH/sch/experiment
c
Yes setting the full path works.
Adding the testbench path to
XSCHEM_LIBRARY_PATH
seems less preferable to me because i will modify and clutter up my xschemrc.
s
It's not actually a full path, its the remaining path after $DESIGN_PATH. xschem tries to find symbol / schematic references in all directories listed in XSCHEM_LIBRARY_PATH. if XSCHEM_LIBRARY_PATH is set to
/a:/b:/a/c
and schematic reference is
d/comp.sch
then the following locations are tried in this order:
/a/d/comp.sch
/b/d/comp.sch
/a/c/d/comp.sch
search stops at first file found.
c
Thank you for the explanation and the great help!
👍 1
s
this manual page has more details about finding schematic / symbols. The goal is to avoid having absolute paths in schematics, since these will make the design unportable. You can do that, like
schematic=/home/user/design/sch/experiment/comp.sch
but it is obviously not recommended.
c
Ohh yes i fully understand that. When i say full path what i meant i the path from the root of the project as you also explained.
👍 1