-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #413 from os-fpga/library
updated design library rtl
- Loading branch information
Showing
13 changed files
with
98 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 19 additions & 26 deletions
45
random_test_generator_v1/Design_Library/invertion/rtl/invertion.v
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,26 @@ | ||
module invertion | ||
#(parameter WIDTH=32) | ||
( | ||
input clk, | ||
input rst, | ||
input [WIDTH-1:0] data_in, | ||
output [WIDTH-1:0] data_out); | ||
module invertion #(parameter WIDTH = 32)( | ||
input wire clk, | ||
input wire rst, | ||
input wire [WIDTH-1:0] data_in, | ||
output reg [WIDTH-1:0] data_out | ||
); | ||
|
||
reg [7:0] data_out_reg; | ||
wire [7:0] data_out_wire; | ||
wire [7:0] bitwise_not_and_or; | ||
wire [7:0] bitwise_xor; | ||
wire [15:0] conditional_invert; | ||
|
||
assign data_out_wire[7:0] = ((~data_in[7:0]) | (~data_in[15:8])); | ||
assign bitwise_not_and_or = (~data_in[7:0]) | (~data_in[15:8]); | ||
|
||
always@(posedge clk) | ||
begin | ||
if (rst) | ||
begin | ||
data_out_reg[7:0]<=0; | ||
end | ||
else | ||
begin | ||
data_out_reg[7:0]<= data_in[31:24] ^ data_in[23:16]; | ||
assign bitwise_xor = data_in[31:24] ^ data_in[23:16]; | ||
|
||
end | ||
end | ||
|
||
assign data_out[31:16] = (data_in[31:16] == data_in[15:0])? ~data_in[15:0]: ^data_in[31:16]; | ||
|
||
assign data_out[15:0] = {data_out_reg,data_out_wire}; | ||
assign conditional_invert = (data_in[31:16] == data_in[15:0]) ? data_in[15:0] : ~data_in[31:16]; | ||
|
||
always @(posedge clk or posedge rst) begin | ||
if (rst) begin | ||
data_out <= 0; | ||
end else begin | ||
data_out <= {conditional_invert, bitwise_xor, bitwise_not_and_or}; | ||
end | ||
end | ||
|
||
endmodule | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 42 additions & 36 deletions
78
random_test_generator_v1/Design_Library/large_mux/rtl/large_mux.v
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,48 @@ | ||
module large_mux | ||
#(parameter WIDTH=32) | ||
( | ||
input clk, | ||
input rst, | ||
input [WIDTH-1:0] data_in, | ||
output reg [WIDTH-1:0] data_out); | ||
|
||
//reg [WIDTH-1:0] data_out = 32'd0; | ||
|
||
always@(data_in) begin | ||
casex(data_in) | ||
32'hxxxxxxx0:data_out[31:0] = {24'b0,data_in[7:0]}; | ||
32'hxxxxxxx1:data_out[31:0] = {16'b0,data_in[15:8],8'b0}; | ||
32'hxxxxxxx2:data_out[31:0] = {8'b0,data_in[23:16],16'b0}; | ||
32'hxxxxxxx3:data_out[31:0] = {data_in[31:24],24'b0}; | ||
|
||
32'hxxxxxx0x:data_out[31:0] = {16'b0,data_in[15:8],8'b0}; | ||
32'hxxxxxx1x:data_out[31:0] = {8'b0,data_in[23:16],16'b0}; | ||
32'hxxxxxx2x:data_out[31:0] = {data_in[31:24],24'b0}; | ||
32'hxxxxxx3x:data_out[31:0] = {24'b0,data_in[7:0]}; | ||
|
||
32'hxxxxx0xx:data_out[31:0] = {8'b0,data_in[23:16],16'b0}; | ||
32'hxxxxx1xx:data_out[31:0] = {data_in[31:24],24'b0}; | ||
32'hxxxxx2xx:data_out[31:0] = {24'b0,data_in[7:0]}; | ||
32'hxxxxx3xx:data_out[31:0] = {16'b0,data_in[15:8],8'b0}; | ||
|
||
32'hxxxx0xxx:data_out[31:0] = {data_in[31:24],24'b0}; | ||
32'hxxxx1xxx:data_out[31:0] = {24'b0,data_in[7:0]}; | ||
32'hxxxx2xxx:data_out[31:0] = {16'b0,data_in[15:8],8'b0}; | ||
32'hxxxx3xxx:data_out[31:0] = {8'b0,data_in[23:16],16'b0}; | ||
|
||
default: data_out[31:0]= 32'd0; | ||
endcase | ||
input clk, | ||
input rst, | ||
input [WIDTH-1:0] data_in, | ||
output reg [WIDTH-1:0] data_out | ||
); | ||
reg [WIDTH-1:0] data_out_reg; | ||
|
||
// Output logic: either reset or update data_out from data_out | ||
always @(posedge clk or posedge rst) begin | ||
if (rst) | ||
data_out_reg <= 0; | ||
else | ||
case(data_in[3:0]) // Focus on the lower 4 bits | ||
4'b0000: data_out_reg <= {24'b0, data_in[7:0]}; | ||
4'b0001: data_out_reg <= {16'b0, data_in[15:8], 8'b0}; | ||
4'b0010: data_out_reg <= {8'b0, data_in[23:16], 16'b0}; | ||
4'b0011: data_out_reg <= {data_in[31:24], 24'b0}; | ||
|
||
4'b0100: data_out_reg <= {16'b0, data_in[15:8], 8'b0}; | ||
4'b0101: data_out_reg <= {8'b0, data_in[23:16], 16'b0}; | ||
4'b0110: data_out_reg <= {data_in[31:24], 24'b0}; | ||
4'b0111: data_out_reg <= {24'b0, data_in[7:0]}; | ||
|
||
4'b1000: data_out_reg <= {8'b0, data_in[23:16], 16'b0}; | ||
4'b1001: data_out_reg <= {data_in[31:24], 24'b0}; | ||
4'b1010: data_out_reg <= {24'b0, data_in[7:0]}; | ||
4'b1011: data_out_reg <= {16'b0, data_in[15:8], 8'b0}; | ||
|
||
4'b1100: data_out_reg <= {data_in[31:24], 24'b0}; | ||
4'b1101: data_out_reg <= {24'b0, data_in[7:0]}; | ||
4'b1110: data_out_reg <= {16'b0, data_in[15:8], 8'b0}; | ||
4'b1111: data_out_reg <= {8'b0, data_in[23:16], 16'b0}; | ||
|
||
default: data_out_reg <= 32'd0; | ||
endcase | ||
end | ||
endmodule | ||
|
||
|
||
|
||
|
||
|
||
always @(posedge clk or posedge rst) begin | ||
if (rst) | ||
data_out <= 0; | ||
else | ||
data_out <= data_out_reg; | ||
end | ||
|
||
endmodule |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters