Hi all! I have a simple question. I can set values...
# xschem
b
Hi all! I have a simple question. I can set values in a input nets, but how can I get their values?
s
I don't understand the question. What are you trying to do?
nets usually have a 'lab' attribute. This defines the name of the net. If you don't name a net xschem will name it automatically as net1, net2, net3, ....
to name a net don't directly set the lab attribute of a net, attach a lab_pin.sym or a lab_wire.sym or a ipin.sym/opin.sym/iopin,sym and edit the lab attribute of these symbols.
b
What I mean is: I can set states on input nets (0, 1, X and Z). I can set the input state by doing something similar to: xschem select instance VSS xschem set_logic 0 xschem select instance VSS clear update How could I get the value of a state of an input net and store it in a variable?
s
Thank you, I understand now. Will check that, few people have used this feature, so i will add a command for that if there is no working one. Will do asap.
I have added the command:
xschem logic_get net_name
that returns the logic value of the net. example:
xschem logic_get VCC
returns the state of VCC net: 0 --> logic low 1 --> logic high 2 --> Unknown state (X) 3--> High impedance state (Z) If net is not found or has never been assigned it will return X Can you pleas update xschem and test?
b
It works just fine! Thanks!
@Stefan Schippers could I make another request? Can you add a function to set the value on a specific net instead of having to select and unselect them? Like you just did: xschem logic_set net_name value
s
Yes i am doing it right now.
I have added the command:
xschem logic_set_net  net_name value [num]
that does the requested action. It sets specified net name to specified value. I have added a new command since it is not good to change the existing
logic_set
one as it breaks existing scripts.
b
Maybe change logic_get to logic_get_net to keep the style?
s
Yes i think it is a good idea. will do that
b
Btw, I saw that it's possible to hide symbols, how do I make to a specific symbol to be hidden?
s
ok logic_get is now changed to logic_get_net. when you say 'hide' do you mean symbol not drawn? or not used in simulation.
b
Not drawn
s
Hiding completely the symbol is dangerous because you will not see it any more.... may be just draw a bounding box around it?
b
That's would be great
Btw, if xschem doesn't do that already, what does "set var hide_symbols" do?
s
It does exactly that but globally, all symbols are hidden and only a bounding box is shown. hide_symbols = 0 --> show all hide_symbols = 1 --> bbox only subcircuits hide_symbols = 2 --> hide all symbols including primitives like transistors.
b
Is it possible to use an attribute to do that instead of being global?
Like hide=true, so it has the similar effect but for specific symbols
s
yes i will add that...
b
Thank you!
s
I think it is done now. Adding
hide=true
to a component will make the specific component display as a bounding box only. In picture two identical instances of an opamp, one with hide=true attribute set.
b
Thank you so much!!! I really appreciate all the work you've done
s
The recent additions need some testing, so if you find weird behavior please report.
b
Sure!
👍 1
@Stefan Schippers I was testing the hide function, and it seems it does not work when I set the property in line, for example: xschem setprop instance VCC hide true xschem redraw But when I open and close the property pop-up, it updates and (un)hide the symbol.
s
Thank you. It is fixed now. Please check
b
It seems that when a input net is set as 0, the other nets are not set up read as 0 instead of undefined. For example, I have 3 inputs nets, A, B and C xschem logic_get_net A (2) xschem logic_get_net B (2) xschem logic_set_net A 0 (first set) xschem logic_get_net A (0) xschem logic_get_net B (0)