whitequark changed the topic of #glasgow to: glasgow debug tool · code https://github.com/whitequark/Glasgow · logs https://freenode.irclog.whitequark.org/glasgow
ZirconiumX has joined #glasgow
<ZirconiumX> Just to clarify something from the README: "Glasgow is a 50 MHz bus multitool" but "he PC interface has peak throughput of ~360 Mbps (bulk endpoints), so you can sample 16 channels at 22.5 Msps, 8 channels at 45 Msps, 4 channels at 90 Msps, and so on"
<ZirconiumX> So, the 50 MHz value is not the sampling rate?
<whitequark> ZirconiumX: that depends on the protocol implemented in gateware!
<whitequark> so if you stream each single sample of raw pins, you're bandwidth limited
<whitequark> but it's possible to e.g. compress samples.
<whitequark> there
<whitequark> *there's already an onboard logic analyzer for applets that does compression, and it can easily sample 16 channels at 16 Msps, but with certain restrictions (that are usually satisfied anyway).
<whitequark> the README is somewhat confusing on that and should be rewritten to something like...
<whitequark> "the bus throughput is 360 Mbps, and the raw I/O throughput is at least 60 Msps (revB) / 96 Msps (revC) per pin, higher if the gateware was carefully tuned for maximum throughput"
<ZirconiumX> whitequark: That's...actually really capable for a $70 plus shipping device.
<ZirconiumX> But I suppose the downside is you need to know Verilog if you want something custom.
<whitequark> ZirconiumX: Glasgow doesn't use Verilog anywhere
<whitequark> it uses Migen, which is a kind of abstraction on top of Verilog, though semantically it's more of a Verilog replacement
<whitequark> using Migen greatly simplifies development of applets
<ZirconiumX> So it's essentially a Python DSL?
<whitequark> it is a Python DSL, yes
<ZirconiumX> You're not even trying to sell it and I'm kinda tempted. Guess I'll keep an eye on this.
<ZirconiumX> Yep, subscribed
<ZirconiumX> What happened with revC0? There's a commit about it having "severe restrictions on use of configurable pull resistors".
<whitequark> a bug happened, that's what
<whitequark> we did not follow the datasheet for one of ICs carefully enough and it blew up in our faces, figuratively
<whitequark> there's a workaround
<ZirconiumX> Hey, a figurative blow-up is better than a literal blow-up, though not as exciting.
<gruetzkopf> most usb ports are only good for magic smoke from silicon
<gruetzkopf> though with USB-PD at 20V/5A that's definitly changed
<ZirconiumX> It's still magic smoke
<ZirconiumX> Just a lot of it
<ZirconiumX> We have "Beware: it is impossible to simultaneously understand and appreciate USB." as a quote in our rounded corner of the internet.
<whitequark> hahahahaha, that's excellent
<whitequark> i know a lot about USB, unfortunately.
<whitequark> useless serial bus
<ZirconiumX> (why rounded corner? because there's nothing straight about the people there)
<whitequark> nice
<ZirconiumX> I have a....hobby....writing device drivers for Corsair devices.
<ZirconiumX> Ten different manufacturer specific protocols, and now they're doing an xkcd #927.
<whitequark> I reverse-engineered a lot of things about Thunderbolt.
<whitequark> it's even worse than USB.
<ZirconiumX> But I focus mostly on keyboard/mouse/mousepad/headset.
<ZirconiumX> How, pray tell, do you get worse than a protocol which has four different transport protocols, descriptors layered in descriptors layered in descriptors and a buggy implementation of half of Common Lisp?
<gruetzkopf> intₑl
<sorear> yet, PCIe is fine. we still haven't figured this out
<gruetzkopf> the actual tech behind tb might actually be (close to) fine, but all of the support firmware and software is delightfully horrible
<whitequark> yeah
<zkms> PCIe is good precisely /because/ tsunderebolt is so cursed
<zkms> there is a conservation law at work.
<whitequark> ZirconiumX: i counted the firmwares once
<whitequark> involved in setting up one TBT device
<gruetzkopf> pcie is extremely good, DESPITE intel working on it
<whitequark> there are at *least* eight, of which at least three are for the same chip but may differ in versions
<hl> that's kind of a miracle in itself really
<sorear> ah, waterbed theory
<ZirconiumX> I don't know how anybody trusted Intel to design something well from scratch after Itanium.
<hl> how -did- Intel manage to make pcie not suck
<gruetzkopf> like, grab the pcie 1.1 spec, read it front to back once and you'll have a good-enough understanding of it
<whitequark> yep
<gruetzkopf> like, enough to build devices
<zkms> they got the people with bad taste in designing these things to work on thunderbolt
<whitequark> hl: i have been told that in certain™ standards committees there have been people whose only job was to get other people who were known to have bad taste in specifications very very drunk.
<whitequark> so drunk they could not work on the standard the next day.
<hl> whitequark: hahahahahaha. oh god. I can believe this.
<whitequark> and do it every day
<whitequark> there's also the "sacrificial anode standard design".
<gruetzkopf> i'd be extremely happy if PCIe had like a 500MT/s mode
<whitequark> which is when you put in a part of the standard specifically to attract the ire of morons
<whitequark> and then you remove it with all their changes.
<hl> whitequark: So a good read (if you're interested in the general principles computer networking, or in the ISO OSI v. TCP/IP war) is 'Patterns in Network Architecture', which I've been reading recently. The author sat on the ISO OSI committee and watched it literally self destruct in political squabbles and dysfunction...
<ZirconiumX> I am already glad I joined channel
<whitequark> that's the normal state for committees
<sorear> ooh I like the sacrificial anode idea, we should have been doing that
<whitequark> it's surprising if they do *not* self destruct
<ZirconiumX> My poor, poor sides
<hl> whitequark: ah yes, the "get rid of the duck" maneuver
<ZirconiumX> I should probably sleep though; I have a 9am class and it's 1am at the moment.
<hl> legend about a SW dev boss who would always insist on random (incredibly stupid) changes to SW at the last minute to "put their mark on it", so they started doing things like adding pictures of ducks so that the thing he would say was "oh, and get rid of that duck"
<whitequark> nice
<gruetzkopf> next spec on my read list is sRIO
<hl> what made ISO OSI particularly acrimonious is that it was basically staffed by telco people, rubbing up against this new 'networking' thing; they saw things like connectionless networking and dumb networks and did _not_ like that (moneyyyy)
<hl> oh god, is this a channel full of people who just randomly read technical specifications? i'm at home
<whitequark> hl: i implemented the first open-source PCIe PHY
<hl> whitequark: Wow!
<whitequark> it's not really usable yet, but it does train the link
<gruetzkopf> rapidio is nice in that they have their specs like right on their website, without login or anything
<hl> gruetzkopf: yeah, so I actually collect paywalled technical specifications
<gruetzkopf> so do we all
<whitequark> i have a library of those, of course
<whitequark> i have an entire collection of PCIe specifications up to gen3 as well as a gen4 draft
<gruetzkopf> my directory of nonpublic datasheets is like 3.5GiB
<whitequark> including MR-IOV
<hl> Yeah, I found the gen4 draft too - I've got v0.7. I also have, hold on
<gruetzkopf> all niche stuff
<whitequark> oh, my draft is 0.3
<zkms> hl: if you have RTCA specs lmk
<hl> https://www.devever.net/~hl/f/pcie-collection.txt this is my collection of PCIe stuff, let me know if anyone wants anything from this
<hl> I don't think I have MR-IOV
<whitequark> oh that's quite a lot
<hl> I have tons of SCSI and ATA standards too, also tons of ISA specs which are mostly public, except for Qualcomm's Hexagon DSP spec
<ZirconiumX> I, uh, just have the spec sheets for the PS2
<ZirconiumX> (PlayStation 2)
<ZirconiumX> Which are very lacking.
<gruetzkopf> i have not a single hexagon in in pile of trash that i can get code exec on
<gruetzkopf> i *really* want to play with that monstrosity
<hl> gruetzkopf: hexagon is hilarious. they literally made an entire DSP arch, and _the only way you can get a Hexagon_ is as part of their ghastly mobile SoCs.
<gruetzkopf> yep
<gruetzkopf> i've seen block diagrams of their current SoCs, where they implemented usb-xhci using a hexagon
<hl> gruetzkopf: what the HELL
<hl> how the
<gruetzkopf> instead of nec v850 like nec/amd or whatever intel did
<hl> hilariously they NDAwall that document on their website, but provide an SDK download for free which is some Windows installer which I had to painstakingly extract to find... the same PDF included within. Good to see corporations continue to have no clue what NDAs are for
<zeiris_> not *just* mobile SoCs, there's Windows laptops with on-die Hexagon cores now!
<whitequark> why
<hl> let me guess, Windows on snapdragon?
<zeiris_> yup
<zkms> hl: ty for that Hexagon spec pdf :3
<hl> zkms: np
<sorear> gonna pull that in a couple hours when I’m on non-mobile, I collect ISAs too
<ZirconiumX> You guys ever seen SuperH?
<ZirconiumX> The ISA.
<hl> I don't know much about it other than Sega used it a lot
<hl> Still used in Renesas MCUs IIRC, and someone made that open implementation of it
<ZirconiumX> Yeah, that and it's sometimes used in cars
<ZirconiumX> 16-bit RISC
<ZirconiumX> (as in, instructions are 16-bit)
<sorear> ZirconiumX: yes! #j-core :3
<sorear> sadly not that active
<ZirconiumX> https://hwdocs.webs.com/ <--- this website is a gold mine, even if it's hosted on the least trustworthy webhost ever.
<ZirconiumX> (the actual download links are Dropbox links)
<_whitenotifier> [whitequark/Glasgow] whitequark pushed 1 commit to master [+0/-0/±1] https://git.io/fhppZ
<_whitenotifier> [whitequark/Glasgow] whitequark 33a63ef - applet..i2c_master: pad scanned addresses to 7 bits.
<hl> i get wonderful milage out of ddg'ing for "intitle:"Index of"" - random people's open directory listings are so useful
<whitequark> nice
<ZirconiumX> From the IBM Gekko (GameCube CPU) ISA manual
<ZirconiumX> Old MacDonald had a farm... https://puu.sh/Bamj2/2e2d7db191.png
<hl> ah, POWER
<hl> it also has "miso" now ("make it so")
<hl> and "darn" ("deliver a random number")
<ZirconiumX> Ridiculous Instruction Set Computing.
<whitequark> nap, doze, sleep and rvwinkle
<ZirconiumX> I'm really glad my introduction to assembly was MIPS :P
<hl> heh, I had to get used to reading MIPS disassembly recently
<ZirconiumX> Maybe Alpha would have been a good beginner ISA too.
<hl> branch delay slots take a bit of getting used to
<ZirconiumX> Honestly I grokked them pretty quickly
<whitequark> MIPS is kind of awful though
<whitequark> I guess the subset people usually teach with is only moderately bad
<hl> yeah
<ZirconiumX> I'm talking full fat MIPS 3 here.
<hl> I mean I assume it's cheaper to licence than ARM or POWER, and now they saw the RISC-V writing on the wall and made it royalty free
<ZirconiumX> The Great MIPS Schism ISAs are unknown to me.
<ZirconiumX> And honestly the instruction decoding makes sense. Unlike, say, ARM.
<hl> ARM is... it may be RISC but it feels hella CISC to me
<ZirconiumX> ldmia sp!, {pc}
<whitequark> RISC and CISC are fake terms.
<hl> more or less
<whitequark> there's absolutely no point in making the distinction or declaring any core as RISC or CISC, ever.
<hl> CISC can be viewed as just an instruction stream compression scheme to save fetch bandwidth
<whitequark> ok, I guess if you want to troll someone on the orange website.
<hl> and most RISCs have adopted such a scheme out of practicality (thumb, etc.)
<hl> so everything is a hybrid design now
<whitequark> no, not even that.
<whitequark> the distinction was never meaningful to begin with.
<whitequark> you can't say that something is CISC or RISC because there's no coherent set of criteria.
<hl> that's true
<whitequark> you could say that something has a fixed instruction size, or that it doesn't have memory-memory opcodes.
<hl> the term really relates to a historical trend in ISA design at a particular point in history; it should be viewed as a historical rather than an objective one
<whitequark> but for example I designed an ISA where registers are stored in a window in main memory. in it, all opcodes are memory-memory opcodes, and also most opcodes are register-register.
<sorear> RISC means “designed after 1985”, nothing more or less
<hl> it's basically just a grab bag of New Ideas in non-sucky ISA design that all came to the fore around the same time
<hl> sorear: pretty much
<whitequark> lol
<ZirconiumX> whitequark: what do you consider a "good" ISA? Or do you think there is no such thing?
<whitequark> that depends on what your domain is
<whitequark> the problem with MIPS is that it's worse than some other ISA in every domain it's applied in
<whitequark> it's kind of unique in that
<ZirconiumX> How so?
<whitequark> MIPS is an ISA that only has features every other ISA also has, and a set of implementations with absolutely nothing to distinguish them
<ZirconiumX> I'll admit, they made awful design decisions in hindsight - the separate multiply pipeline, delay slots - but it was still pretty good for its time
<whitequark> you might have noticed how MIPS gets sold and resold and resold, and that's because no one has any idea what to do with it
<whitequark> it's just completely pointless
<whitequark> there's also a thing where it has more than a dozen ABIs
<ZirconiumX> Modern MIPS, sure, I'm not arguing modern MIPS is any good, because frankly it's not.
<whitequark> MIPS still doesn't have any SIMD in the spec
<whitequark> like what?
<ZirconiumX> MDMX, MSA
<ZirconiumX> Though I haven't looked at either of those.
<whitequark> there are a few extensions
<whitequark> either they are vendor specific, or no real silicon implements them, or both.
<whitequark> there's absolutely nothing compelling about MIPS. it's not particularly bad, it's just pointless.
<whitequark> there's no reason to use it over anything else
<ZirconiumX> Hah, true. The PS2 was really bad in that respect.
<ZirconiumX> How much do you know about the Toshiba R5900 core used in the PS2?
<whitequark> basically nothing
<ZirconiumX> Well, they took an R5000 core
<ZirconiumX> Cut the caches
<ZirconiumX> Gave it an integer SIMD instruction set, which uses the same register file as the GPRs, but extended to 128-bit
<ZirconiumX> Gave it a non-IEEE (DAZ, FTZ, RTZ always on) single-precision-only FPU with changed instruction encoding
<ZirconiumX> (also there are no NaNs or infinities, instead they just extended the range of valid values)
<ZirconiumX> Implemented *most* of MIPS 3 but not a 64-bit multiply/divider
<ZirconiumX> Instead implementing a second 32-bit multiply/divide unit you need to use custom instructions to access
<ZirconiumX> Gave it a 32-bit virtual address space despite being MIPS 3
<ZirconiumX> Didn't implement atomic instructions
<ZirconiumX> And then hooked it up to one of the custom SIMD units they made.
<sorear> So you have evidence MSA was never implemented?
<ZirconiumX> Yeah, it's in the P5600 and P6600
<ZirconiumX> "it" = MSA
<hl> alright, so, where can I read about this open PCIe PHY?
<whitequark> it's not really documented
<hl> ah, this uses the ECP-5G SERDES? nice
<hl> having a SERDES FPGA with an actually open toolchain for the first time is going to be amazing
<whitequark> yes
<hl> does the ECP-5G toolchain have functioning SERDES support now?
<whitequark> yes
<whitequark> it's ECP5-5G, not ECP-5G
<hl> er, yeah
<whitequark> and the -5G suffix is purely binning
<whitequark> the -5G FPGAs are the normal FPGAs that are overvolted by 0.1V and binned
<hl> are the SERDES fused off/unusable in the non-5G parts?
<whitequark> no
<hl> ooh
<whitequark> none of the segmented ECP5 devices have any fuses preventing you from treating it as a higher segment
<sorear> the LFE5UM* parts have a guaranteed 3.3G serdes
<whitequark> there's a bunch that have larger fabric internally
<sorear> the LFE5UM5G have guaranteed to 5G serdes
<sorear> the LFE5U (no M) parts do not have a guaranteed serdes, and it’s not clear if the serdes pads are bonded out on them
<sorear> xray seems to have been making good progress recently too
<hl> i've been wondering if you could do SAS on an ECP-5G... seems plausible
<hl> er, ECP5-5G >_>
<sorear> dunno much about SAS
<sorear> there seems to be a small amount of protocol-specific hardware for things like PCIe Electrical Idle
<hl> yeah
<hl> it seems like the PCIe, USB3, SATA, SAS, (DP?) PHYs are all absurdly similar to one another, though, really
<sorear> yeah
<hl> to the point where Intel's current PIPE spec is 'Converged PIPE' designed to allow a PHY to support all of those as selectable options
<hl> AFAIK the SAS PHY is really just SATA with a higher voltage level
<sorear> and there's a "SATA Express" thing now, but I haven't actually read any of the SATA specs
<sorear> or PIPE for that matter
<hl> SATA Express is just PCIe
<hl> probably AHCI over PCIe, I haven't checked - NVMe has pretty much won though
<hl> the SAS drive connector has been redefined so that it can run (SATA, SAS, or PCIe (for NVMe)), dynamically selecting
<hl> so SAS backplane controllers are probably going to gradually be replaced with PCIe switches, or hybrid SAS controllers/PCIe switches which can function as either
<sorear> UHCI, OHCI, EHCI, XHCI, AHCI confused me for a long time (one of these is not like the others)
<hl> yeah, the generic naming of host controller interfaces is annoying
<whitequark> hl: USB3 PHY is directly derived from PCIe PHY
<hl> yep, figures
<whitequark> the LTSSM has the same state names even
<whitequark> of course they did not miss an opportunity to fuck it up
<hl> it's all just LVDS with 8b/10b
<whitequark> no, also 128b/130b
<hl> ah yeah. How'd they fuck it up?
<whitequark> and SAS has 128b/150b iirc
<whitequark> look at the spec
<hl> oh god, do I have to
<hl> even the typesetting of the USB specs sucks
<whitequark> look, i do not look at the USB spec for free
<hl> ha!
<hl> fair enough
<hl> i seem to be surprisingly optimistic...
<whitequark> hl: re: hotplugging
<whitequark> this is sort of available already
<whitequark> you can ask ACPI to give you the VDM data for the altmodes negotiated by the USB C device
<whitequark> the table is called, fittingly, USBC
<hl> yeah
<whitequark> then well, you have to opt into enabling TBT
<hl> but again, what's nuts is that they did it in ACPI, so how are add-in cards to implement USB-C?
<whitequark> TBT even has a challenge response auth mode so that you can avoid MITM attacks
<whitequark> have you seen how TBT3 addon cards work?
<whitequark> there is a GPIO header
<whitequark> it's patented, which is how i know what's there
<whitequark> it's well, there's a pin for taking TBT controller out of power saving mode (yes, it's a sideband)
<whitequark> and there's another pin for the DP mux
<whitequark> and some other minor junk, you get the idea
<hl> yeah, I heard - the chatter in the wake of USB4 caused me to read your IRC logs about TB
<whitequark> the motherboard has to have a matching GPIO header
<whitequark> ah
<hl> right, so it's completely bananas - what I don't understand is why Intel didn't just extend XHCI
<whitequark> they use XHCI too
<whitequark> if you daisy chain an USB device to a TBT device, the remote XHCI in TBT device activates
<hl> ah, but I mean for controlling local USB-C altmodes
<whitequark> because altmodes aren't USB so much as USB PD which is pretty much completely unrelated
<hl> intel has chosen a bizarre ACPI-based architecture that assumes all USB-C ports on the system will be on the mainboard, when they could have just added an extension to XHCI for tweaking it
<hl> hmmmm
<whitequark> you need USB PD to get USB to work
<whitequark> the SS inversion mux is controlled by USB PD controller
<hl> yeah, I saw - USB PD is some 300kb/s serial interface over CC1? Dunno why they didn't just make that serial channel accessible over XHCI
<whitequark> because altmodes don't involve XHCI at all
<hl> oh I know, I'm just saying, it would have been saner if they did (or could)
<whitequark> unsure
<whitequark> if you tie PD to XHCI, what do you do if your device isn't USB at all?
<whitequark> like DP over USBC, or something else
<whitequark> i think the best altmode would have been SGMII over USBC
<whitequark> what you want for that is probably piping MII registers (if you're terminating that in 1GBASE-T) via USB PD
<whitequark> since SGMII doesn't have any in-band way to do that
<whitequark> i mean, there are vendor extensions to do it, and they're horribly insecure, so you don't want htat
<whitequark> the saner way would be to define a plug-n-play architecture for USB PD controllers in ACPI
<whitequark> they're like halfway there even
<whitequark> the PD controllers have a standardized I2C interface
<whitequark> it's not typically exposed to the OS or ACPI, it's EC/TBT controller only
<whitequark> probably because you jammed together power delivery and altmode parts
<hl> i mean, I'm not saying XHCI should be made mandatory to USB Type-C... just that if you have XHCI in a system, it would be logical to use that as the configuration channel
<hl> you'd add flags to XHCI so a port could be marked 'is Type-C', 'supports altmodes', 'supports PD', maybe also 'this port does not support USB', so it's there but can't be used normally. Add commands to TX/RX over PD serial comms, and commands to get a list of supported altmodes on the local side, and a command to set the altmode... now, any given XHCI controller would probably be designed by a vendor to, I
<hl> dunno, process that command by setting GPIOs on the chip (just like the header), or I2C or something, and a XHCI add-in board maker could connect that to whatever altmode switching crap they have plumbed in
<whitequark> so on current architecture
<whitequark> the XHCI lives on the TBT controller IC and it isn't even powered until the USB PD controller wakes up the TBT controller
<hl> I mean
<hl> if you have a Type C add-in card, and you want to plumb it via ACPI, what's the host communications channel? PCIe or SMBus?
<whitequark> like, that's not excusing them, that's explaining why
<whitequark> neither
<whitequark> existing TBT silicon can't do PM over PCIe, and existing PD silicon can't be exposed to SMBus
<hl> right, exactly
<whitequark> because you can probably blow the motherboard by fuzzing it
<hl> I'm not talking about what is, just how Intel should have designed it if they weren't nucking futz
<whitequark> given how much they failed at producing even *this* utter shit silicon...
<hl> I can dream >_>
<whitequark> if they went with a better design i don't know if they could have made it work at all
<whitequark> like
<whitequark> TI has a die respin of TPS65983 to add 20 kB of RAM to it
<hl> But if USB-IF's adopting this, they're going to have to come up with _some_ solution that doesn't involve "??????? SMM ????? ACPI ??????? GPIO headers ?????"
<whitequark> because they couldn't fit PD3
<sorear> wondering how hl has avoided attention from minnich, leighton, et al
<hl> avoided attention?
<hl> whitequark: hahaha
<whitequark> they are also doing everything to hide this fact, because i assume they are ashamed of it deeply
<whitequark> some of their engineers spilled it on E2E forums
<hl> yeah
<whitequark> the TPS65983 is nearly identical to TPS65982
<whitequark> they are firmware compatible in both directions, I tried
<whitequark> but TPS65983 is TBT only
<whitequark> and TBT requires TPS65983
<whitequark> also
<whitequark> TPS65983 docs are export controlled.
<whitequark> they're not under NDA.
<whitequark> but they ARE under export control.
<whitequark> what the fuck??
<hl> I have to wonder if Intel is actually suffering from skill loss (or at least an evacuation of all sane architects)
<whitequark> skill loss?
<whitequark> intel has always been like that
<hl> yes.... TI seems very.... overenthusiastic about export control...
<hl> True enough
<whitequark> TPS65982 is *not* under export control.
<hl> Can't help but feel they've been getting even worse, tho
<whitequark> also, TI employees claim that Intel made them hide the USB PD docs.
<hl> oh for
<whitequark> and [redacted] laptop company employees claim that TI decided to hide the USB PD docs and pin this on Intel even though Intel doesn't care.
<hl> as someone for whom non-public documentation is the absolute bane of my existence, fuck Intel
<sorear> I have no love for UEFI/ACPI but trying to do anything without them means interacting with a small number of extremely insufferable people
<whitequark> I mean that would be a genius move, just blame Intel for any inane shit you decide to do.
<whitequark> "tire fire" doesn't even begin to describe that whole ecosystem
<hl> I mean TI is an NDA-happy company too, though not nearly as bad as a lot of companies
<hl> you know the beaglebone? Their Sitara processors have open datasheets and TRMs... great. Hilariously all the secure boot crap is in separate secret NDA'd documents. Because "security", I guess
<hl> it's 2019 and the hardware industry still doesn't understand Kerckhoff's principle
<hl> (my previous rant about this... https://www.devever.net/~hl/smartcards )
<whitequark> ahaha smartcards
<whitequark> i don't even need to click that link
<hl> ikr?
<hl> that whole industry is a fucking dumpster fire
<whitequark> sorry, what
<whitequark> BasicCard?
<whitequark> what the everlivnig fuck?
<hl> yes, yes
<hl> this is an actual thing apparently
<hl> suppppposedly some openpgp smartcards are implemented using it
<hl> I have no idea what the fuck
<whitequark> I'm going to start drinking again.
<hl> I also find it randomly hilarious how mifare has for a long time been selling smartcards branded 'MIFARE DESFire' -- but they actually support 3DES, AES. Which tells you all you need to know about their customers - they're clueless enough that 'DES' isn't a customer-repellant
<sorear> is "basiccard" what it says on the tin
<whitequark> hl: >The microcontroller used in the Nitrokey Pro is an STM32F103TB. This microcontroller doesn't appear to offer as much in terms of fuse bits, etc. as the Atmel AT32UC3A3256S used for the Nitrokey Storage — see below — but apparently it is nonetheless possible to prevent readout via JTAG. So long as the device does not expose any facility to read out memory or change firmware via the USB
<whitequark> interface, the device is secure.
<whitequark> what you typically do is glitch the chip
<whitequark> it's exceedingly unlikely that it is actually secure
<whitequark> >The available information about the Nitrokey Pro then suggests a haphazard design in which some functions are performed on a microcontroller but others, for some reason, are performed by a smartcard chip. Perhaps this due to a lack of confidence in the security of the main microcontroller?
<whitequark> oh yeah that's why
<whitequark> with the rigth tools and know-how (which i lack) extracting data from the main uC is a weekedn job
<hl> whitequark: yeah, I know... tbf I know more now than when I wrote that
<whitequark> lol ECB
<sorear> > SAM’s command system is a radical departure from prior spaceflight instrumentation. SAM is a BASIC interpreter. Its native command language encompasses the complete set of BASIC language constructs—FOR-NEXT, DO-WHILE, IF-ENDIF, GOTO and GOSUB—as well as a large set of unique built-in commands to perform all the specific functions necessary to configure and operate the instrument in all its possible modes.
<_whitenotifier> [whitequark/Glasgow] whitequark pushed 1 commit to master [+0/-0/±8] https://git.io/fhpjT
<_whitenotifier> [whitequark/Glasgow] whitequark f55a512 - applet: use dedicated *Error for each *Interface class we have.
<marcan> ok, ordered the new expanders
<marcan> esden: I'm going to lift pins on pine fwiw :)
<marcan> though really just to validate it; you can use the old expanders fine with the mod on the ECNs page
<marcan> *mine
<marcan> will make the schematic/layout changes shortly and push
<_whitenotifier> [Glasgow] whitequark opened issue #108: Verify XC9572XL programming on revC - https://git.io/fhpj6
<_whitenotifier> [Glasgow] whitequark opened issue #109: Verify MEC16xx programming on revC - https://git.io/fhpji
<whitequark> marcan: esden: note that more changes are required for revC1
<whitequark> #97 is quite important
<_whitenotifier> [whitequark/Glasgow] whitequark pushed 2 commits to master [+2/-0/±3] https://git.io/fhpjM
<_whitenotifier> [whitequark/Glasgow] whitequark d3592a8 - database.xilinx.xc9500: separate devices and devices_by_idcode.
<_whitenotifier> [whitequark/Glasgow] whitequark d89fbd7 - database.atmel.avr: extract from applet.program.avr.
<marcan> whitequark: B10 is VPP_FAST, not an IO ball
<whitequark> ugh
<marcan> we don't have any IO balls free in the FX2 side bank
<whitequark> shit
<whitequark> can you follow my thoughts in #97?
<marcan> trying to
<whitequark> i'm in a completely different area rn
<whitequark> but only having one usable PLL sucks
<marcan> you're talking about dual output, right?
<marcan> since the user side PLL should be fine, right?
<marcan> so just the FX2 side PLL
<whitequark> the user side PLL should be fine, although I think for some reason I couldn't get it to work on revC
<whitequark> there were still pin conflicts?..
<marcan> hm, need to look at that, but we had the extra pins so...
<marcan> btw, I have some widgets with XC9536XL if you want me to try to validate that
<marcan> I assume the 9572XL code will work with minor changes?
<whitequark> oh that'd be pretty cool
<whitequark> it should only require database changes
<marcan> k
<whitequark> also i should rename it to program-xc9500xl
<whitequark> not compatible with non-xl parts at all
<marcan> yeah, I thought it was non-xl when I first saw it
<whitequark> the xilinx nomenclature is confusing
<marcan> whitequark: heh, I forgot the pinout of this thing (I designed it lol, but Eagle and I no longer have that installed)
<marcan> I can just use the jtag finder, right? :D
<whitequark> of course
<marcan> I: g.applet.interface.jtag_pinout: shifted 8-bit IR with TCK=A0 TMS=A3 TDI=A2 TDO=A1
<marcan> I: g.applet.interface.jtag_pinout: JTAG interface detected, not probing TRST#
<marcan> nice.
<whitequark> yep
<marcan> I: g.applet.interface.jtag_probe: TAP #0: IR[?] IDCODE=0x59602093
<marcan> I: g.applet.interface.jtag_probe: manufacturer=0x049 (Xilinx) part=0x9602 version=0x5
<whitequark> hm, why did it not determine IR length, i wonder
<whitequark> -v and pastebin?
<marcan> whitequark: https://mrcn.st/p/j9bZ14mL
<marcan> also I see xc9500 hardcodes BLOCK_FUSES/etc, I assume that needs to change for 36?
<marcan> want a .jed file?
<whitequark> yes, and another for 9572xl so i remember how the fuck that worked
<marcan> I don't have one for 72, sorry
<whitequark> hm, fine
<marcan> don't really feel like spinning up ISE
<marcan> but the comments you wrote for 9500 seem reasonable
<whitequark> i can probably work with it like it is
<whitequark> of course they are reasonable, this is verified on real silicon
<marcan> I mean reasonable as in useful
<whitequark> ah, the IR segmentation failure is alright
<whitequark> might want to adjust that but it's expected with the current algo
<marcan> aside: I like how the user LEDs default to dim from the pull-ups when nothing uses them
<marcan> it's a nice effect
<marcan> colorful, not distracting
<marcan> and since i brightness-matched them to the other LEDs, it's obvious they're in tristate state
<whitequark> yeah
<marcan> since when actually active they're notably brighter
<_whitenotifier> [whitequark/Glasgow] whitequark pushed 1 commit to master [+1/-0/±2] https://git.io/fhhek
<_whitenotifier> [whitequark/Glasgow] whitequark 91dfc35 - applet.program.avr→applet.program.avr.spi
<marcan> whitequark: looks like the JED fields for 36 are half as wide?
<whitequark> hrm
<_whitenotifier> [whitequark/Glasgow] whitequark pushed 1 commit to master [+3/-3/±1] https://git.io/fhhes
<_whitenotifier> [whitequark/Glasgow] whitequark 7e47987 - *.xc9500→*.xc9500xl
<marcan> actually I don't even have a bitfile for this, heh
<marcan> just the jed
<marcan> sigh, let me see if ise works
<marcan> I haven't use this in *years*
<marcan> *used
<marcan> [1] 250047 floating point exception ise
<marcan> LOL.
<marcan> [794210.055301] traps: _pn[250047] trap divide error ip:7f213e999ea8 sp:7fff8c53a410 error:0 in libQt_Gui.so[7f213e533000+996000]
<marcan> amazing.
<whitequark> so the 9536 has exactly half as much bits
<marcan> how do you actually *get* bitfiles for a cpld?
<whitequark> you don't
<whitequark> the glasgow .bit format is invented by glasgow
<marcan> oh.
<marcan> lol.
<marcan> how do you generate it?
<whitequark> what you can do is to ask ise to make an svf
<whitequark> program the device
<whitequark> then read out a bit
<marcan> ah
<marcan> well this device is already programmed
<marcan> so that works for me
<whitequark> excellent
<marcan> I *think* it's even programmed with that jed file
<marcan> though I can't guarantee that
<whitequark> give me um, a few thousands reads from FVFYI
<marcan> how do I do that?
<whitequark> then read-bit
<marcan> lol I think paste.debian.net is trying to talk to my yubikey
<whitequark> er, that should be 9602
<whitequark> actually, hm, let me look at BSDL
<marcan> I get E: g.applet.program.xc9500xl: cannot select TAP #0
<marcan> fwiw
<whitequark> marcan: oh fuck's sake
<whitequark> the 9536 actually has a *shorter ISDATA register*
<marcan> ha
<whitequark> this... violates basically every assumption my applet has
<marcan> why does this sound so xilinx?
<whitequark> xc95288 has an enormous ISDATA
<whitequark> 128 bit
<marcan> lolol
<marcan> so they scale up depth-first
<whitequark> and95144 is 64 bit of course
<whitequark> ughhhhhhhh
<whitequark> i resent this deeply
<whitequark> the address register is the same width
<whitequark> what the fuck
<whitequark> marcan: not depth-first.
<marcan> T: g.applet.program.xc9500xl: JTAG-H: ir count does not match idcode count
<marcan> E: g.applet.program.xc9500xl: cannot select TAP #0
<whitequark> depth ONLY.
<marcan> right
<marcan> any idea what that TAP thing is about?
<whitequark> yes.
<whitequark> let me dig out my 9572xl board and i'll fix it.
<whitequark> it's a consequence of some JTAG hardening i did recently
<whitequark> intended although not entirely expected
<marcan> I mean I'd like to understand this too so I wouldn't mind knowing what the problem is and trying to fix it myself :p
<marcan> since ideally the goal here is for me not to have to ask you about everything eventually ;)
<whitequark> sure
<whitequark> give me a moment
<marcan> kk
<whitequark> so the IDCODE/BYPASS DR can be cleanly segmented if you know nothing about the chain
<whitequark> but IR cannot be cleanly segmented because there's only one constraint, IR must start with 10
<whitequark> therefore my code segments IR at every occurrence of 10
<marcan> ah
<whitequark> it used to do something , uh, well not this
<whitequark> which happened to work right with just one TAP
<whitequark> but it was buggy elsewhere
<whitequark> what you should add is to special-case the single TAP case in select_tap
<whitequark> because that's the only case where you never need to segment IR
<whitequark> marcan: actually i guess i'll fix that
<whitequark> but
<whitequark> i really want you to fix the xc9500 code
<marcan> sure
<whitequark> because when i read my own documentation about xilinx internals again i want to vomit
<whitequark> unsure how i even did it in the first place
<marcan> I can make it work with the 36, but you'll have to validate that I don't break the 72 later
<whitequark> sure
<whitequark> let me solder to this board
<marcan> is the bitfile format fixed?
<whitequark> it has a stupid 1.27mm header
<whitequark> not really
<whitequark> it's just whatever
<marcan> the .jed shit is xilinx proprietary, right?
<marcan> not like svf
<whitequark> jed is for JEDec
<marcan> that's what I figured
<whitequark> it is uh
<whitequark> JED1 i think?
<whitequark> no
<marcan> it looked too sparse to be standard/generic stuff
<whitequark> JESD3C
<whitequark> bizarre, extremely old open standard
<whitequark> the thing about jed files is they are a bitmap of every fuse in the device
<whitequark> but they say nothing about how fuses are actually programmed
<marcan> okay so it's .hex for PLDs
<marcan> so basically useless
<whitequark> correct
<whitequark> glasgow doesn't even implement jed
<marcan> I think we should implement a read-only thing to ingest xilinx jed files
<marcan> but otherwise fuck them
<whitequark> of course
<whitequark> this needs a jed parser
<marcan> well okay, so
<marcan> 1) make it read XC9536XL
<marcan> 2) make it write it and not brick it
<marcan> 3) make it read the JED file and prove it works
<whitequark> yep
<marcan> I'm going to stare at the xilinx applet, you can fix the TAP :P
<whitequark> christ, what have i become?
<whitequark> i just pulled a router out of a pile of 14 devices
<whitequark> and that's just the useful ones
<whitequark> i also have a pile of *useless* routers.
<marcan> whitequark: do you prefer internal state or args for XC9500XLInterface? i.e. pass the device to every method or just have a set_device thing that sets state?
<marcan> or even another class?
<whitequark> neither
<whitequark> pass it to the constructor
<marcan> but identify()
<whitequark> mmm
<whitequark> let me see
<marcan> could either set state after identify(), or have another class implement most of the interface and leave the generic class to basically just do identify()
<whitequark> the latter is cleanest
<marcan> k
<whitequark> so you'd have a XC9500XLInterface (generic) and XC95xxXLInterface (specific)
<whitequark> you'll also need to do something about arch.xc9500xl
<marcan> oh I don't mean subclassing for each device
<whitequark> yes
<marcan> the device details can go in the device db
<whitequark> the xx are in the name
<marcan> oh sure
<whitequark> you'll have to rework all the code that pokes registers
<marcan> yes
<whitequark> bizarrely, ISCONFIGURATION connects address AFTER data
<whitequark> the Bitfield class is an awful hack inside
<whitequark> it can't do anything over 64 bits
<whitequark> certainly not 130 bits
<whitequark> so, purge the DR_ bitfield definitions
<whitequark> and i guess slice the bitarray directly or something
<whitequark> nb: you always want the bitarray to be little endian
<whitequark> otherwise, awful shit will silently happen
<whitequark> i actually don't like that class a whole lot but a lot depends on it now, hrm
<marcan> how does Bitfield manage to have a 64-bit limit?
<whitequark> it uses ctypes unions and packed sturcts inside.
<whitequark> yes. the literal worst way to implement Bitfield.
<whitequark> i don't remember what the hell was i thinking
<marcan> but. why.
<whitequark> i have no idea.
<whitequark> i'd say "i was drunk/high" but i definitely wasn't.
<marcan> I like all the horrible metaprogramming in there
<marcan> I'm learning about python features I didn't even know existed
<marcan> :P
<whitequark> lmao
<marcan> I mean of course types.new_class is a thing
<marcan> but I've never *had* to use that before
<whitequark> look, i wasn't trying to be clever
<whitequark> i was just really angry at something
<whitequark> oh
<whitequark> i made it for either XC9500XL or EJTAG
<whitequark> that explains why it's so bad
<marcan> lol
<whitequark> it's because i was really pissed off at this piece of shit interface
<marcan> okay I can accept frustration leading to bad code, but the moment you let ctypes creep in you have control issues :D
<marcan> I'm debating whether I should try to understand and fix Bitfield
<whitequark> i htink i didn't know about python's int.from_bytes back then
<marcan> or just rewrite it from scratch
<whitequark> or it would have been much easier
<whitequark> you don't need to rewrite it from scratch, well not exactly
<whitequark> just make it not use ctypes
<whitequark> what you want is to have a canonical representation, bitfield._bits_
<whitequark> which is a LE bitarray
<whitequark> then implement from_* and to_* in terms of that
<marcan> right
<whitequark> then add accessors
<whitequark> accessors can be added by doing like..
<whitequark> @property
<whitequark> def accessor(self):
<whitequark> @accessor.writer
<whitequark> def accessor(self, value)
<whitequark> setattr(bitfield_cls, accessor_name, accessor)
<whitequark> probably also set __name__ on those to accessor_name
<marcan> yeah I know how to do properties
<marcan> btw I placed the order for the expanders (and some misc junk)
<whitequark> excellent
<marcan> is there a good reason why Bitfield takes a size in bytes other than bits?
<marcan> *instead of
<whitequark> not at all
<whitequark> that needs to be fixed too
<marcan> ok, I'm going to internally change it to bits then once this works mass-change everything to that
<whitequark> yep
<marcan> anyway there's no reason not to rewrite this all, right? I mean keep the interface, but the current code seems very tied to ctypes
<_whitenotifier> [whitequark/Glasgow] whitequark pushed 1 commit to master [+0/-0/±1] https://git.io/fhhvv
<marcan> and it's going to take me more time to excise ctypes than to just start from scratch :p
<whitequark> yes
<_whitenotifier> [whitequark/Glasgow] whitequark f7e0ee0 - applet.interface.jtag_probe: special-case IR segmentation with 1 TAP.
<whitequark> i meant keep the interface, yeah
<whitequark> and tests
<marcan> of course
<marcan> and add some tests
<_whitenotifier> [Glasgow] whitequark commented on issue #62: Use USB type C connector - https://git.io/fhhvI
<_whitenotifier> [Glasgow] whitequark closed issue #62: Use USB type C connector - https://git.io/fpBfe
<marcan> whitequark: sorry for the hour-long detour, can't help it with that showing up on my doorstep
<whitequark> yeah i get it
<_whitenotifier> [whitequark/Glasgow] whitequark pushed 3 commits to master [+0/-0/±3] https://git.io/fhhfz
<_whitenotifier> [whitequark/Glasgow] whitequark 9030521 - applet.interface.i2c_master: use argparse subparsers.
<_whitenotifier> [whitequark/Glasgow] whitequark 2698dfd - applet.memory.25x: remove default for ADDRESS and LENGTH arguments.
<_whitenotifier> [whitequark/Glasgow] whitequark f6279ac - applet.memory.24x: use argparse subparsers.
<whitequark> i am very distractable myself, can't blame others for that
<whitequark> just fixed some really old code in the i2c applet
<whitequark> i2c applet was one of the first ones i wrote
<_whitenotifier> [Glasgow] marcan commented on issue #107: Consider connecting level shifter EN to DAC EN - https://git.io/fhhfa
<_whitenotifier> [Glasgow] marcan assigned issue #107: Consider connecting level shifter EN to DAC EN - https://git.io/fhAsc
<_whitenotifier> [Glasgow] marcan assigned issue #106: Pulls on revC0 are BROKEN and I²C level shifters require replacement - https://git.io/fhAsn
<_whitenotifier> [Glasgow] marcan commented on issue #106: Pulls on revC0 are BROKEN and I²C level shifters require replacement - https://git.io/fhhfV
<_whitenotifier> [Glasgow] marcan assigned issue #105: PCA6408 - https://git.io/fhA3A
<whitequark> oops
<whitequark> i just clipped an I2C EEPROM backwards
<whitequark> my finger hurts :(
<_whitenotifier> [Glasgow] marcan assigned issue #98: Export production files for revC0 - https://git.io/fhH6s
<marcan> oops.
<whitequark> the EEPROM doens't seem to mind though, it still works.
<_whitenotifier> [Glasgow] marcan commented on issue #85: TCA9517 - https://git.io/fhhfo
<_whitenotifier> [Glasgow] marcan assigned issue #84: ATECC508A - https://git.io/fpwo6
<marcan> well if it was current limited, you probably just gave all the protection diodes some exercise
<_whitenotifier> [Glasgow] whitequark commented on issue #85: TCA9517 - https://git.io/fhhf6
<whitequark> yep
<whitequark> but i mean it got quite toasty.
<whitequark> because i actually burned my finger.
<marcan> as long as it didn't go above soldering temperature... :)
<whitequark> lol true
<_whitenotifier> [Glasgow] marcan assigned issue #85: TCA9517 - https://git.io/fpwKf
<_whitenotifier> [whitequark/Glasgow] whitequark pushed 1 commit to master [+0/-0/±1] https://git.io/fhhfd
<_whitenotifier> [whitequark/Glasgow] whitequark a5cbd1a - applet.memory.24x: explain page sizes.
Jasjar has joined #glasgow
<_whitenotifier> [Glasgow] marcan created branch new-bitarray - https://git.io/fp4Wh
<_whitenotifier> [whitequark/Glasgow] marcan pushed 1 commit to new-bitarray [+0/-0/±1] https://git.io/fhhUi
<_whitenotifier> [whitequark/Glasgow] marcan 671eb95 - support.bits: rewrite Bitfield around bitarray instead of ctypes
<_whitenotifier> [Glasgow] marcan opened pull request #110: support.bits: rewrite Bitfield around bitarray instead of ctypes - https://git.io/fhhUX
<marcan> whitequark: ^^ for review
<marcan> note that Bitfield() still takes a byte count and immediately multiplies by 8; once this is in I'll just push a commit to remove that and fix all callers
<_whitenotifier> [whitequark/Glasgow] marcan pushed 1 commit to master [+0/-0/±1] https://git.io/fhhTY
<_whitenotifier> [whitequark/Glasgow] marcan b209775 - revC1: fix ugliness in user LED schematic section
cyrillu[m] has joined #glasgow
<marcan> TypeError: __init__() got an unexpected keyword argument 'required'
<marcan> whitequark: I'm guessing you used a python3.7-ism?
<marcan> yeah, not in 3.7
<marcan> *3.6
<_whitenotifier> [Glasgow] rvolgers opened pull request #111: BMP280 datasheet url changed - https://git.io/fhhLn
<_whitenotifier> [Glasgow] marcan commented on pull request #111: BMP280 datasheet url changed - https://git.io/fhhL6
<marcan> whitequark: btw, the vga termina fails on revC, something about the PLL
<marcan> +l
<_whitenotifier> [whitequark/Glasgow] marcan pushed 2 commits to new-bitarray [+0/-0/±10] https://git.io/fhhYu
<_whitenotifier> [whitequark/Glasgow] marcan 0f25724 - support.bits: rewrite Bitfield around bitarray instead of ctypes
<_whitenotifier> [whitequark/Glasgow] marcan 19fdbde - support.bits: specify total Bitfield width in bits & fix all callsites
<_whitenotifier> [Glasgow] marcan synchronize pull request #110: support.bits: rewrite Bitfield around bitarray instead of ctypes - https://git.io/fhhUX
<whitequark> marcan: i woke up
<marcan> whitequark: needs something like https://mrcn.st/p/oycMN9Iz (plus code to do the same thing manually) unless you want to require python 3.7
<marcan> (I'm on 3.6 right now)
<_whitenotifier> [Glasgow] whitequark commented on pull request #111: BMP280 datasheet url changed - https://git.io/fhhYr
<_whitenotifier> [Glasgow] whitequark commented on pull request #111: BMP280 datasheet url changed - https://git.io/fhhYK
<_whitenotifier> [whitequark/Glasgow] marcan pushed 1 commit to new-bitarray [+0/-0/±1] https://git.io/fhhY6
<_whitenotifier> [whitequark/Glasgow] marcan df28aa5 - support.bits: add len() support for Bitfield (returns total bit width)
<_whitenotifier> [Glasgow] marcan synchronize pull request #110: support.bits: rewrite Bitfield around bitarray instead of ctypes - https://git.io/fhhUX
<whitequark> marcan: that's a very obnoxious issue with argparse
<whitequark> it used to be provided via pip but not since 3.4
<whitequark> I guess let's add a TODO(3.7), maybe...
<whitequark> it's not *critical*
<marcan> should I just apply that patch?
<whitequark> not as is
<whitequark> we have, like, a lot of add_subparsers
<whitequark> and most of these should have required=True
<whitequark> probably all, really
<marcan> wanna take a look at that? I can't run the tool without this fixed :p
<marcan> (currently working on the cpld stuff)
<whitequark> yes, doing it
<marcan> kk
<whitequark> hm, i guess not all
<_whitenotifier> [whitequark/Glasgow] whitequark pushed 1 commit to master [+0/-0/±11] https://git.io/fhhOJ
<_whitenotifier> [whitequark/Glasgow] whitequark af0df17 - applet: sort out required=True in add_subparsers().
<_whitenotifier> [whitequark/Glasgow] marcan pushed 3 commits to new-bitarray [+0/-0/±11] https://git.io/fhhOq
<_whitenotifier> [whitequark/Glasgow] marcan 7444bc7 - support.bits: rewrite Bitfield around bitarray instead of ctypes
<_whitenotifier> [whitequark/Glasgow] marcan d5e57a2 - support.bits: specify total Bitfield width in bits & fix all callsites
<_whitenotifier> [whitequark/Glasgow] marcan ce028fc - support.bits: add len() support for Bitfield (returns total bit width)
<_whitenotifier> [Glasgow] marcan synchronize pull request #110: support.bits: rewrite Bitfield around bitarray instead of ctypes - https://git.io/fhhUX
<whitequark> marcan: two empty lines between definitions, not one
<whitequark> see pep8
<whitequark> and like literally every other file
<_whitenotifier> [whitequark/Glasgow] marcan pushed 3 commits to new-bitarray [+0/-0/±11] https://git.io/fhhOC
<_whitenotifier> [whitequark/Glasgow] marcan d146315 - support.bits: rewrite Bitfield around bitarray instead of ctypes
<marcan> whitequark: fixed
<_whitenotifier> [whitequark/Glasgow] marcan ed58810 - support.bits: specify total Bitfield width in bits & fix all callsites
<_whitenotifier> [whitequark/Glasgow] marcan 6e74852 - support.bits: add len() support for Bitfield (returns total bit width)
<_whitenotifier> [Glasgow] marcan synchronize pull request #110: support.bits: rewrite Bitfield around bitarray instead of ctypes - https://git.io/fhhUX
<whitequark> thanks. the rest looks good, i'm doing a second pass right now
<marcan> there was a bugfix that went in there, possibly after your first pass
<marcan> and a test to catch it
<whitequark> i trust you to get the implementation right, i'm only really looking at the interface
<whitequark> i'm also frankly much too sick to notice anything about the implementation nayway
<marcan> well I mean if it breaks it breaks, but it passes the tests at least; if something else is broken it needs more tests :-)
<marcan> I trust that you or someone else will eventually test the affected applets and shout if this breaks something
<whitequark> yeah of course
<marcan> I did some cursory review of what structures should have bytes*8 and what structures should remove some padding
<marcan> because the new class is strict about from_bitarray etc having *exactly* the right number of bits
<marcan> which the old one wasn't
<whitequark> that's good
<_whitenotifier> [Glasgow] whitequark reviewed pull request #110 commit - https://git.io/fhhOB
<marcan> I'm still using it for the xc95xx btw
<marcan> just defining those bitfields dynamically
<marcan> (the ones that are variable)
<whitequark> yeah, that's fine
<whitequark> you could go to arch/ and change DR_whatever to be a function
<whitequark> that's what i would do
<marcan> that's exactly what I did
<whitequark> excellent
<marcan> that's backwards, you broke it :p
<whitequark> oh fuck
<_whitenotifier> [whitequark/Glasgow] whitequark pushed 1 commit to master [+0/-0/±11] https://git.io/fhhOa
<_whitenotifier> [whitequark/Glasgow] whitequark 257197e - applet: sort out required=True in add_subparsers().
<marcan> the len() thing seems broken, let me go over that; feel free to ignore that commit for now
<marcan> looks like __len__ doesn't work as a classmethod, something something metaclass
<marcan> whitequark: any opinions on the interface for getting the width of a Bitfield?
<marcan> len() works for instances only, unless I use a metaclass, which I could but it feels like a big hammer
<whitequark> you could define a metaclass
<marcan> sure
<marcan> if you think that's acceptable (wasn't sure if worth it)
<whitequark> wait, no
<whitequark> that violates a contract
<whitequark> __len__ implies that it's an iterable
<marcan> heh, really
<whitequark> def bit_length(cls) i guess
<whitequark> yes
<marcan> define it as a method then?
<whitequark> if you define __len__ and __index__ (i think) your class becomes an iterable
<marcan> should really be just a property imo
<whitequark> nmigen signals accidentally became iterables like that
<whitequark> (but it's good in that case)
<whitequark> sure, a property is good
<marcan> might need a metaclass to make it work on the class
<whitequark> no
<whitequark> @classmethod @property works
<whitequark> since uh... 3.5 or something?
<whitequark> or maybe @property @classmethod
<whitequark> it's used somewhere in our codebase already
<whitequark> and it's defined to work
<whitequark> wait
<marcan> doesn't seem to work for me
<marcan> self.assertEqual(bf.bit_length, 10)
<marcan> AssertionError: <bound method ? of <class 'glasgow.support.bits.bf'>> != 10
<whitequark> that was for @abstractmethod
<marcan> self.assertEqual(bf.bit_length, 10)
<marcan> AssertionError: <property object at 0x7f9a127712c8> != 10
<marcan> either order
<whitequark> so they did *not* fix it for @classmethod
<whitequark> fucking garbage language
<whitequark> sure
<marcan> lol
<whitequark> i would go with a regular class method then i guess
<marcan> metaclass?
<marcan> heh ok
<whitequark> just because well
<whitequark> someone's going to try and understand it
<marcan> yeah
<whitequark> and this is even worse than len on metaclass
<marcan> also lol I think this cpld is probably read protected (I assume that's a thing)
<marcan> since I was selling them :D
<whitequark> it might be a thing, i'm not entirely sure
<marcan> yeah it is a thing
<marcan> I get mostly 3f3f when reading
<marcan> with some 7f near the top
<marcan> loop length is 1620 so that is correct
<whitequark> 1620 is for 72XL
<whitequark> oh hm
<marcan> 1620 is for everything
<marcan> this is w=16
<whitequark> oh right
<whitequark> fucking xilinx
<_whitenotifier> [whitequark/Glasgow] whitequark pushed 1 commit to master [+0/-0/±1] https://git.io/fhhO9
<_whitenotifier> [whitequark/Glasgow] rvolgers 934a0bb - BMP280 datasheet url changed (#111)
<_whitenotifier> [Glasgow] whitequark closed pull request #111: BMP280 datasheet url changed - https://git.io/fhhLn
<_whitenotifier> [whitequark/Glasgow] whitequark pushed 1 commit to master [+0/-0/±1] https://git.io/fhhOQ
<_whitenotifier> [whitequark/Glasgow] rvolgers 5ae5dcd - applet.sensor.bmp280: update BMP280 datasheet URL.
<_whitenotifier> [Glasgow] whitequark reviewed pull request #110 commit - https://git.io/fhhOd
<_whitenotifier> [Glasgow] whitequark reviewed pull request #110 commit - https://git.io/fhhOF
<_whitenotifier> [Glasgow] whitequark reviewed pull request #110 commit - https://git.io/fhhOb
<_whitenotifier> [Glasgow] whitequark reviewed pull request #110 commit - https://git.io/fhhON
<_whitenotifier> [Glasgow] whitequark reviewed pull request #110 commit - https://git.io/fhhOA
<_whitenotifier> [Glasgow] Error. The Travis CI build could not complete due to an error - https://travis-ci.org/whitequark/Glasgow/builds/503707158?utm_source=github_status&utm_medium=notification
<_whitenotifier> [whitequark/Glasgow] marcan pushed 3 commits to new-bitarray [+0/-0/±11] https://git.io/fhhOx
<_whitenotifier> [whitequark/Glasgow] marcan af9db2b - support.bits: rewrite Bitfield around bitarray instead of ctypes
<_whitenotifier> [whitequark/Glasgow] marcan adcfcc0 - support.bits: specify total Bitfield width in bits & fix all callsites
<_whitenotifier> [whitequark/Glasgow] marcan 1bd3bbc - support.bits: add bit_length() method to Bitfield
<_whitenotifier> [Glasgow] marcan synchronize pull request #110: support.bits: rewrite Bitfield around bitarray instead of ctypes - https://git.io/fhhUX
<marcan> whitequark: are we allowing negative numbers or just forbidding them entirely?
<marcan> I think forbidding makes more sense, rare case of 2s-complement field can be manually masked
<marcan> (or we add explicit typing)
<whitequark> forbid them
<whitequark> we can always allow them later
<whitequark> add a comment to that extent, I think
<marcan> yeah
<marcan> also, endianness matters for incoming bitarrays
<marcan> because copying a bitarray copies the *raw bytes*
<marcan> hence the assert
<whitequark> oh!
<whitequark> cool, thanks
<marcan> >>> bitarray(bitarray("1110001", "little"), "big")
<marcan> bitarray('0100011')
<marcan> like this is all kinds of horrible
<marcan> lol
<marcan> but yeah
<marcan> I'm leaving that as an assert because if you're feeding it the wrong endianness, meh
<marcan> I'm changing the width asserts to exceptions
<marcan> does not matter for field assignment since that does convert
<whitequark> ack
<marcan> whitequark: re [:] = 0, that's documented, you can set any bitrange to a scalar bit
<marcan> but sure, setall
<whitequark> ah if it's documented then ok
<_whitenotifier> [GitHub] Speak like a human.
<_whitenotifier> [whitequark/Glasgow-Archive] whitequark pushed 1 commit to master [+1/-0/±0] https://git.io/fhh38
<_whitenotifier> [whitequark/Glasgow-Archive] whitequark e184cfb - Initial commit.
<marcan> whitequark: mind if I squash the commit with all the callers? it's getting annoying to apply the fixes and keep that sane (since I added a bunch of tests that depend on exact widths)
<whitequark> sure
<marcan> actually splitting them makes no sense since we're now requiring complete definitions with no padding
<marcan> whitequark: everything should be fixed, and I added a testcase for all the exceptions
<marcan> (which caught a bunch of problems with those, lol)
<marcan> (yay for tests)
<marcan> er, actually pushing now
<_whitenotifier> [whitequark/Glasgow] marcan pushed 1 commit to new-bitarray [+0/-0/±9] https://git.io/fhh32
<_whitenotifier> [whitequark/Glasgow] marcan cb19a84 - support.bits: rewrite Bitfield around bitarray instead of ctypes
<_whitenotifier> [Glasgow] marcan synchronize pull request #110: support.bits: rewrite Bitfield around bitarray instead of ctypes - https://git.io/fhhUX
<marcan> er, and now some stuff is broken, heh
<marcan> due to the stricter bitfield
<_whitenotifier> [whitequark/Glasgow] marcan pushed 1 commit to new-bitarray [+0/-0/±3] https://git.io/fhh3o
<_whitenotifier> [whitequark/Glasgow] marcan bcbaf54 - arch.arc,mips: add explicit padding fields to structures
<marcan> added those fixes as a separate commit
<_whitenotifier> [Glasgow] marcan synchronize pull request #110: support.bits: rewrite Bitfield around bitarray instead of ctypes - https://git.io/fhhUX
<marcan> whitequark: the usercode for 36 looks ok, in fact those are the only bits that I *can* read
<marcan> which makes sense
<marcan> well that and 32
<marcan> which might be the protection flag?
<marcan> I: g.applet.program.xc9500xl: USERCODE=6e69616d (niam)
<marcan> filename was 'main', so that makes sense
<marcan> ... and I'll byteswap it
uberushaximus has joined #glasgow
<_whitenotifier> [whitequark/Glasgow-Archive] whitequark pushed 2 commits to master [+29/-0/±0] https://git.io/fhhsq
<_whitenotifier> [whitequark/Glasgow-Archive] whitequark 224937c - Initial commit.
<_whitenotifier> [whitequark/Glasgow-Archive] whitequark 5456005 - G00001..G00028
<_whitenotifier> [whitequark/Glasgow] whitequark pushed 1 commit to master [+1/-0/±23] https://git.io/fhhsm
<_whitenotifier> [whitequark/Glasgow] whitequark 2bcd06a - Permanently archive all referenced documentation.
<_whitenotifier> [Glasgow] Error. The Travis CI build could not complete due to an error - https://travis-ci.org/whitequark/Glasgow/builds/503728619?utm_source=github_status&utm_medium=notification
<marcan> whitequark: JED parser should go under protocol, right?
<_whitenotifier> [whitequark/Glasgow] whitequark pushed 1 commit to master [+1/-0/±23] https://git.io/fhhsZ
<whitequark> marcan: yes
<_whitenotifier> [whitequark/Glasgow] whitequark f44967b - Permanently archive all referenced documentation.
<_whitenotifier> [Glasgow] whitequark commented on pull request #111: BMP280 datasheet url changed - https://git.io/fhhsc
ali_as has quit [Remote host closed the connection]
ali_as has joined #glasgow
TimRTerrible has joined #glasgow
<_whitenotifier> [GlasgowEmbedded/Glasgow] whitequark pushed 1 commit to master [+0/-0/±3] https://git.io/fhhsB
<_whitenotifier> [GlasgowEmbedded/Glasgow] whitequark 4914571 - Update repository paths after migrating to a GitHub organization.
<_whitenotifier> [GlasgowEmbedded/Glasgow] whitequark pushed 1 commit to master [+0/-0/±1] https://git.io/fhhsV
<_whitenotifier> [GlasgowEmbedded/Glasgow] whitequark 51a33da - Update CONTRIBUTING to require uploads to Glasgow Archive.
<marcan> lol the JED spec has a bug
<marcan> it says "16-bit sum (i.e. modulo 65,535)"
<marcan> pretty sure that should be modulo 65536
<whitequark> if i had a drink each time a spec has a bug...
<_whitenotifier> [GlasgowEmbedded/Glasgow] whitequark pushed 1 commit to master [+0/-0/±1] https://git.io/fhhsM
<_whitenotifier> [GlasgowEmbedded/Glasgow] whitequark 3792701 - Update CONTRIBUTING to require uploads to Glasgow Archive.
<marcan> whitequark: aaaand xilinx is already violating the spec
<marcan> first field has no ID and should be the design spec (free text), xilinx has no such field
<_whitenotifier> [GlasgowEmbedded/Glasgow-Archive] whitequark pushed 1 commit to master [+2/-2/±0] https://git.io/fhhGv
<_whitenotifier> [GlasgowEmbedded/Glasgow-Archive] whitequark 6d362b1 - G00025→G00024A, G00026→G00024B
<_whitenotifier> [GlasgowEmbedded/Glasgow] whitequark pushed 1 commit to master [+0/-0/±2] https://git.io/fhhGf
<_whitenotifier> [GlasgowEmbedded/Glasgow] whitequark ba3e330 - protocol.sfdp: update references.
<_whitenotifier> [GlasgowEmbedded/Glasgow-Archive] whitequark pushed 1 commit to master [+2/-0/±0] https://git.io/fhhGT
<_whitenotifier> [GlasgowEmbedded/Glasgow-Archive] whitequark cd3d9ba - Keep things sequential.
<marcan> whitequark: is the bitfield stuff mergeable?
<whitequark> i am currently manually editing it
<whitequark> there's quite a few things i want to see changed, mostly related to error handling
<_whitenotifier> [GlasgowEmbedded/Glasgow] whitequark pushed 2 commits to master [+0/-0/±12] https://git.io/fhhGN
<_whitenotifier> [GlasgowEmbedded/Glasgow] marcan 7c4be81 - support.bits: rewrite Bitfield around bitarray instead of ctypes.
<_whitenotifier> [GlasgowEmbedded/Glasgow] marcan 1822414 - arch.{arc,mips}: add explicit trailing padding fields to structures.
<_whitenotifier> [Glasgow] whitequark commented on pull request #110: support.bits: rewrite Bitfield around bitarray instead of ctypes - https://git.io/fhhGA
<_whitenotifier> [Glasgow] whitequark closed pull request #110: support.bits: rewrite Bitfield around bitarray instead of ctypes - https://git.io/fhhGx
<_whitenotifier> [GlasgowEmbedded/Glasgow] whitequark deleted branch new-bitarray
<_whitenotifier> [Glasgow] whitequark deleted branch new-bitarray - https://git.io/fhhGp
<whitequark> marcan: merged, thanks!
<whitequark> let's see if ejtag still works
<whitequark> nnnnnope
<whitequark> does now
<_whitenotifier> [GlasgowEmbedded/Glasgow] whitequark pushed 1 commit to master [+0/-0/±1] https://git.io/fhhZv
<_whitenotifier> [GlasgowEmbedded/Glasgow] whitequark a6b3a6c - support.bits: fix typo.
<marcan> whitequark: boo, you didn't add a test for that :p
whitequark changed the topic of #glasgow to: glasgow debug tool · code https://github.com/GlasgowEmbedded/Glasgow · logs https://freenode.irclog.whitequark.org/glasgow
<marcan> so apparently I write-protected these CPLDs
<marcan> ... which can be overriden with some magic JTAG sequence
<whitequark> what.
<marcan> I guess I need to figure out what that is
<whitequark> like for readout?
<whitequark> or erase?
<marcan> erase
<whitequark> IR_FERASE?
<marcan> maybe?
<whitequark> probably FBULK or FBLANK, realistically
<whitequark> what does the svf file look like?
<marcan> FBULK is the normal bulk
<marcan> I don't have an svf, let me see if I can make one
<whitequark> does fbulk not work for you?
<marcan> no, because of the write protect
<whitequark> huh
<marcan> I know it's write protected because I found my old iMPACT batchfile
<marcan> looks like it's ferase;fbulk
<marcan> and ferase takes a magic number
<marcan> SDR 18 TDI (02a957) SMASK (03ffff) ;
<marcan> aa55, lol
<whitequark> lol ok
<marcan> whitequark: jed parsing works, flashed it from a jed converted to bit and it passes funtional testing
<whitequark> :D
<marcan> whitequark: can I get write perms to glasgow-archive?
<marcan> oh, you did
<marcan> oh, you didn't
<marcan> ERROR: Permission to GlasgowEmbedded/Glasgow-Archive.git denied to marcan.
<marcan> whitequark: ^^
<_whitenotifier> [Glasgow] marcan created branch xc9500xl-improvements - https://git.io/fhhGp
<_whitenotifier> [GlasgowEmbedded/Glasgow] marcan pushed 2 commits to xc9500xl-improvements [+1/-0/±3] https://git.io/fhhZh
<_whitenotifier> [GlasgowEmbedded/Glasgow] marcan 88b7914 - protocol.jed: add JED file parser
<_whitenotifier> [GlasgowEmbedded/Glasgow] marcan 6ba2872 - applet.program.xc9500xl: refator, xc9536xl support, JED file support
<_whitenotifier> [GlasgowEmbedded/Glasgow] marcan pushed 2 commits to xc9500xl-improvements [+1/-0/±4] https://git.io/fhhnU
<_whitenotifier> [GlasgowEmbedded/Glasgow] marcan b13e914 - protocol.jed: add JED file parser
<_whitenotifier> [GlasgowEmbedded/Glasgow] marcan 148f5fd - applet.program.xc9500xl: refator, xc9536xl support, JED file support
<_whitenotifier> [Glasgow] Error. The Travis CI build could not complete due to an error - https://travis-ci.org/GlasgowEmbedded/Glasgow/builds/503776720?utm_source=github_status&utm_medium=notification
<_whitenotifier> [Glasgow] marcan opened pull request #112: cc9500xl improvements - https://git.io/fhhnT
<marcan> whitequark: I desperately need sleep, but have a PR. Will push doc when I have write perms (or feel free to push yourself and fix the submodule commitref)
<_whitenotifier> [Glasgow] Error. The Travis CI build could not complete due to an error - https://travis-ci.org/GlasgowEmbedded/Glasgow/builds/503777575?utm_source=github_status&utm_medium=notification
<_whitenotifier> [Glasgow] Error. The Travis CI build could not complete due to an error - https://travis-ci.org/GlasgowEmbedded/Glasgow/builds/503777211?utm_source=github_status&utm_medium=notification
<marcan> whitequark: fun fact: I totally bullshitted the endianness stuff, but upon first attempt at importing a jed file I realized (diffing against the usercode stuff I did have) I got it right by accident, so.
<marcan> oh btw, unwinding: I haven't seen any failures yet on revC, blame the FXMAs?
<whitequark> marcan: hrm
<whitequark> github permissions strike again
<whitequark> ok let me do something uhh
<whitequark> I think I fixed it
<whitequark> marcan: ^
<marcan> ok
<_whitenotifier> [GlasgowEmbedded/Glasgow-Archive] marcan pushed 1 commit to master [+1/-0/±0] https://git.io/fhhnr
<_whitenotifier> [GlasgowEmbedded/Glasgow-Archive] marcan ad94922 - G00029: Add JESD3-C
<marcan> rebased and fixed the ref
<_whitenotifier> [GlasgowEmbedded/Glasgow] marcan pushed 1 commit to xc9500xl-improvements [+0/-0/±4] https://git.io/fhhno
<_whitenotifier> [GlasgowEmbedded/Glasgow] marcan 9f14639 - applet.program.xc9500xl: refator, xc9536xl support, JED file support
<_whitenotifier> [Glasgow] marcan synchronize pull request #112: xc9500xl improvements - https://git.io/fhhnT
<marcan> derp
<marcan> sec
<marcan> better
<_whitenotifier> [GlasgowEmbedded/Glasgow] marcan pushed 2 commits to xc9500xl-improvements [+1/-0/±4] https://git.io/fhhnP
<_whitenotifier> [GlasgowEmbedded/Glasgow] marcan c917c50 - protocol.jed: add JED file parser
<_whitenotifier> [GlasgowEmbedded/Glasgow] marcan 7711063 - applet.program.xc9500xl: refator, xc9536xl support, JED file support
<_whitenotifier> [Glasgow] marcan synchronize pull request #112: xc9500xl improvements - https://git.io/fhhnT
<marcan> whitequark: okay, really going to sleep now
<whitequark> marcan: okay, I'm going to read JESD3C again
<whitequark> and merge your parser, it looks good generally, some nits
<_whitenotifier> [GlasgowEmbedded/Glasgow] marcan pushed 1 commit to xc9500xl-improvements [+0/-0/±3] https://git.io/fhhny
<_whitenotifier> [GlasgowEmbedded/Glasgow] marcan 05d71b9 - applet.program.xc9500xl: refactor, xc9536xl support, JED file support
<_whitenotifier> [Glasgow] marcan synchronize pull request #112: xc9500xl improvements - https://git.io/fhhnT
<marcan> nn!
<_whitenotifier> [GlasgowEmbedded/Glasgow] whitequark pushed 1 commit to master [+0/-0/±1] https://git.io/fhhnp
<_whitenotifier> [GlasgowEmbedded/Glasgow] whitequark 08d1f88 - README: add a note on revC0 issues.
ali_as has quit [Remote host closed the connection]
ali-as has joined #glasgow
<Jasjar> That's a lot of commits...