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
void selection_sort(int values[], int size) { | |
int i; | |
int j; | |
int min_index; | |
int temp; | |
for (i = 0;i < (size - 1);i++) { | |
min_index = i; | |
for (j = (i + 1);j < size;j++) { | |
if (values[min_index] > values[j]) { |
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
int binary_search(int value, int values[], int left_index, int right_index) { | |
int middle_index = (right_index - left_index) / 2 + left_index; | |
if (left_index > right_index) { | |
return -1; | |
} | |
else if (value < values[middle_index]) { | |
return binary_search(value, values, left_index, middle_index - 1); | |
} | |
else if (value > values[middle_index]) { | |
return binary_search(value, values, middle_index + 1, right_index); |
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
module top( | |
input logic i_clk, | |
input logic i_rst_n, | |
input logic [1:0] i_foo, | |
output logic [1:0] o_bar, | |
output logic [1:0] o_baz | |
); | |
if (1) begin : g_bar | |
function automatic logic [1:0] f(logic [1:0] v); | |
return ~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
class Proc | |
def call_on(context, *args, &block) | |
@__call_on__method__ ||= define_call_on_method | |
@__call_on__method__.bind(context).call(*args, &block) | |
end | |
private | |
def define_call_on_method | |
Module.new.module_exec(self) do |body| |
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
package test_pkg; | |
timeunit 1ns; | |
import uvm_pkg::*; | |
`include "uvm_macros.svh" | |
class inner_sequence extends uvm_sequence; | |
task body(); | |
#(1s); | |
endtask |
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
require 'yaml' | |
src = <<~YAML | |
name: taro | |
age: 4 | |
YAML | |
class Psych::Nodes::Node | |
def mapping_key? | |
@mapping_key |
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
# { foo: 1, bar:2, baz: 3 } になる | |
<<: | |
- { foo: 1, bar: 2 } | |
- baz: 3 |
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
module top ( | |
input [1:0] i_a, | |
input [1:0] i_b, | |
output [1:0] o_c | |
); | |
logic [1:0] c = i_a + i_b; | |
assign o_c = c; | |
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
module top ( | |
input logic [1:0] i_a, | |
input logic [1:0] i_b, | |
output logic [1:0] o_c | |
); | |
function automatic logic [1:0] add(); | |
return i_a + i_b; | |
endfunction | |
always_comb begin |
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
interface foo_types; | |
typedef struct packed { | |
logic foo; | |
} foo_struct; | |
endinterface | |
module sub ( | |
foo_types types, | |
input logic i_clk, | |
input logic i_rst_n, |
OlderNewer