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 8 remaining solutions by signing in and submitting your own entry
#9 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

9 active golfers, 41 entries

Leaderboard (lowest score wins):
107
#1 - Jean George / @JeanGeo20504212

03/29/2024 at 06:32PM

107
#2 - Danilo J. S. Bellini 🥊🇧🇷 / @danilobellini

03/29/2024 at 07:18PM

107
#3 - Peppa Pig / @PeppaPigSg

07/11/2024 at 04:04AM

140
#4 - Ryo_Ishimoto / @RIshimoto

03/07/2024 at 02:31PM

140
#5 - nickGPT / @nickandbro

08/23/2024 at 05:45AM

144
#6 - Pablo Cárdenas / @pablo_cardenasb

02/27/2024 at 11:39PM

146
#7 - MonkieeBoi / @MonkieeBoi

02/02/2024 at 10:15AM

181
#8 - Matt Zhang / @MattUnderscoreZhang

01/05/2024 at 04:47AM

197
#9 - Dyson / @DoctorDalek1963

01/24/2024 at 02:45PM