summaryrefslogtreecommitdiffstats
path: root/fpga/xilinx/programmer/bit2svf/commands.c
diff options
context:
space:
mode:
Diffstat (limited to 'fpga/xilinx/programmer/bit2svf/commands.c')
-rw-r--r--fpga/xilinx/programmer/bit2svf/commands.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/fpga/xilinx/programmer/bit2svf/commands.c b/fpga/xilinx/programmer/bit2svf/commands.c
index c4a9493..bddeec4 100644
--- a/fpga/xilinx/programmer/bit2svf/commands.c
+++ b/fpga/xilinx/programmer/bit2svf/commands.c
@@ -2,7 +2,8 @@
Copyright (c) 2005 Juan Pablo D. Borgna <jpborgna en inti gov ar>
Copyright (c) 2006-2007 Salvador E. Tropea <salvador en inti gov ar>
- Copyright (c) 2005-2007 Instituto Nacional de Tecnología Industrial
+ Copyright (c) 2005-2007 Instituto Nacional de Tecnolog�a Industrial
+ Copyright (c) 2012 Timothy Pearson <kb9vqf@pearsoncomputing.net>
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
@@ -276,6 +277,30 @@ do_command(char *cmd, FILE *dfp, FILE *ofp, int *col)
}
/* end SBITS command */
+ /* SADDBITS command */
+ if (strstr(cmd,"SADDBITS"))
+ {
+ /* get the args inside the () */
+ args_pos_s=strchr(cmd,'(');
+ args_pos_e=strchr(cmd,')');
+ if((!args_pos_s && args_pos_e )|| (!args_pos_e && args_pos_s))
+ {
+ fprintf(stderr,"Bad argument specification in $SADDBITS(VAL)$\n");
+ return 1;
+ }
+ if (!args_pos_s && !args_pos_e)
+ {
+ fprintf(stderr,"Bad argument specification in $SADDBITS(VAL)$\n");
+ return 1;
+ }
+ memcpy(args,args_pos_s+1,(size_t)(args_pos_e-args_pos_s)); /* Copy the argument */
+ args[args_pos_e-args_pos_s-1]='\0'; /* Put the null terminator */
+ value=value_from(args);
+ *col+=fprintf(ofp,"%d",(unsigned int)(s_bits+value));
+ return 0;
+ }
+ /* end SADDBITS command */
+
/* SBYTES command */
if (strstr(cmd,"SBYTES"))
{