← Back to community index
# support·Active

astrimid - is there a way to flip a mosfet, so ...

is there a way to flip a mosfet, so that the drain is on the opposite side? if I rotate, I need to flip drain and source, but the arrow then would be pointing to the wrong way and probably simulation would be messed up

Started by astrimidJul 12, 202657 messages

Discussion

Last active 13 hours ago · plain text
astrimidoriginal post
is there a way to flip a mosfet, so that the drain is on the opposite side? if I rotate, I need to flip drain and source, but the arrow then would be pointing to the wrong way and probably simulation would be messed up
Seve
Like “reflect” or “mirrorX” the symbol right? We dont have this but can add it quickly
astrimid
Yeah, I'm trying to model this simple divider powering the gate:
anil
Can't this be done through schrotation now?
shibo
that rotates all the ports, that's distinct from mirroring
Seve
Shared an attachment
Seve
rather than introduce symbol flipping, we can introduce clear props that indicate where the ports should appear rotation and mirror'ing is always a big problems for AI and humans, because it assumes that the normal orientation is obvious
astrimid
I got this so far: But the reference has this whole block rotated 180 degrees
astrimid
Shared an attachment
Seve
that's looking good! We have stuff entering the spec to fix the mosfet issue now. (https://github.com/tscircuit/props/pull/726 SPEC ONLY, implementation to follow)
astrimid
meanwhile, is here a way to rotate a schematic group?
astrimid
are schX/schY coordinates global?
Seve
no unfortunately, we also may not support that because it becomes very confusing when rotations are relative and "up" no longer means "up" etc. (this is why we also tend to discourage using <group />)
Seve
they are relative to a containing group/subcircuit
Seve
if you want to have a bunch of components grouped together but not in a group, you can use `<>` which is called a "Fragment" and does not impose any constraints
Seve
e.g. ``` export const MyElements = () => ( <> <resistor /> <capacitor /> </> ) ```
astrimid
maybe there's a space for a visual editor that reassigns schX/schY around. but mosfets themselves don't support rotation at all as I understand, only 90 degrees and 0 degress. -90, 180 don't appear to have any effect
Seve
yea we'll get mosfets sorted out soon- it is because they are an old symbol
astrimid
is there something newer?
Seve
no you're just finding legitimate bugs- i don't know why nobody has mentioned them
Seve
users don't always join discord i suppose
astrimid
yeah, I only joined cause AI keeps gaslighting me, saying I'm doing something wrong 😩
Seve
what ai do you use out of curiosity? Yea one thing we've learned is that AI is generally better when you give it PNGs rather than SVGs for analysis. If you haven't tried it yet, the tscircuit command line tools can be good for working with ai
Seve
`tsci dev` etc.
Seve
ai will do `tsci snapshot` to take pictures of the circuit iirc
astrimid
claude, gemini, deepseek, google AI mode. Then can produce mostly working spice model, but for tscircuit they keep hallucinating non-existent or introducing deprecated components and attributes
Seve
do you use it directly in the web? They may be failing to install the skill 🤔
astrimid
hm, there's a skill? I've mostly pasting the npm types reference and go from there
astrimid
the agentic way just burns dollars with unsatisfactory results
astrimid
maybe I should try Fable, but if it's impossible to implement without modifying tscircuit, I doubt it'll produce anything useful
Seve
yes this is our skill: https://github.com/tscircuit/skill
astrimid
My understandins is my use case it too niche. I've mostly seen tscircuit advertising in relation to PCB autotracing, not schematic. Maybe I should just give up on visualization and just use spice model and hand-picked set of probes
Seve
we are focusing more on schematic because we have a large partner (TI) that is asking us to make sure the schematics look good
astrimid
ooh, then trying to reproduce reference schematic even with manually positioned components might be exactly what you need
Seve
yea for sure
Seve
feel free to link me to any super complex schematics that could be a good reference
astrimid
the reference snapshots I've uploaded is a part of power delivery network of Dell XPS 15 motherboard, which has dual barell jack / usb-c sources, EC controller, protecting and buck-boost mosfets, charge controller, battery powering B+. with lots of control signals, filters, diods, small voltage regulator ICs and protection circuits even before the B+ distribution. if tscircuit can model that, I think it could model anything
astrimid
FYI, the "symbol*Side" property of MOSFET is live, but doesn't appear to have any effect
Seve
it is live in the types/spec but i don't think the implementation is live
Seve
Shared an attachment
Seve
https://release-tracker.tscircuit.com/
Seve
it takes a hour or so to go through the pipeline for release
Seve
basically every repo is running tests
astrimid
Here's the best I can do without rotating mosfets. SDC_IN should really be at the top. But if it's at the top, then Q202 has intersecting paths
astrimid
The pipeline appears to be failing: https://github.com/tscircuit/eval/pull/3206
Seve
thanks will checkout that pipeline issue, can you send me the code for that circuit- we will file a reproduction and fix it today
astrimid
Here's the file I'm working on. It's still unfinished. There should be voltage sources for simulation/toggling state, AC_DISC and ECOK binary logic signals controlled by those voltage source toggles, main diode to auto-on the main MOSFET and a whole parallel USB-C path with exactly the same kill/enable mosfet circuit with OR gate to switch between barrel source and USB-C power delivery, not even talking about comparators and chips and battery charging/discharging. It would probably be unfeasible to finish without LLM generation, but I'd need to fully understand tscicuit props to fix the draft AI produced and catch any bugs. I don't even know why I'm doing it anymore.😅
Seve
cheers thanks, we will try to get ahead of bugs you may encounter- e.g. <@778624824875941908> i THINK he's going to need to be able to have a switch turn on at a certain point, i'm thinking something like this could be good... ``` <analogsimulation> <simulate.pressswitch at="10ms" switch="SW1" /> </analogsimulation> ``` Also we need support for an OR gate and battery- or at least a doc with some example SPICE so he can implement them himself via `<chip spiceModel={...} />` In the future we'll support event-based state machines, that would make it so you could just do `<simulationevent eventName="press_switch" target="SW1" at="10ms" />`, in some ways this API is a lot more extensible-
Seve
shibo may know if there's already a way to do this (I think there is)
astrimid
well, the power button switch is powered by CMOS battery and the signal goes to EC chip which is operated by firmware, so highly unlikely it would be a part of analogue simulation.
Seve
gotcha- yea i guess i'm trying to think of all the different simulations you're trying to run and trying to get ahead of it. Some people would prefer to put multiple simulations within the same board, some people would create simulations separately (as different components), we're still figuring out how people will practically use simulations
Seve
appreciate the feedback tho, just let us know when you run into things because we will solve them quickly
astrimid
To give you a full context, I'm trying to simulate the main power rail protection logic, it was surprisingly easy to vibe code simulation from scratch: https://spice-circuit-simulation.vercel.app/ but it's all hardcoded, so I'm looking for some schematic format to visualize power paths and/or do simulations so it could be file managed/authored/extended. So far I have these candidates: tscircuit jsx, circuit json or some DSL/enhanced ngspice (I'm also looking at Rust thevenin cirq format/package). As I understand, power delivery schematics are quite similar across motherboards, all the IP is mainly in firmware, chips and physical layout.
Seve
Thats super helpful thanks
astrimid
I've checked again, the routing or wires works, but the symbol itself is not displayed in neither of combinations:
astrimid
The name matches, the symbols PR is in released state. The props PR was available immediately. Is there anything else not released?
Seve
This is due to a bug in tscircuit.com where it is using an old symbols package

Want to add to the conversation?

Reply in Discord so your notes stay connected to the source.
Continue in Discord ↗