luwen_core/
lib.rs

1// SPDX-FileCopyrightText: © 2023 Tenstorrent Inc.
2// SPDX-License-Identifier: Apache-2.0
3
4use std::str::FromStr;
5
6#[derive(Clone, Hash, Copy, Debug, PartialEq, Eq)]
7pub enum Arch {
8    Grayskull,
9    Wormhole,
10    Unknown(u16),
11}
12
13impl Arch {
14    pub fn is_wormhole(&self) -> bool {
15        match self {
16            Arch::Wormhole => true,
17            _ => false,
18        }
19    }
20
21    pub fn is_grayskull(&self) -> bool {
22        match self {
23            Arch::Grayskull => true,
24            _ => false,
25        }
26    }
27}
28
29impl FromStr for Arch {
30    type Err = String;
31
32    fn from_str(s: &str) -> Result<Self, Self::Err> {
33        match s {
34            "grayskull" => Ok(Arch::Grayskull),
35            "wormhole" => Ok(Arch::Wormhole),
36            err => Err(err.to_string()),
37        }
38    }
39}