|
|
@@ -105,7 +105,7 @@ class CBD2Latex:
|
|
|
for f in fncs:
|
|
|
f.args = [VarFnc(x) for x in inputs]
|
|
|
eqs = []
|
|
|
- outputs = [self._rename(block.getPath(self.config["path_sep"]) + self.config['path_sep'] + x) for x in block.getSignals().keys()]
|
|
|
+ outputs = [self._rename(block.getPath(self.config["path_sep"]) + self.config['path_sep'] + x) for x in block.getOutputPortNames()]
|
|
|
for i, fnc in enumerate(fncs):
|
|
|
eqs.append(Eq(outputs[i], fnc))
|
|
|
return eqs
|
|
|
@@ -120,21 +120,9 @@ class CBD2Latex:
|
|
|
"""
|
|
|
# Add all blocks
|
|
|
for block in self.model.getBlocks():
|
|
|
- if block.getBlockType() not in ["OutputPortBlock", "InputPortBlock", "WireBlock"]:
|
|
|
- eq = self.get_block_equation(block)
|
|
|
- for e in eq:
|
|
|
- self.equations.append(e)
|
|
|
- # elif block.getBlockType() in "WireBlock":
|
|
|
- # path = block.getPath(self.config['path_sep'])
|
|
|
- # lhs = self._rename(path + self.config['path_sep'] + "OUT1")
|
|
|
- # rhs = VarFnc(self._rename(path + self.config['path_sep'] + "IN1"))
|
|
|
- # self.equations.append(Eq(lhs, rhs))
|
|
|
- # self.equations.append(Eq(self._rename(path), VarFnc(lhs)))
|
|
|
- # elif block.getBlockType() in "InputPortBlock":
|
|
|
- # path = block.getPath(self.config['path_sep'])
|
|
|
- # lhs = self._rename(path)
|
|
|
- # rhs = VarFnc(self._rename(path))
|
|
|
- # self.equations.append(Eq(lhs, rhs))
|
|
|
+ eq = self.get_block_equation(block)
|
|
|
+ for e in eq:
|
|
|
+ self.equations.append(e)
|
|
|
|
|
|
# Add all connections
|
|
|
for block in self.model.getBlocks():
|
|
|
@@ -146,6 +134,15 @@ class CBD2Latex:
|
|
|
rhs = VarFnc(v_path)
|
|
|
self.equations.append(Eq(lhs, rhs))
|
|
|
|
|
|
+ # Add all outputs
|
|
|
+ for port in self.model.getOutputPorts():
|
|
|
+ prev = port.getIncoming().source
|
|
|
+ p_path = self._rename(
|
|
|
+ prev.block.getPath(self.config['path_sep']) + self.config['path_sep'] + prev.name)
|
|
|
+ n_path = self._rename(
|
|
|
+ port.block.getPath(self.config['path_sep']) + self.config['path_sep'] + port.name)
|
|
|
+ self.equations.append(Eq(n_path, VarFnc(p_path)))
|
|
|
+
|
|
|
def render(self, rl=None):
|
|
|
"""
|
|
|
Creates the LaTeX string for the model, based on the current level of simplifications.
|