Skip to content

Commit

Permalink
Typo fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukáš Plevač committed Apr 26, 2022
1 parent 9ebdece commit 6e93f4f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 15 deletions.
28 changes: 20 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# CGP Loss optimalization YOSYS extension

use genetic algoritms for optimalize circuics
use genetic algoritms for optimalize circuics with accepted error on output or without it.


## Getting Started

CGP Loss optimalization shortly `cgploss` is YOSYS extension. For run it you need YOSYS (https://github.com/YosysHQ/yosys) after you build and install YOSYS you can use this extension. Firstly you need load `cgploss` as extension in yosys
CGP Loss optimalization shortly `cgploss` is YOSYS extension. For run it you need YOSYS (https://github.com/YosysHQ/yosys) after you build and install YOSYS you can use this extension. Firstly you need load `cgploss` as extension in yosys. The goal of CGP Loss is create optimalized circuic with small output error and minimalize amount of electic power to run this circuic.

```bash
yosys -m cgploss.so
Expand All @@ -19,20 +19,21 @@ cgploss [options]
options:
-wire-test test load and save part, do not use CGP only load and save [DEBUG]
-save_individuals=file create debug file with all individuals
-save_individuals=file create debug file with all individuals [DEBUG]
-ports_weights=file ports weights file
-selection_size=size size of selected individuals on end of generation
-generation_size=size number of infividuals in generation
-generation_size=size number of individuals in generation
-max_one_error=0..inf maximal accepted error of circuic (one combination)
-generations=count count of generations
-mutations_count=count number of mutation for center of normal distribution
-mutations_count_sigma=num sigma for normal distribution
-parrents=1..2 number of parrents for individual
-parents=1..2 number of parents for kid
-power_accuracy_ratio=0..1 float number for loss (1 - power_accuracy_ratio) * abs_error + power_accuracy_ratio * power_loss
-max_abs_error=num maximal accepted abs error of circuic (all combinations)
-representation={aig, gates, mig} repreyenation of circuic for CGP
-cross_parts=2..inf number of crossovers for cross individuals
-cross_parts=2..inf number of crossover points for cross individuals
-l-back number for mutation. how many back gates can use this gate
-representation={aig, gates, mig} reprezenation of circuic for CGP
```

#### example run
Expand Down Expand Up @@ -61,14 +62,25 @@ ports.cfg
\uart_tx: 2 4 8 10
```

## After clone

After clone you need init all git submodules for success build. You can init submodule using this commands.

```bash
git submodule init
git submodule update
```

## Building

For build you need forder with YOSYS source codes, this forder is included as git submodule `yosys`. Build as it self can be run using makefile using simple make command
For build you need forder with YOSYS source codes, this forder is included as git submodule `yosys`. Build as it self can be run using makefile using simple make command.

need packages `build-essential clang`

```bash
make
# or multicore with package 𝑙𝑖𝑏𝑜𝑚𝑝−𝑑𝑒𝑣
make multicore
```

## Running tests
Expand Down
14 changes: 7 additions & 7 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,20 +133,20 @@ struct cgploss : public Pass {
param_mutate_sigma = stoi(parsed);
}

} else if (param.rfind("-parrents=", 0) == 0) {
auto parsed = param.substr(std::string("-parrents=").length());
} else if (param.rfind("-parents=", 0) == 0) {
auto parsed = param.substr(std::string("-parents=").length());

if (!config::parse::is_number(parsed)) {
log("[ERROR] Bad value for -parrents using default\n");
log("[ERROR] Bad value for -parents using default\n");
} else {
param_parrents_count = stoi(parsed);
}

if (param_parrents_count > 2) {
log("[ERROR] Bad value for -parrents, max value is 2, min value is 1. using 2\n");
log("[ERROR] Bad value for -parents, max value is 2, min value is 1. using 2\n");
param_parrents_count = 2;
} else if (param_parrents_count < 1) {
log("[ERROR] Bad value for -parrents, max value is 2, min value is 1. using 1\n");
log("[ERROR] Bad value for -parents, max value is 2, min value is 1. using 1\n");
param_parrents_count = 1;
}

Expand Down Expand Up @@ -238,7 +238,7 @@ struct cgploss : public Pass {
}

if (param_parrents_count == 2 && param_selection_count < 2) {
log("[ERROR] minimal selection_count for two parrents is 2. setting to 2\n");
log("[ERROR] minimal selection_count for two parents is 2. setting to 2\n");
param_selection_count = 2;
}

Expand All @@ -258,7 +258,7 @@ struct cgploss : public Pass {
log(" generations : %d\n", param_generations_count);
log(" mutations_count : %d\n", param_mutate_center);
log(" mutations_sigma : %d\n", param_mutate_sigma);
log(" parrents : %d\n", param_parrents_count);
log(" parents : %d\n", param_parrents_count);
log(" cross_parts : %d\n", param_cross_parts);
log(" power_accuracy_ratio: %f\n", param_power_accuracy_ratio);
log(" representation : %s\n", param_repres.c_str());
Expand Down

0 comments on commit 6e93f4f

Please sign in to comment.