hdlnand2tetris

This performs the Or8Way function, Why is the or1out[1] 0?


Shouldn't it be 1 ( 1or1 = 1; 1or0 = 1)

screen shot of hdl


Solution

  • Or8way takes a 8bit bus as input and outputs a single bit bus. That bit is 1 if any of the bits in the input are 1, and 0 if all of the bits in the input are 0. Thus, there really is no or1out[1]. There is only or1out, a single-bit signal.

    You can confirm this by looking at the definition comment for Or8Way:

    /**
     * 8-way Or: 
     * out = (in[0] or in[1] or ... or in[7])
     */