Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #include <iostream>
- #include <vector>
- #include <cstdint>
- /*
- * Aufgabe 1: Implementiere die Klasse Bitarray
- * Aufgabe 2: Schreibe den Konstruktor der Abstract Class LogicGate
- * Aufgabe 3a: Implementiere die Abstract Class LogicGate
- * Aufgabe 3b: Implementiere AND, OR und NOT Gates (leite sie von LogicGate ab)
- * Aufgabe 4a: Implementiere die Abstract Class Latch (wenn nötig füge weitere private member variables hinzu)
- * Aufgabe 4b: Implementiere JK und D Latches (FlipFlop ohne Clock)
- * Aufgabe 5: Implementiere die Klasse Schaltung, die eine Liste von Bauteilen beinhaltet und diese sinnvoll verbindet
- * Schaltzeit wird vernachlässigt (Keine Hasards)!
- */
- //Namespace sn (->Schaltnetz) erstellt einen besonderen Scope auf den man mit sn:: (bsw. sn::Bit oder sn::Bauteil) zugreifen kann
- namespace sn {
- typedef bool Bit;
- void flip(Bit& bit){
- bit ^= 1;
- }
- class Bitarray{
- Bitarray(int n /*Größe des Bitarrays*/);
- Bitarray(const Bitarray& other);
- ~Bitarray();
- //Benutze bitwise operatoren um das Bitarray als Integer darzustellen
- int toInt();
- Bit operator[] (int pos) const;
- Bit& operator[] (int pos);
- private:
- Bit* data;
- };
- class Bauteil {
- public:
- virtual Bitarray getOutput() const = 0;
- virtual Bitarray getInput() const = 0;
- virtual void setInput(const Bitarray& input) = 0;
- };
- class LogicGate: public Bauteil{
- public:
- LogicGate(int num_inputs, int num_outputs);
- /* ... */
- private:
- Bitarray input;
- Bitarray output;
- };
- class Latch: public Bauteil{
- public:
- /* ... */
- private:
- /* ... */
- Bitarray input;
- Bitarray output;
- };
- class NOTGate;
- class ANDGate;
- class ORGate;
- class DLatch;
- class JKLatch;
- class Schaltung: public Bauteil{};
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement