Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Multiple driver issue

Status
Not open for further replies.

Digistu01

Newbie
Joined
Aug 12, 2023
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
14
Hi ,
I am working in verilog.
I have an incoming signal to my fpga and one out signal. when this incoming goes high, I want the output signal to go low and stay low for 1000 clk cycles, irrespective of if the incoming signal goes low/ high. The code synthesises correctly but gives me multiple driver error when I implement it, which I clearly see . I know I cannot drive the reg “ temp” in two different always blocks . But how can I resolve this issue.
Following is the code :


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
module driver_low
 input en,
 output wire reg_out_pin
);
 
reg [9:0] count;
reg temp;
reg reg_out;
 
assign reg_out_pin = reg_out;
 
always @( posedge en) begin
   temp <= 1’b1;
end
 
always @( posedge clk) begin
       If( temp) begin
           If ( count <= 10’d1000)
                 reg_out <= 1’b0;
           else begin
                 reg_out <= 1’b1;
                 temp <= 1’b0;
                 count <= 10’d0;
           end    
     end
          reg_out <= 1’b1;
end

 
Last edited by a moderator:

Besides the multiple driver problem, the code
- doesn't count
- sets output unconditionally high

posedge(clk) models synchronous logic with DFF. A DFF can have only one clock input.

Simple solution would be synchronous edge detection.
Code:
reg [2:0] sync;
always @( posedge clk) begin
    sync <= {sync[1:0], en};
    if (sync[2:1] = 2'b01) //  rising en edge
        temp <= 1'b1;
end;
 
Besides the multiple driver problem, the code
- doesn't count
- sets output unconditionally high

posedge(clk) models synchronous logic with DFF. A DFF can have only one clock input.

Simple solution would be synchronous edge detection.
Code:
reg [2:0] sync;
always @( posedge clk) begin
    sync <= {sync[1:0], en};
    if (sync[2:1] = 2'b01) //  rising en edge
        temp <= 1'b1;
end;
Thanks!
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top