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.

Multiple Drivers for slow_count??

Status
Not open for further replies.

markuswoltjer

Newbie level 5
Newbie level 5
Joined
May 16, 2014
Messages
8
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
68
Here I have the verilog for a simple clock divider, that brings a 2.03MHz clock down to a counter which counts at 1kHz... in other words once every millisecond.

I am using Lattice Diamond and going to run this on an FPGA as part of a bigger project but the error is blocking all of my progress.

Forgive me if it is an easy fix, this is my first week using Verilog or any HDL.


Code Verilog - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
module tekbotslide( input clk,
               output reg [17:0] slow_count);
                           
    reg [10:0] fast_count;
    
    initial
    begin
    fast_count <= 0;
    slow_count <= 0;
    end
 
always @ (posedge clk)
        begin
        fast_count <= fast_count + 1;
        if( fast_count > 2029)
            begin
            slow_count <= slow_count + 1;
            fast_count <= 0;
        end
    end
endmodule



Here is the attempted synthesis:

Code:
Starting: "prj_run Synthesis -impl tekbotslide"


************************************************************
**  Lattice Synthesis Engine                              **
************************************************************

synthesis -f "tekbotslide_tekbotslide_lattice.synproj"
synthesis:  version Diamond (64-bit) 3.1.0.96

Copyright (c) 1991-1994 by NeoCAD Inc. All rights reserved.
Copyright (c) 1995 AT&T Corp.   All rights reserved.
Copyright (c) 1995-2001 Lucent Technologies Inc.  All rights reserved.
Copyright (c) 2001 Agere Systems   All rights reserved.
Copyright (c) 2002-2014 Lattice Semiconductor Corporation,  All rights reserved.
Fri May 16 00:21:18 2014


Command Line:  synthesis -f tekbotslide_tekbotslide_lattice.synproj -gui 

-- all messages logged in file synthesis.log

Synthesis options:
The -a option is MachXO2.
The -s option is 4.
The -t option is TQFP144.
The -d option is LCMXO2-7000HE.
Using package TQFP144.
Using performance grade 4.
INFO:                                                           

INFO: ##########################################################

INFO: ### Lattice Family : MachXO2A

INFO: ### Device  : LCMXO2-7000HE

INFO: ### Package : TQFP144

INFO: ### Speed   : 4

INFO: ##########################################################

INFO:                                                           

Optimization goal = Balanced
Top-level module name = tekbotmoves.
Target frequency = 200.000000 MHz.
Maximum fanout = 1000.
Timing path count = 3
BRAM utilization = 100.000000 %
DSP usage = true (default)
DSP utilization = 100 % (default)
fsm_encoding_style = auto
resolve_mixed_drivers = 0
INFO: fix_gated_clocks = 1

Mux style = Auto
Use Carry Chain = true
carry_chain_length = 0
Use IO Insertion = TRUE
Use IO Reg = TRUE
Resource Sharing = TRUE
Propagate Constants = TRUE
Remove Duplicate Registers = TRUE
force_gsr = auto
ROM style = auto
RAM style = auto
The -comp option is FALSE.
The -syn option is FALSE.
-p C:/Users/Markus/Desktop (searchpath added)
-p C:/lscc/diamond/3.1_x64/ispfpga/xo2c00/data (searchpath added)
-p C:/Users/Markus/Desktop/tekbotslide (searchpath added)
-p C:/Users/Markus/Desktop (searchpath added)
Verilog design file = C:/Users/Markus/Desktop/tekbotslide.v
Verilog design file = C:/Users/Markus/Desktop/tekbotmoves.v
NGD file = tekbotslide_tekbotslide.ngd
-sdc option: SDC file input not used.
-lpf option: Output file option is OFF.
Hardtimer checking is enabled (default). The -dt option is not used.
The -r option is OFF. [ Remove LOC Properties is OFF. ]
-- Technology check ok...

Compile design.
Compile Design Begin
Top module name (Verilog): tekbotmoves
INFO - c:/users/markus/desktop/tekbotmoves.v(1): compiling module tekbotmoves. VERI-1018
INFO - c:/users/markus/desktop/tekbotmoves.v(57): compiling module tekbotslide. VERI-1018
Last elaborated design is tekbotmoves()
Loading NGL library 'C:/lscc/diamond/3.1_x64/ispfpga/xo2c00a/data/xo2alib.ngl'...
Loading NGL library 'C:/lscc/diamond/3.1_x64/ispfpga/xo2c00/data/xo2clib.ngl'...
Loading NGL library 'C:/lscc/diamond/3.1_x64/ispfpga/mg5g00/data/mg5glib.ngl'...
Loading NGL library 'C:/lscc/diamond/3.1_x64/ispfpga/or5g00/data/orc5glib.ngl'...
Loading device for application map from file 'xo2c7000.nph' in environment: C:/lscc/diamond/3.1_x64/ispfpga.
Package Status:                     Final          Version 1.36
Top-level module name = tekbotmoves.



GSR instance connected to net n1.
GSR will not be inferred because no asynchronous signal was found in the netlist.
WARNING - No .lpf file will be written because the -lpf option is not used or is set to zero.
INFO: Applying 200.000000 MHz constraint to all clocks

Results of NGD DRC are available in tekbotmoves_drc.log.
Loading NGL library 'C:/lscc/diamond/3.1_x64/ispfpga/xo2c00a/data/xo2alib.ngl'...
Loading NGL library 'C:/lscc/diamond/3.1_x64/ispfpga/xo2c00/data/xo2clib.ngl'...
Loading NGL library 'C:/lscc/diamond/3.1_x64/ispfpga/mg5g00/data/mg5glib.ngl'...
Loading NGL library 'C:/lscc/diamond/3.1_x64/ispfpga/or5g00/data/orc5glib.ngl'...


Running DRC...

ERROR - logical net 'slow_count_c_17' has multiple drivers
  tekbotslide_1/slow_count_92__i17/REG/Q (L381)	NON_PRIM	OUT
  slow_count_pad_17/IOBUF/O (L610)	NON_PRIM	OUT
ERROR - logical net 'slow_count_c_16' has multiple drivers
  tekbotslide_1/slow_count_92__i16/REG/Q (L382)	NON_PRIM	OUT
  slow_count_pad_16/IOBUF/O (L611)	NON_PRIM	OUT
ERROR - logical net 'slow_count_c_15' has multiple drivers
  tekbotslide_1/slow_count_92__i15/REG/Q (L383)	NON_PRIM	OUT
  slow_count_pad_15/IOBUF/O (L612)	NON_PRIM	OUT
ERROR - logical net 'slow_count_c_14' has multiple drivers
  tekbotslide_1/slow_count_92__i14/REG/Q (L384)	NON_PRIM	OUT
  slow_count_pad_14/IOBUF/O (L613)	NON_PRIM	OUT
ERROR - logical net 'slow_count_c_13' has multiple drivers
  tekbotslide_1/slow_count_92__i13/REG/Q (L385)	NON_PRIM	OUT
  slow_count_pad_13/IOBUF/O (L614)	NON_PRIM	OUT
ERROR - logical net 'slow_count_c_12' has multiple drivers
  tekbotslide_1/slow_count_92__i12/REG/Q (L386)	NON_PRIM	OUT
  slow_count_pad_12/IOBUF/O (L615)	NON_PRIM	OUT
ERROR - logical net 'slow_count_c_11' has multiple drivers
  slow_count_92__i11/REG/Q (L602)	NON_PRIM	OUT
  slow_count_pad_11/IOBUF/O (L616)	NON_PRIM	OUT
ERROR - logical net 'slow_count_c_10' has multiple drivers
  tekbotslide_1/slow_count_92__i10/REG/Q (L387)	NON_PRIM	OUT
  slow_count_pad_10/IOBUF/O (L617)	NON_PRIM	OUT
ERROR - logical net 'slow_count_c_9' has multiple drivers
  tekbotslide_1/slow_count_92__i9/REG/Q (L388)	NON_PRIM	OUT
  slow_count_pad_9/IOBUF/O (L618)	NON_PRIM	OUT
ERROR - logical net 'slow_count_c_8' has multiple drivers
  tekbotslide_1/slow_count_92__i8/REG/Q (L389)	NON_PRIM	OUT
  slow_count_pad_8/IOBUF/O (L619)	NON_PRIM	OUT
ERROR - logical net 'slow_count_c_7' has multiple drivers
  tekbotslide_1/slow_count_92__i7/REG/Q (L390)	NON_PRIM	OUT
  slow_count_pad_7/IOBUF/O (L620)	NON_PRIM	OUT
ERROR - logical net 'slow_count_c_6' has multiple drivers
  tekbotslide_1/slow_count_92__i6/REG/Q (L391)	NON_PRIM	OUT
  slow_count_pad_6/IOBUF/O (L621)	NON_PRIM	OUT
ERROR - logical net 'slow_count_c_5' has multiple drivers
  tekbotslide_1/slow_count_92__i5/REG/Q (L392)	NON_PRIM	OUT
  slow_count_pad_5/IOBUF/O (L622)	NON_PRIM	OUT
ERROR - logical net 'slow_count_c_4' has multiple drivers
  tekbotslide_1/slow_count_92__i4/REG/Q (L393)	NON_PRIM	OUT
  slow_count_pad_4/IOBUF/O (L623)	NON_PRIM	OUT
ERROR - logical net 'slow_count_c_3' has multiple drivers
  tekbotslide_1/slow_count_92__i3/REG/Q (L394)	NON_PRIM	OUT
  slow_count_pad_3/IOBUF/O (L624)	NON_PRIM	OUT
ERROR - logical net 'slow_count_c_2' has multiple drivers
  tekbotslide_1/slow_count_92__i2/REG/Q (L395)	NON_PRIM	OUT
  slow_count_pad_2/IOBUF/O (L625)	NON_PRIM	OUT
ERROR - logical net 'slow_count_c_1' has multiple drivers
  tekbotslide_1/slow_count_92__i1/REG/Q (L396)	NON_PRIM	OUT
  slow_count_pad_1/IOBUF/O (L626)	NON_PRIM	OUT
ERROR - logical net 'slow_count_c_0' has multiple drivers
  tekbotslide_1/slow_count_92__i0/REG/Q (L352)	NON_PRIM	OUT
  slow_count_pad_0/IOBUF/O (L627)	NON_PRIM	OUT
WARNING - logical net 'tekbotslide_1/fast_count_91_add_4_1/S0' has no load
WARNING - logical net 'tekbotslide_1/slow_count_92_add_4_19/CO' has no load
WARNING - logical net 'tekbotslide_1/slow_count_92_add_4_19/S1' has no load
WARNING - logical net 'tekbotslide_1/slow_count_92_add_4_1/S0' has no load
WARNING - logical net 'tekbotslide_1/fast_count_91_add_4_11/CO' has no load
ERROR - DRC failed with 18 errors and 5 warnings

Design Results:
    350 blocks expanded
ERROR - NGD expansion failed.
Done: error code 2

Lastly, one may notice that the upper module in the hierarchy is a huge case statement called tekbotmoves. If need be, I can also post this code, but from what I can tell the problem is slow_count being driven by too many factors.

Thanks all!
 
Last edited by a moderator:

Presumed there's no module code omitted in your post, it looks like your synthesis tool doesn't support initial blocks for registers. Try commenting it out. If the initial block is only required for simulation, you can place a "synthesis off" directive.

Technically, the feasibility of an initial block for registers depends on hardware features. If the device family supports a power-on reset for registers, there should be a way to model it in Verilog. Review the synthesis tool documentation and Lattice code examples.
 
  • Like
Reactions: ads-ee

    ads-ee

    Points: 2
    Helpful Answer Positive Rating
As you can tell, I'm brand new here... just figuring out how it works. I tried taking out the initial, begin, and end around my initial values for the 2 counters. If I leave
Code:
fast_count = 0;
and
Code:
slow_count = 0;
the synthesis tells me that there is an error code 2 for a syntax error on the first of those two lines (the one with fast_count). Is this what you wanted me to try? Removing the initialization entirely gave the same 18 errors, 1 for each bit of slow_count that was being driven my multiple drivers.

Thanks for your help, once again I've dug myself into a hole of stupidity with this project haha.

As for the Lattice Diamond User Manual, it cites two options that could apply.

-A .mem file is an initialization required for ROM and optional for RAM.
-There is an ECO (Engineering Change Order) Editor under "Tools" but the drop-down menu on that tab has it listed gray and not accessible.

Does anyone suggest one of these or anything else for initializing these counters to zero?

Markus
 
Last edited:

FvM was suggesting removing the everything between the initial and the end, or placing
// synthesis off
// synthesis on
Around the initial block.

Regards
 

That still gives the same errors that logical net slow_count has multiple drivers. Anywhere else this error could be resulting from other than the initialization block? I'm starting to think it is not the problem. Thanks again!
 

Did you first try to comment out the initial block? Just to check if it's cauisng the error or not.

Your manual quote just say that initial blocks are supported for RAM and ROM (coressponding to the IEEE 1364.1, the standard for synthesizable Verilog). It apparently doesn't talk about register initialization.

Lattice Diamond isn't a major synthesis tool, unless someone at the forum is familiar with it, you're supposed to find it's specific requirements by studying the documentation.
 

Commenting out and deleting the initial block gave the same errors. The format I tried for that block seemed to have worked for the grad student who was helping me through it, so I suspect it is elsewhere in the code. I'll double check as soon as I meet with him though.
 

I just finished the rest. I'm not sure of how the 4 bit output is going to control enable and direction 1 bit inputs for each wheel, but here it is:
Code:
module tekbotmoves( input clk,
					input [17:0] slow_count,
					output reg [3:0] move);
			  
	//reg [17:0] slow_count;		  
	
	tekbotslide tekbotslide_1(
	.clk(clk),
	.slow_count(slow_count));
	
	always begin
		case(slow_count) //LeReLdRd
				6'd000000: move = 4'b1111;
				6'd013438: move = 4'b0011;
				6'd013700: move = 4'b1111;
				6'd014139: move = 4'b0000;
				6'd014400: move = 4'b1111;
				6'd014572: move = 4'b0011;
				6'd014800: move = 4'b1111;
				6'd015004: move = 4'b0000;
				6'd015300: move = 4'b1111;
				6'd017171: move = 4'b0011;
				6'd017400: move = 4'b1111;
				6'd017847: move = 4'b0000;
				6'd018100: move = 4'b1111;
				6'd018340: move = 4'b0011;
				6'd018600: move = 4'b1111;
				6'd018705: move = 4'b0000;
				6'd018950: move = 4'b1111;
				6'd022605: move = 4'b0010;
				6'd023100: move = 4'b0011;
				6'd024100: move = 4'b1111;
				6'd024513: move = 4'b0001;
				6'd025513: move = 4'b1111;
				6'd026372: move = 4'b0011;
				6'd026622: move = 4'b0000;
				6'd026872: move = 4'b1111;
				6'd028205: move = 4'b0010;
				6'd028455: move = 4'b0001;
				6'd028705: move = 4'b1111;
				6'd030013: move = 4'b0001;
				6'd030263: move = 4'b0010;
				6'd030513: move = 4'b1111;
				6'd032000: move = 4'b0010;
				6'd032250: move = 4'b0001;
				6'd032750: move = 4'b0010;
				6'd033250: move = 4'b0001;
				6'd033750: move = 4'b0010;
				6'd034250: move = 4'b0001;
				6'd034750: move = 4'b0010;
				6'd035250: move = 4'b0001;
				6'd035500: move = 4'b1111;
				6'd037237: move = 4'b0001;
				6'd037737: move = 4'b0011;
				6'd038737: move = 4'b1111;
				6'd039139: move = 4'b0010;
				6'd039639: move = 4'b0000;
				6'd040639: move = 4'b1111;
				6'd040979: move = 4'b0011;
				6'd041229: move = 4'b0000;
				6'd041479: move = 4'b1111;
				6'd042839: move = 4'b0001;
				6'd043089: move = 4'b0010;
				6'd043339: move = 4'b1111;
				6'd044639: move = 4'b0010;
				6'd044889: move = 4'b0001;
				6'd045139: move = 4'b1111;
				6'd046500: move = 4'b0010;
				6'd046750: move = 4'b0001;
				6'd047250: move = 4'b0010;
				6'd047500: move = 4'b1111;
				6'd050000: move = 4'b0010;
				6'd050500: move = 4'b0011;
				6'd051500: move = 4'b0001;
				6'd052500: move = 4'b0011;
				6'd053500: move = 4'b0010;
				6'd054000: move = 4'b0000;
				6'd055000: move = 4'b1111;
				6'd055639: move = 4'b0011;
				6'd055889: move = 4'b0000;
				6'd056139: move = 4'b1111;
				6'd057472: move = 4'b0011;
				6'd057722: move = 4'b0000;
				6'd057972: move = 4'b1111;
				6'd059305: move = 4'b0001;
				6'd059555: move = 4'b0010;
				6'd059805: move = 4'b0001;
				6'd060055: move = 4'b0010;
				6'd060305: move = 4'b1111;
				6'd061000: move = 4'b0010;
				6'd061250: move = 4'b0001;
				6'd061500: move = 4'b0010;
				6'd061750: move = 4'b0001;
				6'd062000: move = 4'b1111;
				6'd063000: move = 4'b0001;
				6'd063500: move = 4'b0011;
				6'd064000: move = 4'b0010;
				6'd065000: move = 4'b0011;
				6'd066000: move = 4'b0001;
				6'd066500: move = 4'b1111;
				6'd066605: move = 4'b0001;
				6'd066855: move = 4'b0010;
				6'd067105: move = 4'b1111;
				6'd067038: move = 4'b0001;
				6'd067288: move = 4'b0010;
				6'd067538: move = 4'b1111;
				6'd068438: move = 4'b0001;
				6'd068688: move = 4'b0010;
				6'd068938: move = 4'b0001;
				6'd069188: move = 4'b0010;
				6'd069438: move = 4'b1111;
				6'd070250: move = 4'b0001;
				6'd070500: move = 4'b0010;
				6'd071000: move = 4'b0001;
				6'd071500: move = 4'b0010;
				6'd072000: move = 4'b0001;
				6'd072500: move = 4'b0010;
				6'd073000: move = 4'b0001;
				6'd073500: move = 4'b0010;
				6'd073750: move = 4'b1111;
				6'd075847: move = 4'b0001;
				6'd076347: move = 4'b0011;
				6'd077347: move = 4'b1111;
				6'd077639: move = 4'b0010;
				6'd078139: move = 4'b0000;
				6'd079139: move = 4'b1111;
				6'd079479: move = 4'b0011;
				6'd079729: move = 4'b0000;
				6'd079979: move = 4'b1111;
				6'd080000: move = 4'b0011;
				6'd080250: move = 4'b0000;
				6'd080500: move = 4'b1111;
				6'd081311: move = 4'b0011;
				6'd081561: move = 4'b0000;
				6'd081811: move = 4'b1111;
				6'd082000: move = 4'b0011;
				6'd082250: move = 4'b0000;
				6'd082500: move = 4'b1111;
				6'd083000: move = 4'b0001;
				6'd083250: move = 4'b0010;
				6'd083500: move = 4'b0001;
				6'd083750: move = 4'b0010;
				6'd085000: move = 4'b0010;
				6'd085250: move = 4'b0001;
				6'd085500: move = 4'b0010;
				6'd085750: move = 4'b0001;
				6'd086000: move = 4'b1111;
				6'd095750: move = 4'b0001;
				6'd096000: move = 4'b0010;
				6'd096500: move = 4'b0001;
				6'd097000: move = 4'b0010;
				6'd097500: move = 4'b0001;
				6'd098000: move = 4'b0010;
				6'd098500: move = 4'b0001;
				6'd099000: move = 4'b0010;
				6'd099250: move = 4'b1111;
				6'd100500: move = 4'b0001;
				6'd101000: move = 4'b0011;
				6'd102000: move = 4'b1111;
				6'd103250: move = 4'b0010;
				6'd103750: move = 4'b0000;
				6'd104750: move = 4'b1111;
				6'd105000: move = 4'b0011;
				6'd105250: move = 4'b0000;
				6'd105500: move = 4'b0011;
				6'd105750: move = 4'b0000;
				6'd106000: move = 4'b0011;
				6'd106250: move = 4'b0000;
				6'd106500: move = 4'b0011;
				6'd106750: move = 4'b0000;
				6'd107000: move = 4'b0011;
				6'd108750: move = 4'b0001;
				6'd109000: move = 4'b0010;
				6'd109250: move = 4'b1111;
				6'd110500: move = 4'b0010;
				6'd110750: move = 4'b0001;
				6'd111000: move = 4'b1111;
				6'd112500: move = 4'b0001;
				6'd112750: move = 4'b0010;
				6'd113000: move = 4'b1111;
				6'd114250: move = 4'b0010;
				6'd114500: move = 4'b0001;
				6'd114750: move = 4'b1111;
				6'd116000: move = 4'b0001;
				6'd116250: move = 4'b0010;
				6'd116500: move = 4'b1111;
				6'd118000: move = 4'b0010;
				6'd118250: move = 4'b0001;
				6'd118500: move = 4'b1111;
				6'd121647: move = 4'b0011;
				6'd121880: move = 4'b0000;
				6'd122113: move = 4'b0011;
				6'd122346: move = 4'b0000;
				6'd122579: move = 4'b0011;
				6'd122812: move = 4'b0000;
				6'd123045: move = 4'b0011;
				6'd123278: move = 4'b0000;
				6'd123511: move = 4'b0011;
				6'd123744: move = 4'b0000;
				6'd123977: move = 4'b0011;
				6'd124210: move = 4'b0000;
				6'd124443: move = 4'b0011;
				6'd124676: move = 4'b0000;
				6'd124909: move = 4'b0011;
				6'd125142: move = 4'b0000;
				6'd125375: move = 4'b0011;
				6'd125608: move = 4'b0000;
				6'd125841: move = 4'b0011;
				6'd126074: move = 4'b0000;
				6'd126307: move = 4'b0011;
				6'd126540: move = 4'b0000;
				6'd126773: move = 4'b0011;
				6'd127006: move = 4'b0000;
				6'd127239: move = 4'b0011;
				6'd127472: move = 4'b0000;
				6'd127705: move = 4'b0011;
				6'd127938: move = 4'b0000;
				6'd128171: move = 4'b0011;
				6'd128404: move = 4'b0000;
				6'd128637: move = 4'b0011;
				6'd128870: move = 4'b1111;
				6'd141500: move = 4'b0011;
				6'd141750: move = 4'b0000;
				6'd142000: move = 4'b1111;
				6'd143500: move = 4'b0001;
				6'd143750: move = 4'b0010;
				6'd144000: move = 4'b1111;
				6'd145500: move = 4'b0010;
				6'd145750: move = 4'b0001;
				6'd146000: move = 4'b1111;
				6'd147250: move = 4'b0001;
				6'd147500: move = 4'b0010;
				6'd148000: move = 4'b0001;
				6'd148500: move = 4'b0010;
				6'd149000: move = 4'b0001;
				6'd149500: move = 4'b0010;
				6'd150000: move = 4'b0001;
				6'd150500: move = 4'b0010;
				6'd150750: move = 4'b1111;
				6'd152750: move = 4'b0001;
				6'd153250: move = 4'b0011;
				6'd154250: move = 4'b0010;
				6'd154750: move = 4'b0000;
				6'd155750: move = 4'b1111;
				6'd156500: move = 4'b0011;
				6'd156750: move = 4'b0000;
				6'd157000: move = 4'b1111;
				6'd158250: move = 4'b0011;
				6'd158500: move = 4'b0000;
				6'd158750: move = 4'b1111;
				6'd160000: move = 4'b0000;
				6'd160500: move = 4'b1111;
				6'd162000: move = 4'b0000;
				6'd162500: move = 4'b1111;
				6'd163750: move = 4'b0001;
				6'd164250: move = 4'b0011;
				6'd165250: move = 4'b0010;
				6'd166250: move = 4'b0011;
				6'd167250: move = 4'b0001;
				6'd167750: move = 4'b0000;
				6'd168000: move = 4'b1111;
				6'd171250: move = 4'b0001;
				6'd171500: move = 4'b0010;
				6'd172000: move = 4'b0001;
				6'd172500: move = 4'b0010;
				6'd173000: move = 4'b0001;
				6'd173500: move = 4'b0010;
				6'd174000: move = 4'b0001;
				6'd174500: move = 4'b0010;
				6'd175000: move = 4'b0001;
				6'd175500: move = 4'b0010;
				6'd176000: move = 4'b0001;
				6'd176500: move = 4'b0010;
				6'd177000: move = 4'b0001;
				6'd177500: move = 4'b0010;
				6'd178000: move = 4'b0001;
				6'd178500: move = 4'b0010;
				6'd178750: move = 4'b1111;
				6'd180250: move = 4'b0001;
				6'd180750: move = 4'b0011;
				6'd181750: move = 4'b0010;
				6'd182250: move = 4'b0000;
				6'd183250: move = 4'b0011;
				6'd184000: move = 4'b0000;
				6'd184250: move = 4'b0011;
				6'd184500: move = 4'b0000;
				6'd184750: move = 4'b0011;
				6'd185000: move = 4'b0000;
				6'd185250: move = 4'b0011;
				6'd185500: move = 4'b0000;
				6'd185750: move = 4'b1111;
				6'd187500: move = 4'b0001;
				6'd187750: move = 4'b0010;
				6'd188000: move = 4'b1111;
				6'd189500: move = 4'b0010;
				6'd189750: move = 4'b0001;
				6'd190000: move = 4'b1111;
				6'd194750: move = 4'b0010;
				6'd195250: move = 4'b0011;
				6'd196250: move = 4'b1111;
				6'd197000: move = 4'b0001;
				6'd198000: move = 4'b0011;
				6'd199000: move = 4'b0010;
				6'd199500: move = 4'b0000;
				6'd200500: move = 4'b0001;
				6'd201000: move = 4'b0010;
				6'd201500: move = 4'b0001;
				6'd202000: move = 4'b0010;
				6'd202500: move = 4'b0001;
				6'd203000: move = 4'b0010;
				6'd203500: move = 4'b0001;
				6'd204000: move = 4'b0010;
				6'd204500: move = 4'b0001;
				6'd205000: move = 4'b0010;
				6'd205500: move = 4'b0001;
				6'd206000: move = 4'b0010;
				6'd206500: move = 4'b0001;
				6'd207000: move = 4'b0010;
				6'd207500: move = 4'b0001;
				6'd208000: move = 4'b0010;
				6'd208500: move = 4'b0001;
				6'd209000: move = 4'b0010;
				6'd209500: move = 4'b0001;
				6'd210000: move = 4'b0010;
				6'd210500: move = 4'b0001;
				6'd211000: move = 4'b0010;
				6'd211500: move = 4'b0001;
				6'd212000: move = 4'b0010;
				6'd212500: move = 4'b0001;
				6'd213000: move = 4'b0010;
				6'd213500: move = 4'b0001;
				6'd214000: move = 4'b1111;
				
		endcase
	end
endmodule

module tekbotslide( input clk,
					output reg [17:0] slow_count);
						   
	reg [10:0] fast_count;
	
	initial
	begin
		fast_count <= 0;
		slow_count <= 0;
	end

always @ (posedge clk)
	begin
		fast_count <= fast_count + 1;
		if( fast_count > 2029)
			begin
			slow_count <= slow_count + 1;
			fast_count <= 0;
		end
	end
endmodule
 

Was the tekbotslide code you posted the entire file or just a snippet? If it was only a snippet the problem may be somewhere else in that file.

- - - Updated - - -

You might try initializing the fast_count and slow_count like the following code.
Also you might try changing the fast_count to use the following code.

Code:
module tekbotslide (
  input clk,
  output [17:0] slow_count
);

  reg [10:0] fast_count = 11'b0;
  reg [17:0] slow_cnt = 18'b0;

  always @ (posedge clk) begin
    if (fast_count > 2029) begin
      slow_cnt <= slow_cnt + 1;
      fast_count <= 0;
    end else begin
      fast_count <= fast_count + 1;
    end
  end

  assign slow_count = slow_cnt;

I suspect the problem is the synthesis tool you are using doesn't know how to interpret the fast_count getting reset to 0 in the if comparison, while the counting is done outside the if, hence you get multiple drivers on that signal.

Regards,

- - - Updated - - -

The tckbotmoves code has a problem with input [17:0] slow_count,, which is defined as an input to the module.

This will result in compilation errors with the .slow_count (slow_count)); line which is defined as an output of tekbotslide.

You are missing the "@ *" in the always statement for the case. e.g. always @* begin

You're case statement is using 6'dxxxxxx values which can't be defined by 6-bits, maximum value should be no more than 6'd63. I think what you want is 17'dxxxxxx. Also add a default to the case to avoid producing latches.

You need to fix these problems before you can hope to simulate or synthesize this code.

Regards
 

    V

    Points: 2
    Helpful Answer Positive Rating

    markuswoltjer

    Points: 2
    Helpful Answer Positive Rating

    FvM

    Points: 2
    Helpful Answer Positive Rating
Thanks, that was helpful. I'm still unclear what the problem with slow_count is. Does it need to be a type other than an input in the tekbotmoves module? I thought 6'd meant 6 binary digits which can cover the 18 binary inputs of slow_count. Is a default output of 1111 okay? That would mean the robot doesn't move.

And again all, thank you for your patience. I am completely new to this and under heavy time pressure.
 

The tckbotmoves code has a problem with input [17:0] slow_count,, which is defined as an input to the module.

This will result in compilation errors with the .slow_count (slow_count)); line which is defined as an output of tekbotslide.
Yes, this clarifies everything. The error message quoted in post #1 is misleading because the multiple driver problem occurs in module tekbotmoves rathen than tekbotslide. Apparently a laxness of the tool.
 

So how to I need to change the code for in tekbotmoves regarding slow_count to eliminate this error?
 

You should get yourself clear if slowcount should be driven from the tekbotslide module or from a module above tekbotmoves. It can't be driven from both sides. That's what the multiple drivers error tells about.
 

I thought 6'd meant 6 binary digits which can cover the 18 binary inputs of slow_count. Is a default output of 1111 okay? That would mean the robot doesn't move.
6'dxx means a 6-bit value i.e. 101010 or 42 decimal.
As you are using slow_count as the case selection. i.e case (slow_count) all possible values of slow_count[17:0] need to be in the case statement...or at least the ones you care about and the last value in the case would then be default : move = 4'b1111; to not move when your slow_count values are not explicitly called out.

If you have ranges of slow_count values that need to move in the same direction until slow_count reaches another value then you should probably use nested if statements instead of a case statement. e.g.
Code:
if (slow_count >= 17'd1000 && slow_count < 2000) begin
  // move some direction when the slow_count is 1000-1999
  move <= 4'b1110;
end else if (slow_count >= 2000 && slow_count < 3000) begin
  // move a different direction when the slow_count is 2000-2999
  move <= 4'b1001;
end else begin
  // default value to not move if not explicitly called out in the above compares
  move <= 4'b1111;
end


Regards

- - - Updated - - -

Looking over your tekbotmoves code it looks like you commented out the reg [17:0] slow_count; because you may have had an error when compiling? The reason you would have had an error is you must use wire [17:0] slow_count; as slow_count must be a non-storing signal. I suspect that is why you added the input [17:0] slow_count, but you should remove the input and add the wire declaration in as you already generated slow_count in the tekbotslide module.

You should probably have a reset if there's one available higher up in the file hierarchy then you won't have to rely on the power up state using initial statements.

Regards
 
Last edited:

Thank you all but it looks like I got it. I got rid of the tekbotmoves module and put the case statement after my if statement in tekbotslides. One module makes things a lot easier for noobs like me, but I'm also learning instantiation, no worries. Maybe I'll leave this "not solved" until I get a video of my robot doing its primitive dance moves as a thank you to all of you who dedicated your time and effort into helping me. I know it was probably frustrating given my incompetence.
 

One module makes things a lot easier for noobs like me, but I'm also learning instantiation, no worries.
Until the module gets so big that you get lost in the forest and can only see "trees". ;-)

markuswoltjer said:
Maybe I'll leave this "not solved" until I get a video of my robot doing its primitive dance moves as a thank you to all of you who dedicated your time and effort into helping me. I know it was probably frustrating given my incompetence.
Wasn't at all frustrating, at least you're willing to learn from others, what's frustrating is when good advice is ignored and the poster keeps returning with the same problem, which they could have fixed by not ignoring that advice.

I would certainly love to see this "dancing" robot "bust a move".


Regards
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top