Skip to content

Commit

Permalink
Make inline prim input type explicit (#1970)
Browse files Browse the repository at this point in the history
* make inline prim input type explicit

* update tests

---------

Co-authored-by: Rachit Nigam <[email protected]>
  • Loading branch information
matth2k and rachitnigam committed Mar 14, 2024
1 parent 23cd0a1 commit 67305da
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 24 deletions.
2 changes: 1 addition & 1 deletion calyx-backend/src/verilog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ fn emit_prim_inline<F: io::Write>(
// NOTE: The signature port definitions are reversed inside the component.
match port.direction {
ir::Direction::Input => {
write!(f, " input")?;
write!(f, " input wire")?;
}
ir::Direction::Output => {
write!(f, " output")?;
Expand Down
1 change: 0 additions & 1 deletion primitives/core.sv
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* - All parameter names must be SNAKE_CASE and all caps.
* - Port names must be snake_case, no caps.
*/
`default_nettype none

module std_slice #(
parameter IN_WIDTH = 32,
Expand Down
14 changes: 7 additions & 7 deletions tests/backend/verilog/big-const.expect
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ endmodule
module std_wire #(
parameter WIDTH = 32
) (
input logic [WIDTH-1:0] in,
input wire logic [WIDTH-1:0] in,
output logic [WIDTH-1:0] out
);
assign out = in;
Expand All @@ -27,8 +27,8 @@ endmodule
module std_add #(
parameter WIDTH = 32
) (
input logic [WIDTH-1:0] left,
input logic [WIDTH-1:0] right,
input wire logic [WIDTH-1:0] left,
input wire logic [WIDTH-1:0] right,
output logic [WIDTH-1:0] out
);
assign out = left + right;
Expand All @@ -37,10 +37,10 @@ endmodule
module std_reg #(
parameter WIDTH = 32
) (
input logic [WIDTH-1:0] in,
input logic write_en,
input logic clk,
input logic reset,
input wire logic [WIDTH-1:0] in,
input wire logic write_en,
input wire logic clk,
input wire logic reset,
output logic [WIDTH-1:0] out,
output logic done
);
Expand Down
14 changes: 7 additions & 7 deletions tests/backend/verilog/data-instance.expect
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ endmodule
module std_wire #(
parameter WIDTH = 32
) (
input logic [WIDTH-1:0] in,
input wire logic [WIDTH-1:0] in,
output logic [WIDTH-1:0] out
);
assign out = in;
Expand All @@ -27,8 +27,8 @@ endmodule
module std_add #(
parameter WIDTH = 32
) (
input logic [WIDTH-1:0] left,
input logic [WIDTH-1:0] right,
input wire logic [WIDTH-1:0] left,
input wire logic [WIDTH-1:0] right,
output logic [WIDTH-1:0] out
);
assign out = left + right;
Expand All @@ -37,10 +37,10 @@ endmodule
module std_reg #(
parameter WIDTH = 32
) (
input logic [WIDTH-1:0] in,
input logic write_en,
input logic clk,
input logic reset,
input wire logic [WIDTH-1:0] in,
input wire logic write_en,
input wire logic clk,
input wire logic reset,
output logic [WIDTH-1:0] out,
output logic done
);
Expand Down
15 changes: 7 additions & 8 deletions tests/backend/verilog/memory-with-external-attribute.expect
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ endmodule
* - All parameter names must be SNAKE_CASE and all caps.
* - Port names must be snake_case, no caps.
*/
`default_nettype none

module std_slice #(
parameter IN_WIDTH = 32,
Expand Down Expand Up @@ -500,7 +499,7 @@ endmodule
module std_wire #(
parameter WIDTH = 32
) (
input logic [WIDTH-1:0] in,
input wire logic [WIDTH-1:0] in,
output logic [WIDTH-1:0] out
);
assign out = in;
Expand All @@ -509,8 +508,8 @@ endmodule
module std_add #(
parameter WIDTH = 32
) (
input logic [WIDTH-1:0] left,
input logic [WIDTH-1:0] right,
input wire logic [WIDTH-1:0] left,
input wire logic [WIDTH-1:0] right,
output logic [WIDTH-1:0] out
);
assign out = left + right;
Expand All @@ -519,10 +518,10 @@ endmodule
module std_reg #(
parameter WIDTH = 32
) (
input logic [WIDTH-1:0] in,
input logic write_en,
input logic clk,
input logic reset,
input wire logic [WIDTH-1:0] in,
input wire logic write_en,
input wire logic clk,
input wire logic reset,
output logic [WIDTH-1:0] out,
output logic done
);
Expand Down

0 comments on commit 67305da

Please sign in to comment.