sythesis question

J

Jason Zheng

Guest
Is this synthesizable?

wire empty;
reg [1:0] ptr;
reg [3:0] isEmpty;

assign empty = isEmpty[ptr];

....

always (posedge clk)
if (rst) begin
ptr <= 0;
isEmpty <= 0;
end
else begin
ptr <= ...
isEmpty <= ...
end


thanks,
 
Try this segment:

//--------------------------
reg empty;

always @ (ptr or isEmpty)
begin
case(ptr)
2'b00: empty <= isEmpty[0];
...
endcase
end
//-------------------------

Kelvin




"Jason Zheng" <jzheng@jpl.nasa.gov> wrote in message
news:ce476j$8e6$1@nntp1.jpl.nasa.gov...
Is this synthesizable?

wire empty;
reg [1:0] ptr;
reg [3:0] isEmpty;

assign empty = isEmpty[ptr];

...

always (posedge clk)
if (rst) begin
ptr <= 0;
isEmpty <= 0;
end
else begin
ptr <= ...
isEmpty <= ...
end


thanks,
 
If you're wondering if you get an asynchronous reset in a clocked register,
you might be slightly off. The code you have is synthesizable (if you
include the @ that you probably forgot to copy) but your resets will be
synchronous. If that's what you want, great.

always @(posedge clk) // clocked register, synchronous reset
always @(posedge clk or posedge rst) // async reset
if( rst ) ...


always
"Jason Zheng" <jzheng@jpl.nasa.gov> wrote in message
news:ce476j$8e6$1@nntp1.jpl.nasa.gov...
Is this synthesizable?

wire empty;
reg [1:0] ptr;
reg [3:0] isEmpty;

assign empty = isEmpty[ptr];

...

always (posedge clk)
if (rst) begin
ptr <= 0;
isEmpty <= 0;
end
else begin
ptr <= ...
isEmpty <= ...
end


thanks,
 
On Mon, 26 Jul 2004 17:21:39 -0700, Jason Zheng <jzheng@jpl.nasa.gov>
wrote:

Is this synthesizable?

wire empty;
reg [1:0] ptr;
reg [3:0] isEmpty;

assign empty = isEmpty[ptr];
[...]

Yes. It represents a 4-input multiplexer, with
"ptr" feeding the 2-bit binary-coded selector input.
As far as I know, every synthesis tool accepts this.

Is there anything that leads you to suspect the contrary?
--
Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL, Verilog, SystemC, Perl, Tcl/Tk, Verification, Project Services

Doulos Ltd. Church Hatch, 22 Market Place, Ringwood, BH24 1AW, UK
Tel: +44 (0)1425 471223 mail:jonathan.bromley@doulos.com
Fax: +44 (0)1425 471573 Web: http://www.doulos.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.
 
Jonathan Bromley wrote:
On Mon, 26 Jul 2004 17:21:39 -0700, Jason Zheng <jzheng@jpl.nasa.gov
wrote:


Is this synthesizable?

wire empty;
reg [1:0] ptr;
reg [3:0] isEmpty;

assign empty = isEmpty[ptr];


[...]

Yes. It represents a 4-input multiplexer, with
"ptr" feeding the 2-bit binary-coded selector input.
As far as I know, every synthesis tool accepts this.

Is there anything that leads you to suspect the contrary?
Great, I've always had doubts about it since I've never had a systematic
training in verilog. Sometimes I get confused about what might cause
problems and what won't.
 

Welcome to EDABoard.com

Sponsor

Back
Top