Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Why is the fitter pruning registers

Status
Not open for further replies.

Nanoprotect

Newbie level 4
Joined
Jan 23, 2015
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
51
Hi All

Using Lattice ispLEVER - ispMACH4256ZE.

Can anyone suggest why most of the registers are being pruned from the following code please?
See fitter errors at end of post:

Code:
module PWM(pwm_out);

	output	reg		pwm_out;
	reg		[14:0]	cnt;
	reg		[6:0]	pwm_val[7:0];
	reg		[2:0]	x;
	reg		[6:0]	pwm_cnt;

	defparam I1.TIMER_DIV = "128";
	OSCTIMER I1 (.DYNOSCDIS(1'b0), .TIMERRES(1'b0), .OSCOUT(osc_clk), .TIMEROUT(tmr_clk));

	initial
		begin
			$readmemb("LED_LUT.txt", pwm_val);
		end

	always @(posedge tmr_clk)
		begin
			cnt <= cnt + 1;
			if(!cnt)
				x <= x + 1;

			pwm_cnt <= cnt[7] ? ~cnt[6:0] : cnt[6:0];

			pwm_out <= (pwm_cnt > pwm_val[x]) ? 0 : 1;
		end

endmodule
Fitter Errors:

@W: CG532 :"C:\users\karl\documents\lattice\breathingleds\breathingleds.v":19:1:19:7|Initial statement will only initialize memories through the usage of $readmemh and $readmemb. Everything else is ignored
@W: CL169 :"C:\users\karl\documents\lattice\breathingleds\breathingleds.v":24:1:24:6|Pruning register x[2:0]

@W: CL279 :"C:\users\karl\documents\lattice\breathingleds\breathingleds.v":24:1:24:6|Pruning register bits 14 to 8 of cnt[14:0]

@W: CL279 :"C:\users\karl\documents\lattice\breathingleds\breathingleds.v":24:1:24:6|Pruning register bits 5 to 0 of pwm_cnt[6:0]
 
Last edited by a moderator:

@W: CL279 :"C:\users\karl\documents\lattice\breathingleds\br eathingleds.v":24:1:24:6|Pruning register bits 14 to 8 of cnt[14:0]
pwm_cnt <= cnt[7] ? ~cnt[6:0] : cnt[6:0]; // You are doing nothing with bits 8 to 14 of the reg. cnt[14:0]

@W: CL279 :"C:\users\karl\documents\lattice\breathingleds\br eathingleds.v":24:1:24:6|Pruning register bits 5 to 0 of pwm_cnt[6:0]
pwm_out <= (pwm_cnt > pwm_val[x]) ? 0 : 1;

You have declared-
reg [6:0] pwm_val[7:0];
reg [2:0] x;

But see what are you comparing!
 

Hi dpaul

Thank you for your reply.
The code loads 8 registers of 7-bit values from a LUT file.
These values are used as a set-point for a centered pwm waveform. The pwm gerneration is constant until cnt overflows back to zero (hence bits 8-14).
Register x is updated on this overflow and is effectively a pointer to the next pwm value.

I have found the error this afternoon.
I put white spaces in the LUT to make the values easier to read.
I should not have put spaces (or put an underline so I understand).

The code is now working great.
The errors from the fitter were throwing me in the wrong direction completely.
 

Fine!
btw- They were warnings, not errors. You could have still proceeded to synth. :)
 

The synthesisor does a lot of checking and reduction to minimise logic, and warns you when redundant, dead or duplicated logic is removed.
Here, I assume it just assigned the various memory bits to 0 because of the extra whitespace in the file, then correctly worked out that the removed bits were never used. This is the synthesisor doing its job.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top