-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
202 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
# include <iostream> | ||
|
||
#include "IComponent.hpp" | ||
#include "ErrorParser.hpp" | ||
|
||
namespace nts | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#ifndef c4514_HPP_ | ||
# define c4514_HPP_ | ||
|
||
# include "AComponent.hpp" | ||
|
||
namespace nts | ||
{ | ||
class c4514 : public AComponent | ||
{ | ||
public: | ||
c4514(const std::string & = ""); | ||
virtual nts::Tristate Compute(std::size_t pin_num_this = 1); | ||
virtual void SetLink(std::size_t pin_num_this, nts::IComponent &component, std::size_t pin_num_target); | ||
virtual void Dump(void) const; | ||
virtual ~c4514(void); | ||
|
||
private: | ||
int value; | ||
Tristate prevClock; | ||
}; | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
.chipsets: | ||
input a | ||
input b | ||
input c | ||
input d | ||
input e | ||
|
||
output s | ||
4081 gate | ||
|
||
.links: | ||
a:1 gate:1 | ||
b:1 gate:2 | ||
gate:3 gate:13 | ||
|
||
c:1 gate:5 | ||
d:1 gate:6 | ||
gate:4 gate:12 | ||
|
||
gate:11 gate:9 | ||
e:1 gate:8 | ||
|
||
gate:10 s:1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
.chipsets: | ||
input i1 | ||
input i2 | ||
input i3 | ||
input i4 | ||
input iI | ||
input iS | ||
|
||
4514 c4514 | ||
|
||
output o1 | ||
output o2 | ||
output o3 | ||
output o4 | ||
output o5 | ||
output o6 | ||
output o7 | ||
output o8 | ||
output o9 | ||
output o10 | ||
output o11 | ||
output o12 | ||
output o13 | ||
output o14 | ||
output o15 | ||
output o16 | ||
|
||
.links: | ||
o1:1 c4514:11 | ||
o2:1 c4514:9 | ||
o3:1 c4514:10 | ||
o4:1 c4514:8 | ||
o5:1 c4514:7 | ||
o6:1 c4514:6 | ||
o7:1 c4514:5 | ||
o8:1 c4514:4 | ||
o9:1 c4514:18 | ||
o10:1 c4514:17 | ||
o11:1 c4514:20 | ||
o12:1 c4514:19 | ||
o13:1 c4514:14 | ||
o14:1 c4514:13 | ||
o15:1 c4514:16 | ||
o16:1 c4514:15 | ||
|
||
c4514:2 i1:1 | ||
c4514:3 i2:1 | ||
c4514:21 i3:1 | ||
c4514:22 i4:1 | ||
c4514:1 iS:1 | ||
c4514:23 iI:1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
#include "c4514.hpp" | ||
|
||
namespace nts | ||
{ | ||
c4514::c4514(const std::string &) : value(0), prevClock(FALSE) | ||
{ | ||
this->name = "4514"; | ||
this->type = nts::AComponent::Type::C; | ||
this->pins.push_back(Pin{nts::Pin::I}); | ||
this->pins.push_back(Pin{nts::Pin::I}); | ||
this->pins.push_back(Pin{nts::Pin::I}); | ||
this->pins.push_back(Pin{nts::Pin::O}); | ||
this->pins.push_back(Pin{nts::Pin::O}); | ||
this->pins.push_back(Pin{nts::Pin::O}); | ||
this->pins.push_back(Pin{nts::Pin::O}); | ||
this->pins.push_back(Pin{nts::Pin::O}); | ||
this->pins.push_back(Pin{nts::Pin::O}); | ||
this->pins.push_back(Pin{nts::Pin::O}); | ||
this->pins.push_back(Pin{nts::Pin::O}); | ||
this->pins.push_back(Pin{nts::Pin::VSS}); | ||
this->pins.push_back(Pin{nts::Pin::O}); | ||
this->pins.push_back(Pin{nts::Pin::O}); | ||
this->pins.push_back(Pin{nts::Pin::O}); | ||
this->pins.push_back(Pin{nts::Pin::O}); | ||
this->pins.push_back(Pin{nts::Pin::O}); | ||
this->pins.push_back(Pin{nts::Pin::O}); | ||
this->pins.push_back(Pin{nts::Pin::O}); | ||
this->pins.push_back(Pin{nts::Pin::O}); | ||
this->pins.push_back(Pin{nts::Pin::I}); | ||
this->pins.push_back(Pin{nts::Pin::I}); | ||
this->pins.push_back(Pin{nts::Pin::I}); | ||
this->pins.push_back(Pin{nts::Pin::VDD}); | ||
} | ||
|
||
nts::Tristate c4514::Compute(std::size_t pin_num_this) | ||
{ | ||
if (pin_num_this < 1 || pin_num_this > 23 || pin_num_this == 12) | ||
return (UNDEFINED); | ||
pin_num_this--; | ||
if (this->pins[pin_num_this].getMode() == Pin::I) | ||
return (this->pins[pin_num_this].compute()); | ||
else | ||
{ | ||
if (this->pins[22].compute() == TRUE) | ||
return (FALSE); | ||
if (this->pins[22].compute() == UNDEFINED || this->pins[0].compute() == UNDEFINED) | ||
return (FALSE); | ||
if (this->prevClock == TRUE && this->pins[0].compute() == FALSE) | ||
{ | ||
if (this->pins[1].compute() == UNDEFINED || this->pins[2].compute() == UNDEFINED || this->pins[20].compute() == UNDEFINED || this->pins[21].compute() == UNDEFINED) | ||
return (UNDEFINED); | ||
this->value = 0; | ||
if (this->pins[1].compute() == TRUE) | ||
this->value += 1; | ||
if (this->pins[2].compute() == TRUE) | ||
this->value += 2; | ||
if (this->pins[20].compute() == TRUE) | ||
this->value += 4; | ||
if (this->pins[21].compute() == TRUE) | ||
this->value += 8; | ||
} | ||
this->prevClock = this->pins[0].compute(); | ||
std::vector<unsigned long int> values = {{11, 9, 10, 8, 7, 6, 5, 4, 18, 17, 20, 19, 14, 13, 16, 15}}; | ||
if (pin_num_this == values[this->value] - 1) | ||
return (TRUE); | ||
return (FALSE); | ||
} | ||
} | ||
|
||
void c4514::SetLink(std::size_t pin_num_this, nts::IComponent &component, std::size_t pin_num_target) | ||
{ | ||
if (pin_num_this < 1 || pin_num_this > 23 || pin_num_this == 12) | ||
return ; | ||
pin_num_this--; | ||
this->pins[pin_num_this].setComponent(component); | ||
this->pins[pin_num_this].setTarget(pin_num_target); | ||
} | ||
|
||
void c4514::Dump(void) const | ||
{ | ||
std::cout << "Chipset " << this->name << std::endl; | ||
} | ||
|
||
c4514::~c4514(void) | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters