frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

Open in hackernews

LFSR CPU Running Forth

https://github.com/howerj/lfsr-vhdl
73•izabera•1d ago

Comments

kragen•1d ago
This is pretty cool. There were some LFSR-PC CPUs back in the 70s such as the TMS 1000 used in the Speak&Spell https://github.com/mikeakohn/tms1000_fpga (its Data Manual omits mention of this, but the Programmer's Reference Manual does mention it https://ia800306.us.archive.org/27/items/bitsavers_tiTMS1000...), and of course the Atari 2600 TIA raster generator is famous for using an LFSR counter for horizontal position. Ken Shirriff has also documented the use of an LFSR counter for tone generation in the UM66T greeting-card music chip http://www.righto.com/2021/12/reverse-engineering-tiny-1980s... and for Pentium self-test circuitry http://www.righto.com/2025/01/pentium-carry-lookahead-revers... and for DTMF tone generation.

It occurred to me recently that an LFSR-pc CPU could avoid having an address field in its conditional jump instructions, instead doing something like complementing a PC bit. There have been conventional counter-based CPUs that did something like this: Data General's NOVA and HP's RPN calculators had conditional-skip instructions which would skip over the next instruction without executing it if the condition was false. But it was usually a jump instruction, so it didn't really save you space. (The TMS 1000's conditionals also worked this way, but could only skip branch and call instructions.)

By contrast, in an LFSR, complementing a bit or incrementing the value takes you potentially far away in the address sequence. The assembler might have to insert NOPs to resolve the occasional collision.

The TMS 1000 program counter had an additional twist: it was only 6 bits, but to enable programs of more than 64 instructions, there were multiple 64-byte "pages" of ROM. The page address register was potentially updated on branches, calls, and returns, but not for normal program sequencing. I'm not sure if this actually saved any transistors, but it meant that normal branch instructions only needed a 6-bit field. An additional "load page buffer" instruction was needed for far jumps and calls, and the page buffer register remained loaded with the return page until the return instruction. (Subroutine calls within subroutines were not supported.)

https://electronics.stackexchange.com/questions/186762/first... claims that the TMS 1000 had 8000 transistors, which seems really inefficient compared to things like the 4004 and the MuP21.

jecel•1d ago
Didn't the TMS 1000 include the processor, i/o, ROM and RAM? All that in 8K transistors seems frugal.
kragen•1d ago
That's a good point. It's more like an 8051 than a 4004, and the 8051 was 50k transistors.
nullc•15h ago
If you had a pallet of a couple possible jump instructions that different twiddle the counter you might be able to use a solver to resolve collisions in the spirit of ribbon filters ( https://engineering.fb.com/2021/07/09/core-infra/ribbon-filt... ).
howerj•1d ago
I had a lot of fun writing this and it is great to see this submitted here, I just did it to see what was possible. It is an incredibly niche processor with little practical use. If you have any questions let me know.

I have also started contracting in the UK and I'm looking for work, details are in my profile.

kragen•1d ago
You may be interested in #forth on Libera, though it's unlikely to lead to work.
sph•1d ago
It’s unlikely to find paid Forth work, though I hope there is still someone hiring engineers that write Forths and LFSR CPUs in their spare time. One will find they are quite versatile and eager to learn :)
howerj•1d ago
Ah yeah, I'm not looking for Forth work, it would be nice, but not likely. Just C/C#/.Net/Linux and Embedded work.
alexisread•1d ago
Nothing involving forth (only Java really) where I'm working, but I wanted to send some appreciation for Embed forth (meta-compiler), the documentation is particularly good :)
artemonster•1d ago
I have used the same LFSR-PC trick for my relay CPU:

https://github.com/artemonster/relay-cpu

Instead of having 24 relays to have a 12bit incrementer (a full adder requires 4 DPDT relays per bit or 2 quad relays) I only have 3 relays for 3 XORs :)

tyrellj•1d ago
I got lost in the weeds following links for a bit. Had not heard of LFSR before, which I think is odd, and then onto some other things like Subleq and OISC. I've at least seen other OISCs before, it might have even come up on hn around x86 mov, I'm not sure. I really regret not taking more hardware/electronics courses in college.
jsd1982•1d ago
Wouldn't this make it somewhat more challenging for assemblers/compilers to emit branch instructions with target PC offsets?

For instance, the offset of an instruction two instructions away would be calculated as `lfsr(lfsr(pc))` (off-by-one bugs notwithstanding), right?

anthk•1d ago
If the PC offsets are non-repeating, you would just create a table from a known start. Kinda like Ouruborus, or the Humming distance between vertexes in a cube without repeating.
nullc•17h ago
LFSR IP seems like one of the optimizations that would show up in a CPU designed for the absolute lowest energy per operation. Sadly many of the most interesting low energy optimizations will be at the analog/transistor level-- or even from optimizing across that boundary--, taking them out of the realm of hobbiests.
dmitrygr•12m ago
instruction set design is reminiscent of PDP8

UBI and the Environmental Cost of Overemployment

https://www.greshm.org/blog/ubi-and-the-environmental-cost-of-overemployment/
1•Suncho•3m ago•0 comments

The White House Gutted Science Funding. Now It Wants to 'Correct' Research

https://www.nytimes.com/2025/06/03/climate/executive-order-gold-standard-science.html
2•LAsteNERD•4m ago•0 comments

Artificial Power: 2025 Landscape Report

https://ainowinstitute.org/publications/research/ai-now-2025-landscape-report
1•jbegley•4m ago•0 comments

Heart attacks, fainting and falls: the perils of pooping

https://theconversation.com/heart-attacks-fainting-and-falls-the-perils-of-pooping-256934
1•XzetaU8•7m ago•0 comments

TechCrunch rocks industry with European shutdown: 'A gut punch to the ecosystem'

https://sifted.eu/articles/techcrunch-leaves-europe-shut-down-startups
2•spenvo•7m ago•0 comments

Claude Code Action (OAuth Fork)

https://github.com/grll/claude-code-action
1•grll•8m ago•1 comments

Where is the app store for AI?

2•bingbongboing•9m ago•0 comments

I Got Fine-Tuned to Use More Em Dashes Too

https://gardnermcintyre.com/post/i-got-fine-tuned-to-use-more-em-dashes-too
1•zebomon•10m ago•0 comments

Show HN: SQLxport – Export SQL Query Results to Parquet, CSV, and S3

https://github.com/vahid110/sqlxport
1•wahid110•12m ago•0 comments

The Evaluation of Engineering Artificial General Intelligence

https://arxiv.org/abs/2505.10653
1•sirregex•12m ago•0 comments

Show HN: I'm Building Ahrefs for AI Search Results

https://linrush.com/
1•devarifhossain•12m ago•0 comments

The Future of User Research

https://jeremybelcher.co/the-future-of-user-research/
1•charlesiv•13m ago•0 comments

Ask HN: How do you struggle with/optimize for deep,sustained focus?

3•jenever•13m ago•0 comments

Ray-Ban Meta AI Glasses: Another Tech Product Designed for the Dump?

https://pirg.org/articles/ray-ban-meta-ai-glasses-another-tech-product-designed-for-the-dump/
1•lg_rocket•14m ago•0 comments

The Devastating Decline of a Brilliant Young Coder (2020)

https://www.wired.com/story/lee-holloway-devastating-decline-brilliant-young-coder/
1•lobo_tuerto•15m ago•0 comments

Show HN: Swiftor AI Hacking Dashboard

https://swiftor.io
1•furaar•17m ago•0 comments

LLMs generate 5G scheduling software (preprint)

https://arxiv.org/abs/2505.18389
2•mychele•17m ago•0 comments

Creating Colorimetrically-Accurate Scans, Part 1: IT8 Considered Harmful (2021)

https://comeonux.com/2021-09-29-it8-considered-harmful/
1•arm•18m ago•0 comments

White-Labeling in Online Education: Whose Credential Is It Anyway?

https://www.classcentral.com/report/white-labeling-in-online-education/
2•raybb•19m ago•0 comments

Feature Analysis of Frank Lloyd Wright Usonian Perforated Board Designs (2018)

https://medium.com/tangibit-studios/feature-analysis-of-usonian-perforated-board-designs-9fa97c8aa383
1•NaOH•19m ago•0 comments

Proposed Canadian spy bill grants government warrantless access to chat and mail

https://www.canada.ca/en/public-safety-canada/news/2025/06/the-strong-borders-act---government-of-canada-strengthens-border-security.html
4•pojntfx•21m ago•0 comments

I Live Here Now

https://randsinrepose.com/archives/i-live-here-now/
3•mooreds•21m ago•0 comments

The Fannie and Freddie Stakes Are High

https://www.bloomberg.com/opinion/newsletters/2025-06-03/the-fannie-and-freddie-stakes-are-high
3•feross•22m ago•0 comments

Diabolus Ex Machina: This Is Not an Essay

https://amandaguinzburg.substack.com/p/diabolus-ex-machina
1•jaredwiener•22m ago•0 comments

AI-SQL Client in the Browser

https://www.datajoi.com
1•datajoi•22m ago•1 comments

Did "Big Oil" Sell Us on a Recycling Scam?

https://daily.jstor.org/did-big-oil-sell-us-on-a-recycling-scam/
3•cratermoon•23m ago•0 comments

Insect protein blocks bacterial infection

https://www.rmit.edu.au/news/all-news/2025/jun/antibacterial-resilin
2•gnabgib•23m ago•0 comments

GoDaddy Issues Certificates That Don't Work in Safari (Again)

https://sslmate.com/blog/post/godaddy_issues_thousands_of_broken_certificates
1•Bender•24m ago•0 comments

Where in the world are babies at the lowest risk of dying?

https://ourworldindata.org/where-are-babies-at-lowest-risk-of-dying
1•kamaraju•25m ago•0 comments

Dating apps tied to U.S. citizens kidnapped in Mexico, officials warn

https://ktla.com/news/local-news/dating-apps-tied-to-u-s-citizens-kidnapped-in-mexico-officials-warn/
2•Bender•26m ago•0 comments