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.

Parent signal when alias is accessed

Status
Not open for further replies.

shaiko

Advanced Member level 5
Advanced Member level 5
Joined
Aug 20, 2011
Messages
2,644
Helped
303
Reputation
608
Reaction score
297
Trophy points
1,363
Activity points
18,302
Hello,

While debugging an old design I came across the following code:

Code:
alias x : std_logic is y ( 18 ) ; -- y is a 32 bit wide std_logic_vector input port.

begin

process ( clock ) is 
begin 
  if rising_edge ( clock ) then
     if x = '1' then
        some_other_signal <= a + b ;
        [COLOR="#FF0000"]x <= '0'[/COLOR] ;
     end if ;
  end if ;
end process ;
Question:
Why does this code even compile ? To me it seems that the line marked in red cause 'x' to be driven by 2 drivers...
What am I missing here ?
 

edit - just seen the input port comment

No Idea, that should indeed be an error. You say old code? maybe old code with bad old compilers.
 
  • Like
Reactions: shaiko

    shaiko

    Points: 2
    Helpful Answer Positive Rating
And what if Y was driven by another process of the same architecture ?
Will this be legal ?
 

depends if y(18) was driven in the other process. Each element of an array (or record) can be driven from a different process.
 

depends if y(18) was driven in the other process
If it was then driving x<='0' would also reset y (18) ??
Why would anyone write such code?? It "hides" logic and hurts the readability...
 

If it was then driving x<='0' would also reset y (18) ??
Why would anyone write such code?? It "hides" logic and hurts the readability...

No, it would not reset Y, it would create multiple drivers.
No Idea why it was done like that - speak to the engineer responsible.
 
  • Like
Reactions: shaiko

    shaiko

    Points: 2
    Helpful Answer Positive Rating
I could possibly see if this wasn't std_logic_vector but rather something that had a synthesizable wired-and resolution function.

The other possibility is that the name of the alias is similar to the name of another signal and you've simply mistaken them.

The third thought is that the optimizer finds that x = 0 is always true and just ignores this code as unreachable. (or that some_other_signal is unused or always assigned to the same expression, making the multiple drivers a non-issue)
 
  • Like
Reactions: shaiko

    shaiko

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top