mirror of
https://github.com/Architeuthis-Flux/Jumperless.git
synced 2024-11-12 01:30:50 +01:00
chippin' away at shit
This commit is contained in:
parent
8f5e2a5e93
commit
f98f819cca
@ -20,11 +20,14 @@ D2-33,
|
||||
D9,18,
|
||||
D5-44,
|
||||
A2-33,
|
||||
25-55,
|
||||
}
|
||||
|
||||
special functions //these are connected first so DNIs will be applied to all the nets
|
||||
{
|
||||
19-GND,
|
||||
52-GND,
|
||||
53-GND,
|
||||
11-SUPPLY_5V,
|
||||
D10-SUPPLY_3V3,
|
||||
6-I_P,
|
||||
|
18
JumperlessNano/data/nodeFile23.txt
Normal file
18
JumperlessNano/data/nodeFile23.txt
Normal file
@ -0,0 +1,18 @@
|
||||
bridges
|
||||
{
|
||||
}
|
||||
|
||||
special functions //these are connected first so DNIs will be applied to all the nets
|
||||
{
|
||||
60-GND,
|
||||
59-GND,
|
||||
29-SUPPLY_5V,
|
||||
30-SUPPLY_5V,
|
||||
16-SUPPLY_3V3,
|
||||
15-SUPPLY_3V3,
|
||||
1-DAC0_5V,
|
||||
2-DAC0_5V,
|
||||
31-DAC1_8V,
|
||||
32-DAC1_8V,
|
||||
}
|
||||
|
@ -97,36 +97,40 @@
|
||||
#define t30 30
|
||||
|
||||
|
||||
#define b1 32
|
||||
#define b2 33
|
||||
#define b3 34
|
||||
#define b4 35
|
||||
#define b5 36
|
||||
#define b6 37
|
||||
#define b7 38
|
||||
#define b8 39
|
||||
#define b9 40
|
||||
#define b10 41
|
||||
#define b11 42
|
||||
#define b12 43
|
||||
#define b13 44
|
||||
#define b14 45
|
||||
#define b15 46
|
||||
#define b16 47
|
||||
#define b17 48
|
||||
#define b18 49
|
||||
#define b19 50
|
||||
#define b20 51
|
||||
#define b21 52
|
||||
#define b22 53
|
||||
#define b23 54
|
||||
#define b24 55
|
||||
#define b25 56
|
||||
#define b26 57
|
||||
#define b27 58
|
||||
#define b28 59
|
||||
#define b29 60
|
||||
#define b30 61
|
||||
#define b1 31
|
||||
#define b2 32
|
||||
#define b3 33
|
||||
#define b4 34
|
||||
#define b5 35
|
||||
#define b6 36
|
||||
#define b7 37
|
||||
#define b8 38
|
||||
#define b9 39
|
||||
#define b10 40
|
||||
#define b11 41
|
||||
#define b12 42
|
||||
#define b13 43
|
||||
#define b14 44
|
||||
#define b15 45
|
||||
#define b16 46
|
||||
#define b17 47
|
||||
#define b18 48
|
||||
#define b19 49
|
||||
#define b20 50
|
||||
#define b21 51
|
||||
#define b22 52
|
||||
#define b23 53
|
||||
#define b24 54
|
||||
#define b25 55
|
||||
#define b26 56
|
||||
#define b27 57
|
||||
#define b28 58
|
||||
#define b29 59
|
||||
#define b30 60
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define NANO_D0 70 //these are completely arbitrary but they should come in handy
|
||||
|
@ -1,5 +1,7 @@
|
||||
#include "LEDs.h"
|
||||
#include <Adafruit_NeoPixel.h>
|
||||
#include "NetsToChipConnections.h"
|
||||
#include "MatrixStateRP2040.h"
|
||||
|
||||
Adafruit_NeoPixel leds(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
|
||||
|
||||
@ -39,4 +41,191 @@ void rainbowy(int saturation, int brightness, int wait)
|
||||
leds.show(); // Update strip with new contents
|
||||
delay(wait); // Pause for a moment
|
||||
}
|
||||
}
|
||||
|
||||
void assignNetColors (void)
|
||||
{
|
||||
//numberOfNets = 60;
|
||||
|
||||
|
||||
|
||||
|
||||
uint16_t colorDistance = 0xffff / numberOfNets;
|
||||
uint32_t netColors[numberOfNets];
|
||||
|
||||
uint32_t specialNetColors[8] =
|
||||
{0x000000,
|
||||
0x00FF80,
|
||||
0xFF4114,
|
||||
0xFF0040,
|
||||
0xFF7800,
|
||||
0xFF4078,
|
||||
0xFFC8C8,
|
||||
0xC8FFC8};
|
||||
|
||||
uint32_t railColors[4] =
|
||||
{
|
||||
0xFF4114,
|
||||
0x00FF80,
|
||||
0xFF0040,
|
||||
0x00FF80};
|
||||
|
||||
|
||||
|
||||
Serial.print("colorDistance: ");
|
||||
Serial.print(colorDistance);
|
||||
Serial.print("\n\r");
|
||||
Serial.print("numberOfNets: ");
|
||||
Serial.print(numberOfNets);
|
||||
Serial.print("\n\rassigning net colors\n\r");
|
||||
|
||||
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
|
||||
netColors[i] = specialNetColors[i];
|
||||
net[i].color = netColors[i];
|
||||
Serial.print("\n\r");
|
||||
Serial.print(net[i].name);
|
||||
Serial.print("\t");
|
||||
Serial.print(net[i].color, HEX);
|
||||
|
||||
}
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
|
||||
|
||||
|
||||
leds.setPixelColor(railsToPixelMap[0][i], railColors[0] ); //top positive rail
|
||||
|
||||
|
||||
leds.setPixelColor(railsToPixelMap[1][i], railColors[1]); //top negative rail
|
||||
|
||||
|
||||
leds.setPixelColor(railsToPixelMap[2][i], railColors[2]); //bottom positive rail
|
||||
|
||||
|
||||
leds.setPixelColor(railsToPixelMap[3][i], railColors[3]); //bottom negative rail
|
||||
|
||||
//leds.show();
|
||||
|
||||
}
|
||||
|
||||
delay(1000);
|
||||
int skipSpecialColors = 0;
|
||||
|
||||
for(int i = 8; i < numberOfNets; i++)
|
||||
{
|
||||
|
||||
for (int j = 1; j < 8; j++)
|
||||
{
|
||||
if (leds.gamma32(leds.ColorHSV(colorDistance * (j + skipSpecialColors),255,200) - leds.ColorHSV(specialNetColors[j],255,200)) < (colorDistance))
|
||||
{
|
||||
Serial.print("\n\rskipping color: ");
|
||||
Serial.print(colorDistance * (j + skipSpecialColors),HEX);
|
||||
Serial.print("\n\r");
|
||||
Serial.print(i);
|
||||
Serial.print("\t");
|
||||
|
||||
Serial.print(leds.gamma32(leds.ColorHSV(colorDistance * (j + skipSpecialColors),255,200)),HEX);
|
||||
Serial.print(" == ");
|
||||
Serial.print(leds.gamma32(leds.ColorHSV(specialNetColors[j],255,200)),HEX);
|
||||
Serial.print("\t");
|
||||
Serial.print(j);
|
||||
Serial.print("\n\r");
|
||||
|
||||
skipSpecialColors++;
|
||||
colorDistance = 0xffff / (numberOfNets + skipSpecialColors);
|
||||
Serial.print("colorDistance: ");
|
||||
Serial.print(colorDistance,HEX);
|
||||
Serial.print("\n\r");
|
||||
|
||||
} else if (leds.gamma32(leds.ColorHSV(colorDistance * (j + skipSpecialColors),255,200) - leds.ColorHSV(specialNetColors[j],255,200)) < (colorDistance))
|
||||
{
|
||||
Serial.print("\n\rskipping color: ");
|
||||
Serial.print(colorDistance * (j + skipSpecialColors),HEX);
|
||||
Serial.print("\n\r");
|
||||
Serial.print(leds.gamma32(leds.ColorHSV(colorDistance * (j + skipSpecialColors),255,200)),HEX);
|
||||
Serial.print(" == ");
|
||||
Serial.print(leds.gamma32(leds.ColorHSV(specialNetColors[j],255,200)),HEX);
|
||||
Serial.print("\n\r");
|
||||
skipSpecialColors++;
|
||||
colorDistance = 0xffff / (numberOfNets + skipSpecialColors);
|
||||
Serial.print("colorDistance: ");
|
||||
Serial.print(colorDistance,HEX);
|
||||
Serial.print("\n\r");
|
||||
} else {
|
||||
netColors[i] = leds.gamma32(leds.ColorHSV(colorDistance * (i + skipSpecialColors),255,200));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//leds.setPixelColor(i, netColors[i]);
|
||||
|
||||
|
||||
net[i].color = netColors[i];
|
||||
Serial.print("\n\r");
|
||||
Serial.print(net[i].name);
|
||||
Serial.print("\t");
|
||||
Serial.print(net[i].color,HEX);
|
||||
}
|
||||
//leds.show();
|
||||
//delay(100000);
|
||||
for (int i = 0; i < numberOfNets; i++)
|
||||
{
|
||||
if (net[i].nodes[1] != 0 && net[i].nodes[1] < 62)
|
||||
{
|
||||
|
||||
|
||||
for (int j = 0; j < MAX_NODES; j++)
|
||||
{
|
||||
if (net[i].nodes[j] == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (net[i].nodes[j] < 62)
|
||||
{
|
||||
leds.setPixelColor(nodesToPixelMap[net[i].nodes[j]], net[i].color);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
leds.show();
|
||||
delay(1200);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void showNets(void)
|
||||
{
|
||||
|
||||
for (int i = 0; i < numberOfNets; i++)
|
||||
{
|
||||
for (int j = 0; j < numberOfPaths; j++)
|
||||
{
|
||||
leds.setPixelColor(bbPixelToNodesMap[net[i].nodes[j]], net[i].color);
|
||||
}
|
||||
}
|
||||
leds.show();
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -11,14 +11,16 @@
|
||||
|
||||
extern Adafruit_NeoPixel leds;
|
||||
|
||||
const int nodesToPixelMap[69] = { 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,
|
||||
30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61};
|
||||
|
||||
const int bbPixelToNodesMap[62] = { 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,
|
||||
32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61};
|
||||
|
||||
const int railsToPixelMap[4][5] = {{71,74,75,78,79},//top positive rail
|
||||
{72,73,76,77,80},//top negative rail
|
||||
{70,67,66,63,62},//bottom positive rail
|
||||
{69,68,65,64,61}};//bottom negative rail
|
||||
const int railsToPixelMap[4][5] = {{70,73,74,77,78},//top positive rail
|
||||
{71,72,75,76,79},//top negative rail
|
||||
{69,66,65,62,61},//bottom positive rail
|
||||
{68,67,64,63,60}};//bottom negative rail
|
||||
|
||||
|
||||
const int pixelsToRails[20] = {B_RAIL_NEG, B_RAIL_POS, B_RAIL_POS, B_RAIL_NEG, B_RAIL_NEG, B_RAIL_POS, B_RAIL_POS, B_RAIL_NEG, B_RAIL_NEG, B_RAIL_POS,
|
||||
@ -28,5 +30,7 @@ void initLEDs(void);
|
||||
|
||||
void colorWipe(uint32_t color, int wait);
|
||||
void rainbowy(int ,int, int wait);
|
||||
void showNets(void);
|
||||
void assignNetColors (void);
|
||||
|
||||
#endif
|
@ -22,6 +22,23 @@ struct netStruct net[MAX_NETS] = { //these are the special function nets that wi
|
||||
char *netNameConstants[MAX_NETS] = {(char*)"Net 0",(char*)"Net 1",(char*)"Net 2",(char*)"Net 3",(char*)"Net 4",(char*)"Net 5",(char*)"Net 6",(char*)"Net 7",(char*)"Net 8",(char*)"Net 9",(char*)"Net 10",(char*)"Net 11",(char*)"Net 12",(char*)"Net 13",(char*)"Net 14",(char*)"Net 15",(char*)"Net 16",(char*)"Net 17",(char*)"Net 18",(char*)"Net 19",(char*)"Net 20",(char*)"Net 21",(char*)"Net 22",(char*)"Net 23",(char*)"Net 24",(char*)"Net 25",(char*)"Net 26",(char*)"Net 27",(char*)"Net 28",(char*)"Net 29",(char*)"Net 30",(char*)"Net 31",(char*)"Net 32",(char*)"Net 33",(char*)"Net 34",(char*)"Net 35",(char*)"Net 36",(char*)"Net 37",(char*)"Net 38",(char*)"Net 39",(char*)"Net 40",(char*)"Net 41",(char*)"Net 42",(char*)"Net 43",(char*)"Net 44",(char*)"Net 45",(char*)"Net 46",(char*)"Net 47",(char*)"Net 48",(char*)"Net 49",(char*)"Net 50",(char*)"Net 51",(char*)"Net 52",(char*)"Net 53",(char*)"Net 54",(char*)"Net 55",(char*)"Net 56",(char*)"Net 57",(char*)"Net 58",(char*)"Net 59",(char*)"Net 60",(char*)"Net 61",(char*)"Net 62"};//,{"Net 63",(char*)"Net 64",(char*)"Net 65",(char*)"Net 66",(char*)"Net 67",(char*)"Net 68",(char*)"Net 69",(char*)"Net 70",(char*)"Net 71",(char*)"Net 72",(char*)"Net 73",(char*)"Net 74",(char*)"Net 75",(char*)"Net 76",(char*)"Net 77",(char*)"Net 78",(char*)"Net 79",(char*)"Net 80",(char*)"Net 81",(char*)"Net 82",(char*)"Net 83",(char*)"Net 84",(char*)"Net 85",(char*)"Net 86",(char*)"Net 87",(char*)"Net 88",(char*)"Net 89",(char*)"Net 90",(char*)"Net 91",(char*)"Net 92",(char*)"Net 93",(char*)"Net 94",(char*)"Net 95",(char*)"Net 96",(char*)"Net 97",(char*)"Net 98",(char*)"Net 99",(char*)"Net 100",(char*)"Net 101",(char*)"Net 102",(char*)"Net 103",(char*)"Net 104",(char*)"Net 105",(char*)"Net 106",(char*)"Net 107",(char*)"Net 108",(char*)"Net 109",(char*)"Net 110",(char*)"Net 111",(char*)"Net 112",(char*)"Net 113",(char*)"Net 114",(char*)"Net 115",(char*)"Net 116",(char*)"Net 117",(char*)"Net 118",(char*)"Net 119",(char*)"Net 120",(char*)"Net 121",(char*)"Net 122",(char*)"Net 123",(char*)"Net 124",(char*)"Net 125",(char*)"Net 126",(char*)"Net 127"}};
|
||||
//char (*netNamesPtr) = netNameConstants[0];
|
||||
|
||||
|
||||
//note that the bottom row is shifted from the schematic by one, so the nodes are what's written on the board
|
||||
const int bbNodesToChip[62] = {-1,CHIP_L, //0,1
|
||||
CHIP_A,CHIP_A,CHIP_A,CHIP_A,CHIP_A,CHIP_A,CHIP_A, // 2, 3, 4, 5, 6, 7, 8
|
||||
CHIP_B,CHIP_B,CHIP_B,CHIP_B,CHIP_B,CHIP_B,CHIP_B, // 9,10,11,12,13,14,15
|
||||
CHIP_C,CHIP_C,CHIP_C,CHIP_C,CHIP_C,CHIP_C,CHIP_C, //16,17,18,19,20,21,22
|
||||
CHIP_D,CHIP_D,CHIP_D,CHIP_D,CHIP_D,CHIP_D,CHIP_D, //23,24,25,26,27,28,29
|
||||
CHIP_L,CHIP_L, //30,31
|
||||
CHIP_E,CHIP_E,CHIP_E,CHIP_E,CHIP_E,CHIP_E,CHIP_E, //32,33,34,35,36,37,38
|
||||
CHIP_F,CHIP_F,CHIP_F,CHIP_F,CHIP_F,CHIP_F,CHIP_F, //39,40,41,42,43,44,45
|
||||
CHIP_G,CHIP_G,CHIP_G,CHIP_G,CHIP_G,CHIP_G,CHIP_G, //46,47,48,49,50,51,52
|
||||
CHIP_H,CHIP_H,CHIP_H,CHIP_H,CHIP_H,CHIP_H,CHIP_H, //53,54,55,56,57,58,59
|
||||
CHIP_L}; //60
|
||||
|
||||
|
||||
|
||||
|
||||
struct chipStatus ch[12] = {
|
||||
{0,'A',
|
||||
{-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, // x status
|
||||
|
@ -23,13 +23,14 @@ int8_t doNotIntersectNodes[8]; //if the net tries to share a node with a net tha
|
||||
|
||||
uint8_t priority = 0; //priority = 1 means it will move connections to take the most direct path, priority = 2 means connections will be doubled up when possible, priority = 3 means both
|
||||
|
||||
|
||||
uint32_t color; //color of the net in hex
|
||||
};
|
||||
|
||||
extern struct netStruct net[MAX_NETS];
|
||||
|
||||
extern char *netNameConstants[MAX_NETS];
|
||||
|
||||
extern const int bbNodesToChip[62];
|
||||
|
||||
struct chipStatus{
|
||||
|
||||
@ -85,6 +86,9 @@ const int8_t reversePinMap[110];// = {NANO_D0, NANO_D1, NANO_D2, NANO_D3, NANO_D
|
||||
extern struct nanoStatus nano;
|
||||
|
||||
//see the comments at the end for a more nicely formatted version that's not in struct initalizers
|
||||
enum pathType {BBtoBB, BBtoNANO, NANOtoNANO, BBtoSF, NANOtoSF};
|
||||
|
||||
enum nodeType {BB, NANO, SF};
|
||||
|
||||
struct pathStruct{
|
||||
|
||||
@ -96,9 +100,15 @@ struct pathStruct{
|
||||
int x[3];
|
||||
int y[3];
|
||||
int candidates[3][3];
|
||||
int altPathNeeded;
|
||||
enum pathType pathType;
|
||||
enum nodeType nodeType[3];
|
||||
bool sameChip;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
extern struct pathStruct path[MAX_BRIDGES]; //this is the array of paths
|
||||
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <Arduino.h>
|
||||
#include "MatrixStateRP2040.h"
|
||||
#include "SafeString.h"
|
||||
#include "NetsToChipConnections.h"
|
||||
|
||||
int8_t newNode1 = -1;
|
||||
int8_t newNode2 = -1;
|
||||
@ -74,6 +75,8 @@ void getNodesToConnect() // read in the nodes you'd like to connect
|
||||
}
|
||||
if (debugNM)
|
||||
Serial.println("done");
|
||||
|
||||
sortPathsByNet();
|
||||
}
|
||||
|
||||
int searchExistingNets(int node1, int node2) // search through existing nets for all nodes that match either one of the new nodes (so it will be added to that net)
|
||||
|
@ -20,10 +20,40 @@ int bbToSfLanes[8][4] = {{0}}; // [Ch
|
||||
int numberOfUniqueNets = 0;
|
||||
int numberOfNets = 0;
|
||||
int numberOfPaths = 0;
|
||||
|
||||
unsigned long timeToSort = 0;
|
||||
|
||||
bool debugNTCC = false;
|
||||
|
||||
/*
|
||||
sort paths by net
|
||||
|
||||
find start and end chips - update chipStatus struct there
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
for each path
|
||||
find start and end chips
|
||||
resolve chip candidates
|
||||
sort chips least to most crowded
|
||||
assign chips to path
|
||||
update bbToSfLanes
|
||||
update chipsLeastToMostCrowded
|
||||
update sfChipsLeastToMostCrowded
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
void sortPathsByNet(void) // not actually sorting, just copying the bridges and nets back from netStruct so they're both in the same order
|
||||
{
|
||||
timeToSort = micros();
|
||||
@ -129,7 +159,7 @@ void bridgesToPaths(void)
|
||||
|
||||
printPathArray();
|
||||
sortAllChipsLeastToMostCrowded();
|
||||
resolveChipCandidates();
|
||||
//resolveChipCandidates();
|
||||
}
|
||||
|
||||
void findStartAndEndChips(int node1, int node2, int pathIdx)
|
||||
@ -151,7 +181,7 @@ void findStartAndEndChips(int node1, int node2, int pathIdx)
|
||||
Serial.println(" ");
|
||||
int candidatesFound = 0;
|
||||
|
||||
switch (bothNodes[twice]) // not checking availability, just finding the chip
|
||||
switch (bothNodes[twice])
|
||||
{
|
||||
|
||||
case 1:
|
||||
@ -159,32 +189,22 @@ void findStartAndEndChips(int node1, int node2, int pathIdx)
|
||||
case 32:
|
||||
case 61:
|
||||
{
|
||||
startEndChip[twice] = CHIP_L;
|
||||
Serial.print("sf chip: ");
|
||||
Serial.println(chipNumToChar(startEndChip[twice]));
|
||||
path[pathIdx].chip[twice] = startEndChip[twice];
|
||||
|
||||
|
||||
path[pathIdx].chip[twice] = CHIP_L;
|
||||
Serial.print("chip: ");
|
||||
Serial.println(chipNumToChar(path[pathIdx].chip[twice]));
|
||||
break;
|
||||
}
|
||||
|
||||
case 2 ... 29: // on the breadboard
|
||||
case 33 ... 60:
|
||||
{
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
for (int j = 1; j < 8; j++) // start at 1 so we dont confuse CHIP_L for a node
|
||||
{
|
||||
if (ch[i].yMap[j] == bothNodes[twice])
|
||||
{
|
||||
startEndChip[twice] = i;
|
||||
Serial.print("bb chip: ");
|
||||
Serial.println(chipNumToChar(startEndChip[twice]));
|
||||
path[pathIdx].chip[twice] = startEndChip[twice];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
path[pathIdx].chip[twice] = bbNodesToChip[bothNodes[twice]];
|
||||
Serial.print("chip: ");
|
||||
Serial.println(chipNumToChar(path[pathIdx].chip[twice]));
|
||||
break;
|
||||
|
||||
}
|
||||
case NANO_D0 ... NANO_A7: // on the nano
|
||||
{
|
||||
@ -192,10 +212,11 @@ void findStartAndEndChips(int node1, int node2, int pathIdx)
|
||||
|
||||
if (nano.numConns[nanoIndex] == 1)
|
||||
{
|
||||
startEndChip[twice] = nano.mapIJ[nanoIndex];
|
||||
Serial.print("nano chip: ");
|
||||
Serial.println(chipNumToChar(startEndChip[twice]));
|
||||
path[pathIdx].chip[twice] = startEndChip[twice];
|
||||
|
||||
path[pathIdx].chip[twice] = nano.mapIJ[nanoIndex];
|
||||
Serial.println(chipNumToChar(path[pathIdx].chip[twice]));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -230,21 +251,189 @@ void findStartAndEndChips(int node1, int node2, int pathIdx)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (candidatesFound == 1)
|
||||
{
|
||||
path[pathIdx].chip[twice] = chipCandidates[twice][0];
|
||||
Serial.print("\n\rchip: ");
|
||||
path[pathIdx].candidates[twice][0] = -1;
|
||||
Serial.println(chipNumToChar(path[pathIdx].chip[twice]));
|
||||
}
|
||||
|
||||
Serial.println(" ");
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
// Serial.print("\n\r");
|
||||
|
||||
mergeOverlappingCandidates(pathIdx);
|
||||
assignPathType(pathIdx);
|
||||
}
|
||||
|
||||
if (startEndChip[0] == -1 || startEndChip[1] == -1)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void mergeOverlappingCandidates (int pathIndex) //also sets altPathNeeded flag if theyre on different sf chips (there are no direct connections between them)
|
||||
{
|
||||
if (path[pathIndex].candidates[0][0] != -1 && path[pathIndex].candidates[1][0] != -1)
|
||||
{
|
||||
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
if (path[pathIndex].candidates[0][i] == path[pathIndex].candidates[1][j])
|
||||
{
|
||||
path[pathIndex].chip[0] = path[pathIndex].candidates[0][i];
|
||||
path[pathIndex].chip[1] = path[pathIndex].candidates[0][i];
|
||||
path[pathIndex].candidates[0][0] = -1;
|
||||
path[pathIndex].candidates[0][1] = -1;
|
||||
path[pathIndex].candidates[0][2] = -1;
|
||||
path[pathIndex].candidates[1][0] = -1;
|
||||
path[pathIndex].candidates[1][1] = -1;
|
||||
path[pathIndex].candidates[1][2] = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//path[pathIndex].altPathNeeded = 1;
|
||||
}
|
||||
|
||||
if (path[pathIndex].chip[0] >= CHIP_I && path[pathIndex].chip[1] >= CHIP_I)
|
||||
{
|
||||
if (path[pathIndex].chip[0] != path[pathIndex].chip[1])
|
||||
{
|
||||
path[pathIndex].altPathNeeded = 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void assignPathType (int pathIndex)
|
||||
{
|
||||
|
||||
if (path[pathIndex].chip[0] == path[pathIndex].chip[1])
|
||||
{
|
||||
path[pathIndex].sameChip = true;
|
||||
} else {
|
||||
path[pathIndex].sameChip = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ((path[pathIndex].node1 >= 1 && path[pathIndex].node1 <= 30) || (path[pathIndex].node1 >= 31 && path[pathIndex].node1 <= 60))
|
||||
{
|
||||
if (path[pathIndex].node1 == 1 || path[pathIndex].node1 == 30 || path[pathIndex].node1 == 31 || path[pathIndex].node1 == 60)
|
||||
{
|
||||
path[pathIndex].nodeType[0] = BB; //maybe have a separate type for ChipL connected nodes, but not now
|
||||
} else {
|
||||
path[pathIndex].nodeType[0] = BB;
|
||||
}
|
||||
|
||||
} else if (path[pathIndex].node1 >= NANO_D0 && path[pathIndex].node1 <= NANO_A7)
|
||||
{
|
||||
path[pathIndex].nodeType[0] = NANO;
|
||||
|
||||
} else if (path[pathIndex].node1 >= GND && path[pathIndex].node1 <= CURRENT_SENSE_MINUS)
|
||||
{
|
||||
path[pathIndex].nodeType[0] = SF;
|
||||
}
|
||||
|
||||
if ((path[pathIndex].node2 >= 1 && path[pathIndex].node2 <= 30) || (path[pathIndex].node2 >= 31 && path[pathIndex].node2 <= 60))
|
||||
{
|
||||
if (path[pathIndex].node2 == 1 || path[pathIndex].node2 == 30 || path[pathIndex].node2 == 31 || path[pathIndex].node2 == 60)
|
||||
{
|
||||
path[pathIndex].nodeType[1] = BB; //maybe have a separate type for ChipL connected nodes, but not now
|
||||
} else {
|
||||
path[pathIndex].nodeType[1] = BB;
|
||||
}
|
||||
|
||||
} else if (path[pathIndex].node2 >= NANO_D0 && path[pathIndex].node2 <= NANO_A7)
|
||||
{
|
||||
path[pathIndex].nodeType[1] = NANO;
|
||||
|
||||
} else if (path[pathIndex].node2 >= GND && path[pathIndex].node2 <= CURRENT_SENSE_MINUS)
|
||||
{
|
||||
path[pathIndex].nodeType[1] = SF;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ((path[pathIndex].nodeType[0] == SF && path[pathIndex].nodeType[1] == NANO) || (path[pathIndex].nodeType[0] == NANO && path[pathIndex].nodeType[1] == SF))
|
||||
{
|
||||
path[pathIndex].pathType = NANOtoSF;
|
||||
|
||||
} else if ((path[pathIndex].nodeType[0] == BB && path[pathIndex].nodeType[1] == SF) || (path[pathIndex].nodeType[0] == SF && path[pathIndex].nodeType[1] == BB))
|
||||
{
|
||||
path[pathIndex].pathType = BBtoSF;
|
||||
|
||||
} else if ((path[pathIndex].nodeType[0] == BB && path[pathIndex].nodeType[1] == NANO) || (path[pathIndex].nodeType[0] == NANO && path[pathIndex].nodeType[1] == BB))
|
||||
{
|
||||
path[pathIndex].pathType = BBtoNANO;
|
||||
|
||||
} else if (path[pathIndex].nodeType[0] == BB && path[pathIndex].nodeType[1] == BB)
|
||||
{
|
||||
path[pathIndex].pathType = BBtoBB;
|
||||
|
||||
} else if (path[pathIndex].nodeType[0] == NANO && path[pathIndex].nodeType[1] == NANO)
|
||||
{
|
||||
path[pathIndex].pathType = NANOtoNANO;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
int xMapForNode(int node, int chip)
|
||||
{
|
||||
int nodeFound = 0;
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
if (ch[chip].xMap[i] == node)
|
||||
{
|
||||
nodeFound = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return nodeFound;
|
||||
|
||||
}
|
||||
|
||||
int yMapForNode(int node, int chip)
|
||||
{
|
||||
int nodeFound = 0;
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
if (ch[chip].yMap[i] == node)
|
||||
{
|
||||
nodeFound = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return nodeFound;
|
||||
}
|
||||
|
||||
int xMapForChip(int chip)
|
||||
{
|
||||
int nodeFound = 0;
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
if (ch[chip].xMap[i] == chip)
|
||||
{
|
||||
nodeFound = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return nodeFound;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void resolveChipCandidates(void)
|
||||
{
|
||||
int nodesToResolve[2] = {0, 0}; // {node1,node2} 0 = already found, 1 = needs resolving
|
||||
@ -334,6 +523,8 @@ int moreAvailableChip(int chip1, int chip2)
|
||||
{
|
||||
int chipChosen = -1;
|
||||
sortAllChipsLeastToMostCrowded();
|
||||
sortSFchipsLeastToMostCrowded();
|
||||
|
||||
|
||||
for (int i = 0; i < 12; i++)
|
||||
{
|
||||
@ -346,6 +537,7 @@ int moreAvailableChip(int chip1, int chip2)
|
||||
return chipChosen;
|
||||
}
|
||||
|
||||
|
||||
void sortSFchipsLeastToMostCrowded(void)
|
||||
{
|
||||
int numberOfConnectionsPerSFchip[4] = {0, 0, 0, 0};
|
||||
@ -371,7 +563,7 @@ void sortSFchipsLeastToMostCrowded(void)
|
||||
|
||||
void sortAllChipsLeastToMostCrowded(void)
|
||||
{
|
||||
debugNTCC = false;
|
||||
//debugNTCC = false;
|
||||
int numberOfConnectionsPerChip[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; // this will be used to determine which chip is most crowded
|
||||
|
||||
for (int i = 0; i < 12; i++)
|
||||
@ -448,7 +640,7 @@ void sortAllChipsLeastToMostCrowded(void)
|
||||
}
|
||||
}
|
||||
debugNTCC = true;
|
||||
bbToSfConnections();
|
||||
// bbToSfConnections();
|
||||
}
|
||||
|
||||
void printPathArray(void) // this also prints candidates and x y
|
||||
@ -494,8 +686,19 @@ void printPathArray(void) // this also prints candidates and x y
|
||||
printChipNumToChar(path[i].candidates[1][j]);
|
||||
tabs += Serial.print(" ");
|
||||
}
|
||||
tabs += Serial.print("\n\rpath type: ");
|
||||
tabs += printPathType(i);
|
||||
|
||||
|
||||
tabs += Serial.println("\n\n\r");
|
||||
if( path[i].altPathNeeded == true)
|
||||
{
|
||||
tabs += Serial.print("\n\ralt path needed");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
tabs += Serial.println("\n\n\r");
|
||||
|
||||
// Serial.print(tabs);
|
||||
// for (int i = 0; i < 24 - (tabs); i++)
|
||||
@ -506,6 +709,32 @@ void printPathArray(void) // this also prints candidates and x y
|
||||
}
|
||||
}
|
||||
|
||||
int printPathType (int pathIndex)
|
||||
{
|
||||
|
||||
switch (path[pathIndex].pathType)
|
||||
{
|
||||
case 0:
|
||||
return Serial.print("BB to BB");
|
||||
break;
|
||||
case 1:
|
||||
return Serial.print("BB to NANO");
|
||||
break;
|
||||
case 2:
|
||||
return Serial.print("NANO to NANO");
|
||||
break;
|
||||
case 3:
|
||||
return Serial.print("BB to SF");
|
||||
break;
|
||||
case 4:
|
||||
return Serial.print("NANO to SF");
|
||||
break;
|
||||
default:
|
||||
return Serial.print("Not Assigned");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int defToNano(int nanoIndex)
|
||||
{
|
||||
return nanoIndex - NANO_D0;
|
||||
|
@ -5,7 +5,9 @@
|
||||
|
||||
|
||||
|
||||
|
||||
extern int numberOfUniqueNets;
|
||||
extern int numberOfNets;
|
||||
extern int numberOfPaths;
|
||||
|
||||
void sortPathsByNet(void);
|
||||
void bridgesToPaths(void);
|
||||
@ -27,18 +29,28 @@ void clearChipsOnPathToNegOne(void);
|
||||
|
||||
void sortAllChipsLeastToMostCrowded(void);
|
||||
|
||||
void sortSFchipsMostToLeastCrowded(void);
|
||||
void sortSFchipsLeastToMostCrowded(void);
|
||||
|
||||
int moreAvailableChip (int chip1 , int chip2);
|
||||
|
||||
|
||||
|
||||
int xMapForNode(int node, int chip);
|
||||
|
||||
|
||||
int yMapForNode(int node, int chip);
|
||||
|
||||
|
||||
int xMapForChip(int chip);
|
||||
|
||||
|
||||
void mergeOverlappingCandidates (int pathIndex);
|
||||
|
||||
|
||||
void assignPathType (int pathIndex);
|
||||
|
||||
int printPathType (int pathIndex);
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -32,7 +32,7 @@ void loop()
|
||||
// delay(100);
|
||||
// digitalWrite(LED_BUILTIN,LOW);
|
||||
|
||||
rainbowy(180, 55, 20); // Red
|
||||
//rainbowy(180, 55, 20); // Red
|
||||
|
||||
// delay(800);
|
||||
|
||||
@ -41,9 +41,10 @@ void loop()
|
||||
Serial.println("\n\n\rfinal netlist\n\n\r");
|
||||
listSpecialNets();
|
||||
listNets();
|
||||
// printBridgeArray();
|
||||
printBridgeArray();
|
||||
|
||||
bridgesToPaths();
|
||||
assignNetColors();
|
||||
while (1)
|
||||
;
|
||||
|
||||
@ -91,7 +92,7 @@ void loop()
|
||||
|
||||
|
||||
}*/
|
||||
delay(100);
|
||||
//delay(100);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user