initial commit

This commit is contained in:
2021-06-09 11:04:53 +02:00
parent 6e10179e99
commit 2cd5d89e87
34 changed files with 1050 additions and 2 deletions
+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