wavedrom / bitfield

:cake: bit field diagram renderer
MIT License
340 stars 26 forks source link

declaring multiple registers in bitfield #57

Open sriniv1422 opened 1 year ago

sriniv1422 commented 1 year ago

Hello

How can I declare multiple registers using bitfield . For eg : {reg: [ {bits: 7, name: 'opcode', attr: 'OP-IMM'}, {bits: 5, name: 'rd', attr: 'dest'}, {bits: 3, name: 'func3', attr: ['ADDI']}, {bits: 5, name: 'rs1', attr: 'src'}, {bits: 12, name: 'imm[11:0]', attr: 'I-immediate[11:0]', type: 3} ], } works just fine. If I want to create another reg or a duplicate of this ; How can I do it in the editor ?

drom commented 1 year ago

no. it is a single diagram editor. but you could create multi-register diagram https://observablehq.com/@drom/risc-v-v-opcodes?collection=@drom/bitfield

lucasbrasilino commented 1 year ago

Hello @drom,

Naive question: how can I render:

https://observablehq.com/@drom/bitfield-testbox?collection=@drom/bitfield#cell-802

using the command line, provided I can run npx bit-field ? Thanks!

drom commented 10 months ago

@lucasbrasilino you can run https://github.com/wavedrom/cli

UTPALBHATT commented 7 months ago

I want to be able to add long fiend name and I am not able to change the size. Is there any option? This is what I have tried so far: {reg: [ {bits: 1, name: 'Field1-LongFieldnametobeadded', type: 1, rotate: -45}, {bits: 7, name: 'Field2', type: 1}, {bits: 4, name: 'Field3', type: 1}, {bits: 1, name: 'Field4', type: 1}, {bits: 3, name: 'Field5', type: 1}, {bits: 4, name: 'Field6', type: 1}, {bits: 4, name: 'Field7', type: 1}, {bits: 4, name: 'Field8', type: 1}, {bits: 1, name: 'Field9', type: 1}, {bits: 3, name: 'Field10', type: 1},

],
config: { bits:32, hflip:true, vflip:false, lanes:4, compact:true, hspace: 9, vspace: 55, margin:{right: 22, bottom:5, left:100, top:20}, label: {right: ['24', '16','8', '0']}, fontsize: 12, trim:false, offset:true, fontfamily: "sans-serif", fontweight: "bold", trim:true } }