text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; int A[5005], n, k, L[5005][5005], S[5005], E[5005]; void doc() { scanf( %d%d , &n, &k); for (int i = 1; i <= n; i++) { scanf( %d , &A[i]); } } void xuly() { sort(A + 1, A + n + 1); for (int i = 1; i <= n; i++) { S[i] = 1; E[i]... |
#include<bits/stdc++.h> using namespace std; #define ll long long int #define M 1000000007 int main() { ios_base::sync_with_stdio(false); cin.tie(0),cout.tie(0); int t,n,x; cin>>t; string str= 2020 ; while(t--) { int a,b,c,d,e,c1,c2,c3; cin>>... |
// megafunction wizard: %LPM_MULT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: lpm_mult
// ============================================================
// File Name: sa1_mult.v
// Megafunction Name(s):
// lpm_mult
//
// Simulation Library Files(s):
// lpm
// ============================================... |
#include <bits/stdc++.h> using namespace std; const int N = 1e4 + 5, mod = 1e9 + 9, bit = 61, sq = 1000; const int T = (100001 + sq - 1) / sq; vector<int> lucky; bool isl[N] = {0}; int bid[100005], a[100005], beg[T], en[T], lazy[T] = {0}; int fq[T][N]; void create() { for (int d = 1; d <= 4; d++) { ... |
#include <bits/stdc++.h> using namespace std; const long long remi = 1000000007; const long long remi2 = 998244353; const long long inf = 1e18 + 1e17 + 1e16 + 1e15 + 1e14; long long Pow(long long x, long long y, long long m) { if (y == 0) return 1; long long p = Pow(x, y / 2, m) % m; p = (p * p) %... |
// We assume clock with frequency F = 100 Hz or period T = 10 ms
`timescale 1ms/1us
module trafficlight_controller_tb;
// Inputs
reg clk;
reg rst;
// outputs
wire light1_green;
wire light1_red;
wire light1_yellow;
wire light2_green;
wire light2_red;
wire light2_yellow;
// Consta... |
#include <bits/stdc++.h> using namespace std; template <typename T> inline bool chkmin(T &x, T y) { return y < x ? x = y, 1 : 0; } template <typename T> inline bool chkmax(T &x, T y) { return x < y ? x = y, 1 : 0; } const int INF = 0x3f3f3f3f; const int N = 2e3 + 10, mod = 1e9 + 7; int dir[4... |
module fmrv32im_alu
(
input RST_N,
input CLK,
input INST_ADDI,
input INST_SLTI,
input INST_SLTIU,
input INST_XORI,
input INST_ORI,
input INST_ANDI,
input INST_SLLI,
input INST_SRLI,
input INST_SRAI,
input INST_ADD,
input INST_... |
module ControlUnit (output reg IR_CU, RFLOAD, PCLOAD, SRLOAD, SRENABLED, ALUSTORE, MFA, WORD_BYTE,READ_WRITE,IRLOAD,MBRLOAD,MBRSTORE,MARLOAD,output reg[4:0] opcode, output reg[3:0] CU, input MFC, Reset,Clk, input [31:0] IR,input [3:0] SR);
reg [4:0] State, NextState;
task registerTask;
input [17:0] signals;
//6 7 8 ... |
#include <bits/stdc++.h> using namespace std; const int INF = (int)1e9; int a, c; int arrA[2000]; int arrC[2000]; void sol() { cin >> c >> a; for (int i = 0; i < c; i++) { cin >> arrC[i]; } for (int i = 0; i < a; i++) { cin >> arrA[i]; } int result = 0; int j = 0; ... |
`include "defines.v"
`timescale 1ns/1ps
module tb(
input `control_w port0_ci,
input `data_w port0_di,
output `control_w port0_co,
output `data_w port0_do,
input `control_w port1_ci,
input `data_w port1_di,
output `control_w port1_co,
output `data_w port1_do,
input `control_w port2... |
//load_store station is for load-store instruction, they will be issued in order
//dispatch: p_rs, p_rt, immed, p_rd, some control signals
//issue: if the head is ready, issue it
//complete: receive <PR_rd#, RegDest_compl> from CDB, set the valid bit
module ls_station(
input clk, rst,
//from dispatch st... |
/**
* 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 Header Begin ==========================================
//
// OpenSPARC T1 Processor File: pcx_monitor.v
// Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
//
// The above named program is free software; you can redistribute it and/o... |
// Copyright (c) 2016 CERN
// Maciej Suminski <>
//
// 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)
// any late... |
/**
* 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 la... |
#include <bits/stdc++.h> using namespace std; double r1, x, A, B, p1, p2, ans, t, y[5002], z[5002], r2; int n, m, k; int main() { cin >> n; for (int i = 1; i <= n; i++) { cin >> x; r1 = (((r1) > (x)) ? (r1) : (x)); } cin >> m; for (int i = 1; i <= m; i++) cin >> y[i]; cin >> ... |
/**
* 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... |
//#############################################################################
//# Function: Carry Save Adder (3:2) #
//#############################################################################
//# Author: Andreas Olofsson #
... |
#include <bits/stdc++.h> using namespace std; int main() { int a, b; cin >> a >> b; if (b > a) { swap(a, b); } cout << b << ; int r = a - b; cout << r / 2; return 0; } |
#include <bits/stdc++.h> #pragma GCC target( avx2 ) #pragma GCC optimize( Ofast ) #pragma GCC optimize( unroll-loops ) using namespace std; template <class T, class U> ostream &operator<<(ostream &os, const pair<T, U> &p) { os << ( << p.first << , << p.second << ) ; return os; } template <c... |
#include<bits/stdc++.h> using namespace std; typedef unsigned long long int ull; typedef long long int ll; typedef long double ld; #define PB push_back #define MP make_pair #define F first #define S second #define Pair vector<pair<ll,ll>> #define vec vector <ll> #define all(a) a.begin... |
`timescale 10ns/10ns
module frame_buffer_tb();
// Declare inputs as regs and outputs as wires
reg clk;
reg [15:0] write_address;
reg [15:0] data_in;
reg load;
reg [10:0] vga_h;
reg [10:0] vga_v;
wire pixel_out;
frame_buffer U0(
.clk(clk),
.write_address(write_addre... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n, k; cin >> n >> k; for (int i = 0; i < k; i++) { if (n % 10 > 0) { n--; } else n /= 10; } cout << n; return 0; } |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2017.4
// Copyright (C) 1986-2017 Xilinx, Inc. All Rights Reserved.
//
// ==============================================================
`timescale 1ns/1ps
... |
#include <bits/stdc++.h> using namespace std; const long long maxm = 3e5 + 5; const long long mod = 998244353; long long fac[maxm], inv[maxm]; long long l[maxm], r[maxm]; pair<long long, long long> p[25]; long long sum[maxm][45]; long long num[maxm]; long long n, m; long long ppow(long long a, long ... |
#include <bits/stdc++.h> using namespace std; template <class TH> void _dbg(const char *sdbg, TH h) { cerr << sdbg << = << h << endl; } template <class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) { while (*sdbg != , ) cerr << *sdbg++; cerr << = << h << , ; _dbg(sdbg + 1... |
#include <bits/stdc++.h> using namespace std; int tt; string input; int main() { cin >> tt; for (int qq = 1; qq <= tt; qq++) { cin >> input; int count[250] = {}; for (char c : input) count[c - a ]++; int diff = 0; for (int i = 0; i < 250; i++) { if (count[i] > 0) d... |
//--------------------------------------------------------------------------
// --
// OneWireMaster --
// A synthesizable 1-wire master peripheral --
// Copyrig... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 105; const double EPS = 1e-9; int n, k; double e; int px0, py0; int x[MAXN], y[MAXN]; double dp[MAXN][2]; double dist(int x1, int y1, int x2, int y2) { return sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2)); } double prob(int ind, double r... |
#include <bits/stdc++.h> using namespace std; int a[1005]; int main() { int n, maxp, mx2p; scanf( %d , &n); for (register int i = 1; i <= n; ++i) { scanf( %d , a + i); } if (a[1] > a[2]) { maxp = 1; mx2p = 2; } else { maxp = 2; mx2p = 1; } for (registe... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10, mod = 1e9 + 7, L = 20; vector<int> G[N], g[N]; int h[N], x[5 * N], y[5 * N], par[N][L]; map<int, bool> mp[N]; void dfs(int v, int p) { par[v][0] = p; for (int i = 1; i < L; i++) par[v][i] = par[par[v][i - 1]][i - 1]; for (int ... |
#include <bits/stdc++.h> using namespace std; void solve() { long long n, x; cin >> n >> x; string second; cin >> second; long long ans = 0; long long sm = 0; for (long long i = 0; i < n; i++) { if (second[i] == 0 ) sm++; else sm--; } long long c = 0;... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n, m; cin >> n >> m; if (n * m % 2 == 1) cout << n * m / 2 + 1 << endl; else cout << n * m / 2 << endl; } } |
// (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; long long MOD = int(1e9) + 7; int debug = 0; const int N = int(2e3) + 5; using namespace std; int a[N], b[N], p[N]; int main() { int i, j, n, t; ios::sync_with_stdio(false); cin >> n; for (i = 0; i < n; i++) cin >> a[i]; for (i = 0; i < n; ... |
// ============================================================================
// Copyright (c) 2010
// ============================================================================
//
// Permission:
//
//
//
// Disclaimer:
//
// This VHDL/Verilog or C/C++ source code is intended as a design reference
// which... |
module GPIO_Board_test(CLOCK_50, GPIO0_D);
input CLOCK_50;
output [31:0] GPIO0_D;
wire [31:0]count;
count_32bit counter1(CLOCK_50, count);
wire GPIO_clock;
assign GPIO_clock = CLOCK_50;
wire [15:0]R0, R1, R2, R3, R4, R5, R6, R7;
assign R0 = {count[31:24], count[31:24]};
assign R1 = {count[31:... |
//-----------------------------------------------------------------
// RISC-V Top
// V0.6
// Ultra-Embedded.com
// Copyright 2014-2019
//
//
//
// License: BSD
//--------------------------... |
//pipeBreakU -- Breaks the instruction pipeline down into individual output wires.
//This should also significantly clean up the main CPU code.
module pipeBreakU(
OS1,
OS2,
OS3,
OS4,
OS5,
op1,
op2,
op3,
op4,
op5,
aSel2,
aSel3,
aSel4,
bSel2,
bSel3,
bSel4,
cSel2,
cSel3,
cSel4,
lite... |
#include <bits/stdc++.h> int main() { int x, y, a, b, cnt = 0; scanf( %d%d%d%d , &x, &y, &a, &b); for (int i = a; i <= x; i++) for (int j = b; j <= y && j < i; j++) cnt++; printf( %d n , cnt); for (int i = a; i <= x; i++) for (int j = b; j <= y && j < i; j++) printf( %d %d n , i, j); ... |
/**
* 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... |
//==============================================================================
// File: $URL: svn+ssh:///public/Projects/GateLib/branches/dev/Publications/Tutorials/Publications/EECS150/Labs/ChipScopeSerial/Framework/IORegister.v $
// Version: $Revision: 26904 $
// Author: Greg Gibeling (http://www.gdgib.com)
// Co... |
#include <bits/stdc++.h> int pos = 1 << 17; char buf[1 << 17]; inline char nextch() { if (pos == 1 << 17) fread(buf, 1 << 17, 1, stdin), pos = 0; return buf[pos++]; } inline int read() { char ch; while (!isdigit(ch = nextch())) ; int x = ch - 0 ; while (isdigit(ch = nextch())) x... |
#include <bits/stdc++.h> using namespace std; #pragma warning(disable : 4996) #pragma comment(linker, /STACK:16777216 ) #pragma warning(disable : 4996) #pragma comment(linker, /STACK:16777216 ) #pragma GCC optimize( Ofast ) #pragma GCC target( avx,avx2,fma ) const int inf = 2e9; const long long linf... |
#include <bits/stdc++.h> using namespace std; int main() { int sizePermute, sizebkp, x, minimum = 100, maximum = 0, maximumIndex, minimumIndex, counter = 0; cin >> sizePermute; sizebkp = sizePermute; vector<int> myvec(sizePermute); myvec.clear(); while (sizeP... |
/**
* 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[200005]; bool got[200004], gave[200004]; queue<int> q; int main() { int n; cin >> n; for (int i = 1; i <= n; i++) { cin >> a[i]; got[a[i]] = 1; if (a[i] != 0) { gave[i] = 1; } } for (int i = 1; i <= n; 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 law... |
/*
* Handshake between two clock domains made from 6 FF's in a circle where
* a single edge travels around as an enable "token". If you see the token,
* you may write/sample data on a parallel bus of signals.
*
* (C) Arlet Ottens
*/
module handshake(
input clka, // clock domain A
output sync_a, // vali... |
module booth(x,y,p);
input [7:0] x,y;
output [15:0] p;
wire [7:0] i,j,k,l,n,o,q,r;
wire [9:0] sp,tp,fop;
wire [7:0] fp;
wire [3:0] one,two,sign;
wire [10:0] c1,c2;
wire [8:0] ip1,ip2;
wire [9:0] c3;
wire [11:0] m;
wire [3:0] cry,z;
// carry generation
// 1st
xor n9(z[0],one[0],two[0]);
and n10(cry[0],z[0],sign[0]);
//2... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: sparc_exu_eclbyplog.v
// Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
//
// The above named program is free software; you can redistribute ... |
#include <bits/stdc++.h> using namespace std; const long long LLINF = 1ll << 60; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout << setprecision(25); int T; cin >> T; while (T--) { int n; cin >> n; string s; cin >> s; int cnt = 1; ... |
#include <bits/stdc++.h> using namespace std; template <class L, class R> ostream &operator<<(ostream &os, map<L, R> P) { for (auto const &vv : P) os << ( << vv.first << , << vv.second << ) ; return os; } template <class T> ostream &operator<<(ostream &os, set<T> V) { os << [ ; for (au... |
#include <bits/stdc++.h> using namespace std; template <class T> T abs(T x) { if (x < 0) return -x; return x; } template <class T> T sqr(T a) { return a * a; } const double pi = acos(-1.0); const double eps = 1e-8; int a[100010]; int a1[100010]; int a2[100010]; int b; int ar[1000... |
#include <bits/stdc++.h> using namespace std; template <class c> struct rge { c b, e; }; template <class c> rge<c> range(c i, c j) { return rge<c>{i, j}; } template <class c> auto dud(c* x) -> decltype(cerr << *x, 0); template <class c> char dud(...); struct debug { template <class c... |
#include <bits/stdc++.h> using namespace std; const int mod = 1000000009; map<pair<int, int>, int> in, id; set<int> S; int X[100010], Y[100010]; bool check(pair<int, int> P) { int x = P.first, y = P.second + 1; for (int dx = x - 1; dx <= x + 1; dx++) { if (in.count(make_pair(dx, y)) && in[make... |
/*
* Milkymist VJ SoC
* Copyright (C) 2007, 2008, 2009, 2010 Sebastien Bourdeauducq
*
* 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 Foundation, version 3 of the License.
*
* This program is distri... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; int a[100001], l = 1; for (int i = 1; i <= n; i++) { int c, t; cin >> c >> t; int x = c * t; a[l] = c * t; l++; } int d = 1, s = 0; for (int i = 0; i < m; i++) { int k;... |
//-----------------------------------------------------------------------------
//
// (c) Copyright 2009-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... |
//==================================================================================================
// Filename : FSM_input_enable.v
// Created On : 2016-10-04 09:10:38
// Last Modified : 2016-10-04 09:45:50
// Revision :
// Author : Jorge Sequeira Rojas
// Company : Instituto Tecnologi... |
// diseño de una fifo ciclica, para implementar en cada bloque de proyecto
// ferney alberto beltran 2016 electrónica digital 1 universidad Nacional
module fifo
#(
parameter adr_width = 4,
parameter dat_width = 8
)
(
input clk, reset,
input rd, wr,
input [dat_width-1:0] data_in,... |
/*******************************************************************************
* This file is owned and controlled by Xilinx and must be used solely *
* for design, simulation, implementation and creation of design files *
* limited to Xilinx devices or technologies. Use with non-Xilinx ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 111111; long long tree[maxn * 4]; void Insert(int o, int l, int r, int k, int v) { if (l == r) { tree[o] = v; return; } int mid = (l + r) >> 1; if (k <= mid) Insert(o * 2, l, mid, k, v); else Insert(o * 2 ... |
// ----------------------------------------------------------------------
// Copyright (c) 2015, 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:... |
#include <bits/stdc++.h> using namespace std; const long double pi = acos(-1); const long long inf = 1LL << 30; const double eps = 1e-9; const long long mod = 1e9 + 7; const int N = 100100; pair<int, pair<int, int>> a[N]; int seg[N << 2], lazy[N << 2]; ; int ans[N]; int dp[N]; void push(int nd, ... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2009 by Iztok Jeras.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
localparam NO = 10; // number of access events
// pack... |
#include <bits/stdc++.h> using namespace std; int mx[4005], need[4005]; int n, l[4005], r[4005], a[4005]; bool inter(int i, int j) { if (l[i] >= l[j] && l[i] <= r[j]) return 1; if (r[i] >= l[j] && r[i] <= r[j]) return 1; if (l[j] >= l[i] && l[j] <= r[i]) return 1; if (r[j] >= r[i] && r[j] <= r[i... |
#include <bits/stdc++.h> struct M { int p, b; }; struct F { const int p, i; int r; int c; F(int p, int t, int i) : p(p), i(i), r(p + t), c(0) {} int t() { return r - p; } }; void solve(std::vector<F> &fs, std::vector<M> &ms) { std::multimap<int, int> ms_landed; std::map<int, F ... |
module x;
reg [31:0] mb_reg_output;
// 16 registers max, register 15 is always the version number, so 15 are useable
// NOTE: number_interface_regs must be the maximum (or 16 in this case) to get the version register
parameter NUMBER_I... |
#include <bits/stdc++.h> using namespace std; int n, a[500005], b[500005]; char s[500005]; int res = 1e9, xx, yy; int calc2(int x, int y) { if (x == 0 && y == 0) return 1000000000; int ans = 0; for (int i = 1; i <= n; i++) { if (x <= a[i] && y <= b[i]) ans = max(ans, max(a[i] - x, b[... |
#include <bits/stdc++.h> using namespace std; long long int power(long long int first, long long int n) { if (n == 0) return 1; else if (n % 2 == 0) { long long int second = power(first, n / 2); return second * second; } else return first * power(first, n - 1); } int strTOint... |
/*
* 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 peripheral_bt(clk , rst , d_in , cs , addr , rd , wr, d_out, uart_tx, clk_uart );
input clk;
input rst;
input [15:0]d_in;
input cs;
input [3:0]addr; // 4 LSB from j1_io_addr
input rd;
input wr;
output reg [15:0]d_out;
output clk_uart;
output uart_tx;
//----------------------------------... |
#include <bits/stdc++.h> using namespace std; int main() { string s; int st = 0; cin >> s; int cnt[4] = {0}; for (int i = 0; i < s.size(); i++) { if ( 1 <= s[i] && s[i] <= 3 ) { ++cnt[s[i] - 0 ]; } } for (int i = 1; i <= 3; i++) { for (int j = 0; j < cnt[i]; ... |
// megafunction wizard: %FIFO%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: scfifo
// ============================================================
// File Name: fifo_85x256.v
// Megafunction Name(s):
// scfifo
//
// Simulation Library Files(s):
// altera_mf
// ===========================================... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016
// Date : Sun Jan 22 23:54:24 2017
// Host : TheMosass-PC running 64-bit major release ... |
module deserializer(
clk, //serialized data proper clock
enable, //suspend while enable on low
reset, //set output to zero and reset counter to 0 on high
framesize, //number of bits to be deserialized
in, //serialized data
out, //deserialized data
complete //reset counter to 0 and hold out's data while... |
`timescale 1ns / 1ps
module rx_DS_SE_tb();
reg d, s;
reg rxClk, rxReset;
wire [1:0] dq;
wire dqValid;
rx_DS_SE dut(
.d(d),
.s(s),
.rxClk(rxClk),
.rxReset(rxReset),
.dq(dq),
.dqValid(dqValid)
);
task assert_dqvalid;
input [7:0] story;
input expected;
begin
if(dqValid !== expected) begin
... |
#include <bits/stdc++.h> using namespace std; vector<long long> v; long long a, b, f, k; int cnt() { int c = 0; int n = v.size(); long long now = 0; for (int i = 0; i < n; i++) { if (now + b < v[i]) return -1; while (i < n && now + b >= v[i]) i++; i--; c++; now = 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... |
/*
-----------------------------------------------------------------------------
General Sound
-----------------------------------------------------------------------------
18.08.2018 Reworked first verilog version
19.08.2018 Produce proper signed output
20.08.2018 Use external SDR/DDR RAM for page 2 a... |
#include <bits/stdc++.h> using namespace std; bool row[1100], col[1100]; int main() { int n, m; while (scanf( %d %d , &n, &m) != EOF) { memset(row, true, sizeof(row)); memset(col, true, sizeof(col)); while (m--) { int x, y; scanf( %d %d , &x, &y); row[x] = false; ... |
// Module m_ckt_jno is the circuit which handles the JNO or
// "jump if not overflow" instruction. When JNO is called, the
// status register is checked for an overflow of the program
// register. If the program register has not overflowed, the
// program counter will increment by 1, and the following value
// held in ... |
// (C) 1992-2014 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 simulati... |
/*
* Titor - System - Remote Controlled Servo Controller
* Copyright (C) 2012,2013 Sean Ryan Moore
*
* 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 Foundation, either version 3 of the Lice... |
#include <bits/stdc++.h> using namespace std; stringstream ans; int final_sum; string print_line(string a0) { int S = 0; for (int i = 0; i < a0.size() - 1; i++) { int digit = a0[i] - 0 ; S += digit; ans << digit << + ; } int digit = a0[a0.size() - 1] - 0 ; S += digit; ... |
/**
* 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... |
// soc_system_mm_interconnect_0_avalon_st_adapter_001.v
// This file was auto-generated from altera_avalon_st_adapter_hw.tcl. If you edit it your changes
// will probably be lost.
//
// Generated using ACDS version 16.0 211
`timescale 1 ps / 1 ps
module soc_system_mm_interconnect_0_avalon_st_adapter_001 #(
parame... |
/*
Copyright (c) 2014 Alex Forencich
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 without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute,... |
#include <bits/stdc++.h> using namespace std; int memo[500][26][26]; int son[500][26][26]; int cambios[500][26][26]; vector<string> A; int m, n; void solve(int x, int y, int z) { for (int row = 0; row < x; row++) for (int a = 0; a < y; a++) for (int b = 0; b < z; b++) { int &re... |
#include <bits/stdc++.h> using namespace std; string s[100] = { 111111101010101111100101001111111 , 100000100000000001010110001000001 , 101110100110110000011010001011101 , 101110101011001001111101001011101 , 101110101100011000111100101011101 , 100000101010101011010000101000001 , 11111... |
#include <bits/stdc++.h> using namespace std; const long long int mod = 1e9 + 7; int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); long long int n, c[100005], dp[100005][2], i, j; cin >> n; string s[100005], rs[100005]; for (i = 1; i <= n; i++) cin >> c[i]; ... |
#include <bits/stdc++.h> using namespace std; const int N = 3e5 + 2; int n, m, a[N], cnt[N], nxt[N]; bool vis[N]; int main() { int test; cin >> test; while (test--) { cin >> n >> m; for (int i = 0; i <= n; ++i) cnt[i] = 0; for (int i = 1; i <= n; ++i) { cin >> a[i]; ... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; const int dy[] = {-1, 1, 0, 0}; const int dx[] = {0, 0, -1, 1}; int n, m; string s[1010]; int L[1010][1010]; int R[1010][1010]; int U[1010][1010]; int D[1010][1010]; int usedX[1010][1010], usedY[1010]... |
/*
Copyright (c) 2016-2018 Alex Forencich
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 without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distri... |
#include <bits/stdc++.h> using namespace std; int n; int a[300010]; long long ans = 0; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n; for (int i = 1; i <= n; ++i) { cin >> a[i]; } sort(a + 1, a + 1 + n); for (int i = 1; i <= n / 2; ++i) { long long sum... |
#include <bits/stdc++.h> using namespace std; long long f[1200]; long long mod = 1000000007; int arr[1100]; long long pw(long long x, long long sum) { long long res = 1, power = sum, val = x; while (power) { if (power & 1) { res *= val; res %= mod; } val *= val; ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.