Merge pull request #138 from awygle/lm4k_icepack

LM4K support in icepack and icecube.sh
This commit is contained in:
Clifford Wolf 2018-05-12 21:15:22 +02:00 committed by GitHub
commit 3c6a4dc517
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 68 additions and 1 deletions

View File

@ -56,6 +56,11 @@ if [ "$1" == "-up5k" ]; then
shift
fi
if [ "$1" == "-lm4k" ]; then
ICEDEV=lm4k-cm49
shift
fi
set -ex
set -- ${1%.v}
icecubedir="${ICECUBEDIR:-/opt/lscc/iCEcube2.2015.08}"
@ -187,6 +192,42 @@ case "${ICEDEV:-hx1k-tq144}" in
iCEPACKAGE="UWG30"
iCE40DEV="iCE40UP5K"
;;
lm4k-cm49)
iCEPACKAGE="CM49"
iCE40DEV="iCE40LM4K"
;;
lm4k-cm36)
iCEPACKAGE="CM36"
iCE40DEV="iCE40LM4K"
;;
lm4k-swg25tr)
iCEPACKAGE="SWG25TR"
iCE40DEV="iCE40LM4K"
;;
lm2k-cm49)
iCEPACKAGE="CM49"
iCE40DEV="iCE40LM2K"
;;
lm2k-cm36)
iCEPACKAGE="CM36"
iCE40DEV="iCE40LM2K"
;;
lm2k-swg25tr)
iCEPACKAGE="SWG25TR"
iCE40DEV="iCE40LM2K"
;;
lm1k-cm49)
iCEPACKAGE="CM49"
iCE40DEV="iCE40LM1K"
;;
lm1k-cm36)
iCEPACKAGE="CM36"
iCE40DEV="iCE40LM1K"
;;
lm1k-swg25tr)
iCEPACKAGE="SWG25TR"
iCE40DEV="iCE40LM1K"
;;
*)
echo "ERROR: Invalid \$ICEDEV device config '$ICEDEV'."
exit 1
@ -238,6 +279,21 @@ case "$iCE40DEV" in
libfile="ice40UP5K.lib"
devfile="ICE40T05.dev"
;;
iCE40LM1K)
icetech="SBTiCE40LM"
libfile="ice40LM4K.lib"
devfile="ICE40R04.dev"
;;
iCE40LM2K)
icetech="SBTiCE40LM"
libfile="ice40LM4K.lib"
devfile="ICE40R04.dev"
;;
iCE40LM4K)
icetech="SBTiCE40LM"
libfile="ice40LM4K.lib"
devfile="ICE40R04.dev"
;;
esac
(

View File

@ -420,6 +420,8 @@ void FpgaConfig::read_bits(std::istream &ifs)
this->device = "5k";
else if (this->cram_width == 692 && this->cram_height == 176)
this->device = "u4k";
else if (this->cram_width == 656 && this->cram_height == 176)
this->device = "lm4k";
else
error("Failed to detect chip type.\n");
@ -692,6 +694,12 @@ void FpgaConfig::read_ascii(std::istream &ifs, bool nosleep)
this->cram_height = 176;
this->bram_width = 80;
this->bram_height = 2 * 128;
} else
if (this->device == "lm4k") {
this->cram_width = 656;
this->cram_height = 176;
this->bram_width = 80;
this->bram_height = 2 * 128;
} else
error("Unsupported chip type '%s'.\n", this->device.c_str());
@ -1048,6 +1056,7 @@ int FpgaConfig::chip_width() const
if (this->device == "1k") return 12;
if (this->device == "5k") return 24;
if (this->device == "u4k") return 24;
if (this->device == "lm4k") return 24;
if (this->device == "8k") return 32;
panic("Unknown chip type '%s'.\n", this->device.c_str());
}
@ -1058,6 +1067,7 @@ int FpgaConfig::chip_height() const
if (this->device == "1k") return 16;
if (this->device == "5k") return 30;
if (this->device == "u4k") return 20;
if (this->device == "lm4k") return 20;
if (this->device == "8k") return 32;
panic("Unknown chip type '%s'.\n", this->device.c_str());
}
@ -1067,6 +1077,7 @@ vector<int> FpgaConfig::chip_cols() const
if (this->device == "384") return vector<int>({18, 54, 54, 54, 54});
if (this->device == "1k") return vector<int>({18, 54, 54, 42, 54, 54, 54});
if (this->device == "u4k") return vector<int>({54, 54, 54, 54, 54, 54, 42, 54, 54, 54, 54, 54, 54});
if (this->device == "lm4k") return vector<int>({18, 54, 54, 54, 54, 54, 42, 54, 54, 54, 54, 54, 54});
// Its IPConnect or Mutiplier block, five logic, ram, six logic.
if (this->device == "5k") return vector<int>({54, 54, 54, 54, 54, 54, 42, 54, 54, 54, 54, 54, 54});
if (this->device == "8k") return vector<int>({18, 54, 54, 54, 54, 54, 54, 54, 42, 54, 54, 54, 54, 54, 54, 54, 54});
@ -1110,7 +1121,7 @@ string FpgaConfig::tile_type(int x, int y) const
return "logic";
}
if (this->device == "5k" || this->device == "u4k") {
if (this->device == "5k" || this->device == "u4k" || this->device == "lm4k") {
if (x == 6 || x == 19) return y % 2 == 1 ? "ramb" : "ramt";
return "logic";
}