| /* |
| * 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_H |
| #define SOFTRVV_H |
| |
| #include <stddef.h> |
| #include <stdint.h> |
| |
| #include "encoding.h" |
| #include "softrvv_internal.h" |
| #include "softrvv_vadd.h" |
| #include "softrvv_vand.h" |
| #include "softrvv_vdiv.h" |
| #include "softrvv_vfadd.h" |
| #include "softrvv_vfdiv.h" |
| #include "softrvv_vfmax.h" |
| #include "softrvv_vfmin.h" |
| #include "softrvv_vfmul.h" |
| #include "softrvv_vfsub.h" |
| #include "softrvv_vmadd_vnmsub.h" |
| #include "softrvv_vmacc.h" |
| #include "softrvv_vmax.h" |
| #include "softrvv_vmfeq.h" |
| #include "softrvv_vmfge.h" |
| #include "softrvv_vmfgt.h" |
| #include "softrvv_vmfle.h" |
| #include "softrvv_vmflt.h" |
| #include "softrvv_vmfne.h" |
| #include "softrvv_vmin.h" |
| #include "softrvv_vmseq.h" |
| #include "softrvv_vmsge.h" |
| #include "softrvv_vmsgt.h" |
| #include "softrvv_vmsle.h" |
| #include "softrvv_vmslt.h" |
| #include "softrvv_vmsne.h" |
| #include "softrvv_vmul_vmulh.h" |
| #include "softrvv_vmv_s_x.h" |
| #include "softrvv_vnsra.h" |
| #include "softrvv_vnsrl.h" |
| #include "softrvv_vor.h" |
| #include "softrvv_vredsum.h" |
| #include "softrvv_vrem.h" |
| #include "softrvv_vsext_vzext.h" |
| #include "softrvv_vsll.h" |
| #include "softrvv_vsra.h" |
| #include "softrvv_vsrl.h" |
| #include "softrvv_vsub.h" |
| #include "softrvv_vwadd.h" |
| #include "softrvv_vwsub.h" |
| #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_H |