Permalink
Browse files

added support for short int signed read from unsigned int reg from ac…

…cumulator
  • Loading branch information...
1 parent f41cc07 commit f675333b1ca711929fb9a59913ec7edd308ca2e1 @kristianpaul committed Dec 12, 2011
Showing with 32 additions and 29 deletions.
  1. +32 −4 software/bios/main.c
  2. +0 −25 software/include/hal/correlator.h
View
@@ -91,7 +91,7 @@ const int prn_code[38] =
/* MMIO */
#define MM_READ(reg) (*((volatile unsigned int *)(reg)))
-#define MM_READS(reg) (*((volatile signed short int *)(reg)))
+#define MM_READS(reg) (short int)(*((volatile unsigned int *)(reg)))
#define MM_WRITE(reg, val) *((volatile unsigned int *)(reg)) = val
/* General address space functions */
@@ -203,6 +203,32 @@ static void namurumeasure()
}
printf("Bye\n");
}
+static void namuruaccumone()
+{
+ char *c;
+// short int value;
+ printf("Accumulator: \n");
+ printf("I_P\n");
+ /* missing polling accum int pin */
+ while(1)
+ {
+
+// volatile unsigned int *ch_prompt = CH0_I_PROMPT;
+// value = (short int) *ch_prompt;
+ //printf("%d\n",(short int)(*((volatile unsigned int *)(CH0_I_PROMPT))));
+ printf("%d\n",MM_READS(CH0_I_PROMPT));
+ MM_WRITE(CLEAR_STATUS,0x0f);
+ MM_WRITE(CH0_ENABLES,0xff);
+ if(readchar_nonblock())
+ {
+ c = readchar();
+ if(c == 'q')
+ break;
+ }
+ }
+ printf("\n");
+
+}
static void namuruaccumu()
{
char *c;
@@ -637,6 +663,7 @@ static void help()
puts("namurumeasure - no dump,measure TPs with scope ");
puts("namuruaccums - dump accumlators as signed to screen");
puts("namuruaccumu - dump accumlators as un-signed to screen");
+ puts("namuruaccumone - dump one accumlator as signed to screen");
puts("memtest1 - memory speed test, use a stopwatch!");
puts("printmath - confirm some signed/unsiged visualization");
}
@@ -692,6 +719,7 @@ static void do_command(char *c)
else if(strcmp(token, "namurumeasure") == 0) namurumeasure();
else if(strcmp(token, "namuruaccums") == 0) namuruaccums();
else if(strcmp(token, "namuruaccumu") == 0) namuruaccumu();
+ else if(strcmp(token, "namuruaccumone") == 0) namuruaccumone();
else if(strcmp(token, "memtest1") == 0) memtest1();
else if(strcmp(token, "printmath") == 0) printmath();
@@ -861,7 +889,7 @@ int main(int i, char **c)
putsnonl(banner);
crcbios();
brd_init();
- tmu_init(); /* < for hardware-accelerated scrolling */
+ //tmu_init(); /* < for hardware-accelerated scrolling */
//usb_init();
//ukb_init();
@@ -872,8 +900,8 @@ int main(int i, char **c)
ethreset(); /* < that pesky ethernet PHY needs two resets at times... */
print_mac();
boot_sequence();
- vga_unblank();
- vga_set_console(1);
+ //vga_unblank();
+ //vga_set_console(1);
while(1) {
putsnonl("\e[1mBIOS>\e[0m ");
readstr(buffer, 64);
@@ -1,25 +0,0 @@
-/*
- * Milkymist SoC (Software)
- * Copyleft 2011 Cristian Paul Peñarada
- *
- * 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
- * the Free Software Foundation, version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * 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/>.
- */
-
-#ifndef __HAL_CORRELATOR_H
-#define __HAL_CORRELATOR_H
-
-void correlator_init();
-
-void correlator_isr();
-
-#endif /* __HAL_correlator_H */

0 comments on commit f675333

Please sign in to comment.