Open sifferman opened 1 year ago
@nbdd0121 Disallowing argumentless functions would work. I don't see many people using them. It seems the best use-case is just for style consistency for a group of related functions.
For example: https://github.com/pulp-platform/riscv-dbg/blob/138d74bcaa90c70180c12215db3776813d2a95f2/src/dm_pkg.sv#L420-L437
function automatic logic [31:0] csrr (csr_reg_t csr, logic [4:0] dest); // rs1, CSRRS, rd, OpCode System return {csr, 5'h0, 3'h2, dest, 7'h73}; endfunction function automatic logic [31:0] branch(logic [4:0] src2, logic [4:0] src1, logic [2:0] funct3, logic [11:0] offset); // OpCode Branch return {offset[11], offset[9:4], src2, src1, funct3, offset[3:0], offset[10], 7'b11_000_11}; endfunction function automatic logic [31:0] ebreak (); return 32'h00100073; endfunction
By @a-will in https://github.com/lowRISC/style-guides/issues/66#issuecomment-1662542373
// Equivalent variable declarations with initial values. logic foo = bar; var logic foo = bar; // Equivalent net declarations with continuous assignment. wire foo = bar; wire logic foo = bar;
Wow, I didn't know you could do this. I think this example should be added to the "Use logic
for synthesis" section. It may help stress the importance of the rule a bit more
This is a dedicated location to discuss a potential addition to the style guide to cover the following edge case:
VCS (2020.12) will currently not run this correctly:
Possible solutions
This is a summary of the discussion made in #66.
assign
/wire
.always_comb
should be used instead. By @sifferman and @marnovandermaaswire [7:0] test = test_func()
). By @GregACFull explanation by @GregAC in https://github.com/lowRISC/style-guides/issues/66#issuecomment-1662118280