Skip to content
This repository has been archived by the owner on May 13, 2023. It is now read-only.

Latest commit

 

History

History
95 lines (76 loc) · 2.83 KB

SAMPLES.md

File metadata and controls

95 lines (76 loc) · 2.83 KB

Sample Circuits and Screenshots

1Bit Full Adder

This circuit calculates the result of adding two bits together as well as a carried value form a previous addition. Chaining multiple of these adders together by connecting the Cout and Cin of subsequent adders is how simple multiple bit adders work.

module fulladder
(
    input x, y, cin,
    output A, cout
);
 
assign {cout,A} =  cin + y + x;
 
endmodule

Minecraft Circuit 1bit_full_adder Sample Input
1bit_full_adder_input Sample Output
1bit_full_adder_output
In this case we are calculating '1' + '1' with no carry in. The result is the binary number "10" however since out output is only 1 bit, the output A is actually '0' and the carry out Cout is set to '1'.


Logical Funtioning Unit

This circuit is an "all-in-one" 1-bit boolean calculator. It has 2 control signals that select the operation we want to do and 2 inputs. The output is the result of the operation selected by C1 and C2 using the inputs a and b.

module lfu (
    input C1, C2, a, b,
    output o
);

always @(C1, C2, a, b)
begin
  if (C1 == 0 && C2 == 0)
    o = a & b;
  else if (C1 == 0 && C2 == 1)
    o = a | b;
  else if (C1 == 1 && C2 == 0)
    o = a ^ b;
  else
    o = 0;
end

endmodule

The control values correspond to the folowing operations:

  • '0', '0' : a AND b
  • '0', '1' : a OR b,
  • '1', '0' : a XOR b,
  • '1', '1' : Nothing, output is set to 0

Minecraft Circuit lfu


2Bit 7-Segment Display Decoder

This circuit controls the state of the 7 segments of a 7-segment display. For this example we only decode a 2Bit number (that means we can display numbers 0, 1, 2, and 3); We chose 2Bits because a full 0-9 decoder would have been too large. However MinecraftHDL does generate it properly.

module sevenseg (
    input I1, I2,
    output S1, S2, S3, S4, S5, S6, S7
);

assign S1 = ~I2 | I1;
assign S2 = 1;
assign S3 = ~I1 | I2;
assign S4 = ~I2 | I1;
assign S5 = ~I2;
assign S6 = ~I1 & ~I2;
assign S7 = I1;

endmodule

Minecraft Circuit 7seg Here, the display was built and wired to the outputs by hand, however all the logic and circuit were generated from the verilog above.

Gif of the display in action!

7seg