| /* |
| * Copyright 2023 Google LLC |
| * |
| * Licensed under the Apache License, Version 2.0 (the "License"); |
| * you may not use this file except in compliance with the License. |
| * You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| |
| #ifndef SOFTRVV_INCLUDE_SOFTRVV_H_ |
| #define SOFTRVV_INCLUDE_SOFTRVV_H_ |
| |
| #include <stddef.h> |
| #include <stdint.h> |
| |
| #include "softrvv/include/encoding.h" |
| #include "softrvv/include/softrvv_internal.h" |
| #include "softrvv/include/softrvv_vadd.h" |
| #include "softrvv/include/softrvv_vand.h" |
| #include "softrvv/include/softrvv_vdiv.h" |
| #include "softrvv/include/softrvv_vfadd.h" |
| #include "softrvv/include/softrvv_vfdiv.h" |
| #include "softrvv/include/softrvv_vfmax.h" |
| #include "softrvv/include/softrvv_vfmin.h" |
| #include "softrvv/include/softrvv_vfmul.h" |
| #include "softrvv/include/softrvv_vfsub.h" |
| #include "softrvv/include/softrvv_vmacc.h" |
| #include "softrvv/include/softrvv_vmadd_vnmsub.h" |
| #include "softrvv/include/softrvv_vmax.h" |
| #include "softrvv/include/softrvv_vmfeq.h" |
| #include "softrvv/include/softrvv_vmfge.h" |
| #include "softrvv/include/softrvv_vmfgt.h" |
| #include "softrvv/include/softrvv_vmfle.h" |
| #include "softrvv/include/softrvv_vmflt.h" |
| #include "softrvv/include/softrvv_vmfne.h" |
| #include "softrvv/include/softrvv_vmin.h" |
| #include "softrvv/include/softrvv_vmseq.h" |
| #include "softrvv/include/softrvv_vmsge.h" |
| #include "softrvv/include/softrvv_vmsgt.h" |
| #include "softrvv/include/softrvv_vmsle.h" |
| #include "softrvv/include/softrvv_vmslt.h" |
| #include "softrvv/include/softrvv_vmsne.h" |
| #include "softrvv/include/softrvv_vmul_vmulh.h" |
| #include "softrvv/include/softrvv_vmv_s_x.h" |
| #include "softrvv/include/softrvv_vnsra.h" |
| #include "softrvv/include/softrvv_vnsrl.h" |
| #include "softrvv/include/softrvv_vor.h" |
| #include "softrvv/include/softrvv_vredsum.h" |
| #include "softrvv/include/softrvv_vrem.h" |
| #include "softrvv/include/softrvv_vsext_vzext.h" |
| #include "softrvv/include/softrvv_vsll.h" |
| #include "softrvv/include/softrvv_vsra.h" |
| #include "softrvv/include/softrvv_vsrl.h" |
| #include "softrvv/include/softrvv_vsub.h" |
| #include "softrvv/include/softrvv_vwadd.h" |
| #include "softrvv/include/softrvv_vwsub.h" |
| #include "softrvv/include/softrvv_vxor.h" |
| |
| namespace softrvv { |
| |
| const uint32_t MSTATUS_VS_FS_ENABLE_BIT = |
| (MSTATUS_VS & (MSTATUS_VS >> 1)) | (MSTATUS_FS & (MSTATUS_FS >> 1)); |
| |
| inline void disable_rvv() { |
| __asm__ volatile( |
| "li t0, %[MSTATUS_VS_BITS]\n\t" |
| "csrc mstatus, t0" ::[MSTATUS_VS_BITS] "n"(MSTATUS_VS_FS_ENABLE_BIT)); |
| } |
| |
| inline void enable_rvv() { |
| __asm__ volatile( |
| "li t0, %[MSTATUS_VS_BITS]\n\t" |
| "csrs mstatus, t0" ::[MSTATUS_VS_BITS] "n"(MSTATUS_VS_FS_ENABLE_BIT)); |
| } |
| |
| } // namespace softrvv |
| |
| #endif // SOFTRVV_INCLUDE_SOFTRVV_H_ |