Skip to content

Commit

Permalink
feat(zicsr): add zicsr instructions + parser stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
cyuria committed Jun 13, 2024
1 parent 4b62b1b commit 53b2a59
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
4 changes: 4 additions & 0 deletions h/form/csr.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#pragma once
#include "form/instructions.h"

extern const struct formation zicsr[];
2 changes: 2 additions & 0 deletions h/parse.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,7 @@ arg_parser parse_jr;
arg_parser parse_ftso;
arg_parser parse_al;
arg_parser parse_as;
arg_parser parse_csr;
arg_parser parse_csri;

int parse_asm(const char *, struct sectionpos);
16 changes: 16 additions & 0 deletions src/form/csr.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

#include "form/csr.h"

#include "form/generic.h"
#include "parse.h"

const struct formation zicsr[] = {
{ "csrrw", &form_itype, &parse_csr, { 4, OP_CSR, 0x1, 0 } },
{ "csrrs", &form_itype, &parse_csr, { 4, OP_CSR, 0x2, 0 } },
{ "csrrc", &form_itype, &parse_csr, { 4, OP_CSR, 0x3, 0 } },
{ "csrrwi", &form_itype, &parse_csri, { 4, OP_CSR, 0x5, 0 } },
{ "csrrsi", &form_itype, &parse_csri, { 4, OP_CSR, 0x6, 0 } },
{ "csrrci", &form_itype, &parse_csri, { 4, OP_CSR, 0x7, 0 } },

END_FORMATION
};
10 changes: 10 additions & 0 deletions src/parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -727,3 +727,13 @@ struct args parse_as(char *argstr)

return args;
}

struct args parse_csr(char *argstr)
{

}

struct args parse_csri(char *argstr)
{

}

0 comments on commit 53b2a59

Please sign in to comment.