Skip to content

Commit

Permalink
Add Baklava in Verilog (#3871)
Browse files Browse the repository at this point in the history
  • Loading branch information
rzuckerm authored Oct 3, 2024
1 parent 743a050 commit 31ba7e6
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions archive/v/verilog/baklava.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module main;
integer i, j, numSpaces, numStars;
initial begin
for (i = -10; i <= 10; i += 1) begin
numSpaces = i;
if (numSpaces < 0) begin
numSpaces = -numSpaces;
end

for (j = 0; j < numSpaces; j += 1) begin
$write(" ");
end

numStars = 21 - 2 * numSpaces;
for (j = 0; j < numStars; j += 1) begin
$write("*");
end

$write("\n");
end
$finish(0);
end
endmodule

0 comments on commit 31ba7e6

Please sign in to comment.