-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPUL.vhd
More file actions
60 lines (49 loc) · 1.22 KB
/
PUL.vhd
File metadata and controls
60 lines (49 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity PUL is
Port ( clk : in STD_LOGIC;
data : out STD_LOGIC;
latch : out STD_LOGIC;
shift : out STD_LOGIC;
rstO : out STD_LOGIC;
rst : in STD_LOGIC);
end PUL;
architecture PUL_b of PUL is
type states is (load, move, lock);
signal state, nextState : states;
constant text : STD_LOGIC_VECTOR(0 to 55) := "00110111001101000100100001000011001101010011100100110101";
signal current_bit : integer range 0 to 55 := 0;
begin
progress: process (nextState) --state pusher
begin
state <= nextState;
end process progress;
machine : process (clk, rst) --state machine
begin
if (rst = '0') then
nextState <= load;
current_bit <= 0;
else
case state is
when load =>
data <= text(current_bit);
shift <= '0';
latch <= '0';
nextState <= move;
when move =>
shift <= '1';
current_bit <= (current_bit + 1) MOD 56;
nextState <= lock;
when lock =>
if current_bit MOD 8 = 0 then
latch <= '1';
end if;
nextState <= load;
end case;
end if;
end process machine;
reset_passthrough : process (rst)
begin
rstO <= rst;
end process reset_passthrough;
end PUL_b;