Skip to content

Instantly share code, notes, and snippets.

@ungood
Created May 5, 2011 15:45
Show Gist options
  • Select an option

  • Save ungood/957278 to your computer and use it in GitHub Desktop.

Select an option

Save ungood/957278 to your computer and use it in GitHub Desktop.
reg v. wire example
module add(a, b, out);
input [4:0] a, b;
output [4:0] out;
wire a, b;
reg out;
always @(a or b)
out = a + b;
endmodule;
module sub(a, b, out);
input [4:0] a, b;
output [4:0] out;
wire a, b;
reg out;
always @(a or b)
out = a - b;
endmodule;
module test();
wire [4:0] sum, diff;
add add0(4'b0010, 4'b0011, sum);
sub sub0(sum, 4'b0001, diff);
endmodule;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment