diff options
| author | Alasdair | 2020-05-15 12:30:33 +0100 |
|---|---|---|
| committer | Alasdair | 2020-05-15 12:30:33 +0100 |
| commit | 5ad99d0bf86d856b7cfb537d18941937fb308ab2 (patch) | |
| tree | 7830d8dfd70ff5dcef06f0bdfb5067049ba5506c | |
| parent | 74da1d93d78e606a7c855f2a427dbd171fd861c5 (diff) | |
Add --tab-width option to sailcov
| -rw-r--r-- | sailcov/README.md | 7 | ||||
| -rw-r--r-- | sailcov/main.ml | 9 |
2 files changed, 13 insertions, 3 deletions
diff --git a/sailcov/README.md b/sailcov/README.md index 68ab0924..5118d919 100644 --- a/sailcov/README.md +++ b/sailcov/README.md @@ -38,5 +38,8 @@ sailcov -a all_branches -t sail_coverage my_model.sail which produces a `my_model.html` file. Multiple sail files can be passed to the tool, and it will produce html for each -individually. See [riscv_vmem_sv39.html](https://alasdair.github.io/riscv_vmem_sv39.html) for an -example of the output. +individually. See +[riscv_vmem_sv39.html](https://alasdair.github.io/riscv_vmem_sv39.html) +for an example of the output. There is also a `--tab-width` option for +sailcov that can be used to control the tab width in the generated +html. diff --git a/sailcov/main.ml b/sailcov/main.ml index 84fbd595..6b435700 100644 --- a/sailcov/main.ml +++ b/sailcov/main.ml @@ -4,6 +4,8 @@ let opt_files = ref ([] : string list) let opt_taken = ref "sail_coverage" let opt_all = ref "all_branches" + +let opt_tab_width = ref 4 let options = Arg.align [ @@ -12,7 +14,10 @@ let options = "<file> coverage information for branches taken while executing the model (default: sail_coverage)"); ( "-a", Arg.String (fun str -> opt_all := str), - "<file> information about all possible branches (default: all_branches)") + "<file> information about all possible branches (default: all_branches)"); + ( "--tab-width", + Arg.Int (fun n -> opt_tab_width := n), + "<integer> set the tab width for html output (default: 4)") ] type span = { @@ -89,6 +94,8 @@ let output_html_char chan c = output_string chan ">" else if c == '"' then output_string chan """ + else if c == '\t' then + output_string chan (String.concat "" (List.init !opt_tab_width (fun _ -> " "))) else output_char chan c |
