loop

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

loop

lonelyjohner
Is there any thing like the "for" loop I could use in DHL to save some trouble repetitively inputting code?
Reply | Threaded
Open this post in threaded view
|

Re: loop

cadet1620
Administrator
lonelyjohner wrote
Is there any thing like the "for" loop I could use in DHL to save some trouble repetitively inputting code?
There are no looping constructs in HDL. You will need to have one line for each bit in the Xxx16.hdl files.

Hint: it is fastest to write a line like
    Xyz(a=a[], b=b[], out=out[]);
and copy it 15 times. Then you can quickly run down the columns, starting with the rightmost column, inserting the bit numbers.

--Mark
Reply | Threaded
Open this post in threaded view
|

Re: loop

lonelyjohner
Yes..And that was exactly what I did to the 8-way scenarios.. When it comes to 16-way the code could go crazy..
Reply | Threaded
Open this post in threaded view
|

Re: loop

cadet1620
Administrator
[Oops -- we're talking about 8-Way, 16-Way, etc not Xxx16. ignore this; correct post in a minute or to.]

Are you trying to write everything with Nands? The 16Ways should just be 16 uses of their corresponding simple gate.

--Mark
Reply | Threaded
Open this post in threaded view
|

Re: loop

cadet1620
Administrator
In reply to this post by lonelyjohner
You are right, Or8Way is a lot of typing.

The other nWays (2 muxes and 2 demuxes) can be easily handled with abstraction by using 2-way muxes to build their 4-ways, and a combination of 2- and 4-ways to build their 8-ways. They can be as short as 3 lines of code.

--Mark
Reply | Threaded
Open this post in threaded view
|

Re:Re: loop

lonelyjohner
In reply to this post by cadet1620


No, I used Or and And gate, etc. But still, it is a lot of work.



At 2013-12-28 22:45:50,"cadet1620 [via Nand2Tetris Questions and Answers Forum]" <[hidden email]> wrote:
Are you trying to write everything with Nands? The 16Ways should just be 16 uses of their corresponding simple gate.

--Mark


If you reply to this email, your message will be added to the discussion below:
http://nand2tetris-questions-and-answers-forum.32033.n3.nabble.com/loop-tp4027564p4027567.html
To unsubscribe from loop, click here.
NAML