From 57d74093a19569b9dd55520c6a1548e4827f3b1e Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Fri, 24 Apr 2020 22:16:01 +0100 Subject: Add valueToInt function --- src/verilog/Value.v | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/verilog') diff --git a/src/verilog/Value.v b/src/verilog/Value.v index fe53dbc..241534c 100644 --- a/src/verilog/Value.v +++ b/src/verilog/Value.v @@ -78,6 +78,9 @@ Definition uvalueToZ (v : value) : Z := Definition intToValue (i : Integers.int) : value := ZToValue Int.wordsize (Int.unsigned i). +Definition valueToInt (i : value) : Integers.int := + Int.repr (valueToZ i). + (** Convert a [value] to a [bool], so that choices can be made based on the result. This is also because comparison operators will give back [value] instead of [bool], so if they are in a condition, they will have to be converted before -- cgit