- random generating logic function
This commit is contained in:
parent
c3d6e29e9d
commit
1a57b2db62
@ -55,6 +55,18 @@ class TruthTableTask extends PicturedTask
|
|||||||
return $this->lf;
|
return $this->lf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function generateRandomFunction(array $input_vars, int $min_depth, int $max_depth): void {
|
||||||
|
$this->lf = LogicFunction::genRandom($input_vars, $min_depth, $max_depth);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function generateRandomDF(array $input_vars): void {
|
||||||
|
$this->lf = LogicFunction::genRandomDF($input_vars);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setLogicFunctionExpr(string $expr, array $input_vars = []): void {
|
||||||
|
$this->lf = new LogicFunction($expr, $input_vars);
|
||||||
|
}
|
||||||
|
|
||||||
public function getLogicFunctionExpr(string $fmt = "verilog_bitwise"): string {
|
public function getLogicFunctionExpr(string $fmt = "verilog_bitwise"): string {
|
||||||
return $this->lf->getExpression($fmt);
|
return $this->lf->getExpression($fmt);
|
||||||
}
|
}
|
||||||
@ -80,11 +92,11 @@ class TruthTableTask extends PicturedTask
|
|||||||
|
|
||||||
public function randomize(): void
|
public function randomize(): void
|
||||||
{
|
{
|
||||||
|
parent::randomize();
|
||||||
|
|
||||||
if ($this->hasFlag("drawnetwork")) {
|
if ($this->hasFlag("drawnetwork")) {
|
||||||
$this->setImageData($this->lf->drawNetwork($this->output_variable));
|
$this->setImageData($this->lf->drawNetwork($this->output_variable));
|
||||||
$this->setImageType("svg");
|
$this->setImageType("svg");
|
||||||
}
|
}
|
||||||
|
|
||||||
parent::randomize();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user