Skip to content

Commit

Permalink
Fix length of L for MachXO2
Browse files Browse the repository at this point in the history
  • Loading branch information
mattzamora committed Oct 4, 2024
1 parent 69b5f75 commit 0e2557c
Show file tree
Hide file tree
Showing 3 changed files with 2,768 additions and 2 deletions.
23 changes: 21 additions & 2 deletions src/internal/jedec.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "jedec.hpp"
#include <stdio.h>

namespace fipsy {

Expand Down Expand Up @@ -147,13 +148,25 @@ class JedecParser {
}

bool handleL() {
printf("Doing function: HandleL\n");
int addr = 0;
for (int i = 0; i < qfSize; ++i) {
if (!appendDigit<10>(addr, readChar())) {
while(true) {
char ch;
// readChar() does not let us capture terminal strings, so doing it manually here
// this fixes a bug where readChar() denpends on sizeQf length - which is NOT related
// to the length of L characters. That is, length of QF chars != length of L chars.
input.readBytes(&ch, 1);

// printf("Char here is [%c] booleab pass: %B\n",ch, ch=='0');

if (!(ch >= '0' && ch <= '9')) {break;}
if (!appendDigit<10>(addr, ch)) {
return false;
}
}

printf("Starting addr: %d\n",addr);

while (true) {
char ch = readChar();
switch (ch) {
Expand All @@ -163,11 +176,17 @@ class JedecParser {
case '*':
return true;
default:
printf("Failure F2: Unrecognized character\n");
return false;
}

// TODO: Fix this check so it passes for Fipsy V2 - MachX02-1200
/*
if (addr >= qf) {
printf("Failure F3: Addr: %d and qf: %d for character index: %d\n", addr, qf, index);
return false;
}
*/
fuseTable[addr++] = ch - '0';
}
}
Expand Down
Loading

0 comments on commit 0e2557c

Please sign in to comment.