Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library ieee;
- use ieee.std_logic_1164.all;
-
- entity myOnes is
- port (din : in bit_vector(7 downto 0);
- y : out integer range 0 to 15);
- end;
-
- architecture be of myOnes is
- begin
-
- process(din)
- variable c : integer range 0 to 15 := 0;
- begin
- c:= 0;
- for i in 0 to 7 loop
- if din(i) = '1' then c := c + 1;
- else c := c;
- end if;
- end loop;
- y <= c;
- end process;
-
- end be;
- n, s = 0, 0
- while n >= 0:
- n = int(input("Enter a positive number: "))
- if n >= 0:
- s += n
- print(s)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement