Skip to content

Commit

Permalink
Post-merge fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
VonTum committed Jan 29, 2025
1 parent 634ffdc commit 5da1def
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/codegen/system_verilog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ fn typ_to_declaration(mut typ: &ConcreteType, var_name: &str) -> String {
}
match typ {
ConcreteType::Named(reference) => {
let sz = ConcreteType::sizeof_named(reference.id);
let sz = ConcreteType::sizeof_named(reference);
if sz == 1 {
format!("{array_string} {var_name}")
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/codegen/vhdl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ fn typ_to_declaration(mut typ: &ConcreteType) -> String {
}
match typ {
ConcreteType::Named(reference) => {
let sz = ConcreteType::sizeof_named(reference.id);
let sz = ConcreteType::sizeof_named(reference);
if sz == 1 {
format!("{array_string} std_logic")
} else {
Expand Down
17 changes: 5 additions & 12 deletions src/typing/concrete_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,6 @@ impl ConcreteType {
};
v
}
pub fn down_array(&self) -> &ConcreteType {
let ConcreteType::Array(arr_box) = self else {
unreachable!("Must be an array! Is {self:?} instead")
};
let (sub, _sz) = arr_box.deref();
sub
}
pub fn contains_unknown(&self) -> bool {
match self {
ConcreteType::Named(global_ref) => {
Expand Down Expand Up @@ -88,7 +81,7 @@ impl ConcreteType {
/// If it contains any Unknowns, then returns None
pub fn sizeof(&self) -> Option<BigInt> {
match self {
ConcreteType::Named(uuid) => Some(Self::sizeof_named(*uuid).into()),
ConcreteType::Named(reference) => Some(Self::sizeof_named(reference).into()),
ConcreteType::Value(_value) => unreachable!("Root of ConcreteType cannot be a value"),
ConcreteType::Array(arr_box) => {
let (typ, size) = arr_box.deref();
Expand All @@ -105,11 +98,11 @@ impl ConcreteType {
}
}

/// TODO #50 Ranged Int work & ConcreteGlobalReference should be integrated
pub fn sizeof_named(id: TypeUUID) -> u64 {
if id == get_builtin_type("int") {
/// TODO #50 Ranged Int work should be integrated
pub fn sizeof_named(type_ref: &ConcreteGlobalReference<TypeUUID>) -> u64 {
if type_ref.id == get_builtin_type("int") {
32 // TODO concrete int sizes
} else if id == get_builtin_type("bool") {
} else if type_ref.id == get_builtin_type("bool") {
1
} else {
println!("TODO Named Structs Size");
Expand Down

0 comments on commit 5da1def

Please sign in to comment.