Questions tagged [nand2tetris]

For questions regarding the Nand2Tetris course assignments (and the accompanying book "The elements of computing systems") by Shimon Schocken and Noam Nisan. Including the Hack assembly language, the Jack VM and high level languages.

The Nand2Tetris course teaches how to build a modern computer from the first principles, and can be taken by each person with some programming knowledge in any language. All the CS related materials are taught and explained during the course.

The course can be taken in Coursera, and has two parts:

It has an accompanying software that can be found on the website, and a book named The Elements of Computing Systems: Building a Modern Computer from First Principles.

See also: Nand2Tetris forum

116 questions
2
votes
2 answers

Intuition for implementing logic gates

I've been asked to implement logic gates in semi-HDL language for an exercise. The problem is that I'm lack of intuition regarding the implementations and can't see a method or algorithm for "turning" a truth-table into logic gates, even the more…
Gabi_Ma
  • 31
  • 3
2
votes
2 answers

(Nand2tetris CPU) (What/How much) happens in each clock cycle?

On the basis of the Nand2tetris CPU, as shown below, I would like to know the following: (What/How much) happens in each clock cycle? (see IMG_1 and IMG_2) As a follow-up question to question 1, when should the program counter change? Note that…
Sebastian Nielsen
  • 3,835
  • 5
  • 27
  • 43
2
votes
2 answers

What should happen in this (nand2tetris) CPU implementation, if the instruction is a c-instruction?

Seeing this CPU implementation, I am utterly confused (and it is not just because the control bits aren't connected with anything; it is my task to connect those). The first thing that confuses me is that if the upcoming instruction is a…
2
votes
1 answer

Java functions in Hack assembly Language

How do i implement a Java function in Hack Assembly? I know that instructions to change variables is easily made, but how does HACK call a function? For Example: function(int a, int b) { if (a-b > 0) return a; else return b; } My (i think wrong)…
J.Dean
  • 37
  • 4
2
votes
1 answer

Is the Nand2Tetris Hack computer's RAM a good model for how RAM is structured on x86 machines?

The following is the structure of RAM for the entire Hack Computer in Nand2Tetris: Putting aside virtual memory, is this a good simplified model for how the entire RAM is set up on x86 computers? Is RAM really just made of clusters of memory…
Jonathan Ma
  • 353
  • 3
  • 11
2
votes
1 answer

NAND2Tetris Hack

How do I skip 2 commands in hack if I don't know the exact line no. of which the code I want to jump to. eg. 30.@33 31.D;JGT 32.M=M-1 33.M=M+1 But I don't know the line no. I am currently at(30), I just want to skip the next line of code(Go 2 steps…
2
votes
1 answer

Passing false to an input in HDL

I am using the HDL from the Nand2Tetris (Elements of Computing Systems) book, and whilst looking at example gate implementations online I regularly notice something along the lines of; CHIP ExampleZeroer { IN a[16], sel; OUT out[16]; …
Rudi Kershaw
  • 12,332
  • 7
  • 52
  • 77
1
vote
1 answer

Error: undefined method `[]' for nil:NilClass (NoMethodError)

I am doing the nand2tetris project in Ruby, and I am programming a translator from VM to Jack. I keep getting the error: in initialize': undefined method []' for nil:NilClass (NoMethodError) path = path[0...-1] if path[-1] == "/"\r …
Ellie
  • 13
  • 2
1
vote
1 answer

How many steps does the Hack computer's fetch-execute cycle take?

I have completed the first part of the From Nand to Tetris course (thanks MadOverlord and everyone!) but still can't figure out how many steps the Hack CPU's fetch-execute cycle takes. I read the But How Do It Know? book about an 8-bit "shared…
Piovezan
  • 3,215
  • 1
  • 28
  • 45
1
vote
1 answer

A instruction control bits

I'm building a CPU in the nand2tetris course and I'm kind of stuck. Do I have to check if the instruction is an A or C instruction? In the A instruction guide it only shows the first control bit. The MSB controls the output of the first Mux. What…
elonma1234
  • 11
  • 2
1
vote
2 answers

Implementing a 16 bit register in Nand2Tetris (HDL code)

think I am most of the way there, and my hardware simulator accepts the chip, but when running the test script the comparison fails half way through, I'm guessing there is an issue with feeding the output of the DFF back into the Mux. Any advice…
1
vote
2 answers

nand2tetris HDL: Getting error "Sub bus of an internal node may not be used"

I am trying to make a 10-bit adder/subtractor. Right now, the logic works as intended. However, I am trying to set all bits to 0 iff there is overflow. To do this, I need to pass the output (tempOut) through a 10-bit Mux, but in doing so, am getting…
codeing_monkey
  • 43
  • 1
  • 2
  • 6
1
vote
1 answer

Assembly Hack to Binary Machine Language

How do I convert Assembly Hack to Binary Machine Language? For example, the below hack assembly, how would I manually translate it into machine code (binary). I just need to know a reference or where I can learn how to manually translate…
coder3
  • 357
  • 1
  • 3
  • 14
1
vote
2 answers

How to implement nand2tetris processor on a real FPGA?

I followed the nand2tetris course (https://www.nand2tetris.org/course) with the main intent to learn how to build a soft processor on a real FPGA. While the course was simple enough, now that I am starting with the FPGA implementation I feel a bit…
1
vote
1 answer

The logic of designing a HDL parts from the beginning : DM

I am taking the nand2tetris coursera course. I am trying to understand how you guys, can design the underlying mental process of finding the HDL core parts. For exemple, let's take the DMUX4way. What is the complete mental process to achieve the…