Skip to content

Commit 8de6b0e

Browse files
committed
Update documentation
Signed-off-by: Claire Xenia Wolf <[email protected]>
1 parent 78864c2 commit 8de6b0e

File tree

6 files changed

+40
-6
lines changed

6 files changed

+40
-6
lines changed

COPYING

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
SAG4Fun
1+
SAG4Fun - An Open Source Sheep-And-Goats (SAG) and Inverse SAG Verilog IP
22

33
Copyright (C) 2022 Claire Wolf <[email protected]>
44

README.md

+36-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ mask in the second operand.
77
The file [sag4fun.v](sag4fun.v) provides implementations for 32 and 64 bits:
88

99
| Verilog Module | Description |
10-
| -------------- | -------------------------------------------- |
10+
|:-------------- |:-------------------------------------------- |
1111
| SAG4Fun32C | 32-Bit combinatorial logic |
1212
| SAG4Fun32S | 32-Bit 5-step sequential core |
1313
| SAG4Fun64C | 64-Bit combinatorial logic |
@@ -41,7 +41,7 @@ reversed order.
4141
## Variants without reversed order of "goat" bits
4242

4343
A variant of the Sheep-And-Goats (SAG) instruction that does not reverse the
44-
order of the unmarked data bits in significantly harder to implement in hardware,
44+
order of the unmarked data bits is significantly harder to implement in hardware,
4545
and is thus best emulated using the following sequence of three instructions:
4646

4747
```
@@ -61,3 +61,37 @@ sag rd, rs2, rs2
6161
sag rd, rs1, rd
6262
isg rd, rd, rs2
6363
```
64+
65+
## Verilog Core Interface
66+
67+
The combinatorial cores SAG4Fun32C and SAG4Fun64C have the following interface:
68+
69+
| Port | Description |
70+
|:------------------------- |:------------------------------------- |
71+
| `input ctrl_inv` | Set to 1 for ISG and DEP, 0 otherwise |
72+
| `input ctrl_msk` | Set to 1 for EXT and DEP, 0 otherwise |
73+
| `input [N-1:0] in_data` | The data operand (32 or 64 bits wide) |
74+
| `input [N-1:0] in_mask` | The mask operand (32 or 64 bits wide) |
75+
| `output [N-1:0] out_data` | The result |
76+
77+
The sequential cores have only one data input and provide a "load mask" mode
78+
for loading a new mask. Loading a mask requires the same number of cycles
79+
as processing a data word (5, 6, or 3 cycles for SAG4Fun32S, SAG4Fun64S,
80+
and SAG4Fun64F respectively).
81+
82+
| Port | Description |
83+
|:------------------------- |:----------------------------------------- |
84+
| `input clock` | The (positive edge) clock |
85+
| `input reset` | The (high-active, synchronous) reset |
86+
| `input ctrl_start` | Start a new operation (abort current one) |
87+
| `output ctrl_ready` | Signal that last operation finished |
88+
| `input ctrl_inv` | Set to 1 for ISG and DEP, 0 otherwise |
89+
| `input ctrl_msk` | Set to 1 for EXT and DEP, 0 otherwise |
90+
| `input ctrl_ldm` | Set to 1 for loading a new mask |
91+
| `input [N-1:0] in_data` | The data input (32 or 64 bits wide) |
92+
| `output [N-1:0] out_data` | The result (valid when `ctrl_ready` is 1) |
93+
94+
The control inputs `ctrl_inv` and `ctrl_msk` should be set to 0 in `ctrl_ldm`
95+
mode.
96+
97+
![SAG4Fun Example Waveform](waveform.png)

algorithm.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python3
22
#
3-
# SAG4Fun
3+
# SAG4Fun - An Open Source Sheep-And-Goats (SAG) and Inverse SAG Verilog IP
44
#
55
# Copyright (C) 2022 Claire Wolf <[email protected]>
66
#

sag4fun.v

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// SAG4Fun
2+
// SAG4Fun - An Open Source Sheep-And-Goats (SAG) and Inverse SAG Verilog IP
33
//
44
// Copyright (C) 2022 Claire Wolf <[email protected]>
55
//

testbench.v

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// SAG4Fun
2+
// SAG4Fun - An Open Source Sheep-And-Goats (SAG) and Inverse SAG Verilog IP
33
//
44
// Copyright (C) 2022 Claire Wolf <[email protected]>
55
//

waveform.png

21.9 KB
Loading

0 commit comments

Comments
 (0)