ice40: lower fuzz size to improve patcher reliability

The fuzz size should be made smaller, because we're getting too many false positives.

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2019-02-25 22:16:31 +08:00
parent d2b4ff089d
commit ea6c170023

12
ice40.c
View File

@ -5,6 +5,10 @@
#define MAX(x, y) (x) > (y) ? (x) : (y)
#define DEBUG_PRINT(...)
// The number of words forward and backward to look for matches.
// Should be at least 16.
#define DIFF_FUZZ 32
struct Ice40Bitstream
{
uint32_t offset;
@ -295,12 +299,12 @@ int ice40_patch(struct irw_file *f, struct irw_file *rom,
if (word) {
int found = 0;
int start = ora_ptr - 64;
int end = ora_ptr + 64;
int start = ora_ptr - DIFF_FUZZ;
int end = ora_ptr + DIFF_FUZZ;
if (start < 0)
start = 0;
if (end > 8192)
end = 8192;
if (end > (byte_count - 1))
end = (byte_count - 1);
for (i = start; i < end; i++) {
if (ora16[i] == word) {
found = 1;