<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
><channel><title>Talk Binary &#187; ADD</title> <atom:link href="http://talkbinary.com/tag/add/feed/" rel="self" type="application/rss+xml" /><link>http://talkbinary.com</link> <description>Programming Resources, Technology, Computers</description> <lastBuildDate>Fri, 30 Jul 2010 18:22:57 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.0.1</generator> <item><title>LC-3 Operations</title><link>http://talkbinary.com/programming/lc-3/lc-3-operations/</link> <comments>http://talkbinary.com/programming/lc-3/lc-3-operations/#comments</comments> <pubDate>Sat, 11 Oct 2008 23:17:52 +0000</pubDate> <dc:creator>Diego</dc:creator> <category><![CDATA[LC-3]]></category> <category><![CDATA[ADD]]></category> <category><![CDATA[AND]]></category> <category><![CDATA[Destination]]></category> <category><![CDATA[LC-3 Operations]]></category> <category><![CDATA[NOT]]></category> <category><![CDATA[Registers]]></category> <category><![CDATA[Truth Tables]]></category><guid
isPermaLink="false">http://talkbinary.com/?p=1247</guid> <description><![CDATA[LC-3 has three type of operations: ADD, AND, and NOT. I&#8217;ll describe them below with an accompanying Truth Table if necessary. *Note: I&#8217;ll be accompanying this with an intro to the LC-3 Programming Environment soon&#8230;This was merely posted for those who needed help with their CS course. I&#8217;ll post the remaining guides soon&#8230; First of [...]]]></description> <content:encoded><![CDATA[<p>LC-3 has three type of operations: ADD, AND, and NOT. I&#8217;ll describe them below with an accompanying Truth Table if necessary.</p><p>*Note: I&#8217;ll be accompanying this with an intro to the LC-3 Programming Environment soon&#8230;This was merely posted for those who needed help with their CS course. I&#8217;ll post the remaining guides soon&#8230;</p><p>First of all before we begin, let&#8217;s say these registers hold the following values&#8230;</p><p>R2 = 10<br
/> R3 = 15<br
/> R4 = 1;</p><h3>The ADD Operation</h3><p>The first ADD operation allows you to add the content of two registers and save the result in a register.</p><pre lang="">ADD	R2, R3, R4</pre><p>R2 denotes the Destination Register<br
/> R3, and R4 denotes the Registers whose contents will be added</p><p><b>Translation:</b><br
/> R2 = R3 + R4<br
/> R2 = 15 + 1<br
/> R2 would contain 16.</p><pre lang="">ADD	R2, R3, immediate value</pre><p><span
id="more-1247"></span><br
/> R2 denotes the Destination Register<br
/> R3 is the register whose contents will be added to an immediate value (can you determine the value of the highest/lowest value that can be represented here?) You can place values such as 5, 10, 0, -2, -5&#8230;so on</p><p><b>Translation with Example:</b><br
/> R2 = R3 + 10;<br
/> R2 = 15 + 10;<br
/> R2 = 25;</p><h3>The AND Operation</h3><p> The <b>truth table</b> for the AND operation between two binary digits is below. Easiest way to remember, is simply to know that in order to get TRUE or 1, all contents that are ANDed must be 1 or TRUE.</p><table
border="1"><tr><td>A</td><td>B</td><td>A AND B</td></tr><tr><td>0</td><td>0</td><td>0</td></tr><tr><td>0</td><td>1</td><td>0</td></tr><tr><td>1</td><td>0</td><td>0</td></tr><tr><td>1</td><td>1</td><td>1</td></tr></table><pre lang="">AND	R2, R3, R4</pre><p>R2 is the Destination Register<br
/> R3 and R4 are the Registers whose contents will be ANDed</p><p><b>Translation:</b><br
/> R2 = R3 AND R4;<br
/> R2 = 1111 AND 0001<br
/> R2 = 0001</p><pre lang="">AND	R2, R3, immediate value</pre><p>R2 is the Desination Register<br
/> R3 is the register whose contents will be ANDed with an immediate value</p><p><b>Translation</b>:<br
/> R2 = R3 AND 5;<br
/> R2 = 1111 AND 0101<br
/> R2 = 0101</p><h3>The NOT Operation</h3><p>The <b>truth table</b> for the NOT Operation is below. To remember, simply invert the bits whenever you see a NOT operation.</p><table
border="1"><tr><td>A</td><td>NOT A</td></tr><tr><td>0</td><td>1</td></tr><tr><td>1</td><td>0</td></tr></table><pre lang="">NOT	R1, R4</pre><p>R1 is the Destination Register<br
/> R2 is the register whose contents will be NOT</p><p><b>Translation:</b><br
/> R1 = NOT R4<br
/> R1 = NOT 0001<br
/> R1 = 1110</p><h3>Summary</h3><p>It is critical for you to understand how these instructions operate fully. I&#8217;ll be adding Data Movement, Control, and Trapvector table instructions soon.</p><h3  class="related_post_title">You might also find these interesting</h3><ul
class="related_post"><li><a
href="http://talkbinary.com/programming/c/how-to-write-and-compile-c-program-in-linux/" title="How to write and compile C++ program in Linux">How to write and compile C++ program in Linux</a> (28)</li><li><a
href="http://talkbinary.com/gaming/ps3-gaming/how-to-use-a-ps3-controller-on-your-pc/" title="How to use a PS3 Controller On Your PC">How to use a PS3 Controller On Your PC</a> (28)</li><li><a
href="http://talkbinary.com/blog/google-wave-invitations/" title="Google Wave Invitations">Google Wave Invitations</a> (15)</li><li><a
href="http://talkbinary.com/hardware/usb-devices/usb-flash-drive-tip/" title="USB Flash Drive Tip">USB Flash Drive Tip</a> (13)</li><li><a
href="http://talkbinary.com/blog/google-wave-invitations-round-2/" title="Google Wave Invitations Round 2">Google Wave Invitations Round 2</a> (8)</li><li><a
href="http://talkbinary.com/linux/open-suse-a-linux-distro-worth-setting-your-eye-on/" title="openSuSe &#8211; A Linux Distro worth setting your eye on ">openSuSe &#8211; A Linux Distro worth setting your eye on </a> (7)</li><li><a
href="http://talkbinary.com/resources-online/links/imoim-instant-messaging-service-online/" title="imo.im &#8211; Instant Messaging Service Online ">imo.im &#8211; Instant Messaging Service Online </a> (7)</li><li><a
href="http://talkbinary.com/programming/c/hello-world-in-c/" title="Hello World in C++!">Hello World in C++!</a> (6)</li><li><a
href="http://talkbinary.com/programming/c/how-to-write-and-compile-a-c-program-in-windows-using-an-ide/" title="How to write and compile a C++ program in Windows using an IDE">How to write and compile a C++ program in Windows using an IDE</a> (6)</li><li><a
href="http://talkbinary.com/programming/c/fundamental-data-type-string/" title="Fundamental Data Type String">Fundamental Data Type String</a> (6)</li></ul>]]></content:encoded> <wfw:commentRss>http://talkbinary.com/programming/lc-3/lc-3-operations/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (enhanced) (user agent is rejected)
Database Caching 28/57 queries in 0.244 seconds using disk

Served from: talkbinary.com @ 2010-07-31 10:29:16 -->