Update for code standards
This commit is contained in:
parent
537e4bb9d6
commit
948b4edeea
|
@ -14,8 +14,8 @@
|
|||
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/>. */
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
|
||||
#include "config.h"
|
||||
|
@ -30,9 +30,7 @@ static void write_opcodes PARAMS ((void));
|
|||
static void write_template PARAMS ((void));
|
||||
|
||||
int
|
||||
main (argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
if ((argc > 1) && (strcmp (argv[1],"-h") == 0))
|
||||
write_header();
|
||||
|
@ -60,8 +58,8 @@ write_header ()
|
|||
}
|
||||
|
||||
|
||||
/* write_template creates a file all required functions, ready */
|
||||
/* to be filled out */
|
||||
/* write_template creates a file all required functions,
|
||||
ready to be filled out. */
|
||||
|
||||
static void
|
||||
write_template ()
|
||||
|
@ -74,10 +72,10 @@ write_template ()
|
|||
for ( ; i < NUMOPCODES; i++)
|
||||
{
|
||||
if (cr16_instruction[i].size != 0)
|
||||
{
|
||||
{
|
||||
printf("/* %s */\nvoid\nOP_%X_%X ()\n{\n",cr16_instruction[i].mnemonic,cr16_instruction[i].match,(32 - cr16_instruction[i].match_bits));
|
||||
|
||||
/* count operands */
|
||||
/* count operands. */
|
||||
j = 0;
|
||||
for (k=0;k<5;k++)
|
||||
{
|
||||
|
@ -104,7 +102,7 @@ write_template ()
|
|||
fprintf (stderr,"Too many operands: %d\n",j);
|
||||
}
|
||||
printf ("}\n\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -127,16 +125,15 @@ write_opcodes ()
|
|||
{
|
||||
int i = 0, j = 0, k;
|
||||
|
||||
unsigned long mask;
|
||||
/* write out opcode table */
|
||||
/* write out opcode table. */
|
||||
printf ("#include \"cr16_sim.h\"\n");
|
||||
printf ("#include \"simops.h\"\n\n");
|
||||
printf ("struct simops Simops[] = {\n");
|
||||
|
||||
for ( ; i < NUMOPCODES; i++)
|
||||
for (i = NUMOPCODES-1; i >= 0; --i)
|
||||
{
|
||||
if (cr16_instruction[i].size != 0)
|
||||
{
|
||||
{
|
||||
printf (" { \"%s\", %ld, %d, %d, %d, \"OP_%X_%X\", OP_%X_%X, ",
|
||||
cr16_instruction[i].mnemonic, cr16_instruction[i].size,
|
||||
cr16_instruction[i].match_bits, cr16_instruction[i].match,
|
||||
|
@ -157,26 +154,21 @@ write_opcodes ()
|
|||
j = 0;
|
||||
for (k=0;k<4;k++)
|
||||
{
|
||||
int flags = cr16_instruction[i].operands[k].op_type;
|
||||
int match_bits = cr16_instruction[i].operands[k].shift;
|
||||
{
|
||||
int optype = cr16_instruction[i].operands[k].op_type;
|
||||
int shift = cr16_instruction[i].operands[k].shift;
|
||||
if (j == 0)
|
||||
printf ("{");
|
||||
else
|
||||
printf (", ");
|
||||
// if (cr16_instruction[i].size == 2)
|
||||
// match_bits += 15;
|
||||
printf ("{");
|
||||
printf ("%d,%d",cr16_instruction[i].operands[k].shift,flags);
|
||||
printf ("%d,%d",optype, shift);
|
||||
printf ("}");
|
||||
j = 1;
|
||||
}
|
||||
}
|
||||
if (j)
|
||||
printf ("}");
|
||||
printf ("},\n");
|
||||
}
|
||||
}
|
||||
//printf (" { 0,0,0,0,(void (*)(void))0,0,{0,0,0}},\n};\n");
|
||||
printf (" { \"NULL\",1,8,0,0,\"OP_0_20\",OP_0_20,0,{0,0,0}},\n};\n");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue