1 / 18

Rechnen im Binärsystem

Rechnen im Binärsystem. Subtraktion durch Addition n – m  n + ( -m ). Subtrahend. Subtrahend m umrechen in seine Zweierkomplement-Darstellung. Wie geht das?. Informatik im U2 FH Bingen „Bitte ein Bit“ HHD. Beispiel: Umwandeln Zweierkomplement. Gegeben: Die Zahl 6 im Dezimalsystem.

gene
Download Presentation

Rechnen im Binärsystem

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Rechnen im Binärsystem Subtraktion durch Addition n – m  n + (-m) Subtrahend • Subtrahend m umrechen in seine Zweierkomplement-Darstellung Wie geht das? Informatik im U2 FH Bingen „Bitte ein Bit“ HHD

  2. Beispiel: Umwandeln Zweierkomplement Gegeben: Die Zahl 6 im Dezimalsystem. Gesucht: Die Zahl -6 im Dezimalsystem in Zweierkomplement-Darstellung mit einer Datenbreite k = 4. Informatik im U2 FH Bingen „Bitte ein Bit“ HHD

  3. 1. Schritt: 6(10) -> binäre Darstellung bei k = 4 Wie? Modulo-Methode • : 2 = 3 Rest 0 • : 2 = 1 Rest 1 • : 2 = 0 Rest 1 6(10) -> 0 1 1 0 (2) Least Significant Bit Most Significant Bit Informatik im U2 FH Bingen „Bitte ein Bit“ HHD

  4. 2. Schritt: 0 1 1 0 (2) -> Zweierkomplement INVERT +1 Informatik im U2 FH Bingen „Bitte ein Bit“ HHD

  5. Ergebnis: Der Bitstrom: codiert im Zweierkomplement die dezimale Zahl: Informatik im U2 FH Bingen „Bitte ein Bit“ HHD

  6. Woran erkennen Sie bei der Zweierkomplement-Darstellung mit der Datenbreite k, ob es sich um eine negative oder positive ganze Zahl handelt? Most Significant Bit Informatik im U2 FH Bingen „Bitte ein Bit“ HHD

  7. Probe: Gegeben: Ein Bitstrom mit der Datenbreite k = 4, der eine ganze Zahl im Zweierkomplement codiert: Gesucht: Welche ganze Dezimalzahl wird hierdurch repräsentiert. Informatik im U2 FH Bingen „Bitte ein Bit“ HHD

  8. 1. Schritt: Zweierkomplement errechnen INVERT +1 Informatik im U2 FH Bingen „Bitte ein Bit“ HHD

  9. 2. Schritt:IF MSB = 1 THAN negative Zahl Informatik im U2 FH Bingen „Bitte ein Bit“ HHD

  10. Ergebnis: Der Bitstrom: codiert im Zweierkomplement die dezimale Zahl: ✔ Informatik im U2 FH Bingen „Bitte ein Bit“ HHD

  11. Beispiel: Subtrahieren durch Addieren Gegeben: Die Zahl 6 und die Zahl 3 im Dezimalsystem. Gesucht: 6 – 3 errechnet im Binärsystem mittels Addition. Informatik im U2 FH Bingen „Bitte ein Bit“ HHD

  12. 1. Schritt: 6(10) -> binäre Darstellung bei k = 4 Wie? Modulo-Methode • : 2 = 3 Rest 0 • : 2 = 1 Rest 1 • : 2 = 0 Rest 1 6(10) -> 0 1 1 0 (2) Least Significant Bit Most Significant Bit Informatik im U2 FH Bingen „Bitte ein Bit“ HHD

  13. 2. Schritt: 3(10) -> binäre Darstellung bei k = 4 Wie? Modulo-Methode 3 : 2 = 1 Rest 1 1: 2 = 0 Rest 1 3(10) -> 0 0 1 1 (2) Least Significant Bit Most Significant Bit Informatik im U2 FH Bingen „Bitte ein Bit“ HHD

  14. 3. Schritt: 0 0 1 1 (2) -> Zweierkomplement INVERT +1 Informatik im U2 FH Bingen „Bitte ein Bit“ HHD

  15. 4. Schritt: 0 1 1 0(2) + 1 1 0 1 (2) Informatik im U2 FH Bingen „Bitte ein Bit“ HHD

  16. 5. Schritt: Probe Gegeben: Ein Bitstrom mit der Datenbreite k = 4, der eine ganze Zahl Gesucht: Welche ganze Dezimalzahl wird hierdurch repräsentiert. Informatik im U2 FH Bingen „Bitte ein Bit“ HHD

  17. 5. Schritt: Rechnung 3 2 1 0 = k 21 + 20 = 2 + 1 = 3 Informatik im U2 FH Bingen „Bitte ein Bit“ HHD

  18. 4. Schritt: 0 1 1 0(2) + 1 1 0 1 (2) ✔ Informatik im U2 FH Bingen „Bitte ein Bit“ HHD

More Related