TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

The J1 Forth CPU

214 pointsby Cieplakover 4 years ago

10 comments

peter_d_shermanover 4 years ago
&gt;&quot;J1 is a<p><i>small (200 lines of Verilog)</i><p>stack-based CPU, intended for FPGAs. A complete J1 with 16Kbytes of RAM fits easily on a small Xilinx FPGA.<p>PDS: A long time ago, I thought that Forth was &quot;just another computer programming language&quot;, but back then, I had no appreciation for it, because I didn&#x27;t understand where it fits in on the abstraction hierarchy that we call modern day computing...<p>I didn&#x27;t have this appreciation, at the time, because I had not worked on writing compilers at the time...<p>Now, let me explain to you why Forth is so gloriously wonderful!<p>You see, in terms of abstraction, where transistors are the lowest level, and Lisp, and Lisp-like languages are the highest, and most compilers are somewhat mid-level,<p><i>Forth is the next step up above machine language -- but a step below most compilers!</i><p>You&#x27;d know this, you&#x27;d <i>derive</i> this, if you ever tried to write a compiler from the bottom up (going from assembly language to a compiler) rather than from the top down (what is taught about compiler construction in most University CS classes, i.e., the &quot;Dragon Book&quot;, etc.)<p>See, Forth is sort of what happens when you add an at-runtime symbol (AKA, &quot;keyword&quot;) lookup table to your assembler code, such that addresses (AKA &quot;labels&quot;, AKA, &quot;functions&quot;, AKA &quot;procedures&quot;, AKA &quot;methods&quot;) can be dynamically executed at runtime, and you create an interpreter &#x2F; stack-machine -- around this concept.<p>There&#x27;s a little bit more to that of course, but that&#x27;s the basic idea.<p>Then you <i>derive</i> Forth!<p>That&#x27;s <i>why</i> Forth is so gorgeous and brilliant!<p>And so aesthetically pleasing, because of it&#x27;s small size, yet amazing functionality!<p>And why you don&#x27;t need big, complex CPU&#x27;s to run it!<p>It exactly follows the &quot;Einsteinian mantra&quot; of<p><i>&quot;As simple as possible, but not simpler!&quot;</i><p>Anyway, thanks again for your great work with the J1 Forth CPU!
评论 #25765367 未加载
评论 #25767962 未加载
Cieplakover 4 years ago
Also worth checking out James’s simplified version designed for the Lattice iCE40 [1][2].<p>[1] <a href="https:&#x2F;&#x2F;www.excamera.com&#x2F;sphinx&#x2F;article-j1a-swapforth.html" rel="nofollow">https:&#x2F;&#x2F;www.excamera.com&#x2F;sphinx&#x2F;article-j1a-swapforth.html</a><p>[2] <a href="https:&#x2F;&#x2F;youtube.com&#x2F;watch?v=rdLgLCIDSk0" rel="nofollow">https:&#x2F;&#x2F;youtube.com&#x2F;watch?v=rdLgLCIDSk0</a>
评论 #25765141 未加载
评论 #25760009 未加载
rbanffyover 4 years ago
In college, one of our assignments was to design a CPU. I started with a plain register-based one, but ended up moving to a stack-based design. It was one of the best decisions I made in the project, simplified the microcode enormously and made programming it easy and fun.
评论 #25762569 未加载
one-more-minuteover 4 years ago
Tangential question about FPGAs: Is there any work on compiling code to a combination of hardware and software? I&#x27;m imagining that the &quot;outer loop&quot; of a program is still fairly standard ARM instructions, or similar, but the compiler turns some subroutines into specialised circuits. Even more ambitiously you could JIT-compile hot loops from machine instructions to hardware.<p>We already kind of do this manually over the long term (eg things like bfloat16, TF32 and hardware support for them in ML, or specialised video decoders). With mixed compilation you could do things like specify a floating point format on-the-fly, or mix and match formats, in software and still get high performance.
评论 #25762860 未加载
评论 #25761098 未加载
评论 #25761031 未加载
评论 #25765690 未加载
fctorialover 4 years ago
What are the advantages of an fpga over an emulator running on a board like rpi? Isn&#x27;t an fpga just a hardware level emulator?
评论 #25761278 未加载
评论 #25764027 未加载
评论 #25766788 未加载
评论 #25763848 未加载
jandreseover 4 years ago
&gt; one’s complement addition<p>That&#x27;s going to catch some people off guard, especially on a 16 bit system where it&#x27;s so easy to overflow.
pkayeover 4 years ago
I always wondered if it is feasible to do a pipelined&#x2F;super scalar stack based CPU.
评论 #25769949 未加载
评论 #25768133 未加载
moonchildover 4 years ago
&gt; double precision (i.e. 32 bit) math<p>Is this standard nomenclature anywhere? IME &#x27;double precision&#x27; generally refers to 64-bit floating values; and 32-bit is called &#x27;single precision&#x27;.
评论 #25760580 未加载
评论 #25760510 未加载
评论 #25760136 未加载
评论 #25760139 未加载
bmitcover 4 years ago
Forth is fun. I haven’t learned much of it or used it much, but it has been enjoyable.
cbmuserover 4 years ago
The name is a bit confusing as there is already a J2 CPU which is the open source variant of the SuperH SH-2.
评论 #25765310 未加载