YosysHQ / arachne-pnr

Place and route tool for FPGAs
MIT License
413 stars 73 forks source link

SB_IO_OD doesn't work #107

Closed ducky64 closed 6 years ago

ducky64 commented 6 years ago

While yosys + arachne seems to work with the RGB pins in open-drain GPIO mode by setting the pins in the pcf file and using it as a normal signal output, the results appear incorrect (pin does nothing - stay in tristate) when a SB_IO_OD block is instantiated and connected to the output.

Note that explicit SB_IO_OD instantiation is required by iCEcube, and works as expected there.

~arachne fails with this error when running on a design with a SB_IO_OD (using the RGB pins in open-drain GPIO mode) block:~

arachne-pnr -d 5k -P sg48 -p top.pcf build/top.blif -o build/top.asc

seed: 1
device: 5k
read_chipdb +/share/arachne-pnr/chipdb-5k.bin...
  supported packages: sg48, uwg30
read_blif build/top.blif...
prune...
read_pcf top.pcf...
instantiate_io...
pack...

After packing:
IOs          1 / 39
  IO_I3Cs    0 / 0
  IO_ODs     1 / 3
GBs          0 / 8
  GB_IOs     0 / 8
LCs          0 / 5280
  DFF        0
  CARRY      0
  CARRY, DFF 0
  DFF PASS   0
  CARRY PASS 0
BRAMs        0 / 30
WARMBOOTs    0 / 1
PLLs         0 / 1
MAC16s       0 / 8
SPRAM256KAs  0 / 4
HFOSCs       0 / 1
LFOSCs       0 / 1
RGBA_DRVs    0 / 1
LEDDA_IPs    0 / 1
I2Cs         0 / 2
SPIs         0 / 2

place_constraints...
terminate called after throwing an instance of 'std::out_of_range'
  what():  map::at
Aborted (core dumped)

~The code compiles fine in iCEcube, so I'm not sure what's going on here. While arachne allows signals to be directly connected to the RGB pins, iCEcube requires that they be connected to a SB_IO_OD - so it would appear impossible to get the same code to compile through both toolchains.~

module Top(
  output  foo,
);
  SB_IO_OD #(.PIN_TYPE(25), .NEG_TRIGGER(0)) SB_IO_OD (
    .PACKAGEPIN(foo),
    .DOUT0(1)
  );
endmodule

and the relevant line in the pcf file:

set_io foo 39

~Support for SB_IO_OD at all seems to be a new-ish feature, since a not-that-old version of arachne used to error out with fatal error: unknown model `SB_IO_OD'.

(separated out from #100, since this is failing to place/route with a presumably good design, instead of just a error message issue)~

ducky64 commented 6 years ago

Heh, derp, needed to update icestorm tools. Arachne runs through the design now. That being said, the pin doesn't seem to do anything when the SB_IO_OD is instantiated, whereas it has the proper behavior in iCEcube, or when the output is connected directly with arachne. So SB_IO_OD still appears to be broken.

daveshah1 commented 6 years ago

Thanks for the bug report! Fixed in 161e349