Least number of lines of HDL code

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

Least number of lines of HDL code

Leroy
Just curious.  What is the least number of lines of HDL code, where a line of HDL code contains either just 1 logic gate or 1 chip (from chapter 2), that can be used to create a successful ALU implementation.  I ended up using 18 lines- 7 Mux16, 3 Not16, 2 Or8Way, 2 Not, 1 Or, 1 Mux, 1 And16 and 1 Add16.

     
Reply | Threaded
Open this post in threaded view
|

Re: Least number of lines of HDL code

cadet1620
Administrator
Leroy wrote
Just curious.  What is the least number of lines of HDL code, where a line of HDL code contains either just 1 logic gate or 1 chip (from chapter 2), that can be used to create a successful ALU implementation.  I ended up using 18 lines- 7 Mux16, 3 Not16, 2 Or8Way, 2 Not, 1 Or, 1 Mux, 1 And16 and 1 Add16.
My shortest has 13 parts lines.

If you want, become a registered member of the forum and send me your ALU.hdl using More>Reply to Author. I will send you the 13-liner and a couple more showing different techniques that can be used to make the ALU.

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

Re: Least number of lines of HDL code

AndyGeo
This post was updated on .
Just finished mine and thought I was doing well until i had to get the zr and ng outputs. The ng itself was ok but i used 5 lines just to get the zr not including the lines used to create the 8-bit buses.

I used 20 lines altogether.
Reply | Threaded
Open this post in threaded view
|

Re: Least number of lines of HDL code

ysh443
In reply to this post by cadet1620
Hi Mark
i had it done with 12 lines
can i send you my imp. for code_review?

Regards
Reply | Threaded
Open this post in threaded view
|

Re: Least number of lines of HDL code

cadet1620
Administrator
In reply to this post by AndyGeo
AndyGeo wrote
Just finished mine and thought I was doing well until i had to get the zr and ng outputs. The ng itself was ok but i used 5 lines just to get the zr not including the lines used to create the 8-bit buses.

I used 20 lines altogether.
Study Appendix A.5.3. You will learn how you can create the 8-bit buses from the output of the same part that connects to the ALU's out.

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

Re: Least number of lines of HDL code

cadet1620
Administrator
In reply to this post by ysh443
ysh443 wrote
can i send you my imp. for code_review?
Yes, feel free to send me your code. I'll be happy to comment upon it.

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

Re: Least number of lines of HDL code

dpotter
In reply to this post by ysh443
I also found a 12-line solution.  However, my approach was wasteful in that it increased the overall number of components in the system in order to minimize the lines of code in ALU.HDL.  

Specifically, it uses a Mux4Way16 when using only 1 bit inputs and outputs (because there is no 1-bit Mux4Way).