[otbn] Use libcst to extract implementations for docs This isn't the full solution: we are going to want to do some prettifying to make this more "pseudo-codeish". For example, we currently have lines like val1 = state.gprs.get_reg(self.grs1).read_unsigned() state.gprs.get_reg(self.grd).write_unsigned(result) which should probably be something more like val1 <- gprs[self.grs1] gprs[self.grd] <- val1 or similar. However, it does get rid of the duplicated definitions from the YAML files and, if ugly, the definitions in the spec are now at least clear. Signed-off-by: Rupert Swarbrick <rswarbrick@lowrisc.org>
diff --git a/util/build_docs.py b/util/build_docs.py index 477361f..4aa6e81 100755 --- a/util/build_docs.py +++ b/util/build_docs.py
@@ -330,9 +330,11 @@ otbn_dir = SRCTREE_TOP / 'hw/ip/otbn' script = otbn_dir / 'util/yaml_to_doc.py' yaml_file = otbn_dir / 'data/insns.yml' + impl_file = otbn_dir / 'dv/otbnsim/sim/insn.py' out_dir = config['outdir-generated'].joinpath('otbn-isa') - subprocess.run([str(script), str(yaml_file), str(out_dir)], check=True) + subprocess.run([str(script), str(yaml_file), str(impl_file), str(out_dir)], + check=True) def hugo_match_version(hugo_bin_path, version):