Skip to content

Commit

Permalink
Fix the ALU unpack
Browse files Browse the repository at this point in the history
Interpret "11110000000000000000" as an alternative ADD code. Works only
in unpack --- you can't generate such a code.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
  • Loading branch information
yrabbit committed Apr 3, 2022
1 parent 1f56d19 commit 8add147
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion apycula/chipdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ def fse_luts(fse, ttyp):
# ADDSUB INIT="0110 0000 1001 1010"
# add 0 sub carry
add_alu_mode(mode, bel.modes, lut, "2", "0110000010011010")
add_alu_mode(mode, bel.modes, lut, "hadder", "1111000000000000")
# NE INIT="1001 0000 1001 1111"
# add 0 sub carry
add_alu_mode(mode, bel.modes, lut, "3", "1001000010011111")
Expand Down Expand Up @@ -283,7 +284,7 @@ def fse_osc(device, fse, ttyp):

if device == 'GW1NS-2':
bel.portmap['OSCEN'] = "B3"
elif device == 'GW1NS-4':
elif device == 'GW1NS-4':
bel.portmap['OSCEN'] = "D6"
elif device == 'GW1NZ-1':
bel.portmap['OSCEN'] = "A6"
Expand Down
2 changes: 2 additions & 0 deletions apycula/gowin_unpack.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,8 @@ def tile2verilog(dbrow, dbcol, bels, pips, clock_pips, mod, cst, db):
kind, = flags # ALU only have one flag
idx = int(idx)
name = f"R{row}C{col}_ALU_{idx}"
if kind == 'hadder':
kind = '0'
if kind in "012346789": # main ALU
alu = codegen.Primitive("ALU", name)
alu.params["ALU_MODE"] = kind
Expand Down

0 comments on commit 8add147

Please sign in to comment.