initial commit

This commit is contained in:
schmidtsi76327 committed 2021-06-09 11:04:53 +02:00
1 parent 6e10179e99
commit 2cd5d89e87
34 files changed
+1050 -2

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
//////////////////////////////////////////////////////////////
// 4-bit loadable up-down counter //////
//////////////////////////////////////////////////////////////
module counter(clk, rst, data, updown, load, data_out);
input clk, rst, load;
input updown;
input [3:0] data;
output reg [3:0] data_out;
always @(posedge clk)
begin
if(rst)
data_out <= 4'b0;
else if(load)
data_out <= data;
else
data_out <= ((updown)?(data_out + 1'b1):(data_out -1'b1));
end
// Dump waves
initial begin
$dumpfile("dump.vcd");
$dumpvars(1, counter);
end
endmodule