Real Vim ninjas count every keystroke - do you?

Pick a challenge, fire up Vim, and show us what you got.

Changelog, Rules & FAQ, updates: @vimgolf, RSS.

Your VimGolf key: please sign in

$ gem install vimgolf
$ vimgolf setup
$ vimgolf put 9v006596bb0c00000000025f

Instance creation in Verilog

Creating an instance of a module is a very frequent task in Verilog. Let's see how efficiently can it be done

Start file
module sram #(
  parameter AW = 12,
  parameter DW = 32
)(
  input clk,
  input rstn,
  input wr,
  input rd,
  input [AW-1:0] addr,
  input [DW-1:0] wdata,
  output [DW-1:0] rdata
);
  // here goes the SRAM model
  // ...
endmodule
End file
  wire        w_clk;
  wire        w_rstn;
  wire        w_wr;
  wire        w_rd;
  wire [ 7:0] w_addr;
  wire [15:0] w_wdata;
  wire [15:0] w_rdata;

  sram #(
    .AW   (8),
    .DW   (16)
  ) i0_sram (
    .clk  (w_clk),
    .rstn (w_rstn),
    .wr   (w_wr),
    .rd   (w_rd),
    .addr (w_addr),
    .wdata(w_wdata),
    .rdata(w_rdata)
  );

View Diff

1,15c1,20
< module sram #(
<   parameter AW = 12,
<   parameter DW = 32
< )(
<   input clk,
<   input rstn,
<   input wr,
<   input rd,
<   input [AW-1:0] addr,
<   input [DW-1:0] wdata,
<   output [DW-1:0] rdata
< );
<   // here goes the SRAM model
<   // ...
< endmodule
---
>   wire        w_clk;
>   wire        w_rstn;
>   wire        w_wr;
>   wire        w_rd;
>   wire [ 7:0] w_addr;
>   wire [15:0] w_wdata;
>   wire [15:0] w_rdata;
> 
>   sram #(
>     .AW   (8),
>     .DW   (16)
>   ) i0_sram (
>     .clk  (w_clk),
>     .rstn (w_rstn),
>     .wr   (w_wr),
>     .rd   (w_rd),
>     .addr (w_addr),
>     .wdata(w_wdata),
>     .rdata(w_rdata)
>   );

Solutions by @nickandbro:

Unlock 6 remaining solutions by signing in and submitting your own entry
Created by: @5S-Goran

9 active golfers, 41 entries

Solutions by @nickandbro:
140
#5 - nickGPT / @nickandbro

08/23/2024 at 05:45AM

140
#>5 - nickGPT / @nickandbro

08/26/2024 at 07:32PM

144
#>6 - nickGPT / @nickandbro

08/23/2024 at 05:44AM

146
#>7 - nickGPT / @nickandbro

08/23/2024 at 03:42AM

181
#>8 - nickGPT / @nickandbro

08/23/2024 at 03:41AM

197
#>9 - nickGPT / @nickandbro

08/23/2024 at 03:41AM