[HN Gopher] Show HN: I made an Ethernet transceiver from logic g...
___________________________________________________________________
Show HN: I made an Ethernet transceiver from logic gates
Author : ynoxinul
Score : 413 points
Date : 2022-12-18 07:00 UTC (16 hours ago)
(HTM) web link (imihajlov.tk)
(TXT) w3m dump (imihajlov.tk)
| amelius wrote:
| From Wikipedia:
|
| > Manchester code was used in early Ethernet physical layer
| standards
|
| So, not in later standards?
| detaro wrote:
| Later standards use more efficient codes that map longer
| symbols to DC-free codes, and thus are more bandwidth-
| efficient. (8b/10b, 64b/66b codes, where manchester is
| basically a 1b/2b code)
| Aromasin wrote:
| Interesting timing for this post - I'm studying this for a
| new job at the moment and building myself my own little
| Wikipedia in order to learn it. 10BASE uses Manchester
| Encoding, 100BASE uses Non-Return-to-Zero, Invert-on-one
| (NRZI) encoding and Multiple Level Transition (MLT-3) with
| 4B5B translation, 1000BASE uses 8b/10b Encoding (8 bits for
| data, 2 for ECC).
|
| More recent speeds all tend to use PAM4 encoding, meaning
| there's 4 voltage levels instead of 2! There's a great
| article on it here:
| https://blog.samtec.com/post/understanding-nrz-and-
| pam4-sign...
| testermelon wrote:
| This is sick. I also read their post about the making a discrete
| computer and didn't expect them to be also writing a compiler
| from scratch. Something I've only been dreaming about.
| bjt2n3904 wrote:
| Oh wow.
|
| I had thought this was, "I simulated it in a high level HDL and
| synthesized it to gates".
|
| No, this is... I built it with physical chips. Brilliant build
| and write-up!
|
| Edit: This is beautiful for a second reason... The lack of regard
| for doing things "correctly". The ugly clock circuit is
| horrifically unreliable... But just reliable enough for it to
| still work.
|
| It reminds me of Muntzing.
|
| https://en.wikipedia.org/wiki/Muntzing
| Evidlo wrote:
| A mistake: you refer to C9 in the monostable section, but it
| should be C5
| exmadscientist wrote:
| Another mistake that doesn't deserve a top-level comment: the
| unit abbreviation for "second" is "s", not "S" (that one's the
| siemens = inverse ohm = former mho, which was a way better unit
| than the siemens, but that's another discussion...). Thus, "ms"
| and "ns" rather than "mS" and "nS". This may sound incredibly
| pedantic, and it is, but it's also one of the tests for
| attention to detail that I use when interviewing and evaluating
| an EE candidate, so, y'know, maybe worth learning to get right.
| Or not, life's short and building stuff out of discretes is
| more fun. Your call!
| ynoxinul wrote:
| Thank you, fixed.
| unwind wrote:
| Hadn't heard of "mho" for conductivity, is that from when
| Bourne worked with electronics? :)
|
| I would oppose a unit that starts with a prefix symbol
| (m=milli=0.001) on principle.
| pwg wrote:
| Wikipedia dates the mho to 1883 and Lord Kelvin:
|
| https://en.wikipedia.org/wiki/Mho#Mho
| exmadscientist wrote:
| > I would oppose a unit that starts with a prefix symbol
| (m=milli=0.001) on principle.
|
| The unit name isn't usually important. I think you're
| talking about the symbol? That's "", which has its own
| problems. But at least it's in Unicode now! Altogether I
| think the "" caused much less trouble than the "S" has. "S"
| is just stupid... as evidenced by this whole subthread.
| And, yes, I have read datasheets wrong because of this.
| Thanks, 14th CGPM!
| [deleted]
| [deleted]
| ynoxinul wrote:
| Thanks, fixed it.
| mikewarot wrote:
| So all I need are link pulses to fake the other end of an
| Ethernet connection to keep it alive?
|
| This makes building a data diode much simpler than I thought it
| needed to be. Thanks!
| ynoxinul wrote:
| Yes, but this is only the case with 10BASE-T. Modern standards
| use more complicated Fast Link Pulses.
| kevin_thibedeau wrote:
| Also applies to 100Base-T which is still a usable solution
| for basic networking.
| alexnewman wrote:
| classic hackernews. We need more of these
| userbinator wrote:
| _However, some hardware I have sometimes produced longer
| preambles_
|
| How long were they, and did they happen to coincide with short
| frames? It's been a _long_ time since I 've worked with 10M
| Ethernet PHY but I vaguely remember some non-standard
| implementations would lengthen the preamble instead of padding
| the "tail" of the frame.
| ynoxinul wrote:
| The preambles were longer by a few bits (even less than 8). I
| didn't check which frames excatly caused this, but it happened
| only with one old 10 MBit switch.
| mgsouth wrote:
| Cool! Have you submitted to Hackaday?
| bogomipz wrote:
| Wow, this is fantastic! I had a couple of questions. The author
| states:
|
| >"According to the 10BASE-T spec, each frame starts with a fixed
| synchronization sequence of 64 bits, first 62 of which are
| alternating ones and zeroes and the last two are ones."
|
| I believe the intention of the "preamble" is to provide clocking
| and synchronization for the circuit so that it knows where to
| find the start frame delimiter and subsequent fields. Is that
| correct?
|
| My other question is at what point does the circuit drop frames
| that are not intended for it? Does that happen in layer 1 or
| layer 2? I realize this happens less in modern switched Ethernet
| networks but it is still possible for a host to get an Ethernet
| frame for where the destination MAC address does not match any of
| those burned-in addresses on the Ethernet adapter. Does the
| transceiver always read the entire Ethernet frame even when the
| destination MAC address field it reads is incorrect? The maximum
| Ethernet frame size is 1518 bytes which seems like a lot of data
| read if the MAC address is not valid for the host.
| ynoxinul wrote:
| The preamble is intended for synchronization, the last two
| consequtive ones indicate the start of the data.
|
| My circuit doesn't drop any frames, it simply converts serial
| Ethernet signal to SPI. FCS and MAC checking is done in
| software after receiving the whole frame.
|
| You absolutely can get frames not addressed to you. Wireshark
| lets you do that. I debugged my adapter this way: I connected
| it to a dumb switch together with my computer and ran Wireshark
| on the computer which captured all frames regardless of their
| intended destination. On Linux you can even disable FCS
| checking and receive all rubbish from the wire.
| bogomipz wrote:
| Thanks, I had another question after a second reading of your
| post:
|
| >"The first bit of an Ethernet frame is always one, which
| means there might or might not be an extra edge in the
| beginning depending on the idle state of the amplifier. This
| extra edge, if it comes, needs to be filtered out."
|
| Practically speaking what is the cause of the "extra" edge
| here? Would it be that the last bit of the FCS from the
| previous frame caused it to be a 1 and then the transceiver
| is immediately getting another edge from a preamble on a new
| Ethernet frame? Or am I confusing bits and edges?
| ynoxinul wrote:
| A manchester-encoded bit 1 is a low-to-high transition:
| there should be "low" on the line which will change to
| "high". Before the "low" the line was idle (zero voltage
| difference), this state is interpreted by the differential
| amplifier as "high", so it's "high-low-high" at the
| beginning, but we are interested in the "low-high" edge and
| not in the "high-low" one.
| zamadatix wrote:
| Imagine you had 2 transceivers you wanted to bridge - if the
| transceiver dropped all unicast MACs but its own
| indiscriminately then it would not function properly. There is
| also a litany of other features that would not want this kind
| of offload always running (general MAC spoofing, packet
| capturing for debug/troubleshooting purposes, VMs, some IP
| redundancy protocols that keep the virtual IP's MAC consistent
| after failover, and the like).
|
| Offloads such as this or other more advanced ones are
| implemented as optional hardware features (if at all)
| controlled by upstream signaling. This is usually a driver
| signaling things over a PCIe bus on modern systems but it can
| be anything including just "upstream logic gates". That way if
| it's a normal client-only PC not running e.g. Wireshark or VMs
| the CPU doesn't have to be interrupted for the types of traffic
| you mention but the other use cases can still work too.
| bogomipz wrote:
| Thanks, that makes perfect sense about things like VRRP and
| proxy arp, indeed they wouldn't work if the transceiver
| filtered on the destination MAC field of the Ethernet frame.
| I'm guessing this is exactly why this stuff is handled at L2
| and in the kernel module for the NIC? I didn't understand
| your first example though:
|
| >"Imagine you had 2 transceivers you wanted to bridge - if
| the transceiver dropped all unicast MACs but its own
| indiscriminately then it would not function properly"
|
| I'm not understanding why bridging makes a difference. In the
| case of a bridge a host would send out a broadcast i.e a
| frame with destination MAC ff:ff:ff:ff:ff:ff which is valid
| for all Ethernet adapters, this is similar whether it's a
| switched or bridge network no? Maybe I'm missing something
| obvious?
|
| >"Offloads such as this or other more advanced ones are
| implemented as optional hardware features (if at all)
| controlled by upstream signaling."
|
| Which offloads are you referring to here? Just general TCP
| offload engine stuff? How does that relate?
| birdyrooster wrote:
| I love these people bc they do all the esoteric stuff so that I
| don't have to.
| jtlienwis wrote:
| Look on Hackaday for "Why do you need to use decoupling caps". I
| am not seeing any talk of decoupling caps in any of this persons
| writeups. Maybe they are there and I am just not seeing them. It
| used to be when designing with LS ttl you needed one per chip to
| make sure switching noise did not get onto your power supply
| rails. Otherwise, a great project for learning.
| bogantech wrote:
| The decoupling caps are there in the schematics shown alongside
| the symbols for the IC power inputs which is a common way of
| doing things.
|
| IDK why something as fundamental as decoupling caps should be
| mentioned here at all though, anyone sufficiently knowledgeable
| to make use of this information would know that they're
| required already.
| ynoxinul wrote:
| Do you think they are worth mentioning? My post isn't a
| tutorial.
| 55555 wrote:
| Wow the tech talent in Tokelau is insane!
| charcircuit wrote:
| What is the benefit of using all of these different components
| over using an FPGA?
| meltedcapacitor wrote:
| It is hardware poetry.
|
| (What is the benefit of rhymes, meter, etc over using prose?)
| ynoxinul wrote:
| It's a fun project. I feel like building stuff with logic
| gates.
| PostOnce wrote:
| It's worth your while to buy another domain. You could keep the
| .tk running.
|
| Some sites shadowban .tk, Reddit probably still does. Search
| engines probably downrank it. That's because it's free and has
| been used for a lot of spammy stuff.
|
| This makes it harder for people to share and harder for people to
| find. That might just put a damper on your hobby, but it might
| also mean you won't get random emails about jobs you might want.
| (If you're interested in that.)
|
| I only mention it because I learned that the hard way many years
| ago.
| marginalia_nu wrote:
| Yeah. Cheap TLDs are very strongly correlated with spam.
|
| Although I think .icu and .xyz are far bigger offenders than
| .tk these days.
| moffkalast wrote:
| Is it worth it though? Renewing a domain is yet another
| bottomless pit you throw money into, along with server hosting.
| For a site without ads or other revenue it's just more expense.
| actionfromafar wrote:
| Static hosting can be found free on sites like gatsby.
| moffkalast wrote:
| Ok yeah now that I think about it there are ways to host
| for free, github pages also comes to mind. Not exactly
| elegant solutions though. Makes the domain expense even
| worse in that respect.
| kfajdsl wrote:
| > Not exactly elegant solutions though.
|
| How come? I think services like GitHub pages are a great
| way to host a static site.
| moffkalast wrote:
| By large you tend to be severely limited by size and
| traffic. Github's also very slow to update changes and
| can't host private repos either.
|
| I remember using 000webhost back in the day, their free
| plan had an uptime of "maybe". It was never up when I
| actually needed it.
| layer8 wrote:
| Standard domains (com/net/org) are super cheap, around $1
| per month.
| samjmck wrote:
| imihajlov.com would cost around 10 USD per month and as
| another reply mentioned, static site hosting is free. I guess
| it's a bottomless pit but it's "only" 10 USD and it's nice to
| have.
| climb_stealth wrote:
| Surely you mean 10USD per year? If you are paying that per
| month just for the domain you are being ripped off :)
| samjmck wrote:
| Correct, I meant per year
| moffkalast wrote:
| Sure, but that would add up to $1200 in a decade of hosting
| which _is_ substantial and the timespan one 'd likely run
| it for. People buy a $1k PC every 5 years and consider it a
| large expense, why not this?
|
| I can find it for much lower though, like $8/year? Then
| again that's on namecheap who then raise rates when you go
| in to renew lol.
| OJFord wrote:
| I'm sure GP meant /year, not month. Pricing's always (as
| far as I've ever seen) per year for one thing, but also
| it's not 120 (or more) unless your name's Ford or
| something. (Damn it.)
| PostOnce wrote:
| The site is already being hosted, I was only talking
| about a domain name, so at ~$10/year or whatever it is
| now, that's only $100 a decade over whatever he is paying
| now for hosting using a free domain.
|
| That's 10 years of benefiting from a real domain name for
| the cost of... a very long list of pointless $100 goods
| and services.
|
| It's a couple of cents per day.
| Gordonjcp wrote:
| A .com domain for US$10 per *month*? That doesn't round
| right, it's not even that per year.
| TaylorAlexander wrote:
| Yeah but what if it's a cool domain? Then it's a cool
| bottomless pit.
| moffkalast wrote:
| The cooler the name, the deeper the pit.
| TaylorAlexander wrote:
| I'm very proud of my site (and the URL) reboot dot love,
| which I haven't done much with lately but I want to! Also
| yeah I need to fix my SSL cert. the server is giving me
| grief. Bottomless pit of time and money yaaay.
| 867-5309 wrote:
| SSL certs can be free and auto-renewing. set and forget
| TaylorAlexander wrote:
| Yep. Server is just having some weird issues. I'm using
| Lets Encrypt but something isn't right.
| Gordonjcp wrote:
| I need to find something to do with onlyfandans.com, even
| if it's probably only funny in Scotland.
| PostOnce wrote:
| It very well might be, if you value publicity for your hobby,
| the greater reach might be worth it to you. If you can get
| 10,000 readers instead of 90 readers because your links are
| shareable...
|
| If we think about potential dollars, though:
|
| The bottomless pit isn't very deep, it's a few dollars a
| year.
|
| If it nets you one single short-contract offer (nevermind a
| job) or worthwhile contact because someone found your work,
| it'll pay itself off many, many times over. Let's say one
| person found him and offered him a $3000 contract to do some
| electronic thing for a week, well, then the cost of the
| domain and hosting won't matter for the rest of his life.
|
| The mere fact that this guy has an oscilloscope out means he
| has skills that someone might want to contact him about in
| relation to his blog.
|
| Limiting yourself for want of a $10/year domain name is
| probably not a great idea, and again, it's something I
| learned the hard way.
| [deleted]
| teddyh wrote:
| I know of exactly one site which had a .tk TLD. Here's why they
| switched to a .com in 2005:
|
| https://tailsteak.com/archive.php?num=388
|
| " _tailsteak.com_
|
| _Alright, so I 'm finally fed up with Tokelau._
|
| _Don 't get me wrong, it's a nice island, but they just aren't
| answering my mail._
|
| _I suppose most of you have noticed, by now, the fifteen-
| second ads that present you with beautiful women and fish when
| you surf to tailsteak.tk. Those are not my ads. I do not obtain
| revenue from them. Tokelau 's domain name referral service just
| started putting them up there without so much as a by-your-
| leave. I have contacted their tech support and enquired if,
| perhaps, they might consider removing them for customers
| willing to pay a certain amount. They have not responded._
|
| _Of course, I have had access to tailsteak.com for some time
| now. So henceforth, I will be directing my viewers there. It 's
| the same site, the same host, and, in truth, the .tk address
| has been sending you there for months. But now it's official.
| Note the change in title graphic:_
|
| _tailsteak.com_ "
| verisimi wrote:
| How is this fairly nerdy piece, that no one has commented on, top
| of hn? What am I missing?
| db48x wrote:
| The very best things speak for themselves, and need no
| amplifying comments.
| [deleted]
| tintedfireglass wrote:
| the HN algorithm is a bigger mystery than the universe itself
| revskill wrote:
| No, i think most of its part is manual update database to set
| the rank of a post.
| stavros wrote:
| It's super cool.
| Myrmornis wrote:
| That it's impressive.
| greenyoda wrote:
| This is a wonderful project! I'm old enough to remember the days
| when Ethernet adapters for commercial computers were made of
| individual logic gates. The Ethernet adapter in the VAX 11/750 I
| used in the early 80's was two large Unibus boards full of TTL
| logic:
| http://gunkies.org/wiki/Digital_Ethernet_UNIBUS_Network_Adap...
| tyingq wrote:
| This blog post dives into another mostly TTL logic Ethernet
| board from the Xerox Alto:
| https://www.righto.com/2017/11/fixing-ethernet-board-from-vi...
|
| It has a nice high level diagram of what each group of TTL
| chips is doing too:
|
| https://lh3.googleusercontent.com/-DpUyda3g2Yk/WgB7G_7o54I/A...
| aswanson wrote:
| That is crazy, the amount of space a network adapter took up.
| db48x wrote:
| And there were a few more boards for the disk controller, and
| another couple for the display controller...
| greenyoda wrote:
| Not to mention all the boards that the CPUs and RAM took
| up. Here's a nice photo of the insides of a VAX 11/780 - if
| you enlarge it all the way you can see the annotations
| showing which boards do what: https://upload.wikimedia.org/
| wikipedia/commons/e/ec/SPEC-1_V...
|
| Note that those 16 huge memory boards each held 256K (
| _kilo_ bytes!) for a total of 4M of RAM.
|
| Photo with people to show size of cabinets:
| https://photovault.com/363660
| Gordonjcp wrote:
| The one that superseded that, the DELUA adaptor, was powered by
| a 68000 CPU that was generally faster than the machine hosting
| it :-D
| omeze wrote:
| Its been way too long since I touched a breadboard, but what
| software was the post using to simulate this? I would expect that
| the requirement for ~ns precision (microwave frequencies) would
| involve a lot more tedious calculations for designing the
| circuit.
| ynoxinul wrote:
| I used Falstad curcuit simulator
| (https://www.falstad.com/circuit/circuitjs.html) to try out
| some subcircuits (monostable, for example) and then tried them
| out on a breadboard.
| 0xmarcin wrote:
| What a mervell of retro-computing. I think the author should
| definitely contact Ben Eater, as this is an excellent material
| for the next video.
|
| Aside from this, Arduino shields for Ethernet are available for
| quite some time, but they often contain the more advanced chip
| than the atmega328p itself. Here OTOH the author builds from the
| ground up. Simply amazing!
|
| That being said, I think most of the ppl that are serious about
| their arduino networking will use CAN as their network of choice
| (https://en.wikipedia.org/wiki/CAN_bus).
| systems_glitch wrote:
| Nice work! Now do thicknet :P
| psychphysic wrote:
| I love this stuff, well over my head but amazing read and so
| grateful for the scope captures!
___________________________________________________________________
(page generated 2022-12-18 23:01 UTC)