akipro
Newbie level 6
- Joined
- Mar 14, 2013
- Messages
- 12
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,361
The following is one simple 4 bit up counter verilog code I made using a 4 bit adder verilog code ( a working file , tested). I happens that when I include the adder instantiation the clock stops working and hence entire code stops working. Any suggestions of what possibly went wrong????
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 module four_bit_counter( output reg [3:0] a ); reg clock ; reg [3:0] temp; // wire [3:0] temp; initial begin a = 4'b0000; clock =0 ; temp = 4'b0000; // remove this end four_bit_adder add(.a(temp), .b(4'b0001), .s(a)); // four_bit_adder add(.a(a), .b(4'b0001), .s(temp)); [ Ensure o/p of adder is of type wire ] always begin #10 clock = ~clock; end always @(posedge clock) begin assign temp = a; // a<=temp; end endmodule
Last edited: