How to read this code

OP (Company: none) #3435165
Rate this post
• ▲ useful
▼ not useful
Hi,
I am a beginner in vhdl, struggling with vhdl programming. I am 
currently reading books and trying to understand code by other authors. 
i have to understand a code structure like this:
1
entity declaration
2

3
architecture behavioral of entity is
4

5
signal declarations:
6

7
signal(0) <= '1' when signal_1(0)='0' and signal_2(0)='1' else '0';
8
signal(1) <= '1' when signal_1(1)='0' and signal_2(1)='1' else '0';
9
signal(2) <= '1' when signal_1(2)='0' and signal_2(2)='1' else '0';
10
signal(3) <= '1' when signal_1(3)='0' and signal_2(3)='1' else '0';
11

12
inport <=  data_in and not signal;
13

14
signal_4(0) <= '1' when signal(0)='0' and signal_2(0)='1' else '0';
15
signal_4(1) <= '1' when signal(1)='0' and signal_2(1)='1' else '0';
16
signal_4(2) <= '1' when signal(2)='0' and signal_2(2)='1' else '0';
17
signal_4(3) <= '1' when signal(3)='0' and signal_2(3)='1' else '0';
18

19
inport_1 <= signal or signal_4;
20

21
process(clk)
22
do something here
23
.
24
.
25
end  process
26

27
end behavioral

my question is:

1)how this code will work, for behavioral part all statements execute 
concurrently, but signal_4 depends on signal so will second when-else 
would wait for signal computation?
2) how inport would be computed, concurrently or sequentially?
3)are all when else for signal computed simultaneously?
4)if i want to count how many bits of signal are turning to '1' after 
all 4 bits are computed is the 1's counter after when else for signal is 
the only way to do it? can i somehow count 1's within the when else?
5) if i want the same number of bits to go high for signal and signal_4, 
how can i do it?

I appreciate any help.
thanks

Reply

Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.

Formatting
  • [c]C-Code[/c]
  • [vhdl]VHDL-Code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.