Skip to content

Commit

Permalink
Manually instantiate buffers
Browse files Browse the repository at this point in the history
  • Loading branch information
meiniKi committed Apr 3, 2024
1 parent 10e2a39 commit 0128cfe
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
15 changes: 14 additions & 1 deletion rtl/fazyrv_pc.sv
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,20 @@ assign add_vec = {{(ADD_VEC_WIDTH-3){1'b0}}, inc_i, 2'b00};

assign carry_vec[0] = carry_r[0];

assign pc_n = shift_i ? {din_i, pc_r[31:CHUNKSIZE]} : pc_r;

// Insert sky130 buffers manually to achieve a higher
// placement density. Inspired by MichaelBell/tinyQV
// www.github.com/MichaelBell/tinyQV/blob/69ce898bf1122e91a3114f3f0fe8e4bdf242f7f0/cpu/register.v#L58
//

logic [31-CHUNKSIZE:0] pc_dlyd;
`ifdef SKY130
sky130_fd_sc_hd__dlygate4sd3_1 i_buf[31-CHUNKSIZE:0] ( .X(pc_dlyd), .A(pc_r[31:CHUNKSIZE]) );
`else
buf #1 i_buf[31:CHUNKSIZE] (pc_dlyd, pc_r[31:CHUNKSIZE]);
`endif

assign pc_n = shift_i ? {din_i, pc_dlyd} : pc_r;

always_ff @(posedge clk_i) begin
if (~rst_in) begin
Expand Down
14 changes: 13 additions & 1 deletion rtl/fazyrv_shftreg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,23 @@ logic [31:0] reg_r = 'b0;
logic [31:0] reg_r;
`endif

// Insert sky130 buffers manually to achieve a higher
// placement density. Inspired by MichaelBell/tinyQV
// www.github.com/MichaelBell/tinyQV/blob/69ce898bf1122e91a3114f3f0fe8e4bdf242f7f0/cpu/register.v#L58
//

logic [31-CHUNKSIZE:0] reg_dlyd;
`ifdef SKY130
sky130_fd_sc_hd__dlygate4sd3_1 i_buf[31-CHUNKSIZE:0] ( .X(reg_dlyd), .A(reg_r[31:CHUNKSIZE]) );
`else
buf #1 i_buf[31:CHUNKSIZE] (reg_dlyd, reg_r[31:CHUNKSIZE]);
`endif

assign dat_o = reg_r[CHUNKSIZE-1:0];

always_ff @(posedge clk_i) begin
if (shft_i) begin
reg_r <= {dat_i, reg_r[31:CHUNKSIZE]};
reg_r <= {dat_i, reg_dlyd};
end
end

Expand Down

0 comments on commit 0128cfe

Please sign in to comment.