google / google/xls

Support sign_ext in std.x

Open
#857 1 comment 0 reactions 0 assignees View on GitHub
dslx enhancement
Dominant language
C++
Stars
1.9k
Forks
283
Avg merge
2d 10h
Merged PRs (30d)
135

Description

Sign extending a value from one width to another is more annoying than it should be. Cases which are particularly annoying are if the to/from type are not signed and when the to/from types are typedefs. For example:

```
type x_t = u8
type y_t = u16

let x = x_t:0xf;
let signext_x = (x as s8) as s16;
```

It'd be nice to be able to simply do:

```
std::sign_ext(x, y_t:0)
```

Or if we supported types as parametric parameters:

```
std::sign_ext(x)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.