On 29 Mar 2007 07:26:34 -0700, "konstantink"
<
[email protected]> wrote:
>module top ( clk, reset, in_a, in_b, out );
>
> input clk, reset, in_a, in_b;
> output out;
>
> reg out;
>
> always @( posedge clk or negedge reset )
> if ( reset == 1'b0 )
> out <= 1'b0;
> else
> out <= ( clk ) ? in_a : in_b;
>
>endmodule
>
>The question is: is the output of the multiplexer regarded as clock
>line and why?
>And can you tell me when the clock propagation stops?
This is VERY strange code.
At first glance it looks like a flip-flop. It has the right
structure, and the body of the always block looks
correct too. But then we find (clk) appearing as a term
in the logic! This is crazy. The "else" branch of your
if statement will execute only on (posedge clk), so
(assuming no X values) clk is definitely 1; so the
last line of code is equivalent to
out <= in_a;
A signal is regarded as a clock only if you use it
to clock some registers. You can do that with the
STANDARD clocked process arrangement.
In your example there is no "clock propagation"
of any kind. There is no multiplexer, for the
reasons I have described. And the output of the
circuit might be a clock, or it might not be,
depending on what you do with it elsewhere.
There are, I think, three possibilities here:
(1) You have a prof. who thinks he's being clever,
but in fact is just being confused. (It happens.)
(2) This is a "spot the deliberate mistake" homework
question, and I just gave you the right answer.
Shame on me.
(3) You have some colleagues who urgently need to
come on one of our Verilog training courses to learn
how to write sensible flip-flop models.
--
Jonathan Bromley, Consultant
DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services
Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
[email protected]
http://www.MYCOMPANY.com
The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.