text
stringlengths
59
71.4k
// synthesis translate_off `timescale 1ns / 1ps // synthesis translate_on // synthesis verilog_input_version verilog_2001 // turn off superfluous verilog processor warnings // altera message_level Level1 // altera message_off 10034 10035 10036 10037 10230 10240 10030 //--------------------------------------------------...
#include <bits/stdc++.h> using namespace std; string a, b; bool ok(string s) { if (s == ) return false; if (s.length() == 1 && s[0] == 0 ) return true; if (s[0] == 0 ) return false; for (char c : s) { if (c < 0 || c > 9 ) return false; } return true; } void cal(string s) {...
#include <bits/stdc++.h> using namespace std; long long fast_pow(long long a, long long p) { long long res = 1; while (p) { if (p % 2 == 0) { a = a * 1LL * a % 1000000007; p /= 2; } else { res = res * 1LL * a % 1000000007; p--; } } return res; } ...
#include <bits/stdc++.h> #pragma warning(disable : 4996) using namespace std; int IT_MAX = 1 << 17; const long long MOD = 5000000; const int INF = 1034567891; const long long LL_INF = 1234567890123456789ll; const double PI = 3.141592653589793238; const double ERR = 1E-11; int in[200050]; int lr[2000...
#include <bits/stdc++.h> using namespace std; int cnt[1000010] = {}; void pre() { for (int i = 1; i < 1000010; i++) { for (int j = i; j < 1000010; j += i) { cnt[j]++; } } } long long int tree[2 * 1000010]; int n; void build() { for (int i = n - 1; i > 0; i--) { tree[i...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 10; int n, m; vector<string> v(maxn); int func(int x, vector<vector<int>> &s) { vector<vector<int>> t(n + 3, vector<int>(m + 3, 0)); int i, j; for (i = 1; i <= n - 2 * x; i++) { for (j = 1; j <= m - 2 * x; j++) if (...
// (C) 2001-2015 Altera Corporation. All rights reserved. // Your use of Altera Corporation's design tools, logic functions and other // software and tools, and its AMPP partner logic functions, and any output // files any of the foregoing (including device programming or simulation // files), and any associated doc...
#include <bits/stdc++.h> using namespace std; string s, t; double ans; double solve(string s) { int a = 0, b = 0, c = 0, p = 0; for (int i = 0; i < s.size(); i++) { char e = (b % 2) ? R : L ; if (s[i] == X ) b++; else if (s[i] == e) a++, b++, p = 0; else ...
#include <bits/stdc++.h> #include <algorithm> using namespace std; #define int long long #define ll long long #define rep(i,a,b) for (int i = a; i < b; ++i) #define mod 1000000007 #define F first #define S second #define printer(v) for(auto f: v) cout<<f<< #define pb push_back #define mp ma...
#include <bits/stdc++.h> using namespace std; const int kN = 100 + 1; const int kA = 256; bool dp[kN][kN][kA]; bool used[kN][kN][kA]; vector<pair<int, int> > g[kN]; bool Dp(int u, int v, int mark) { if (!used[u][v][mark]) { used[u][v][mark] = true; dp[u][v][mark] = false; for (const ...
// DESCRIPTION: Verilator: Verilog Test module // // Copyright 2010 by Wilson Snyder. This program is free software; you can // redistribute it and/or modify it under the terms of either the GNU // Lesser General Public License Version 3 or the Perl Artistic License // Version 2.0. // SPDX-License-Identifier: LGPL-3.0-...
// Copyright 2020-2022 F4PGA Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; int main() { long long int n, x, rev; cin >> n; while (n % 10 == 0) n = n / 10; rev = 0; x = n; while (x > 0) { rev = rev * 10 + x % 10; x = x / 10; } if (rev == n) cout << YES ; else cout << NO ; }
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; ++i) cin >> a[i]; multiset<int> s; for (int v : a) s.insert(v); int ans = 0; for (int i = 0; i < n; ++i) { ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 2016/05/24 16:47:01 // Design Name: // Module Name: _32bit_adder_tb // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: // ...
// *************************************************************************** // *************************************************************************** // Copyright 2013(c) Analog Devices, Inc. // // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // a...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef string str; #define pb push_back #define ppp pop_back #define pii pair<int,int> #define fi first #define se second #define stie std::tie #define vec vector #define forn(i, l, r) for (int i=l; i...
#include <bits/stdc++.h> using namespace std; const int maxlongint = 2147483647; const int P1 = 19260817, P2 = 1000000007, N = 100011, M = 1000011; long long mi1[M], mi2[M], ni1[M], ni2[M], s1[M], s2[M]; char st[M], Ans[M]; long long powder(int x, int a, const int& P) { if (!a) return 1; long long t...
#include <bits/stdc++.h> using namespace std; void fast() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); } int main() { int n, c = 0; char x; vector<pair<int, int> > v; cin >> n; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { cin >> x; if (...
// Copyright 1986-2014 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2014.1 (lin64) Build 881834 Fri Apr 4 14:00:25 MDT 2014 // Date : Fri May 9 13:48:22 2014 // Host : macbook running 64-bit Arch Linux // ...
// file: main_pll.v // // (c) Copyright 2008 - 2011 Xilinx, Inc. All rights reserved. // // This file contains confidential and proprietary information // of Xilinx, Inc. and is protected under U.S. and // international copyright and other intellectual property // laws. // // DISCLAIMER // This disclaimer is not a l...
////////////////////////////////////////////////////////////////////// //// //// //// uart_wb.v //// //// //// //// ...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int L[n]; for (int i = 0; i < n; ++i) scanf( %d , &L[i]); int imos[n + 1]; fill(imos, imos + n + 1, 0); for (int i = 0; i < n; ++i) { L[i] = min(L[i], i); ++imos[i - L[i]]; --imos[i]; } ...
#include <bits/stdc++.h> using namespace std; bool tu[305][305]; long long pri[305]; int d[305]; int n, m, t; int bg[1100000]; int top[110000]; int main() { scanf( %d%d%d , &n, &m, &t); for (int i = 1; i <= n; i++) scanf( %I64d , &pri[i]); for (int i = 1; i <= m; i++) { int b, c; ...
#include <bits/stdc++.h> inline int two(int n) { return 1 << n; } inline int test(int n, int b) { return (n >> b) & 1; } inline void set_bit(int& n, int b) { n |= two(b); } inline void unset_bit(int& n, int b) { n &= ~two(b); } inline int last_bit(int n) { return n & (-n); } inline int ones(int n) { int...
#include <bits/stdc++.h> using namespace std; template <class TH> void _dbg(const char *sdbg, TH h) { cout << sdbg << = << h << endl; } template <class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) { while (*sdbg != , ) cout << *sdbg++; cout << = << h << , ; _dbg(sdb...
#include <bits/stdc++.h> using namespace std; long long int fastExpo(long long int a, long long int n, long long int mod) { long long int result = 1; while (n > 0) { if (n & 1) result = (result * a) % mod; a = (a * a) % mod; n >>= 1; } return result; } long long int modInverse(...
module RegisterFile(input [31:0] in,Pcin,input [19:0] RSLCT,input Clk, RESET, LOADPC, LOAD,IR_CU, output [31:0] Rn,Rm,Rs,PCout); wire [31:0] Q[15:0]; //Rd wire [15:0] DecoderRd; // signal outputs of decoder //Decoder4x16(input [3:0] IN,output reg [15:0] OUT) Decoder4x16 DRd(.IN(RSLCT[15:12]),.OUT(DecoderRd)); //Decod...
`timescale 1ns / 1ps //`define CHIPSCOPE /*********************************************************************** This file is part of the OpenADC Project. See www.newae.com for more details, or the codebase at http://www.assembla.com/spaces/openadc . This file is the Partial Reconfiguration (using ICAP) interface. ...
#include <bits/stdc++.h> using namespace std; int dx[] = {0, 1, 0, -1}; int dy[] = {1, 0, -1, 0}; int dp[1005][1005]; bool vis[1005][1005]; int sx, sy, x, y; vector<string> v; bool valid(int xx, int yy) { if (xx >= 0 && yy >= 0 && xx < x && yy < y && v[xx][yy] != * ) return 1; return 0; } i...
#include <bits/stdc++.h> int loya[8]; int tloyal[8]; int level[8]; double pb[1 << 8]; int N, K, A; void init_search(int state, int B, int deepth, int cnt) { if (deepth == N) { pb[state] = cnt > (N >> 1) ? 1.0 : A / (double)(A + B); } else { init_search(state | (1 << deepth), B, deepth + ...
// megafunction wizard: %ROM: 1-PORT%VBB% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: bg.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // =================================...
/** * $Id: red_pitaya_pid_block.v -01-21 11:40:39Z matej.oblak $ * * @brief Red Pitaya PID controller. * * @Author Matej Oblak * * (c) Red Pitaya http://www.redpitaya.com * * This part of code is written in Verilog hardware description language (HDL). * Please visit http://en.wikipedia.org/wiki/Verilog * fo...
#include <bits/stdc++.h> using namespace std; int main() { int n, v; cin >> n >> v; vector<vector<int> > mat(n + 1, vector<int>(v + 1, INT_MAX)); for (int i = 1, j = 0; j <= v; j++) { mat[i][j] = j; } for (int i = 2; i <= n; i++) { for (int j = 0; j <= v; j++) { if (j < v...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
#include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; const long long infll = 0x3f3f3f3f3f3f3f3fLL; inline long long read() { long long x = 0, f = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } while (ch >= 0 ...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; int k; cin >> n >> k; int octr = 0; int a[n]; int sum = 0; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] % 2 != 0) octr++; sum = sum + ...
#include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; const int maxn = 115 + 5; char s[maxn][maxn]; int main() { int n, m; while (~scanf( %d%d , &n, &m)) { int mini = inf, maxi = 0, minj = inf, maxj = 0; getchar(); for (int i = 1; i <= n; i++) { for (int j...
#include <bits/stdc++.h> using namespace std; int get() { int x = 0, f = 1; char c = getchar(); while (!isdigit(c)) { if (c == - ) f = -1; c = getchar(); } while (isdigit(c)) { x = x * 10 + c - 0 ; c = getchar(); } return x * f; } const int N = 1e6 + 5, Base...
// // fixed for 9.1 jan 21 2010 cruben // `include "timescale.v" `include "i2c_master_defines.v" module i2c_opencores ( wb_clk_i, wb_rst_i, wb_adr_i, wb_dat_i, wb_dat_o, wb_we_i, wb_stb_i, /*wb_cyc_i,*/ wb_ack_o, wb_inta_o, sda_pad_in, sda_pad_out , sda_pad_en, scl_pad_in, scl_pad_out, scl_pad_en ); // Common bus...
`include "macro.v" module if_id_buffer( input wire clock, input wire reset, input wire[`SIGNAL_BUS] stall, input wire[`INST_ADDR_BUS] if_program_counter, input wire[`INST_DATA_BUS] if_instruction, output reg[`IN...
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2014 Francis Bruno, All Rights Reserved // // This program is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by the Free // Software...
/* * File: lsu_reg2mem.v * Project: pippo * Designer: kiss@pwrsemi * Mainteiner: kiss@pwrsemi * Checker: * Description: * */ // synopsys translate_off `include "timescale.v" // synopsys translate_on `include "def_pippo.v" module lsu_reg2mem(addr, lsu_op, regdata, memdata); parameter w...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; int T, n, a, b, c; string s; int shi, bu, jian; int main() { cin >> T; while (T--) { shi = bu = jian = 0; cin >> n; cin >> a >> b >> c; cin >> s; for (int i = 0; i < s.length(); i++) { if (s[i...
// Copyright 1986-2017 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2017.2 (win64) Build Thu Jun 15 18:39:09 MDT 2017 // Date : Tue Sep 19 09:38:22 2017 // Host : DarkCube running 64-bit major release ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ii = pair<int, int>; using i3 = pair<int, ii>; using li = pair<ll, int>; using lii = pair<ll, ii>; using pll = pair<ll, ll>; using vi = vector<int>; using vl = vector<ll>; using vii = vector<ii>; using vli = vector<li>; us...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; const int oo = 0x3f3f3f3f; const double eps = 1e-9; string words[100005]; int type[100005]; int gender[100005]; void reverse(string &c) { for (int i = (0); i < (int((c).size()) / 2); i++) { char tmp = c[i]; c[i] = c[int((c).size()) - i - 1]; ...
#include <bits/stdc++.h> using namespace std; unsigned long long hs[1050], hL[1 << 15], bs[50]; int main() { mt19937_64 rnd(time(0)); srand(time(0)); int n, s, d; scanf( %d%d%d , &n, &s, &d); for (int i = 0; i < 1050; i++) hs[i] = rnd(); random_shuffle(hs, hs + 1050); for (int i = 0; i...
// // Copyright (c) 1999 Steven Wilson () // // This source code is free software; you can redistribute it // and/or modify it in source code form under the terms of the GNU // General Public License as published by the Free Software // Foundation; either version 2 of the License, or (at your option) // ...
#include <bits/stdc++.h> using namespace std; const long long INF = 1e18; const int N = 1000 + 10; int n, l, k; double dp[202][202][404]; double pro[300]; int a[N]; double solve(int i, int sofar, int cap) { if (i == n + 1) { return sofar >= l && cap >= 0; } double &ret = dp[i][sofar][c...
#include <bits/stdc++.h> using namespace std; template <typename Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << : << arg1 << std::endl; } template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args) { const char* comma = strchr(names + 1, ...
// *************************************************************************** // *************************************************************************** // Copyright 2011(c) Analog Devices, Inc. // // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // a...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; long long mx, mi; int t, head[N], len, k, vis[N]; struct edge { int v, w, next; } e[N * 2]; void add(int u, int v, int w) { e[len].v = v; e[len].w = w; e[len].next = head[u]; head[u] = len++; } void dfs(int u, int...
#include <bits/stdc++.h> using namespace std; const int dx[8] = {-1, -1, -1, 0, 0, 1, 1, 1}; const int dy[8] = {-1, 0, 1, -1, 1, -1, 0, 1}; int t, ans, n, m; int a[256][256], u[256][256]; char c; void work(int x, int y) { int tx, ty; u[x][y] = 1; for (int i = 0; i <= 7; i++) { tx = x + d...
#include <bits/stdc++.h> using namespace std; double l[10], b[10]; vector<int> kk(10, -1); vector<vector<int> > v; int k, n; void abc(int i, int sum) { if (i == 0 && sum == 0) { v.push_back(kk); return; } if (i == 0) { return; } for (int j = 0; j <= k; j++) { if (...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
// // TV80 8-Bit Microprocessor Core // Based on the VHDL T80 core by Daniel Wallner () // // Copyright (c) 2004 Guy Hutchison () // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), // to deal in the Software witho...
#include <bits/stdc++.h> using namespace std; signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); long long t; cin >> t; while (t--) { long long n, l, r; cin >> n >> l >> r; vector<long long> lol = {0}; for (long long i = n - 1; i >= 1; i...
#include <bits/stdc++.h> using namespace std; const signed long long INF = 1000000100; const long double EPS = 1e-9; const long double Pi = 2 * atanl(1.0); template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p) { return os << ( << p.first << , << p.second << ) ; }...
// ---------------------------------------------------------------------- // Copyright (c) 2016, The Regents of the University of California All // rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met:...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 22:09:44 06/18/2014 // Design Name: washing_machine // Module Name: F:/ISE/work/final_exp/washing_machine/washing_machine_test.v // Project Name: washing_machine // ...
#include <bits/stdc++.h> using namespace std; int main() { int n, p1, p2; cin >> n; cin >> p1; int a1[p1]; for (int i = 0; i < p1; i++) cin >> a1[i]; cin >> p2; int a2[p2]; for (int i = 0; i < p2; i++) cin >> a2[i]; sort(a1, a1 + p1); sort(a2, a2 + p2); vector<int>::itera...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; struct Point { double x, y; Point(double x = 0, double y = 0) : x(x), y(y) {} Point operator+(Point b) { return Point(x + b.x, y + b.y); } Point operator-(Point b) { return Point(x - b.x, y - b.y); } double operator^(Point b) { return x * b.y - y * b...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, x, y, z; cin >> a >> b >> c >> x >> y >> z; int ans; if ((a == 0 && b == 0 && c) || (x == 0 && y == 0 && z)) { ans = 0; } else if (a * y == b * x) { if (a * z == c * x && b * z == c * y) { ans = -1; ...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
// Accellera Standard V2.5 Open Verification Library (OVL). // Accellera Copyright (c) 2005-2010. All rights reserved. //------------------------------------------------------------------------------ // SHARED CODE //------------------------------------------------------------------------------ // No shared code for ...
`timescale 1 ns / 1 ps `include "vga_axi_buffer_v1_0_tb_include.vh" // lite_response Type Defines `define RESPONSE_OKAY 2'b00 `define RESPONSE_EXOKAY 2'b01 `define RESP_BUS_WIDTH 2 `define BURST_TYPE_INCR 2'b01 `define BURST_TYPE_WRAP 2'b10 // AMBA AXI4 Lite Range Constants `define SAXI_MAX_BURST_LENGTH 1 `define...
/* * Copyright (c) 2000 Guy Hutchison () * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU * General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) * ...
// // Module: DRAM16XN // // Description: Distributed SelectRAM example // Dual Port 16 x N-bit // // Device: Spartan-3 Family //--------------------------------------------------------------------------------------- module DRAM16XN #(parameter data_width = 20) ( DATA_IN, ...
/* * Copyright 2012, Homer Hsing <> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to ...
// fir8dec.v: 8x FIR decimator with TDM I/Q I/O // 07-17-16 E. Brombaugh module fir8dec #( parameter isz = 16, // input data size osz = 16, // output data size psz = 8, // pointer size csz = 16, // coeff data size clen = 246, ...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
#include <bits/stdc++.h> using namespace std; using lint = long long; using pint = pair<int, int>; using plint = pair<lint, lint>; struct fast_ios { fast_ios() { cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(20); }; } fast_ios_; template <typename T, ...
#include <bits/stdc++.h> using namespace std; int T, n, m, sum, tot; struct P { int val, x, y; } a[500]; struct R { int x, y; } b[10]; bool cmp1(const P& a, const P& b) { return a.val > b.val; } bool cmp2(const R& a, const R& b) { return a.y > b.y; } bool Judge(int i, int j, int k, int u) { ...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 09:12:26 11/03/2014 // Design Name: // Module Name: spi_bonus // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // ...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; int a[11][5]; bool ok(int l, int j, int k) { int i, an = 0; for (i = 0; i < 5; i++) { an = an + (a[j][i] - a[l][i]) * (a[k][i] - a[l][i]); } if (an > 0) return false; return true; } int main() { ios::sync_with_stdio(false); int i,...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
#include <bits/stdc++.h> using namespace std; int main() { int n, count1 = 0, count2 = 0, sum = 0; scanf( %d , &n); vector<pair<int, int> > v1; vector<pair<int, int> > v2; for (int i = 0; i < n; i++) { int x, a; scanf( %d %d , &x, &a); if (x < 0) { v1.push_back(make_pai...
module wildcard_tcam #( parameter CMP_WIDTH = 32, parameter DEPTH = 32, parameter DEPTH_BITS = 5, parameter ENCODE = 0, parameter CURRENT_TABLE_ID = 0 )( input clk, input reset, input [CMP_WIDTH - 1 : 0] cmp_din, output ...
//----------------------------------------------------------------------------- //-- Secuenciador de 4 estados usando un multiplexor de 4 a 1 //-- (C) BQ. August 2015. Written by Juan Gonzalez (obijuan) //----------------------------------------------------------------------------- //-- License GPL //------------------...
#include <bits/stdc++.h> using namespace std; int N; pair<int, int> a[200002 + 1]; int min(int a, int b) { return a > b ? b : a; } int abs(int a) { return a < 0 ? -a : a; } int main() { cin >> N; N *= 2; int b; for (int i = 0; i < N; i++) { cin >> b; a[i] = {b, i}; } sort...
#include <bits/stdc++.h> using namespace std; const int maxsize = 100; int n, m; bool visited[maxsize][maxsize]; string v, h; int go[][2] = {1, 0, -1, 0, 0, -1, 0, 1}; map<char, int> dir; int cnt; void dfs(int row, int col) { if (visited[row][col]) return; visited[row][col] = true; cnt++; ...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; int a[4] = {1, 2, 3, 5}; int main(void) { int n, k; scanf( %d%d , &n, &k); printf( %d n , (5 + 6 * (n - 1)) * k); for (int i = 0; i < n; i++) { printf( %d %d %d %d n , (a[0] + 6 * i) * k, (a[1] + 6 * i) * k, (a[2] + 6 * i) * k, (a[3]...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
`include "../network_params.h" module rect_linear_tb; reg clock; reg reset; reg [`NN_BITWIDTH:0] rect_in; wire [`NN_BITWIDTH:0] rect_out; rect_linear dut( .clock(clock), .reset(reset), .rect_in(rect_in), .rect_out(rect_out) ); initial begin clock = 1'b0; reset = 1'b0; rect_in = 1'b0; end always ...
/* SD card interface $0 RW - RDY|XXX|XXX|XXX|XXX|XXX|XXX|SS0 $1 RW - DATA $2 RW - PRESCALER RDY - R- IO ready SS0 - select SPI device 0 */ module sdcardio ( input wire clk, input wire rst, input wire [2:0] AD, input wire [7:0] DI, output reg [7:0] DO, input wire rw, input wire cs, // o...
`timescale 1ns / 1ns /* verilator lint_off INITIALDLY */ /////////////////////////////////// // MulA /////////////////////////////////// module MulA( input wire sysclock, input wire [31:0] inputMulA, output reg [63:0] product ); initial begin product <= 64'd0; end always @ (posedge sysclock) begin p...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
//ÊýÂë¹Ü¼Æ·ÖÄ£¿é module Seg_Display ( input clk, input rst, input add_cube, inout [1:0]game_status, output reg[15:0]point, output reg[7:0]seg_out, output reg[3:0]sel ); localparam RESTART = 2'b00; reg[31:0]clk_cnt; always@(posedge clk or posedge rst) begin if(!rst) begin seg_out <= ...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2003 by Wilson Snyder. module t (clk); input clk; reg [7:0] a,b; wire [7:0] z; mytop u0 ( a, b, clk, z ); integer cyc; initial cyc=1; always @ (posedge clk) be...
#include <bits/stdc++.h> using namespace std; long long dp[2]; void solve() { long long n; cin >> n; for (int i = 0; i < n; i++) { dp[i % 2] = dp[i % 2] + dp[!(i % 2)] + 1; if (dp[i % 2] > 1000000007) dp[i % 2] %= 1000000007; } cout << (dp[0] + dp[1] + 1000000007) % (1000000007); ...