Finish cast.cc cleanup
Replace big if statement with switch statemetn
This commit is contained in:
parent
b5e65ac9ed
commit
8323d5d01d
|
|
@ -39,19 +39,23 @@ vhdl_expr *vhdl_expr::cast(const vhdl_type *to)
|
||||||
else
|
else
|
||||||
return resize(to->get_width());
|
return resize(to->get_width());
|
||||||
}
|
}
|
||||||
else if (to->get_name() == VHDL_TYPE_BOOLEAN)
|
else {
|
||||||
|
switch (to->get_name()) {
|
||||||
|
case VHDL_TYPE_BOOLEAN:
|
||||||
return to_boolean();
|
return to_boolean();
|
||||||
else if (to->get_name() == VHDL_TYPE_INTEGER)
|
case VHDL_TYPE_INTEGER:
|
||||||
return to_integer();
|
return to_integer();
|
||||||
else if (to->get_name() == VHDL_TYPE_UNSIGNED
|
case VHDL_TYPE_UNSIGNED:
|
||||||
|| to->get_name() == VHDL_TYPE_SIGNED
|
case VHDL_TYPE_SIGNED:
|
||||||
|| to->get_name() == VHDL_TYPE_STD_LOGIC_VECTOR)
|
case VHDL_TYPE_STD_LOGIC_VECTOR:
|
||||||
return to_vector(to->get_name(), to->get_width());
|
return to_vector(to->get_name(), to->get_width());
|
||||||
else if (to->get_name() == VHDL_TYPE_STD_LOGIC)
|
case VHDL_TYPE_STD_LOGIC:
|
||||||
return to_std_logic();
|
return to_std_logic();
|
||||||
else
|
default:
|
||||||
assert(false);
|
assert(false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generate code to cast an expression to a vector type (std_logic_vector,
|
* Generate code to cast an expression to a vector type (std_logic_vector,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue