On 8/18/20 8:50 AM, Taylor Simpson wrote:
> Declare bitfields within registers such as user status register (USR)
>
> Signed-off-by: Taylor Simpson <[email protected]>
> ---
> target/hexagon/reg_fields.h | 40 +++++++++++++++++++++
> target/hexagon/reg_fields_def.h | 78
> +++++++++++++++++++++++++++++++++++++++++
> target/hexagon/reg_fields.c | 28 +++++++++++++++
> 3 files changed, 146 insertions(+)
> create mode 100644 target/hexagon/reg_fields.h
> create mode 100644 target/hexagon/reg_fields_def.h
> create mode 100644 target/hexagon/reg_fields.c
>
> diff --git a/target/hexagon/reg_fields.h b/target/hexagon/reg_fields.h
> new file mode 100644
> index 0000000..cf168f0
> --- /dev/null
> +++ b/target/hexagon/reg_fields.h
> @@ -0,0 +1,40 @@
> +/*
> + * Copyright(c) 2019-2020 Qualcomm Innovation Center, Inc. All Rights
> Reserved.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +#ifndef HEXAGON_REG_FIELDS_H
> +#define HEXAGON_REG_FIELDS_H
> +
> +#define NUM_GEN_REGS 32
What's this? It doesn't appear to be field related.
> +extern reg_field_t reg_field_info[];
const.
> +enum reg_fields_enum {
Doesn't follow naming guidelines. But you don't actually use the name at all,
so better to just drop the name entirely?
> +/* USR fields */
> +DEF_REG_FIELD(USR_OVF,
> + "ovf", 0, 1,
> + "Sticky Saturation Overflow - "
> + "Set when saturation occurs while executing instruction that specifies "
> + "optional saturation, remains set until explicitly cleared by a USR=Rs "
> + "instruction.")
Is the description as a string really useful, or even used?
A comment would seem to do just as well, not consume space in the final binary,
and even then seems redundant with the actual architecture manual.
r~