Coder Social home page Coder Social logo

icetime - 1000020.4ns with UP5k about icestorm HOT 5 OPEN

yosyshq avatar yosyshq commented on September 2, 2024
icetime - 1000020.4ns with UP5k

from icestorm.

Comments (5)

daveshah1 avatar daveshah1 commented on September 2, 2024

The problem is an inferred latch in your ram_test.v, because the decoder doesn't cover all possibilities. Without totally rewriting the decoder, the simplest fix I see is to add an "else" clause as follows (choose your own default value) :

    always @*
    begin
      casez ({c12, c11}) // Depending on memory address, select different RAM blocks.
      2'b00: insn = insn0;
      2'b01: insn = insn1;
      2'b10: insn = insn2;
      2'b11: begin
			if (!c10 & !c9 & !c8) insn = insn3;   // Select the 256x16 blocks
			else if (!c10 & !c9 &  c8) insn = insn4;
			else if (!c10 &  c9 & !c8) insn = insn5;
			else if (!c10 &  c9 &  c8) insn = insn6;
			else if ( c10 & !c9 & !c8) insn = insn7;
			else if ( c10 & !c9 &  c8) insn = insn8;
			else insn = 16'h0000;
			end
	  
      endcase

With the fix you get a timing estimate of 37.25MHz.

from icestorm.

daveshah1 avatar daveshah1 commented on September 2, 2024

I will keep the issue open however, as a reminder to myself to add a nicer error message in icetime in this situation.

from icestorm.

cliffordwolf avatar cliffordwolf commented on September 2, 2024

the simplest fix I see is to add an "else" clause as follows (choose your own default value)

I'd personally prefer a default assignment in the beginning of the block. something like this:

    always @*
    begin
      insn = 16'bx;
      casez ({c12, c11}) // Depending on memory address, select different RAM blocks.
      2'b00: insn = insn0;
      2'b01: insn = insn1;
      2'b10: insn = insn2;
      2'b11: begin
			if (!c10 & !c9 & !c8) insn = insn3;   // Select the 256x16 blocks
			else if (!c10 & !c9 &  c8) insn = insn4;
			else if (!c10 &  c9 & !c8) insn = insn5;
			else if (!c10 &  c9 &  c8) insn = insn6;
			else if ( c10 & !c9 & !c8) insn = insn7;
			else if ( c10 & !c9 &  c8) insn = insn8;
			end
      endcase
    end

from icestorm.

igor-m avatar igor-m commented on September 2, 2024

OMG, a freshman's mistake :) Thanks!
The timing estimates from 32-40MHz based on the seed..

from icestorm.

Zaba avatar Zaba commented on September 2, 2024

I get a similar report from icetime (with loop-start, the time starting from ~1000000 ns, etc.) with the following Verilog module:

module repro(clk, out);

input		clk;
output		out;
reg	[8:0]	data;

always @(posedge clk) begin
	if (data == 9'd 10)
		data <= 9'b 0;
	else
		data <= data + 1;
end

assign out = data < 9'd 8;

endmodule

Changing the register width from [8:0] to [7:0] makes the icetime report look normal (Edit: at least when using synth_ice40 -abc9...?). The issue seems to originate from the data < 9'd 8 comparison. I don't see any reports in the Yosys log of any inferred latches or any other abnormalities.

Putting aside the question of whether this is good Verilog, I'd really like to figure out why the icetime report looks the way it does.

Yosys/Nextpnr/icetime output: yosys-nextpnr-icetime.log

from icestorm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.