My code is as follows:
Code Verilog - [expand ] 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
module StateMachine(
input start,
input CLK,
input stop,
input input_type,
input read_to_read,
output reg input_to_lc,
output reg logic_controller_enable,
output reg read_enable,
output reg mem_read
) ;
reg [ 1 : 0 ] state, next_state;
parameter S0 = 2'b00 ;
parameter S1 = 2'b01 ;
parameter S2 = 2'b10 ;
parameter S3 = 2'b11 ;
always @ ( posedge CLK or posedge stop )
begin
if ( stop)
state<= S0; //default state
else if ( start)
state<= next_state;
end
always @ ( state )
begin
case ( state)
S0:
begin
if ( start == 1'b1 )
begin
$display ( "hiiii" ) ;
state <= S1;
end
else
state <= S0;
end
S1:
begin
mem_read <= 1'b1 ;
$display ( "hiiii new" ) ;
if ( read_to_read == 1 )
state <= S2;
else
state<= S1;
end
S2:
begin
logic_controller_enable <= 1'b1 ;
read_enable <= 1'b1 ;
state <= S3;
end
S3:
begin
// mem_write = 1'b1;
end
endcase
end
endmodule
when i try to synthesixe this, im getting error as multiple drivers on signal state. Error occurs at always@(posedge CLK...) block. how to correct this code..
Last edited by a moderator: Jan 20, 2015