If I write a task that creates a square wave on the pins of port 8B, all is well.
If I then declare a global variable alongside the original declaration for port 4D, port 8B stops working (see below). This occurs even if I do not reference the 4 bit port variable anywhere in my code.
If I output a (different) square wave to the 4 bit port, this works whether or not the 8 bit port is used. i.e. the 4 bit port takes precedence.
Code: Select all
on tile : out port toggle_port = XS1_PORT_8B;
on tile : out port toggle_port2 = XS1_PORT_4D;
For ideal behaviour would be that this would not build; in the same way that using the same port twice fails.
Since that is not the case, is the behaviour of this circumstance documented anywhere? Is there any way of catching this kind of error at build time? [I know I can just map out the pins and check, but having a compiler catch errors is always helpful].
n.b. I was checking all of this to test for conflicts with USB PHY. I had written some code that used the four bit port that conflicts with the 8 bit port used by the USB. It built but did not work. Using the actual 8 bit port used does not build (which is nicer).