Skip to content

Conversation

@jwang2672
Copy link
Collaborator

its not done yet

Copy link
Owner

@coderkalyan coderkalyan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the work! Left a few initial comments.

// `XARITH_OP_SLT: o_result = (i_op1 < i_op2) ? 1'b1 : 1'b0
// `XARITH_OP_CMP: o_result = min/max(i_op1, i_op2)
input wire [1:0] i_opsel,
input wire [ 1:0] i_opsel,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Autoformatting definitely needs to be done but please don't add it here in this PR.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ye thats a next time problem my bad


// comparison
wire lt = sum[63];
wire lt = sum[63];
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here and everywhere else. Also, the equals signs were explicitly aligned here so the formatter needs to be tweaked.

begin
// implement bypassing for all read ports, assumes
// rd1 != rd2
if (i_rd1_wen && (i_rs1_addr == i_rd1_addr))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah please avoid especially these large changes to unrelated modules.

tb_shifter.v Outdated
$dumpvars(0, tb_shifter);
end

wire i_word_true = i_word == 1'b1;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i_word_true is the same as i_word and i_word_false is the same as !i_word, more readable

tb_shifter.v Outdated
wire i_word_true = i_word == 1'b1;
wire i_word_false = i_word == 1'b0;

initial begin
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Take a look at the formal article I sent, should be using an always @(*) combinational block here.

input wire i_rst_n,
input wire [63:0] i_operand,
input wire [5:0] i_amount,
input wire i_clk,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the interface to the shifter should be sequential. It's fine if you want to keep it single cycle for now (but update the comments if you do). I don't see any pipeline registers here to latch o_result.

assign stage5_ror = (i_amount[5]) ? ({stage4_ror[31:0], stage4_ror[63:32]}) : stage4_ror;

// Select operation for final output
assign o_result_tmp =
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No correctness issues here but please use a case statement in these cases. Ternary is great for the above stages, but for a multi-way mux between outputs it may synthesize better to a flatter tree than the ternary chain.

stage5_ror;

// Stage 0: rotate by 1 (32 bit)
assign stage0_32_rotate = (i_amount[0]) ? (
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now I think its best to unroll these like the others. This optimizes for latency and we can do a pass later to try to reduce the area cost of the shifter. It will be large.

@jwang2672 jwang2672 force-pushed the jw_multiply_shift branch 5 times, most recently from c6e74df to d1eecd4 Compare April 15, 2025 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants