<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title><![CDATA[Forums - Open Redstone Engineers - Concepts]]></title>
		<link>https://forum.openredstone.org/</link>
		<description><![CDATA[Forums - Open Redstone Engineers - https://forum.openredstone.org]]></description>
		<pubDate>Sun, 26 Apr 2026 16:11:52 +0000</pubDate>
		<generator>MyBB</generator>
		<item>
			<title><![CDATA[***FREE*** COMP ARCH BOOK!]]></title>
			<link>https://forum.openredstone.org/thread-14217.html</link>
			<pubDate>Thu, 28 Jun 2018 22:33:14 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.openredstone.org/member.php?action=profile&uid=254">greatgamer34</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.openredstone.org/thread-14217.html</guid>
			<description><![CDATA[Okay so I have been often requested to link people for a university book on Computer Architecture so to be a good soul I will: https://www.amazon.com/Computer-Organization-Design-MIPS-Fifth/dp/0124077269/ref=sr_1_1?ie=UTF8&amp;qid=1529277209&amp;sr=8-1&amp;keywords=computer+organization+and+microprocessor+design<br />
<br />
its pretty cheap....<br />
<br />
But I have something thats free: http://submit4m.nl/bestanden/jeroen/patterson_book.pdf<br />
<br />
This is an older version of that amazon book and if you skip to chapter 6 (goes over pipelining in 10 sections about 10 pages each)you should be set!<br />
<br />
Edit** <br />
Here is another link, its the newest version on github: https://github.com/hamadkh/MIPS-iVerilog/blob/master/Morgan.Kaufmann.Computer.Organization.And.Design.5th.Edition.Oct.2013.ISBN.0124077269.pdf]]></description>
			<content:encoded><![CDATA[Okay so I have been often requested to link people for a university book on Computer Architecture so to be a good soul I will: https://www.amazon.com/Computer-Organization-Design-MIPS-Fifth/dp/0124077269/ref=sr_1_1?ie=UTF8&amp;qid=1529277209&amp;sr=8-1&amp;keywords=computer+organization+and+microprocessor+design<br />
<br />
its pretty cheap....<br />
<br />
But I have something thats free: http://submit4m.nl/bestanden/jeroen/patterson_book.pdf<br />
<br />
This is an older version of that amazon book and if you skip to chapter 6 (goes over pipelining in 10 sections about 10 pages each)you should be set!<br />
<br />
Edit** <br />
Here is another link, its the newest version on github: https://github.com/hamadkh/MIPS-iVerilog/blob/master/Morgan.Kaufmann.Computer.Organization.And.Design.5th.Edition.Oct.2013.ISBN.0124077269.pdf]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[CPU Architecture slides]]></title>
			<link>https://forum.openredstone.org/thread-13335.html</link>
			<pubDate>Fri, 01 Dec 2017 22:25:22 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.openredstone.org/member.php?action=profile&uid=254">greatgamer34</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.openredstone.org/thread-13335.html</guid>
			<description><![CDATA[I had received requests for these so I hope you like them! <br />
<a href="https://www.mediafire.com/folder/a8u1d4v7rracr/lecture_notes" target="_blank" rel="noopener" class="mycode_url">Here is where you can download OR view the folder containing the files!</a><br />
<br />
hope this was useful]]></description>
			<content:encoded><![CDATA[I had received requests for these so I hope you like them! <br />
<a href="https://www.mediafire.com/folder/a8u1d4v7rracr/lecture_notes" target="_blank" rel="noopener" class="mycode_url">Here is where you can download OR view the folder containing the files!</a><br />
<br />
hope this was useful]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Logic gate formulas]]></title>
			<link>https://forum.openredstone.org/thread-12558.html</link>
			<pubDate>Sat, 01 Jul 2017 23:27:12 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.openredstone.org/member.php?action=profile&uid=8360">Splavacado100</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.openredstone.org/thread-12558.html</guid>
			<description><![CDATA[Me and Data are working on a hex ALU, i.e. inputs have 16 states, and I devised a common formula for make logic gates with n input states. Sorry if this post doesn't go into much detail, I will update it with a much more in-depth explanation.<br />
<br />
OR gate: max(x,y)<br />
AND gate min(x,y)<br />
<br />
Now the XOR gate is a little tricky but I've found a formula: |x-y|. Now, when doing hex subtraction, compactors have the function max(0, back - side), only using one side. You can using max(x - y, y - x) when doing a hex XOR. Simply put, and XOR gate is the absolute difference between the inputs. The max function is easier, just combine all lines, highest signal strength wins. For the min function, first do invert on each input, i.e. 15-x, then combine (max) each line, then hex invert back again. This is actually the structure of a common and gate, just now using hex NOTs instead of binary NOTs. Please comment any questions!]]></description>
			<content:encoded><![CDATA[Me and Data are working on a hex ALU, i.e. inputs have 16 states, and I devised a common formula for make logic gates with n input states. Sorry if this post doesn't go into much detail, I will update it with a much more in-depth explanation.<br />
<br />
OR gate: max(x,y)<br />
AND gate min(x,y)<br />
<br />
Now the XOR gate is a little tricky but I've found a formula: |x-y|. Now, when doing hex subtraction, compactors have the function max(0, back - side), only using one side. You can using max(x - y, y - x) when doing a hex XOR. Simply put, and XOR gate is the absolute difference between the inputs. The max function is easier, just combine all lines, highest signal strength wins. For the min function, first do invert on each input, i.e. 15-x, then combine (max) each line, then hex invert back again. This is actually the structure of a common and gate, just now using hex NOTs instead of binary NOTs. Please comment any questions!]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Cordic - algorithm]]></title>
			<link>https://forum.openredstone.org/thread-7601.html</link>
			<pubDate>Sat, 29 Aug 2015 15:01:38 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.openredstone.org/member.php?action=profile&uid=309">Mar_Win</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.openredstone.org/thread-7601.html</guid>
			<description><![CDATA[Hey guys!<br />
Some of you asked me a lot about the implementation of the Cordic - algorithm built by robinch and me, which dominates my plot at the moment.<br />
To answer all this questions i thought of doing a brief explanation of the algorithm and here it is.<br />
<br />
In this paper I describe the approach of the algorithm, the computation of the trigonometric functions and some implementation possibilites.<br />
<br />
I do NOT explain the whole algorithm in this paper, because time and stuff. To compute the hyperbolic functions the hardware does not change drastically.<br />
<br />
If there are questions don't hesitate to ask them.<br />
<br />
Feel free to take a look into <a href="https://www.dropbox.com/s/hqox99w576jkuf4/Cordic%20-%20algorithm.pdf?dl=0" target="_blank" rel="noopener" class="mycode_url">it</a>. &lt;--------<br />
<br />
Please leave feedback.<br /><!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://forum.openredstone.org/images/attachtypes/pdf.gif" title="Adobe Acrobat PDF" border="0" alt=".pdf" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=658" target="_blank" title="">Cordic - algorithm.pdf</a> (Size: 234.19 KB / Downloads: 87)
<!-- end: postbit_attachments_attachment -->]]></description>
			<content:encoded><![CDATA[Hey guys!<br />
Some of you asked me a lot about the implementation of the Cordic - algorithm built by robinch and me, which dominates my plot at the moment.<br />
To answer all this questions i thought of doing a brief explanation of the algorithm and here it is.<br />
<br />
In this paper I describe the approach of the algorithm, the computation of the trigonometric functions and some implementation possibilites.<br />
<br />
I do NOT explain the whole algorithm in this paper, because time and stuff. To compute the hyperbolic functions the hardware does not change drastically.<br />
<br />
If there are questions don't hesitate to ask them.<br />
<br />
Feel free to take a look into <a href="https://www.dropbox.com/s/hqox99w576jkuf4/Cordic%20-%20algorithm.pdf?dl=0" target="_blank" rel="noopener" class="mycode_url">it</a>. &lt;--------<br />
<br />
Please leave feedback.<br /><!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://forum.openredstone.org/images/attachtypes/pdf.gif" title="Adobe Acrobat PDF" border="0" alt=".pdf" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=658" target="_blank" title="">Cordic - algorithm.pdf</a> (Size: 234.19 KB / Downloads: 87)
<!-- end: postbit_attachments_attachment -->]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Pipelining basics]]></title>
			<link>https://forum.openredstone.org/thread-5968.html</link>
			<pubDate>Thu, 12 Mar 2015 21:07:38 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.openredstone.org/member.php?action=profile&uid=2305">Magic :^)</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.openredstone.org/thread-5968.html</guid>
			<description><![CDATA[I found a nice page on pipelining :3<br />
<br />
http://www.gamedev.net/page/resources/_/technical/general-programming/a-journey-through-the-cpu-pipeline-r3115]]></description>
			<content:encoded><![CDATA[I found a nice page on pipelining :3<br />
<br />
http://www.gamedev.net/page/resources/_/technical/general-programming/a-journey-through-the-cpu-pipeline-r3115]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[First Quantum Signal and Comparator Behavior Analytics]]></title>
			<link>https://forum.openredstone.org/thread-5927.html</link>
			<pubDate>Sat, 07 Mar 2015 03:53:35 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.openredstone.org/member.php?action=profile&uid=2902">Apocryphan</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.openredstone.org/thread-5927.html</guid>
			<description><![CDATA[Recently i've been finding more and more discrepencies between comparators in 1.7.10 and 1.8.3. Most of these differences are ONLY in Direction, Configuration (same parts and connections) or both. <br />
<br />
So I will no longer be building in 1.7 for fear of having to make things twice but same only different...<br />
<br />
there is a rabbit hole in 1.8, and i'm afraid i've fallen in. I've started to document my findings in a series I'm calling Comparator Behavior Analytics (CBA). The laws for creating the quantum signal will be called Apo's Law. Just a head's up, it won't add up, but it is like a 1 inch punch breaking a boulder. It may be hard to automate until i get better at manipulating timing at a game tick level. Nothing is seen as impossible through these eyes.<br />
<br />
Quantum Signal (works in 1.7 also)<br />
http://imgur.com/a/Rd7lY<br />
<br />
1 tick Comparator Do's and Don'ts in 1.8 (CBA part 1)<br />
http://imgur.com/a/Z9a70<br />
<br />
In 1.7 1 tick comparators don't stop 1 before the end when chained, and from what i've seen were easier to produce.<br />
<br />
In 1.8 1 tick comparators have transfer rules different than the 1.5 tick. slight game tick differences between comparators and repeaters can cause adverse effects to the game ticks without any visual change to the signal. In specific wiring such as chaining comparators the game tick can be slowed to misalign 2 synced signals. <br />
<br />
Here was the start of my 1 tick endevor, the circuit that broke my logic, it only works with those 3 comparators chained. other wire setups with same values just output a 2 tick signal of 3 but this outputs a 1 tick value. And when the 1 value is replaced with 15, this circuit will not output, but now other wiring will now output 1 tick! I believe even pulsers used affect the signal at a game tick level.<br />
<br />
<img src="http://i.imgur.com/tG2Fkxz.png" alt="[Image: tG2Fkxz.png]" class="mycode_img" /><br />
^1st rule of Apo's law, there are no laws.<br />
<br />
<img src="http://i.imgur.com/iBOGK2w.png" alt="[Image: iBOGK2w.png]" class="mycode_img" /><br />
^outputs a 2 tick value of 3, only slight differences in setup, no added ticks.<br />
<br />
<img src="http://i.imgur.com/pVu9oIs.png" alt="[Image: pVu9oIs.png]" class="mycode_img" /><br />
^outputs 1 tick when the 1 is upped to 15]]></description>
			<content:encoded><![CDATA[Recently i've been finding more and more discrepencies between comparators in 1.7.10 and 1.8.3. Most of these differences are ONLY in Direction, Configuration (same parts and connections) or both. <br />
<br />
So I will no longer be building in 1.7 for fear of having to make things twice but same only different...<br />
<br />
there is a rabbit hole in 1.8, and i'm afraid i've fallen in. I've started to document my findings in a series I'm calling Comparator Behavior Analytics (CBA). The laws for creating the quantum signal will be called Apo's Law. Just a head's up, it won't add up, but it is like a 1 inch punch breaking a boulder. It may be hard to automate until i get better at manipulating timing at a game tick level. Nothing is seen as impossible through these eyes.<br />
<br />
Quantum Signal (works in 1.7 also)<br />
http://imgur.com/a/Rd7lY<br />
<br />
1 tick Comparator Do's and Don'ts in 1.8 (CBA part 1)<br />
http://imgur.com/a/Z9a70<br />
<br />
In 1.7 1 tick comparators don't stop 1 before the end when chained, and from what i've seen were easier to produce.<br />
<br />
In 1.8 1 tick comparators have transfer rules different than the 1.5 tick. slight game tick differences between comparators and repeaters can cause adverse effects to the game ticks without any visual change to the signal. In specific wiring such as chaining comparators the game tick can be slowed to misalign 2 synced signals. <br />
<br />
Here was the start of my 1 tick endevor, the circuit that broke my logic, it only works with those 3 comparators chained. other wire setups with same values just output a 2 tick signal of 3 but this outputs a 1 tick value. And when the 1 value is replaced with 15, this circuit will not output, but now other wiring will now output 1 tick! I believe even pulsers used affect the signal at a game tick level.<br />
<br />
<img src="http://i.imgur.com/tG2Fkxz.png" alt="[Image: tG2Fkxz.png]" class="mycode_img" /><br />
^1st rule of Apo's law, there are no laws.<br />
<br />
<img src="http://i.imgur.com/iBOGK2w.png" alt="[Image: iBOGK2w.png]" class="mycode_img" /><br />
^outputs a 2 tick value of 3, only slight differences in setup, no added ticks.<br />
<br />
<img src="http://i.imgur.com/pVu9oIs.png" alt="[Image: pVu9oIs.png]" class="mycode_img" /><br />
^outputs 1 tick when the 1 is upped to 15]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Architecture Comparison,questions. ..]]></title>
			<link>https://forum.openredstone.org/thread-5096.html</link>
			<pubDate>Thu, 20 Nov 2014 13:31:30 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.openredstone.org/member.php?action=profile&uid=742">LordDecapo</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.openredstone.org/thread-5096.html</guid>
			<description><![CDATA[So I have been thinking about doing a write up of overview of different architectures like, SuperScalar OOOexe, Basic MIPS, VLIW, Belt, basic SIMD and maybe some MIMD and graphical stuff GPU stuff, <br />
This would include technical references, a bunch of books and papers for you to read and a compare and contrast writwrite by me with assistance from friends, on when each architecture is good to use and when it's bad..<br />
This will be a multipage write up, and will take a while,<br />
so this post is to see,,, who wants me to do this? Who thinks it's a good idea? Who just doesn't give 2 shits? Lol]]></description>
			<content:encoded><![CDATA[So I have been thinking about doing a write up of overview of different architectures like, SuperScalar OOOexe, Basic MIPS, VLIW, Belt, basic SIMD and maybe some MIMD and graphical stuff GPU stuff, <br />
This would include technical references, a bunch of books and papers for you to read and a compare and contrast writwrite by me with assistance from friends, on when each architecture is good to use and when it's bad..<br />
This will be a multipage write up, and will take a while,<br />
so this post is to see,,, who wants me to do this? Who thinks it's a good idea? Who just doesn't give 2 shits? Lol]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[How to calculate the Sine ?]]></title>
			<link>https://forum.openredstone.org/thread-4835.html</link>
			<pubDate>Mon, 06 Oct 2014 23:03:52 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.openredstone.org/member.php?action=profile&uid=2686">GISED_Link</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.openredstone.org/thread-4835.html</guid>
			<description><![CDATA[<img src="http://img15.hostingpics.net/pics/586293ThundeRedResearchDepartment2.jpg" alt="[Image: 586293ThundeRedResearchDepartment2.jpg]" class="mycode_img" /><br />
<br />
<span style="font-size: x-large;" class="mycode_size"><div style="text-align: center;" class="mycode_align"><span style="color: #006400;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">Calculate the sine of an angle</span></span><br />
</div></span><div style="text-align: center;" class="mycode_align">(in combinatorial)</div>
<br />
Hello, it's Link !<br />
<br />
Today (or now...), I'm going to explain you how to calculate a sine. There is algorithme for this (like CORDIC), but I will show you how to do this in combinational.<br />
<br />
Important to know :<br />
<br />
We give a angle, and the system return a new value : The sine. But there some trouble you have to know :<br />
<ol type="1" class="mycode_list"><li>An angle can be given in radian or in degree,<br />
</li>
<li>The sine is always between -1 and 1. And, the floating number are very difficult to work with.<br />
</li>
<li>The precision of the system is very important. I'll show you my result below</li>
</ol>
Also in this condition, I will said those things for making the task easier for us :<br />
<ol type="1" class="mycode_list"><li>The input  value is between 0 and 90 (corresponding to the value in degrees)<br />
</li>
<li>For the sign, us an additional circuit<br />
</li>
<li>For deleting the float problem, the sine value will be given between 0 and 255 (8 bits). You have only to divide the given sine value by 255 and then you will have the true value <img src="https://forum.openredstone.org/images/smilies/smile.png" alt="Smile" title="Smile" class="smilie smilie_1" /></li>
</ol>
All right ? Then fallow me into the darkness world without any poney of :<br />
<br />
<div style="text-align: center;" class="mycode_align"><img src="https://forum.openredstone.org/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" /> <span style="color: #FF4500;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">Mathematics</span></span> <img src="https://forum.openredstone.org/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" /></div>
<br />
<span style="font-weight: bold;" class="mycode_b">Chapter 1 : Taylor Series </span><img src="https://forum.openredstone.org/images/smilies/cool.png" alt="Cool" title="Cool" class="smilie smilie_3" /><br />
<br />
for further information, look at the link.<br />
See : <a href="http://en.wikipedia.org/wiki/Taylor_series" target="_blank" rel="noopener" class="mycode_url">Sine Series</a><br />
<br />
With this series we have :<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp; 3<br />
x - ( --- * x&nbsp;&nbsp;)&nbsp;&nbsp;// with x in Radian !!!!<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 6</code></div></div>I voluntary stop at the 3rd power. Because, after, we have term in X^5 ... See what the mess it would be ^^.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Chapter 2 : Magic formula</span> <img src="https://forum.openredstone.org/images/smilies/huh.png" alt="Huh" title="Huh" class="smilie smilie_17" /><br />
<br />
I skip the formula transformation, see <a href="http://minecraft.fr/forum/index.php?threads/calculer-le-sinus-dun-angle.127607/" target="_blank" rel="noopener" class="mycode_url">official French topic</a> for further precision<br />
<br />
So, this is the final formula<br />
<img src="http://img4.hostingpics.net/pics/313317fonctionapprox2.jpg" alt="[Image: 313317fonctionapprox2.jpg]" class="mycode_img" /><br />
And what this function looks like ? Let see :<br />
<img src="http://img4.hostingpics.net/pics/260480Rsumdusinus.png" alt="[Image: 260480Rsumdusinus.png]" class="mycode_img" /><br />
<br />
What is the Floor ? <img src="https://forum.openredstone.org/images/smilies/rolleyes.png" alt="Rolleyes" title="Rolleyes" class="smilie smilie_6" /><br />
<br />
Floor() means that we take the integer portion of a division. Example: Floor(1,8) = 1 !<br />
<br />
I choose C=76 (the best curve),  and we have for precision something like that :<br />
<img src="http://img4.hostingpics.net/pics/113398Graphiquederreur.png" alt="[Image: 113398Graphiquederreur.png]" class="mycode_img" /><br />
The yellow curve represents the error due to the 8 bits resolution. See that Sin(87)=255... So not so good.<br />
<br />
And Minecraft with all this S*** ?<br />
<br />
A little example :<br />
<img src="http://img4.hostingpics.net/pics/44757220141001234453.png" alt="[Image: 44757220141001234453.png]" class="mycode_img" /><br />
A quick view<br />
<br />
<img src="http://img4.hostingpics.net/pics/28643020141001234549.png" alt="[Image: 28643020141001234549.png]" class="mycode_img" /><br />
down : the input (here = 32), and lamp up : the result in 8 bits (here = 134) ! <br />
(and if you do ArcSin(134 / 255) you will found : 31,7 ° ! AMAZING)<br />
<br />
You just have to divide the given value by 255 to have the truth sinus !]]></description>
			<content:encoded><![CDATA[<img src="http://img15.hostingpics.net/pics/586293ThundeRedResearchDepartment2.jpg" alt="[Image: 586293ThundeRedResearchDepartment2.jpg]" class="mycode_img" /><br />
<br />
<span style="font-size: x-large;" class="mycode_size"><div style="text-align: center;" class="mycode_align"><span style="color: #006400;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">Calculate the sine of an angle</span></span><br />
</div></span><div style="text-align: center;" class="mycode_align">(in combinatorial)</div>
<br />
Hello, it's Link !<br />
<br />
Today (or now...), I'm going to explain you how to calculate a sine. There is algorithme for this (like CORDIC), but I will show you how to do this in combinational.<br />
<br />
Important to know :<br />
<br />
We give a angle, and the system return a new value : The sine. But there some trouble you have to know :<br />
<ol type="1" class="mycode_list"><li>An angle can be given in radian or in degree,<br />
</li>
<li>The sine is always between -1 and 1. And, the floating number are very difficult to work with.<br />
</li>
<li>The precision of the system is very important. I'll show you my result below</li>
</ol>
Also in this condition, I will said those things for making the task easier for us :<br />
<ol type="1" class="mycode_list"><li>The input  value is between 0 and 90 (corresponding to the value in degrees)<br />
</li>
<li>For the sign, us an additional circuit<br />
</li>
<li>For deleting the float problem, the sine value will be given between 0 and 255 (8 bits). You have only to divide the given sine value by 255 and then you will have the true value <img src="https://forum.openredstone.org/images/smilies/smile.png" alt="Smile" title="Smile" class="smilie smilie_1" /></li>
</ol>
All right ? Then fallow me into the darkness world without any poney of :<br />
<br />
<div style="text-align: center;" class="mycode_align"><img src="https://forum.openredstone.org/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" /> <span style="color: #FF4500;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">Mathematics</span></span> <img src="https://forum.openredstone.org/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" /></div>
<br />
<span style="font-weight: bold;" class="mycode_b">Chapter 1 : Taylor Series </span><img src="https://forum.openredstone.org/images/smilies/cool.png" alt="Cool" title="Cool" class="smilie smilie_3" /><br />
<br />
for further information, look at the link.<br />
See : <a href="http://en.wikipedia.org/wiki/Taylor_series" target="_blank" rel="noopener" class="mycode_url">Sine Series</a><br />
<br />
With this series we have :<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp; 3<br />
x - ( --- * x&nbsp;&nbsp;)&nbsp;&nbsp;// with x in Radian !!!!<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 6</code></div></div>I voluntary stop at the 3rd power. Because, after, we have term in X^5 ... See what the mess it would be ^^.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Chapter 2 : Magic formula</span> <img src="https://forum.openredstone.org/images/smilies/huh.png" alt="Huh" title="Huh" class="smilie smilie_17" /><br />
<br />
I skip the formula transformation, see <a href="http://minecraft.fr/forum/index.php?threads/calculer-le-sinus-dun-angle.127607/" target="_blank" rel="noopener" class="mycode_url">official French topic</a> for further precision<br />
<br />
So, this is the final formula<br />
<img src="http://img4.hostingpics.net/pics/313317fonctionapprox2.jpg" alt="[Image: 313317fonctionapprox2.jpg]" class="mycode_img" /><br />
And what this function looks like ? Let see :<br />
<img src="http://img4.hostingpics.net/pics/260480Rsumdusinus.png" alt="[Image: 260480Rsumdusinus.png]" class="mycode_img" /><br />
<br />
What is the Floor ? <img src="https://forum.openredstone.org/images/smilies/rolleyes.png" alt="Rolleyes" title="Rolleyes" class="smilie smilie_6" /><br />
<br />
Floor() means that we take the integer portion of a division. Example: Floor(1,8) = 1 !<br />
<br />
I choose C=76 (the best curve),  and we have for precision something like that :<br />
<img src="http://img4.hostingpics.net/pics/113398Graphiquederreur.png" alt="[Image: 113398Graphiquederreur.png]" class="mycode_img" /><br />
The yellow curve represents the error due to the 8 bits resolution. See that Sin(87)=255... So not so good.<br />
<br />
And Minecraft with all this S*** ?<br />
<br />
A little example :<br />
<img src="http://img4.hostingpics.net/pics/44757220141001234453.png" alt="[Image: 44757220141001234453.png]" class="mycode_img" /><br />
A quick view<br />
<br />
<img src="http://img4.hostingpics.net/pics/28643020141001234549.png" alt="[Image: 28643020141001234549.png]" class="mycode_img" /><br />
down : the input (here = 32), and lamp up : the result in 8 bits (here = 134) ! <br />
(and if you do ArcSin(134 / 255) you will found : 31,7 ° ! AMAZING)<br />
<br />
You just have to divide the given value by 255 to have the truth sinus !]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Analog to Binary Conversion]]></title>
			<link>https://forum.openredstone.org/thread-3578.html</link>
			<pubDate>Wed, 21 May 2014 20:08:04 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.openredstone.org/member.php?action=profile&uid=739">Legofreak</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.openredstone.org/thread-3578.html</guid>
			<description><![CDATA[We all know how to convert binary to analog. It is simply subtracting/adding the values 8,4,2, and 1 to a line of comparators.<br />
<br />
When it comes to converting analog to binary, it is a bit more difficult.<br />
<br />
There are two kinds of conversion that I know of: <br />
1. get a single output from the analog and then decode it from there.<br />
or<br />
2. Logically process the analog signal.<br />
<br />
I'll try to go over both.<br />
<br />
<br />
Table Decoder<br />
This design is big, but is easy to understand and also easy to sync the outputs.<br />
<br />
First you need some kind of analog selector. This takes the analog signal and gives a single output among 15 lines. <br />
<br />
Second you need to hook up a decoder to the selector. depending on the output of the selector, the decoder will display the correct binary value which you have laid out(normally with torches).<br />
<br />
<br />
Logic Decoder<br />
This design involves using the compare and subtract functions of the comparator to get the desired result. It can be confusing but once you get it, it makes a lot of sense.<br />
<br />
There are 2 lines of comparators in this: a logic line, and a bypass line.<br />
First, you take the incoming signal and compare it to a value of 8. If its less than 8, the signal will be ignored and pass through the bypass comparator. If its 8 or more, it will pass through that comparator and make some things happen. It disables the bypass, displays a 1 in the 8s place, and sends the signal on through a comparator to subtract 8.<br />
<br />
The logic line is then reconnected with the bypass line and the process is repeated with values 4 and 2. <br />
<br />
After all 3 processes, the only possible leftover is 1, so you don't need to have a process for that. Just combine the lines after the 2 process , put a repeater on it, and there's your 1s place.<br />
<br />
Here's a block diagram I drew up in autocad for reference.<br />
<a href="http://smg.photobucket.com/user/legofreak1988/media/ana2binblock_zps5a1b39ec.png.html" target="_blank" rel="noopener" class="mycode_url"><img src="http://img.photobucket.com/albums/v191/legofreak1988/ana2binblock_zps5a1b39ec.png" alt="[Image: ana2binblock_zps5a1b39ec.png]" class="mycode_img" /></a><br />
You can also subtract from the bypass instead of having a separate comparator to subtract from.<br />
<br />
I hope this is informative. I know analog isn't very popular here but its my favorite subject in redstone.]]></description>
			<content:encoded><![CDATA[We all know how to convert binary to analog. It is simply subtracting/adding the values 8,4,2, and 1 to a line of comparators.<br />
<br />
When it comes to converting analog to binary, it is a bit more difficult.<br />
<br />
There are two kinds of conversion that I know of: <br />
1. get a single output from the analog and then decode it from there.<br />
or<br />
2. Logically process the analog signal.<br />
<br />
I'll try to go over both.<br />
<br />
<br />
Table Decoder<br />
This design is big, but is easy to understand and also easy to sync the outputs.<br />
<br />
First you need some kind of analog selector. This takes the analog signal and gives a single output among 15 lines. <br />
<br />
Second you need to hook up a decoder to the selector. depending on the output of the selector, the decoder will display the correct binary value which you have laid out(normally with torches).<br />
<br />
<br />
Logic Decoder<br />
This design involves using the compare and subtract functions of the comparator to get the desired result. It can be confusing but once you get it, it makes a lot of sense.<br />
<br />
There are 2 lines of comparators in this: a logic line, and a bypass line.<br />
First, you take the incoming signal and compare it to a value of 8. If its less than 8, the signal will be ignored and pass through the bypass comparator. If its 8 or more, it will pass through that comparator and make some things happen. It disables the bypass, displays a 1 in the 8s place, and sends the signal on through a comparator to subtract 8.<br />
<br />
The logic line is then reconnected with the bypass line and the process is repeated with values 4 and 2. <br />
<br />
After all 3 processes, the only possible leftover is 1, so you don't need to have a process for that. Just combine the lines after the 2 process , put a repeater on it, and there's your 1s place.<br />
<br />
Here's a block diagram I drew up in autocad for reference.<br />
<a href="http://smg.photobucket.com/user/legofreak1988/media/ana2binblock_zps5a1b39ec.png.html" target="_blank" rel="noopener" class="mycode_url"><img src="http://img.photobucket.com/albums/v191/legofreak1988/ana2binblock_zps5a1b39ec.png" alt="[Image: ana2binblock_zps5a1b39ec.png]" class="mycode_img" /></a><br />
You can also subtract from the bypass instead of having a separate comparator to subtract from.<br />
<br />
I hope this is informative. I know analog isn't very popular here but its my favorite subject in redstone.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[ACD (Analog Coded Decimal)]]></title>
			<link>https://forum.openredstone.org/thread-3262.html</link>
			<pubDate>Fri, 25 Apr 2014 23:32:22 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.openredstone.org/member.php?action=profile&uid=180">Chibill</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.openredstone.org/thread-3262.html</guid>
			<description><![CDATA[Analog Coded Decimal is a version of BCD I created because it is compact and can be converted from and to BCD with ease. It can also transmit Decimal.<br />
<br />
To convert from ACD to BCD is as simple a signal strength to 4 bit binary decoder.<br />
<br />
But it convert to ACD to BCD is a binary to signal strength converter.<br />
<br />
Now for ACD to Binary is a bit of a challenge because you must decode each line to is binary equivalent then add them all which I figure for a system that can count to 99 to be maybe 6 ticks.<br />
<br />
For Binary to ACD you need ether a loop that runs till its done or many subtractors. <br />
<br />
Because to get a number like 25 to be ACD from Binary you need to first subtract 20 but you ask how do we know what to subtract?<br />
<br />
Its simply a matter of starting at the highest you number in binary can be in tens then subtract if it is negative don't then go down by 10 and try again. If it is not negative disable all the other out puts.<br />
<br />
Then repeat for the ones.<br />
<br />
<br />
This has been a documentation by Chibill. Thank you for reading.<br />
<br />
More info on speeds and designs as I test and try them.]]></description>
			<content:encoded><![CDATA[Analog Coded Decimal is a version of BCD I created because it is compact and can be converted from and to BCD with ease. It can also transmit Decimal.<br />
<br />
To convert from ACD to BCD is as simple a signal strength to 4 bit binary decoder.<br />
<br />
But it convert to ACD to BCD is a binary to signal strength converter.<br />
<br />
Now for ACD to Binary is a bit of a challenge because you must decode each line to is binary equivalent then add them all which I figure for a system that can count to 99 to be maybe 6 ticks.<br />
<br />
For Binary to ACD you need ether a loop that runs till its done or many subtractors. <br />
<br />
Because to get a number like 25 to be ACD from Binary you need to first subtract 20 but you ask how do we know what to subtract?<br />
<br />
Its simply a matter of starting at the highest you number in binary can be in tens then subtract if it is negative don't then go down by 10 and try again. If it is not negative disable all the other out puts.<br />
<br />
Then repeat for the ones.<br />
<br />
<br />
This has been a documentation by Chibill. Thank you for reading.<br />
<br />
More info on speeds and designs as I test and try them.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Two's Complement: Conversion, Arithmetic and more]]></title>
			<link>https://forum.openredstone.org/thread-1788.html</link>
			<pubDate>Tue, 31 Dec 2013 01:20:48 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.openredstone.org/member.php?action=profile&uid=310">Iceglade</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.openredstone.org/thread-1788.html</guid>
			<description><![CDATA[So recently for the line algorithms in my upcoming GPU, I found myself requiring a two's complement adder. I sort of skated around building it because it seemed foreign and strange to me, and many of the tutorials I found gave me only a piece of the puzzle. Today I'd like to give you the whole picture all at once, in understandable terms for redstone. I'm still learning more advanced signed operations such as optimized comparison, subtraction, and mult/div, so this thread will be updated with tutorials as I myself learn the concepts.<br />
<br />
<br />
<br />
<span style="font-size: x-large;" class="mycode_size">What is two's complement?</span><br />
<br />
You've heard the term time and time again, you know it makes a number negative, but what really is two's complement? Two's complement is essentially an intuitive representation of a negative binary number with altered bits and a sign. Many devices, such as subtractors, natively return outputs in two's complement, which is why it is so widely used.<br />
<br />
<br />
<br />
<span style="font-size: x-large;" class="mycode_size">Conversions</span><br />
<br />
Note: Numbers' sign bits will be shown on every binary number I represent, as the first bit. It will be in italics. It's good to know that 0=positive and 1=negative.<br />
<br />
Let's say we have the <span style="font-weight: bold;" class="mycode_b">positive</span> binary number <span style="font-style: italic;" class="mycode_i">0</span>1010, and we want to negate it using the simple system of two's complement. This is a two-step process that you've probably heard all the time when making binary subtractors, which are actually just adding the two's complement negative. (Fun fact! <img src="https://forum.openredstone.org/images/smilies/smile.png" alt="Smile" title="Smile" class="smilie smilie_1" />)<br />
<br />
Well first let's figure out what <span style="font-style: italic;" class="mycode_i">0</span>1010 is in binary, 8+2=10 decimal, if you don't know binary then that's a definite prerequisite to two's complement. We've got a bunch of tutorials laying around the forums.<br />
<br />
Okay, so now we have our <span style="font-style: italic;" class="mycode_i">0</span>1010. Time for the process! It's the two-step subtractor process:<br />
<br />
1. Invert all the bits.<br />
2. Add 1.<br />
3. Profit!<br />
<br />
So let's do this with our 10 decimal. We start with <span style="font-style: italic;" class="mycode_i">0</span>1010, inverting all bits gives us <span style="font-style: italic;" class="mycode_i">1</span>0101. (Yes, we also invert the sign bit! Which makes sense, since we're just making the number negative.) Now, we can add 1:<br />
<br />
  <span style="font-style: italic;" class="mycode_i">1</span>0101<br />
+0001<br />
-------------<br />
<span style="font-style: italic;" class="mycode_i">1</span>0110<br />
<br />
And this answer is indeed <span style="font-style: italic;" class="mycode_i">0</span>1010 in two's complement! You can use this process to convert negative to positive as well.<br />
<br />
<br />
<br />
<span style="font-size: x-large;" class="mycode_size">Addition</span><br />
<br />
HEY! LISTEN! HEY!: You must must must know binary addition for this. I'm not going to explain the binary addition process for this, only how it applies to two's complement.<br />
<br />
Alright, so at first the concept of two's complement addition is a lot like regular binary addition that just includes the signs, with the COUT truncated. There's some extra crap that can happen, but if I could I would make all adders two's complement, because it completely eliminates the need to make seperate adders and subtractors... they're the same!<br />
<br />
So let's start by saying we want to add 7+(-3). Obviously, this simplifies to 7-3, so in the addition section we're already subtracting! Well, 7 in binary is <span style="font-style: italic;" class="mycode_i">0</span>111 and 3 is <span style="font-style: italic;" class="mycode_i">0</span>011.<br />
<br />
But we need to convert 3 to two's complement! Let's do that!<br />
<br />
<span style="font-style: italic;" class="mycode_i">0</span>011 --&gt; <span style="font-style: italic;" class="mycode_i">1</span>100 --&gt; <span style="font-style: italic;" class="mycode_i">1</span>101! That's just a simple conversion, obviously you should read conversions before this.<br />
<br />
Okay, so now let's add!<br />
<br />
­    <span style="font-style: italic;" class="mycode_i">0</span>111<br />
  +<span style="font-style: italic;" class="mycode_i">1</span>101<br />
  1<span style="font-style: italic;" class="mycode_i">0</span>100<br />
<br />
Wait... what? We just got 20... what just happened? Well, when adding two's complement we get this extra carry on the end that nobody cares about. We can simply get rid of the COUT 1 and get <span style="font-style: italic;" class="mycode_i">0</span>100. And that's positive 4, which is indeed 7-3. You can do this with most numbers, and you can literally implement this in redstone with little more than a simple adder. Just remember to use the signs in the addition and to discard the final COUT!<br />
<br />
But are we done? Well, sadly... no. ;-; We have a slight problem which I'll now show you. Let's do <span style="font-style: italic;" class="mycode_i">0</span>111+<span style="font-style: italic;" class="mycode_i">0</span>101.<br />
<br />
    <span style="font-style: italic;" class="mycode_i">0</span>111<br />
  +<span style="font-style: italic;" class="mycode_i">0</span>101<br />
        0<span style="font-style: italic;" class="mycode_i">1</span>100<br />
<br />
We take off the extra COUT and get <span style="font-style: italic;" class="mycode_i">1</span>100... and that's 12 in binary, right? But wait! Why is that one there in our sign spot! This is certainly not a negative number!<br />
<br />
And welcome to a very annoying part of two's complement arithmetic: sign extension. Basically, the idea is that if we add another extra bit to our number before the sign, the sign will stay in the sign spot and other things will stay out of it. Sign extension in two's complement is actually really easy: just copy the sign bit for all your extras. For instance:<br />
<br />
+9: <span style="font-style: italic;" class="mycode_i">0</span>1001 = <span style="font-style: italic;" class="mycode_i">0</span><span style="font-weight: bold;" class="mycode_b">0</span>1001<br />
In this example, we add an extra 0 (which is our sign).<br />
<br />
-9: <span style="font-style: italic;" class="mycode_i">1</span>1001 = <span style="font-style: italic;" class="mycode_i">1</span><span style="font-weight: bold;" class="mycode_b">1</span>1001<br />
In this example, we add an extra 1 (which is our sign).<br />
<br />
Alright, so let's do our sign extension and try our problem again.<br />
<br />
    <span style="font-style: italic;" class="mycode_i">0</span><span style="font-weight: bold;" class="mycode_b">0</span>111<br />
  +<span style="font-style: italic;" class="mycode_i">0</span><span style="font-weight: bold;" class="mycode_b">0</span>101<br />
    <span style="font-style: italic;" class="mycode_i">0</span><span style="font-weight: bold;" class="mycode_b">1</span>100<br />
<br />
And look at that, folks! Our extra 1 is now in a normal bit. Thus we have just created a perfect algorithm for redstone two's complement adders. To sum it up:<br />
<br />
A. Have two extra bits to the left both connected to the sign<br />
<br />
B. Ignore the final COUT<br />
<br />
Easy as they come! Because this is so simple, once again I'd like to recommend two's complement adders to be used everywhere due to their versatility. But that's just my thought.<br />
<br />
<br />
<br />
<span style="font-size: x-large;" class="mycode_size">Sign Extension Intuition</span><br />
<br />
Because I was having so much fun writing tutorial, I decided to do a quick intuition on why the whole sign extension idea works. To recap, sign extension in two's complement is just taking the sign and copying it over however many times. For instance:<br />
<br />
<span style="font-style: italic;" class="mycode_i">0</span>101 = 000...<span style="font-style: italic;" class="mycode_i">0</span>101<br />
<br />
<span style="font-style: italic;" class="mycode_i">1</span>101 = 111...<span style="font-style: italic;" class="mycode_i">1</span>101<br />
<br />
Well the first example is obvious, you can stick as many 0s at the front of a regular binary number as you want and it won't change. That's the easy part. But what about the second example? Well, we know that two's complement is pretty much an inverted form of a regular binary number, so if we convert that negative back to a positive all those extra 1s will become 0s when we invert.<br />
<br />
I don't know, just kinda felt like putting that in there.<br />
<br />
<br />
<br />
<span style="font-size: x-large;" class="mycode_size">Subtraction</span><br />
<br />
Well, if we can already add signed numbers, then we can add positive to negative. This gives us subtraction, so there's no need for a seperate two's complement subtraction.<br />
<br />
<br />
<br />
<span style="font-size: large;" class="mycode_size">More to come in the near future!</span>]]></description>
			<content:encoded><![CDATA[So recently for the line algorithms in my upcoming GPU, I found myself requiring a two's complement adder. I sort of skated around building it because it seemed foreign and strange to me, and many of the tutorials I found gave me only a piece of the puzzle. Today I'd like to give you the whole picture all at once, in understandable terms for redstone. I'm still learning more advanced signed operations such as optimized comparison, subtraction, and mult/div, so this thread will be updated with tutorials as I myself learn the concepts.<br />
<br />
<br />
<br />
<span style="font-size: x-large;" class="mycode_size">What is two's complement?</span><br />
<br />
You've heard the term time and time again, you know it makes a number negative, but what really is two's complement? Two's complement is essentially an intuitive representation of a negative binary number with altered bits and a sign. Many devices, such as subtractors, natively return outputs in two's complement, which is why it is so widely used.<br />
<br />
<br />
<br />
<span style="font-size: x-large;" class="mycode_size">Conversions</span><br />
<br />
Note: Numbers' sign bits will be shown on every binary number I represent, as the first bit. It will be in italics. It's good to know that 0=positive and 1=negative.<br />
<br />
Let's say we have the <span style="font-weight: bold;" class="mycode_b">positive</span> binary number <span style="font-style: italic;" class="mycode_i">0</span>1010, and we want to negate it using the simple system of two's complement. This is a two-step process that you've probably heard all the time when making binary subtractors, which are actually just adding the two's complement negative. (Fun fact! <img src="https://forum.openredstone.org/images/smilies/smile.png" alt="Smile" title="Smile" class="smilie smilie_1" />)<br />
<br />
Well first let's figure out what <span style="font-style: italic;" class="mycode_i">0</span>1010 is in binary, 8+2=10 decimal, if you don't know binary then that's a definite prerequisite to two's complement. We've got a bunch of tutorials laying around the forums.<br />
<br />
Okay, so now we have our <span style="font-style: italic;" class="mycode_i">0</span>1010. Time for the process! It's the two-step subtractor process:<br />
<br />
1. Invert all the bits.<br />
2. Add 1.<br />
3. Profit!<br />
<br />
So let's do this with our 10 decimal. We start with <span style="font-style: italic;" class="mycode_i">0</span>1010, inverting all bits gives us <span style="font-style: italic;" class="mycode_i">1</span>0101. (Yes, we also invert the sign bit! Which makes sense, since we're just making the number negative.) Now, we can add 1:<br />
<br />
  <span style="font-style: italic;" class="mycode_i">1</span>0101<br />
+0001<br />
-------------<br />
<span style="font-style: italic;" class="mycode_i">1</span>0110<br />
<br />
And this answer is indeed <span style="font-style: italic;" class="mycode_i">0</span>1010 in two's complement! You can use this process to convert negative to positive as well.<br />
<br />
<br />
<br />
<span style="font-size: x-large;" class="mycode_size">Addition</span><br />
<br />
HEY! LISTEN! HEY!: You must must must know binary addition for this. I'm not going to explain the binary addition process for this, only how it applies to two's complement.<br />
<br />
Alright, so at first the concept of two's complement addition is a lot like regular binary addition that just includes the signs, with the COUT truncated. There's some extra crap that can happen, but if I could I would make all adders two's complement, because it completely eliminates the need to make seperate adders and subtractors... they're the same!<br />
<br />
So let's start by saying we want to add 7+(-3). Obviously, this simplifies to 7-3, so in the addition section we're already subtracting! Well, 7 in binary is <span style="font-style: italic;" class="mycode_i">0</span>111 and 3 is <span style="font-style: italic;" class="mycode_i">0</span>011.<br />
<br />
But we need to convert 3 to two's complement! Let's do that!<br />
<br />
<span style="font-style: italic;" class="mycode_i">0</span>011 --&gt; <span style="font-style: italic;" class="mycode_i">1</span>100 --&gt; <span style="font-style: italic;" class="mycode_i">1</span>101! That's just a simple conversion, obviously you should read conversions before this.<br />
<br />
Okay, so now let's add!<br />
<br />
­    <span style="font-style: italic;" class="mycode_i">0</span>111<br />
  +<span style="font-style: italic;" class="mycode_i">1</span>101<br />
  1<span style="font-style: italic;" class="mycode_i">0</span>100<br />
<br />
Wait... what? We just got 20... what just happened? Well, when adding two's complement we get this extra carry on the end that nobody cares about. We can simply get rid of the COUT 1 and get <span style="font-style: italic;" class="mycode_i">0</span>100. And that's positive 4, which is indeed 7-3. You can do this with most numbers, and you can literally implement this in redstone with little more than a simple adder. Just remember to use the signs in the addition and to discard the final COUT!<br />
<br />
But are we done? Well, sadly... no. ;-; We have a slight problem which I'll now show you. Let's do <span style="font-style: italic;" class="mycode_i">0</span>111+<span style="font-style: italic;" class="mycode_i">0</span>101.<br />
<br />
    <span style="font-style: italic;" class="mycode_i">0</span>111<br />
  +<span style="font-style: italic;" class="mycode_i">0</span>101<br />
        0<span style="font-style: italic;" class="mycode_i">1</span>100<br />
<br />
We take off the extra COUT and get <span style="font-style: italic;" class="mycode_i">1</span>100... and that's 12 in binary, right? But wait! Why is that one there in our sign spot! This is certainly not a negative number!<br />
<br />
And welcome to a very annoying part of two's complement arithmetic: sign extension. Basically, the idea is that if we add another extra bit to our number before the sign, the sign will stay in the sign spot and other things will stay out of it. Sign extension in two's complement is actually really easy: just copy the sign bit for all your extras. For instance:<br />
<br />
+9: <span style="font-style: italic;" class="mycode_i">0</span>1001 = <span style="font-style: italic;" class="mycode_i">0</span><span style="font-weight: bold;" class="mycode_b">0</span>1001<br />
In this example, we add an extra 0 (which is our sign).<br />
<br />
-9: <span style="font-style: italic;" class="mycode_i">1</span>1001 = <span style="font-style: italic;" class="mycode_i">1</span><span style="font-weight: bold;" class="mycode_b">1</span>1001<br />
In this example, we add an extra 1 (which is our sign).<br />
<br />
Alright, so let's do our sign extension and try our problem again.<br />
<br />
    <span style="font-style: italic;" class="mycode_i">0</span><span style="font-weight: bold;" class="mycode_b">0</span>111<br />
  +<span style="font-style: italic;" class="mycode_i">0</span><span style="font-weight: bold;" class="mycode_b">0</span>101<br />
    <span style="font-style: italic;" class="mycode_i">0</span><span style="font-weight: bold;" class="mycode_b">1</span>100<br />
<br />
And look at that, folks! Our extra 1 is now in a normal bit. Thus we have just created a perfect algorithm for redstone two's complement adders. To sum it up:<br />
<br />
A. Have two extra bits to the left both connected to the sign<br />
<br />
B. Ignore the final COUT<br />
<br />
Easy as they come! Because this is so simple, once again I'd like to recommend two's complement adders to be used everywhere due to their versatility. But that's just my thought.<br />
<br />
<br />
<br />
<span style="font-size: x-large;" class="mycode_size">Sign Extension Intuition</span><br />
<br />
Because I was having so much fun writing tutorial, I decided to do a quick intuition on why the whole sign extension idea works. To recap, sign extension in two's complement is just taking the sign and copying it over however many times. For instance:<br />
<br />
<span style="font-style: italic;" class="mycode_i">0</span>101 = 000...<span style="font-style: italic;" class="mycode_i">0</span>101<br />
<br />
<span style="font-style: italic;" class="mycode_i">1</span>101 = 111...<span style="font-style: italic;" class="mycode_i">1</span>101<br />
<br />
Well the first example is obvious, you can stick as many 0s at the front of a regular binary number as you want and it won't change. That's the easy part. But what about the second example? Well, we know that two's complement is pretty much an inverted form of a regular binary number, so if we convert that negative back to a positive all those extra 1s will become 0s when we invert.<br />
<br />
I don't know, just kinda felt like putting that in there.<br />
<br />
<br />
<br />
<span style="font-size: x-large;" class="mycode_size">Subtraction</span><br />
<br />
Well, if we can already add signed numbers, then we can add positive to negative. This gives us subtraction, so there's no need for a seperate two's complement subtraction.<br />
<br />
<br />
<br />
<span style="font-size: large;" class="mycode_size">More to come in the near future!</span>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Principles of Analog (signal strength) Arithmetic]]></title>
			<link>https://forum.openredstone.org/thread-1680.html</link>
			<pubDate>Sun, 22 Dec 2013 10:23:40 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.openredstone.org/member.php?action=profile&uid=867">Hans_Lemurson</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.openredstone.org/thread-1680.html</guid>
			<description><![CDATA[<span style="font-size: large;" class="mycode_size">Note: This is a re-post of a topic of mine that I rescued from the old RDF forums.</span><br />
<br />
The ability to subtract the strength of one signal from another using a Comparator opens up the possibility of doing arithmetic and numerical manipulations by using the charge strength to encode a numerical value.  This, most of us know.  Knowing the possibility exists however is rather different from understanding how to manipulate the mechanics to create Arithmetic Devices.<br />
<br />
With the Comparator, we have a subtractor, but one of limited utility.  It's chief weakness is that it cannot produce negative numbers.  However, via clever manipulation and special configurations, it is possible to do more than just subtract.  The project I am working on right now is building a 4-wide analog adder, and in the process of design and refinement, I have made much use of the following arithmetic operations:<br />
<br />
<span style="font-size: 5pt;" class="mycode_size"><span style="font-weight: bold;" class="mycode_b">-Inversion</span></span><br />
To perform this operation, you subtract the current signal value "A" from 15.<br />
<span style="font-weight: bold;" class="mycode_b">15 - A = ~A</span><br />
You might wonder how you can perform inversion on positive non-binary numbers.  The answer is that you technically can't (you're taking the <span style="font-weight: bold;" class="mycode_b">complement</span>, but it doesn't matter because it's functionally equivalent to the uses of Inversion in Binary Arithmetic.<br />
<br />
Here is the table of complements: (can <span style="font-style: italic;" class="mycode_i">you</span> decipher the pattern?)<br />
0&lt;-&gt;15<br />
1&lt;-&gt;14<br />
2&lt;-&gt;13<br />
3&lt;-&gt;12<br />
4&lt;-&gt;11<br />
5&lt;-&gt;10<br />
6&lt;-&gt;9<br />
7&lt;-&gt;8<br />
<br />
It is interesting to note that if you look at the Binary representation of each of the Complement pairs, they are in fact the bitwise inverses of each other; Six (0110) and Nine (1001), for example.  This lends further justification to the functional equivalence of Inversion and Complement.  (It is important to note though that this equivalence holds even for numerical bases that are not readily converted into Binary, such as Decimal.)<br />
<br />
The important principle to keep in mind for conceptualizing Inversion/Complement is: <span style="font-weight: bold;" class="mycode_b">Big becomes Small, Small becomes Big</span>.  Seems trivial, but it's vital to allow you to keep track of what's going on in a circuit and why.<br />
<br />
<br />
<br />
<span style="font-size: 5pt;" class="mycode_size"><span style="font-weight: bold;" class="mycode_b">-Negation</span></span><br />
Inverting a number is mathematically the same as flipping the sign and subtracting 1.<br />
<span style="font-weight: bold;" class="mycode_b">~B = -B -1</span><br />
<span style="font-weight: bold;" class="mycode_b">-B = ~B +1</span><br />
<br />
These two equivalent equations are the mathematical basis that allows you to use Inversion to create Negative values (or make negative ones positive).  In many cases their utility will be merely conceptual, since <span style="font-weight: bold;" class="mycode_b">Comparators cannot yield negative numbers</span>.<br />
<br />
<br />
<span style="font-size: 5pt;" class="mycode_size"><span style="font-weight: bold;" class="mycode_b">-Addition</span></span><br />
Converting a Subtractor to an Adder requires Negating the "subtractant" input.  Negating a single input is done in ALUs all the time to turn an Adder into a Subtractor.  Fortunately, two negations cancel out, so the same tweaks that convert A+B into A-B can be used to turn A-B into A+B.<br />
There are two ways of doing this for adders:<br />
 A - B = A + ~B +1 (this isn't feasible since it requires addition in the first place which we don't have yet.)<br />
~(~A + B) = A - B (This is the one we'll use, when reconfigured for addition)<br />
<br />
You can indirectly Negate the B input by Inverting A and then Inverting the Output.  When applied to a subtraction operation (A-B) you get:<br />
<span style="font-weight: bold;" class="mycode_b">~(~A - B) = A + B</span><br />
<br />
Structurally, you have a Subtractor that lies between two Inverters.  I like to think of the 'between-two-Inverters' as <span style="font-weight: bold;" class="mycode_b">"The Negative Zone"</span> where any operation you perform has the opposite of it's normal effect.  Thus, performing Subtraction while in the "Negative Zone" results in addition.  Let's see it in action with an example:<br />
<br />
Suppose we want to do 8+5.  Let 8 be 'A' and 5 be 'B' (it works either way).<br />
~8 = 7<br />
7 - 5 = 2<br />
~2 = 13<br />
<br />
Thus, 8 + 5 = 13.  Crazy, huh?<br />
<br />
Let's try another example: 12 + 9!<br />
~12 = 3<br />
3 - 9 = 0  Uh-oh!  Comparators can't give negative numbers<br />
~0 = 15  Hmm...not looking good<br />
Thus 12 + 9 = 15.  This is not correct.  This is far from correct.  This is bad, since it's not uncommon when adding numbers that the result will exceed 15.  How do we deal with this?<br />
<br />
<span style="font-size: 5pt;" class="mycode_size"><span style="font-weight: bold;" class="mycode_b">-Overflow Sum</span></span><br />
You can't have negative signal strength values, and you can't have a signal strength that exceeds 15.  What do you do?  You use a second adder designed to handle exactly these cases!  One that can compute sums for values greater than 15 (and ONLY for greater than 15).<br />
<br />
The problem was that we were getting a negative number from subtraction, but as I'm sure you know, if you swap the values in subtraction, the answer is the negative of what it was before.<br />
<br />
Instead of doing (~A - B), we will do <span style="font-weight: bold;" class="mycode_b">(B - ~A)</span>.  (To swap the inputs on a Comparator, all you have to do is rotate it 90 degrees).<br />
<br />
Let's see how this works with that 12+9 example again:<br />
<br />
~12 = 3 (~A)<br />
9 - 3 = 6  <span style="font-weight: bold;" class="mycode_b">(B - ~A)</span><br />
...And then we keep the 6.  We're done here.  (B - ~A) is actually the value we want out of this.  Why?  <span style="font-weight: bold;" class="mycode_b">Because MATH!!!</span>  <br />
<br />
Remember the definition of Inversion in the first section?  <br />
<span style="font-weight: bold;" class="mycode_b">~A = 15 - A</span><br />
Substitute (15-A) for (~A)<br />
<br />
(B - ~A)<br />
(B -(15-A)) [substitute]<br />
(B - 15 + A) [distribute the negative]<br />
(A + B - 15) [re-arrange to look pretty]<br />
<br />
So...that answer of 6?  That's 12 + 9 - 15.  The -15 is vitally important here, since it reduces an answer of 21 (out of our range) to an answer of 6 (inside our range).  More importantly still, it's just 1 larger than the answer we need for the Sum when the addition produces a Carry.<br />
<br />
We're working with base16 here, so whenever you get a number like 21, which cannot fit within the 0-15 range, you have to split it into a 16 and a 5.  The 16 gets carried over the the next digit where it acts as a +1, and the 5 remains as the Sum for that digit.<br />
<br />
This means that the value for the Sum when A+B exceeds 15 is:<br />
<span style="font-weight: bold;" class="mycode_b">(A + B -16)</span><br />
This is 1 less than the result of (B-~A), but that's easy enough to fix since <span style="font-style: italic;" class="mycode_i">subtracting 1 is ridicuously easy</span> to do in Signal-Strength manipulation: Just make the wire 1 longer.<br />
<br />
This will be referred to as the "Modified Overflow Sum", for reasons which will become clear in a minute.  Unmodified, the Overflow Sum displays values 1-15.  Modified, it shows values 0-14.  This is not a problem, since the largest value a half-adder will encounter is 30 from 15+15, whose proper Sum is (30-16 =?) 14.<br />
<br />
<br />
<span style="font-size: 5pt;" class="mycode_size"><span style="font-weight: bold;" class="mycode_b">-Carrying</span></span><br />
(No algebra in this section, just design principles)<br />
In order to make a useful adding machine, you have to be able to send a "Carry" signal to the next digit.  Once you can generate a proper Sum and a Carry, then you have a <span style="font-weight: bold;" class="mycode_b">Half Adder</span>.<br />
<br />
Quite fortuitously, the unmodified Overflow Sum <span style="font-style: italic;" class="mycode_i">is</span> our "Carry" signal. It only ever yields a signal if the total is greater than 15...which is <span style="font-style: italic;" class="mycode_i">exactly</span> the situation when you have to carry.  How convenient!<br />
<br />
The Carry signal in this sort of adder though has to do more than just communicate with the next digit though.  Although we now have the ability to get the correct Sum for any set of inputs...we still have two different Sum outputs: the "Normal" and "Overflow" Sums.  This can't do!<br />
<br />
The Normal Sum should only give its output when the value is 15 or less.  If it is more than 15, then it needs to kindly STFU, since it's stuck blaring a full-strength signal as it's output.  We can't use that!  In yet another piece of convenience, whenever the Normal Sum becomes irrelevant...that's when you have to Carry!  This means that you can use the Carry Signal to disable the Normal Sum whenever A+B&gt;15.  (How you go about doing this is the personal choice of the engineer)<br />
<br />
Once you have the Normal-Sum properly controlled, you can then just join the Normal and and Overflow sums together in one SUM wire for the output.  The Overflow won't cause any problems, since it just outputs a 0 whenever the value is 15 or less.<br />
<br />
Once you have all these things in place, then you've got yourself a <span style="font-weight: bold;" class="mycode_b">Half Adder</span>, my friend!<br />
<br />
You should be able to figure out how to go and make a Full-Adder out of Half-Adders.  I'm not going to explain that here, since this is kinda long already, and all I was trying to do was explain how you manipulate "Analog" signals to do Addition.<br />
<br />
<br />
<span style="font-size: 5pt;" class="mycode_size"><span style="font-weight: bold;" class="mycode_b">Conclusion</span></span><br />
So that's my attempt so far at an algebraic explanation of how Analog Adders can be made from Subtractors (without the use of negative numbers).<br />
<br />
And if I stop being a lazy bum, I might even include pictures at some point!<br />
<span style="font-weight: bold;" class="mycode_b">Note: 11 months later and I am still a lazy bum.</span>]]></description>
			<content:encoded><![CDATA[<span style="font-size: large;" class="mycode_size">Note: This is a re-post of a topic of mine that I rescued from the old RDF forums.</span><br />
<br />
The ability to subtract the strength of one signal from another using a Comparator opens up the possibility of doing arithmetic and numerical manipulations by using the charge strength to encode a numerical value.  This, most of us know.  Knowing the possibility exists however is rather different from understanding how to manipulate the mechanics to create Arithmetic Devices.<br />
<br />
With the Comparator, we have a subtractor, but one of limited utility.  It's chief weakness is that it cannot produce negative numbers.  However, via clever manipulation and special configurations, it is possible to do more than just subtract.  The project I am working on right now is building a 4-wide analog adder, and in the process of design and refinement, I have made much use of the following arithmetic operations:<br />
<br />
<span style="font-size: 5pt;" class="mycode_size"><span style="font-weight: bold;" class="mycode_b">-Inversion</span></span><br />
To perform this operation, you subtract the current signal value "A" from 15.<br />
<span style="font-weight: bold;" class="mycode_b">15 - A = ~A</span><br />
You might wonder how you can perform inversion on positive non-binary numbers.  The answer is that you technically can't (you're taking the <span style="font-weight: bold;" class="mycode_b">complement</span>, but it doesn't matter because it's functionally equivalent to the uses of Inversion in Binary Arithmetic.<br />
<br />
Here is the table of complements: (can <span style="font-style: italic;" class="mycode_i">you</span> decipher the pattern?)<br />
0&lt;-&gt;15<br />
1&lt;-&gt;14<br />
2&lt;-&gt;13<br />
3&lt;-&gt;12<br />
4&lt;-&gt;11<br />
5&lt;-&gt;10<br />
6&lt;-&gt;9<br />
7&lt;-&gt;8<br />
<br />
It is interesting to note that if you look at the Binary representation of each of the Complement pairs, they are in fact the bitwise inverses of each other; Six (0110) and Nine (1001), for example.  This lends further justification to the functional equivalence of Inversion and Complement.  (It is important to note though that this equivalence holds even for numerical bases that are not readily converted into Binary, such as Decimal.)<br />
<br />
The important principle to keep in mind for conceptualizing Inversion/Complement is: <span style="font-weight: bold;" class="mycode_b">Big becomes Small, Small becomes Big</span>.  Seems trivial, but it's vital to allow you to keep track of what's going on in a circuit and why.<br />
<br />
<br />
<br />
<span style="font-size: 5pt;" class="mycode_size"><span style="font-weight: bold;" class="mycode_b">-Negation</span></span><br />
Inverting a number is mathematically the same as flipping the sign and subtracting 1.<br />
<span style="font-weight: bold;" class="mycode_b">~B = -B -1</span><br />
<span style="font-weight: bold;" class="mycode_b">-B = ~B +1</span><br />
<br />
These two equivalent equations are the mathematical basis that allows you to use Inversion to create Negative values (or make negative ones positive).  In many cases their utility will be merely conceptual, since <span style="font-weight: bold;" class="mycode_b">Comparators cannot yield negative numbers</span>.<br />
<br />
<br />
<span style="font-size: 5pt;" class="mycode_size"><span style="font-weight: bold;" class="mycode_b">-Addition</span></span><br />
Converting a Subtractor to an Adder requires Negating the "subtractant" input.  Negating a single input is done in ALUs all the time to turn an Adder into a Subtractor.  Fortunately, two negations cancel out, so the same tweaks that convert A+B into A-B can be used to turn A-B into A+B.<br />
There are two ways of doing this for adders:<br />
 A - B = A + ~B +1 (this isn't feasible since it requires addition in the first place which we don't have yet.)<br />
~(~A + B) = A - B (This is the one we'll use, when reconfigured for addition)<br />
<br />
You can indirectly Negate the B input by Inverting A and then Inverting the Output.  When applied to a subtraction operation (A-B) you get:<br />
<span style="font-weight: bold;" class="mycode_b">~(~A - B) = A + B</span><br />
<br />
Structurally, you have a Subtractor that lies between two Inverters.  I like to think of the 'between-two-Inverters' as <span style="font-weight: bold;" class="mycode_b">"The Negative Zone"</span> where any operation you perform has the opposite of it's normal effect.  Thus, performing Subtraction while in the "Negative Zone" results in addition.  Let's see it in action with an example:<br />
<br />
Suppose we want to do 8+5.  Let 8 be 'A' and 5 be 'B' (it works either way).<br />
~8 = 7<br />
7 - 5 = 2<br />
~2 = 13<br />
<br />
Thus, 8 + 5 = 13.  Crazy, huh?<br />
<br />
Let's try another example: 12 + 9!<br />
~12 = 3<br />
3 - 9 = 0  Uh-oh!  Comparators can't give negative numbers<br />
~0 = 15  Hmm...not looking good<br />
Thus 12 + 9 = 15.  This is not correct.  This is far from correct.  This is bad, since it's not uncommon when adding numbers that the result will exceed 15.  How do we deal with this?<br />
<br />
<span style="font-size: 5pt;" class="mycode_size"><span style="font-weight: bold;" class="mycode_b">-Overflow Sum</span></span><br />
You can't have negative signal strength values, and you can't have a signal strength that exceeds 15.  What do you do?  You use a second adder designed to handle exactly these cases!  One that can compute sums for values greater than 15 (and ONLY for greater than 15).<br />
<br />
The problem was that we were getting a negative number from subtraction, but as I'm sure you know, if you swap the values in subtraction, the answer is the negative of what it was before.<br />
<br />
Instead of doing (~A - B), we will do <span style="font-weight: bold;" class="mycode_b">(B - ~A)</span>.  (To swap the inputs on a Comparator, all you have to do is rotate it 90 degrees).<br />
<br />
Let's see how this works with that 12+9 example again:<br />
<br />
~12 = 3 (~A)<br />
9 - 3 = 6  <span style="font-weight: bold;" class="mycode_b">(B - ~A)</span><br />
...And then we keep the 6.  We're done here.  (B - ~A) is actually the value we want out of this.  Why?  <span style="font-weight: bold;" class="mycode_b">Because MATH!!!</span>  <br />
<br />
Remember the definition of Inversion in the first section?  <br />
<span style="font-weight: bold;" class="mycode_b">~A = 15 - A</span><br />
Substitute (15-A) for (~A)<br />
<br />
(B - ~A)<br />
(B -(15-A)) [substitute]<br />
(B - 15 + A) [distribute the negative]<br />
(A + B - 15) [re-arrange to look pretty]<br />
<br />
So...that answer of 6?  That's 12 + 9 - 15.  The -15 is vitally important here, since it reduces an answer of 21 (out of our range) to an answer of 6 (inside our range).  More importantly still, it's just 1 larger than the answer we need for the Sum when the addition produces a Carry.<br />
<br />
We're working with base16 here, so whenever you get a number like 21, which cannot fit within the 0-15 range, you have to split it into a 16 and a 5.  The 16 gets carried over the the next digit where it acts as a +1, and the 5 remains as the Sum for that digit.<br />
<br />
This means that the value for the Sum when A+B exceeds 15 is:<br />
<span style="font-weight: bold;" class="mycode_b">(A + B -16)</span><br />
This is 1 less than the result of (B-~A), but that's easy enough to fix since <span style="font-style: italic;" class="mycode_i">subtracting 1 is ridicuously easy</span> to do in Signal-Strength manipulation: Just make the wire 1 longer.<br />
<br />
This will be referred to as the "Modified Overflow Sum", for reasons which will become clear in a minute.  Unmodified, the Overflow Sum displays values 1-15.  Modified, it shows values 0-14.  This is not a problem, since the largest value a half-adder will encounter is 30 from 15+15, whose proper Sum is (30-16 =?) 14.<br />
<br />
<br />
<span style="font-size: 5pt;" class="mycode_size"><span style="font-weight: bold;" class="mycode_b">-Carrying</span></span><br />
(No algebra in this section, just design principles)<br />
In order to make a useful adding machine, you have to be able to send a "Carry" signal to the next digit.  Once you can generate a proper Sum and a Carry, then you have a <span style="font-weight: bold;" class="mycode_b">Half Adder</span>.<br />
<br />
Quite fortuitously, the unmodified Overflow Sum <span style="font-style: italic;" class="mycode_i">is</span> our "Carry" signal. It only ever yields a signal if the total is greater than 15...which is <span style="font-style: italic;" class="mycode_i">exactly</span> the situation when you have to carry.  How convenient!<br />
<br />
The Carry signal in this sort of adder though has to do more than just communicate with the next digit though.  Although we now have the ability to get the correct Sum for any set of inputs...we still have two different Sum outputs: the "Normal" and "Overflow" Sums.  This can't do!<br />
<br />
The Normal Sum should only give its output when the value is 15 or less.  If it is more than 15, then it needs to kindly STFU, since it's stuck blaring a full-strength signal as it's output.  We can't use that!  In yet another piece of convenience, whenever the Normal Sum becomes irrelevant...that's when you have to Carry!  This means that you can use the Carry Signal to disable the Normal Sum whenever A+B&gt;15.  (How you go about doing this is the personal choice of the engineer)<br />
<br />
Once you have the Normal-Sum properly controlled, you can then just join the Normal and and Overflow sums together in one SUM wire for the output.  The Overflow won't cause any problems, since it just outputs a 0 whenever the value is 15 or less.<br />
<br />
Once you have all these things in place, then you've got yourself a <span style="font-weight: bold;" class="mycode_b">Half Adder</span>, my friend!<br />
<br />
You should be able to figure out how to go and make a Full-Adder out of Half-Adders.  I'm not going to explain that here, since this is kinda long already, and all I was trying to do was explain how you manipulate "Analog" signals to do Addition.<br />
<br />
<br />
<span style="font-size: 5pt;" class="mycode_size"><span style="font-weight: bold;" class="mycode_b">Conclusion</span></span><br />
So that's my attempt so far at an algebraic explanation of how Analog Adders can be made from Subtractors (without the use of negative numbers).<br />
<br />
And if I stop being a lazy bum, I might even include pictures at some point!<br />
<span style="font-weight: bold;" class="mycode_b">Note: 11 months later and I am still a lazy bum.</span>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[PLA, KSA CSA, and PLA losgism files]]></title>
			<link>https://forum.openredstone.org/thread-1654.html</link>
			<pubDate>Fri, 20 Dec 2013 14:51:17 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.openredstone.org/member.php?action=profile&uid=43">EDevil</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.openredstone.org/thread-1654.html</guid>
			<description><![CDATA[I've made schematics of these adders in losigm;<ul class="mycode_list"><li>LFA: Ladner Fisher Adder<br />
</li>
<li>KSA: Kogge Stone Adder<br />
</li>
<li>CSA: Carry Save Adder<br />
</li>
<li>PLA: Proper Look Ahead<br />
</li>
</ul>
<br />
I would like to point out that the CSA and the KSA are both completely optional, and would really only recommend LFA and PLA. Because i like knowing how every type of adder works, i also made these other 2.<br />
<br />
Anyhow, you can find the schematics <a href="https://dl.dropboxusercontent.com/u/28579324/Logism.zip" target="_blank" rel="noopener" class="mycode_url">here</a>.<br />
<br />
Good luck!]]></description>
			<content:encoded><![CDATA[I've made schematics of these adders in losigm;<ul class="mycode_list"><li>LFA: Ladner Fisher Adder<br />
</li>
<li>KSA: Kogge Stone Adder<br />
</li>
<li>CSA: Carry Save Adder<br />
</li>
<li>PLA: Proper Look Ahead<br />
</li>
</ul>
<br />
I would like to point out that the CSA and the KSA are both completely optional, and would really only recommend LFA and PLA. Because i like knowing how every type of adder works, i also made these other 2.<br />
<br />
Anyhow, you can find the schematics <a href="https://dl.dropboxusercontent.com/u/28579324/Logism.zip" target="_blank" rel="noopener" class="mycode_url">here</a>.<br />
<br />
Good luck!]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Carry Look-Everywhere Addition [Text + Images] [My first tutorial]]]></title>
			<link>https://forum.openredstone.org/thread-1482.html</link>
			<pubDate>Wed, 04 Dec 2013 00:12:57 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.openredstone.org/member.php?action=profile&uid=123">AFtExploision</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.openredstone.org/thread-1482.html</guid>
			<description><![CDATA[Note: This assumes you know binary logic gates and Ripple-Carry addition<br />
------------------------------------------------------------------------<br />
     Carry Look-Everywhere Addition (CLE) is a Minecraft optimized carry-look ahead adder. But what is CLA (Carry Look-Ahead)?<br />
------------------------------------------------------------------------<br />
    CLA is an adder that calculates carry at the same time as the sum, unlike RCA, where it is sum-carry rippling through the adders.  <br />
    The first component of CLA is the half-adder.  This is just an XOR and AND gate on the same two input lines. We'll call the XOR's output Pn and the AND's output Gn where n is the number of the half-adder, starting at 0.<br />
     So, we have the first part of the adder.  Now how can we calculate sums with CLA using them?<br />
    Well, lets start at the carry calculation.  For the first bit, bit 0 (in computers you start counting at 0, not 1), the only possible way to get a carry input is through Cin.  So, the sum for the first bit (S0) is:<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>S0 = P0 xor Cin</code></div></div>   Remember, P0 is the output of the XOR gate of the half-adder. So, basically it is:<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>s0 = (A0 XOR B0) xor Cin</code></div></div>the same as RCA.  Simple right?<br />
    In fact, the sum of bit 'n' is:<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>Sn = Pn xor C(n-1)</code></div></div>where C(n-1) is the carry for the bit before bit 'n.' (For the first bit, C(n-1) is just Cin)<br />
     So far, this is the same as RCA.  What's the difference?  The difference is how C, the carry is calculated.  In RCA you need to calculate the bit before to get the carry value, but in CLA you can calculate the value of all carries at the same time.  Using equations (where the terms are next to each other is AND, a + is OR) you can get C0:<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>C0 = P0Cin + G0</code></div></div>How do you arrive here?  Well for bit 0, when can you generate a carry?  When one input is on (P0, xors are only on with one input, remember?) AND when it receives a carry in signal (which for bit 0 is just Cin) OR when both inputs are on (When both inputs are on, the carry-in doesn't effect the carry calculation. Remember G0 is the AND of both inputs).<br />
     OK, so for CLA carry calculations you OR together all possible combinations.  Sounds hard to keep track of it all? Well, here is the equation for bit 1...<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>C1 = P1P0Cin + P1G0 + G1</code></div></div>Looking familiar? Yes, the carry calculations for bit 1 is all the terms from the carry calculation with an extra AND P1 added, OR'd with a G1.  Why is this? Think about it.  The terms for C0 tell you when you get a carry from bit 0.  So, how do you calculate a carry from a carry-in? You AND it with the P output.  So the "P1P0Cin + P1G0" is just AND'ing the possible carry-ins and adding a + 'Gn'.  So, the carry calculation for any bit n can be found by taking the calculation for bit n-1, AND'ing a 'Pn' with the terms, and adding a '+ Gn', all the way to bit 0, where again,<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>C0 = P0Cin + G0</code></div></div>Why is this better than RCA? Well, for calculating carries you do NOT have to wait for the sum of the last bit to finish, only the P's, which, if you built your half-adders correctly, are sync'ed.  This allows all the sums to be calculated faster, especially the ones near the end of the adder, where in RCA they would have to wait for the signal to 'ripple' to them.  <br />
----------------------------------------------------------------------<br />
     So, that is CLA.  But what is CLE and why is it MC optimized?  CLE is the exact same as in it follows the same logic, but different in that carries use the same line.  Let me explain.  In CLA, even though bit 0 and bit 1 both use the term 'Cin' to calculate their carries, there are different lines from Cin to the bits.  In CLE, they use the same line.  In this example, bit 0 would have P0Cin going into its carry line, but, with an instant diode or something of the sort.  So then, we have a line for P0Cin.  We add another instant diode (like glowstone) and wire it to bit 1.  Here, we and P1 with P0Cin to git P1P0Cin.  Because of the instant diode, it does not interfere with the calculations for bit 0's carry, and because of the instant diode from P0Cin to the carry line of bit 0, the rest of the possible carries does not interfere with P0Cin.  This continues for the rest of the adder.  Every new bit, one new term that can carry is added, but, we do the same for these.  A practical way to do this is to Invert Cin, Invert P0, then use that line as the place for the instant diode to branch off.  Then on bit 1, we connect an inverted P1 to the line and instant diode off to bit 2, and so on.  Then, on each bit, we invert this signal to input to the carry line.  This works on the idea that AND gates are just inverters, ORs, and another inverter.  On the first bit, we invert the two inputs on the AND then or them.  Next, we invert it to get P0 AND Cin.  However, because we carry the inverted line, when we combine with P1 and invert for bit 1's carry line, we are basically making a big AND gate of P1, P0 and Cin that does not interfere with the first AND, and so on.  <br />
----------------------------------------------------------------------<br />
      Here is an example of the carries from Newomaster's CLE:<br />
<img src="http://i.imgur.com/wLwCD9B.png" alt="[Image: wLwCD9B.png]" class="mycode_img" /> The carry lines<br />
<img src="http://i.imgur.com/PLw97RY.png" alt="[Image: PLw97RY.png]" class="mycode_img" /> The inverted Cin, the only thing needed to calculate carry for bit 0<br />
<img src="http://i.imgur.com/do4Ry36.png" alt="[Image: do4Ry36.png]" class="mycode_img" /> Using half-slab insta diodes to carry the inverted Cin up to other carry lines<br />
<img src="http://i.imgur.com/p5ZqSoe.png" alt="[Image: p5ZqSoe.png]" class="mycode_img" /> The gold block substitutes for P0. There is a torch on the other side to invert it and add it to the slab line.<br />
<img src="http://i.imgur.com/nms3Jwp.png" alt="[Image: nms3Jwp.png]" class="mycode_img" /> We do the same for the rest of the bits.<br />
<img src="http://i.imgur.com/uZU0yqC.png" alt="[Image: uZU0yqC.png]" class="mycode_img" /> Now, for the G0, which goes to the line for bit 1.  This is the start, so the torch represents an inverted G0 going in.<br />
<img src="http://i.imgur.com/3cuOaaX.png" alt="[Image: 3cuOaaX.png]" class="mycode_img" /> Now we do the slab tower and torches. Wait for what we do with these.<br />
<img src="http://i.imgur.com/naP8Xy7.png" alt="[Image: naP8Xy7.png]" class="mycode_img" /> Finish this up for the rest of the terms....<br />
<img src="http://i.imgur.com/ZQ9smtp.png" alt="[Image: ZQ9smtp.png]" class="mycode_img" /> Here we connect the torches in the horizontals. This is because the horizontals are all the same 'Pn" term. <br />
     This example is 4 bits, the 5th carry line is the Cout of the adder.  We would XOR each of these lines with their respective P to get the sum.]]></description>
			<content:encoded><![CDATA[Note: This assumes you know binary logic gates and Ripple-Carry addition<br />
------------------------------------------------------------------------<br />
     Carry Look-Everywhere Addition (CLE) is a Minecraft optimized carry-look ahead adder. But what is CLA (Carry Look-Ahead)?<br />
------------------------------------------------------------------------<br />
    CLA is an adder that calculates carry at the same time as the sum, unlike RCA, where it is sum-carry rippling through the adders.  <br />
    The first component of CLA is the half-adder.  This is just an XOR and AND gate on the same two input lines. We'll call the XOR's output Pn and the AND's output Gn where n is the number of the half-adder, starting at 0.<br />
     So, we have the first part of the adder.  Now how can we calculate sums with CLA using them?<br />
    Well, lets start at the carry calculation.  For the first bit, bit 0 (in computers you start counting at 0, not 1), the only possible way to get a carry input is through Cin.  So, the sum for the first bit (S0) is:<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>S0 = P0 xor Cin</code></div></div>   Remember, P0 is the output of the XOR gate of the half-adder. So, basically it is:<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>s0 = (A0 XOR B0) xor Cin</code></div></div>the same as RCA.  Simple right?<br />
    In fact, the sum of bit 'n' is:<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>Sn = Pn xor C(n-1)</code></div></div>where C(n-1) is the carry for the bit before bit 'n.' (For the first bit, C(n-1) is just Cin)<br />
     So far, this is the same as RCA.  What's the difference?  The difference is how C, the carry is calculated.  In RCA you need to calculate the bit before to get the carry value, but in CLA you can calculate the value of all carries at the same time.  Using equations (where the terms are next to each other is AND, a + is OR) you can get C0:<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>C0 = P0Cin + G0</code></div></div>How do you arrive here?  Well for bit 0, when can you generate a carry?  When one input is on (P0, xors are only on with one input, remember?) AND when it receives a carry in signal (which for bit 0 is just Cin) OR when both inputs are on (When both inputs are on, the carry-in doesn't effect the carry calculation. Remember G0 is the AND of both inputs).<br />
     OK, so for CLA carry calculations you OR together all possible combinations.  Sounds hard to keep track of it all? Well, here is the equation for bit 1...<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>C1 = P1P0Cin + P1G0 + G1</code></div></div>Looking familiar? Yes, the carry calculations for bit 1 is all the terms from the carry calculation with an extra AND P1 added, OR'd with a G1.  Why is this? Think about it.  The terms for C0 tell you when you get a carry from bit 0.  So, how do you calculate a carry from a carry-in? You AND it with the P output.  So the "P1P0Cin + P1G0" is just AND'ing the possible carry-ins and adding a + 'Gn'.  So, the carry calculation for any bit n can be found by taking the calculation for bit n-1, AND'ing a 'Pn' with the terms, and adding a '+ Gn', all the way to bit 0, where again,<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>C0 = P0Cin + G0</code></div></div>Why is this better than RCA? Well, for calculating carries you do NOT have to wait for the sum of the last bit to finish, only the P's, which, if you built your half-adders correctly, are sync'ed.  This allows all the sums to be calculated faster, especially the ones near the end of the adder, where in RCA they would have to wait for the signal to 'ripple' to them.  <br />
----------------------------------------------------------------------<br />
     So, that is CLA.  But what is CLE and why is it MC optimized?  CLE is the exact same as in it follows the same logic, but different in that carries use the same line.  Let me explain.  In CLA, even though bit 0 and bit 1 both use the term 'Cin' to calculate their carries, there are different lines from Cin to the bits.  In CLE, they use the same line.  In this example, bit 0 would have P0Cin going into its carry line, but, with an instant diode or something of the sort.  So then, we have a line for P0Cin.  We add another instant diode (like glowstone) and wire it to bit 1.  Here, we and P1 with P0Cin to git P1P0Cin.  Because of the instant diode, it does not interfere with the calculations for bit 0's carry, and because of the instant diode from P0Cin to the carry line of bit 0, the rest of the possible carries does not interfere with P0Cin.  This continues for the rest of the adder.  Every new bit, one new term that can carry is added, but, we do the same for these.  A practical way to do this is to Invert Cin, Invert P0, then use that line as the place for the instant diode to branch off.  Then on bit 1, we connect an inverted P1 to the line and instant diode off to bit 2, and so on.  Then, on each bit, we invert this signal to input to the carry line.  This works on the idea that AND gates are just inverters, ORs, and another inverter.  On the first bit, we invert the two inputs on the AND then or them.  Next, we invert it to get P0 AND Cin.  However, because we carry the inverted line, when we combine with P1 and invert for bit 1's carry line, we are basically making a big AND gate of P1, P0 and Cin that does not interfere with the first AND, and so on.  <br />
----------------------------------------------------------------------<br />
      Here is an example of the carries from Newomaster's CLE:<br />
<img src="http://i.imgur.com/wLwCD9B.png" alt="[Image: wLwCD9B.png]" class="mycode_img" /> The carry lines<br />
<img src="http://i.imgur.com/PLw97RY.png" alt="[Image: PLw97RY.png]" class="mycode_img" /> The inverted Cin, the only thing needed to calculate carry for bit 0<br />
<img src="http://i.imgur.com/do4Ry36.png" alt="[Image: do4Ry36.png]" class="mycode_img" /> Using half-slab insta diodes to carry the inverted Cin up to other carry lines<br />
<img src="http://i.imgur.com/p5ZqSoe.png" alt="[Image: p5ZqSoe.png]" class="mycode_img" /> The gold block substitutes for P0. There is a torch on the other side to invert it and add it to the slab line.<br />
<img src="http://i.imgur.com/nms3Jwp.png" alt="[Image: nms3Jwp.png]" class="mycode_img" /> We do the same for the rest of the bits.<br />
<img src="http://i.imgur.com/uZU0yqC.png" alt="[Image: uZU0yqC.png]" class="mycode_img" /> Now, for the G0, which goes to the line for bit 1.  This is the start, so the torch represents an inverted G0 going in.<br />
<img src="http://i.imgur.com/3cuOaaX.png" alt="[Image: 3cuOaaX.png]" class="mycode_img" /> Now we do the slab tower and torches. Wait for what we do with these.<br />
<img src="http://i.imgur.com/naP8Xy7.png" alt="[Image: naP8Xy7.png]" class="mycode_img" /> Finish this up for the rest of the terms....<br />
<img src="http://i.imgur.com/ZQ9smtp.png" alt="[Image: ZQ9smtp.png]" class="mycode_img" /> Here we connect the torches in the horizontals. This is because the horizontals are all the same 'Pn" term. <br />
     This example is 4 bits, the 5th carry line is the Cout of the adder.  We would XOR each of these lines with their respective P to get the sum.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Line Drawing]]></title>
			<link>https://forum.openredstone.org/thread-1461.html</link>
			<pubDate>Sun, 01 Dec 2013 18:21:15 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.openredstone.org/member.php?action=profile&uid=5">Guy1234567890</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.openredstone.org/thread-1461.html</guid>
			<description><![CDATA[<iframe width="560" height="315" src="//www.youtube.com/embed/VCii4EiCJ2M" frameborder="0" allowfullscreen></iframe>]]></description>
			<content:encoded><![CDATA[<iframe width="560" height="315" src="//www.youtube.com/embed/VCii4EiCJ2M" frameborder="0" allowfullscreen></iframe>]]></content:encoded>
		</item>
	</channel>
</rss>