Skip to content

Instantly share code, notes, and snippets.

@SamKLowe
Created June 14, 2018 23:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SamKLowe/27538b0e99f09f5c64f21edad44c3e88 to your computer and use it in GitHub Desktop.
Save SamKLowe/27538b0e99f09f5c64f21edad44c3e88 to your computer and use it in GitHub Desktop.
Sam and Noah
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 06/14/2018 03:56:38 PM
// Design Name:
// Module Name: top
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
module top(
input wire sw,
output wire toggleout,
input wire clk,
input wire reset
);
reg [26:0] count1 = 27'b0;
reg toggle = 1'b0;
always @ (posedge clk or posedge reset)
begin
if(reset)
begin
count1 <= 0;
end
else
begin
if(count1 >= 50000000)
begin
count1 <= count1 - 50000000;
end
else
begin
count1 <= count1 + sw;
end
if(toggle == 0)
begin
toggle <= 1;
end
else
begin
toggle <= 0;
end
end
end
assign toggleout = toggle;
endmodule
@SamKLowe
Copy link
Author

This is a synthesizable module but is not complete since I couldn't see the rest of your code. Glad to meet you and don't hesitate to ask questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment