data/full_repos/permissive/116468596/topMod.v
1: b'%Warning-IMPLICIT: data/full_repos/permissive/116468596/topMod.v:86: Signal definition not found, creating implicitly: \'rnd8\'\n                                                                   : ... Suggested alternative: \'rnd\'\n    assign rnd8 = {1\'b1, rnd[2], 1\'b0, rnd[4], 1\'b1, rnd[3], 1\'b0, rnd[6]};  \n           ^~~~\n                   ... Use "/* verilator lint_off IMPLICIT */" and lint_on around source to disable this message.\n%Warning-IMPLICIT: data/full_repos/permissive/116468596/topMod.v:115: Signal definition not found, creating implicitly: \'allHit\'\n                                                                    : ... Suggested alternative: \'allhit\'\n    assign allHit = {returnHit[0]&returnHit[1]&returnHit[2]&returnHit[3]&returnHit[4]&returnHit[5]&returnHit[6]&returnHit[7]};\n           ^~~~~~\n%Warning-IMPLICIT: data/full_repos/permissive/116468596/topMod.v:120: Signal definition not found, creating implicitly: \'syncFlash\'\n    assign vgaRed = {4{redRectPass | (activeRegion & goodWall& allHit & syncFlash) }};\n                                                                        ^~~~~~~~~\n%Error: data/full_repos/permissive/116468596/topMod.v:54: Cannot find file containing module: \'FDRE\'\n    FDRE #(.INIT(1\'b0) ) syncFlsh (.C(clk), .R(1\'b0), .CE(1\'b1), .D(eightSec^syncFlash), .Q(syncFlash));\n    ^~~~\n        ... Looked in:\n             data/full_repos/permissive/116468596,data/full_repos/permissive/116468596/FDRE\n             data/full_repos/permissive/116468596,data/full_repos/permissive/116468596/FDRE.v\n             data/full_repos/permissive/116468596,data/full_repos/permissive/116468596/FDRE.sv\n             FDRE\n             FDRE.v\n             FDRE.sv\n             obj_dir/FDRE\n             obj_dir/FDRE.v\n             obj_dir/FDRE.sv\n%Error: data/full_repos/permissive/116468596/topMod.v:56: Cannot find file containing module: \'lab7_clks\'\n    lab7_clks not_so_slow (.clkin(clkin), .greset(sw[0]), .clk(clk), .digsel(digsel));\n    ^~~~~~~~~\n%Error: data/full_repos/permissive/116468596/topMod.v:57: Cannot find file containing module: \'count8\'\n    count8 twoSecCount (.clk(clk), .enable(frame), .reset(1\'b0), .twoSec(twoSec));       \n    ^~~~~~\n%Error: data/full_repos/permissive/116468596/topMod.v:58: Cannot find file containing module: \'count4\'\n    count4 eighthSecCount (.clk(clk), .enable(frame), .eightSec(eightSec));              \n    ^~~~~~\n%Error: data/full_repos/permissive/116468596/topMod.v:59: Cannot find file containing module: \'edgeDetector\'\n    edgeDetector ed_btnC (.clk(clk), .btnC(btnC), .edgeOut(edgeOut)); \n    ^~~~~~~~~~~~\n%Error: data/full_repos/permissive/116468596/topMod.v:62: Cannot find file containing module: \'vgaControlMod\'\n    vgaControlMod monitor (.clk(clk), .enable(1\'b1), .up(1\'b1), .LD(1\'b0), .Hsync(Hsync),\n    ^~~~~~~~~~~~~\n%Error: data/full_repos/permissive/116468596/topMod.v:68: Cannot find file containing module: \'taggerMod\'\n    taggerMod greenSq ( .hOutQ (hOutQ), .vOutQ(vOutQ), .frame(frame), .syncFlash(syncFlash), .activeGreen(activeGreen),\n    ^~~~~~~~~\n%Error: data/full_repos/permissive/116468596/topMod.v:72: Cannot find file containing module: \'updownTagger\'\n    updownTagger upDownSM (.clk(clk), .twoSec(twoSec), .top(topHit), .bottom(bottomHit), .up(btnU), .down(btnD),\n    ^~~~~~~~~~~~\n%Error: data/full_repos/permissive/116468596/topMod.v:74: Cannot find file containing module: \'updownTagger\'\n    updownTagger leftRightSM (.clk(clk), .twoSec(twoSec), .top(rightHit), .bottom(leftHit), .up(btnR), .down(btnL),\n    ^~~~~~~~~~~~\n%Error: data/full_repos/permissive/116468596/topMod.v:78: Cannot find file containing module: \'lfsr\'\n    lfsr rect1Random (.clk(clk), .frame(frame), .rnd(rnd));\n    ^~~~\n%Warning-WIDTH: data/full_repos/permissive/116468596/topMod.v:86: Operator ASSIGNW expects 1 bits on the Assign RHS, but Assign RHS\'s REPLICATE generates 8 bits.\n                                                                : ... In instance topMod\n    assign rnd8 = {1\'b1, rnd[2], 1\'b0, rnd[4], 1\'b1, rnd[3], 1\'b0, rnd[6]};  \n                ^\n%Error: data/full_repos/permissive/116468596/topMod.v:87: Cannot find file containing module: \'count8D\'\n    count8D count1 (.clk(clk), .enable(frame), .reset(1\'b0), .LD(outOfAR[0]), .inD(rnd), .TC(doneC[0]) );\n    ^~~~~~~\n%Error: data/full_repos/permissive/116468596/topMod.v:88: Cannot find file containing module: \'count8D\'\n    count8D count2 (.clk(clk), .enable(frame), .reset(1\'b0), .LD(outOfAR[1]), .inD(rnd1), .TC(doneC[1]) );\n    ^~~~~~~\n%Error: data/full_repos/permissive/116468596/topMod.v:89: Cannot find file containing module: \'count8D\'\n    count8D count3 (.clk(clk), .enable(frame), .reset(1\'b0), .LD(outOfAR[2]), .inD(rnd2), .TC(doneC[2]) );\n    ^~~~~~~\n%Error: data/full_repos/permissive/116468596/topMod.v:90: Cannot find file containing module: \'count8D\'\n    count8D count4 (.clk(clk), .enable(frame), .reset(1\'b0), .LD(outOfAR[3]), .inD(rnd3), .TC(doneC[3]) );\n    ^~~~~~~\n%Error: data/full_repos/permissive/116468596/topMod.v:91: Cannot find file containing module: \'count8D\'\n    count8D count5 (.clk(clk), .enable(frame), .reset(1\'b0), .LD(outOfAR[4]), .inD(rnd4), .TC(doneC[4]) );\n    ^~~~~~~\n%Error: data/full_repos/permissive/116468596/topMod.v:92: Cannot find file containing module: \'count8D\'\n    count8D count6 (.clk(clk), .enable(frame), .reset(1\'b0), .LD(outOfAR[5]), .inD(rnd5), .TC(doneC[5]) );\n    ^~~~~~~\n%Error: data/full_repos/permissive/116468596/topMod.v:93: Cannot find file containing module: \'count8D\'\n    count8D count7 (.clk(clk), .enable(frame), .reset(1\'b0), .LD(outOfAR[6]), .inD(rnd6), .TC(doneC[6]) );\n    ^~~~~~~\n%Error: data/full_repos/permissive/116468596/topMod.v:94: Cannot find file containing module: \'count8D\'\n    count8D count8 (.clk(clk), .enable(frame), .reset(1\'b0), .LD(outOfAR[7]), .inD(rnd7), .TC(doneC[7]) );\n    ^~~~~~~\n%Error: data/full_repos/permissive/116468596/topMod.v:95: Cannot find file containing module: \'redRectangle\'\n%Error: data/full_repos/permissive/116468596/topMod.v:96: Cannot find file containing module: \'redRectangle\'\n%Error: data/full_repos/permissive/116468596/topMod.v:97: Cannot find file containing module: \'redRectangle\'\n%Error: data/full_repos/permissive/116468596/topMod.v:98: Cannot find file containing module: \'redRectangle\'\n%Error: data/full_repos/permissive/116468596/topMod.v:99: Cannot find file containing module: \'redRectangle\'\n%Error: data/full_repos/permissive/116468596/topMod.v:100: Cannot find file containing module: \'redRectangle\'\n%Error: data/full_repos/permissive/116468596/topMod.v:101: Cannot find file containing module: \'redRectangle\'\n%Error: data/full_repos/permissive/116468596/topMod.v:102: Cannot find file containing module: \'redRectangle\'\n%Warning-WIDTH: data/full_repos/permissive/116468596/topMod.v:103: Operator ASSIGNW expects 1 bits on the Assign RHS, but Assign RHS\'s AND generates 8 bits.\n                                                                 : ... In instance topMod\n    assign btncFilter = {8{btnC}} & resetState & startState & loadTime;\n                      ^\n%Error: data/full_repos/permissive/116468596/topMod.v:126: Cannot find file containing module: \'count14D\'\n    count14D countDown (.clk(clk), .enable(frame & (anyHit & scoreCounterEnable < 4\'d8)), .LD(startState | resetState), .sw(sw), .outQ(outTime), .TC(timeOut)  );\n    ^~~~~~~~\n%Error: data/full_repos/permissive/116468596/topMod.v:132: Cannot find file containing module: \'ringCounter\'\n    ringCounter ring (.clk(clk), .digsel(digsel), .sel(ringOut));\n    ^~~~~~~~~~~\n%Error: data/full_repos/permissive/116468596/topMod.v:133: Cannot find file containing module: \'selector\'\n    selector select (.sel(ringOut), .N(selectorIn), .H(selOut));\n    ^~~~~~~~\n%Error: data/full_repos/permissive/116468596/topMod.v:134: Cannot find file containing module: \'hex7seg\'\n    hex7seg display (.n(selOut), .enable(1\'b1), .seg(seg));\n    ^~~~~~~\n%Error: Exiting due to 30 error(s), 5 warning(s)\n'
module topMod(
    input btnU, btnL, btnC, btnR, btnD,
    input clkin,
    input [15:0] sw,
    output [3:0] an,
    output [6:0] seg,
    output [15:0] led,
    output Hsync, Vsync,
    output [3:0]vgaRed,
    output [3:0] vgaBlue,
    output [3:0] vgaGreen
    );
    wire clk, digsel, frame, eightSec, twoSec, edgeOut; 
    wire [7:0] doneCount;
    wire topHit, bottomHit, cntUp, cntDown, cntRight, cntLeft, upDownLD, leftRightLD;
    wire activeGreen, greenSquareOut, greenTagger;
    wire [7:0] redRect,activeRed,resetState, startState,loadTime;
    wire redRectPass;
    wire activeRegion, goodWall, topWall, bottomWall, leftWall, rightWall;
    wire [9:0] hOutQ, vOutQ;
    wire [7:0] outOfAR, doneC;
    wire [7:0] rnd, rnd1, rnd2, rnd3, rnd4, rnd5, rnd6, rnd7;
    wire allhit, anyHit, timeOut; 
    wire [3:0] scoreCounterEnable;
    wire [13:0] tempInTime;
    wire [13:0] outTime;
    wire [7:0] hit, returnHit;
    wire [15:0] selectorIn;
    wire [3:0] ringOut;
    wire [3:0] selOut;
    wire btncFilter;
    FDRE #(.INIT(1'b0) ) syncFlsh (.C(clk), .R(1'b0), .CE(1'b1), .D(eightSec^syncFlash), .Q(syncFlash));

    lab7_clks not_so_slow (.clkin(clkin), .greset(sw[0]), .clk(clk), .digsel(digsel));
    count8 twoSecCount (.clk(clk), .enable(frame), .reset(1'b0), .twoSec(twoSec));
    count4 eighthSecCount (.clk(clk), .enable(frame), .eightSec(eightSec));
    edgeDetector ed_btnC (.clk(clk), .btnC(btnC), .edgeOut(edgeOut)); 
    

    vgaControlMod monitor (.clk(clk), .enable(1'b1), .up(1'b1), .LD(1'b0), .Hsync(Hsync),
     .activeRegion(activeRegion), .Vsync(Vsync), .hOutQ(hOutQ), .vOutQ(vOutQ), .goodWall(goodWall),
     .topWall(topWall), .bottomWall(bottomWall), .leftWall(leftWall), .rightWall(rightWall), .frame(frame) );
    
    

    taggerMod greenSq ( .hOutQ (hOutQ), .vOutQ(vOutQ), .frame(frame), .syncFlash(syncFlash), .activeGreen(activeGreen),
     .clk(clk), .cntUp(cntUp), .cntDown(cntDown), .cntRight(cntRight), .cntLeft(cntLeft), .upDownLD(upDownLD),
      .leftRightLD(leftRightLD), .greenSquare(greenSquareOut), .topHit(topHit), .bottomHit(bottomHit), .leftHit(leftHit), .rightHit(rightHit) );

    updownTagger upDownSM (.clk(clk), .twoSec(twoSec), .top(topHit), .bottom(bottomHit), .up(btnU), .down(btnD),
     .countUp(cntUp), .countDown(cntDown), .upDownLD(upDownLD), .activeGreen(activeGreen) );
    updownTagger leftRightSM (.clk(clk), .twoSec(twoSec), .top(rightHit), .bottom(leftHit), .up(btnR), .down(btnL),
     .countUp(cntRight), .countDown(cntLeft), .upDownLD(leftRightLD) );


    lfsr rect1Random (.clk(clk), .frame(frame), .rnd(rnd));
    assign rnd1 = {1'b1, rnd[1], 1'b0, rnd[4], 1'b1, rnd[6], 1'b0, rnd[2]};
    assign rnd2 = {1'b0, rnd[1], 1'b0, rnd[3], 1'b0, rnd[5], 1'b0, rnd[7]};
    assign rnd3 = {1'b0, rnd[2], 1'b0, rnd[4], 1'b0, rnd[6], 1'b0, rnd[3]};
    assign rnd4 = {1'b1, rnd[1], 1'b1, rnd[3], 1'b1, rnd[5], 1'b1, rnd[7]};
    assign rnd5 = {1'b1, rnd[2], 1'b1, rnd[4], 1'b1, rnd[6], 1'b1, rnd[6]};
    assign rnd6 = {1'b0, rnd[1], 1'b1, rnd[3], 1'b0, rnd[5], 1'b1, rnd[7]};
    assign rnd7 = {1'b0, rnd[2], 1'b1, rnd[4], 1'b0, rnd[6], 1'b1, rnd[5]};
    assign rnd8 = {1'b1, rnd[2], 1'b0, rnd[4], 1'b1, rnd[3], 1'b0, rnd[6]};
    count8D count1 (.clk(clk), .enable(frame), .reset(1'b0), .LD(outOfAR[0]), .inD(rnd), .TC(doneC[0]) );
    count8D count2 (.clk(clk), .enable(frame), .reset(1'b0), .LD(outOfAR[1]), .inD(rnd1), .TC(doneC[1]) );
    count8D count3 (.clk(clk), .enable(frame), .reset(1'b0), .LD(outOfAR[2]), .inD(rnd2), .TC(doneC[2]) );
    count8D count4 (.clk(clk), .enable(frame), .reset(1'b0), .LD(outOfAR[3]), .inD(rnd3), .TC(doneC[3]) );
    count8D count5 (.clk(clk), .enable(frame), .reset(1'b0), .LD(outOfAR[4]), .inD(rnd4), .TC(doneC[4]) );
    count8D count6 (.clk(clk), .enable(frame), .reset(1'b0), .LD(outOfAR[5]), .inD(rnd5), .TC(doneC[5]) );
    count8D count7 (.clk(clk), .enable(frame), .reset(1'b0), .LD(outOfAR[6]), .inD(rnd6), .TC(doneC[6]) );
    count8D count8 (.clk(clk), .enable(frame), .reset(1'b0), .LD(outOfAR[7]), .inD(rnd7), .TC(doneC[7]) );
    redRectangle rect1 (.clk(clk), .btnC(edgeOut), .frame(frame), .timeOut(timeOut), .syncFlash(syncFlash), .hit(hit[0]), .allHit(allHit), .returnHit(returnHit[0]), .doneCount(doneC[0]), .sw(sw), .hOutQ(hOutQ), .vOutQ(vOutQ), .horizontalPosition(10'd78), .redRect(redRect[0]), .outOfAR(outOfAR[0]),  .activeRed(activeRed[0]), .resetState(resetState[0]), .startState(startState[0]),.loadTime(loadTime[0]) );
    redRectangle rect2 (.clk(clk), .btnC(edgeOut), .frame(frame), .timeOut(timeOut), .syncFlash(syncFlash), .hit(hit[1]), .allHit(allHit), .returnHit(returnHit[1]), .doneCount(doneC[1]), .sw(sw), .hOutQ(hOutQ), .vOutQ(vOutQ), .horizontalPosition(10'd146), .redRect(redRect[1]), .outOfAR(outOfAR[1]), .activeRed(activeRed[1]), .resetState(resetState[1]), .startState(startState[1]),.loadTime(loadTime[1])  );
    redRectangle rect3 (.clk(clk), .btnC(edgeOut), .frame(frame), .timeOut(timeOut), .syncFlash(syncFlash), .hit(hit[2]), .allHit(allHit), .returnHit(returnHit[2]), .doneCount(doneC[2]), .sw(sw), .hOutQ(hOutQ), .vOutQ(vOutQ), .horizontalPosition(10'd214), .redRect(redRect[2]), .outOfAR(outOfAR[2]), .activeRed(activeRed[2]), .resetState(resetState[2]), .startState(startState[2]),.loadTime(loadTime[2])  );
    redRectangle rect4 (.clk(clk), .btnC(edgeOut), .frame(frame), .timeOut(timeOut), .syncFlash(syncFlash), .hit(hit[3]), .allHit(allHit), .returnHit(returnHit[3]), .doneCount(doneC[3]), .sw(sw), .hOutQ(hOutQ), .vOutQ(vOutQ), .horizontalPosition(10'd282), .redRect(redRect[3]), .outOfAR(outOfAR[3]), .activeRed(activeRed[3]), .resetState(resetState[3]), .startState(startState[3]),.loadTime(loadTime[3])  );
    redRectangle rect5 (.clk(clk), .btnC(edgeOut), .frame(frame), .timeOut(timeOut), .syncFlash(syncFlash), .hit(hit[4]), .allHit(allHit), .returnHit(returnHit[4]), .doneCount(doneC[4]), .sw(sw), .hOutQ(hOutQ), .vOutQ(vOutQ), .horizontalPosition(10'd350), .redRect(redRect[4]), .outOfAR(outOfAR[4]), .activeRed(activeRed[4]), .resetState(resetState[4]), .startState(startState[4]),.loadTime(loadTime[4])  );
    redRectangle rect6 (.clk(clk), .btnC(edgeOut), .frame(frame), .timeOut(timeOut), .syncFlash(syncFlash), .hit(hit[5]), .allHit(allHit), .returnHit(returnHit[5]), .doneCount(doneC[5]), .sw(sw), .hOutQ(hOutQ), .vOutQ(vOutQ), .horizontalPosition(10'd418), .redRect(redRect[5]), .outOfAR(outOfAR[5]), .activeRed(activeRed[5]), .resetState(resetState[5]), .startState(startState[5]),.loadTime(loadTime[5])  );
    redRectangle rect7 (.clk(clk), .btnC(edgeOut), .frame(frame), .timeOut(timeOut), .syncFlash(syncFlash), .hit(hit[6]), .allHit(allHit), .returnHit(returnHit[6]), .doneCount(doneC[6]), .sw(sw), .hOutQ(hOutQ), .vOutQ(vOutQ), .horizontalPosition(10'd486), .redRect(redRect[6]), .outOfAR(outOfAR[6]), .activeRed(activeRed[6]), .resetState(resetState[6]), .startState(startState[6]),.loadTime(loadTime[6])  );
    redRectangle rect8 (.clk(clk), .btnC(edgeOut), .frame(frame), .timeOut(timeOut), .syncFlash(syncFlash), .hit(hit[7]), .allHit(allHit), .returnHit(returnHit[7]), .doneCount(doneC[7]), .sw(sw), .hOutQ(hOutQ), .vOutQ(vOutQ), .horizontalPosition(10'd554), .redRect(redRect[7]), .outOfAR(outOfAR[7]), .activeRed(activeRed[7]), .resetState(resetState[7]), .startState(startState[7]),.loadTime(loadTime[7]) );
    assign btncFilter = {8{btnC}} & resetState & startState & loadTime;

    assign hit[0] = {redRect[0] & greenTagger};
    assign hit[1] = {redRect[1] & greenTagger};
    assign hit[2] = {redRect[2] & greenTagger};
    assign hit[3] = {redRect[3] & greenTagger};
    assign hit[4] = {redRect[4] & greenTagger};
    assign hit[5] = {redRect[5] & greenTagger};
    assign hit[6] = {redRect[6] & greenTagger};
    assign hit[7] = {redRect[7] & greenTagger};
    assign scoreCounterEnable = { {3'b000, returnHit[0]} + {3'b000, returnHit[1]} + {3'b000, returnHit[2]} + {3'b000, returnHit[3]} + {3'b000, returnHit[4]} +
     {3'b000, returnHit[5]} + {3'b000, returnHit[6]} + {3'b000, returnHit[7]} };
    assign allHit = {returnHit[0]&returnHit[1]&returnHit[2]&returnHit[3]&returnHit[4]&returnHit[5]&returnHit[6]&returnHit[7]};
    assign anyHit = {returnHit[0]|returnHit[1]|returnHit[2]|returnHit[3]|returnHit[4]|returnHit[5]|returnHit[6]|returnHit[7]};

    assign redRectPass = (activeRegion & redRect[0])|(activeRegion & redRect[1])|(activeRegion & redRect[2])|(activeRegion & redRect[3])
     |(activeRegion & redRect[4])|(activeRegion & redRect[5])|(activeRegion & redRect[6])|(activeRegion & redRect[7]);  
    assign vgaRed = {4{redRectPass | (activeRegion & goodWall& allHit & syncFlash) }};
    assign greenTagger = activeRegion & greenSquareOut;
    assign vgaGreen = {4{greenTagger | (activeRegion & goodWall & allHit & syncFlash) }};
    assign vgaBlue = {4{(activeRegion & goodWall & ~allHit) | 
    (activeRegion & goodWall & allHit & syncFlash)}};
    
    count14D countDown (.clk(clk), .enable(frame & (anyHit & scoreCounterEnable < 4'd8)), .LD(startState | resetState), .sw(sw), .outQ(outTime), .TC(timeOut)  );



    assign selectorIn = {scoreCounterEnable, 1'b0,1'b0,1'b0,1'b0, outTime[13:10],outTime[9:6]};

    ringCounter ring (.clk(clk), .digsel(digsel), .sel(ringOut));
    selector select (.sel(ringOut), .N(selectorIn), .H(selOut));
    hex7seg display (.n(selOut), .enable(1'b1), .seg(seg));
    
    assign led[15:4] = sw[15:4];
    assign an[0] = ~ringOut[0];
    assign an[1] = ~ringOut[1];
    assign an[2] = 1'b1;
    assign an[3] = ~ringOut[3];
    
    
endmodule
module topMod(
    input btnU, btnL, btnC, btnR, btnD,
    input clkin,
    input [15:0] sw,
    output [3:0] an,
    output [6:0] seg,
    output [15:0] led,
    output Hsync, Vsync,
    output [3:0]vgaRed,
    output [3:0] vgaBlue,
    output [3:0] vgaGreen
    );

    wire clk, digsel, frame, eightSec, twoSec, edgeOut; 
    wire [7:0] doneCount;
    wire topHit, bottomHit, cntUp, cntDown, cntRight, cntLeft, upDownLD, leftRightLD;
    wire activeGreen, greenSquareOut, greenTagger;
    wire [7:0] redRect,activeRed,resetState, startState,loadTime;
    wire redRectPass;
    wire activeRegion, goodWall, topWall, bottomWall, leftWall, rightWall;
    wire [9:0] hOutQ, vOutQ;
    wire [7:0] outOfAR, doneC;
    wire [7:0] rnd, rnd1, rnd2, rnd3, rnd4, rnd5, rnd6, rnd7;
    wire allhit, anyHit, timeOut; 
    wire [3:0] scoreCounterEnable;
    wire [13:0] tempInTime;
    wire [13:0] outTime;
    wire [7:0] hit, returnHit;
    wire [15:0] selectorIn;
    wire [3:0] ringOut;
    wire [3:0] selOut;
    wire btncFilter;
    FDRE #(.INIT(1'b0) ) syncFlsh (.C(clk), .R(1'b0), .CE(1'b1), .D(eightSec^syncFlash), .Q(syncFlash));

    lab7_clks not_so_slow (.clkin(clkin), .greset(sw[0]), .clk(clk), .digsel(digsel));
    count8 twoSecCount (.clk(clk), .enable(frame), .reset(1'b0), .twoSec(twoSec));
    count4 eighthSecCount (.clk(clk), .enable(frame), .eightSec(eightSec));
    edgeDetector ed_btnC (.clk(clk), .btnC(btnC), .edgeOut(edgeOut)); 
    

    vgaControlMod monitor (.clk(clk), .enable(1'b1), .up(1'b1), .LD(1'b0), .Hsync(Hsync),
     .activeRegion(activeRegion), .Vsync(Vsync), .hOutQ(hOutQ), .vOutQ(vOutQ), .goodWall(goodWall),
     .topWall(topWall), .bottomWall(bottomWall), .leftWall(leftWall), .rightWall(rightWall), .frame(frame) );
    
    

    taggerMod greenSq ( .hOutQ (hOutQ), .vOutQ(vOutQ), .frame(frame), .syncFlash(syncFlash), .activeGreen(activeGreen),
     .clk(clk), .cntUp(cntUp), .cntDown(cntDown), .cntRight(cntRight), .cntLeft(cntLeft), .upDownLD(upDownLD),
      .leftRightLD(leftRightLD), .greenSquare(greenSquareOut), .topHit(topHit), .bottomHit(bottomHit), .leftHit(leftHit), .rightHit(rightHit) );

    updownTagger upDownSM (.clk(clk), .twoSec(twoSec), .top(topHit), .bottom(bottomHit), .up(btnU), .down(btnD),
     .countUp(cntUp), .countDown(cntDown), .upDownLD(upDownLD), .activeGreen(activeGreen) );
    updownTagger leftRightSM (.clk(clk), .twoSec(twoSec), .top(rightHit), .bottom(leftHit), .up(btnR), .down(btnL),
     .countUp(cntRight), .countDown(cntLeft), .upDownLD(leftRightLD) );


    lfsr rect1Random (.clk(clk), .frame(frame), .rnd(rnd));
    assign rnd1 = {1'b1, rnd[1], 1'b0, rnd[4], 1'b1, rnd[6], 1'b0, rnd[2]};
    assign rnd2 = {1'b0, rnd[1], 1'b0, rnd[3], 1'b0, rnd[5], 1'b0, rnd[7]};
    assign rnd3 = {1'b0, rnd[2], 1'b0, rnd[4], 1'b0, rnd[6], 1'b0, rnd[3]};
    assign rnd4 = {1'b1, rnd[1], 1'b1, rnd[3], 1'b1, rnd[5], 1'b1, rnd[7]};
    assign rnd5 = {1'b1, rnd[2], 1'b1, rnd[4], 1'b1, rnd[6], 1'b1, rnd[6]};
    assign rnd6 = {1'b0, rnd[1], 1'b1, rnd[3], 1'b0, rnd[5], 1'b1, rnd[7]};
    assign rnd7 = {1'b0, rnd[2], 1'b1, rnd[4], 1'b0, rnd[6], 1'b1, rnd[5]};
    assign rnd8 = {1'b1, rnd[2], 1'b0, rnd[4], 1'b1, rnd[3], 1'b0, rnd[6]};
    count8D count1 (.clk(clk), .enable(frame), .reset(1'b0), .LD(outOfAR[0]), .inD(rnd), .TC(doneC[0]) );
    count8D count2 (.clk(clk), .enable(frame), .reset(1'b0), .LD(outOfAR[1]), .inD(rnd1), .TC(doneC[1]) );
    count8D count3 (.clk(clk), .enable(frame), .reset(1'b0), .LD(outOfAR[2]), .inD(rnd2), .TC(doneC[2]) );
    count8D count4 (.clk(clk), .enable(frame), .reset(1'b0), .LD(outOfAR[3]), .inD(rnd3), .TC(doneC[3]) );
    count8D count5 (.clk(clk), .enable(frame), .reset(1'b0), .LD(outOfAR[4]), .inD(rnd4), .TC(doneC[4]) );
    count8D count6 (.clk(clk), .enable(frame), .reset(1'b0), .LD(outOfAR[5]), .inD(rnd5), .TC(doneC[5]) );
    count8D count7 (.clk(clk), .enable(frame), .reset(1'b0), .LD(outOfAR[6]), .inD(rnd6), .TC(doneC[6]) );
    count8D count8 (.clk(clk), .enable(frame), .reset(1'b0), .LD(outOfAR[7]), .inD(rnd7), .TC(doneC[7]) );
    redRectangle rect1 (.clk(clk), .btnC(edgeOut), .frame(frame), .timeOut(timeOut), .syncFlash(syncFlash), .hit(hit[0]), .allHit(allHit), .returnHit(returnHit[0]), .doneCount(doneC[0]), .sw(sw), .hOutQ(hOutQ), .vOutQ(vOutQ), .horizontalPosition(10'd78), .redRect(redRect[0]), .outOfAR(outOfAR[0]),  .activeRed(activeRed[0]), .resetState(resetState[0]), .startState(startState[0]),.loadTime(loadTime[0]) );
    redRectangle rect2 (.clk(clk), .btnC(edgeOut), .frame(frame), .timeOut(timeOut), .syncFlash(syncFlash), .hit(hit[1]), .allHit(allHit), .returnHit(returnHit[1]), .doneCount(doneC[1]), .sw(sw), .hOutQ(hOutQ), .vOutQ(vOutQ), .horizontalPosition(10'd146), .redRect(redRect[1]), .outOfAR(outOfAR[1]), .activeRed(activeRed[1]), .resetState(resetState[1]), .startState(startState[1]),.loadTime(loadTime[1])  );
    redRectangle rect3 (.clk(clk), .btnC(edgeOut), .frame(frame), .timeOut(timeOut), .syncFlash(syncFlash), .hit(hit[2]), .allHit(allHit), .returnHit(returnHit[2]), .doneCount(doneC[2]), .sw(sw), .hOutQ(hOutQ), .vOutQ(vOutQ), .horizontalPosition(10'd214), .redRect(redRect[2]), .outOfAR(outOfAR[2]), .activeRed(activeRed[2]), .resetState(resetState[2]), .startState(startState[2]),.loadTime(loadTime[2])  );
    redRectangle rect4 (.clk(clk), .btnC(edgeOut), .frame(frame), .timeOut(timeOut), .syncFlash(syncFlash), .hit(hit[3]), .allHit(allHit), .returnHit(returnHit[3]), .doneCount(doneC[3]), .sw(sw), .hOutQ(hOutQ), .vOutQ(vOutQ), .horizontalPosition(10'd282), .redRect(redRect[3]), .outOfAR(outOfAR[3]), .activeRed(activeRed[3]), .resetState(resetState[3]), .startState(startState[3]),.loadTime(loadTime[3])  );
    redRectangle rect5 (.clk(clk), .btnC(edgeOut), .frame(frame), .timeOut(timeOut), .syncFlash(syncFlash), .hit(hit[4]), .allHit(allHit), .returnHit(returnHit[4]), .doneCount(doneC[4]), .sw(sw), .hOutQ(hOutQ), .vOutQ(vOutQ), .horizontalPosition(10'd350), .redRect(redRect[4]), .outOfAR(outOfAR[4]), .activeRed(activeRed[4]), .resetState(resetState[4]), .startState(startState[4]),.loadTime(loadTime[4])  );
    redRectangle rect6 (.clk(clk), .btnC(edgeOut), .frame(frame), .timeOut(timeOut), .syncFlash(syncFlash), .hit(hit[5]), .allHit(allHit), .returnHit(returnHit[5]), .doneCount(doneC[5]), .sw(sw), .hOutQ(hOutQ), .vOutQ(vOutQ), .horizontalPosition(10'd418), .redRect(redRect[5]), .outOfAR(outOfAR[5]), .activeRed(activeRed[5]), .resetState(resetState[5]), .startState(startState[5]),.loadTime(loadTime[5])  );
    redRectangle rect7 (.clk(clk), .btnC(edgeOut), .frame(frame), .timeOut(timeOut), .syncFlash(syncFlash), .hit(hit[6]), .allHit(allHit), .returnHit(returnHit[6]), .doneCount(doneC[6]), .sw(sw), .hOutQ(hOutQ), .vOutQ(vOutQ), .horizontalPosition(10'd486), .redRect(redRect[6]), .outOfAR(outOfAR[6]), .activeRed(activeRed[6]), .resetState(resetState[6]), .startState(startState[6]),.loadTime(loadTime[6])  );
    redRectangle rect8 (.clk(clk), .btnC(edgeOut), .frame(frame), .timeOut(timeOut), .syncFlash(syncFlash), .hit(hit[7]), .allHit(allHit), .returnHit(returnHit[7]), .doneCount(doneC[7]), .sw(sw), .hOutQ(hOutQ), .vOutQ(vOutQ), .horizontalPosition(10'd554), .redRect(redRect[7]), .outOfAR(outOfAR[7]), .activeRed(activeRed[7]), .resetState(resetState[7]), .startState(startState[7]),.loadTime(loadTime[7]) );
    assign btncFilter = {8{btnC}} & resetState & startState & loadTime;

    assign hit[0] = {redRect[0] & greenTagger};
    assign hit[1] = {redRect[1] & greenTagger};
    assign hit[2] = {redRect[2] & greenTagger};
    assign hit[3] = {redRect[3] & greenTagger};
    assign hit[4] = {redRect[4] & greenTagger};
    assign hit[5] = {redRect[5] & greenTagger};
    assign hit[6] = {redRect[6] & greenTagger};
    assign hit[7] = {redRect[7] & greenTagger};
    assign scoreCounterEnable = { {3'b000, returnHit[0]} + {3'b000, returnHit[1]} + {3'b000, returnHit[2]} + {3'b000, returnHit[3]} + {3'b000, returnHit[4]} +
     {3'b000, returnHit[5]} + {3'b000, returnHit[6]} + {3'b000, returnHit[7]} };
    assign allHit = {returnHit[0]&returnHit[1]&returnHit[2]&returnHit[3]&returnHit[4]&returnHit[5]&returnHit[6]&returnHit[7]};
    assign anyHit = {returnHit[0]|returnHit[1]|returnHit[2]|returnHit[3]|returnHit[4]|returnHit[5]|returnHit[6]|returnHit[7]};

    assign redRectPass = (activeRegion & redRect[0])|(activeRegion & redRect[1])|(activeRegion & redRect[2])|(activeRegion & redRect[3])
     |(activeRegion & redRect[4])|(activeRegion & redRect[5])|(activeRegion & redRect[6])|(activeRegion & redRect[7]);  
    assign vgaRed = {4{redRectPass | (activeRegion & goodWall& allHit & syncFlash) }};
    assign greenTagger = activeRegion & greenSquareOut;
    assign vgaGreen = {4{greenTagger | (activeRegion & goodWall & allHit & syncFlash) }};
    assign vgaBlue = {4{(activeRegion & goodWall & ~allHit) | 
    (activeRegion & goodWall & allHit & syncFlash)}};
    
    count14D countDown (.clk(clk), .enable(frame & (anyHit & scoreCounterEnable < 4'd8)), .LD(startState | resetState), .sw(sw), .outQ(outTime), .TC(timeOut)  );



    assign selectorIn = {scoreCounterEnable, 1'b0,1'b0,1'b0,1'b0, outTime[13:10],outTime[9:6]};

    ringCounter ring (.clk(clk), .digsel(digsel), .sel(ringOut));
    selector select (.sel(ringOut), .N(selectorIn), .H(selOut));
    hex7seg display (.n(selOut), .enable(1'b1), .seg(seg));
    
    assign led[15:4] = sw[15:4];
    assign an[0] = ~ringOut[0];
    assign an[1] = ~ringOut[1];
    assign an[2] = 1'b1;
    assign an[3] = ~ringOut[3];
    
    
endmodule