Agent skill
writing-module
Provides module template with include guard, port ordering, and checklist. Triggers when creating a new svc_ module from scratch.
Stars
163
Forks
31
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/development/writing-module
SKILL.md
Writing a New Module
Module Template
systemverilog
`ifndef SVC_MODULE_NAME_SV
`define SVC_MODULE_NAME_SV
`include "svc.sv"
module svc_module_name #(
parameter WIDTH = 32
) (
input logic clk,
input logic rst_n,
input logic in_valid,
input logic [WIDTH-1:0] in_data,
output logic in_ready,
output logic out_valid,
output logic [WIDTH-1:0] out_data,
input logic out_ready
);
//
// Localparams
//
//
// Internal signals
//
logic [WIDTH-1:0] data_next;
//
// Child module instantiations
//
//
// Combinational logic
//
always_comb begin
data_next = in_data;
end
//
// Sequential logic
//
always_ff @(posedge clk) begin
if (!rst_n) begin
out_valid <= 1'b0;
out_data <= '0;
end else begin
// Logic here
end
end
endmodule
`endif
Checklist
- Include guard with
_SVsuffix (uppercase module name) -
include "svc.sv"after guard - Module name has
svc_prefix - Ports:
clk,rst_nfirst - Parameters before ports
- Group related ports with blank lines
- Align port declarations
- Comments above code, never at end of line
- Use blank comment blocks for section separators
- Run
make formatwhen done - Run
make lintbefore committing
File Location
Place in appropriate rtl/ subdirectory:
rtl/axi/- AXI/AXI-Litertl/cdc/- Clock domain crossingrtl/common/- Fundamental building blocksrtl/fifo/- FIFOsrtl/gfx/- Graphics/VGArtl/ice40/- iCE40 FPGA-specificrtl/rv/- RISC-V processorrtl/stats/- Statistics collectionrtl/uart/- Serial communication
Reference Implementation
See rtl/common/svc_arbiter.sv for a well-structured example.
Didn't find tool you were looking for?