-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmemFSM.v
More file actions
72 lines (58 loc) · 1.37 KB
/
Copy pathmemFSM.v
File metadata and controls
72 lines (58 loc) · 1.37 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
60
61
62
63
64
65
66
67
68
69
70
71
72
`timescale 1ns/1ns
module memFSM(CLOCK_50,reset,done,state_controller,start,rw,address,state_memFSM);
parameter memory_controller = 3'b101;
parameter initial_memFSM=2'b00,
write_memFSM=2'b01,
writeTime_memFSM=2'b10,
finished_memFSM=2'b11;
input CLOCK_50,reset,done;
input [2:0]state_controller;
output reg start,rw;
output reg [19:0]address;
//output reg memoryFinished;
output reg [1:0]state_memFSM;
parameter initial_fitFSM = 3'b000,
gene_fitFSM = 3'b001;
always@(posedge CLOCK_50)begin//controller
if(reset)begin
state_memFSM <= initial_memFSM;
end
else if(state_controller==memory_controller)begin
case(state_memFSM)
initial_memFSM :
begin
state_memFSM <= write_memFSM;
end
write_memFSM :
begin
address<=20'd0;
start<=1'b1;
rw<=1'b1;
//dataOut<=geneFound;
if(done==1 && start==1)begin
start<=0;
state_memFSM <= writeTime_memFSM;
end
end
writeTime_memFSM :
begin
address<=20'd1;
start<=1'b1;
rw<=1'b1;
//dataOut<=timer;
if(done==1 && start==1)begin
state_memFSM <= finished_memFSM;
//memoryFinished<=1;
start<=0;
end
end
finished_memFSM :
begin
$stop;
end
endcase
end else begin//if
state_memFSM<=initial_memFSM;
end
end//always
endmodule