summaryrefslogtreecommitdiff
path: root/src/Wasm/Expression/Utilities.agda
blob: 129af144894e6267bac86d8b6dbfb022f017c654 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
{-# OPTIONS --without-K --safe #-}

module Wasm.Expression.Utilities where

open import Data.Fin using (Fin)
open import Data.Nat using (ℕ; _^_)
open import Data.Vec.Bounded using (Vec≤)
open import Wasm.Constants

Vec′ : ∀ {a} → Set a → Set a
Vec′ A = Vec≤ A 2^32

data Signedness : Set where
  Signed   : Signedness
  Unsigned : Signedness

data BitWidth : Set where
  32Bit : BitWidth
  64Bit : BitWidth

module BitWidth′ where
  toℕ : BitWidth → ℕ
  toℕ 32Bit = 32
  toℕ 64Bit = 64

module Indices where
  TypeIdx : Set
  TypeIdx = Fin 2^32

  FuncIdx : Set
  FuncIdx = Fin 2^32

  TableIdx : Set
  TableIdx = Fin 2^32

  MemIdx : Set
  MemIdx = Fin 2^32

  GlobalIdx : Set
  GlobalIdx = Fin 2^32

  ElemIdx : Set
  ElemIdx = Fin 2^32

  DataIdx : Set
  DataIdx = Fin 2^32

  LocalIdx : Set
  LocalIdx = Fin 2^32

  LabelIdx : Set
  LabelIdx = Fin 2^32