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

The best way to learn is to practice. Below, you will find some of the solutions other golfers have entered. To unlock higher ranked solutions, submit your own entry which does as well or better than the solutions you can currently see - climb the ladder!

Check out these helpful resources to improve your Vim skills... Game on.

Unlock 6 remaining solutions by signing in and submitting your own entry
#7 Dyson / @DoctorDalek1963 - Score: 197 - 01/24/24 @ 14:45
dwjw<C-V>jels.<Esc>f=<C-V>jr llct,(8)<Esc>jvhc(16)<Esc>ji i0_sram <Esc>jqq$Bd^yiwi.<Esc>ea (w_)<Esc>Pjq6@qjdGkf f <C-V>kdkkbhh<C-V>ks   <Esc>kki <Esc><C-V>6jbygg8O<Esc>ggpqqI  wire        w_<Esc>A;<Esc>jq6@qkqq^ellR[15:0]<Esc>kq2@qjF1R 7<Esc>:%s/ \+;/;<CR>4jqqI  <Esc>jq11@qZZ

0 comments


Created by: @5S-Goran

7 active golfers, 16 entries

Leaderboard (lowest score wins):
10
#1 - あああ / @kVaY5ghuwn6J11E

03/03/2024 at 07:57AM

126
#2 - Jean George / @JeanGeo20504212

03/03/2024 at 10:17AM

134
#3 - Danilo J. S. Bellini 🥊🇧🇷 / @danilobellini

02/25/2024 at 09:42PM

144
#4 - Pablo Cárdenas / @pablo_cardenasb

02/27/2024 at 11:39PM

146
#5 - MonkieeBoi / @MonkieeBoi

02/02/2024 at 10:15AM

181
#6 - Matt Zhang / @MattUnderscoreZhang

01/05/2024 at 04:47AM

197
#7 - Dyson / @DoctorDalek1963

01/24/2024 at 02:45PM