data/full_repos/permissive/179884651/examples/WF_RGB_dot_matrix_joystick_demo.v
 line:53: before: "."
1: b'%Warning-MULTITOP: data/full_repos/permissive/179884651/examples/WF_RGB_dot_matrix_joystick_demo.v:403: Multiple top level modules\n                                                                                                      : ... Suggest see manual; fix the duplicates, or use --top-module to select top.\n                   ... Use "/* verilator lint_off MULTITOP */" and lint_on around source to disable this message.\n                                                                                                      : ... Top module \'fpga_top\'\nmodule fpga_top (\n       ^~~~~~~~\n                                                                                                      : ... Top module \'WF_random_5\'\n   module WF_random_5 (\n          ^~~~~~~~~~~\n                                                                                                      : ... Top module \'WF_bram256x16\'\n   module WF_bram256x16 (\n          ^~~~~~~~~~~~~\n                                                                                                      : ... Top module \'WF_switch_debounce\'\n   module WF_switch_debounce (\n          ^~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/179884651/examples/WF_RGB_dot_matrix_joystick_demo.v:224: Duplicate declaration of signal: \'scan_done\'\n                                                                                           : ... note: ANSI ports must have type declared with the I/O (IEEE 1800-2017 23.2.2.2)\n  wire scan_done = dotclk_done;\n       ^~~~~~~~~\n        data/full_repos/permissive/179884651/examples/WF_RGB_dot_matrix_joystick_demo.v:214: ... Location of original declaration\n   output scan_done,  \n          ^~~~~~~~~\n%Warning-IMPLICIT: data/full_repos/permissive/179884651/examples/WF_RGB_dot_matrix_joystick_demo.v:57: Signal definition not found, creating implicitly: \'clk\'\n           .clk(clk),\n                ^~~\n%Warning-IMPLICIT: data/full_repos/permissive/179884651/examples/WF_RGB_dot_matrix_joystick_demo.v:59: Signal definition not found, creating implicitly: \'ten_us\'\n           .timer_pulse(ten_us));\n                        ^~~~~~\n%Warning-IMPLICIT: data/full_repos/permissive/179884651/examples/WF_RGB_dot_matrix_joystick_demo.v:65: Signal definition not found, creating implicitly: \'two_ms\'\n           .timer_pulse(two_ms));\n                        ^~~~~~\n%Warning-IMPLICIT: data/full_repos/permissive/179884651/examples/WF_RGB_dot_matrix_joystick_demo.v:71: Signal definition not found, creating implicitly: \'one_second\'\n           .timer_pulse(one_second));\n                        ^~~~~~~~~~\n%Warning-IMPLICIT: data/full_repos/permissive/179884651/examples/WF_RGB_dot_matrix_joystick_demo.v:78: Signal definition not found, creating implicitly: \'scan_done\'\n     .scan_done(scan_done),\n                ^~~~~~~~~\n%Warning-IMPLICIT: data/full_repos/permissive/179884651/examples/WF_RGB_dot_matrix_joystick_demo.v:124: Signal definition not found, creating implicitly: \'center_pushed\'\n     assign center_pushed = joystick[3] && !joystick_d[3];\n            ^~~~~~~~~~~~~\n%Warning-IMPLICIT: data/full_repos/permissive/179884651/examples/WF_RGB_dot_matrix_joystick_demo.v:125: Signal definition not found, creating implicitly: \'north_pushed\'\n     assign north_pushed  = joystick[0] && !joystick_d[0];\n            ^~~~~~~~~~~~\n%Warning-IMPLICIT: data/full_repos/permissive/179884651/examples/WF_RGB_dot_matrix_joystick_demo.v:126: Signal definition not found, creating implicitly: \'south_pushed\'\n                                                                                                      : ... Suggested alternative: \'north_pushed\'\n     assign south_pushed  = joystick[2] && !joystick_d[2];\n            ^~~~~~~~~~~~\n%Warning-IMPLICIT: data/full_repos/permissive/179884651/examples/WF_RGB_dot_matrix_joystick_demo.v:127: Signal definition not found, creating implicitly: \'east_pushed\'\n                                                                                                      : ... Suggested alternative: \'north_pushed\'\n     assign east_pushed   = joystick[1] && !joystick_d[1];\n            ^~~~~~~~~~~\n%Warning-IMPLICIT: data/full_repos/permissive/179884651/examples/WF_RGB_dot_matrix_joystick_demo.v:128: Signal definition not found, creating implicitly: \'west_pushed\'\n                                                                                                      : ... Suggested alternative: \'east_pushed\'\n     assign west_pushed   = joystick[4] && !joystick_d[4];\n            ^~~~~~~~~~~\n%Error: Exiting due to 1 error(s), 11 warning(s)\n'
module fpga_top (

    output wire      RGB_CLK_OUT,
    output wire      RGB_DOUT,
    output wire      RGB_LOAD,

    output wire      SIO_CLK_OUT,
    output wire      SIO_MST_OUT_SLV_IN,
    input  wire      SIO_MST_IN_SLV_OUT,
    output wire      SIO_LOAD
);

   wire [15:0]  ram_rd_pixels;
   wire [5:0]   ram_rd_addr;
   reg  [2:0]  cnt;


   wire [4:0] joystick;





   wire      clk_en = 1'b1;
    

  SB_HFOSC OSC_i (
        .CLKHFEN(clk_en),
        .CLKHFPU(clk_en),
        .CLKHF(clk));


   defparam OSC_i.CLKHF_DIV = "0b10";


     WF_timer #(.COUNT(119), .EVERY_CLK(1'b1)) ten_usec( 
           .clk(clk),
           .enable(1'b1),
           .timer_pulse(ten_us));
 

     WF_timer #(.COUNT(099)) two_msec(   
           .clk(clk),
           .enable(ten_us),
           .timer_pulse(two_ms));


     WF_timer #(.COUNT(499)) one_sec( 
           .clk(clk),
           .enable(two_ms),
           .timer_pulse(one_second));



    WF_RGB_if RGB_if_inst(
     .clk(clk),
     .scan_en(two_ms),
     .scan_done(scan_done),
     .ram_rd_addr(ram_rd_addr),
     .ram_rd_pixels(ram_rd_pixels),
     .CLK_OUT(RGB_CLK_OUT),
     .LOAD(RGB_LOAD),
     .DOUT(RGB_DOUT)
     );


     WF_joystick_board joystick_inst (
             .clk(clk),
             .scan_enable(two_ms),

             .slide_leds_red(8'h0),
             .slide_leds_green(8'h0),
             .status_leds_red(4'b1010),
             .status_leds_blue(4'b0101),

             .circle_leds_red({2'b0,joystick[4],2'b0,joystick[2],2'b0,joystick[1],2'b0,joystick[0]}),
             .circle_leds_green(12'h0),

             .slide_switches(),
             .joystick_switches(joystick),

             .header_outputs(8'h0),
             .header_inputs(),

             .LOAD(SIO_LOAD),
             .CLK_OUT(SIO_CLK_OUT),
             .MST_OUT_SLV_IN(SIO_MST_OUT_SLV_IN),
             .MST_IN_SLV_OUT(SIO_MST_IN_SLV_OUT)
     );





 
  reg [4:0] joystick_d;
  reg [5:0] dot;



     always @ (posedge clk)
       joystick_d <= joystick;

     assign center_pushed = joystick[3] && !joystick_d[3];
     assign north_pushed  = joystick[0] && !joystick_d[0];
     assign south_pushed  = joystick[2] && !joystick_d[2];
     assign east_pushed   = joystick[1] && !joystick_d[1];
     assign west_pushed   = joystick[4] && !joystick_d[4];


     always @ (posedge clk)
       if (center_pushed || (cnt == 0))
	 begin
           dot <= 28;
           if (cnt == 0) 
             cnt <= 1;
           else
	     cnt <= cnt + 1;
	 end
       else
	 begin    

	   if (north_pushed)
	     if (dot[5:3] == 3'b000)
               begin
	         if (cnt == 7) cnt <= 1;
		 else cnt <= cnt +1;
	       end
             else 
	      dot <= dot  - 8;


	   if (south_pushed)
	     if (dot[5:3]  == 3'b111)
               begin
	         if (cnt == 7) cnt <= 1;
		 else cnt <= cnt +1;
	       end
             else 
	      dot <= dot  + 8;


	   if (east_pushed)
	     if (dot[2:0] == 3'b111)
               begin
	         if (cnt == 7) cnt <= 1;
		 else cnt <= cnt +1;
	       end
             else 
	      dot <= dot  + 1;


	   if (west_pushed)
	     if (dot[2:0] == 3'b000)
               begin
	         if (cnt == 7) cnt <= 1;
		 else cnt <= cnt +1;
	       end
             else 
	      dot <= dot  - 1;
         end

     assign ram_rd_pixels = (dot == ram_rd_addr) ? 16'h0 : { 1'b0,4'b0,cnt[0], 4'b0,cnt[1],4'b0, cnt[2]}; 


endmodule
module fpga_top (

    output wire      RGB_CLK_OUT,
    output wire      RGB_DOUT,
    output wire      RGB_LOAD,

    output wire      SIO_CLK_OUT,
    output wire      SIO_MST_OUT_SLV_IN,
    input  wire      SIO_MST_IN_SLV_OUT,
    output wire      SIO_LOAD
);


   wire [15:0]  ram_rd_pixels;
   wire [5:0]   ram_rd_addr;
   reg  [2:0]  cnt;


   wire [4:0] joystick;





   wire      clk_en = 1'b1;
    

  SB_HFOSC OSC_i (
        .CLKHFEN(clk_en),
        .CLKHFPU(clk_en),
        .CLKHF(clk));


   defparam OSC_i.CLKHF_DIV = "0b10";


     WF_timer #(.COUNT(119), .EVERY_CLK(1'b1)) ten_usec( 
           .clk(clk),
           .enable(1'b1),
           .timer_pulse(ten_us));
 

     WF_timer #(.COUNT(099)) two_msec(   
           .clk(clk),
           .enable(ten_us),
           .timer_pulse(two_ms));


     WF_timer #(.COUNT(499)) one_sec( 
           .clk(clk),
           .enable(two_ms),
           .timer_pulse(one_second));



    WF_RGB_if RGB_if_inst(
     .clk(clk),
     .scan_en(two_ms),
     .scan_done(scan_done),
     .ram_rd_addr(ram_rd_addr),
     .ram_rd_pixels(ram_rd_pixels),
     .CLK_OUT(RGB_CLK_OUT),
     .LOAD(RGB_LOAD),
     .DOUT(RGB_DOUT)
     );


     WF_joystick_board joystick_inst (
             .clk(clk),
             .scan_enable(two_ms),

             .slide_leds_red(8'h0),
             .slide_leds_green(8'h0),
             .status_leds_red(4'b1010),
             .status_leds_blue(4'b0101),

             .circle_leds_red({2'b0,joystick[4],2'b0,joystick[2],2'b0,joystick[1],2'b0,joystick[0]}),
             .circle_leds_green(12'h0),

             .slide_switches(),
             .joystick_switches(joystick),

             .header_outputs(8'h0),
             .header_inputs(),

             .LOAD(SIO_LOAD),
             .CLK_OUT(SIO_CLK_OUT),
             .MST_OUT_SLV_IN(SIO_MST_OUT_SLV_IN),
             .MST_IN_SLV_OUT(SIO_MST_IN_SLV_OUT)
     );





 
  reg [4:0] joystick_d;
  reg [5:0] dot;



     always @ (posedge clk)
       joystick_d <= joystick;

     assign center_pushed = joystick[3] && !joystick_d[3];
     assign north_pushed  = joystick[0] && !joystick_d[0];
     assign south_pushed  = joystick[2] && !joystick_d[2];
     assign east_pushed   = joystick[1] && !joystick_d[1];
     assign west_pushed   = joystick[4] && !joystick_d[4];


     always @ (posedge clk)
       if (center_pushed || (cnt == 0))
	 begin
           dot <= 28;
           if (cnt == 0) 
             cnt <= 1;
           else
	     cnt <= cnt + 1;
	 end
       else
	 begin    

	   if (north_pushed)
	     if (dot[5:3] == 3'b000)
               begin
	         if (cnt == 7) cnt <= 1;
		 else cnt <= cnt +1;
	       end
             else 
	      dot <= dot  - 8;


	   if (south_pushed)
	     if (dot[5:3]  == 3'b111)
               begin
	         if (cnt == 7) cnt <= 1;
		 else cnt <= cnt +1;
	       end
             else 
	      dot <= dot  + 8;


	   if (east_pushed)
	     if (dot[2:0] == 3'b111)
               begin
	         if (cnt == 7) cnt <= 1;
		 else cnt <= cnt +1;
	       end
             else 
	      dot <= dot  + 1;


	   if (west_pushed)
	     if (dot[2:0] == 3'b000)
               begin
	         if (cnt == 7) cnt <= 1;
		 else cnt <= cnt +1;
	       end
             else 
	      dot <= dot  - 1;
         end

     assign ram_rd_pixels = (dot == ram_rd_addr) ? 16'h0 : { 1'b0,4'b0,cnt[0], 4'b0,cnt[1],4'b0, cnt[2]}; 


endmodule