electronics forum

Rules | Recent posts | topic RSS | Search | Register  | Log in

Problem with one Verilog statement


Post new topic  Reply to topic    EDAboard.com Forum Index -> PLD, SPLD, GAL, CPLD, FPGA Design -> Problem with one Verilog statement
Author Message
firefoxPL



Joined: 18 Mar 2008
Posts: 40
Helped: 5
Location: Poznan, POLAND


Post08 May 2008 16:02   

Problem with one Verilog statement


Hello, I am currently porting demo from Xilinx for XUPV2P board for controling VDEC from Verilog to VHDL and I have problem with understanding one phrase:
Code:
assign TRS = ((~|YCrCb_rg2[9:2]) & (~|YCrCb_rg3[9:2]) & (&YCrCb_rg4[9:2]));

TRS is a 1-bit signal, I did something like this in VHDL but I am not sure whether it is right:
Code:
 TRS <= ((((YCrCb_rg2(9) nor YCrCb_rg2(8)) nor (YCrCb_rg2(7) nor YCrCb_rg2(6))) nor ((YCrCb_rg2(5) nor YCrCb_rg2(4)) nor (YCrCb_rg2(3) nor YCrCb_rg2(2))))
        and (((YCrCb_rg3(9) nor YCrCb_rg3(8)) nor (YCrCb_rg3(7) nor YCrCb_rg3(6))) nor ((YCrCb_rg3(5) nor YCrCb_rg3(4)) nor (YCrCb_rg3(3) nor YCrCb_rg3(2)))))
        and (((YCrCb_rg2(9) and YCrCb_rg2(8)) and (YCrCb_rg2(7) and YCrCb_rg2(6))) and ((YCrCb_rg2(5) and YCrCb_rg2(4)) and (YCrCb_rg2(3) and YCrCb_rg2(2))));

In fact it is very probable that this is wrong and thats why the project doesn't work Razz
Back to top
Google
AdSense
Google Adsense




Post08 May 2008 16:02   

Ads




Back to top
FvM



Joined: 22 Jan 2008
Posts: 5154
Helped: 767
Location: Bochum, Germany


Post08 May 2008 19:58   

Re: Problem with one Verilog statement


To my opinion, the translation of the Verilog reductional operators expression is correct exept for the nor chaining which creates wrong polarity. Furthermore I would expect a logical and && between the three partial expressions, but the difference shouldn't matter in this place.

Code:
TRS <= not (YCrCb_rg2(9) or YCrCb_rg2(8) or YCrCb_rg2(7) or YCrCb_rg2(6) or YCrCb_rg2(5) or YCrCb_rg2(4) or YCrCb_rg2(3) or YCrCb_rg2(2))
and not(YCrCb_rg3(9) or YCrCb_rg3(8) or YCrCb_rg3(7) or YCrCb_rg3(6) or YCrCb_rg3(5) or YCrCb_rg3(4) or YCrCb_rg3(3) or YCrCb_rg3(2))
and (YCrCb_rg2(9) and YCrCb_rg2(8) and YCrCb_rg2(7) and YCrCb_rg2(6) and YCrCb_rg2(5) and YCrCb_rg2(4) and (YCrCb_rg2(3) and YCrCb_rg2(2));
Back to top
echo47



Joined: 07 Apr 2002
Posts: 4206
Helped: 566


Post09 May 2008 14:47   

Problem with one Verilog statement


I don't know VHDL, but there's got to be an easier way to write that expression.
The Verilog statement sets TRS to 1 if the following is true:

YCrCb_rg2[9:2] is 00000000
and
YCrCb_rg3[9:2] is 00000000
and
YCrCb_rg4[9:2] is 11111111
Back to top
firefoxPL



Joined: 18 Mar 2008
Posts: 40
Helped: 5
Location: Poznan, POLAND


Post09 May 2008 15:38   

Re: Problem with one Verilog statement


echo47 wrote:
I don't know VHDL, but there's got to be an easier way to write that expression.
The Verilog statement sets TRS to 1 if the following is true:

YCrCb_rg2[9:2] is 00000000
and
YCrCb_rg3[9:2] is 00000000
and
YCrCb_rg4[9:2] is 11111111

that should be really helpful thanks a lot
Back to top
lucbra



Joined: 30 Oct 2003
Posts: 161
Helped: 6
Location: Belgium


Post10 May 2008 9:42   

Re: Problem with one Verilog statement


Maybe something like this:
TRS <= '1' when ((YCrCb_rg2(9 downto 2) = "00000000") and
(YCrCb_rg3(9 downto 2) = "00000000") and
(YCrCb_rg4(9 downto 2) = "11111111"))
else '0';
Back to top
firefoxPL



Joined: 18 Mar 2008
Posts: 40
Helped: 5
Location: Poznan, POLAND


Post10 May 2008 9:45   

Re: Problem with one Verilog statement


lucbra wrote:
Maybe something like this:
TRS <= '1' when ((YCrCb_rg2(9 downto 2) = "00000000") and
(YCrCb_rg3(9 downto 2) = "00000000") and
(YCrCb_rg4(9 downto 2) = "11111111"))
else '0';

I was thinking exactly the same thing Smile
Back to top
Arabic versionBulgarian versionCatalan versionCzech versionDanish versionGerman versionGreek versionEnglish versionSpanish versionFinnish versionFrench versionHindi versionCroatian versionIndonesian versionItalian versionHebrew versionJapanese versionKorean versionLithuanian versionLatvian versionDutch versionNorwegian versionPolish versionPortuguese versionRomanian versionRussian versionSlovak versionSlovenian versionSerbian versionSwedish versionTagalog versionUkrainian versionVietnamese versionChinese version
Post new topic  Reply to topic    EDAboard.com Forum Index -> PLD, SPLD, GAL, CPLD, FPGA Design -> Problem with one Verilog statement
Page 1 of 1 All times are GMT + 1 Hour
Similar topics:
problem in using generate statement in verilog (2)
Assigning more than one task to a state (in WITH statement) (6)
Which one preferd if statement or assignment ? (3)
assignment statement in Verilog (10)
case statement(verilog) (3)
REG case statement in verilog (2)
VERILOG :if-else generate statement (3)
verilog : conditional assign statement (1)
Generate statement usage verilog (2)
SYSTEM VERILOG:Help needed on 'expect' statement??? (7)


Abuse || Administrator || Moderators || Support us || sitemap
topic RSS