Skip to content

Commit

Permalink
Merge pull request #11 from PAICookers/dev
Browse files Browse the repository at this point in the history
🔖 v0.0.12
  • Loading branch information
KafCoppelia authored Apr 19, 2023
2 parents e60ce40 + f14383b commit b2fad4c
Show file tree
Hide file tree
Showing 7 changed files with 137 additions and 124 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
steps:
- uses: actions/checkout@v3
with:
ref: master
ref: main

- name: Setup Poetry
uses: Gr1N/setup-poetry@v8
Expand Down
62 changes: 29 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

## 📦 版本

[v0.0.11 Prerelease](https://github.com/PAICookers/PAITest/releases/tag/v0.0.11)
[v0.0.12 Prerelease](https://github.com/PAICookers/PAITest/releases/tag/v0.0.12)

## 🛠️ 使用生成

Expand All @@ -22,50 +22,46 @@
# Define the direction of test chip
PAITestManager = paitest("EAST")
```
2. `Get1GroupForNCoresWithNParams`,产生一组针对 `N` 个核的配置-测试帧,每个核配置不同参数。可以指定单个需要**屏蔽**的核坐标。`verbose=True` 以开启日志显示,默认关闭。

2. `Get1GroupForNCoresWithNParams`,产生一组针对 `N` 个核的配置-测试帧,每个核配置不同参数。可以指定单个需要**屏蔽**的核坐标

```python
groups = 10 # Generate 10 groups
save_to_dir="./test" # Save frames into ./test directory

# Generate configuration frames, testin & testout frames
cf, ti, to = PAITestManager.Get1GroupForNCoresWithNParams(groups, save_dir=save_to_dir)
```python
groups = 10 # Generate 10 groups
save_to_dir="./test" # Save frames into ./test directory

# Mask a cord coordinate so that avoid generating the same coordinate.
cf, ti, to = PAITestManager.Get1GroupForNCoresWithNParams(groups,
save_dir=save_to_dir, masked_core_coord=(12, 16))
```
# Generate configuration frames, testin & testout frames
cf, ti, to = PAITestManager.Get1GroupForNCoresWithNParams(groups, save_dir=save_to_dir)

# Mask a cord coordinate so that avoid generating the same coordinate.
# And enable verbose logging
cf, ti, to = PAITestManager.Get1GroupForNCoresWithNParams(groups,
save_dir=save_to_dir, masked_core_coord=(12, 16), verbose=True)
```
3. `Get1GroupForNCoresWith1Param`,产生1组针对 `N` 个核的配置-测试帧,每个核配置相同参数。可以指定单个需要**屏蔽**的核坐标

```python
# Same as Get1GroupForNCoresWithNParams
cf, ti, to = PAITestManager.Get1GroupForNCoresWith1Param(10, save_dir="./test")
```

```python
# Same as Get1GroupForNCoresWithNParams
cf, ti, to = PAITestManager.Get1GroupForNCoresWith1Param(10, save_dir="./test")
```
4. `GetNGroupsFor1CoreWithNParams`,产生 `N` 组针对1个核的配置-测试帧,每个核配置不同参数。可以指定单个需要**屏蔽**的核坐标

```python
# Same as Get1GroupForNCoresWithNParams
cf, ti, to = PAITestManager.GetNGroupsFor1CoreWithNParams(1, save_dir="./test")
```

```python
# Same as Get1GroupForNCoresWithNParams
cf, ti, to = PAITestManager.GetNGroupsFor1CoreWithNParams(1, save_dir="./test")
```
5. `ReplaceCoreCoord`,替换单个或**一组**帧中的 `CORE_ADDR` 为指定坐标。

```python
# Replaced core coordinate with (9, 9)
replaced = PAITestManager.ReplaceCoreCoord(original_frames, (9, 9))
```

⚠️ 一组指一组完整的配置帧,包含3帧。对于测试输入帧,即为单帧。
```python
# Replaced core coordinate with (9, 9)
replaced = PAITestManager.ReplaceCoreCoord(original_frames, (9, 9))
```

⚠️ 一组指一组完整的配置帧,包含3帧。对于测试输入帧,即为单帧。
6. `SaveFrames`,保存帧数据至 `.bin` 文件

```python
# Save into ./test/config.bin
PAITestManager.SaveFrames("./test/config.bin", replaced)
```
```python
# Save into ./test/config.bin
PAITestManager.SaveFrames("./test/config.bin", replaced)
```

## 🗓️ TODO

Expand Down
4 changes: 2 additions & 2 deletions example.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

# 1. Generate 1 group for N cores with N parameters reg.
a_cf, a_ti, a_to = PAITestManager.Get1GroupForNCoresWithNParams(
3, save_dir="./test"
3, save_dir="./test", verbose=True
)
print(a_cf, a_ti, a_to)

Expand All @@ -37,7 +37,7 @@
# Then, decode the replaced frames to check whether the replacement is OK
decoder = FrameDecoder()
attr = decoder.decode(a_cf_replaced)

replaced_coord = attr.get("core_coord")
if replaced_coord == (9, 9):
print("Replacement OK")
11 changes: 5 additions & 6 deletions paitest/frames/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,8 @@ def GenConfigGroup(
core_coord: Coord,
core_star_coord: Coord,
test_chip_coord: Coord,
) -> List[int]:
) -> Tuple[int, ...]:
ConfigFrameGroup: List[int] = []

param_reg = FrameGen._GenParamReg(test_chip_coord)

for i in range(3):
Expand All @@ -91,7 +90,7 @@ def GenConfigGroup(
)
)

return ConfigFrameGroup
return tuple(ConfigFrameGroup)

@staticmethod
def _GenParamReg(
Expand All @@ -109,7 +108,7 @@ def _GenParamReg(
tick_wait_end: Optional[int] = None,
snn_en: Optional[bool] = None,
target_lcn: Optional[int] = None,
) -> List[int]:
) -> Tuple[int, ...]:
high3, low7 = test_chip_coord_split(test_chip_coord)

param_reg: List[int] = []
Expand All @@ -128,7 +127,7 @@ def _GenParamReg(
else:
pass

return param_reg
return tuple(param_reg)

"""Functions of Test Frames Generation"""

Expand Down Expand Up @@ -190,7 +189,7 @@ def GenTest2OutFrame(
class FrameDecoder:
"""Frame decoder"""

def __init__(self):
def __init__(self) -> None:
self.groups_len: int
self._frame: int
self._frames_group: Tuple[int, ...]
Expand Down
Loading

0 comments on commit b2fad4c

Please sign in to comment.