Issues routing clock signal with himbaechel for gowin #1451
Replies: 3 comments 7 replies
-
Can I have the example files with the error? Especially since you have both working and non-working designs. |
Beta Was this translation helpful? Give feedback.
-
This snippet with nextpnr version e4115e8 works with warnings but no errors. There are two possible reasons for this: I have a different random number and I made up a bad .CST file. Add “--seed 10” when calling nextpnr-himbaechel if it stops crashing then I will continue experimenting with other random numbers, otherwise I need a link to your full project repository or full project archive. |
Beta Was this translation helpful? Give feedback.
-
After looking around at the gowin primitives, I have a theory behind why it is failing. wire sclk_en;
wire clk_switched;
DQCE clk_switch (
.CE(sclk_en),
.CLKIN(clk_in),
.CLKOUT(clk_switched)
);
assign serial_clk = clk_in ^ CLOCK_POLARITY; Full module for context: module byte_serial_spi #(
parameter NUMBER_OF_BITS = 8,
localparam WIDTH_CURRENT_BIT = $clog2(NUMBER_OF_BITS),
parameter CLOCK_POLARITY = 1'b0, // CPOL
parameter CLOCK_PHASE = 1'b0 // CPHA
) (
// Clock
input clk_in,
input enable,
input reset,
// Part of SPI interface
output serial_clk,
output main_out_sub_in,
input main_in_sub_out,
// Block interface
output [NUMBER_OF_BITS - 1:0] sub_data_in,
input [NUMBER_OF_BITS - 1:0] main_data_out,
output finished
);
localparam SPI_STATE_IDLE = 2'd0, SPI_STATE_RUNNING = 2'd1, SPI_STATE_FINISH = 2'd2;
reg [ 1:0] current_state;
reg [ 1:0] next_state;
reg [WIDTH_CURRENT_BIT - 1:0] current_bit;
reg [ NUMBER_OF_BITS - 1 : 0] received_data;
// Data Shift ------------------
// NUMBER_OF_BITS bits + 1 cycle with the last one skipped to signal that the data was sent/received
wire sclk_en;
wire clk_switched;
DQCE clk_switch (
.CE(sclk_en),
.CLKIN(clk_in),
.CLKOUT(clk_switched)
);
assign serial_clk = clk_switched ^ CLOCK_POLARITY;
assign sclk_en = current_state == SPI_STATE_RUNNING;
assign finished = current_state == SPI_STATE_FINISH;
always @(negedge (clk_in ^ CLOCK_PHASE)) begin
next_state = current_state;
if (reset) begin
next_state = SPI_STATE_IDLE;
end else begin
case (current_state)
SPI_STATE_IDLE: begin
if (enable) begin
next_state = SPI_STATE_RUNNING;
current_bit = NUMBER_OF_BITS - 1;
end
end
SPI_STATE_RUNNING: begin
if (current_bit > 0) current_bit = current_bit - 1;
else next_state = SPI_STATE_FINISH;
end
SPI_STATE_FINISH: begin
next_state = SPI_STATE_IDLE;
end
default: begin
end
endcase
end
current_state = next_state;
end
// Data going to sub
assign main_out_sub_in = main_data_out[current_bit];
// Data Sampling --------------
// Data coming from sub
assign sub_data_in = received_data;
always @(posedge ((serial_clk ^ CLOCK_POLARITY) ^ CLOCK_PHASE)) begin
received_data[current_bit] <= main_in_sub_out;
end Luckly with this explicit instantiation Yosys elaborates it correctly, but sadly nextpnr fails not knowing what to do with the DQCE: Info: Using uarch 'gowin' for device 'GW1NR-LV9QN88PC6/I5'
Info: Reading constraints...
Info: Create constant nets...
Info: Modify LUTs...
Info: Pack IOBs...
Info: Pack diff IOBs...
Info: Pack IO logic...
Info: Pack DESER16 logic...
Info: Pack GSR..
Info: Pack INV..
Info: Pack wide LUTs...
Info: Packed MUX2_LUT8:1, MUX2_LU7:0, MUX2_LUT6:4, MUX2_LUT5:26
Info: Pack ALUs...
Info: Pack PLL..
Info: Pack RAMs...
Info: Pack BSRAMs...
Info: Pack buffered nets..
Info: Checksum: 0xeed2c4f1
Info: Device utilisation:
Info: VCC: 1/ 1 100%
Info: IOB: 12/ 274 4%
Info: LUT4: 225/ 8640 2%
Info: OSER16: 0/ 80 0%
Info: IDES16: 0/ 80 0%
Info: IOLOGIC: 0/ 276 0%
Info: MUX2_LUT5: 42/ 4320 0%
Info: MUX2_LUT6: 8/ 2160 0%
Info: MUX2_LUT7: 2/ 1080 0%
Info: MUX2_LUT8: 1/ 1080 0%
Info: ALU: 30/ 6480 0%
Info: GND: 1/ 1 100%
Info: DFF: 114/ 6480 1%
Info: RAM16SDP4: 0/ 270 0%
Info: BSRAM: 0/ 26 0%
Info: GSR: 1/ 1 100%
Info: OSC: 0/ 1 0%
Info: rPLL: 1/ 2 50%
Info: BUFG: 0/ 22 0%
Info: Placed 0 cells based on constraints.
ERROR: Unable to place cell 'tf_card.spi_driver.clk_switch', no BELs remaining to implement cell type 'DQCE' I am using the latest release of Apicula, and I also noticed that those two blocks I mentioned were added to the wiki after v0.15, so maybe the issue now is an outdated cell map, or something. Also, just so we can test with the same project, here is an archive of the project like you asked. |
Beta Was this translation helpful? Give feedback.
-
I am having some problems with nextpnr-himbaechel (both latest commit and 0.7) warning that it can't use dedicated routing for a clk signal, and then asserting at this line:
nextpnr/common/route/router1.cc
Line 345 in e4115e8
Here is the end of the output:
And the call for nextpnr:
nextpnr-himbaechel --json top_tangnano_9k.json \ --write pnrtop_tangnano_9k.json \ --device GW1NR-LV9QN88PC6/I5 \ --vopt family=GW1N-9C \ --vopt cst=../global/top_tf_reader_tangnano_9k.cst
Weirdly enough, if I use nextpnr-gowin (0.7) it can route without an issue.
This project uses a rPLL, but removing it doesn't stop the error from happening (the warning changes to complain about another clock signal), and I have another project that uses a rPLL which routes fine.
Any ideas why it could be failing?
Beta Was this translation helpful? Give feedback.
All reactions