mirror of
https://github.com/vortexgpgpu/vortex.git
synced 2025-04-23 21:39:10 -04:00
minor update
This commit is contained in:
parent
3d19588e57
commit
160ff94a22
2 changed files with 41 additions and 0 deletions
20
hw/rtl/libs/VX_bits_insert.v
Normal file
20
hw/rtl/libs/VX_bits_insert.v
Normal file
|
@ -0,0 +1,20 @@
|
|||
`include "VX_platform.vh"
|
||||
|
||||
module VX_bits_insert #(
|
||||
parameter N = 1,
|
||||
parameter S = 1,
|
||||
parameter POS = 0
|
||||
) (
|
||||
input wire [N-1:0] data_in,
|
||||
input wire [S-1:0] sel_in,
|
||||
output wire [N+S-1:0] data_out
|
||||
);
|
||||
if (POS == 0) begin
|
||||
assign data_out = {data_in, sel_in};
|
||||
end else if (POS == N) begin
|
||||
assign data_out = {sel_in, data_in};
|
||||
end else begin
|
||||
assign data_out = {data_in[N-1:POS], sel_in, data_in[POS-1:0]};
|
||||
end
|
||||
|
||||
endmodule
|
21
hw/rtl/libs/VX_bits_remove.v
Normal file
21
hw/rtl/libs/VX_bits_remove.v
Normal file
|
@ -0,0 +1,21 @@
|
|||
`include "VX_platform.vh"
|
||||
|
||||
module VX_bits_remove #(
|
||||
parameter N = 1,
|
||||
parameter S = 1,
|
||||
parameter POS = 0
|
||||
) (
|
||||
input wire [N-1:0] data_in,
|
||||
output wire [N-S-1:0] data_out
|
||||
);
|
||||
`UNUSED_VAR (data_in)
|
||||
|
||||
if (POS == 0) begin
|
||||
assign data_out = data_in[N-1:S];
|
||||
end else if (POS == N) begin
|
||||
assign data_out = data_in[N-S-1:0];
|
||||
end else begin
|
||||
assign data_out = {data_in[N-1:(POS+S)], data_in[POS-1:0]};
|
||||
end
|
||||
|
||||
endmodule
|
Loading…
Add table
Add a link
Reference in a new issue