-
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
47 changed files
with
963 additions
and
58 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
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,62 @@ | ||
/** | ||
* yosys-cgploss - Create circuics using Genetic (CGP) | ||
* support data types header file | ||
* @author Lukas Plevac <xpleva07@vutbr.cz> | ||
*/ | ||
|
||
#pragma once | ||
|
||
namespace types { | ||
/** | ||
* @brief Reprezenting number as 2**exp | ||
*/ | ||
class Exponent { | ||
public: | ||
/** | ||
* @brief Exponent of reprezented number | ||
*/ | ||
unsigned exp; | ||
|
||
Exponent(unsigned exponent) { | ||
this->exp = exponent; | ||
} | ||
|
||
Exponent() { | ||
this->exp = 0; | ||
} | ||
|
||
/** | ||
* Get real value of number | ||
* @return unsigned | ||
*/ | ||
unsigned real() { | ||
return 1 << this->exp; | ||
} | ||
|
||
Exponent operator*(const Exponent& b) { | ||
Exponent c(this->exp); | ||
c.exp += b.exp; | ||
return c; | ||
} | ||
|
||
Exponent operator/(const Exponent& b) { | ||
Exponent c(this->exp); | ||
c.exp -= b.exp; | ||
return c; | ||
} | ||
|
||
|
||
friend float operator/(const float& lhs, const Exponent& rhs) { | ||
unsigned do_div = rhs.exp; | ||
float out = lhs; | ||
|
||
while (do_div) { | ||
out = out / 2; | ||
do_div--; | ||
} | ||
|
||
return out; | ||
} | ||
|
||
}; | ||
} |
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
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,4 @@ | ||
module paritydev (input [127:0] a, | ||
output par); | ||
assign par = ^a; | ||
endmodule |
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,6 @@ | ||
read_verilog tests/128bparity-gates-cgp/code.v | ||
techmap | ||
opt | ||
abc | ||
cgploss -generations=3 -generation_size=3 -selection_size=1 -representation=gates | ||
write_verilog test_out.v |
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,33 @@ | ||
module fulladder_tb; | ||
task assert(input condition); | ||
if(!condition) | ||
$fatal; | ||
endtask | ||
|
||
reg [127:0] a; | ||
reg par_exp; | ||
wire par; | ||
|
||
integer i; | ||
|
||
paritydev UUT( | ||
.a(a), | ||
.par(par) | ||
); | ||
|
||
initial begin | ||
a <= 0; | ||
|
||
for (i = 0; i < 131072; i = i + 1) begin | ||
a <= {$random, $random, $random, $random}; | ||
|
||
#10 | ||
|
||
par_exp = ^a; | ||
|
||
#10 | ||
|
||
assert(par === par_exp); | ||
end | ||
end | ||
endmodule |
Oops, something went wrong.