Nand2Tetris/Hack Core

sajattack
Core Developer
Posts: 35
Joined: Sun May 24, 2020 6:50 pm
Location: BC, Canada
Has thanked: 4 times
Been thanked: 17 times
Contact:

Nand2Tetris/Hack Core

Unread post by sajattack »

Hello, I have an unofficial core not many people know about, implementing the computer from the Nand2Tetris Coursera course, which is called Hack. It was largely an educational exercise and doesn't have many games but I'd be happy if y'all checked it out. I updated it last week to work with newest main. https://github.com/sajattack/Hack_MiSTer
User avatar
Moondandy
Top Contributor
Posts: 535
Joined: Mon May 25, 2020 2:14 am
Location: Edinburgh, Scotland
Has thanked: 32 times
Been thanked: 102 times

Re: Nand2Tetris/Hack Core

Unread post by Moondandy »

Hey, that's really cool you made a core. I'm not entirely sure what this is or what games can be played, and how to set it up to play them. Are you able to give a write up of what it is and how to set it up? Would be worth adding to the readme file on GitHub, hopefully with that you will get some more people downloading and get some feedback.

Maybe Pezz 82 will give it a bump on one of his update videos and perhaps it could even be added to Main.

Do you plan to work on any more cores?
sajattack
Core Developer
Posts: 35
Joined: Sun May 24, 2020 6:50 pm
Location: BC, Canada
Has thanked: 4 times
Been thanked: 17 times
Contact:

Re: Nand2Tetris/Hack Core

Unread post by sajattack »

Pretty much the only game it runs is one player Pong. Get the Pong.bin here https://github.com/sajattack/Hack_MiSTe ... aster/roms and place it in /media/fat/games/Hack . I was disappointed many of the games written for the platform have larger memory requirements than what are actually specified. The repository links to the website for nand2tetris which has a video that explains what it is. I also ported the CHIP-8 core from MiST and have thought about doing Fairchild Channel F.
User avatar
Moondandy
Top Contributor
Posts: 535
Joined: Mon May 25, 2020 2:14 am
Location: Edinburgh, Scotland
Has thanked: 32 times
Been thanked: 102 times

Re: Nand2Tetris/Hack Core

Unread post by Moondandy »

A Fairchild F core would be great, that is one glaring hole in Mister's coverage of the early consoles. Hopefully it isn't too tricky. Quite surprised no one has done it already.
User avatar
ragnar
Posts: 27
Joined: Thu May 28, 2020 10:16 am
Been thanked: 10 times

Re: Nand2Tetris/Hack Core

Unread post by ragnar »

A Channel F core would be really great but... i wonder, since the Channel F has a "second layer of controls" on the button, how would it work on a regular joypad?
• FireBee • Falcon030/040/060 • MiSTer • TT • (Mega)STe • Suska III-B • Suska III-C • (Mega)ST •
sajattack
Core Developer
Posts: 35
Joined: Sun May 24, 2020 6:50 pm
Location: BC, Canada
Has thanked: 4 times
Been thanked: 17 times
Contact:

Re: Nand2Tetris/Hack Core

Unread post by sajattack »

Moondandy wrote: Tue Jun 02, 2020 2:37 pm Hopefully it isn't too tricky. Quite surprised no one has done it already.
It has a very unusual CPU. So not a drop-in z80 or 6502 like a lot of other cores. But it's fairly simplistic in it's operation. Should be doable.
User avatar
Moondandy
Top Contributor
Posts: 535
Joined: Mon May 25, 2020 2:14 am
Location: Edinburgh, Scotland
Has thanked: 32 times
Been thanked: 102 times

Re: Nand2Tetris/Hack Core

Unread post by Moondandy »

Good luck and godspeed, keep us updated! I will be getting the games on my SD in anticipation.
sajattack
Core Developer
Posts: 35
Joined: Sun May 24, 2020 6:50 pm
Location: BC, Canada
Has thanked: 4 times
Been thanked: 17 times
Contact:

Re: Nand2Tetris/Hack Core

Unread post by sajattack »

Haha don't get too excited yet.
User avatar
Moondandy
Top Contributor
Posts: 535
Joined: Mon May 25, 2020 2:14 am
Location: Edinburgh, Scotland
Has thanked: 32 times
Been thanked: 102 times

Re: Nand2Tetris/Hack Core

Unread post by Moondandy »

I had a play of Pong, a basic but fun one player version. Do any other games run on it or have they all failed to adhere to the memory restrictions?
sajattack
Core Developer
Posts: 35
Joined: Sun May 24, 2020 6:50 pm
Location: BC, Canada
Has thanked: 4 times
Been thanked: 17 times
Contact:

Re: Nand2Tetris/Hack Core

Unread post by sajattack »

Yeah it's really quite unfortunate that the course encourages students to develop their games in a simulator with no memory restrictions. Because if you actually try to run them with the specified memory limit, they fail. I have a friend who started developing a game within the memory limits but it's unfinished. I believe it's in the repo under "pumpkin"
User avatar
Moondandy
Top Contributor
Posts: 535
Joined: Mon May 25, 2020 2:14 am
Location: Edinburgh, Scotland
Has thanked: 32 times
Been thanked: 102 times

Re: Nand2Tetris/Hack Core

Unread post by Moondandy »

Any plans to add the core into Main? Is there more you are wanting to do to it?

Hopefully more people make games that actually run on the spec.
sajattack
Core Developer
Posts: 35
Joined: Sun May 24, 2020 6:50 pm
Location: BC, Canada
Has thanked: 4 times
Been thanked: 17 times
Contact:

Re: Nand2Tetris/Hack Core

Unread post by sajattack »

Sorg didn't want it on Main last time I asked.
User avatar
lomdar67
Posts: 184
Joined: Sun May 24, 2020 8:27 pm
Has thanked: 14 times
Been thanked: 9 times

Re: Nand2Tetris/Hack Core

Unread post by lomdar67 »

It's a nice core, but including it into Main somehow contradicts the whole Nand2Teris project.

The whole purpose of the project is to build a "computer" in software (emulation) or in fpga yourself. It's not about running software on that "computer" but to understand the principles of a modern computer.
We raise hopes here...until they're old enough to fend for themselves.
--Mike Callahan
User avatar
Moondandy
Top Contributor
Posts: 535
Joined: Mon May 25, 2020 2:14 am
Location: Edinburgh, Scotland
Has thanked: 32 times
Been thanked: 102 times

Re: Nand2Tetris/Hack Core

Unread post by Moondandy »

Question for Sorg: now there is an "other" section, are there objections to this core being merged into Main?
Zorro
Posts: 4
Joined: Sat Aug 15, 2020 6:16 pm

Re: Nand2Tetris/Hack Core

Unread post by Zorro »

As soon that I've got my Jack compiler done, I'll maybe create another Hack Game, just to get some ideas about the design of OO high level languages. I plan to make my own Hack core for the DE-10 nano, but as I'm still on the 2nd nand2tetris course yet, both projects might take some time.
Zorro
Posts: 4
Joined: Sat Aug 15, 2020 6:16 pm

Re: Nand2Tetris/Hack Core

Unread post by Zorro »

Code: Select all

// I'd love to make this out of nand gates but my fpga would explode  
module RAM16K(
    input clk,
    input [15:0] in,
    
   ...

endmodule
Hahahaha, this is my favorite part of your code. :lol:
I will have a deeper look into your implementation. My own verilog knowledge is very rudimentary.
cmstar0
Posts: 20
Joined: Thu Mar 11, 2021 3:16 am
Has thanked: 1 time
Been thanked: 5 times

Re: Nand2Tetris/Hack Core

Unread post by cmstar0 »

I'm taking a class based on the Coursera / Nand2Tetris course as well and had the same thought of trying to make the core. Glad to see someone else had the same thought. I'll have to check this out after the class is finished. I think it would be great to have a 'Hack' core here for further educational value, or perhaps a write up guide to help others create their own.
User avatar
pgimeno
Top Contributor
Posts: 710
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 277 times
Been thanked: 226 times

Re: Nand2Tetris/Hack Core

Unread post by pgimeno »

What are the specs of this machine?
User avatar
pgimeno
Top Contributor
Posts: 710
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 277 times
Been thanked: 226 times

Re: Nand2Tetris/Hack Core

Unread post by pgimeno »

pgimeno wrote: Fri Mar 19, 2021 1:32 am What are the specs of this machine?
Anyone?

I haven't found anything concrete in the Nand2Tetris course pages. How does it compare to Gigatron? I wrote a full spec of Gigatron here: viewtopic.php?p=11342#p11342
sajattack
Core Developer
Posts: 35
Joined: Sun May 24, 2020 6:50 pm
Location: BC, Canada
Has thanked: 4 times
Been thanked: 17 times
Contact:

Re: Nand2Tetris/Hack Core

Unread post by sajattack »

It's a 16 bit machine that runs at about 1 million instructions per sec in my implementation, but the instructions are very RISC and hardly do anything. For example iirc a memory access requires two instructions. Resolution is 512x256 1bpp. 16384 16 bit words of RAM and 32768 16 bit words of instruction ROM.
Post Reply