FPGA Central - World's 1st FPGA / CPLD Portal

FPGA Central

World's 1st FPGA Portal

 

Go Back   FPGA Groups > NewsGroup > Verilog

Verilog comp.lang.verilog newsgroup / usenet

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-17-2003, 06:15 PM
TC2
Guest
 
Posts: n/a
Default What's my mistake? Combinatorial decision

I must be missing something simple but it looks to me like these two cases
should be the same (can you say De Morgan?):

if (hndshk_to_fpga | inc_ndx | rst_ndx) begin
//do nothing
end
else begin
hndshk_from_motor = 0;
end



if (~hndshk_to_fpga & ~inc_ndx & ~rst_ndx) begin
hndshk_from_motor = 0;
end
else begin
//do nothing
end


Signal hndshk_to_fpga is a 1-bit input. Signals inc_ndx and rst_ndx are
1-bit registers. Example 1 works, example 2 doesn't.

Thanks,
Tom


Reply With Quote
  #2 (permalink)  
Old 07-17-2003, 10:20 PM
Clint Olsen
Guest
 
Posts: n/a
Default Re: What's my mistake? Combinatorial decision

In article <[email protected]>, TC2 wrote:
>
> if (hndshk_to_fpga | inc_ndx | rst_ndx) begin
> //do nothing
> end
> else begin
> hndshk_from_motor = 0;
> end
>
> if (~hndshk_to_fpga & ~inc_ndx & ~rst_ndx) begin
> hndshk_from_motor = 0;
> end
> else begin
> //do nothing
> end


Looks like you blew DeMorgan's Law. Remember that DeMorgan's Law shows you
how to push negation bubbles across gates:

(ab)' = a' + b' (1)
(a + b)' = a'b' (2)

You need to get your first equation into a form that fits this:

a + b + c = ((a + b + c)')' # (a')' = a
((a + b + c)')' = (a'b'c')' # apply (2) to innermost negation

So, you need to invert your entire expression in your second example.

-Clint
Reply With Quote
  #3 (permalink)  
Old 07-18-2003, 12:11 AM
Andy Peters
Guest
 
Posts: n/a
Default Re: What's my mistake? Combinatorial decision

"TC2" <[email protected]> wrote in message news:<[email protected]>...
> I must be missing something simple but it looks to me like these two cases
> should be the same (can you say De Morgan?):
>
> if (hndshk_to_fpga | inc_ndx | rst_ndx) begin
> //do nothing
> end
> else begin
> hndshk_from_motor = 0;
> end
>
>
>
> if (~hndshk_to_fpga & ~inc_ndx & ~rst_ndx) begin
> hndshk_from_motor = 0;
> end
> else begin
> //do nothing
> end
>
>
> Signal hndshk_to_fpga is a 1-bit input. Signals inc_ndx and rst_ndx are
> 1-bit registers. Example 1 works, example 2 doesn't.


Are any of the inputs X or Z at any time?

--a
Reply With Quote
  #4 (permalink)  
Old 07-18-2003, 12:58 AM
Kevin Neilson
Guest
 
Posts: n/a
Default Re: What's my mistake? Combinatorial decision

I don't think you have a DeMorganization error; it's just a matter of when
you assign things. Let me rephrase your logic:

case 1) if (a); else b=0;

case 2) if (~a) b=0;

In case 1, b only gets assigned when a is true. In case 2, b only gets
assigned when a is false. Both are equivalent in a manner, because when b
is assigned, it is always assigned to a; it's just a matter of when it gets
assigned. There seems to be some code missing in your snippet, because you
don't show when the output gets a value of 1. That code should be in the
same process, because it's poor practice to assign a variable in two
processes unless it's nonsynthesizable test code.

-Kevin

"TC2" <[email protected]> wrote in message
news:[email protected]
> I must be missing something simple but it looks to me like these two cases
> should be the same (can you say De Morgan?):
>
> if (hndshk_to_fpga | inc_ndx | rst_ndx) begin
> //do nothing
> end
> else begin
> hndshk_from_motor = 0;
> end
>
>
>
> if (~hndshk_to_fpga & ~inc_ndx & ~rst_ndx) begin
> hndshk_from_motor = 0;
> end
> else begin
> //do nothing
> end
>
>
> Signal hndshk_to_fpga is a 1-bit input. Signals inc_ndx and rst_ndx are
> 1-bit registers. Example 1 works, example 2 doesn't.
>
> Thanks,
> Tom
>
>



Reply With Quote
  #5 (permalink)  
Old 07-18-2003, 02:35 AM
nospam
Guest
 
Posts: n/a
Default Re: What's my mistake? Combinatorial decision

"TC2" <[email protected]> wrote:

> if (hndshk_to_fpga | inc_ndx | rst_ndx) begin
> //do nothing
> end
> else begin
> hndshk_from_motor = 0;
> end
>
>
> if (~hndshk_to_fpga & ~inc_ndx & ~rst_ndx) begin
> hndshk_from_motor = 0;
> end
> else begin
> //do nothing
> end
>
>Signal hndshk_to_fpga is a 1-bit input. Signals inc_ndx and rst_ndx are
>1-bit registers.


They are equivalent.

>Example 1 works, example 2 doesn't.


What you gave us would both be optimised away. Your problem is with what
you didn't give us or (less likely) with your tools.


Reply With Quote
  #6 (permalink)  
Old 07-18-2003, 06:36 PM
Clint Olsen
Guest
 
Posts: n/a
Default Re: What's my mistake? Combinatorial decision

In article <[email protected]>, Clint Olsen wrote:
>
> Looks like you blew DeMorgan's Law. Remember that DeMorgan's Law shows you
> how to push negation bubbles across gates:


Whoops, I didn't read closely enough to notice you swapped the if/else
blocks, so it looks like it should work.

-Clint
Reply With Quote
  #7 (permalink)  
Old 07-22-2003, 01:46 PM
Jim Wu
Guest
 
Posts: n/a
Default Re: What's my mistake? Combinatorial decision

In your first if-else block, hndshk_from_motor = 0 if all inputs are not 1.
(they could be x or z)

In the second if-else block, hndshk_from_motor = 0 if and only if all inputs
are 0s.

So if there are any 'x' or 'z' in yout inputs, you would see simulation
mismatch, but the synthesis result should be the same.

Jim
[email protected]

"TC2" <[email protected]> wrote in message news:<[email protected]>...
> I must be missing something simple but it looks to me like these two cases
> should be the same (can you say De Morgan?):
>
> if (hndshk_to_fpga | inc_ndx | rst_ndx) begin
> //do nothing
> end
> else begin
> hndshk_from_motor = 0;
> end
>
>
>
> if (~hndshk_to_fpga & ~inc_ndx & ~rst_ndx) begin
> hndshk_from_motor = 0;
> end
> else begin
> //do nothing
> end
>
>
> Signal hndshk_to_fpga is a 1-bit input. Signals inc_ndx and rst_ndx are
> 1-bit registers. Example 1 works, example 2 doesn't.
>
> Thanks,
> Tom

Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 02:04 PM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright 2008 @ FPGA Central. All rights reserved